Skip to content
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

[event_v2] indexer logic update to handle migration #360

Merged
merged 2 commits into from
May 16, 2024

Conversation

lightmark
Copy link
Contributor

@lightmark lightmark commented May 1, 2024

PR description

In this PR we add event v2 migration indexing support.

PRs to handle:

  1. [event v2] double emitting in account, coin, fungible asset and object and migrate move-examples aptos-core#10532
  2. [event_v2] migrate the rest files in aptos-framework aptos-core#11688
  3. [event_migration] migrate token v1 and other fixes of event v2 migration aptos-core#13147

Events to migrate

  • V1 + V2: means dedupe is required
  • only V1 or V2: means no dedupe is required due to no double emission.
Module Event Name Migration Note
account KeyRotation not indexed
aptos_account DirectCoinTransferConfigUpdated not indexed
coin Deposit only V1 or V2; not both
Withdraw only V1 or V2; not both
fungible_asset Deposit only V1 or V2; not both
Withdraw only V1 or V2; not both
Frozen only V1 or V2; not both
object Transfer V1 + V2
aptos_governance CreateProposal not indexed
Vote V1 + V2
UpdateConfig not indexed
block NewBlock not indexed
UpdateEpochInterval not indexed
multisig_account -- all events -- not indexed
reconfiguration NewEpoch not indexed
stake RegisterValidatorCandidate not indexed
SetOperator not indexed
AddStake V1 + V2
ReactivateStakeEvent not indexed
RotateConsensusKey not indexed
UpdateNetworkAndFullnodeAddresses not indexed
IncreaseLockup not indexed
JoinValidatorSet not indexed
DistributeRewards V1 + V2
UnlockStake not indexed
WithdrawStake not indexed
LeaveValidatorSet not indexed
staking_contract -- all events -- not indexed
vesting -- all events -- not indexed
voting -- all events -- not indexed
token Mutation V1 + V2
token_event_store -- all events -- not indexed
token_transfers -- all events -- not indexed

Notes

An example for event v2 migration.

whether a new field would be added can be seen here:
https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-71.md
But the ground truth is in the code. Please verify.

@lightmark lightmark force-pushed the lightmark/event_v2_migrate_example branch 4 times, most recently from b6fcdc7 to 107707c Compare May 1, 2024 17:07
@@ -16,3 +18,8 @@ pub mod token_models;
pub mod token_v2_models;
pub mod transaction_metadata_model;
pub mod user_transactions_models;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if v1 name is "XXXEvent" then v2 name is always "XXX" or "XXX<YYY..." and emitted just before v1 so if the preceding event exists and matches the name we will dedup/skip the current v1.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can you add this as a comment in the code, and make a note that it's for events v2 migration?

@lightmark lightmark force-pushed the lightmark/event_v2_migrate_example branch from 107707c to 5716a93 Compare May 1, 2024 17:17
@larry-aptos larry-aptos force-pushed the lightmark/event_v2_migrate_example branch from 5716a93 to b42a35d Compare May 3, 2024 22:23
@larry-aptos larry-aptos changed the title [event_v2] an example code for event v2 migration [event_v2] indexer logic update to handle migration May 6, 2024
@larry-aptos larry-aptos force-pushed the lightmark/event_v2_migrate_example branch from 0e42f40 to b5a0bb1 Compare May 15, 2024 00:01
Comment on lines 146 to 147
event.type_str != "0x3::token::DepositEvent"
and event.type_str != "0x3::token::Deposit"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since these are used in multiple places, would be good to make them a constant

@larry-aptos larry-aptos force-pushed the lightmark/event_v2_migrate_example branch from 446be63 to 15a7fc9 Compare May 15, 2024 22:35
@larry-aptos larry-aptos merged commit 3551f40 into main May 16, 2024
7 checks passed
@larry-aptos larry-aptos deleted the lightmark/event_v2_migrate_example branch May 16, 2024 00:12
larry-aptos added a commit that referenced this pull request May 22, 2024
larry-aptos added a commit that referenced this pull request May 22, 2024
lightmark added a commit that referenced this pull request May 24, 2024
* [event_v2] an example code for event v2 migration

* event v2 indexing.

---------

Co-authored-by: Larry Liu <[email protected]>
lightmark added a commit that referenced this pull request Jul 15, 2024
* [event_v2] an example code for event v2 migration

* event v2 indexing.

---------

Co-authored-by: Larry Liu <[email protected]>
lightmark added a commit that referenced this pull request Oct 30, 2024
* [event_v2] an example code for event v2 migration

* event v2 indexing.

---------

Co-authored-by: Larry Liu <[email protected]>
lightmark added a commit that referenced this pull request Nov 12, 2024
* [event_v2] an example code for event v2 migration

* event v2 indexing.

---------

Co-authored-by: Larry Liu <[email protected]>
lightmark added a commit that referenced this pull request Nov 12, 2024
* [event_v2] an example code for event v2 migration

* event v2 indexing.

---------

Co-authored-by: Larry Liu <[email protected]>
lightmark added a commit that referenced this pull request Nov 13, 2024
* [event_v2] an example code for event v2 migration

* event v2 indexing.

---------

Co-authored-by: Larry Liu <[email protected]>
lightmark added a commit that referenced this pull request Nov 21, 2024
* [event_v2] an example code for event v2 migration

* event v2 indexing.

---------

Co-authored-by: Larry Liu <[email protected]>
lightmark added a commit that referenced this pull request Nov 27, 2024
* [event_v2] an example code for event v2 migration

* event v2 indexing.

---------

Co-authored-by: Larry Liu <[email protected]>
lightmark added a commit that referenced this pull request Dec 5, 2024
* [event_v2] an example code for event v2 migration

* event v2 indexing.

---------

Co-authored-by: Larry Liu <[email protected]>
lightmark added a commit that referenced this pull request Dec 5, 2024
* [event_v2] an example code for event v2 migration

* event v2 indexing.

---------

Co-authored-by: Larry Liu <[email protected]>
lightmark added a commit that referenced this pull request Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants