-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[module events] update token events and switch v1 with v2 #14432
Conversation
⏱️ 1h 20m total CI duration on this PR
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #14432 +/- ##
=========================================
- Coverage 59.8% 59.8% -0.1%
=========================================
Files 852 852
Lines 207730 207730
=========================================
- Hits 124346 124336 -10
- Misses 83384 83394 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
a465e7b
to
ff30778
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that there is no corresponding v2 event for the 0x1::account::CoinRegisterEvent
. Can we add one for that?
ff30778
to
00fca21
Compare
type_info: type_info::type_of<CoinType>(), | ||
}, | ||
); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good example of avoiding double-emission. I believe the migration of the other core V2 events should follow a similar approach.
00fca21
to
50054c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still several places where double-emitting will happen. Could you update those, too?
@@ -669,7 +733,7 @@ module aptos_token::token { | |||
let Token { id: _, amount: burned_amount, token_properties: _ } = withdraw_token(owner, token_id, amount); | |||
let token_store = borrow_global_mut<TokenStore>(signer::address_of(owner)); | |||
if (std::features::module_event_migration_enabled()) { | |||
event::emit(BurnToken { id: token_id, amount: burned_amount }); | |||
event::emit(Burn { account: signer::address_of(owner), id: token_id, amount: burned_amount }); | |||
}; | |||
event::emit_event<BurnTokenEvent>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will double emit.
@@ -600,7 +664,7 @@ module aptos_token::token { | |||
let Token { id: _, amount: burned_amount, token_properties: _ } = withdraw_with_event_internal(owner, token_id, amount); | |||
let token_store = borrow_global_mut<TokenStore>(owner); | |||
if (std::features::module_event_migration_enabled()) { | |||
event::emit(BurnToken { id: token_id, amount: burned_amount }); | |||
event::emit(Burn { account: owner, id: token_id, amount: burned_amount }); | |||
}; | |||
event::emit_event<BurnTokenEvent>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will double emit.
@@ -892,7 +956,8 @@ module aptos_token::token { | |||
direct_deposit(token_owner, new_token); | |||
update_token_property_internal(token_owner, new_token_id, keys, values, types); | |||
if (std::features::module_event_migration_enabled()) { | |||
event::emit(MutateTokenPropertyMap { | |||
event::emit(MutatePropertyMap { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will double emit.
@@ -126,7 +129,8 @@ module aptos_token::token_transfers { | |||
|
|||
if (std::features::module_event_migration_enabled()) { | |||
event::emit( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will double emit.
50054c5
to
d527334
Compare
020dac5
to
bf89257
Compare
@@ -416,7 +416,7 @@ fn is_reconfiguration(vm_output: &TransactionOutput) -> bool { | |||
vm_output | |||
.events() | |||
.iter() | |||
.any(|event| event.event_key() == Some(&new_epoch_event_key)) | |||
.any(|event| event.type_tag() == || event.event_key() == Some(&new_epoch_event_key)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intended or by mistake? Anyway, this would give a syntax error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good to me.
However, this minor issue (https://github.com/aptos-labs/aptos-core/pull/14432/files#r1807194788) and the CI test error need to be addressed.
bf89257
to
c54794e
Compare
7721e7d
to
fc7fcdc
Compare
8de9c3f
to
a8fa2da
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
7e9214e
to
f0bf11e
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
f0bf11e
to
63f1d2a
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
} else { | ||
let events = borrow_global_mut<GovernanceEvents>(@aptos_framework); | ||
event::emit_event<CreateProposalEvent>( | ||
&mut events.create_proposal_events, | ||
CreateProposalEvent { | ||
proposal_id, | ||
proposer: proposer_address, | ||
stake_pool, | ||
execution_hash, | ||
proposal_metadata, | ||
}, | ||
); | ||
}; | ||
let events = borrow_global_mut<GovernanceEvents>(@aptos_framework); | ||
event::emit_event<CreateProposalEvent>( | ||
&mut events.create_proposal_events, | ||
CreateProposalEvent { | ||
proposal_id, | ||
proposer: proposer_address, | ||
stake_pool, | ||
execution_hash, | ||
proposal_metadata, | ||
}, | ||
); | ||
proposal_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GovernanceEvents nv1 not emitted any more?
Description
omitted some fields. add them.
Type of Change
Which Components or Systems Does This Change Impact?
How Has This Been Tested?
Key Areas to Review
Checklist