Skip to content

Refactor Aptos Framework Events with Module Events

AIP-71 - Refactor Aptos Framework Events with Module Events

Section titled “AIP-71 - Refactor Aptos Framework Events with Module Events”

This AIP proposes a migration plan for all handle events (event v1) in Aptos Framework to module events (event v2) and adding new events. To facilitate a seamless migration process, this AIP also introduces the event v2 translation engine, which is a temporary REST Node API path to support the event v1 queries even after the event migration is enabled.

  • Migrate all existing events to module events with minimal impact on downstream customized indexer as soon as possible.
  • Piggyback new useful new module events to the migration change.

AIP-44 introduced module events and explained the motivation and the advantages over the old event with EventHandle. Given its superiority, it is favorable to migrate all the events in Aptos Framework to module events. The major benefits are:

  • Module Event does not need event handle.
  • Module Event supports parallel execution.
  • Module event is easier to index.

Also, when migrating, it is a good opportunity to add new useful events in the same framework upgrade.

The successful migration will make events easier to use for Aptos Move developers and indexer builders. Also, for normal users, the module events will be easier for them to understand and use because the current form is more similar to the syntax of Solidity.

The alternative solution is just change all the events to module events directly. This will immediately break all the dApps not updated before the changes are available on mainnet.

The default migration strategy:

  • Create new struct T2 with #[event] for an event type and add an event::emit<T2>() call by each event::emit_event<T1>()

Migrated Events

ModuleEvent v1 NameEvent v2 NameABI update
account.moveKeyRotationEventKeyRotation+account:address
aptos_account.moveDirectCoinTransferConfigUpdatedEventDirectCoinTransferConfigUpdated+ account:address
object.moveTransferEventTransfer
aptos_governance.moveCreateProposalEventCreateProposal
aptos_governance.moveVoteEventVote
aptos_governance.moveUpdateConfigEventUpdateConfig
block.moveUpdateEpochIntervalEventUpdateEpochInterval
aptos-token-objects/token.moveMutationEventMutation+ token:address
aptos-token-objects/collection.moveMutationEventMutation+ collection:address
aptos-token-objects/collection.moveBurnEventBurn+ previous_owner
aptos-token-objects/collection.moveMintEventMint+ collection:address
multisig_account.moveAddOwnersEventAddOwners+ account: address
multisig_account.moveRemoveOwnersEventRemoveOwners+ account: address
multisig_account.moveUpdateSignaturesRequiredEventUpdateSignaturesRequired+ account: address
multisig_account.moveCreateTransactionEventCreateTransaction+ account: address
multisig_account.moveVoteEventVote+ account: address
multisig_account.moveExecuteRejectedTransactionEventExecuteRejectedTransaction+ account: address
multisig_account.moveTransactionExecutionSucceededEventTransactionExecutionSucceeded+ account: address
multisig_account.moveTransactionExecutionFailedEventTransactionExecutionFailed+ account: address
multisig_account.moveMetadataUpdatedEventMetadataUpdated+ account: address
reconfiguration.moveNewEpochEventNewEpoch
stake.moveRegisterValidatorCandidateEventRegisterValidatorCandidate
stake.moveSetOperatorEventSetOperator
stake.moveAddStakeEventAddStake
stake.moveReactivateStakeEventReactivateStake
stake.moveRotateConsensusKeyEventRotateConsensusKey
stake.moveUpdateNetworkAndFullnodeAddressesEventUpdateNetworkAndFullnodeAddresses
stake.moveIncreaseLockupEventIncreaseLockup
stake.moveJoinValidatorSetEventJoinValidatorSet
stake.moveDistributeRewardsEventDistributeRewards
stake.moveUnlockStakeEventUnlockStake
stake.moveWithdrawStakeEventWithdrawStake
stake.moveLeaveValidatorSetEventLeaveValidatorSet
staking_contract.moveUpdateCommissionEventUpdateCommission
staking_contract.moveCreateStakingContractEventCreateStakingContract
staking_contract.moveUpdateVoterEventUpdateVoter
staking_contract.moveResetLockupEventResetLockup
staking_contract.moveAddStakeEventAddStake
staking_contract.moveRequestCommissionEventRequestCommission
staking_contract.moveUnlockStakeEventUnlockStake
staking_contract.moveSwitchOperatorEventSwitchOperator
staking_contract.moveAddDistributionEventAddDistribution
staking_contract.moveDistributeEventDistribute
staking_contract.moveSwitchOperatorEventSwitchOperator
vesting.moveCreateVestingContractEventCreateVestingContract
vesting.moveUpdateOperatorEventUpdateOperator
vesting.moveUpdateVoterEventUpdateVoter
vesting.moveResetLockupEventResetLockup
vesting.moveSetBeneficiaryEventSetBeneficiary
vesting.moveUnlockRewardsEventUnlockRewards
vesting.moveVestEventVest
vesting.moveDistributeEventDistribute
vesting.moveTerminateEventTerminate
vesting.moveAdminWithdrawEventAdminWithdraw
voting.moveCreateProposalEventCreateProposal
voting.moveRegisterForumEventRegisterForum
voting.moveVoteEventVote
voting.moveResolveProposal
token_event_store.moveCollectionDescriptionMutateEventCollectionDescriptionMutate
token_event_store.moveCollectionUriMutateEventCollectionUriMutate
token_event_store.moveCollectionMaxiumMutateEventCollectionMaxiumMutate
token_event_store.moveOptInTransferEventOptInTransfer
token_event_store.moveUriMutationEventUriMutation
token_event_store.moveDefaultPropertyMutateEventDefaultPropertyMutate
token_event_store.moveDescriptionMutateEventDescriptionMutate
token_event_store.moveRoyaltyMutateEventRoyaltyMutate
token_event_store.moveMaxiumMutateEventMaximumMutate
token.moveDepositEventTokenDeposit+ account: address
token.moveWithdrawEventTokenWithdraw+ account: address
token.moveCreateTokenDataEventTokenDataCreation+ creator: address
token.moveMintTokenEventMint+ creator: address
token.moveBurnTokenEventBurn+ account: address
token.moveMutateTokenPropertyMapEventMutatePropertyMap+ account: address
  • The Coin module will undergo maintenance and be migrated to the FA standard. Coin events will be silently replaced by fungible asset events.
  • NewBlockEvent will remain as v1.
  • Both NewEpochEvent and NewEpoch will be emitted.

https://github.com/aptos-labs/aptos-core/pull/10532

https://github.com/aptos-labs/aptos-core/pull/11688

Event v2 translation: https://github.com/aptos-labs/aptos-core/pull/14615

During the migration,

  • Double emitting both v1 and v2 events would cause 5% - 10% regression on blockchain performance.
  • Related transactions that involve framework modules double emitting events would expect a 5%-15% gas increase.

The migration period will take 3-6 months depending on the progress of the transition to module event streams. After that, a new AIP may be necessary to remove all old events.

already done

Suggested developer platform support timeline

Section titled “Suggested developer platform support timeline”

before release 1.11 to mainnet.

End of Q1 to testnet and then to mainnet.

See Risks and Drawbacks