Skip to content

Commit 6fa6924

Browse files
authored
revert: removing unbonding queue index (cosmos#22795) (#1732)
1 parent c021960 commit 6fa6924

28 files changed

+2478
-1094
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ Ref: https://keepachangelog.com/en/1.0.0/
4242

4343
* (x/staking) [#1730](https://github.com/crypto-org-chain/cosmos-sdk/pull/1730) Normalize cache validator queue key to be UTC.
4444
* (x/staking) [#1725](https://github.com/crypto-org-chain/cosmos-sdk/pull/1725) Optimize staking endblocker execution by caching queue entries from iterators.
45-
* (x/staking) [#22795](https://github.com/cosmos/cosmos-sdk/pull/22795) `NewUnbondingDelegationEntry`, `NewUnbondingDelegation`, `AddEntry`, `NewRedelegationEntry`, `NewRedelegation` and `NewRedelegationEntryResponse` no longer take an ID in there function signatures. AfterUnbondingInitiated hook has been removed as it is no longer required by ICS. Keys `stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, stakingtypes.UnbondingTypeKey` have been removed as they are no longer required by ICS.
4645
* (baseapp) [#205](https://github.com/crypto-org-chain/cosmos-sdk/pull/205) Add `TxExecutor` baseapp option, add `TxIndex`/`TxCount`/`MsgIndex`/`BlockGasUsed` fields to `Context, to support tx parallel execution.
4746
* (baseapp) [#206](https://github.com/crypto-org-chain/cosmos-sdk/pull/206) Support mount object store in baseapp, add `ObjectStore` api in context, [#585](https://github.com/crypto-org-chain/cosmos-sdk/pull/585) Skip snapshot for object store.
4847
* (bank) [#237](https://github.com/crypto-org-chain/cosmos-sdk/pull/237) Support virtual accounts in sending coins.

api/cosmos/staking/v1beta1/staking.pulsar.go

Lines changed: 169 additions & 172 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/cosmos/staking/v1beta1/staking.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ message UnbondingDelegationEntry {
245245
(gogoproto.nullable) = false
246246
];
247247
// Incrementing id that uniquely identifies this entry
248-
uint64 unbonding_id = 5 [deprecated = true];
248+
uint64 unbonding_id = 5;
249249

250250
// Strictly positive if this entry's unbonding has been stopped by external modules
251251
int64 unbonding_on_hold_ref_count = 6;

simapp/sim_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ func TestAppImportExport(t *testing.T) {
194194
skipPrefixes := map[string][][]byte{
195195
stakingtypes.StoreKey: {
196196
stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey,
197-
stakingtypes.HistoricalInfoKey, stakingtypes.ValidatorUpdatesKey,
197+
stakingtypes.HistoricalInfoKey, stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey,
198+
stakingtypes.UnbondingTypeKey, stakingtypes.ValidatorUpdatesKey,
198199
},
199200
authzkeeper.StoreKey: {authzkeeper.GrantQueuePrefix},
200201
feegrant.StoreKey: {feegrant.FeeAllowanceQueueKeyPrefix},

tests/integration/staking/keeper/determinstic_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ func TestGRPCValidatorUnbondingDelegations(t *testing.T) {
464464
ValidatorAddr: validator.OperatorAddress,
465465
}
466466

467-
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.ValidatorUnbondingDelegations, 3707, false)
467+
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.ValidatorUnbondingDelegations, 3719, false)
468468
}
469469

470470
func TestGRPCDelegation(t *testing.T) {
@@ -536,7 +536,7 @@ func TestGRPCUnbondingDelegation(t *testing.T) {
536536
DelegatorAddr: delegator1,
537537
}
538538

539-
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.UnbondingDelegation, 1615, false)
539+
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.UnbondingDelegation, 1621, false)
540540
}
541541

542542
func TestGRPCDelegatorDelegations(t *testing.T) {
@@ -647,7 +647,7 @@ func TestGRPCDelegatorUnbondingDelegations(t *testing.T) {
647647
DelegatorAddr: delegator1,
648648
}
649649

650-
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DelegatorUnbondingDelegations, 1290, false)
650+
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.DelegatorUnbondingDelegations, 1302, false)
651651
}
652652

653653
func TestGRPCHistoricalInfo(t *testing.T) {
@@ -816,7 +816,7 @@ func TestGRPCRedelegations(t *testing.T) {
816816
DstValidatorAddr: validator2,
817817
}
818818

819-
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Redelegations, 3914, false)
819+
testdata.DeterministicIterations(f.ctx, t, req, f.queryClient.Redelegations, 3920, false)
820820
}
821821

822822
func TestGRPCParams(t *testing.T) {

tests/integration/staking/keeper/msg_server_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func TestCancelUnbondingDelegation(t *testing.T) {
5555
delegatorAddr, validatorAddr, 10,
5656
ctx.BlockTime().Add(time.Minute*10),
5757
unbondingAmount.Amount,
58+
0,
5859
address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"),
5960
)
6061

tests/integration/staking/keeper/slash_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func TestSlashUnbondingDelegation(t *testing.T) {
6262
// set an unbonding delegation with expiration timestamp (beyond which the
6363
// unbonding delegation shouldn't be slashed)
6464
ubd := types.NewUnbondingDelegation(addrDels[0], addrVals[0], 0,
65-
time.Unix(5, 0), math.NewInt(10), address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
65+
time.Unix(5, 0), math.NewInt(10), 0, address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
6666

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

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

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

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

271271
// slash validator for the first time
@@ -395,7 +395,7 @@ func TestSlashWithRedelegation(t *testing.T) {
395395

396396
// set a redelegation
397397
rdTokens := f.stakingKeeper.TokensFromConsensusPower(f.sdkCtx, 6)
398-
rd := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 11, time.Unix(0, 0), rdTokens, math.LegacyNewDecFromInt(rdTokens), address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
398+
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"))
399399
assert.NilError(t, f.stakingKeeper.SetRedelegation(f.sdkCtx, rd))
400400

401401
// set the associated delegation
@@ -553,7 +553,7 @@ func TestSlashBoth(t *testing.T) {
553553
// set a redelegation with expiration timestamp beyond which the
554554
// redelegation shouldn't be slashed
555555
rdATokens := f.stakingKeeper.TokensFromConsensusPower(f.sdkCtx, 6)
556-
rdA := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 11, time.Unix(0, 0), rdATokens, math.LegacyNewDecFromInt(rdATokens), address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
556+
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"))
557557
assert.NilError(t, f.stakingKeeper.SetRedelegation(f.sdkCtx, rdA))
558558

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

570570
bondedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, rdATokens.MulRaw(2)))

0 commit comments

Comments
 (0)