Skip to content

Commit

Permalink
[hotfix] migrate coin v1 and fix the order of emitting
Browse files Browse the repository at this point in the history
  • Loading branch information
lightmark committed May 1, 2024
1 parent 27b9c6a commit 8562b7c
Show file tree
Hide file tree
Showing 9 changed files with 807 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ processed 8 tasks

task 1 'run'. lines 6-8:
Events:
{
type: 0x3::token::CreateCollection
data: "f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb60b6170746f735f70756e6b7300006400000000000000"
}
{
key: 0400000000000000f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6
seq_num: 0
Expand All @@ -10,24 +14,36 @@ Events:
}
{
type: 0x1::transaction_fee::FeeStatement
data: "64000000000000000400000000000000020000000000000028720100000000000000000000000000"
data: "65000000000000000400000000000000030000000000000028720100000000000000000000000000"
}mutable inputs after call: local#0: 0
return values: 0

task 2 'run'. lines 9-9:
Events:
{
type: 0x3::token::CreateTokenData
data: "f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb60b6170746f735f70756e6b730a6765656b5f746f6b656e00640000000000000000f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6010000000000000000000000000000000a6765656b5f746f6b656e0000000000000000"
}
{
key: 0500000000000000f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6
seq_num: 0
type: 0x3::token::CreateTokenDataEvent
data: "f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb60b6170746f735f70756e6b730a6765656b5f746f6b656e00640000000000000000f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6010000000000000000000000000000000a6765656b5f746f6b656e0000000000000000"
}
{
type: 0x3::token::MintToken
data: "f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb60b6170746f735f70756e6b730a6765656b5f746f6b656e0a00000000000000"
}
{
key: 0600000000000000f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6
seq_num: 0
type: 0x3::token::MintTokenEvent
data: "f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb60b6170746f735f70756e6b730a6765656b5f746f6b656e0a00000000000000"
}
{
type: 0x3::token::Deposit
data: "f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb60b6170746f735f70756e6b730a6765656b5f746f6b656e00000000000000000a00000000000000"
}
{
key: 0700000000000000f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6
seq_num: 0
Expand All @@ -36,7 +52,7 @@ Events:
}
{
type: 0x1::transaction_fee::FeeStatement
data: "9b0000000000000006000000000000000300000000000000c83a0200000000000000000000000000"
data: "9c0000000000000007000000000000000400000000000000c83a0200000000000000000000000000"
}mutable inputs after call: local#0: 0
return values: 0

Expand Down Expand Up @@ -82,12 +98,20 @@ task 4 'view_table'. lines 13-15:

task 5 'run'. lines 16-18:
Events:
{
type: 0x3::token::Withdraw
data: "f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb60b6170746f735f70756e6b730a6765656b5f746f6b656e00000000000000000100000000000000"
}
{
key: 0800000000000000f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6
seq_num: 0
type: 0x3::token::WithdrawEvent
data: "f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb60b6170746f735f70756e6b730a6765656b5f746f6b656e00000000000000000100000000000000"
}
{
type: 0x3::token_transfers::TokenOffer
data: "9c3b634ac05d0af393e0f93b9b19b61e7cac1c519f566276aa0c6fd15dac12aaf75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb60b6170746f735f70756e6b730a6765656b5f746f6b656e00000000000000000100000000000000"
}
{
key: 0b00000000000000f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6
seq_num: 0
Expand All @@ -96,18 +120,26 @@ Events:
}
{
type: 0x1::transaction_fee::FeeStatement
data: "6b000000000000000500000000000000030000000000000018820100000000000000000000000000"
data: "6c000000000000000600000000000000040000000000000018820100000000000000000000000000"
}mutable inputs after call: local#0: 0
return values: 0

task 6 'run'. lines 19-19:
Events:
{
type: 0x3::token::Deposit
data: "f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb60b6170746f735f70756e6b730a6765656b5f746f6b656e00000000000000000100000000000000"
}
{
key: 04000000000000009c3b634ac05d0af393e0f93b9b19b61e7cac1c519f566276aa0c6fd15dac12aa
seq_num: 0
type: 0x3::token::DepositEvent
data: "f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb60b6170746f735f70756e6b730a6765656b5f746f6b656e00000000000000000100000000000000"
}
{
type: 0x3::token_transfers::TokenClaim
data: "9c3b634ac05d0af393e0f93b9b19b61e7cac1c519f566276aa0c6fd15dac12aaf75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb60b6170746f735f70756e6b730a6765656b5f746f6b656e00000000000000000100000000000000"
}
{
key: 0d00000000000000f75daa73fc071f93593335eb9033da804777eb94491650dd3f095ce6f778acb6
seq_num: 0
Expand All @@ -116,7 +148,7 @@ Events:
}
{
type: 0x1::transaction_fee::FeeStatement
data: "6b0000000000000005000000000000000300000000000000b88201000000000058bb000000000000"
data: "6c0000000000000006000000000000000400000000000000b88201000000000058bb000000000000"
}mutable inputs after call: local#0: 0
return values: 0

Expand Down
10 changes: 10 additions & 0 deletions aptos-move/framework/aptos-framework/doc/multisig_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -3196,6 +3196,16 @@ This function is private so no other code can call this beside the VM itself as
<b>let</b> (num_approvals, _) = <a href="multisig_account.md#0x1_multisig_account_remove_executed_transaction">remove_executed_transaction</a>(multisig_account_resource);

<b>if</b>(<a href="../../aptos-stdlib/../move-stdlib/doc/features.md#0x1_features_multisig_v2_enhancement_feature_enabled">features::multisig_v2_enhancement_feature_enabled</a>() && implicit_approval) {
<b>if</b> (std::features::module_event_migration_enabled()) {
emit(
<a href="multisig_account.md#0x1_multisig_account_Vote">Vote</a> {
<a href="multisig_account.md#0x1_multisig_account">multisig_account</a>,
owner: executor,
sequence_number,
approved: <b>true</b>,
}
);
};
num_approvals = num_approvals + 1;
emit_event(
&<b>mut</b> multisig_account_resource.vote_events,
Expand Down
13 changes: 6 additions & 7 deletions aptos-move/framework/aptos-framework/doc/reconfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,20 +421,19 @@ Signal validators to start using new configuration. Must be called from friend c
};
config_ref.epoch = config_ref.epoch + 1;

<a href="event.md#0x1_event_emit_event">event::emit_event</a>&lt;<a href="reconfiguration.md#0x1_reconfiguration_NewEpochEvent">NewEpochEvent</a>&gt;(
&<b>mut</b> config_ref.events,
<a href="reconfiguration.md#0x1_reconfiguration_NewEpochEvent">NewEpochEvent</a> {
epoch: config_ref.epoch,
},
);

<b>if</b> (std::features::module_event_migration_enabled()) {
<a href="event.md#0x1_event_emit">event::emit</a>(
<a href="reconfiguration.md#0x1_reconfiguration_NewEpoch">NewEpoch</a> {
epoch: config_ref.epoch,
},
);
};
<a href="event.md#0x1_event_emit_event">event::emit_event</a>&lt;<a href="reconfiguration.md#0x1_reconfiguration_NewEpochEvent">NewEpochEvent</a>&gt;(
&<b>mut</b> config_ref.events,
<a href="reconfiguration.md#0x1_reconfiguration_NewEpochEvent">NewEpochEvent</a> {
epoch: config_ref.epoch,
},
);

<a href="reconfiguration_state.md#0x1_reconfiguration_state_on_reconfig_finish">reconfiguration_state::on_reconfig_finish</a>();
}
Expand Down
10 changes: 10 additions & 0 deletions aptos-move/framework/aptos-framework/sources/multisig_account.move
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,16 @@ module aptos_framework::multisig_account {
let (num_approvals, _) = remove_executed_transaction(multisig_account_resource);

if(features::multisig_v2_enhancement_feature_enabled() && implicit_approval) {
if (std::features::module_event_migration_enabled()) {
emit(
Vote {
multisig_account,
owner: executor,
sequence_number,
approved: true,
}
);
};
num_approvals = num_approvals + 1;
emit_event(
&mut multisig_account_resource.vote_events,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,19 @@ module aptos_framework::reconfiguration {
};
config_ref.epoch = config_ref.epoch + 1;

event::emit_event<NewEpochEvent>(
&mut config_ref.events,
NewEpochEvent {
epoch: config_ref.epoch,
},
);

if (std::features::module_event_migration_enabled()) {
event::emit(
NewEpoch {
epoch: config_ref.epoch,
},
);
};
event::emit_event<NewEpochEvent>(
&mut config_ref.events,
NewEpochEvent {
epoch: config_ref.epoch,
},
);

reconfiguration_state::on_reconfig_finish();
}
Expand Down
Loading

0 comments on commit 8562b7c

Please sign in to comment.