Fix capability key-rotation skipping the offerer's Account write - #53
Open
sausagee wants to merge 3 commits into
Open
Fix capability key-rotation skipping the offerer's Account write#53sausagee wants to merge 3 commits into
sausagee wants to merge 3 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
account_restorationtreats everyAccountwrite as belonging to the transaction sender. That is wrong for0x1::account::rotate_authentication_key_with_rotation_capability.On chain, the delegate sender only bumps their own sequence number. The offerer's
Account.authentication_keyis what actually changes. The processor:Accountwrite (sender != account_address)KeyRotationToPublicKeypublic keys to the sender's auth keyThe 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_capabilityas a sender self-rotation, it inverted the capability-rotation mapping.Fix
Accountwrite only whenauth_key != account_address(the offerer after capability rotation).KeyRotationToPublicKeypublic 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.rscover: