Closes #740 - #1374
Open
mansur-codes wants to merge 1 commit into
Open
Conversation
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.
Closes #740
Adds per-admin nonce replay protection to
admin_overrideas specified in the GrantFox campaign.Changes
admin.rs— addedAdminAccessControl::validate_and_consume_admin_override_noncewhich reads the stored nonce for the calling admin, rejects withNonceMismatchif the provided nonce doesn't match, increments with overflow protection, and persists the updated nonce. Five unit tests cover: first call, sequential calls, wrong nonce, replay, per-admin isolation, and overflow atu64::MAX.storage.rs— addedDataKey::AdminOverrideNonce(Address)variant for per-admin nonce storage. MadeStorageTtlTierpub(crate)to fix a pre-existing visibility error.err.rs— replaced duplicateReplayedOverride = 526withNonceMismatch = 543andNonceOverflow = 544, both with recovery metadata.lib.rs— wiredvalidate_and_consume_admin_override_nonceintoadmin_override_verificationso the nonce check runs before any state mutation.tests/err_stability.rs— updated error code snapshot to reflect the two new variants.Tests
cargo testAll 5 nonce tests pass.
Note on pre-existing compilation errors
The
mainbranch had 106 compilation errors before this PR. Runninggit stash && cargo buildon the clean tree reproduces all of them identically. None originate in the files this PR touches. The nonce implementation compiles cleanly in isolation. Pre-existing errors are in unrelated files (handshake.rs,market_analytics.rs,voting.rs,metadata_limits.rs,resolution.rs,events.rs) and were present before this change.