Skip to content

feat(v1): add admin rotation - #145

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

feat(v1): add admin rotation#145
collinsezedike merged 3 commits into
drydocs:mainfrom
dimin4241-svg:feat/issue-128-admin-rotation

Conversation

@dimin4241-svg

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

Copy link
Copy Markdown
Contributor

Summary

Adds a direct, current-admin-authorized set_admin entrypoint for Tholos v1. Rotation takes effect immediately, emits AdminUpdated, and keeps the instance TTL alive. The public contract docs and generated TypeScript client are updated; bond and resolver economics are unchanged.

Closes #128

Test plan

  • cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test pass locally (make check)
  • CONTRACT.md updated for the new public function and event
  • scripts/testnet-smoke.sh passed against a fresh testnet deployment built from this branch
  • Manually rotated the fresh deployment, confirmed the old admin was rejected by set_paused, and confirmed the new admin was accepted
  • Regenerated and built packages/tholos-sdk

@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.

This branch also shows as conflicting with main right now, that'll need a rebase separately from the finding below.

Comment thread contracts/tholos/src/lib.rs Outdated
old_admin.require_auth();
Self::touch_instance_ttl(&env);

env.storage().instance().set(&DataKey::Admin, &new_admin);

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 is an irreversible one-step admin transfer with no acceptance step from new_admin. If old_admin calls this with a mistyped, unreachable, or otherwise uncontrolled address, the write happens immediately and permanently replaces the only admin key. Since set_paused, update_resolvers, set_bond_amount, and set_admin itself all gate on this single stored address with no recovery path, one bad call locks out every admin-only capability forever. A two-step transfer, propose_admin plus accept_admin requiring new_admin's own authorization, would let the new key confirm control before old_admin's authority is dropped.

@dimin4241-svg
dimin4241-svg force-pushed the feat/issue-128-admin-rotation branch from bbfc89c to 28dd4fb Compare September 4, 2026 16:51
@dimin4241-svg

Copy link
Copy Markdown
Contributor Author

Implemented the safer two-step admin rotation and rebased onto current main in commits 862205c and 28dd4fb:

  • propose_admin(new_admin) is authorized by the current admin and stores a pending proposal.
  • accept_admin() requires the proposed admin's authorization before changing authority; the pending proposal is then cleared and AdminUpdated is emitted.
  • Added regression coverage for rejected arbitrary/old-admin acceptance and post-rotation authority, plus updated the contract docs and regenerated TypeScript bindings.

cargo test -p tholos passes: 77 tests; cargo fmt --all -- --check and pnpm install --frozen-lockfile && pnpm build for packages/tholos-sdk also pass.

@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 7d73e6e 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 v1

2 participants