Skip to content

feat(v2): add admin rotation - #144

Merged
collinsezedike merged 2 commits into
drydocs:mainfrom
dimin4241-svg:feat/issue-129-v2-admin-rotation
Sep 4, 2026
Merged

feat(v2): add admin rotation#144
collinsezedike merged 2 commits into
drydocs:mainfrom
dimin4241-svg:feat/issue-129-v2-admin-rotation

Conversation

@dimin4241-svg

@dimin4241-svg dimin4241-svg commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the same direct, current-admin-authorized set_admin mechanism to Tholos v2. Rotation takes effect immediately, emits AdminUpdated, and changes only who may invoke existing admin controls; pinned assertion policy and economics are unaffected. The v2 administration design documentation is updated.

Closes #129

Test plan

  • cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test pass locally (make check)
  • CONTRACT.md updated if the public interface changed — not applicable because it documents v1; V2_RESOLUTION.md is updated instead
  • Fresh v2 WASM was built, deployed to testnet, and initialized from this branch
  • Manually rotated the fresh deployment, confirmed the old admin was rejected by set_paused_v2, and confirmed the new admin was accepted

Comment thread contracts/tholos-v2/src/lib.rs Outdated
env.storage().instance().set(&DataKey::Admin, &new_admin);
env.storage()
.instance()
.extend_ttl(INSTANCE_LIFETIME_THRESHOLD, INSTANCE_BUMP_AMOUNT);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set_admin extends instance-storage TTL, but the existing set_paused_v2 doesn't. If set_admin is the only admin-initiated instance-storage-touching call over a long stretch, the instance entry still risks TTL expiration since set_paused_v2 never extends it. Consider fixing this at the shared level (a helper both functions call) rather than only in the function this PR adds.

Comment thread docs/src/V2_RESOLUTION.md
assertions. The admin cannot insert a voter, remove one, alter weight, or change a
pinned policy.

The admin address itself can be rotated through `set_admin(new_admin)`. The call

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This note explains set_admin's semantics, but docs/src/DEPLOYMENT.md's separate Admin runbook section (Pausing during an incident, Rotating the resolver committee) has no equivalent step-by-step example for rotating the admin key. An operator following that runbook during an incident has no set_admin invocation example to copy, unlike pause and resolver rotation. Please add one there too.

@dimin4241-svg
dimin4241-svg force-pushed the feat/issue-129-v2-admin-rotation branch from 514233d to fec3633 Compare September 4, 2026 16:40
@dimin4241-svg

Copy link
Copy Markdown
Contributor Author

Addressed both review points in commit fec3633:

  • set_paused_v2 now shares the instance-TTL renewal helper with initialize/set_admin, with a regression test covering both admin state-changing calls near expiry.
  • Added a concrete set_admin invocation to the Admin runbook and clarified that the handoff is immediate.

cargo test -p tholos-v2 passes: 112 tests.

@collinsezedike collinsezedike left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dimin4241-svg thank you for the contribution. This looks good, there is nothing to flag.

@collinsezedike
collinsezedike merged commit dbfe36d into drydocs:main Sep 4, 2026
4 checks passed
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.

[Feature] No admin rotation/recovery path in tholos-v2

2 participants