Skip to content

Fix capability key-rotation skipping the offerer's Account write - #53

Open
sausagee wants to merge 3 commits into
mainfrom
cursor/fix-capability-rotation-account-skip-ee89
Open

Fix capability key-rotation skipping the offerer's Account write#53
sausagee wants to merge 3 commits into
mainfrom
cursor/fix-capability-rotation-account-skip-ee89

Conversation

@sausagee

@sausagee sausagee commented Sep 6, 2026

Copy link
Copy Markdown

Bug

account_restoration treats every Account write as belonging to the transaction sender. That is wrong for 0x1::account::rotate_authentication_key_with_rotation_capability.

On chain, the delegate sender only bumps their own sequence number. The offerer's Account.authentication_key is what actually changes. The processor:

  1. skipped the offerer's Account write (sender != account_address)
  2. still treated the entry function as a sender rotation, so the delegate was stored as the rotated account
  3. attached KeyRotationToPublicKey public keys to the sender's auth key

The checkpoint still advanced, so the offerer's new auth-key mapping was permanently missing from auth_key_account_addresses.

This is not covered by PRs #16#52 (those do not touch capability-rotation Account selection).

Root cause

The sender-only filter was meant to ignore incidental Account writes (for example account creation inside a multi-key transaction). Combined with listing rotate_authentication_key_with_rotation_capability as a sender self-rotation, it inverted the capability-rotation mapping.

Fix

  • Index a non-sender Account write only when auth_key != account_address (the offerer after capability rotation).
  • Do not treat the capability-rotation entry function as a sender self-rotation.
  • Bind KeyRotationToPublicKey public keys to the event's new auth key, not the sender.

Self-rotation, unverified rotation, and multi-key sender indexing are unchanged.

Tests

Unit tests in account_restoration_processor_helpers.rs cover:

  • capability rotation indexes the offerer and not the delegate
  • self-rotation still indexes the sender
  • multi-key txns do not index a newly created recipient
  • unverified rotation still marks the sender unused
  • event-derived public keys bind to the offerer auth key
Open in Web Open in Cursor 

cursoragent and others added 2 commits September 6, 2026 13:52
rotate_authentication_key_with_rotation_capability writes the offerer's
Account, not the delegate sender. The sender-only filter dropped that
mapping, then treated the delegate as the rotated account. Index the
offerer when auth_key != address, and bind KeyRotationToPublicKey
public keys to the event's new auth key.

Co-authored-by: Young Yang Liauw <sausagee@users.noreply.github.com>
ROTATE_AUTH_KEY_WITH_CAPABILITY is only referenced by unit tests. Keep
it in the test module so clippy -D warnings stays clean.

Co-authored-by: Young Yang Liauw <sausagee@users.noreply.github.com>
@sausagee
sausagee marked this pull request as ready for review September 6, 2026 14:01
@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.
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