core: implement multi-sig admin for critical operations#36
Open
Oluwatos94 wants to merge 1 commit into
Open
Conversation
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.
Pull Request
Closes #15
Description
Implements multi-signature governance for the protocol's critical operations.
Previously all five contracts relied on a single admin key compromise of that
key would expose the protocol to drainage. This adds an N-of-M proposal system
to the
parameters-contractso that critical operations require multipledistinct approvals, time-bound to a 7-day window.
Scope is the core
parameters-contract(the "core:" deliverable in #15). Wiringthe other contracts'
upgrade()functions into this committee is left tofollow-up issues.
Type of Change
Changes Made
configure_multisig(signers, threshold); admin-onlybootstrap, callable exactly once. Afterwards the committee can only be changed
via an approved
UpdateSignersproposal, so a compromised admin key alone canno longer alter governance.
propose/approve/executecovering the criticalactions
UpdateParameters,SetAdmin,Upgrade, andUpdateSigners. Theprior direct logic moved to private
do_*helpers reachable only viaexecute.executerequiresapprovals.len() >= threshold;config validation requires
2 <= threshold <= signers.len()and rejectsduplicate signers.
expires_at = created_at + 604_800; bothapproveandexecutereject expired proposals.approval;
approverejects any address already present.get_admin/get_parameters/get_version.persistent per-proposal storage with an id counter.
creditline-contractintegration test to drive the new proposalflow (it previously called the removed
update_parametersdirectly).Testing
cargo test -p parameters-contract— 20 passed;cargo test -p creditline-contractpassing;cargo build --workspaceclean)duplicate-signature rejection, 7-day expiry, configure-once, and each critical
action executed via proposal.
Checklist