fix: prevent sentinel tx replays#392
Open
matthias-wright wants to merge 2 commits into
Open
Conversation
Contributor
|
Implements comprehensive sentinel transaction validation with replay protection for ops authentication. Phase 2
Phase 3
LGTM with the clippy annotations needed above. The sentinel validation logic is comprehensive with proper authentication, replay protection, and expiration handling. Tests correctly use Seismic chain specs and timestamp multipliers. |
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.
Hardens the sentinel transaction introduced in #369 against replay attacks.
apply_sentinel_actionnow runs these five checks in order:validator_idmatches the validator's current per-process session idrecent_block_hashis on this validator's canonical chain, andexpires_at_block − reference ≤ 256(matches EVMBLOCKHASHlookback)expires_at_blocktry_advance_admin_nonce(envelope.nonce)— strict-greater, so out-of-order delivery silently drops stale payloads instead of blocking later onesvalidator_idis 32 random bytes minted byWhitelist::new(); both it andadmin_noncelive in memory only and reset on restart. A freshvalidator_idinvalidates any in-flight captured payload from the previous incarnation, so resettingadmin_nonce = 0after restart is safe.The nonce advance is intentionally placed after the action-specific
expires_atcheck, so a governance typo doesn't burn a nonce and force a refetch + re-sign.Governance can't sign anything until it knows the live
validator_idand the currentadmin_nonce. Two new unauthenticated read endpoints on the ops server expose them:ops_getValidatorId→B256ops_getAdminNonce→u64The middleware bypasses auth for these two method names.
This is the shim contract that represents the ABI: