feat(admin): config epoch serialization and retry contract for privileged operations - #1299
Merged
Baskarayelu merged 1 commit intoAug 29, 2026
Conversation
Adds a monotonic ConfigEpoch to the Admin contract that advances exactly once per committed privileged mutation (admin roles, suspension, ownership transfer, pause config, pause state transitions, and pause proposal approvals) and exposes get_config_epoch() so clients can detect concurrent conflicts and retry against fresh state. Rejected, stale, repeated, and failed operations never advance the epoch and leave no partial state: same-role role updates, duplicate pause/unpause, duplicate proposal approvals, and stale proposal executions are idempotent no-ops. Documented in docs/CONFIG_EPOCH.md and covered by test_concurrency_race_safety.rs. Closes CredenceOrg#1297
|
@nasirudeenbadirudeen87-cloud Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Closed
8 tasks
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.
Description
Implements the concurrency / race-safety contract for the Admin contract's privileged configuration, pause, and ownership operations (issue #1297).
ConfigEpoch: every committed privileged mutation advances the counter exactly once (add_admin,remove_admin,update_admin_role,deactivate_admin,reactivate_admin,suspend_admin,transfer_ownership,accept_ownership,set_pause_signer,set_pause_threshold,pause,unpause,approve_pause_proposal,execute_pause_proposal).get_config_epoch(): clients read it alongside the governance state they depend on, detect concurrent conflicts (epoch advanced), and retry against fresh state. The client retry contract is explicit in the module docs anddocs/CONFIG_EPOCH.md.update_admin_role, duplicatepause/unpause, duplicate proposal approvals, and re-proposing an already-proposed-and-approved action are now no-ops — no state change, no events, no epoch bump.Regression coverage
contracts/admin/src/test_concurrency_race_safety.rs(7 tests) locks the invariant at the integration boundary (generated contract client): exactly-once epoch advancement per committed mutation, auth-rejection atomicity, insufficient-approval atomicity (proposal stays live), idempotent repeats, conflict detection + retry, last-writer-wins ownership transfer, and paused-rejection atomicity.Closes #1297
Type of Change
How Has This Been Tested?
cargo fmtclean on all touched filescargo test -p admin— blocked locally: this machine lacks Xcode Command Line Tools (/Library/Developer/CommandLineTools missing), so Cargo cannot link build scripts (serde/proc-macro2). CI (contract workflow: fmt, clippy -D warnings, cargo test) runs on the PR; I can fix anything CI flags.Checklist
get_config_epochentrypoint,docs/CONFIG_EPOCH.md, module docs)CHANGELOG.mdupdated (contracts/**touched)fix/issue-1297naming convention