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

This commit is contained in:
Marko 2024-12-16 02:48:54 -08:00 committed by GitHub
parent 2c2249ffd3
commit 234cdc45f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 1127 additions and 2508 deletions

View File

@ -15459,6 +15459,8 @@ type UnbondingDelegationEntry struct {
// balance defines the tokens to receive at completion.
Balance string `protobuf:"bytes,4,opt,name=balance,proto3" json:"balance,omitempty"`
// Incrementing id that uniquely identifies this entry
//
// Deprecated: Do not use.
UnbondingId uint64 `protobuf:"varint,5,opt,name=unbonding_id,json=unbondingId,proto3" json:"unbonding_id,omitempty"`
// Strictly positive if this entry's unbonding has been stopped by external modules
UnbondingOnHoldRefCount int64 `protobuf:"varint,6,opt,name=unbonding_on_hold_ref_count,json=unbondingOnHoldRefCount,proto3" json:"unbonding_on_hold_ref_count,omitempty"`
@ -15512,6 +15514,7 @@ func (x *UnbondingDelegationEntry) GetBalance() string {
return ""
}
// Deprecated: Do not use.
func (x *UnbondingDelegationEntry) GetUnbondingId() uint64 {
if x != nil {
return x.UnbondingId
@ -16316,7 +16319,7 @@ var file_cosmos_staking_v1beta1_staking_proto_rawDesc = []byte{
0x6e, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52,
0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x3a, 0x08, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0,
0x1f, 0x00, 0x22, 0x9b, 0x03, 0x0a, 0x18, 0x55, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67,
0x1f, 0x00, 0x22, 0x9f, 0x03, 0x0a, 0x18, 0x55, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67,
0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
0x27, 0x0a, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x69, 0x67,
0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69,
@ -16335,208 +16338,209 @@ var file_cosmos_staking_v1beta1_staking_proto_rawDesc = []byte{
0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49,
0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74,
0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x62,
0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52,
0x0b, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x12, 0x3c, 0x0a, 0x1b,
0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x6e, 0x5f, 0x68, 0x6f, 0x6c,
0x64, 0x5f, 0x72, 0x65, 0x66, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28,
0x03, 0x52, 0x17, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4f, 0x6e, 0x48, 0x6f,
0x6c, 0x64, 0x52, 0x65, 0x66, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01,
0x22, 0x9f, 0x03, 0x0a, 0x11, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12,
0x52, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69,
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73,
0x74, 0x61, 0x6d, 0x70, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0xa8, 0xe7,
0xb0, 0x2a, 0x01, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x54,
0x69, 0x6d, 0x65, 0x12, 0x54, 0x0a, 0x0f, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x62,
0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde,
0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e,
0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0e, 0x69, 0x6e, 0x69, 0x74, 0x69,
0x61, 0x6c, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x50, 0x0a, 0x0a, 0x73, 0x68, 0x61,
0x72, 0x65, 0x73, 0x5f, 0x64, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8,
0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b,
0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44,
0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63,
0x52, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x44, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x75,
0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28,
0x04, 0x52, 0x0b, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x12, 0x3c,
0x0a, 0x1b, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x6e, 0x5f, 0x68,
0x6f, 0x6c, 0x64, 0x5f, 0x72, 0x65, 0x66, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20,
0x01, 0x28, 0x03, 0x52, 0x17, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4f, 0x6e,
0x48, 0x6f, 0x6c, 0x64, 0x52, 0x65, 0x66, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x04, 0xe8, 0xa0,
0x1f, 0x01, 0x22, 0xdd, 0x02, 0x0a, 0x0c, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72,
0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18,
0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65,
0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61,
0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x55, 0x0a, 0x15, 0x76, 0x61,
0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x73, 0x72, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72,
0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, 0xd2, 0xb4, 0x2d, 0x1d, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41,
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x13, 0x76, 0x61,
0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x72, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
0x73, 0x12, 0x55, 0x0a, 0x15, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x64,
0x73, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x42, 0x21, 0xd2, 0xb4, 0x2d, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x61, 0x6c,
0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72,
0x69, 0x6e, 0x67, 0x52, 0x13, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x44, 0x73,
0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4e, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72,
0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d,
0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74,
0x61, 0x31, 0x2e, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52,
0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x3a, 0x08, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0,
0x1f, 0x00, 0x22, 0xeb, 0x03, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x4f, 0x0a,
0x0e, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x98, 0xdf, 0x1f, 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52,
0x0d, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x25,
0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x73,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x56, 0x61, 0x6c, 0x69, 0x64,
0x61, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x65, 0x6e, 0x74,
0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x45,
0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, 0x31, 0x0a, 0x12, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72,
0x69, 0x63, 0x61, 0x6c, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01,
0x28, 0x0d, 0x42, 0x02, 0x18, 0x01, 0x52, 0x11, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x63,
0x61, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6e,
0x64, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62,
0x6f, 0x6e, 0x64, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x84, 0x01, 0x0a, 0x13, 0x6d, 0x69, 0x6e,
0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x74, 0x65,
0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x54, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b,
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74,
0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xf2, 0xde, 0x1f, 0x1a, 0x79,
0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6d, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73,
0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x22, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x11, 0x6d, 0x69,
0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x74, 0x65, 0x12,
0x49, 0x0a, 0x10, 0x6b, 0x65, 0x79, 0x5f, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
0x66, 0x65, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d,
0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e,
0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0e, 0x6b, 0x65, 0x79, 0x52,
0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x65, 0x3a, 0x24, 0xe8, 0xa0, 0x1f, 0x01,
0x8a, 0xe7, 0xb0, 0x2a, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f,
0x78, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x22, 0xa9, 0x01, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x0a, 0x64, 0x65, 0x6c, 0x65, 0x67,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62,
0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42,
0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x64, 0x65, 0x6c, 0x65,
0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f,
0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x07, 0x62,
0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0xcd, 0x01, 0x0a,
0x19, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74,
0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x12, 0x72, 0x65,
0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e,
0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e,
0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72,
0x79, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x11, 0x72, 0x65,
0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
0x45, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x25, 0x0a, 0x0c, 0x75, 0x6e, 0x62,
0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42,
0x02, 0x18, 0x01, 0x52, 0x0b, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x49, 0x64,
0x12, 0x3c, 0x0a, 0x1b, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x6e,
0x5f, 0x68, 0x6f, 0x6c, 0x64, 0x5f, 0x72, 0x65, 0x66, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18,
0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x17, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67,
0x4f, 0x6e, 0x48, 0x6f, 0x6c, 0x64, 0x52, 0x65, 0x66, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x04,
0xe8, 0xa0, 0x1f, 0x01, 0x22, 0x9f, 0x03, 0x0a, 0x11, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x72,
0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20,
0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x69,
0x67, 0x68, 0x74, 0x12, 0x52, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f,
0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54,
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf,
0x1f, 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74,
0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x54, 0x0a, 0x0f, 0x69, 0x6e, 0x69, 0x74, 0x69,
0x61, 0x6c, 0x5f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2,
0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x07, 0x62,
0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x22, 0xc9, 0x01, 0x0a,
0x14, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x0c, 0x72, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62,
0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0c, 0x72, 0x65,
0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x56, 0x0a, 0x07, 0x65, 0x6e,
0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62,
0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x09,
0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69,
0x65, 0x73, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0xeb, 0x01, 0x0a, 0x04, 0x50, 0x6f, 0x6f,
0x6c, 0x12, 0x71, 0x0a, 0x11, 0x6e, 0x6f, 0x74, 0x5f, 0x62, 0x6f, 0x6e, 0x64, 0x65, 0x64, 0x5f,
0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x45, 0xc8, 0xde,
0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e,
0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xea, 0xde, 0x1f, 0x11, 0x6e,
0x6f, 0x74, 0x5f, 0x62, 0x6f, 0x6e, 0x64, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73,
0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xa8, 0xe7,
0xb0, 0x2a, 0x01, 0x52, 0x0f, 0x6e, 0x6f, 0x74, 0x42, 0x6f, 0x6e, 0x64, 0x65, 0x64, 0x54, 0x6f,
0x6b, 0x65, 0x6e, 0x73, 0x12, 0x66, 0x0a, 0x0d, 0x62, 0x6f, 0x6e, 0x64, 0x65, 0x64, 0x5f, 0x74,
0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x41, 0xc8, 0xde, 0x1f,
0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69,
0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xea, 0xde, 0x1f, 0x0d, 0x62, 0x6f,
0x6e, 0x64, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0xd2, 0xb4, 0x2d, 0x0a, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0c,
0x62, 0x6f, 0x6e, 0x64, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x3a, 0x08, 0xe8, 0xa0,
0x1f, 0x01, 0xf0, 0xa0, 0x1f, 0x01, 0x22, 0x5e, 0x0a, 0x10, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61,
0x74, 0x6f, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x07, 0x75, 0x70,
0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f,
0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2e, 0x61, 0x62, 0x63, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x56,
0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x09,
0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74,
0x65, 0x73, 0x3a, 0x02, 0x18, 0x01, 0x22, 0xd0, 0x02, 0x0a, 0x19, 0x43, 0x6f, 0x6e, 0x73, 0x50,
0x75, 0x62, 0x4b, 0x65, 0x79, 0x52, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x69, 0x73,
0x74, 0x6f, 0x72, 0x79, 0x12, 0x29, 0x0a, 0x10, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72,
0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f,
0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12,
0x56, 0x0a, 0x0f, 0x6f, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x6b,
0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, 0x18,
0xca, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74,
0x6f, 0x2e, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x52, 0x0d, 0x6f, 0x6c, 0x64, 0x43, 0x6f, 0x6e,
0x73, 0x50, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x12, 0x56, 0x0a, 0x0f, 0x6e, 0x65, 0x77, 0x5f, 0x63,
0x6f, 0x6e, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, 0x18, 0xca, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d,
0x6f, 0x73, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79,
0x52, 0x0d, 0x6e, 0x65, 0x77, 0x43, 0x6f, 0x6e, 0x73, 0x50, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x12,
0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52,
0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x36, 0x0a, 0x03, 0x66, 0x65, 0x65, 0x18, 0x05,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61,
0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42,
0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x03, 0x66, 0x65, 0x65, 0x3a,
0x08, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0x53, 0x0a, 0x19, 0x56, 0x61, 0x6c,
0x41, 0x64, 0x64, 0x72, 0x73, 0x4f, 0x66, 0x52, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f,
0x6e, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73,
0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72,
0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x2a, 0xb6,
0x01, 0x0a, 0x0a, 0x42, 0x6f, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2c, 0x0a,
0x17, 0x42, 0x4f, 0x4e, 0x44, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53,
0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x1a, 0x0f, 0x8a, 0x9d, 0x20, 0x0b,
0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12, 0x26, 0x0a, 0x14, 0x42,
0x4f, 0x4e, 0x44, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x42, 0x4f, 0x4e,
0x44, 0x45, 0x44, 0x10, 0x01, 0x1a, 0x0c, 0x8a, 0x9d, 0x20, 0x08, 0x55, 0x6e, 0x62, 0x6f, 0x6e,
0x64, 0x65, 0x64, 0x12, 0x28, 0x0a, 0x15, 0x42, 0x4f, 0x4e, 0x44, 0x5f, 0x53, 0x54, 0x41, 0x54,
0x55, 0x53, 0x5f, 0x55, 0x4e, 0x42, 0x4f, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x1a, 0x0d,
0x8a, 0x9d, 0x20, 0x09, 0x55, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x22, 0x0a,
0x12, 0x42, 0x4f, 0x4e, 0x44, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x42, 0x4f, 0x4e,
0x44, 0x45, 0x44, 0x10, 0x03, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, 0x42, 0x6f, 0x6e, 0x64, 0x65,
0x64, 0x1a, 0x04, 0x88, 0xa3, 0x1e, 0x00, 0x2a, 0x5d, 0x0a, 0x0a, 0x49, 0x6e, 0x66, 0x72, 0x61,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x16, 0x49, 0x4e, 0x46, 0x52, 0x41, 0x43, 0x54,
0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10,
0x00, 0x12, 0x1a, 0x0a, 0x16, 0x49, 0x4e, 0x46, 0x52, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f,
0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x5f, 0x53, 0x49, 0x47, 0x4e, 0x10, 0x01, 0x12, 0x17, 0x0a,
0x13, 0x49, 0x4e, 0x46, 0x52, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x44, 0x4f, 0x57, 0x4e,
0x54, 0x49, 0x4d, 0x45, 0x10, 0x02, 0x42, 0xdc, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31,
0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0c, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b,
0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73,
0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x73,
0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03,
0x43, 0x53, 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61,
0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x16, 0x43,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31,
0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53,
0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47,
0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x18, 0x43, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31,
0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0e, 0x69,
0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x50, 0x0a,
0x0a, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x5f, 0x64, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28,
0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67,
0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
0x2e, 0x44, 0x65, 0x63, 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x44, 0x73, 0x74, 0x12,
0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18,
0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67,
0x49, 0x64, 0x12, 0x3c, 0x0a, 0x1b, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f,
0x6f, 0x6e, 0x5f, 0x68, 0x6f, 0x6c, 0x64, 0x5f, 0x72, 0x65, 0x66, 0x5f, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x17, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69,
0x6e, 0x67, 0x4f, 0x6e, 0x48, 0x6f, 0x6c, 0x64, 0x52, 0x65, 0x66, 0x43, 0x6f, 0x75, 0x6e, 0x74,
0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x22, 0xdd, 0x02, 0x0a, 0x0c, 0x52, 0x65, 0x64, 0x65, 0x6c,
0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67,
0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41,
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x64, 0x65,
0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x55,
0x0a, 0x15, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x73, 0x72, 0x63, 0x5f,
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, 0xd2,
0xb4, 0x2d, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61,
0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67,
0x52, 0x13, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x72, 0x63, 0x41, 0x64,
0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x55, 0x0a, 0x15, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
0x6f, 0x72, 0x5f, 0x64, 0x73, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x42, 0x21, 0xd2, 0xb4, 0x2d, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x13, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
0x6f, 0x72, 0x44, 0x73, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4e, 0x0a, 0x07,
0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e,
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76,
0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7,
0xb0, 0x2a, 0x01, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x3a, 0x08, 0x88, 0xa0,
0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0xeb, 0x03, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d,
0x73, 0x12, 0x4f, 0x0a, 0x0e, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x74,
0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x98, 0xdf, 0x1f, 0x01, 0xa8, 0xe7,
0xb0, 0x2a, 0x01, 0x52, 0x0d, 0x75, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x54, 0x69,
0x6d, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61,
0x74, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x56,
0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61, 0x78,
0x5f, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a,
0x6d, 0x61, 0x78, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, 0x31, 0x0a, 0x12, 0x68, 0x69,
0x73, 0x74, 0x6f, 0x72, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73,
0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x02, 0x18, 0x01, 0x52, 0x11, 0x68, 0x69, 0x73, 0x74,
0x6f, 0x72, 0x69, 0x63, 0x61, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, 0x1d, 0x0a,
0x0a, 0x62, 0x6f, 0x6e, 0x64, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28,
0x09, 0x52, 0x09, 0x62, 0x6f, 0x6e, 0x64, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x84, 0x01, 0x0a,
0x13, 0x6d, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f,
0x72, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x54, 0xc8, 0xde, 0x1f, 0x00,
0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f,
0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xf2,
0xde, 0x1f, 0x1a, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6d, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x6d,
0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x22, 0xd2, 0xb4, 0x2d,
0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, 0x2a, 0x01,
0x52, 0x11, 0x6d, 0x69, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52,
0x61, 0x74, 0x65, 0x12, 0x49, 0x0a, 0x10, 0x6b, 0x65, 0x79, 0x5f, 0x72, 0x6f, 0x74, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e,
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65,
0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0e,
0x6b, 0x65, 0x79, 0x52, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x65, 0x3a, 0x24,
0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d,
0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x50, 0x61,
0x72, 0x61, 0x6d, 0x73, 0x22, 0xa9, 0x01, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x0a, 0x64,
0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67,
0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a,
0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x07, 0x62, 0x61,
0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61,
0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a,
0x01, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x00,
0x22, 0xcd, 0x01, 0x0a, 0x19, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63,
0x0a, 0x12, 0x72, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65,
0x6e, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65,
0x74, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01,
0x52, 0x11, 0x72, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e,
0x74, 0x72, 0x79, 0x12, 0x45, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x04,
0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e,
0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e,
0x74, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01,
0x22, 0xc9, 0x01, 0x0a, 0x14, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x0c, 0x72, 0x65, 0x64,
0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67,
0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01,
0x52, 0x0c, 0x72, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x56,
0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x31, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67,
0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x07, 0x65,
0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0xeb, 0x01, 0x0a,
0x04, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x71, 0x0a, 0x11, 0x6e, 0x6f, 0x74, 0x5f, 0x62, 0x6f, 0x6e,
0x64, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x42, 0x45, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xea,
0xde, 0x1f, 0x11, 0x6e, 0x6f, 0x74, 0x5f, 0x62, 0x6f, 0x6e, 0x64, 0x65, 0x64, 0x5f, 0x74, 0x6f,
0x6b, 0x65, 0x6e, 0x73, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49,
0x6e, 0x74, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0f, 0x6e, 0x6f, 0x74, 0x42, 0x6f, 0x6e, 0x64,
0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x66, 0x0a, 0x0d, 0x62, 0x6f, 0x6e, 0x64,
0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42,
0x41, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73,
0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xea, 0xde,
0x1f, 0x0d, 0x62, 0x6f, 0x6e, 0x64, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0xd2,
0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xa8, 0xe7, 0xb0,
0x2a, 0x01, 0x52, 0x0c, 0x62, 0x6f, 0x6e, 0x64, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73,
0x3a, 0x08, 0xe8, 0xa0, 0x1f, 0x01, 0xf0, 0xa0, 0x1f, 0x01, 0x22, 0x5e, 0x0a, 0x10, 0x56, 0x61,
0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x46,
0x0a, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x21, 0x2e, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2e, 0x61, 0x62, 0x63, 0x69, 0x2e,
0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x07, 0x75,
0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x3a, 0x02, 0x18, 0x01, 0x22, 0xd0, 0x02, 0x0a, 0x19, 0x43,
0x6f, 0x6e, 0x73, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x52, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x29, 0x0a, 0x10, 0x6f, 0x70, 0x65, 0x72,
0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0c, 0x52, 0x0f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72,
0x65, 0x73, 0x73, 0x12, 0x56, 0x0a, 0x0f, 0x6f, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x5f,
0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41,
0x6e, 0x79, 0x42, 0x18, 0xca, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63,
0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x52, 0x0d, 0x6f, 0x6c,
0x64, 0x43, 0x6f, 0x6e, 0x73, 0x50, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x12, 0x56, 0x0a, 0x0f, 0x6e,
0x65, 0x77, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, 0x18, 0xca, 0xb4, 0x2d, 0x14,
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x50, 0x75,
0x62, 0x4b, 0x65, 0x79, 0x52, 0x0d, 0x6e, 0x65, 0x77, 0x43, 0x6f, 0x6e, 0x73, 0x50, 0x75, 0x62,
0x6b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04, 0x20,
0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x36, 0x0a, 0x03, 0x66,
0x65, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43,
0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x03,
0x66, 0x65, 0x65, 0x3a, 0x08, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0x53, 0x0a,
0x19, 0x56, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x73, 0x4f, 0x66, 0x52, 0x6f, 0x74, 0x61, 0x74,
0x65, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x64,
0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x18, 0xd2,
0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
0x65, 0x73, 0x2a, 0xb6, 0x01, 0x0a, 0x0a, 0x42, 0x6f, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x12, 0x2c, 0x0a, 0x17, 0x42, 0x4f, 0x4e, 0x44, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53,
0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x1a, 0x0f,
0x8a, 0x9d, 0x20, 0x0b, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12,
0x26, 0x0a, 0x14, 0x42, 0x4f, 0x4e, 0x44, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55,
0x4e, 0x42, 0x4f, 0x4e, 0x44, 0x45, 0x44, 0x10, 0x01, 0x1a, 0x0c, 0x8a, 0x9d, 0x20, 0x08, 0x55,
0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x65, 0x64, 0x12, 0x28, 0x0a, 0x15, 0x42, 0x4f, 0x4e, 0x44, 0x5f,
0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x42, 0x4f, 0x4e, 0x44, 0x49, 0x4e, 0x47,
0x10, 0x02, 0x1a, 0x0d, 0x8a, 0x9d, 0x20, 0x09, 0x55, 0x6e, 0x62, 0x6f, 0x6e, 0x64, 0x69, 0x6e,
0x67, 0x12, 0x22, 0x0a, 0x12, 0x42, 0x4f, 0x4e, 0x44, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53,
0x5f, 0x42, 0x4f, 0x4e, 0x44, 0x45, 0x44, 0x10, 0x03, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, 0x42,
0x6f, 0x6e, 0x64, 0x65, 0x64, 0x1a, 0x04, 0x88, 0xa3, 0x1e, 0x00, 0x2a, 0x5d, 0x0a, 0x0a, 0x49,
0x6e, 0x66, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x16, 0x49, 0x4e, 0x46,
0x52, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46,
0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x49, 0x4e, 0x46, 0x52, 0x41, 0x43, 0x54,
0x49, 0x4f, 0x4e, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x5f, 0x53, 0x49, 0x47, 0x4e, 0x10,
0x01, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x4e, 0x46, 0x52, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f,
0x44, 0x4f, 0x57, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x02, 0x42, 0xdc, 0x01, 0x0a, 0x1a, 0x63,
0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e,
0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0c, 0x53, 0x74, 0x61, 0x6b, 0x69,
0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d,
0x6f, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74,
0x61, 0x31, 0x3b, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61,
0x31, 0xa2, 0x02, 0x03, 0x43, 0x53, 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
0x2e, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31,
0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e,
0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d,
0x6f, 0x73, 0x5c, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74,
0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02,
0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67,
0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (

View File

@ -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},

View File

@ -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) {
@ -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) {
@ -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) {
@ -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) {

View File

@ -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"),
)

View File

@ -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))
@ -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))
@ -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
@ -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
@ -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
@ -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)))

View File

@ -1,460 +0,0 @@
package keeper_test
import (
"testing"
"time"
"go.uber.org/mock/gomock"
"gotest.tools/v3/assert"
"cosmossdk.io/core/header"
"cosmossdk.io/math"
banktestutil "cosmossdk.io/x/bank/testutil"
stakingkeeper "cosmossdk.io/x/staking/keeper"
"cosmossdk.io/x/staking/testutil"
"cosmossdk.io/x/staking/types"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// SetupUnbondingTests creates two validators and setup mocked staking hooks for testing unbonding
func SetupUnbondingTests(t *testing.T, f *fixture, hookCalled *bool, ubdeID *uint64) (bondDenom string, addrDels []sdk.AccAddress, addrVals []sdk.ValAddress) {
t.Helper()
// setup hooks
mockCtrl := gomock.NewController(t)
mockStackingHooks := testutil.NewMockStakingHooks(mockCtrl)
mockStackingHooks.EXPECT().AfterDelegationModified(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
mockStackingHooks.EXPECT().AfterUnbondingInitiated(gomock.Any(), gomock.Any()).DoAndReturn(func(ctx sdk.Context, id uint64) error {
*hookCalled = true
// save id
*ubdeID = id
// call back to stop unbonding
err := f.stakingKeeper.PutUnbondingOnHold(f.sdkCtx, id)
assert.NilError(t, err)
return nil
}).AnyTimes()
mockStackingHooks.EXPECT().AfterValidatorBeginUnbonding(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
mockStackingHooks.EXPECT().AfterValidatorBonded(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
mockStackingHooks.EXPECT().AfterValidatorCreated(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
mockStackingHooks.EXPECT().AfterValidatorRemoved(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
mockStackingHooks.EXPECT().BeforeDelegationCreated(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
mockStackingHooks.EXPECT().BeforeDelegationRemoved(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
mockStackingHooks.EXPECT().BeforeDelegationSharesModified(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
mockStackingHooks.EXPECT().BeforeValidatorModified(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
mockStackingHooks.EXPECT().BeforeValidatorSlashed(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
mockStackingHooks.EXPECT().AfterConsensusPubKeyUpdate(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
f.stakingKeeper.SetHooks(types.NewMultiStakingHooks(mockStackingHooks))
addrDels = simtestutil.AddTestAddrsIncremental(f.bankKeeper, f.stakingKeeper, f.sdkCtx, 2, math.NewInt(10000))
addrVals = simtestutil.ConvertAddrsToValAddrs(addrDels)
valTokens := f.stakingKeeper.TokensFromConsensusPower(f.sdkCtx, 10)
startTokens := f.stakingKeeper.TokensFromConsensusPower(f.sdkCtx, 20)
bondDenom, err := f.stakingKeeper.BondDenom(f.sdkCtx)
assert.NilError(t, err)
notBondedPool := f.stakingKeeper.GetNotBondedPool(f.sdkCtx)
assert.NilError(t, banktestutil.FundModuleAccount(f.sdkCtx, f.bankKeeper, notBondedPool.GetName(), sdk.NewCoins(sdk.NewCoin(bondDenom, startTokens))))
f.accountKeeper.SetModuleAccount(f.sdkCtx, notBondedPool)
// Create a validator
validator1 := testutil.NewValidator(t, addrVals[0], PKs[0])
validator1, issuedShares1 := validator1.AddTokensFromDel(valTokens)
assert.DeepEqual(t, valTokens, issuedShares1.RoundInt())
validator1 = stakingkeeper.TestingUpdateValidator(f.stakingKeeper, f.sdkCtx, validator1, true)
assert.Assert(math.IntEq(t, valTokens, validator1.BondedTokens()))
assert.Assert(t, validator1.IsBonded())
// Create a delegator
delegation := types.NewDelegation(addrDels[0].String(), addrVals[0].String(), issuedShares1)
assert.NilError(t, f.stakingKeeper.SetDelegation(f.sdkCtx, delegation))
// Create a validator to redelegate to
validator2 := testutil.NewValidator(t, addrVals[1], PKs[1])
validator2, issuedShares2 := validator2.AddTokensFromDel(valTokens)
assert.DeepEqual(t, valTokens, issuedShares2.RoundInt())
validator2 = stakingkeeper.TestingUpdateValidator(f.stakingKeeper, f.sdkCtx, validator2, true)
assert.Equal(t, types.Bonded, validator2.Status)
assert.Assert(t, validator2.IsBonded())
return bondDenom, addrDels, addrVals
}
func doUnbondingDelegation(
t *testing.T,
stakingKeeper *stakingkeeper.Keeper,
bankKeeper types.BankKeeper,
ctx sdk.Context,
bondDenom string,
addrDels []sdk.AccAddress,
addrVals []sdk.ValAddress,
hookCalled *bool,
) (completionTime time.Time, bondedAmt, notBondedAmt math.Int) {
t.Helper()
// UNDELEGATE
// Save original bonded and unbonded amounts
bondedAmt1 := bankKeeper.GetBalance(ctx, stakingKeeper.GetBondedPool(ctx).GetAddress(), bondDenom).Amount
notBondedAmt1 := bankKeeper.GetBalance(ctx, stakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount
var err error
undelegateAmount := math.LegacyNewDec(1)
completionTime, undelegatedAmount, err := stakingKeeper.Undelegate(ctx, addrDels[0], addrVals[0], undelegateAmount)
assert.NilError(t, err)
assert.Assert(t, undelegateAmount.Equal(math.LegacyNewDecFromInt(undelegatedAmount)))
// check that the unbonding actually happened
bondedAmt2 := bankKeeper.GetBalance(ctx, stakingKeeper.GetBondedPool(ctx).GetAddress(), bondDenom).Amount
notBondedAmt2 := bankKeeper.GetBalance(ctx, stakingKeeper.GetNotBondedPool(ctx).GetAddress(), bondDenom).Amount
// Bonded amount is less
assert.Assert(math.IntEq(t, bondedAmt1.SubRaw(1), bondedAmt2))
// Unbonded amount is more
assert.Assert(math.IntEq(t, notBondedAmt1.AddRaw(1), notBondedAmt2))
// Check that the unbonding happened- we look up the entry and see that it has the correct number of shares
unbondingDelegations, err := stakingKeeper.GetUnbondingDelegationsFromValidator(ctx, addrVals[0])
assert.NilError(t, err)
assert.DeepEqual(t, math.NewInt(1), unbondingDelegations[0].Entries[0].Balance)
// check that our hook was called
assert.Assert(t, *hookCalled)
return completionTime, bondedAmt2, notBondedAmt2
}
func doRedelegation(
t *testing.T,
stakingKeeper *stakingkeeper.Keeper,
ctx sdk.Context,
addrDels []sdk.AccAddress,
addrVals []sdk.ValAddress,
hookCalled *bool,
) (completionTime time.Time) {
t.Helper()
var err error
completionTime, err = stakingKeeper.BeginRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1], math.LegacyNewDec(1))
assert.NilError(t, err)
// Check that the redelegation happened- we look up the entry and see that it has the correct number of shares
redelegations, err := stakingKeeper.GetRedelegationsFromSrcValidator(ctx, addrVals[0])
assert.NilError(t, err)
assert.Equal(t, 1, len(redelegations))
assert.DeepEqual(t, math.LegacyNewDec(1), redelegations[0].Entries[0].SharesDst)
// check that our hook was called
assert.Assert(t, *hookCalled)
return completionTime
}
func doValidatorUnbonding(
t *testing.T,
stakingKeeper *stakingkeeper.Keeper,
ctx sdk.Context,
addrVal sdk.ValAddress,
hookCalled *bool,
) (validator types.Validator) {
t.Helper()
validator, found := stakingKeeper.GetValidator(ctx, addrVal)
assert.Assert(t, found)
// Check that status is bonded
assert.Equal(t, types.BondStatus(3), validator.Status)
validator, err := stakingKeeper.BeginUnbondingValidator(ctx, validator)
assert.NilError(t, err)
// Check that status is unbonding
assert.Equal(t, types.BondStatus(2), validator.Status)
// check that our hook was called
assert.Assert(t, *hookCalled)
return validator
}
func TestValidatorUnbondingOnHold1(t *testing.T) {
t.Parallel()
f := initFixture(t)
var (
hookCalled bool
ubdeID uint64
)
_, _, addrVals := SetupUnbondingTests(t, f, &hookCalled, &ubdeID)
// Start unbonding first validator
validator := doValidatorUnbonding(t, f.stakingKeeper, f.sdkCtx, addrVals[0], &hookCalled)
completionTime := validator.UnbondingTime
completionHeight := validator.UnbondingHeight
// CONSUMER CHAIN'S UNBONDING PERIOD ENDS - STOPPED UNBONDING CAN NOW COMPLETE
err := f.stakingKeeper.UnbondingCanComplete(f.sdkCtx, ubdeID)
assert.NilError(t, err)
// Try to unbond validator
assert.NilError(t, f.stakingKeeper.UnbondAllMatureValidators(f.sdkCtx))
// Check that validator unbonding is not complete (is not mature yet)
validator, found := f.stakingKeeper.GetValidator(f.sdkCtx, addrVals[0])
assert.Assert(t, found)
assert.Equal(t, types.Unbonding, validator.Status)
unbondingVals, err := f.stakingKeeper.GetUnbondingValidators(f.sdkCtx, completionTime, completionHeight)
assert.NilError(t, err)
assert.Equal(t, 1, len(unbondingVals))
assert.Equal(t, validator.OperatorAddress, unbondingVals[0])
// PROVIDER CHAIN'S UNBONDING PERIOD ENDS - BUT UNBONDING CANNOT COMPLETE
f.sdkCtx = f.sdkCtx.WithHeaderInfo(header.Info{Time: completionTime.Add(time.Duration(1))})
f.sdkCtx = f.sdkCtx.WithBlockHeight(completionHeight + 1)
assert.NilError(t, f.stakingKeeper.UnbondAllMatureValidators(f.sdkCtx))
// Check that validator unbonding is complete
validator, found = f.stakingKeeper.GetValidator(f.sdkCtx, addrVals[0])
assert.Assert(t, found)
assert.Equal(t, types.Unbonded, validator.Status)
unbondingVals, err = f.stakingKeeper.GetUnbondingValidators(f.sdkCtx, completionTime, completionHeight)
assert.NilError(t, err)
assert.Equal(t, 0, len(unbondingVals))
}
func TestValidatorUnbondingOnHold2(t *testing.T) {
t.Parallel()
f := initFixture(t)
var (
hookCalled bool
ubdeID uint64
ubdeIDs []uint64
)
_, _, addrVals := SetupUnbondingTests(t, f, &hookCalled, &ubdeID)
// Start unbonding first validator
validator1 := doValidatorUnbonding(t, f.stakingKeeper, f.sdkCtx, addrVals[0], &hookCalled)
ubdeIDs = append(ubdeIDs, ubdeID)
// Reset hookCalled flag
hookCalled = false
// Start unbonding second validator
validator2 := doValidatorUnbonding(t, f.stakingKeeper, f.sdkCtx, addrVals[1], &hookCalled)
ubdeIDs = append(ubdeIDs, ubdeID)
// Check that there are two unbonding operations
assert.Equal(t, 2, len(ubdeIDs))
// Check that both validators have same unbonding time
assert.Equal(t, validator1.UnbondingTime, validator2.UnbondingTime)
completionTime := validator1.UnbondingTime
completionHeight := validator1.UnbondingHeight
// PROVIDER CHAIN'S UNBONDING PERIOD ENDS - BUT UNBONDING CANNOT COMPLETE
f.sdkCtx = f.sdkCtx.WithHeaderInfo(header.Info{Time: completionTime.Add(time.Duration(1))})
f.sdkCtx = f.sdkCtx.WithBlockHeight(completionHeight + 1)
assert.NilError(t, f.stakingKeeper.UnbondAllMatureValidators(f.sdkCtx))
// Check that unbonding is not complete for both validators
validator1, found := f.stakingKeeper.GetValidator(f.sdkCtx, addrVals[0])
assert.Assert(t, found)
assert.Equal(t, types.Unbonding, validator1.Status)
validator2, found = f.stakingKeeper.GetValidator(f.sdkCtx, addrVals[1])
assert.Assert(t, found)
assert.Equal(t, types.Unbonding, validator2.Status)
unbondingVals, err := f.stakingKeeper.GetUnbondingValidators(f.sdkCtx, completionTime, completionHeight)
assert.NilError(t, err)
assert.Equal(t, 2, len(unbondingVals))
assert.Equal(t, validator1.OperatorAddress, unbondingVals[0])
assert.Equal(t, validator2.OperatorAddress, unbondingVals[1])
// CONSUMER CHAIN'S UNBONDING PERIOD ENDS - STOPPED UNBONDING CAN NOW COMPLETE
err = f.stakingKeeper.UnbondingCanComplete(f.sdkCtx, ubdeIDs[0])
assert.NilError(t, err)
// Try again to unbond validators
assert.NilError(t, f.stakingKeeper.UnbondAllMatureValidators(f.sdkCtx))
// Check that unbonding is complete for validator1, but not for validator2
validator1, found = f.stakingKeeper.GetValidator(f.sdkCtx, addrVals[0])
assert.Assert(t, found)
assert.Equal(t, types.Unbonded, validator1.Status)
validator2, found = f.stakingKeeper.GetValidator(f.sdkCtx, addrVals[1])
assert.Assert(t, found)
assert.Equal(t, types.Unbonding, validator2.Status)
unbondingVals, err = f.stakingKeeper.GetUnbondingValidators(f.sdkCtx, completionTime, completionHeight)
assert.NilError(t, err)
assert.Equal(t, 1, len(unbondingVals))
assert.Equal(t, validator2.OperatorAddress, unbondingVals[0])
// Unbonding for validator2 can complete
err = f.stakingKeeper.UnbondingCanComplete(f.sdkCtx, ubdeIDs[1])
assert.NilError(t, err)
// Try again to unbond validators
assert.NilError(t, f.stakingKeeper.UnbondAllMatureValidators(f.sdkCtx))
// Check that unbonding is complete for validator2
validator2, found = f.stakingKeeper.GetValidator(f.sdkCtx, addrVals[1])
assert.Assert(t, found)
assert.Equal(t, types.Unbonded, validator2.Status)
unbondingVals, err = f.stakingKeeper.GetUnbondingValidators(f.sdkCtx, completionTime, completionHeight)
assert.NilError(t, err)
assert.Equal(t, 0, len(unbondingVals))
}
func TestRedelegationOnHold1(t *testing.T) {
t.Parallel()
f := initFixture(t)
var (
hookCalled bool
ubdeID uint64
)
// _, app, ctx := createTestInput(t)
_, addrDels, addrVals := SetupUnbondingTests(t, f, &hookCalled, &ubdeID)
completionTime := doRedelegation(t, f.stakingKeeper, f.sdkCtx, addrDels, addrVals, &hookCalled)
// CONSUMER CHAIN'S UNBONDING PERIOD ENDS - BUT UNBONDING CANNOT COMPLETE
err := f.stakingKeeper.UnbondingCanComplete(f.sdkCtx, ubdeID)
assert.NilError(t, err)
// Redelegation is not complete - still exists
redelegations, err := f.stakingKeeper.GetRedelegationsFromSrcValidator(f.sdkCtx, addrVals[0])
assert.NilError(t, err)
assert.Equal(t, 1, len(redelegations))
// PROVIDER CHAIN'S UNBONDING PERIOD ENDS - STOPPED UNBONDING CAN NOW COMPLETE
f.sdkCtx = f.sdkCtx.WithHeaderInfo(header.Info{Time: completionTime})
_, err = f.stakingKeeper.CompleteRedelegation(f.sdkCtx, addrDels[0], addrVals[0], addrVals[1])
assert.NilError(t, err)
// Redelegation is complete and record is gone
redelegations, err = f.stakingKeeper.GetRedelegationsFromSrcValidator(f.sdkCtx, addrVals[0])
assert.NilError(t, err)
assert.Equal(t, 0, len(redelegations))
}
func TestRedelegationOnHold2(t *testing.T) {
t.Parallel()
f := initFixture(t)
var (
hookCalled bool
ubdeID uint64
)
// _, app, ctx := createTestInput(t)
_, addrDels, addrVals := SetupUnbondingTests(t, f, &hookCalled, &ubdeID)
completionTime := doRedelegation(t, f.stakingKeeper, f.sdkCtx, addrDels, addrVals, &hookCalled)
// PROVIDER CHAIN'S UNBONDING PERIOD ENDS - BUT UNBONDING CANNOT COMPLETE
f.sdkCtx = f.sdkCtx.WithHeaderInfo(header.Info{Time: completionTime})
_, err := f.stakingKeeper.CompleteRedelegation(f.sdkCtx, addrDels[0], addrVals[0], addrVals[1])
assert.NilError(t, err)
// Redelegation is not complete - still exists
redelegations, err := f.stakingKeeper.GetRedelegationsFromSrcValidator(f.sdkCtx, addrVals[0])
assert.NilError(t, err)
assert.Equal(t, 1, len(redelegations))
// CONSUMER CHAIN'S UNBONDING PERIOD ENDS - STOPPED UNBONDING CAN NOW COMPLETE
err = f.stakingKeeper.UnbondingCanComplete(f.sdkCtx, ubdeID)
assert.NilError(t, err)
// Redelegation is complete and record is gone
redelegations, err = f.stakingKeeper.GetRedelegationsFromSrcValidator(f.sdkCtx, addrVals[0])
assert.NilError(t, err)
assert.Equal(t, 0, len(redelegations))
}
func TestUnbondingDelegationOnHold1(t *testing.T) {
t.Parallel()
f := initFixture(t)
var (
hookCalled bool
ubdeID uint64
)
// _, app, ctx := createTestInput(t)
bondDenom, addrDels, addrVals := SetupUnbondingTests(t, f, &hookCalled, &ubdeID)
for _, addr := range addrDels {
acc := f.accountKeeper.NewAccountWithAddress(f.sdkCtx, addr)
f.accountKeeper.SetAccount(f.sdkCtx, acc)
}
completionTime, bondedAmt1, notBondedAmt1 := doUnbondingDelegation(t, f.stakingKeeper, f.bankKeeper, f.sdkCtx, bondDenom, addrDels, addrVals, &hookCalled)
// CONSUMER CHAIN'S UNBONDING PERIOD ENDS - BUT UNBONDING CANNOT COMPLETE
err := f.stakingKeeper.UnbondingCanComplete(f.sdkCtx, ubdeID)
assert.NilError(t, err)
bondedAmt3 := f.bankKeeper.GetBalance(f.sdkCtx, f.stakingKeeper.GetBondedPool(f.sdkCtx).GetAddress(), bondDenom).Amount
notBondedAmt3 := f.bankKeeper.GetBalance(f.sdkCtx, f.stakingKeeper.GetNotBondedPool(f.sdkCtx).GetAddress(), bondDenom).Amount
// Bonded and unbonded amounts are the same as before because the completionTime has not yet passed and so the
// unbondingDelegation has not completed
assert.Assert(math.IntEq(t, bondedAmt1, bondedAmt3))
assert.Assert(math.IntEq(t, notBondedAmt1, notBondedAmt3))
// PROVIDER CHAIN'S UNBONDING PERIOD ENDS - STOPPED UNBONDING CAN NOW COMPLETE
f.sdkCtx = f.sdkCtx.WithHeaderInfo(header.Info{Time: completionTime})
_, err = f.stakingKeeper.CompleteUnbonding(f.sdkCtx, addrDels[0], addrVals[0])
assert.NilError(t, err)
// Check that the unbonding was finally completed
bondedAmt5 := f.bankKeeper.GetBalance(f.sdkCtx, f.stakingKeeper.GetBondedPool(f.sdkCtx).GetAddress(), bondDenom).Amount
notBondedAmt5 := f.bankKeeper.GetBalance(f.sdkCtx, f.stakingKeeper.GetNotBondedPool(f.sdkCtx).GetAddress(), bondDenom).Amount
assert.Assert(math.IntEq(t, bondedAmt1, bondedAmt5))
// Not bonded amount back to what it was originally
assert.Assert(math.IntEq(t, notBondedAmt1.SubRaw(1), notBondedAmt5))
}
func TestUnbondingDelegationOnHold2(t *testing.T) {
t.Parallel()
f := initFixture(t)
var (
hookCalled bool
ubdeID uint64
)
// _, app, ctx := createTestInput(t)
bondDenom, addrDels, addrVals := SetupUnbondingTests(t, f, &hookCalled, &ubdeID)
for _, addr := range addrDels {
acc := f.accountKeeper.NewAccountWithAddress(f.sdkCtx, addr)
f.accountKeeper.SetAccount(f.sdkCtx, acc)
}
completionTime, bondedAmt1, notBondedAmt1 := doUnbondingDelegation(t, f.stakingKeeper, f.bankKeeper, f.sdkCtx, bondDenom, addrDels, addrVals, &hookCalled)
// PROVIDER CHAIN'S UNBONDING PERIOD ENDS - BUT UNBONDING CANNOT COMPLETE
f.sdkCtx = f.sdkCtx.WithHeaderInfo(header.Info{Time: completionTime})
_, err := f.stakingKeeper.CompleteUnbonding(f.sdkCtx, addrDels[0], addrVals[0])
assert.NilError(t, err)
bondedAmt3 := f.bankKeeper.GetBalance(f.sdkCtx, f.stakingKeeper.GetBondedPool(f.sdkCtx).GetAddress(), bondDenom).Amount
notBondedAmt3 := f.bankKeeper.GetBalance(f.sdkCtx, f.stakingKeeper.GetNotBondedPool(f.sdkCtx).GetAddress(), bondDenom).Amount
// Bonded and unbonded amounts are the same as before because the completionTime has not yet passed and so the
// unbondingDelegation has not completed
assert.Assert(math.IntEq(t, bondedAmt1, bondedAmt3))
assert.Assert(math.IntEq(t, notBondedAmt1, notBondedAmt3))
// CONSUMER CHAIN'S UNBONDING PERIOD ENDS - STOPPED UNBONDING CAN NOW COMPLETE
err = f.stakingKeeper.UnbondingCanComplete(f.sdkCtx, ubdeID)
assert.NilError(t, err)
// Check that the unbonding was finally completed
bondedAmt5 := f.bankKeeper.GetBalance(f.sdkCtx, f.stakingKeeper.GetBondedPool(f.sdkCtx).GetAddress(), bondDenom).Amount
notBondedAmt5 := f.bankKeeper.GetBalance(f.sdkCtx, f.stakingKeeper.GetNotBondedPool(f.sdkCtx).GetAddress(), bondDenom).Amount
assert.Assert(math.IntEq(t, bondedAmt1, bondedAmt5))
// Not bonded amount back to what it was originally
assert.Assert(math.IntEq(t, notBondedAmt1.SubRaw(1), notBondedAmt5))
}

View File

@ -104,6 +104,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [#21315](https://github.com/cosmos/cosmos-sdk/pull/21315) New struct `Metadata` to store extra validator information.
* New field `Metadata` introduced in `types`: `Description`.
* The signature of `NewDescription` has changed to accept an extra argument of type `Metadata`.
* [#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.
* [#22795](https://github.com/cosmos/cosmos-sdk/pull/22795) AfterUnbondingInitiated hook has been removed as it is no longer required by ICS.
### State Breaking changes
@ -111,3 +113,4 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [#18142](https://github.com/cosmos/cosmos-sdk/pull/18142) Introduce `key_rotation_fee` param to calculate fees while rotating the keys
* [#19740](https://github.com/cosmos/cosmos-sdk/pull/19740) `InitGenesis` and `ExportGenesis` module code and keeper code do not panic but return errors.
* [#20845](https://github.com/cosmoc/cosmos-sdk/pull/20845) Remove HistoricalInfo from the staking modules storage
* [#22795](https://github.com/cosmos/cosmos-sdk/pull/22795) Keys `stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, stakingtypes.UnbondingTypeKey` have been removed as they are no longer required by ICS.

View File

@ -310,17 +310,11 @@ func (k Keeper) SetUnbondingDelegationEntry(
ctx context.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress,
creationHeight int64, minTime time.Time, balance math.Int,
) (types.UnbondingDelegation, error) {
id, err := k.IncrementUnbondingID(ctx)
if err != nil {
return types.UnbondingDelegation{}, err
}
isNewUbdEntry := true
ubd, err := k.GetUnbondingDelegation(ctx, delegatorAddr, validatorAddr)
if err == nil {
isNewUbdEntry = ubd.AddEntry(creationHeight, minTime, balance, id)
ubd.AddEntry(creationHeight, minTime, balance)
} else if errors.Is(err, types.ErrNoUnbondingDelegation) {
ubd = types.NewUnbondingDelegation(delegatorAddr, validatorAddr, creationHeight, minTime, balance, id, k.validatorAddressCodec, k.authKeeper.AddressCodec())
ubd = types.NewUnbondingDelegation(delegatorAddr, validatorAddr, creationHeight, minTime, balance, k.validatorAddressCodec, k.authKeeper.AddressCodec())
} else {
return ubd, err
}
@ -329,18 +323,6 @@ func (k Keeper) SetUnbondingDelegationEntry(
return ubd, err
}
// only call the hook for new entries since
// calls to AfterUnbondingInitiated are not idempotent
if isNewUbdEntry {
// Add to the UBDByUnbondingOp index to look up the UBD by the UBDE ID
if err = k.SetUnbondingDelegationByUnbondingID(ctx, ubd, id); err != nil {
return ubd, err
}
if err := k.Hooks().AfterUnbondingInitiated(ctx, id); err != nil {
return ubd, fmt.Errorf("failed to call after unbonding initiated hook: %w", err)
}
}
return ubd, nil
}
@ -528,17 +510,12 @@ func (k Keeper) SetRedelegationEntry(ctx context.Context,
minTime time.Time, balance math.Int,
sharesSrc, sharesDst math.LegacyDec,
) (types.Redelegation, error) {
id, err := k.IncrementUnbondingID(ctx)
if err != nil {
return types.Redelegation{}, err
}
red, err := k.Redelegations.Get(ctx, collections.Join3(delegatorAddr.Bytes(), validatorSrcAddr.Bytes(), validatorDstAddr.Bytes()))
if err == nil {
red.AddEntry(creationHeight, minTime, balance, sharesDst, id)
red.AddEntry(creationHeight, minTime, balance, sharesDst)
} else if errors.Is(err, collections.ErrNotFound) {
red = types.NewRedelegation(delegatorAddr, validatorSrcAddr,
validatorDstAddr, creationHeight, minTime, balance, sharesDst, id, k.validatorAddressCodec, k.authKeeper.AddressCodec())
validatorDstAddr, creationHeight, minTime, balance, sharesDst, k.validatorAddressCodec, k.authKeeper.AddressCodec())
} else {
return types.Redelegation{}, err
}
@ -547,15 +524,6 @@ func (k Keeper) SetRedelegationEntry(ctx context.Context,
return types.Redelegation{}, err
}
// Add to the UBDByEntry index to look up the UBD by the UBDE ID
if err = k.SetRedelegationByUnbondingID(ctx, red, id); err != nil {
return types.Redelegation{}, err
}
if err := k.Hooks().AfterUnbondingInitiated(ctx, id); err != nil {
return types.Redelegation{}, fmt.Errorf("failed to call after unbonding initiated hook: %w", err)
}
return red, nil
}
@ -996,12 +964,9 @@ func (k Keeper) CompleteUnbonding(ctx context.Context, delAddr sdk.AccAddress, v
// loop through all the entries and complete unbonding mature entries
for i := 0; i < len(ubd.Entries); i++ {
entry := ubd.Entries[i]
if entry.IsMature(ctxTime) && !entry.OnHold() {
if entry.IsMature(ctxTime) {
ubd.RemoveEntry(int64(i))
i--
if err = k.DeleteUnbondingIndex(ctx, entry.UnbondingId); err != nil {
return nil, err
}
// track undelegation only when remaining or truncated shares are non-zero
if !entry.Balance.IsZero() {
@ -1136,12 +1101,9 @@ func (k Keeper) CompleteRedelegation(
// loop through all the entries and complete mature redelegation entries
for i := 0; i < len(red.Entries); i++ {
entry := red.Entries[i]
if entry.IsMature(ctxTime) && !entry.OnHold() {
if entry.IsMature(ctxTime) {
red.RemoveEntry(int64(i))
i--
if err = k.DeleteUnbondingIndex(ctx, entry.UnbondingId); err != nil {
return nil, err
}
if !entry.InitialBalance.IsZero() {
balances = balances.Add(sdk.NewCoin(bondDenom, entry.InitialBalance))

View File

@ -286,7 +286,6 @@ func (s *KeeperTestSuite) TestUnbondingDelegation() {
0,
time.Unix(0, 0).UTC(),
math.NewInt(5),
0,
address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"),
)
@ -343,8 +342,8 @@ func (s *KeeperTestSuite) TestUnbondingDelegationsFromValidator() {
0,
time.Unix(0, 0).UTC(),
math.NewInt(5),
0,
address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"),
address.NewBech32Codec("cosmosvaloper"),
address.NewBech32Codec("cosmos"),
)
// set and retrieve a record
@ -716,7 +715,7 @@ func (s *KeeperTestSuite) TestGetRedelegationsFromSrcValidator() {
rd := stakingtypes.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 0,
time.Unix(0, 0), math.NewInt(5),
math.LegacyNewDec(5), 0, address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
math.LegacyNewDec(5), address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
// set and retrieve a record
err := keeper.SetRedelegation(ctx, rd)
@ -746,7 +745,7 @@ func (s *KeeperTestSuite) TestRedelegation() {
rd := stakingtypes.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 0,
time.Unix(0, 0).UTC(), math.NewInt(5),
math.LegacyNewDec(5), 0, address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
math.LegacyNewDec(5), address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
// test shouldn't have and redelegations
has, err := keeper.HasReceivingRedelegation(ctx, addrDels[0], addrVals[1])
@ -1107,14 +1106,14 @@ func (s *KeeperTestSuite) TestUnbondingDelegationAddEntry() {
creationHeight,
time.Unix(0, 0).UTC(),
math.NewInt(10),
0,
address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"),
address.NewBech32Codec("cosmosvaloper"),
address.NewBech32Codec("cosmos"),
)
var initialEntries []stakingtypes.UnbondingDelegationEntry
initialEntries = append(initialEntries, ubd.Entries...)
require.Len(initialEntries, 1)
isNew := ubd.AddEntry(creationHeight, time.Unix(0, 0).UTC(), math.NewInt(5), 1)
isNew := ubd.AddEntry(creationHeight, time.Unix(0, 0).UTC(), math.NewInt(5))
require.False(isNew)
require.Len(ubd.Entries, 1) // entry was merged
require.NotEqual(initialEntries, ubd.Entries)
@ -1123,7 +1122,7 @@ func (s *KeeperTestSuite) TestUnbondingDelegationAddEntry() {
require.Equal(ubd.Entries[0].Balance, math.NewInt(15)) // 10 from previous + 5 from merged
newCreationHeight := int64(11)
isNew = ubd.AddEntry(newCreationHeight, time.Unix(1, 0).UTC(), math.NewInt(5), 2)
isNew = ubd.AddEntry(newCreationHeight, time.Unix(1, 0).UTC(), math.NewInt(5))
require.True(isNew)
require.Len(ubd.Entries, 2) // entry was appended
require.NotEqual(initialEntries, ubd.Entries)
@ -1131,7 +1130,6 @@ func (s *KeeperTestSuite) TestUnbondingDelegationAddEntry() {
require.Equal(newCreationHeight, ubd.Entries[1].CreationHeight)
require.Equal(ubd.Entries[0].Balance, math.NewInt(15))
require.Equal(ubd.Entries[1].Balance, math.NewInt(5))
require.NotEqual(ubd.Entries[0].UnbondingId, ubd.Entries[1].UnbondingId) // appended entry has a new unbondingID
}
func (s *KeeperTestSuite) TestSetUnbondingDelegationEntry() {
@ -1149,8 +1147,8 @@ func (s *KeeperTestSuite) TestSetUnbondingDelegationEntry() {
creationHeight,
time.Unix(0, 0).UTC(),
math.NewInt(5),
0,
address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"),
address.NewBech32Codec("cosmosvaloper"),
address.NewBech32Codec("cosmos"),
)
// set and retrieve a record
@ -1180,8 +1178,7 @@ func (s *KeeperTestSuite) TestSetUnbondingDelegationEntry() {
require.Len(resUnbonding.Entries, 1)
require.NotEqual(initialEntries, resUnbonding.Entries)
require.Equal(creationHeight, resUnbonding.Entries[0].CreationHeight)
require.Equal(initialEntries[0].UnbondingId, resUnbonding.Entries[0].UnbondingId) // initial unbondingID remains unchanged
require.Equal(resUnbonding.Entries[0].Balance, math.NewInt(10)) // 5 from previous entry + 5 from merged entry
require.Equal(resUnbonding.Entries[0].Balance, math.NewInt(10)) // 5 from previous entry + 5 from merged entry
// set unbonding delegation entry for newCreationHeight
// new entry is expected to be appended to the existing entries
@ -1202,11 +1199,6 @@ func (s *KeeperTestSuite) TestSetUnbondingDelegationEntry() {
require.NotEqual(resUnbonding.Entries[0], resUnbonding.Entries[1])
require.Equal(creationHeight, resUnbonding.Entries[0].CreationHeight)
require.Equal(newCreationHeight, resUnbonding.Entries[1].CreationHeight)
// unbondingID is incremented on every call to SetUnbondingDelegationEntry
// unbondingID == 1 was skipped because the entry was merged with the existing entry with unbondingID == 0
// unbondingID comes from a global counter -> gaps in unbondingIDs are OK as long as every unbondingID is unique
require.Equal(uint64(2), resUnbonding.Entries[1].UnbondingId)
}
func (s *KeeperTestSuite) TestUndelegateWithDustShare() {

View File

@ -648,7 +648,6 @@ func redelegationsToRedelegationResponses(ctx context.Context, k *Keeper, redels
entry.SharesDst,
entry.InitialBalance,
val.TokensFromShares(entry.SharesDst).TruncateInt(),
entry.UnbondingId,
)
}

View File

@ -70,17 +70,12 @@ type Keeper struct {
LastTotalPower collections.Item[math.Int]
// DelegationsByValidator key: valAddr+delAddr | value: none used (index key for delegations by validator index)
DelegationsByValidator collections.Map[collections.Pair[sdk.ValAddress, sdk.AccAddress], []byte]
UnbondingID collections.Sequence
// ValidatorByConsensusAddress key: consAddr | value: valAddr
ValidatorByConsensusAddress collections.Map[sdk.ConsAddress, sdk.ValAddress]
// UnbondingType key: unbondingID | value: index of UnbondingType
UnbondingType collections.Map[uint64, uint64]
// Redelegations key: AccAddr+SrcValAddr+DstValAddr | value: Redelegation
Redelegations collections.Map[collections.Triple[[]byte, []byte, []byte], types.Redelegation]
// Delegations key: AccAddr+valAddr | value: Delegation
Delegations collections.Map[collections.Pair[sdk.AccAddress, sdk.ValAddress], types.Delegation]
// UnbondingIndex key:UnbondingID | value: ubdKey (ubdKey = [UnbondingDelegationKey(Prefix)+len(delAddr)+delAddr+len(valAddr)+valAddr])
UnbondingIndex collections.Map[uint64, []byte]
// UnbondingQueue key: Timestamp | value: DVPairs [delAddr+valAddr]
UnbondingQueue collections.Map[time.Time, types.DVPairs]
// Validators key: valAddr | value: Validator
@ -178,14 +173,12 @@ func NewKeeper(
),
collections.BytesValue,
),
UnbondingID: collections.NewSequence(sb, types.UnbondingIDKey, "unbonding_id"),
ValidatorByConsensusAddress: collections.NewMap(
sb, types.ValidatorsByConsAddrKey,
"validator_by_cons_addr",
sdk.LengthPrefixedAddressKey(sdk.ConsAddressKey).WithName("cons_address"), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility
collcodec.KeyToValueCodec(sdk.ValAddressKey),
),
UnbondingType: collections.NewMap(sb, types.UnbondingTypeKey, "unbonding_type", collections.Uint64Key.WithName("unbonding_id"), collections.Uint64Value),
// key format is: 52 | lengthPrefixedBytes(AccAddr) | lengthPrefixedBytes(SrcValAddr) | lengthPrefixedBytes(DstValAddr)
Redelegations: collections.NewMap(
sb, types.RedelegationKey,
@ -200,7 +193,6 @@ func NewKeeper(
),
codec.CollValue[types.Redelegation](cdc),
),
UnbondingIndex: collections.NewMap(sb, types.UnbondingIndexKey, "unbonding_index", collections.Uint64Key.WithName("index"), collections.BytesValue.WithName("ubd_key")),
UnbondingDelegationByValIndex: collections.NewMap(
sb, types.UnbondingDelegationByValIndexKey,
"unbonding_delegation_by_val_index",

View File

@ -939,7 +939,7 @@ func (s *KeeperTestSuite) TestMsgCancelUnbondingDelegation() {
require.NoError(err)
require.Equal(del, resDel)
ubd := types.NewUnbondingDelegation(Addr, ValAddr, 10, ctx.HeaderInfo().Time.Add(time.Minute*10), shares.RoundInt(), 0, keeper.ValidatorAddressCodec(), ak.AddressCodec())
ubd := types.NewUnbondingDelegation(Addr, ValAddr, 10, ctx.HeaderInfo().Time.Add(time.Minute*10), shares.RoundInt(), keeper.ValidatorAddressCodec(), ak.AddressCodec())
require.NoError(keeper.SetUnbondingDelegation(ctx, ubd))
resUnbond, err := keeper.GetUnbondingDelegation(ctx, Addr, ValAddr)
require.NoError(err)

View File

@ -254,7 +254,7 @@ func (k Keeper) SlashUnbondingDelegation(ctx context.Context, unbondingDelegatio
continue
}
if entry.IsMature(now) && !entry.OnHold() {
if entry.IsMature(now) {
// Unbonding delegation no longer eligible for slashing, skip it
continue
}
@ -346,7 +346,7 @@ func (k Keeper) SlashRedelegation(ctx context.Context, srcValidator types.Valida
case entry.CreationHeight < infractionHeight:
continue
// Unbonding delegation no longer eligible for slashing, skip it
case entry.IsMature(now) && !entry.OnHold():
case entry.IsMature(now):
continue
// Slash the unbonding delegation
default:

View File

@ -1,450 +0,0 @@
package keeper
import (
"context"
"errors"
"cosmossdk.io/collections"
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/x/staking/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// IncrementUnbondingID increments and returns a unique ID for an unbonding operation
func (k Keeper) IncrementUnbondingID(ctx context.Context) (unbondingID uint64, err error) {
unbondingID, err = k.UnbondingID.Next(ctx)
if err != nil {
return 0, err
}
unbondingID++
return unbondingID, err
}
// DeleteUnbondingIndex removes a mapping from UnbondingId to unbonding operation
func (k Keeper) DeleteUnbondingIndex(ctx context.Context, id uint64) error {
return k.UnbondingIndex.Remove(ctx, id)
}
// GetUnbondingType returns the enum type of unbonding which is any of
// {UnbondingDelegation | Redelegation | ValidatorUnbonding}
func (k Keeper) GetUnbondingType(ctx context.Context, id uint64) (unbondingType types.UnbondingType, err error) {
ubdType, err := k.UnbondingType.Get(ctx, id)
if errors.Is(err, collections.ErrNotFound) {
return unbondingType, types.ErrNoUnbondingType
}
return types.UnbondingType(ubdType), err
}
// SetUnbondingType sets the enum type of unbonding which is any of
// {UnbondingDelegation | Redelegation | ValidatorUnbonding}
func (k Keeper) SetUnbondingType(ctx context.Context, id uint64, unbondingType types.UnbondingType) error {
return k.UnbondingType.Set(ctx, id, uint64(unbondingType))
}
// GetUnbondingDelegationByUnbondingID returns a unbonding delegation that has an unbonding delegation entry with a certain ID
func (k Keeper) GetUnbondingDelegationByUnbondingID(ctx context.Context, id uint64) (ubd types.UnbondingDelegation, err error) {
ubdKey, err := k.UnbondingIndex.Get(ctx, id) // ubdKey => [UnbondingDelegationKey(Prefix)+len(delAddr)+delAddr+len(valAddr)+valAddr]
if err != nil {
if errors.Is(err, collections.ErrNotFound) {
return types.UnbondingDelegation{}, types.ErrNoUnbondingDelegation
}
return types.UnbondingDelegation{}, err
}
if ubdKey == nil {
return types.UnbondingDelegation{}, types.ErrNoUnbondingDelegation
}
// remove prefix bytes and length bytes (since ubdKey obtained is prefixed by UnbondingDelegationKey prefix and length of the address)
delAddr := ubdKey[2 : (len(ubdKey)/2)+1]
// remove prefix length bytes
valAddr := ubdKey[2+len(ubdKey)/2:]
ubd, err = k.UnbondingDelegations.Get(ctx, collections.Join(delAddr, valAddr))
if err != nil {
if errors.Is(err, collections.ErrNotFound) {
return types.UnbondingDelegation{}, types.ErrNoUnbondingDelegation
}
return types.UnbondingDelegation{}, err
}
return ubd, nil
}
// GetRedelegationByUnbondingID returns a unbonding delegation that has an unbonding delegation entry with a certain ID
func (k Keeper) GetRedelegationByUnbondingID(ctx context.Context, id uint64) (red types.Redelegation, err error) {
store := k.KVStoreService.OpenKVStore(ctx)
redKey, err := k.UnbondingIndex.Get(ctx, id)
if err != nil {
if errors.Is(err, collections.ErrNotFound) {
return types.Redelegation{}, types.ErrNoRedelegation
}
return types.Redelegation{}, err
}
if redKey == nil {
return types.Redelegation{}, types.ErrNoRedelegation
}
value, err := store.Get(redKey)
if err != nil {
return types.Redelegation{}, err
}
if value == nil {
return types.Redelegation{}, types.ErrNoRedelegation
}
red, err = types.UnmarshalRED(k.cdc, value)
// An error here means that what we got wasn't the right type
if err != nil {
return types.Redelegation{}, err
}
return red, nil
}
// GetValidatorByUnbondingID returns the validator that is unbonding with a certain unbonding op ID
func (k Keeper) GetValidatorByUnbondingID(ctx context.Context, id uint64) (val types.Validator, err error) {
store := k.KVStoreService.OpenKVStore(ctx)
valKey, err := k.UnbondingIndex.Get(ctx, id)
if err != nil {
if errors.Is(err, collections.ErrNotFound) {
return types.Validator{}, types.ErrNoValidatorFound
}
return types.Validator{}, err
}
if valKey == nil {
return types.Validator{}, types.ErrNoValidatorFound
}
value, err := store.Get(valKey)
if err != nil {
return types.Validator{}, err
}
if value == nil {
return types.Validator{}, types.ErrNoValidatorFound
}
val, err = types.UnmarshalValidator(k.cdc, value)
// An error here means that what we got wasn't the right type
if err != nil {
return types.Validator{}, err
}
return val, nil
}
// SetUnbondingDelegationByUnbondingID sets an index to look up an UnbondingDelegation
// by the unbondingID of an UnbondingDelegationEntry that it contains Note, it does not
// set the unbonding delegation itself, use SetUnbondingDelegation(ctx, ubd) for that
func (k Keeper) SetUnbondingDelegationByUnbondingID(ctx context.Context, ubd types.UnbondingDelegation, id uint64) error {
delAddr, err := k.authKeeper.AddressCodec().StringToBytes(ubd.DelegatorAddress)
if err != nil {
return err
}
valAddr, err := k.validatorAddressCodec.StringToBytes(ubd.ValidatorAddress)
if err != nil {
return err
}
ubdKey := types.GetUBDKey(delAddr, valAddr)
if err = k.UnbondingIndex.Set(ctx, id, ubdKey); err != nil {
return err
}
// Set unbonding type so that we know how to deserialize it later
return k.SetUnbondingType(ctx, id, types.UnbondingType_UnbondingDelegation)
}
// SetRedelegationByUnbondingID sets an index to look up a Redelegation by the unbondingID of a RedelegationEntry that it contains
// Note, it does not set the redelegation itself, use SetRedelegation(ctx, red) for that
func (k Keeper) SetRedelegationByUnbondingID(ctx context.Context, red types.Redelegation, id uint64) error {
delAddr, err := k.authKeeper.AddressCodec().StringToBytes(red.DelegatorAddress)
if err != nil {
return err
}
valSrcAddr, err := k.validatorAddressCodec.StringToBytes(red.ValidatorSrcAddress)
if err != nil {
return err
}
valDstAddr, err := k.validatorAddressCodec.StringToBytes(red.ValidatorDstAddress)
if err != nil {
return err
}
redKey := types.GetREDKey(delAddr, valSrcAddr, valDstAddr)
if err = k.UnbondingIndex.Set(ctx, id, redKey); err != nil {
return err
}
// Set unbonding type so that we know how to deserialize it later
return k.SetUnbondingType(ctx, id, types.UnbondingType_Redelegation)
}
// SetValidatorByUnbondingID sets an index to look up a Validator by the unbondingID corresponding to its current unbonding
// Note, it does not set the validator itself, use SetValidator(ctx, val) for that
func (k Keeper) SetValidatorByUnbondingID(ctx context.Context, val types.Validator, id uint64) error {
valAddr, err := k.validatorAddressCodec.StringToBytes(val.OperatorAddress)
if err != nil {
return err
}
valKey := types.GetValidatorKey(valAddr)
if err = k.UnbondingIndex.Set(ctx, id, valKey); err != nil {
return err
}
// Set unbonding type so that we know how to deserialize it later
return k.SetUnbondingType(ctx, id, types.UnbondingType_ValidatorUnbonding)
}
// unbondingDelegationEntryArrayIndex and redelegationEntryArrayIndex are utilities to find
// at which position in the Entries array the entry with a given id is
func unbondingDelegationEntryArrayIndex(ubd types.UnbondingDelegation, id uint64) (index int, err error) {
for i, entry := range ubd.Entries {
// we find the entry with the right ID
if entry.UnbondingId == id {
return i, nil
}
}
return 0, types.ErrNoUnbondingDelegation
}
func redelegationEntryArrayIndex(red types.Redelegation, id uint64) (index int, err error) {
for i, entry := range red.Entries {
// we find the entry with the right ID
if entry.UnbondingId == id {
return i, nil
}
}
return 0, types.ErrNoRedelegation
}
// UnbondingCanComplete allows a stopped unbonding operation, such as an
// unbonding delegation, a redelegation, or a validator unbonding to complete.
// In order for the unbonding operation with `id` to eventually complete, every call
// to PutUnbondingOnHold(id) must be matched by a call to UnbondingCanComplete(id).
func (k Keeper) UnbondingCanComplete(ctx context.Context, id uint64) error {
unbondingType, err := k.GetUnbondingType(ctx, id)
if err != nil {
return err
}
switch unbondingType {
case types.UnbondingType_UnbondingDelegation:
if err := k.unbondingDelegationEntryCanComplete(ctx, id); err != nil {
return err
}
case types.UnbondingType_Redelegation:
if err := k.redelegationEntryCanComplete(ctx, id); err != nil {
return err
}
case types.UnbondingType_ValidatorUnbonding:
if err := k.validatorUnbondingCanComplete(ctx, id); err != nil {
return err
}
default:
return types.ErrUnbondingNotFound
}
return nil
}
func (k Keeper) unbondingDelegationEntryCanComplete(ctx context.Context, id uint64) error {
ubd, err := k.GetUnbondingDelegationByUnbondingID(ctx, id)
if err != nil {
return err
}
i, err := unbondingDelegationEntryArrayIndex(ubd, id)
if err != nil {
return err
}
// The entry must be on hold
if !ubd.Entries[i].OnHold() {
return errorsmod.Wrapf(
types.ErrUnbondingOnHoldRefCountNegative,
"undelegation unbondingID(%d), expecting UnbondingOnHoldRefCount > 0, got %T",
id, ubd.Entries[i].UnbondingOnHoldRefCount,
)
}
ubd.Entries[i].UnbondingOnHoldRefCount--
// Check if entry is matured.
if !ubd.Entries[i].OnHold() && ubd.Entries[i].IsMature(k.HeaderService.HeaderInfo(ctx).Time) {
// If matured, complete it.
delegatorAddress, err := k.authKeeper.AddressCodec().StringToBytes(ubd.DelegatorAddress)
if err != nil {
return err
}
bondDenom, err := k.BondDenom(ctx)
if err != nil {
return err
}
// track undelegation only when remaining or truncated shares are non-zero
if !ubd.Entries[i].Balance.IsZero() {
amt := sdk.NewCoin(bondDenom, ubd.Entries[i].Balance)
if err := k.bankKeeper.UndelegateCoinsFromModuleToAccount(
ctx, types.NotBondedPoolName, delegatorAddress, sdk.NewCoins(amt),
); err != nil {
return err
}
}
// Remove entry
ubd.RemoveEntry(int64(i))
// Remove from the UnbondingIndex
err = k.DeleteUnbondingIndex(ctx, id)
if err != nil {
return err
}
}
// set the unbonding delegation or remove it if there are no more entries
if len(ubd.Entries) == 0 {
return k.RemoveUnbondingDelegation(ctx, ubd)
}
return k.SetUnbondingDelegation(ctx, ubd)
}
func (k Keeper) redelegationEntryCanComplete(ctx context.Context, id uint64) error {
red, err := k.GetRedelegationByUnbondingID(ctx, id)
if err != nil {
return err
}
i, err := redelegationEntryArrayIndex(red, id)
if err != nil {
return err
}
// The entry must be on hold
if !red.Entries[i].OnHold() {
return errorsmod.Wrapf(
types.ErrUnbondingOnHoldRefCountNegative,
"redelegation unbondingID(%d), expecting UnbondingOnHoldRefCount > 0, got %T",
id, red.Entries[i].UnbondingOnHoldRefCount,
)
}
red.Entries[i].UnbondingOnHoldRefCount--
headerInfo := k.HeaderService.HeaderInfo(ctx)
if !red.Entries[i].OnHold() && red.Entries[i].IsMature(headerInfo.Time) {
// If matured, complete it.
// Remove entry
red.RemoveEntry(int64(i))
// Remove from the Unbonding index
if err = k.DeleteUnbondingIndex(ctx, id); err != nil {
return err
}
}
// set the redelegation or remove it if there are no more entries
if len(red.Entries) == 0 {
return k.RemoveRedelegation(ctx, red)
}
return k.SetRedelegation(ctx, red)
}
func (k Keeper) validatorUnbondingCanComplete(ctx context.Context, id uint64) error {
val, err := k.GetValidatorByUnbondingID(ctx, id)
if err != nil {
return err
}
if val.UnbondingOnHoldRefCount <= 0 {
return errorsmod.Wrapf(
types.ErrUnbondingOnHoldRefCountNegative,
"val(%s), expecting UnbondingOnHoldRefCount > 0, got %T",
val.OperatorAddress, val.UnbondingOnHoldRefCount,
)
}
val.UnbondingOnHoldRefCount--
return k.SetValidator(ctx, val)
}
// PutUnbondingOnHold allows an external module to stop an unbonding operation,
// such as an unbonding delegation, a redelegation, or a validator unbonding.
// In order for the unbonding operation with `id` to eventually complete, every call
// to PutUnbondingOnHold(id) must be matched by a call to UnbondingCanComplete(id).
func (k Keeper) PutUnbondingOnHold(ctx context.Context, id uint64) error {
unbondingType, err := k.GetUnbondingType(ctx, id)
if err != nil {
return err
}
switch unbondingType {
case types.UnbondingType_UnbondingDelegation:
if err := k.putUnbondingDelegationEntryOnHold(ctx, id); err != nil {
return err
}
case types.UnbondingType_Redelegation:
if err := k.putRedelegationEntryOnHold(ctx, id); err != nil {
return err
}
case types.UnbondingType_ValidatorUnbonding:
if err := k.putValidatorOnHold(ctx, id); err != nil {
return err
}
default:
return types.ErrUnbondingNotFound
}
return nil
}
func (k Keeper) putUnbondingDelegationEntryOnHold(ctx context.Context, id uint64) error {
ubd, err := k.GetUnbondingDelegationByUnbondingID(ctx, id)
if err != nil {
return err
}
i, err := unbondingDelegationEntryArrayIndex(ubd, id)
if err != nil {
return err
}
ubd.Entries[i].UnbondingOnHoldRefCount++
return k.SetUnbondingDelegation(ctx, ubd)
}
func (k Keeper) putRedelegationEntryOnHold(ctx context.Context, id uint64) error {
red, err := k.GetRedelegationByUnbondingID(ctx, id)
if err != nil {
return err
}
i, err := redelegationEntryArrayIndex(red, id)
if err != nil {
return err
}
red.Entries[i].UnbondingOnHoldRefCount++
return k.SetRedelegation(ctx, red)
}
func (k Keeper) putValidatorOnHold(ctx context.Context, id uint64) error {
val, err := k.GetValidatorByUnbondingID(ctx, id)
if err != nil {
return err
}
val.UnbondingOnHoldRefCount++
return k.SetValidator(ctx, val)
}

View File

@ -1,346 +0,0 @@
package keeper_test
import (
"time"
"cosmossdk.io/math"
"cosmossdk.io/x/staking/testutil"
"cosmossdk.io/x/staking/types"
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
sdk "github.com/cosmos/cosmos-sdk/types"
)
func (s *KeeperTestSuite) TestIncrementUnbondingID() {
for i := 1; i < 10; i++ {
id, err := s.stakingKeeper.IncrementUnbondingID(s.ctx)
s.Require().NoError(err)
s.Require().Equal(uint64(i), id)
}
}
func (s *KeeperTestSuite) TestUnbondingTypeAccessors() {
require := s.Require()
cases := []struct {
exists bool
name string
expected types.UnbondingType
}{
{
name: "existing 1",
exists: true,
expected: types.UnbondingType_UnbondingDelegation,
},
{
name: "existing 2",
exists: true,
expected: types.UnbondingType_Redelegation,
},
{
name: "not existing",
exists: false,
},
}
for i, tc := range cases {
s.Run(tc.name, func() {
if tc.exists {
require.NoError(s.stakingKeeper.SetUnbondingType(s.ctx, uint64(i), tc.expected))
}
unbondingType, err := s.stakingKeeper.GetUnbondingType(s.ctx, uint64(i))
if tc.exists {
require.NoError(err)
require.Equal(tc.expected, unbondingType)
} else {
require.ErrorIs(err, types.ErrNoUnbondingType)
}
})
}
}
func (s *KeeperTestSuite) TestUnbondingDelegationByUnbondingIDAccessors() {
delAddrs, valAddrs := createValAddrs(2)
require := s.Require()
type exists struct {
setUnbondingDelegation bool
setUnbondingDelegationByUnbondingID bool
}
cases := []struct {
exists exists
name string
expected types.UnbondingDelegation
}{
{
name: "existing 1",
exists: exists{true, true},
expected: types.NewUnbondingDelegation(
delAddrs[0],
valAddrs[0],
0,
time.Unix(0, 0).UTC(),
math.NewInt(5),
0,
addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"),
),
},
{
name: "not existing 1",
exists: exists{false, true},
expected: types.NewUnbondingDelegation(
delAddrs[1],
valAddrs[1],
0,
time.Unix(0, 0).UTC(),
math.NewInt(5),
0,
addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"),
),
},
{
name: "not existing 2",
exists: exists{false, false},
expected: types.NewUnbondingDelegation(
delAddrs[0],
valAddrs[0],
0,
time.Unix(0, 0).UTC(),
math.NewInt(5),
0,
addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"),
),
},
}
for i, tc := range cases {
s.Run(tc.name, func() {
if tc.exists.setUnbondingDelegation {
require.NoError(s.stakingKeeper.SetUnbondingDelegation(s.ctx, tc.expected))
}
if tc.exists.setUnbondingDelegationByUnbondingID {
require.NoError(s.stakingKeeper.SetUnbondingDelegationByUnbondingID(s.ctx, tc.expected, uint64(i)))
}
ubd, err := s.stakingKeeper.GetUnbondingDelegationByUnbondingID(s.ctx, uint64(i))
if tc.exists.setUnbondingDelegation && tc.exists.setUnbondingDelegationByUnbondingID {
require.NoError(err)
require.Equal(tc.expected, ubd)
} else {
require.ErrorIs(err, types.ErrNoUnbondingDelegation)
}
})
}
}
func (s *KeeperTestSuite) TestRedelegationByUnbondingIDAccessors() {
delAddrs, valAddrs := createValAddrs(2)
require := s.Require()
type exists struct {
setRedelegation bool
setRedelegationByUnbondingID bool
}
cases := []struct {
exists exists
name string
expected types.Redelegation
}{
{
name: "existing 1",
exists: exists{true, true},
expected: types.NewRedelegation(
delAddrs[0],
valAddrs[0],
valAddrs[1],
0,
time.Unix(5, 0).UTC(),
math.NewInt(10),
math.LegacyNewDec(10),
0,
addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"),
),
},
{
name: "not existing 1",
exists: exists{false, true},
expected: types.NewRedelegation(
delAddrs[1],
valAddrs[0],
valAddrs[1],
0,
time.Unix(5, 0).UTC(),
math.NewInt(10),
math.LegacyNewDec(10),
0,
addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"),
),
},
{
name: "not existing 2",
exists: exists{false, false},
expected: types.NewRedelegation(
delAddrs[1],
valAddrs[1],
valAddrs[0],
0,
time.Unix(5, 0).UTC(),
math.NewInt(10),
math.LegacyNewDec(10),
0,
addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"),
),
},
}
for i, tc := range cases {
s.Run(tc.name, func() {
if tc.exists.setRedelegation {
require.NoError(s.stakingKeeper.SetRedelegation(s.ctx, tc.expected))
}
if tc.exists.setRedelegationByUnbondingID {
require.NoError(s.stakingKeeper.SetRedelegationByUnbondingID(s.ctx, tc.expected, uint64(i)))
}
red, err := s.stakingKeeper.GetRedelegationByUnbondingID(s.ctx, uint64(i))
if tc.exists.setRedelegation && tc.exists.setRedelegationByUnbondingID {
require.NoError(err)
require.Equal(tc.expected, red)
} else {
require.ErrorIs(err, types.ErrNoRedelegation)
}
})
}
}
func (s *KeeperTestSuite) TestValidatorByUnbondingIDAccessors() {
_, valAddrs := createValAddrs(3)
require := s.Require()
type exists struct {
setValidator bool
setValidatorByUnbondingID bool
}
cases := []struct {
exists exists
name string
validator types.Validator
}{
{
name: "existing 1",
exists: exists{true, true},
validator: testutil.NewValidator(s.T(), valAddrs[0], PKs[0]),
},
{
name: "not existing 1",
exists: exists{false, true},
validator: testutil.NewValidator(s.T(), valAddrs[1], PKs[1]),
},
{
name: "not existing 2",
exists: exists{false, false},
validator: testutil.NewValidator(s.T(), valAddrs[2], PKs[0]),
},
}
for i, tc := range cases {
s.Run(tc.name, func() {
if tc.exists.setValidator {
require.NoError(s.stakingKeeper.SetValidator(s.ctx, tc.validator))
}
if tc.exists.setValidatorByUnbondingID {
require.NoError(s.stakingKeeper.SetValidatorByUnbondingID(s.ctx, tc.validator, uint64(i)))
}
val, err := s.stakingKeeper.GetValidatorByUnbondingID(s.ctx, uint64(i))
if tc.exists.setValidator && tc.exists.setValidatorByUnbondingID {
require.NoError(err)
require.Equal(tc.validator, val)
} else {
require.ErrorIs(err, types.ErrNoValidatorFound)
}
})
}
}
func (s *KeeperTestSuite) TestUnbondingCanComplete() {
delAddrs, valAddrs := createValAddrs(3)
require := s.Require()
unbondingID := uint64(1)
// no unbondingID set
err := s.stakingKeeper.UnbondingCanComplete(s.ctx, unbondingID)
require.ErrorIs(err, types.ErrNoUnbondingType)
// unbonding delegation
require.NoError(s.stakingKeeper.SetUnbondingType(s.ctx, unbondingID, types.UnbondingType_UnbondingDelegation))
err = s.stakingKeeper.UnbondingCanComplete(s.ctx, unbondingID)
require.ErrorIs(err, types.ErrNoUnbondingDelegation)
ubd := types.NewUnbondingDelegation(
delAddrs[0],
valAddrs[0],
0,
time.Unix(0, 0).UTC(),
math.NewInt(5),
unbondingID,
addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"),
)
require.NoError(s.stakingKeeper.SetUnbondingDelegation(s.ctx, ubd))
require.NoError(s.stakingKeeper.SetUnbondingDelegationByUnbondingID(s.ctx, ubd, unbondingID))
err = s.stakingKeeper.UnbondingCanComplete(s.ctx, unbondingID)
require.ErrorIs(err, types.ErrUnbondingOnHoldRefCountNegative)
err = s.stakingKeeper.PutUnbondingOnHold(s.ctx, unbondingID)
require.NoError(err)
s.bankKeeper.EXPECT().UndelegateCoinsFromModuleToAccount(s.ctx, types.NotBondedPoolName, delAddrs[0], sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(5)))).Return(nil)
err = s.stakingKeeper.UnbondingCanComplete(s.ctx, unbondingID)
require.NoError(err)
// redelegation
unbondingID++
require.NoError(s.stakingKeeper.SetUnbondingType(s.ctx, unbondingID, types.UnbondingType_Redelegation))
err = s.stakingKeeper.UnbondingCanComplete(s.ctx, unbondingID)
require.ErrorIs(err, types.ErrNoRedelegation)
red := types.NewRedelegation(
delAddrs[0],
valAddrs[0],
valAddrs[1],
0,
time.Unix(5, 0).UTC(),
math.NewInt(10),
math.LegacyNewDec(10),
unbondingID,
addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"),
)
require.NoError(s.stakingKeeper.SetRedelegation(s.ctx, red))
require.NoError(s.stakingKeeper.SetRedelegationByUnbondingID(s.ctx, red, unbondingID))
err = s.stakingKeeper.UnbondingCanComplete(s.ctx, unbondingID)
require.ErrorIs(err, types.ErrUnbondingOnHoldRefCountNegative)
require.NoError(s.stakingKeeper.PutUnbondingOnHold(s.ctx, unbondingID))
require.NoError(s.stakingKeeper.UnbondingCanComplete(s.ctx, unbondingID))
// validator unbonding
unbondingID++
require.NoError(s.stakingKeeper.SetUnbondingType(s.ctx, unbondingID, types.UnbondingType_ValidatorUnbonding))
err = s.stakingKeeper.UnbondingCanComplete(s.ctx, unbondingID)
require.ErrorIs(err, types.ErrNoValidatorFound)
val := testutil.NewValidator(s.T(), valAddrs[0], PKs[0])
require.NoError(s.stakingKeeper.SetValidator(s.ctx, val))
require.NoError(s.stakingKeeper.SetValidatorByUnbondingID(s.ctx, val, unbondingID))
err = s.stakingKeeper.UnbondingCanComplete(s.ctx, unbondingID)
require.ErrorIs(err, types.ErrUnbondingOnHoldRefCountNegative)
require.NoError(s.stakingKeeper.PutUnbondingOnHold(s.ctx, unbondingID))
require.NoError(s.stakingKeeper.UnbondingCanComplete(s.ctx, unbondingID))
}

View File

@ -456,11 +456,6 @@ func (k Keeper) BeginUnbondingValidator(ctx context.Context, validator types.Val
return validator, fmt.Errorf("should not already be unbonded or unbonding, validator: %v", validator)
}
id, err := k.IncrementUnbondingID(ctx)
if err != nil {
return validator, err
}
validator = validator.UpdateStatus(types.Unbonding)
headerInfo := k.HeaderService.HeaderInfo(ctx)
@ -468,8 +463,6 @@ func (k Keeper) BeginUnbondingValidator(ctx context.Context, validator types.Val
validator.UnbondingTime = headerInfo.Time.Add(params.UnbondingTime)
validator.UnbondingHeight = headerInfo.Height
validator.UnbondingIds = append(validator.UnbondingIds, id)
// save the now unbonded validator record and power index
if err = k.SetValidator(ctx, validator); err != nil {
return validator, err
@ -499,14 +492,6 @@ func (k Keeper) BeginUnbondingValidator(ctx context.Context, validator types.Val
return validator, err
}
if err := k.SetValidatorByUnbondingID(ctx, validator, id); err != nil {
return validator, err
}
if err := k.Hooks().AfterUnbondingInitiated(ctx, id); err != nil {
return validator, err
}
return validator, nil
}

View File

@ -545,36 +545,19 @@ func (k Keeper) unbondMatureValidators(
return errors.New("unexpected validator in unbonding queue; status was not unbonding")
}
// if the ref count is not zero, early exit.
if val.UnbondingOnHoldRefCount != 0 {
return nil
}
// otherwise do proper unbonding
for _, id := range val.UnbondingIds {
if err = k.DeleteUnbondingIndex(ctx, id); err != nil {
return err
}
}
val, err = k.UnbondingToUnbonded(ctx, val)
if err != nil {
return err
}
if val.GetDelegatorShares().IsZero() {
str, err := k.validatorAddressCodec.StringToBytes(val.GetOperator())
addr, err := k.validatorAddressCodec.StringToBytes(val.OperatorAddress)
if err != nil {
return err
}
if err = k.RemoveValidator(ctx, str); err != nil {
if err := k.RemoveValidator(ctx, addr); err != nil {
return err
}
} else {
// remove unbonding ids
val.UnbondingIds = []uint64{}
}
// remove validator from queue
if err = k.DeleteValidatorQueue(ctx, val); err != nil {
return err

View File

@ -3,6 +3,9 @@ package v6
import "cosmossdk.io/collections"
var (
UnbondingTypeKey = collections.NewPrefix(57) // prefix for an index containing the type of unbonding operations
UnbondingIDKey = collections.NewPrefix(55) // key for the counter for the incrementing id for UnbondingOperations
UnbondingIndexKey = collections.NewPrefix(56) // prefix for an index for looking up unbonding operations by their IDs
ValidatorUpdatesKey = collections.NewPrefix(97)
HistoricalInfoKey = collections.NewPrefix(80) // prefix for the historical info
)

View File

@ -13,5 +13,8 @@ import (
func MigrateStore(ctx context.Context, store storetypes.KVStore, cdc codec.BinaryCodec) error {
store.Delete(ValidatorUpdatesKey)
store.Delete(HistoricalInfoKey)
store.Delete(UnbondingIDKey)
store.Delete(UnbondingIndexKey)
store.Delete(UnbondingTypeKey)
return nil
}

View File

@ -259,7 +259,7 @@ message UnbondingDelegationEntry {
(gogoproto.nullable) = false
];
// Incrementing id that uniquely identifies this entry
uint64 unbonding_id = 5;
uint64 unbonding_id = 5 [deprecated = true];
// Strictly positive if this entry's unbonding has been stopped by external modules
int64 unbonding_on_hold_ref_count = 6;

View File

@ -611,20 +611,6 @@ func (mr *MockStakingHooksMockRecorder) AfterDelegationModified(ctx, delAddr, va
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterDelegationModified", reflect.TypeOf((*MockStakingHooks)(nil).AfterDelegationModified), ctx, delAddr, valAddr)
}
// AfterUnbondingInitiated mocks base method.
func (m *MockStakingHooks) AfterUnbondingInitiated(ctx context.Context, id uint64) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AfterUnbondingInitiated", ctx, id)
ret0, _ := ret[0].(error)
return ret0
}
// AfterUnbondingInitiated indicates an expected call of AfterUnbondingInitiated.
func (mr *MockStakingHooksMockRecorder) AfterUnbondingInitiated(ctx, id any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterUnbondingInitiated", reflect.TypeOf((*MockStakingHooks)(nil).AfterUnbondingInitiated), ctx, id)
}
// AfterValidatorBeginUnbonding mocks base method.
func (m *MockStakingHooks) AfterValidatorBeginUnbonding(ctx context.Context, consAddr types1.ConsAddress, valAddr types1.ValAddress) error {
m.ctrl.T.Helper()

View File

@ -66,13 +66,12 @@ func (d Delegations) String() (out string) {
return strings.TrimSpace(out)
}
func NewUnbondingDelegationEntry(creationHeight int64, completionTime time.Time, balance math.Int, unbondingID uint64) UnbondingDelegationEntry {
func NewUnbondingDelegationEntry(creationHeight int64, completionTime time.Time, balance math.Int) UnbondingDelegationEntry {
return UnbondingDelegationEntry{
CreationHeight: creationHeight,
CompletionTime: completionTime,
InitialBalance: balance,
Balance: balance,
UnbondingId: unbondingID,
UnbondingOnHoldRefCount: 0,
}
}
@ -82,26 +81,6 @@ func (e UnbondingDelegationEntry) IsMature(currentTime time.Time) bool {
return !e.CompletionTime.After(currentTime)
}
// OnHold - is the current entry on hold due to external modules
func (e UnbondingDelegationEntry) OnHold() bool {
return e.UnbondingOnHoldRefCount > 0
}
// return the unbonding delegation entry
func MustMarshalUBDE(cdc codec.BinaryCodec, ubd UnbondingDelegationEntry) []byte {
return cdc.MustMarshal(&ubd)
}
// unmarshal a unbonding delegation entry from a store value
func MustUnmarshalUBDE(cdc codec.BinaryCodec, value []byte) UnbondingDelegationEntry {
ubd, err := UnmarshalUBDE(cdc, value)
if err != nil {
panic(err)
}
return ubd
}
// unmarshal a unbonding delegation entry from a store value
func UnmarshalUBDE(cdc codec.BinaryCodec, value []byte) (ubd UnbondingDelegationEntry, err error) {
err = cdc.Unmarshal(value, &ubd)
@ -111,7 +90,7 @@ func UnmarshalUBDE(cdc codec.BinaryCodec, value []byte) (ubd UnbondingDelegation
// NewUnbondingDelegation - create a new unbonding delegation object
func NewUnbondingDelegation(
delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress,
creationHeight int64, minTime time.Time, balance math.Int, id uint64,
creationHeight int64, minTime time.Time, balance math.Int,
valAc, delAc address.Codec,
) UnbondingDelegation {
valAddr, err := valAc.BytesToString(validatorAddr)
@ -126,13 +105,13 @@ func NewUnbondingDelegation(
DelegatorAddress: delAddr,
ValidatorAddress: valAddr,
Entries: []UnbondingDelegationEntry{
NewUnbondingDelegationEntry(creationHeight, minTime, balance, id),
NewUnbondingDelegationEntry(creationHeight, minTime, balance),
},
}
}
// AddEntry - append entry to the unbonding delegation
func (ubd *UnbondingDelegation) AddEntry(creationHeight int64, minTime time.Time, balance math.Int, unbondingID uint64) bool {
func (ubd *UnbondingDelegation) AddEntry(creationHeight int64, minTime time.Time, balance math.Int) bool {
// Check the entries exists with creation_height and complete_time
entryIndex := -1
for index, ubdEntry := range ubd.Entries {
@ -152,7 +131,7 @@ func (ubd *UnbondingDelegation) AddEntry(creationHeight int64, minTime time.Time
return false
}
// append the new unbond delegation entry
entry := NewUnbondingDelegationEntry(creationHeight, minTime, balance, unbondingID)
entry := NewUnbondingDelegationEntry(creationHeight, minTime, balance)
ubd.Entries = append(ubd.Entries, entry)
return true
}
@ -194,13 +173,12 @@ func (ubds UnbondingDelegations) String() (out string) {
return strings.TrimSpace(out)
}
func NewRedelegationEntry(creationHeight int64, completionTime time.Time, balance math.Int, sharesDst math.LegacyDec, id uint64) RedelegationEntry {
func NewRedelegationEntry(creationHeight int64, completionTime time.Time, balance math.Int, sharesDst math.LegacyDec) RedelegationEntry {
return RedelegationEntry{
CreationHeight: creationHeight,
CompletionTime: completionTime,
InitialBalance: balance,
SharesDst: sharesDst,
UnbondingId: id,
UnbondingOnHoldRefCount: 0,
}
}
@ -217,7 +195,7 @@ func (e RedelegationEntry) OnHold() bool {
func NewRedelegation(
delegatorAddr sdk.AccAddress, validatorSrcAddr, validatorDstAddr sdk.ValAddress,
creationHeight int64, minTime time.Time, balance math.Int, sharesDst math.LegacyDec, id uint64,
creationHeight int64, minTime time.Time, balance math.Int, sharesDst math.LegacyDec,
valAc, delAc address.Codec,
) Redelegation {
valSrcAddr, err := valAc.BytesToString(validatorSrcAddr)
@ -238,14 +216,14 @@ func NewRedelegation(
ValidatorSrcAddress: valSrcAddr,
ValidatorDstAddress: valDstAddr,
Entries: []RedelegationEntry{
NewRedelegationEntry(creationHeight, minTime, balance, sharesDst, id),
NewRedelegationEntry(creationHeight, minTime, balance, sharesDst),
},
}
}
// AddEntry - append entry to the unbonding delegation
func (red *Redelegation) AddEntry(creationHeight int64, minTime time.Time, balance math.Int, sharesDst math.LegacyDec, id uint64) {
entry := NewRedelegationEntry(creationHeight, minTime, balance, sharesDst, id)
func (red *Redelegation) AddEntry(creationHeight int64, minTime time.Time, balance math.Int, sharesDst math.LegacyDec) {
entry := NewRedelegationEntry(creationHeight, minTime, balance, sharesDst)
red.Entries = append(red.Entries, entry)
}
@ -341,10 +319,10 @@ func NewRedelegationResponse(
// NewRedelegationEntryResponse creates a new RedelegationEntryResponse instance.
func NewRedelegationEntryResponse(
creationHeight int64, completionTime time.Time, sharesDst math.LegacyDec, initialBalance, balance math.Int, unbondingID uint64,
creationHeight int64, completionTime time.Time, sharesDst math.LegacyDec, initialBalance, balance math.Int,
) RedelegationEntryResponse {
return RedelegationEntryResponse{
RedelegationEntry: NewRedelegationEntry(creationHeight, completionTime, initialBalance, sharesDst, unbondingID),
RedelegationEntry: NewRedelegationEntry(creationHeight, completionTime, initialBalance, sharesDst),
Balance: balance,
}
}

View File

@ -50,7 +50,7 @@ func TestDelegationString(t *testing.T) {
func TestUnbondingDelegationEqual(t *testing.T) {
ubd1 := types.NewUnbondingDelegation(sdk.AccAddress(valAddr1), valAddr2, 0,
time.Unix(0, 0), math.NewInt(0), 1, addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"))
time.Unix(0, 0), math.NewInt(0), addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"))
ubd2 := ubd1
ok := ubd1.String() == ubd2.String()
@ -67,7 +67,7 @@ func TestUnbondingDelegationEqual(t *testing.T) {
func TestUnbondingDelegationString(t *testing.T) {
ubd := types.NewUnbondingDelegation(sdk.AccAddress(valAddr1), valAddr2, 0,
time.Unix(0, 0), math.NewInt(0), 1, addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"))
time.Unix(0, 0), math.NewInt(0), addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"))
require.NotEmpty(t, ubd.String())
}
@ -75,10 +75,10 @@ func TestUnbondingDelegationString(t *testing.T) {
func TestRedelegationEqual(t *testing.T) {
r1 := types.NewRedelegation(sdk.AccAddress(valAddr1), valAddr2, valAddr3, 0,
time.Unix(0, 0), math.NewInt(0),
math.LegacyNewDec(0), 1, addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"))
math.LegacyNewDec(0), addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"))
r2 := types.NewRedelegation(sdk.AccAddress(valAddr1), valAddr2, valAddr3, 0,
time.Unix(0, 0), math.NewInt(0),
math.LegacyNewDec(0), 1, addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"))
math.LegacyNewDec(0), addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"))
require.True(t, proto.Equal(&r1, &r2))
r2.Entries[0].SharesDst = math.LegacyNewDec(10)
@ -89,7 +89,7 @@ func TestRedelegationEqual(t *testing.T) {
func TestRedelegationString(t *testing.T) {
r := types.NewRedelegation(sdk.AccAddress(valAddr1), valAddr2, valAddr3, 0,
time.Unix(0, 0), math.NewInt(0),
math.LegacyNewDec(10), 1, addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"))
math.LegacyNewDec(10), addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"))
require.NotEmpty(t, r.String())
}
@ -145,8 +145,8 @@ func TestRedelegationResponses(t *testing.T) {
require.NoError(t, err)
entries := []types.RedelegationEntryResponse{
types.NewRedelegationEntryResponse(0, time.Unix(0, 0), math.LegacyNewDec(5), math.NewInt(5), math.NewInt(5), 0),
types.NewRedelegationEntryResponse(0, time.Unix(0, 0), math.LegacyNewDec(5), math.NewInt(5), math.NewInt(5), 0),
types.NewRedelegationEntryResponse(0, time.Unix(0, 0), math.LegacyNewDec(5), math.NewInt(5), math.NewInt(5)),
types.NewRedelegationEntryResponse(0, time.Unix(0, 0), math.LegacyNewDec(5), math.NewInt(5), math.NewInt(5)),
}
rdr1 := types.NewRedelegationResponse(addr1, vAddr2, vAddr3, entries)
rdr2 := types.NewRedelegationResponse(addr2, vAddr1, vAddr3, entries)

View File

@ -105,7 +105,6 @@ type StakingHooks interface {
BeforeDelegationRemoved(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error // Must be called when a delegation is removed
AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
BeforeValidatorSlashed(ctx context.Context, valAddr sdk.ValAddress, fraction math.LegacyDec) error
AfterUnbondingInitiated(ctx context.Context, id uint64) error
AfterConsensusPubKeyUpdate(ctx context.Context, oldPubKey, newPubKey cryptotypes.PubKey, rotationFee sdk.Coin) error
}

View File

@ -109,15 +109,6 @@ func (h MultiStakingHooks) BeforeValidatorSlashed(ctx context.Context, valAddr s
return nil
}
func (h MultiStakingHooks) AfterUnbondingInitiated(ctx context.Context, id uint64) error {
for i := range h {
if err := h[i].AfterUnbondingInitiated(ctx, id); err != nil {
return err
}
}
return nil
}
func (h MultiStakingHooks) AfterConsensusPubKeyUpdate(ctx context.Context, oldPubKey, newPubKey cryptotypes.PubKey, rotationFee sdk.Coin) error {
for i := range h {
if err := h[i].AfterConsensusPubKeyUpdate(ctx, oldPubKey, newPubKey, rotationFee); err != nil {

View File

@ -49,10 +49,6 @@ var (
RedelegationByValSrcIndexKey = collections.NewPrefix(53) // prefix for each key for a redelegation, by source validator operator
RedelegationByValDstIndexKey = collections.NewPrefix(54) // prefix for each key for a redelegation, by destination validator operator
UnbondingIDKey = collections.NewPrefix(55) // key for the counter for the incrementing id for UnbondingOperations
UnbondingIndexKey = collections.NewPrefix(56) // prefix for an index for looking up unbonding operations by their IDs
UnbondingTypeKey = collections.NewPrefix(57) // prefix for an index containing the type of unbonding operations
UnbondingQueueKey = collections.NewPrefix(65) // prefix for the timestamps in unbonding queue
RedelegationQueueKey = collections.NewPrefix(66) // prefix for the timestamps in redelegations queue
ValidatorQueueKey = collections.NewPrefix(67) // prefix for the timestamps in validator queue

File diff suppressed because it is too large Load Diff