Repository navigation
feat(multisig): implement signer rotation and threshold updates with approval invalidation (#197) - #321
Open
Dimank92 wants to merge 1 commit into
Conversation
…approval invalidation (Zenith-options#197)
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.
Summary
Resolves #197 by implementing admin-gated signer rotation (
add_signer,add_signer_weighted,remove_signer,remove_signer_and_set_threshold) and threshold update (set_threshold) entrypoints with O(1) approval invalidation via monotonic signer epoch bumping.Scope & Architecture Implementation
Self-Administered Admin Entrypoints:
add_signer(caller, signer)&add_signer_weighted(caller, signer, weight): Adds a new signer with validation (1 <= total_weight, bounded byMAX_SIGNERS, rejects duplicate signers).remove_signer(caller, signer): Removes an existing signer. Rejects removal withError::InvalidThresholdif the remaining count or total weight falls below the threshold.set_threshold(caller, threshold): Updates approval threshold. Validates1 <= threshold <= signer_countandthreshold <= total_weight, updatingRotationThresholdinvariant.remove_signer_and_set_threshold(caller, signer, new_threshold): Atomically lowers threshold and removes a signer in a single step so operations requiring simultaneously lower threshold succeed without bricking.caller == env.current_contract_address() && caller.require_auth(). Direct calls by single signers outsideexecuteare rejected withError::DirectAdminCall(Code 34).Self-Call Proposal Dispatch in
execute:execute_self_callto handle proposals targetingcurrent_contract_address(), bypassing Soroban's re-entrancy restriction while enforcing full proposal verification and quorum threshold.Approval Invalidation via Signer Epoch Bumping:
DataKey::SignerEpoch.approvals_keyis keyed byDataKey::Approvals(epoch, action_id), bumpingSignerEpochinvalidates all outstanding approvals in O(1) time across both persistent and temporary storage.signers_rotatedwith the new epoch, resulting signer set, threshold, and rotation threshold.Testing & Verification:
rotation_happy_path_via_proposal: End-to-endadd_signer->remove_signer->set_thresholdvia approved proposals.epoch_bump_invalidates_in_flight_pending_approvals: Verifies that approvals cast in an earlier epoch do not carry over and cannot execute after a rotation.threshold_bounds_rejection: Rejects 0 and threshold > count.denial_of_configuration_change_below_threshold: Rejects execution of configuration changes without threshold approvals (NotYetApproved).removing_signer_dropping_count_below_threshold_rejected_unless_threshold_lowered: Ensures removal that drops count below threshold reverts unless threshold is atomically lowered.direct_admin_calls_by_individual_signers_rejected: Direct invocations reject withError::DirectAdminCall.94 passed; 0 failed).Payout Wallet (Base / Polygon / EVM):
0xC345C07229307d4f1c7935aD2cAe48e390215808