@@ -69,20 +69,20 @@ Pool is used for tracking bonded and not-bonded token supply of the bond denomin
69
69
LastTotalPower tracks the total amounts of bonded tokens recorded during the previous end block.
70
70
Store entries prefixed with "Last" must remain unchanged until EndBlock.
71
71
72
- * LastTotalPower: ` 0x12 -> ProtocolBuffer(math.Int )`
72
+ * LastTotalPower: ` collections.NewPrefix(18 )`
73
73
74
74
### UnbondingID
75
75
76
76
UnbondingID stores the ID of the latest unbonding operation. It enables creating unique IDs for unbonding operations, i.e., UnbondingID is incremented every time a new unbonding operation (validator unbonding, unbonding delegation, redelegation) is initiated.
77
77
78
- * UnbondingID: ` 0x37 -> uint64 `
78
+ * UnbondingID: ` 55 `
79
79
80
80
### Params
81
81
82
82
The staking module stores its params in state with the prefix of ` 0x51 ` ,
83
83
it can be updated with governance or the address with authority.
84
84
85
- * Params: ` 0x51 | ProtocolBuffer(Params) `
85
+ * Params: ` 81 `
86
86
87
87
``` protobuf reference
88
88
https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/staking/proto/cosmos/staking/v1beta1/staking.proto#L300-L328
@@ -117,18 +117,18 @@ required lookups for slashing and validator-set updates. A third special index
117
117
throughout each block, unlike the first two indices which mirror the validator
118
118
records within a block.
119
119
120
- * Validators: ` 0x21 | OperatorAddrLen (1 byte) | OperatorAddr -> ProtocolBuffer(validator)`
121
- * ValidatorsByConsAddr: ` 0x22 | ConsAddrLen (1 byte) | ConsAddr -> OperatorAddr`
122
- * ValidatorsByPower: ` 0x23 | BigEndian(ConsensusPower) | OperatorAddrLen (1 byte) | OperatorAddr -> OperatorAddr`
123
- * LastValidatorsPower: ` 0x11 | OperatorAddrLen (1 byte) | OperatorAddr -> ProtocolBuffer(ConsensusPower)`
124
- * ValidatorsByUnbondingID : ` 0x38 | UnbondingID -> 0x21 | OperatorAddrLen (1 byte) | OperatorAddr`
120
+ * Validators: ` 33 | OperatorAddrLen (1 byte) | OperatorAddr -> ProtocolBuffer(validator)`
121
+ * ValidatorsByConsAddr: ` 34 | ConsAddrLen (1 byte) | ConsAddr -> OperatorAddr`
122
+ * ValidatorsByPower: ` 23 | BigEndian(ConsensusPower) | OperatorAddrLen (1 byte) | OperatorAddr -> OperatorAddr`
123
+ * LastValidatorsPower: ` 17 | OperatorAddrLen (1 byte) | OperatorAddr -> ProtocolBuffer(ConsensusPower)`
124
+ * UnbondingIndex : ` 56 | UnbondingID -> 21 | OperatorAddrLen (1 byte) | OperatorAddr`
125
125
126
126
` Validators ` is the primary index - it ensures that each operator can have only one
127
127
associated validator, where the public key of that validator can change in the
128
128
future. Delegators can refer to the immutable operator of the validator, without
129
129
concern for the changing public key.
130
130
131
- ` ValidatorsByUnbondingID ` is an additional index that enables lookups for
131
+ ` UnbondingIndex ` is an additional index that enables lookups for
132
132
validators by the unbonding IDs corresponding to their current unbonding.
133
133
134
134
` ValidatorByConsAddr ` is an additional index that enables lookups for slashing.
@@ -161,9 +161,9 @@ https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/staking/proto/cosmos
161
161
### Delegation
162
162
163
163
Delegations are identified by combining ` DelegatorAddr ` (the address of the delegator)
164
- with the ` ValidatorAddr ` Delegators are indexed in the store as follows:
164
+ with the ` ValidatorAddr ` . Delegators are indexed in the store as follows:
165
165
166
- * Delegation: ` 0x31 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr -> ProtocolBuffer(delegation)`
166
+ * Delegation: ` 49 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr -> ProtocolBuffer(delegation)`
167
167
168
168
Stake holders may delegate coins to validators; under this circumstance their
169
169
funds are held in a ` Delegation ` data structure. It is owned by one
@@ -183,7 +183,7 @@ validator and the number of shares issued so far:
183
183
` Shares per Token = validator.TotalShares() / validator.Tokens() `
184
184
185
185
Only the number of shares received is stored on the DelegationEntry. When a delegator then
186
- Undelegates , the token amount they receive is calculated from the number of shares they currently
186
+ undelegates , the token amount they receive is calculated from the number of shares they currently
187
187
hold and the inverse exchange rate:
188
188
189
189
` Tokens per Share = validator.Tokens() / validatorShares() `
@@ -201,17 +201,17 @@ detected.
201
201
202
202
` UnbondingDelegation ` are indexed in the store as:
203
203
204
- * UnbondingDelegation: ` 0x32 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr -> ProtocolBuffer(unbondingDelegation)`
205
- * UnbondingDelegationsFromValidator : ` 0x33 | ValidatorAddrLen (1 byte) | ValidatorAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil`
206
- * UnbondingDelegationByUnbondingId : ` 0x38 | UnbondingId -> 0x32 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr`
204
+ * UnbondingDelegation: ` 50 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr -> ProtocolBuffer(unbondingDelegation)`
205
+ * UnbondingDelegationByValIndex : ` 51 | ValidatorAddrLen (1 byte) | ValidatorAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil`
206
+ * UnbondingIndex : ` 56 | UnbondingId -> 0x32 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr`
207
207
` UnbondingDelegation ` is used in queries, to lookup all unbonding delegations for
208
208
a given delegator.
209
209
210
- ` UnbondingDelegationsFromValidator ` is used in slashing, to lookup all
210
+ ` UnbondingDelegationByValIndex ` is used in slashing, to lookup all
211
211
unbonding delegations associated with a given validator that need to be
212
212
slashed.
213
213
214
- ` UnbondingDelegationByUnbondingId ` is an additional index that enables
214
+ ` UnbondingIndex ` is an additional index that enables
215
215
lookups for unbonding delegations by the unbonding IDs of the containing
216
216
unbonding delegation entries.
217
217
@@ -232,23 +232,23 @@ committed by the source validator.
232
232
233
233
` Redelegation ` are indexed in the store as:
234
234
235
- * Redelegations: ` 0x34 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddr -> ProtocolBuffer(redelegation)`
236
- * RedelegationsBySrc : ` 0x35 | ValidatorSrcAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddrLen (1 byte) | ValidatorDstAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil`
237
- * RedelegationsByDst : ` 0x36 | ValidatorDstAddrLen (1 byte) | ValidatorDstAddr | ValidatorSrcAddrLen (1 byte) | ValidatorSrcAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil`
238
- * RedelegationByUnbondingId: ` 0x38 | UnbondingId -> 0x34 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddr`
235
+ * Redelegations: ` 52 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddrLen (1 byte) | ValidatorDstAddr -> ProtocolBuffer(redelegation)`
236
+ * RedelegationsByValSrc : ` 53 | ValidatorSrcAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddrLen (1 byte) | ValidatorDstAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil`
237
+ * RedelegationsByValDst : ` 54 | ValidatorDstAddrLen (1 byte) | ValidatorDstAddr | ValidatorSrcAddrLen (1 byte) | ValidatorSrcAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil`
238
+ * RedelegationByUnbondingId: ` 56 | UnbondingId -> 0x34 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddr`
239
239
240
240
` Redelegations ` is used for queries, to lookup all redelegations for a given
241
241
delegator.
242
242
243
- ` RedelegationsBySrc ` is used for slashing based on the ` ValidatorSrcAddr ` .
243
+ ` RedelegationsByValSrc ` is used for slashing based on the ` ValidatorSrcAddr ` .
244
244
245
- ` RedelegationsByDst ` is used for slashing based on the ` ValidatorDstAddr `
245
+ ` RedelegationsByValDst ` is used for slashing based on the ` ValidatorDstAddr `
246
246
247
247
The first map here is used for queries, to lookup all redelegations for a given
248
248
delegator. The second map is used for slashing based on the ` ValidatorSrcAddr ` ,
249
249
while the third map is for slashing based on the ` ValidatorDstAddr ` .
250
250
251
- ` RedelegationByUnbondingId ` is an additional index that enables
251
+ ` UnbondingIndex ` is an additional index that enables
252
252
lookups for redelegations by the unbonding IDs of the containing
253
253
redelegation entries.
254
254
@@ -317,7 +317,7 @@ element.
317
317
For the purpose of tracking progress of unbonding delegations the unbonding
318
318
delegations queue is kept.
319
319
320
- * UnbondingDelegation : ` 0x41 | format(time) -> []DVPair`
320
+ * UnbondingQueue : ` 65 | format(time) -> []DVPair`
321
321
322
322
``` protobuf reference
323
323
https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/staking/proto/cosmos/staking/v1beta1/staking.proto#L159-L173
@@ -328,7 +328,7 @@ https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/staking/proto/cosmos
328
328
For the purpose of tracking progress of redelegations the redelegation queue is
329
329
kept.
330
330
331
- * RedelegationQueue: ` 0x42 | format(time) -> []DVVTriplet`
331
+ * RedelegationQueue: ` 66 | format(time) -> []DVVTriplet`
332
332
333
333
``` protobuf reference
334
334
https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/staking/proto/cosmos/staking/v1beta1/staking.proto#L175-L191
@@ -339,7 +339,7 @@ https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/staking/proto/cosmos
339
339
For the purpose of tracking progress of unbonding validators the validator
340
340
queue is kept.
341
341
342
- * ValidatorQueueTime : ` 0x43 | format(time) -> []sdk.ValAddress`
342
+ * ValidatorQueue : ` 67 | format(time) -> []sdk.ValAddress`
343
343
344
344
The stored object by each key is an array of validator operator addresses from
345
345
which the validator object can be accessed. Typically it is expected that only
@@ -348,7 +348,7 @@ that multiple validators exist in the queue at the same location.
348
348
349
349
#### ValidatorConsensusKeyRotationRecordQueueKey
350
350
351
- For the purpose of tracking progress or consensus pubkey rotations the ` ValidatorConsensusKeyRotationRecordQueueKey ` kept.
351
+ For the purpose of tracking progress of consensus pubkey rotations, the ` ValidatorConsensusKeyRotationRecordQueueKey ` is kept.
352
352
353
353
* ValidatorConsensusKeyRotationRecordQueueKey: ` 103 | format(time) -> types.ValAddrsOfRotatedConsKeys `
354
354
@@ -361,9 +361,6 @@ the present store info and append the `ValAddress` to the array and set it back
361
361
https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/staking/proto/cosmos/staking/v1beta1/staking.proto#L420-L424
362
362
```
363
363
364
-
365
-
366
-
367
364
## State Transitions
368
365
369
366
### Validators
@@ -401,7 +398,7 @@ When a validator begins the unbonding process the following operations occur:
401
398
#### Unbonding to Unbonded
402
399
403
400
A validator moves from unbonding to unbonded when the ` ValidatorQueue ` object
404
- moves from bonded to unbonded
401
+ moves from bonded to unbonded.
405
402
406
403
* update the ` Validator ` object for this validator
407
404
* set ` validator.Status ` to ` Unbonded `
@@ -423,7 +420,7 @@ Jailed validators are not present in any of the following stores:
423
420
424
421
#### Delegate
425
422
426
- When a delegation occurs both the validator and the delegation objects are affected
423
+ When a delegation occurs both the validator and the delegation objects are affected.
427
424
428
425
* determine the delegators shares based on tokens delegated and the validator's exchange rate
429
426
* remove tokens from the sending account
@@ -894,10 +891,12 @@ following hooks can registered with staking:
894
891
* called when a delegation is created
895
892
* ` BeforeDelegationSharesModified(Context, AccAddress, ValAddress) error `
896
893
* called when a delegation's shares are modified
897
- * ` AfterDelegationModified(Context, AccAddress, ValAddress) error `
898
- * called when a delegation is created or modified
899
894
* ` BeforeDelegationRemoved(Context, AccAddress, ValAddress) error `
900
895
* called when a delegation is removed
896
+ * ` AfterDelegationModified(Context, AccAddress, ValAddress) error `
897
+ * called when a delegation is created or modified
898
+ * ` BeforeValidatorSlashed(Context, sdk.ValAddress, math.LegacyDec) error `
899
+ * called when a validator is slashed
901
900
* ` AfterUnbondingInitiated(Context, UnbondingID) `
902
901
* called when an unbonding operation (validator unbonding, unbonding delegation, redelegation) was initiated
903
902
* ` AfterConsensusPubKeyUpdate(ctx Context, oldpubkey, newpubkey types.PubKey, fee sdk.Coin) `
@@ -916,11 +915,9 @@ The staking module emits the following events:
916
915
| complete_unbonding | validator | {validatorAddress} |
917
916
| complete_unbonding | delegator | {delegatorAddress} |
918
917
| complete_redelegation | amount | {totalRedelegationAmount} |
918
+ | complete_redelegation | delegator | {delegatorAddress} |
919
919
| complete_redelegation | source_validator | {srcValidatorAddress} |
920
920
| complete_redelegation | destination_validator | {dstValidatorAddress} |
921
- | complete_redelegation | delegator | {delegatorAddress} |
922
-
923
- ## Msg's
924
921
925
922
### MsgCreateValidator
926
923
@@ -947,7 +944,9 @@ The staking module emits the following events:
947
944
| Type | Attribute Key | Attribute Value |
948
945
| -------- | ------------- | ------------------ |
949
946
| delegate | validator | {validatorAddress} |
947
+ | delegate | delegator | {delegatorAddress} |
950
948
| delegate | amount | {delegationAmount} |
949
+ | delegate | new_shares | {newShares} |
951
950
| message | module | staking |
952
951
| message | action | delegate |
953
952
| message | sender | {senderAddress} |
@@ -957,6 +956,7 @@ The staking module emits the following events:
957
956
| Type | Attribute Key | Attribute Value |
958
957
| ------- | ------------------- | ------------------ |
959
958
| unbond | validator | {validatorAddress} |
959
+ | unbond | delegator | {delegatorAddress} |
960
960
| unbond | amount | {unbondAmount} |
961
961
| unbond | completion_time [ 0] | {completionTime} |
962
962
| message | module | staking |
0 commit comments