Decentralized key revocation pipelines for admin roster sets#509
Merged
Sadeequ merged 4 commits intoJun 27, 2026
Conversation
…roup Introduces a two-phase multi-sig revocation flow in src/admin.rs to strip permissions from a compromised hot-wallet key without requiring a full contract upgrade. - Add propose_emergency_revocation() and vote_emergency_revocation() with majority threshold enforcement (n/2 + 1) - On threshold, instantly write REVOKED_SIGNER_KEY storage flag and strip target from signer set - Add assert_not_revoked() guard to all mutating functions in lib.rs - Add 10 tests covering the full revocation flow
|
@Aonlike Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Alot of heavy text, yeah? |
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.
Closes #409
This pull request introduces an emergency key revocation mechanism that allows a predefined multi-signature coordinator group to immediately revoke a compromised administrative or coordinator hot-wallet key without requiring a full contract upgrade.
Once the required voting threshold is reached:
The compromised address is immediately marked as revoked in
REVOKED_SIGNER_KEYpersistent storage.The address is stripped from the active signer set.
If the target was admin, admin rights are transferred to the replacement address.
Storage is updated atomically in the same transaction as the deciding vote.
All future authorization checks reject the revoked account from signing transactions or modifying contract configuration.
Motivation
Previously, if an administrator or coordinator hot wallet became compromised, the only mitigation was deploying an upgraded contract.
This introduced several risks:
Delayed response to security incidents.
Opportunity for attackers to execute malicious administrative actions during the upgrade window.
Operational downtime during the upgrade process.
Manual intervention requiring broad team coordination.
This implementation enables secure, decentralized on-chain emergency revocation through coordinator consensus with no contract upgrade required.
Technical Design
New Storage Keys
The following storage entries are introduced:
REVOKED_SIGNER_KEYstores aMap<Address, ()>of all permanently revoked addresses.EMERGENCY_REVOCATION_KEYstores the activeEmergencyRevocationProposalwhile voting is in progress.EmergencyRevocationProposalThis structure tracks:
the compromised address to be revoked
the replacement address to be promoted
the coordinator who opened the proposal
the ledger timestamp at proposal time
the set of addresses that have already voted
New Functions
propose_emergency_revocation()Responsibilities:
Authenticate the proposer.
Verify proposer is a registered signer or admin.
Reject the compromised key from opening its own proposal.
Enforce only one active proposal at a time.
Record the proposer's opening vote automatically.
Store the proposal under
EMERGENCY_REVOCATION_KEY.vote_emergency_revocation()Responsibilities:
Reject stale signatures.
Authenticate the voter.
Verify voter is a registered signer or admin.
Prevent the target from voting on its own revocation.
Prevent duplicate votes.
Check whether the majority threshold (
n/2 + 1) has been reached.Execute revocation atomically once threshold is satisfied.
assert_not_revoked()Enforcing guard called at the top of every sensitive function. Returns
RevokedAddressimmediately if the caller has been revoked.is_revoked()Returns
trueif the supplied address has been stamped as revoked inREVOKED_SIGNER_KEYstorage.Authorization Changes
Every privileged operation in
src/lib.rsnow callsassert_not_revoked()before proceeding:The check is applied to:
Function Protection
propose_upgradeRevoked key cannot propose upgradesexecute_upgradeRevoked key cannot execute upgradescancel_upgradeRevoked key cannot cancel upgradesset_valueRevoked key cannot modify stateregister_signerRevoked key cannot add signersremove_signerRevoked key cannot remove signersstake_and_registerRevoked node cannot re-stakestake_and_register_for_feedRevoked node cannot register feedsset_heartbeat_intervalRevoked key cannot change intervalsupsert_node_profileRevoked key cannot modify node profilesset_staking_tier_configRevoked key cannot change tier configset_asset_feed_metricsRevoked key cannot update feed metricsupdate_validator_profileRevoked node cannot update profilevote_revocationRevoked key cannot participate in governanceMulti-Signature Workflow
Storage Updates
Immediately after the voting threshold is reached:
No contract upgrade is required at any point.
Security Improvements
Immediate Permission Removal
Permissions are revoked during the same transaction that satisfies the voting threshold. There is no intermediate state where the compromised key retains any access.
Self-Revocation Prevented
The compromised key cannot open its own revocation proposal and cannot vote on its own revocation:
Duplicate Vote Prevention
Each coordinator can vote only once per proposal. Duplicate votes are rejected with
AlreadyVoted.Signature Expiry Enforcement
Votes with stale signatures are rejected immediately:
Atomic Execution
Revocation and all storage updates occur atomically within a single transaction.
New Error Variants
Files Modified
Testing
The following test cases were added to
src/test.rs:Successful Proposal
Proposal opens correctly and proposer vote is counted automatically.
Threshold Execution
Target is blocked and proposal is cleared once majority is reached.
Revoked Address Blocking
Revoked address gets
RevokedAddressonstake_and_registerandregister_signer.Revoked Admin Upgrade Prevention
Revoked admin key gets
RevokedAddressonpropose_upgrade.Self-Revocation Prevention
Target voting on its own revocation returns
Unauthorized.Duplicate Vote Prevention
Second vote from the same address returns
AlreadyVoted.Single Active Proposal Enforcement
Opening a second proposal while one is active returns
EmergencyRevocationAlreadyActive.Expired Signature Rejection
Stale
sig_expires_atreturnsSignatureExpired.No Active Proposal Error
Voting with no active proposal returns
NoActiveEmergencyRevocation.Replacement Promotion
Replacement address is admitted into the signer set after revocation completes.
Checklist
[x] Emergency key revocation implemented inside
src/admin.rs[x] Multi-signature coordinator voting with majority threshold
[x] Immediate storage flag update on successful vote
[x] Revoked key blocked from signing
[x] Revoked key blocked from modifying configurations
[x] Self-revocation prevented
[x] Duplicate vote prevention
[x] Signature expiry enforcement
[x] Atomic execution — no intermediate state
[x] No contract upgrade required
[x] All new code covered by tests
Result
This implementation introduces a secure, decentralized emergency key revocation mechanism for the StellarFlow Network.
Once the configured multi-signature coordinator threshold is satisfied, the compromised administrative or coordinator account is immediately revoked, its permissions are removed from storage, and all future attempts to sign transactions or modify contract state are rejected.
This significantly strengthens the network's resilience against compromised administrative hot wallets while eliminating the need for an emergency contract upgrade.