feat(v1): add admin rotation - #145
Conversation
collinsezedike
left a comment
There was a problem hiding this comment.
This branch also shows as conflicting with main right now, that'll need a rebase separately from the finding below.
| old_admin.require_auth(); | ||
| Self::touch_instance_ttl(&env); | ||
|
|
||
| env.storage().instance().set(&DataKey::Admin, &new_admin); |
There was a problem hiding this comment.
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.
bbfc89c to
28dd4fb
Compare
|
Implemented the safer two-step admin rotation and rebased onto current main in commits
|
collinsezedike
left a comment
There was a problem hiding this comment.
@dimin4241-svg thank you for the contribution. This looks good, there is nothing to flag.
Summary
Adds a direct, current-admin-authorized
set_adminentrypoint for Tholos v1. Rotation takes effect immediately, emitsAdminUpdated, 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, andcargo testpass locally (make check)CONTRACT.mdupdated for the new public function and eventscripts/testnet-smoke.shpassed against a fresh testnet deployment built from this branchset_paused, and confirmed the new admin was acceptedpackages/tholos-sdk