Skip to content

Fix TokenMutation V2 from_address and event type mapping - #49

Open
sausagee wants to merge 3 commits into
mainfrom
cursor/fix-token-mutation-from-address-f3df
Open

Fix TokenMutation V2 from_address and event type mapping#49
sausagee wants to merge 3 commits into
mainfrom
cursor/fix-token-mutation-from-address-f3df

Conversation

@sausagee

@sausagee sausagee commented Sep 6, 2026

Copy link
Copy Markdown

Bug

0x4::token::Mutation (V2 module event) writes a corrupted token_activities_v2 row:

  1. from_address is set to inner.token_address — the token object being mutated, not the account that submitted the mutation.
  2. type_ is hardcoded to 0x4::collection::MutationEvent — a collection event type — instead of 0x4::token::MutationEvent.

Account-scoped activity feeds then attribute the mutation to an object ID, and type filters mix token mutations with collection events.

Root cause

Sibling TokenMutationEvent (0x4::token::MutationEvent) already documents the intended rule (from_address = txn sender) and keeps type_ as 0x4::token::MutationEvent. The module-event branch copied the Mint/Burn remap pattern but used the collection module name and filled from_address from the event’s object field.

This is not covered by open PRs #16#48.

Fix

  • Set from_address to the transaction sender (same as TokenMutationEvent).
  • Remap 0x4::token::Mutation0x4::token::MutationEvent so both event styles share one type.

Tests

  • cargo test -p processor --lib token_mutation_v2_uses_sender_not_token_address — pass
  • cargo clippy -p processor --lib --tests -- -D warnings — pass
Open in Web Open in Cursor 

0x4::token::Mutation stored the token object as from_address and
relabeled the row as 0x4::collection::MutationEvent. Use the txn
sender (same as MutationEvent) and remap to 0x4::token::MutationEvent.

Co-authored-by: Young Yang Liauw <sausagee@users.noreply.github.com>
@sausagee
sausagee marked this pull request as ready for review September 6, 2026 12:49
@sausagee
sausagee changed the base branch from main to fix/lint-stable-xclippy September 7, 2026 22:19
@sausagee
sausagee changed the base branch from fix/lint-stable-xclippy to main September 7, 2026 22:30
Stack the CI unblocker files from PR #70 (stable cargo xclippy, bookworm Dockerfiles with make) onto this bugfix branch so CI can go green while #70 awaits review. Merge target remains main; this does not merge #70.
CI Lint: apply cargo +nightly fmt so rustfmt --check passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants