Repository navigation
test(staking): cover staking-to-governance voting power flow (#1521) - #1569
Merged
nanaf6203-bit merged 1 commit intoNov 24, 2026
Merged
nanaf6203-bit merged 1 commit into
nanaf6203-bit merged 1 commit into
Conversation
Add an integration suite under contract-extensions/tests that stakes with different amounts and lock periods, then drives proposal creation, weighted voting, execution, unstaking and delegation through the compiled staking contract. Voting power is pinned to the staked principal. Lock duration and pending rewards are asserted to move rewards only; auto-compounding becomes principal and therefore power, which the suite states explicitly.
|
@Moonwalker-rgb 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! 🚀 |
nanaf6203-bit
approved these changes
Nov 24, 2026
nanaf6203-bit
left a comment
Contributor
There was a problem hiding this comment.
This looks good to me. Thanks for the effort!
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 #1521
Summary
Adds a standalone integration suite at
contract-extensions/tests/staking-governance-voting-tests/that drives thestaking contract's own parameter-governance module through the real compiled
contract:
stake -> propose_param_change -> vote_on_proposal -> execute_param_proposal, plus unstaking and delegation.Changes
contract-extensions/tests/staking-governance-voting-tests/Cargo.tomlcontract-extensions/tests/staking-governance-voting-tests/src/lib.rsChecklist
contract-extensions/contracts/,tests/,scripts/, or root configuration filescargo clippypasses with no warningscargo testpassescargo buildsucceeds (the test run builds the crate and its contract dependency)Testing
Coverage against the acceptance criteria
spend its old power (
NoVotingPower); the orphaned proposal then failsquorum.
principal and power untouched.
Two behaviours pinned rather than assumed
The shipped contract differs from the usual token-weighted DAO model, so the
tests state the actual semantics instead of asserting behaviour the code does
not implement:
stakegrants the rawamount in
governance_power;LockPeriodis only used in reward pricing.lock_period_changes_rewards_but_not_voting_powerasserts equal power forequal principals and a higher reward projection for the longer lock.
rewards and an ordinary claim leave power alone. Auto-compounding adds the
reward to
stake.amount, which is new principal and therefore increasespower; the test asserts that distinction explicitly.