Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(x/staking)!: removing unbonding queue index #22795

Merged
merged 13 commits into from
Dec 16, 2024
406 changes: 205 additions & 201 deletions api/cosmos/staking/v1beta1/staking.pulsar.go

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion simapp/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ func TestAppImportExport(t *testing.T) {
skipPrefixes := map[string][][]byte{
stakingtypes.StoreKey: {
stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey,
stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, stakingtypes.UnbondingTypeKey,
},
authzkeeper.StoreKey: {authzkeeper.GrantQueuePrefix},
feegrant.StoreKey: {feegrant.FeeAllowanceQueueKeyPrefix},
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/staking/keeper/deterministic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ func TestGRPCValidatorUnbondingDelegations(t *testing.T) {
ValidatorAddr: validator.OperatorAddress,
}

testdata.DeterministicIterations(t, f.ctx, req, f.queryClient.ValidatorUnbondingDelegations, 3719, false)
testdata.DeterministicIterations(t, f.ctx, req, f.queryClient.ValidatorUnbondingDelegations, 3707, false)
}

func TestGRPCDelegation(t *testing.T) {
Expand Down Expand Up @@ -632,7 +632,7 @@ func TestGRPCUnbondingDelegation(t *testing.T) {
DelegatorAddr: delegator1,
}

testdata.DeterministicIterations(t, f.ctx, req, f.queryClient.UnbondingDelegation, 1621, false)
testdata.DeterministicIterations(t, f.ctx, req, f.queryClient.UnbondingDelegation, 1615, false)
}

func TestGRPCDelegatorDelegations(t *testing.T) {
Expand Down Expand Up @@ -755,7 +755,7 @@ func TestGRPCDelegatorUnbondingDelegations(t *testing.T) {
DelegatorAddr: delegator1,
}

testdata.DeterministicIterations(t, f.ctx, req, f.queryClient.DelegatorUnbondingDelegations, 1302, false)
testdata.DeterministicIterations(t, f.ctx, req, f.queryClient.DelegatorUnbondingDelegations, 1290, false)
}

func TestGRPCDelegatorValidators(t *testing.T) {
Expand Down Expand Up @@ -875,7 +875,7 @@ func TestGRPCRedelegations(t *testing.T) {
DstValidatorAddr: validator2,
}

testdata.DeterministicIterations(t, f.ctx, req, f.queryClient.Redelegations, 3926, false)
testdata.DeterministicIterations(t, f.ctx, req, f.queryClient.Redelegations, 3920, false)
}

func TestGRPCParams(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion tests/integration/staking/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func TestCancelUnbondingDelegation(t *testing.T) {
delegatorAddr, validatorAddr, 10,
ctx.HeaderInfo().Time.Add(time.Minute*10),
unbondingAmount.Amount,
0,
address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"),
)

Expand Down
12 changes: 6 additions & 6 deletions tests/integration/staking/keeper/slash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func TestSlashUnbondingDelegation(t *testing.T) {
// set an unbonding delegation with expiration timestamp (beyond which the
// unbonding delegation shouldn't be slashed)
ubd := types.NewUnbondingDelegation(addrDels[0], addrVals[0], 0,
time.Unix(5, 0), math.NewInt(10), 0, address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
time.Unix(5, 0), math.NewInt(10), address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))

assert.NilError(t, f.stakingKeeper.SetUnbondingDelegation(f.sdkCtx, ubd))

Expand Down Expand Up @@ -138,7 +138,7 @@ func TestSlashRedelegation(t *testing.T) {
// set a redelegation with an expiration timestamp beyond which the
// redelegation shouldn't be slashed
rd := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 0,
time.Unix(5, 0), math.NewInt(10), math.LegacyNewDec(10), 0, address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
time.Unix(5, 0), math.NewInt(10), math.LegacyNewDec(10), address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))

assert.NilError(t, f.stakingKeeper.SetRedelegation(f.sdkCtx, rd))

Expand Down Expand Up @@ -285,7 +285,7 @@ func TestSlashWithUnbondingDelegation(t *testing.T) {
// set an unbonding delegation with expiration timestamp beyond which the
// unbonding delegation shouldn't be slashed
ubdTokens := f.stakingKeeper.TokensFromConsensusPower(f.sdkCtx, 4)
ubd := types.NewUnbondingDelegation(addrDels[0], addrVals[0], 11, time.Unix(0, 0), ubdTokens, 0, address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
ubd := types.NewUnbondingDelegation(addrDels[0], addrVals[0], 11, time.Unix(0, 0), ubdTokens, address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
assert.NilError(t, f.stakingKeeper.SetUnbondingDelegation(f.sdkCtx, ubd))

// slash validator for the first time
Expand Down Expand Up @@ -415,7 +415,7 @@ func TestSlashWithRedelegation(t *testing.T) {

// set a redelegation
rdTokens := f.stakingKeeper.TokensFromConsensusPower(f.sdkCtx, 6)
rd := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 11, time.Unix(0, 0), rdTokens, math.LegacyNewDecFromInt(rdTokens), 0, address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
rd := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 11, time.Unix(0, 0), rdTokens, math.LegacyNewDecFromInt(rdTokens), address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
assert.NilError(t, f.stakingKeeper.SetRedelegation(f.sdkCtx, rd))

// set the associated delegation
Expand Down Expand Up @@ -573,7 +573,7 @@ func TestSlashBoth(t *testing.T) {
// set a redelegation with expiration timestamp beyond which the
// redelegation shouldn't be slashed
rdATokens := f.stakingKeeper.TokensFromConsensusPower(f.sdkCtx, 6)
rdA := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 11, time.Unix(0, 0), rdATokens, math.LegacyNewDecFromInt(rdATokens), 0, address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
rdA := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 11, time.Unix(0, 0), rdATokens, math.LegacyNewDecFromInt(rdATokens), address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
assert.NilError(t, f.stakingKeeper.SetRedelegation(f.sdkCtx, rdA))

// set the associated delegation
Expand All @@ -584,7 +584,7 @@ func TestSlashBoth(t *testing.T) {
// unbonding delegation shouldn't be slashed)
ubdATokens := f.stakingKeeper.TokensFromConsensusPower(f.sdkCtx, 4)
ubdA := types.NewUnbondingDelegation(addrDels[0], addrVals[0], 11,
time.Unix(0, 0), ubdATokens, 0, address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
time.Unix(0, 0), ubdATokens, address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
assert.NilError(t, f.stakingKeeper.SetUnbondingDelegation(f.sdkCtx, ubdA))

bondedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, rdATokens.MulRaw(2)))
Expand Down
Loading
Loading