Skip to content

Commit

Permalink
Adjust stake_multiplier to stakeMultiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
p-offtermatt committed Aug 2, 2024
1 parent ed7e12d commit 484cb7d
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions tests/integration/partial_set_security_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
// this is needed because 1000000 tokens = 1 voting power, so lower multipliers
// will be verbose and harder to read because small token numbers
// won't correspond to at least one voting power
const stake_multiplier = 1000000
const stakeMultiplier = 1000000

// TestMinStake tests the min stake parameter.
// It starts a provider and single consumer chain,
Expand All @@ -36,46 +36,46 @@ func TestMinStake(t *testing.T) {
{
name: "disabled min stake",
stakedTokens: []int64{
1 * stake_multiplier,
2 * stake_multiplier,
3 * stake_multiplier,
4 * stake_multiplier,
1 * stakeMultiplier,
2 * stakeMultiplier,
3 * stakeMultiplier,
4 * stakeMultiplier,
},
minStake: 0,
expectedConsuValSet: []int64{
1 * stake_multiplier,
2 * stake_multiplier,
3 * stake_multiplier,
4 * stake_multiplier,
1 * stakeMultiplier,
2 * stakeMultiplier,
3 * stakeMultiplier,
4 * stakeMultiplier,
},
},
{
name: "stake multiplier - standard case",
stakedTokens: []int64{
1 * stake_multiplier,
2 * stake_multiplier,
3 * stake_multiplier,
4 * stake_multiplier,
1 * stakeMultiplier,
2 * stakeMultiplier,
3 * stakeMultiplier,
4 * stakeMultiplier,
},
minStake: 3 * stake_multiplier,
minStake: 3 * stakeMultiplier,
expectedConsuValSet: []int64{
3 * stake_multiplier,
4 * stake_multiplier,
3 * stakeMultiplier,
4 * stakeMultiplier,
},
},
{
name: "check min stake with multiple equal stakes",
stakedTokens: []int64{
1 * stake_multiplier,
2 * stake_multiplier,
2 * stake_multiplier,
2 * stake_multiplier,
1 * stakeMultiplier,
2 * stakeMultiplier,
2 * stakeMultiplier,
2 * stakeMultiplier,
},
minStake: 2 * stake_multiplier,
minStake: 2 * stakeMultiplier,
expectedConsuValSet: []int64{
2 * stake_multiplier,
2 * stake_multiplier,
2 * stake_multiplier,
2 * stakeMultiplier,
2 * stakeMultiplier,
2 * stakeMultiplier,
},
},
}
Expand Down Expand Up @@ -132,7 +132,7 @@ func TestMinStake(t *testing.T) {
consuValPowers := make([]int64, len(consuValSet.Validators))
for i, consuVal := range consuValSet.Validators {
// voting power corresponds to staked tokens at a 1:stake_multiplier ratio
consuValPowers[i] = consuVal.VotingPower * stake_multiplier
consuValPowers[i] = consuVal.VotingPower * stakeMultiplier
}

s.Require().ElementsMatch(consuValPowers, tc.stakedTokens)
Expand All @@ -145,7 +145,7 @@ func TestMinStake(t *testing.T) {
// delegate and undelegate to trigger a vscupdate

// first delegate
delegateAndUndelegate(s, delegatorAccount.SenderAccount.GetAddress(), math.NewInt(1*stake_multiplier), 1)
delegateAndUndelegate(s, delegatorAccount.SenderAccount.GetAddress(), math.NewInt(1*stakeMultiplier), 1)

// end the epoch to apply the updates
s.nextEpoch()
Expand All @@ -166,7 +166,7 @@ func TestMinStake(t *testing.T) {
newConsuValPowers := make([]int64, len(newConsuValSet.Validators))
for i, consuVal := range newConsuValSet.Validators {
// voting power corresponds to staked tokens at a 1:stake_multiplier ratio
newConsuValPowers[i] = consuVal.VotingPower * stake_multiplier
newConsuValPowers[i] = consuVal.VotingPower * stakeMultiplier
}

// check that the new validator set is as expected
Expand Down

0 comments on commit 484cb7d

Please sign in to comment.