Repository navigation
feat: key merge voting and holder position migration - #1020
Merged
Chucks1093 merged 3 commits intoOct 2, 2026
Merged
Conversation
Add weighted holder voting, threshold validation, atomic balance migration and source-key deprecation to the key merge module.
|
@Emmazlee 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! 🚀 |
Chucks1093
pushed a commit
that referenced
this pull request
Sep 30, 2026
…t budget `cargo clippy --workspace --all-targets -- -D warnings` fails with `this function has too many arguments (8/7)` at the test helper `propose`. The helper mirrors the entrypoint's seven parameters and adds `contract_id`, because each entrypoint runs in its own contract frame. Rather than allow the lint, group the proposal under test - the two keys, the quorum and the holder list - into a `MergeProposalSpec`, which brings the helper to four arguments and leaves the entrypoint signature untouched. Verified with `cargo clippy --workspace --all-targets -- -D warnings` and `cargo test -p creator-keys` on the branch tree.
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.
Overview
creator-keys/src/acl_limits_merge_sunset.rsshipped only a placeholder key-merge flow:propose_key_mergestored a ratio andexecute_key_mergeflipped flags and returned the ratio. There was no way for source-key holders to vote, no threshold check, no balance migration and no source-key deprecation, so the merge was a no-op. This change builds the missing voting, migration and deprecation flow inside the existing module (the crate still has no matchinglib.rsentrypoints) and reuses the protocol's real holder-balance storage.Related Issue
#962 — Add on-chain key merge voting and execution with position migration.
Changes
creator-keys/src/acl_limits_merge_sunset.rs—vote_on_merge(holder, source_key, approve)weights a source-key holder's vote by their liquidKeyBalance, replaces a previous vote by removing the old weight before adding the new one so no holder is double counted, and rejects non-holders and votes cast after execution.MergeVoteRecordandMergeMigrationEntrycontract types, theMergeHolders/MergeVote/MergeMigrationLogkeys in the module's existingEmwulrdDataKeynamespace, andget_key_merge_proposal/get_merge_migration_logviews.KeyMergeProposalnow carriesapproval_threshold_bps,votes_for,votes_againstandtotal_voted_weight.propose_key_mergetakes the approval threshold and the source-holder set, validates the ratio/threshold ranges, rejects duplicate holders and refuses to overwrite an executed proposal.execute_key_mergevalidates the weighted approval share againstapproval_threshold_bpsbefore touching state, then migrates every registered holder's liquid and staked positions to the target key atconversion_ratio_bps(target balances are additive), transfers the aggregateTotalStaked, stores the full migration log, deprecates the source key with the protocol-wide marker plus the module sunset status, and emitsMergeExecutedwith the ratio/counts andKeyDeprecated.#[test]cases covering weighted vote collection, non-holder rejection, vote switching without double counting, threshold failure with no state mutation, and the successful migration/deprecation path including the second-execution guard and invalid proposal inputs.Verification Results
I fetched
creator-keys/srcplus the workspace manifests into a scratch tree and compiled it against the repo's pinnedsoroban-sdk22.0.11 withcargo check --offline --testsandcargo test --offline --lib acl_limits_merge_sunset::test. Both succeed; the five new tests pass:lib.rswas left untouched, and I did not run the crate's wider snapshot suite.merge_votes_use_liquid_source_balance_as_weight— weight equals the holder's liquid source-key balanceexecute_rejects_below_approval_threshold— returnsUnauthorized, balances untouchedexecute_migrates_all_positions_and_deprecates_source— liquid and staked moved at 50%acl_limits_merge_sunset::testCloses #962