feat: deprecate x/params usage in x/bank (#12630)
This commit is contained in:
parent
eee23d9531
commit
a5d5461426
@ -61,6 +61,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
### State Machine Breaking
|
||||
|
||||
* (x/bank) [#12610](https://github.com/cosmos/cosmos-sdk/pull/12610) `MsgMultiSend` now allows only a single input.
|
||||
* (x/bank) [#12630](https://github.com/cosmos/cosmos-sdk/pull/12630) Migrate `x/bank` to self-managed parameters and deprecate its usage of `x/params`.
|
||||
* (x/auth) [#12475](https://github.com/cosmos/cosmos-sdk/pull/12475) Migrate `x/auth` to self-managed parameters and deprecate its usage of `x/params`.
|
||||
* (x/slashing) [#12399](https://github.com/cosmos/cosmos-sdk/pull/12399) Migrate `x/slashing` to self-managed parameters and deprecate its usage of `x/params`.
|
||||
* (x/mint) [#12363](https://github.com/cosmos/cosmos-sdk/pull/12363) Migrate `x/mint` to self-managed parameters and deprecate it's usage of `x/params`.
|
||||
|
||||
@ -4639,54 +4639,51 @@ var file_cosmos_bank_v1beta1_bank_proto_rawDesc = []byte{
|
||||
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f,
|
||||
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73,
|
||||
0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x05, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x3a, 0x08, 0x88,
|
||||
0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0xb7, 0x01, 0x0a, 0x06, 0x53, 0x75, 0x70, 0x70,
|
||||
0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0x82, 0x01, 0x0a, 0x06, 0x53, 0x75, 0x70, 0x70,
|
||||
0x6c, 0x79, 0x12, 0x61, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x03, 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, 0x30, 0xc8, 0xde,
|
||||
0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73,
|
||||
0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x05,
|
||||
0x74, 0x6f, 0x74, 0x61, 0x6c, 0x3a, 0x4a, 0x18, 0x01, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f,
|
||||
0x01, 0xca, 0xb4, 0x2d, 0x3c, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73,
|
||||
0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x62, 0x61, 0x6e, 0x6b, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x30, 0x34, 0x30, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79,
|
||||
0x49, 0x22, 0x57, 0x0a, 0x09, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x14,
|
||||
0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64,
|
||||
0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74,
|
||||
0x12, 0x18, 0x0a, 0x07, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,
|
||||
0x09, 0x52, 0x07, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x22, 0x8a, 0x02, 0x0a, 0x08, 0x4d,
|
||||
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
|
||||
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65,
|
||||
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x0b, 0x64, 0x65, 0x6e,
|
||||
0x6f, 0x6d, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e,
|
||||
0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62,
|
||||
0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x0a,
|
||||
0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x61,
|
||||
0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x18,
|
||||
0x0a, 0x07, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x07, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79,
|
||||
0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x19, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x07, 0x20, 0x01, 0x28,
|
||||
0x09, 0x42, 0x07, 0xe2, 0xde, 0x1f, 0x03, 0x55, 0x52, 0x49, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12,
|
||||
0x26, 0x0a, 0x08, 0x75, 0x72, 0x69, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28,
|
||||
0x09, 0x42, 0x0b, 0xe2, 0xde, 0x1f, 0x07, 0x55, 0x52, 0x49, 0x48, 0x61, 0x73, 0x68, 0x52, 0x07,
|
||||
0x75, 0x72, 0x69, 0x48, 0x61, 0x73, 0x68, 0x42, 0xc4, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e,
|
||||
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65,
|
||||
0x74, 0x61, 0x31, 0x42, 0x09, 0x42, 0x61, 0x6e, 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
|
||||
0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61,
|
||||
0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x6e, 0x6b, 0x2f, 0x76,
|
||||
0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x62, 0x61, 0x6e, 0x6b, 0x76, 0x31, 0x62, 0x65, 0x74,
|
||||
0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x58, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f,
|
||||
0x73, 0x2e, 0x42, 0x61, 0x6e, 0x6b, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02,
|
||||
0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x62,
|
||||
0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61,
|
||||
0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65,
|
||||
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a,
|
||||
0x3a, 0x42, 0x61, 0x6e, 0x6b, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x74, 0x6f, 0x74, 0x61, 0x6c, 0x3a, 0x15, 0x18, 0x01, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f,
|
||||
0x01, 0xca, 0xb4, 0x2d, 0x07, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x22, 0x57, 0x0a, 0x09,
|
||||
0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e,
|
||||
0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12,
|
||||
0x1a, 0x0a, 0x08, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x0d, 0x52, 0x08, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61,
|
||||
0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x61, 0x6c,
|
||||
0x69, 0x61, 0x73, 0x65, 0x73, 0x22, 0x8a, 0x02, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
|
||||
0x74, 0x61, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x0b, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x5f, 0x75, 0x6e,
|
||||
0x69, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e,
|
||||
0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x0a, 0x64, 0x65, 0x6e, 0x6f, 0x6d,
|
||||
0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x69, 0x73,
|
||||
0x70, 0x6c, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x69, 0x73, 0x70,
|
||||
0x6c, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f,
|
||||
0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12,
|
||||
0x19, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xe2, 0xde,
|
||||
0x1f, 0x03, 0x55, 0x52, 0x49, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x26, 0x0a, 0x08, 0x75, 0x72,
|
||||
0x69, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xe2, 0xde,
|
||||
0x1f, 0x07, 0x55, 0x52, 0x49, 0x48, 0x61, 0x73, 0x68, 0x52, 0x07, 0x75, 0x72, 0x69, 0x48, 0x61,
|
||||
0x73, 0x68, 0x42, 0xc4, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
|
||||
0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x09,
|
||||
0x42, 0x61, 0x6e, 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f,
|
||||
0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x6e, 0x6b, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61,
|
||||
0x31, 0x3b, 0x62, 0x61, 0x6e, 0x6b, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03,
|
||||
0x43, 0x42, 0x58, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x42, 0x61, 0x6e,
|
||||
0x6b, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x5c, 0x42, 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2,
|
||||
0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31,
|
||||
0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
|
||||
0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x42, 0x61, 0x6e, 0x6b,
|
||||
0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -26,6 +26,11 @@ type MsgClient interface {
|
||||
Send(ctx context.Context, in *MsgSend, opts ...grpc.CallOption) (*MsgSendResponse, error)
|
||||
// MultiSend defines a method for sending coins from some accounts to other accounts.
|
||||
MultiSend(ctx context.Context, in *MsgMultiSend, opts ...grpc.CallOption) (*MsgMultiSendResponse, error)
|
||||
// UpdateParams defines a governance operation for updating the x/bank module parameters.
|
||||
// The authority is defined in the keeper.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
@ -54,6 +59,15 @@ func (c *msgClient) MultiSend(ctx context.Context, in *MsgMultiSend, opts ...grp
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
|
||||
out := new(MsgUpdateParamsResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Msg/UpdateParams", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
// All implementations must embed UnimplementedMsgServer
|
||||
// for forward compatibility
|
||||
@ -62,6 +76,11 @@ type MsgServer interface {
|
||||
Send(context.Context, *MsgSend) (*MsgSendResponse, error)
|
||||
// MultiSend defines a method for sending coins from some accounts to other accounts.
|
||||
MultiSend(context.Context, *MsgMultiSend) (*MsgMultiSendResponse, error)
|
||||
// UpdateParams defines a governance operation for updating the x/bank module parameters.
|
||||
// The authority is defined in the keeper.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
|
||||
mustEmbedUnimplementedMsgServer()
|
||||
}
|
||||
|
||||
@ -75,6 +94,9 @@ func (UnimplementedMsgServer) Send(context.Context, *MsgSend) (*MsgSendResponse,
|
||||
func (UnimplementedMsgServer) MultiSend(context.Context, *MsgMultiSend) (*MsgMultiSendResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method MultiSend not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
|
||||
|
||||
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
|
||||
@ -124,6 +146,24 @@ func _Msg_MultiSend_Handler(srv interface{}, ctx context.Context, dec func(inter
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgUpdateParams)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).UpdateParams(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.bank.v1beta1.Msg/UpdateParams",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@ -139,6 +179,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "MultiSend",
|
||||
Handler: _Msg_MultiSend_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateParams",
|
||||
Handler: _Msg_UpdateParams_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cosmos/bank/v1beta1/tx.proto",
|
||||
|
||||
@ -71,7 +71,7 @@ Migration functions should live inside the `migrations/` folder of each module,
|
||||
```go
|
||||
// Migrate1to2 migrates from version 1 to 2.
|
||||
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
|
||||
return v043bank.MigrateStore(ctx, m.keeper.storeKey) // v043bank is package `x/bank/migrations/v043`.
|
||||
return v2bank.MigrateStore(ctx, m.keeper.storeKey) // v043bank is package `x/bank/migrations/v2`.
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ message QueryParamsResponse {
|
||||
As a result of implementing the module parameter methodology, we gain the ability
|
||||
for module parameter changes to be stateful and extensible to fit nearly every
|
||||
application's use case. We will be able to emit events (and trigger hooks registered
|
||||
to that events using the work proposed in [even hooks](https://github.com/cosmos/cosmos-sdk/discussions/9656)),
|
||||
to that events using the work proposed in [event hooks](https://github.com/cosmos/cosmos-sdk/discussions/9656)),
|
||||
call other Msg service methods or perform migration.
|
||||
In addition, there will be significant gains in performance when it comes to reading
|
||||
and writing parameters from and to state, especially if a specific set of parameters
|
||||
|
||||
@ -45,13 +45,13 @@ Since these migrations are functions that need access to a Keeper's store, use a
|
||||
|
||||
## Writing Migration Scripts
|
||||
|
||||
To define the functionality that takes place during an upgrade, write a migration script and place the functions in a `migrations/` directory. For example, to write migration scripts for the bank module, place the functions in `x/bank/migrations/`. Use the recommended naming convention for these functions. For example, `v043bank` is the script that migrates the package `x/bank/migrations/v043`:
|
||||
To define the functionality that takes place during an upgrade, write a migration script and place the functions in a `migrations/` directory. For example, to write migration scripts for the bank module, place the functions in `x/bank/migrations/`. Use the recommended naming convention for these functions. For example, `v2bank` is the script that migrates the package `x/bank/migrations/v2`:
|
||||
|
||||
```golang
|
||||
// Migrating bank module from version 1 to 2
|
||||
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
|
||||
return v043bank.MigrateStore(ctx, m.keeper.storeKey) // v043bank is package `x/bank/migrations/v043`.
|
||||
return v2bank.MigrateStore(ctx, m.keeper.storeKey) // v2bank is package `x/bank/migrations/v2`.
|
||||
}
|
||||
```
|
||||
|
||||
To see example code of changes that were implemented in a migration of balance keys, check out [migrateBalanceKeys](https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-rc1/x/bank/migrations/v043/store.go#L50-L71). For context, this code introduced migrations of the bank store that updated addresses to be prefixed by their length in bytes as outlined in [ADR-028](../architecture/adr-028-public-key-addresses.md).
|
||||
To see example code of changes that were implemented in a migration of balance keys, check out [migrateBalanceKeys](https://github.com/cosmos/cosmos-sdk/blob/v0.46.0-rc1/x/bank/migrations/v2/store.go#L50-L71). For context, this code introduced migrations of the bank store that updated addresses to be prefixed by their length in bytes as outlined in [ADR-028](../architecture/adr-028-public-key-addresses.md).
|
||||
|
||||
@ -60,7 +60,7 @@ message Supply {
|
||||
option (gogoproto.equal) = true;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
option (cosmos_proto.implements_interface) = "*github.com/cosmos/cosmos-sdk/x/bank/migrations/v040.SupplyI";
|
||||
option (cosmos_proto.implements_interface) = "SupplyI";
|
||||
|
||||
repeated cosmos.base.v1beta1.Coin total = 1
|
||||
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
|
||||
|
||||
@ -16,6 +16,12 @@ service Msg {
|
||||
|
||||
// MultiSend defines a method for sending coins from some accounts to other accounts.
|
||||
rpc MultiSend(MsgMultiSend) returns (MsgMultiSendResponse);
|
||||
|
||||
// UpdateParams defines a governance operation for updating the x/bank module parameters.
|
||||
// The authority is defined in the keeper.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
|
||||
}
|
||||
|
||||
// MsgSend represents a message to send coins from one account to another.
|
||||
@ -46,3 +52,24 @@ message MsgMultiSend {
|
||||
|
||||
// MsgMultiSendResponse defines the Msg/MultiSend response type.
|
||||
message MsgMultiSendResponse {}
|
||||
|
||||
// MsgUpdateParams is the Msg/UpdateParams request type.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgUpdateParams {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
|
||||
// authority is the address of the governance account.
|
||||
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// params defines the x/bank parameters to update.
|
||||
//
|
||||
// NOTE: All parameters must be supplied.
|
||||
Params params = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// MsgUpdateParamsResponse defines the response structure for executing a
|
||||
// MsgUpdateParams message.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgUpdateParamsResponse {}
|
||||
|
||||
@ -258,7 +258,7 @@ func NewSimApp(
|
||||
app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, keys[authtypes.StoreKey], authtypes.ProtoBaseAccount, maccPerms, sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
|
||||
app.BankKeeper = bankkeeper.NewBaseKeeper(
|
||||
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), app.ModuleAccountAddrs(),
|
||||
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.ModuleAccountAddrs(), authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
||||
)
|
||||
app.StakingKeeper = stakingkeeper.NewKeeper(
|
||||
appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName),
|
||||
@ -353,7 +353,7 @@ func NewSimApp(
|
||||
),
|
||||
auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
|
||||
vesting.NewAppModule(app.AccountKeeper, app.BankKeeper),
|
||||
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper),
|
||||
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)),
|
||||
capability.NewAppModule(appCodec, *app.CapabilityKeeper, false),
|
||||
crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)),
|
||||
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
|
||||
@ -422,7 +422,7 @@ func NewSimApp(
|
||||
// transactions
|
||||
app.sm = module.NewSimulationManager(
|
||||
auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
|
||||
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper),
|
||||
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)),
|
||||
capability.NewAppModule(appCodec, *app.CapabilityKeeper, false),
|
||||
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
|
||||
gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper),
|
||||
|
||||
@ -96,7 +96,7 @@ func NewAccountKeeper(
|
||||
}
|
||||
}
|
||||
|
||||
// GetAuthority returns the x/mint module's authority.
|
||||
// GetAuthority returns the x/auth module's authority.
|
||||
func (ak AccountKeeper) GetAuthority() string {
|
||||
return ak.authority
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package exported
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
)
|
||||
|
||||
// GenesisBalance defines a genesis balance interface that allows for account
|
||||
@ -10,3 +11,15 @@ type GenesisBalance interface {
|
||||
GetAddress() sdk.AccAddress
|
||||
GetCoins() sdk.Coins
|
||||
}
|
||||
|
||||
type (
|
||||
ParamSet = paramtypes.ParamSet
|
||||
|
||||
// Subspace defines an interface that implements the legacy x/params Subspace
|
||||
// type.
|
||||
//
|
||||
// NOTE: This is used solely for migration of x/params managed parameters.
|
||||
Subspace interface {
|
||||
GetParamSet(ctx sdk.Context, ps ParamSet)
|
||||
}
|
||||
)
|
||||
|
||||
@ -10,7 +10,9 @@ import (
|
||||
|
||||
// InitGenesis initializes the bank module's state from a given genesis state.
|
||||
func (k BaseKeeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) {
|
||||
k.SetParams(ctx, genState.Params)
|
||||
if err := k.SetParams(ctx, genState.Params); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
for _, se := range genState.GetAllSendEnabled() {
|
||||
k.SetSendEnabled(ctx, se.Denom, se.Enabled)
|
||||
|
||||
@ -32,7 +32,8 @@ func (suite *IntegrationTestSuite) TestExportGenesis() {
|
||||
Require().
|
||||
NoError(app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, accAddr, expectedBalances[i].Coins))
|
||||
}
|
||||
app.BankKeeper.SetParams(ctx, types.DefaultParams())
|
||||
|
||||
suite.Require().NoError(app.BankKeeper.SetParams(ctx, types.DefaultParams()))
|
||||
|
||||
exportGenesis := app.BankKeeper.ExportGenesis(ctx)
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ func (k BaseKeeper) SpendableBalances(ctx context.Context, req *types.QuerySpend
|
||||
accountStore := k.getAccountStore(sdkCtx, addr)
|
||||
zeroAmt := sdk.ZeroInt()
|
||||
|
||||
pageRes, err := query.Paginate(accountStore, req.Pagination, func(key, value []byte) error {
|
||||
pageRes, err := query.Paginate(accountStore, req.Pagination, func(key, _ []byte) error {
|
||||
balances = append(balances, sdk.NewCoin(string(key), zeroAmt))
|
||||
return nil
|
||||
})
|
||||
|
||||
@ -470,8 +470,8 @@ func (suite *IntegrationTestSuite) TestQuerySendEnabled() {
|
||||
req: &types.QuerySendEnabledRequest{Denoms: []string{}},
|
||||
exp: &types.QuerySendEnabledResponse{
|
||||
SendEnabled: []*types.SendEnabled{
|
||||
{"falsestcoin", false},
|
||||
{"truestcoin", true},
|
||||
{Denom: "falsestcoin", Enabled: false},
|
||||
{Denom: "truestcoin", Enabled: true},
|
||||
},
|
||||
Pagination: &query.PageResponse{
|
||||
NextKey: nil,
|
||||
@ -484,8 +484,8 @@ func (suite *IntegrationTestSuite) TestQuerySendEnabled() {
|
||||
req: &types.QuerySendEnabledRequest{Denoms: []string{}},
|
||||
exp: &types.QuerySendEnabledResponse{
|
||||
SendEnabled: []*types.SendEnabled{
|
||||
{"falsestcoin", false},
|
||||
{"truestcoin", true},
|
||||
{Denom: "falsestcoin", Enabled: false},
|
||||
{Denom: "truestcoin", Enabled: true},
|
||||
},
|
||||
Pagination: &query.PageResponse{
|
||||
NextKey: nil,
|
||||
@ -503,7 +503,7 @@ func (suite *IntegrationTestSuite) TestQuerySendEnabled() {
|
||||
},
|
||||
exp: &types.QuerySendEnabledResponse{
|
||||
SendEnabled: []*types.SendEnabled{
|
||||
{"falsestcoin", false},
|
||||
{Denom: "falsestcoin", Enabled: false},
|
||||
},
|
||||
Pagination: &query.PageResponse{
|
||||
NextKey: []byte("truestcoin"),
|
||||
@ -516,7 +516,7 @@ func (suite *IntegrationTestSuite) TestQuerySendEnabled() {
|
||||
req: &types.QuerySendEnabledRequest{Denoms: []string{"truestcoin"}},
|
||||
exp: &types.QuerySendEnabledResponse{
|
||||
SendEnabled: []*types.SendEnabled{
|
||||
{"truestcoin", true},
|
||||
{Denom: "truestcoin", Enabled: true},
|
||||
},
|
||||
Pagination: nil,
|
||||
},
|
||||
@ -526,7 +526,7 @@ func (suite *IntegrationTestSuite) TestQuerySendEnabled() {
|
||||
req: &types.QuerySendEnabledRequest{Denoms: []string{"falsestcoin"}},
|
||||
exp: &types.QuerySendEnabledResponse{
|
||||
SendEnabled: []*types.SendEnabled{
|
||||
{"falsestcoin", false},
|
||||
{Denom: "falsestcoin", Enabled: false},
|
||||
},
|
||||
Pagination: nil,
|
||||
},
|
||||
@ -544,8 +544,8 @@ func (suite *IntegrationTestSuite) TestQuerySendEnabled() {
|
||||
req: &types.QuerySendEnabledRequest{Denoms: []string{"truestcoin", "falsestcoin"}},
|
||||
exp: &types.QuerySendEnabledResponse{
|
||||
SendEnabled: []*types.SendEnabled{
|
||||
{"truestcoin", true},
|
||||
{"falsestcoin", false},
|
||||
{Denom: "truestcoin", Enabled: true},
|
||||
{Denom: "falsestcoin", Enabled: false},
|
||||
},
|
||||
Pagination: nil,
|
||||
},
|
||||
@ -555,8 +555,8 @@ func (suite *IntegrationTestSuite) TestQuerySendEnabled() {
|
||||
req: &types.QuerySendEnabledRequest{Denoms: []string{"truestcoin", "falsestcoin", "unknownestcoin"}},
|
||||
exp: &types.QuerySendEnabledResponse{
|
||||
SendEnabled: []*types.SendEnabled{
|
||||
{"truestcoin", true},
|
||||
{"falsestcoin", false},
|
||||
{Denom: "truestcoin", Enabled: true},
|
||||
{Denom: "falsestcoin", Enabled: false},
|
||||
},
|
||||
Pagination: nil,
|
||||
},
|
||||
|
||||
@ -13,7 +13,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/types/query"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
)
|
||||
|
||||
var _ Keeper = (*BaseKeeper)(nil)
|
||||
@ -57,7 +56,6 @@ type BaseKeeper struct {
|
||||
ak types.AccountKeeper
|
||||
cdc codec.BinaryCodec
|
||||
storeKey storetypes.StoreKey
|
||||
paramSpace paramtypes.Subspace
|
||||
mintCoinsRestrictionFn MintingRestrictionFn
|
||||
}
|
||||
|
||||
@ -98,20 +96,18 @@ func NewBaseKeeper(
|
||||
cdc codec.BinaryCodec,
|
||||
storeKey storetypes.StoreKey,
|
||||
ak types.AccountKeeper,
|
||||
paramSpace paramtypes.Subspace,
|
||||
blockedAddrs map[string]bool,
|
||||
authority string,
|
||||
) BaseKeeper {
|
||||
// set KeyTable if it has not already been set
|
||||
if !paramSpace.HasKeyTable() {
|
||||
paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable())
|
||||
if _, err := sdk.AccAddressFromBech32(authority); err != nil {
|
||||
panic(fmt.Errorf("invalid bank authority address: %w", err))
|
||||
}
|
||||
|
||||
return BaseKeeper{
|
||||
BaseSendKeeper: NewBaseSendKeeper(cdc, storeKey, ak, paramSpace, blockedAddrs),
|
||||
BaseSendKeeper: NewBaseSendKeeper(cdc, storeKey, ak, blockedAddrs, authority),
|
||||
ak: ak,
|
||||
cdc: cdc,
|
||||
storeKey: storeKey,
|
||||
paramSpace: paramSpace,
|
||||
mintCoinsRestrictionFn: func(ctx sdk.Context, coins sdk.Coins) error { return nil },
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,9 +21,11 @@ import (
|
||||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
vesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
|
||||
)
|
||||
@ -74,6 +76,7 @@ type IntegrationTestSuite struct {
|
||||
app *simapp.SimApp
|
||||
ctx sdk.Context
|
||||
queryClient types.QueryClient
|
||||
msgServer types.MsgServer
|
||||
}
|
||||
|
||||
func (suite *IntegrationTestSuite) initKeepersWithmAccPerms(blockedAddrs map[string]bool) (authkeeper.AccountKeeper, keeper.BaseKeeper) {
|
||||
@ -91,27 +94,26 @@ func (suite *IntegrationTestSuite) initKeepersWithmAccPerms(blockedAddrs map[str
|
||||
maccPerms, sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
||||
)
|
||||
keeper := keeper.NewBaseKeeper(
|
||||
appCodec, app.GetKey(types.StoreKey), authKeeper,
|
||||
app.GetSubspace(types.ModuleName), blockedAddrs,
|
||||
appCodec, app.GetKey(types.StoreKey), authKeeper, blockedAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
||||
)
|
||||
|
||||
return authKeeper, keeper
|
||||
}
|
||||
|
||||
func (suite *IntegrationTestSuite) SetupTest() {
|
||||
app := simapp.Setup(suite.T(), false)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()})
|
||||
suite.app = simapp.Setup(suite.T(), false)
|
||||
suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{Time: time.Now()})
|
||||
|
||||
app.AccountKeeper.SetParams(ctx, authtypes.DefaultParams())
|
||||
app.BankKeeper.SetParams(ctx, types.DefaultParams())
|
||||
suite.Require().NoError(suite.app.AccountKeeper.SetParams(suite.ctx, authtypes.DefaultParams()))
|
||||
suite.Require().NoError(suite.app.BankKeeper.SetParams(suite.ctx, types.DefaultParams()))
|
||||
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry())
|
||||
types.RegisterQueryServer(queryHelper, app.BankKeeper)
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry())
|
||||
types.RegisterQueryServer(queryHelper, suite.app.BankKeeper)
|
||||
queryClient := types.NewQueryClient(queryHelper)
|
||||
types.RegisterInterfaces(suite.app.InterfaceRegistry())
|
||||
|
||||
suite.app = app
|
||||
suite.ctx = ctx
|
||||
suite.queryClient = queryClient
|
||||
suite.msgServer = keeper.NewMsgServerImpl(suite.app.BankKeeper)
|
||||
}
|
||||
|
||||
func (suite *IntegrationTestSuite) TestSupply() {
|
||||
@ -496,7 +498,7 @@ func (suite *IntegrationTestSuite) TestSendEnabled() {
|
||||
params := types.DefaultParams()
|
||||
suite.Require().Equal(enabled, params.DefaultSendEnabled)
|
||||
|
||||
app.BankKeeper.SetParams(ctx, params)
|
||||
suite.Require().NoError(app.BankKeeper.SetParams(ctx, params))
|
||||
|
||||
bondCoin := sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())
|
||||
fooCoin := sdk.NewCoin("foocoin", sdk.OneInt())
|
||||
@ -512,7 +514,7 @@ func (suite *IntegrationTestSuite) TestSendEnabled() {
|
||||
|
||||
// Set default send_enabled to !enabled, add a foodenom that overrides default as enabled
|
||||
params.DefaultSendEnabled = !enabled
|
||||
app.BankKeeper.SetParams(ctx, params)
|
||||
suite.Require().NoError(app.BankKeeper.SetParams(ctx, params))
|
||||
app.BankKeeper.SetSendEnabled(ctx, fooCoin.Denom, enabled)
|
||||
|
||||
// Expect our specific override to be enabled, others to be !enabled.
|
||||
@ -596,7 +598,7 @@ func (suite *IntegrationTestSuite) TestMsgSendEvents() {
|
||||
func (suite *IntegrationTestSuite) TestMsgMultiSendEvents() {
|
||||
app, ctx := suite.app, suite.ctx
|
||||
|
||||
app.BankKeeper.SetParams(ctx, types.DefaultParams())
|
||||
suite.Require().NoError(app.BankKeeper.SetParams(ctx, types.DefaultParams()))
|
||||
|
||||
addr := sdk.AccAddress([]byte("addr1_______________"))
|
||||
addr2 := sdk.AccAddress([]byte("addr2_______________"))
|
||||
@ -1055,7 +1057,7 @@ func (suite *IntegrationTestSuite) TestBalanceTrackingEvents() {
|
||||
)
|
||||
|
||||
suite.app.BankKeeper = keeper.NewBaseKeeper(suite.app.AppCodec(), suite.app.GetKey(types.StoreKey),
|
||||
suite.app.AccountKeeper, suite.app.GetSubspace(types.ModuleName), nil,
|
||||
suite.app.AccountKeeper, nil, authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
||||
)
|
||||
|
||||
// set account with multiple permissions
|
||||
@ -1148,9 +1150,9 @@ func (suite *IntegrationTestSuite) getTestMetadata() []types.Metadata {
|
||||
Symbol: "ATOM",
|
||||
Description: "The native staking token of the Cosmos Hub.",
|
||||
DenomUnits: []*types.DenomUnit{
|
||||
{"uatom", uint32(0), []string{"microatom"}},
|
||||
{"matom", uint32(3), []string{"milliatom"}},
|
||||
{"atom", uint32(6), nil},
|
||||
{Denom: "uatom", Exponent: uint32(0), Aliases: []string{"microatom"}},
|
||||
{Denom: "matom", Exponent: uint32(3), Aliases: []string{"milliatom"}},
|
||||
{Denom: "atom", Exponent: uint32(6), Aliases: nil},
|
||||
},
|
||||
Base: "uatom",
|
||||
Display: "atom",
|
||||
@ -1160,9 +1162,9 @@ func (suite *IntegrationTestSuite) getTestMetadata() []types.Metadata {
|
||||
Symbol: "TOKEN",
|
||||
Description: "The native staking token of the Token Hub.",
|
||||
DenomUnits: []*types.DenomUnit{
|
||||
{"1token", uint32(5), []string{"decitoken"}},
|
||||
{"2token", uint32(4), []string{"centitoken"}},
|
||||
{"3token", uint32(7), []string{"dekatoken"}},
|
||||
{Denom: "1token", Exponent: uint32(5), Aliases: []string{"decitoken"}},
|
||||
{Denom: "2token", Exponent: uint32(4), Aliases: []string{"centitoken"}},
|
||||
{Denom: "3token", Exponent: uint32(7), Aliases: []string{"dekatoken"}},
|
||||
},
|
||||
Base: "utoken",
|
||||
Display: "token",
|
||||
@ -1195,7 +1197,7 @@ func (suite *IntegrationTestSuite) TestMintCoinRestrictions() {
|
||||
}{
|
||||
{
|
||||
"restriction",
|
||||
func(ctx sdk.Context, coins sdk.Coins) error {
|
||||
func(_ sdk.Context, coins sdk.Coins) error {
|
||||
for _, coin := range coins {
|
||||
if coin.Denom != fooDenom {
|
||||
return fmt.Errorf("Module %s only has perms for minting %s coins, tried minting %s coins", types.ModuleName, fooDenom, coin.Denom)
|
||||
@ -1218,7 +1220,7 @@ func (suite *IntegrationTestSuite) TestMintCoinRestrictions() {
|
||||
|
||||
for _, test := range tests {
|
||||
suite.app.BankKeeper = keeper.NewBaseKeeper(suite.app.AppCodec(), suite.app.GetKey(types.StoreKey),
|
||||
suite.app.AccountKeeper, suite.app.GetSubspace(types.ModuleName), nil,
|
||||
suite.app.AccountKeeper, nil, authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
||||
).WithMintCoinsRestriction(keeper.MintingRestrictionFn(test.restrictionFn))
|
||||
for _, testCase := range test.testCases {
|
||||
if testCase.expectPass {
|
||||
@ -1273,7 +1275,7 @@ func (suite *IntegrationTestSuite) TestIsSendEnabledDenom() {
|
||||
|
||||
for _, def := range []bool{true, false} {
|
||||
params := types.Params{DefaultSendEnabled: def}
|
||||
bankKeeper.SetParams(ctx, params)
|
||||
suite.Require().NoError(bankKeeper.SetParams(ctx, params))
|
||||
for _, tc := range tests {
|
||||
suite.T().Run(fmt.Sprintf("%s default %t", tc.denom, def), func(t *testing.T) {
|
||||
actual := suite.app.BankKeeper.IsSendEnabledDenom(suite.ctx, tc.denom)
|
||||
@ -1378,7 +1380,7 @@ func (suite *IntegrationTestSuite) TestSetSendEnabled() {
|
||||
|
||||
for _, def := range []bool{true, false} {
|
||||
params := types.Params{DefaultSendEnabled: def}
|
||||
bankKeeper.SetParams(ctx, params)
|
||||
suite.Require().NoError(bankKeeper.SetParams(ctx, params))
|
||||
for _, tc := range tests {
|
||||
suite.T().Run(fmt.Sprintf("%s default %t", tc.name, def), func(t *testing.T) {
|
||||
bankKeeper.SetSendEnabled(ctx, tc.denom, tc.value)
|
||||
@ -1407,48 +1409,48 @@ func (suite *IntegrationTestSuite) TestSetAllSendEnabled() {
|
||||
{
|
||||
name: "one true",
|
||||
sendEnableds: []*types.SendEnabled{
|
||||
{"aonecoin", true},
|
||||
{Denom: "aonecoin", Enabled: true},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "one false",
|
||||
sendEnableds: []*types.SendEnabled{
|
||||
{"bonecoin", false},
|
||||
{Denom: "bonecoin", Enabled: false},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "two true",
|
||||
sendEnableds: []*types.SendEnabled{
|
||||
{"conecoin", true},
|
||||
{"ctwocoin", true},
|
||||
{Denom: "conecoin", Enabled: true},
|
||||
{Denom: "ctwocoin", Enabled: true},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "two true false",
|
||||
sendEnableds: []*types.SendEnabled{
|
||||
{"donecoin", true},
|
||||
{"dtwocoin", false},
|
||||
{Denom: "donecoin", Enabled: true},
|
||||
{Denom: "dtwocoin", Enabled: false},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "two false true",
|
||||
sendEnableds: []*types.SendEnabled{
|
||||
{"eonecoin", false},
|
||||
{"etwocoin", true},
|
||||
{Denom: "eonecoin", Enabled: false},
|
||||
{Denom: "etwocoin", Enabled: true},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "two false",
|
||||
sendEnableds: []*types.SendEnabled{
|
||||
{"fonecoin", false},
|
||||
{"ftwocoin", false},
|
||||
{Denom: "fonecoin", Enabled: false},
|
||||
{Denom: "ftwocoin", Enabled: false},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, def := range []bool{true, false} {
|
||||
params := types.Params{DefaultSendEnabled: def}
|
||||
bankKeeper.SetParams(ctx, params)
|
||||
suite.Require().NoError(bankKeeper.SetParams(ctx, params))
|
||||
for _, tc := range tests {
|
||||
suite.T().Run(fmt.Sprintf("%s default %t", tc.name, def), func(t *testing.T) {
|
||||
bankKeeper.SetAllSendEnabled(ctx, tc.sendEnableds)
|
||||
@ -1466,7 +1468,7 @@ func (suite *IntegrationTestSuite) TestDeleteSendEnabled() {
|
||||
|
||||
for _, def := range []bool{true, false} {
|
||||
params := types.Params{DefaultSendEnabled: def}
|
||||
bankKeeper.SetParams(ctx, params)
|
||||
suite.Require().NoError(bankKeeper.SetParams(ctx, params))
|
||||
suite.T().Run(fmt.Sprintf("default %t", def), func(t *testing.T) {
|
||||
denom := fmt.Sprintf("somerand%tcoin", !def)
|
||||
bankKeeper.SetSendEnabled(ctx, denom, !def)
|
||||
@ -1482,7 +1484,7 @@ func (suite *IntegrationTestSuite) TestIterateSendEnabledEntries() {
|
||||
|
||||
suite.T().Run("no entries to iterate", func(t *testing.T) {
|
||||
count := 0
|
||||
bankKeeper.IterateSendEnabledEntries(ctx, func(denom string, sendEnabled bool) (stop bool) {
|
||||
bankKeeper.IterateSendEnabledEntries(ctx, func(_ string, _ bool) (stop bool) {
|
||||
count++
|
||||
return false
|
||||
})
|
||||
@ -1500,7 +1502,7 @@ func (suite *IntegrationTestSuite) TestIterateSendEnabledEntries() {
|
||||
|
||||
for _, def := range []bool{true, false} {
|
||||
params := types.Params{DefaultSendEnabled: def}
|
||||
bankKeeper.SetParams(ctx, params)
|
||||
suite.Require().NoError(bankKeeper.SetParams(ctx, params))
|
||||
var seen []string
|
||||
suite.T().Run(fmt.Sprintf("all denoms have expected values default %t", def), func(t *testing.T) {
|
||||
bankKeeper.IterateSendEnabledEntries(ctx, func(denom string, sendEnabled bool) (stop bool) {
|
||||
@ -1524,7 +1526,7 @@ func (suite *IntegrationTestSuite) TestIterateSendEnabledEntries() {
|
||||
|
||||
suite.T().Run("no entries to iterate again after deleting all of them", func(t *testing.T) {
|
||||
count := 0
|
||||
bankKeeper.IterateSendEnabledEntries(ctx, func(denom string, sendEnabled bool) (stop bool) {
|
||||
bankKeeper.IterateSendEnabledEntries(ctx, func(_ string, _ bool) (stop bool) {
|
||||
count++
|
||||
return false
|
||||
})
|
||||
@ -1551,7 +1553,7 @@ func (suite *IntegrationTestSuite) TestGetAllSendEnabledEntries() {
|
||||
|
||||
for _, def := range []bool{true, false} {
|
||||
params := types.Params{DefaultSendEnabled: def}
|
||||
bankKeeper.SetParams(ctx, params)
|
||||
suite.Require().NoError(bankKeeper.SetParams(ctx, params))
|
||||
var seen []string
|
||||
suite.T().Run(fmt.Sprintf("all denoms have expected values default %t", def), func(t *testing.T) {
|
||||
actual := bankKeeper.GetAllSendEnabledEntries(ctx)
|
||||
@ -1579,14 +1581,25 @@ func (suite *IntegrationTestSuite) TestGetAllSendEnabledEntries() {
|
||||
})
|
||||
}
|
||||
|
||||
type mockSubspace struct {
|
||||
ps banktypes.Params
|
||||
}
|
||||
|
||||
func (ms mockSubspace) GetParamSet(ctx sdk.Context, ps exported.ParamSet) {
|
||||
*ps.(*banktypes.Params) = ms.ps
|
||||
}
|
||||
|
||||
func (suite *IntegrationTestSuite) TestMigrator_Migrate3to4() {
|
||||
ctx, bankKeeper := suite.ctx, suite.app.BankKeeper
|
||||
|
||||
for _, def := range []bool{true, false} {
|
||||
params := types.Params{DefaultSendEnabled: def}
|
||||
bankKeeper.SetParams(ctx, params)
|
||||
suite.Require().NoError(bankKeeper.SetParams(ctx, params))
|
||||
suite.T().Run(fmt.Sprintf("default %t does not change", def), func(t *testing.T) {
|
||||
migrator := keeper.NewMigrator(bankKeeper.(keeper.BaseKeeper))
|
||||
legacySubspace := func(ps types.Params) mockSubspace {
|
||||
return mockSubspace{ps: ps}
|
||||
}(banktypes.NewParams(def))
|
||||
migrator := keeper.NewMigrator(bankKeeper.(keeper.BaseKeeper), legacySubspace)
|
||||
require.NoError(t, migrator.Migrate3to4(ctx))
|
||||
actual := bankKeeper.GetParams(ctx)
|
||||
assert.Equal(t, params.DefaultSendEnabled, actual.DefaultSendEnabled)
|
||||
@ -1596,13 +1609,16 @@ func (suite *IntegrationTestSuite) TestMigrator_Migrate3to4() {
|
||||
for _, def := range []bool{true, false} {
|
||||
params := types.Params{
|
||||
SendEnabled: []*types.SendEnabled{
|
||||
{fmt.Sprintf("truecoin%t", def), true},
|
||||
{fmt.Sprintf("falsecoin%t", def), false},
|
||||
{Denom: fmt.Sprintf("truecoin%t", def), Enabled: true},
|
||||
{Denom: fmt.Sprintf("falsecoin%t", def), Enabled: false},
|
||||
},
|
||||
}
|
||||
bankKeeper.SetParams(ctx, params)
|
||||
suite.Require().NoError(bankKeeper.SetParams(ctx, params))
|
||||
suite.T().Run(fmt.Sprintf("default %t send enabled info moved to store", def), func(t *testing.T) {
|
||||
migrator := keeper.NewMigrator(bankKeeper.(keeper.BaseKeeper))
|
||||
legacySubspace := func(ps types.Params) mockSubspace {
|
||||
return mockSubspace{ps: ps}
|
||||
}(banktypes.NewParams(def))
|
||||
migrator := keeper.NewMigrator(bankKeeper.(keeper.BaseKeeper), legacySubspace)
|
||||
require.NoError(t, migrator.Migrate3to4(ctx))
|
||||
newParams := bankKeeper.GetParams(ctx)
|
||||
assert.Len(t, newParams.SendEnabled, 0)
|
||||
@ -1618,10 +1634,10 @@ func (suite *IntegrationTestSuite) TestSetParams() {
|
||||
ctx, bankKeeper := suite.ctx, suite.app.BankKeeper
|
||||
params := types.NewParams(true)
|
||||
params.SendEnabled = []*types.SendEnabled{
|
||||
{"paramscointrue", true},
|
||||
{"paramscoinfalse", false},
|
||||
{Denom: "paramscointrue", Enabled: true},
|
||||
{Denom: "paramscoinfalse", Enabled: false},
|
||||
}
|
||||
bankKeeper.SetParams(ctx, params)
|
||||
suite.Require().NoError(bankKeeper.SetParams(ctx, params))
|
||||
|
||||
suite.Run("stored params are as expected", func() {
|
||||
actual := bankKeeper.GetParams(ctx)
|
||||
|
||||
@ -2,35 +2,34 @@ package keeper
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
v043 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v043"
|
||||
v046 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v046"
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/exported"
|
||||
v2 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v2"
|
||||
v3 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v3"
|
||||
v4 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v4"
|
||||
)
|
||||
|
||||
// Migrator is a struct for handling in-place store migrations.
|
||||
type Migrator struct {
|
||||
keeper BaseKeeper
|
||||
keeper BaseKeeper
|
||||
legacySubspace exported.Subspace
|
||||
}
|
||||
|
||||
// NewMigrator returns a new Migrator.
|
||||
func NewMigrator(keeper BaseKeeper) Migrator {
|
||||
return Migrator{keeper: keeper}
|
||||
func NewMigrator(keeper BaseKeeper, legacySubspace exported.Subspace) Migrator {
|
||||
return Migrator{keeper: keeper, legacySubspace: legacySubspace}
|
||||
}
|
||||
|
||||
// Migrate1to2 migrates from version 1 to 2.
|
||||
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
|
||||
return v043.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc)
|
||||
return v2.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc)
|
||||
}
|
||||
|
||||
// Migrate2to3 migrates x/bank storage from version 2 to 3.
|
||||
func (m Migrator) Migrate2to3(ctx sdk.Context) error {
|
||||
return v046.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc)
|
||||
return v3.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc)
|
||||
}
|
||||
|
||||
// Migrate3to4 migrates x/bank storage from version 3 to 4.
|
||||
func (m Migrator) Migrate3to4(ctx sdk.Context) error {
|
||||
oldParams := m.keeper.GetParams(ctx)
|
||||
m.keeper.SetAllSendEnabled(ctx, oldParams.GetSendEnabled())
|
||||
m.keeper.SetParams(ctx, banktypes.NewParams(oldParams.DefaultSendEnabled))
|
||||
return nil
|
||||
return v4.MigrateStore(ctx, m.keeper.storeKey, m.legacySubspace, m.keeper.cdc)
|
||||
}
|
||||
|
||||
@ -7,22 +7,24 @@ import (
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/telemetry"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/errors"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
)
|
||||
|
||||
type msgServer struct {
|
||||
Keeper
|
||||
}
|
||||
|
||||
var _ types.MsgServer = msgServer{}
|
||||
|
||||
// NewMsgServerImpl returns an implementation of the bank MsgServer interface
|
||||
// for the provided Keeper.
|
||||
func NewMsgServerImpl(keeper Keeper) types.MsgServer {
|
||||
return &msgServer{Keeper: keeper}
|
||||
}
|
||||
|
||||
var _ types.MsgServer = msgServer{}
|
||||
|
||||
func (k msgServer) Send(goCtx context.Context, msg *types.MsgSend) (*types.MsgSendResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
|
||||
@ -100,3 +102,24 @@ func (k msgServer) MultiSend(goCtx context.Context, msg *types.MsgMultiSend) (*t
|
||||
|
||||
return &types.MsgMultiSendResponse{}, nil
|
||||
}
|
||||
|
||||
func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
|
||||
if k.GetAuthority() != req.Authority {
|
||||
return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority)
|
||||
}
|
||||
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
if err := k.SetParams(ctx, req.Params); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ctx.EventManager().EmitEvent(
|
||||
sdk.NewEvent(
|
||||
sdk.EventTypeMessage,
|
||||
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
|
||||
sdk.NewAttribute(sdk.AttributeKeySender, req.Authority),
|
||||
),
|
||||
)
|
||||
|
||||
return &types.MsgUpdateParamsResponse{}, nil
|
||||
}
|
||||
|
||||
61
x/bank/keeper/msg_service_test.go
Normal file
61
x/bank/keeper/msg_service_test.go
Normal file
@ -0,0 +1,61 @@
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
)
|
||||
|
||||
func (suite *IntegrationTestSuite) TestMsgUpdateParams() {
|
||||
// default params
|
||||
params := types.DefaultParams()
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
input *types.MsgUpdateParams
|
||||
expErr bool
|
||||
expErrMsg string
|
||||
}{
|
||||
{
|
||||
name: "invalid authority",
|
||||
input: &types.MsgUpdateParams{
|
||||
Authority: "invalid",
|
||||
Params: params,
|
||||
},
|
||||
expErr: true,
|
||||
expErrMsg: "invalid authority",
|
||||
},
|
||||
{
|
||||
name: "send enabled param",
|
||||
input: &types.MsgUpdateParams{
|
||||
Authority: suite.app.BankKeeper.GetAuthority(),
|
||||
Params: types.Params{
|
||||
SendEnabled: []*types.SendEnabled{
|
||||
{Denom: "foo", Enabled: true},
|
||||
},
|
||||
},
|
||||
},
|
||||
expErr: false,
|
||||
},
|
||||
{
|
||||
name: "all good",
|
||||
input: &types.MsgUpdateParams{
|
||||
Authority: suite.app.BankKeeper.GetAuthority(),
|
||||
Params: params,
|
||||
},
|
||||
expErr: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
suite.Run(tc.name, func() {
|
||||
_, err := suite.msgServer.UpdateParams(suite.ctx, tc.input)
|
||||
|
||||
if tc.expErr {
|
||||
suite.Require().Error(err)
|
||||
suite.Require().Contains(err.Error(), tc.expErrMsg)
|
||||
} else {
|
||||
suite.Require().NoError(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||
@ -9,7 +11,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/types/address"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
)
|
||||
|
||||
// SendKeeper defines a module interface that facilitates the transfer of coins
|
||||
@ -17,11 +18,11 @@ import (
|
||||
type SendKeeper interface {
|
||||
ViewKeeper
|
||||
|
||||
InputOutputCoins(ctx sdk.Context, inputs types.Input, outputs []types.Output) error
|
||||
InputOutputCoins(ctx sdk.Context, input types.Input, outputs []types.Output) error
|
||||
SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
|
||||
|
||||
GetParams(ctx sdk.Context) types.Params
|
||||
SetParams(ctx sdk.Context, params types.Params)
|
||||
SetParams(ctx sdk.Context, params types.Params) error
|
||||
|
||||
IsSendEnabledDenom(ctx sdk.Context, denom string) bool
|
||||
GetSendEnabledEntry(ctx sdk.Context, denom string) (types.SendEnabled, bool)
|
||||
@ -36,6 +37,8 @@ type SendKeeper interface {
|
||||
|
||||
BlockedAddr(addr sdk.AccAddress) bool
|
||||
GetBlockedAddresses() map[string]bool
|
||||
|
||||
GetAuthority() string
|
||||
}
|
||||
|
||||
var _ SendKeeper = (*BaseSendKeeper)(nil)
|
||||
@ -45,44 +48,73 @@ var _ SendKeeper = (*BaseSendKeeper)(nil)
|
||||
type BaseSendKeeper struct {
|
||||
BaseViewKeeper
|
||||
|
||||
cdc codec.BinaryCodec
|
||||
ak types.AccountKeeper
|
||||
storeKey storetypes.StoreKey
|
||||
paramSpace paramtypes.Subspace
|
||||
cdc codec.BinaryCodec
|
||||
ak types.AccountKeeper
|
||||
storeKey storetypes.StoreKey
|
||||
|
||||
// list of addresses that are restricted from receiving transactions
|
||||
blockedAddrs map[string]bool
|
||||
|
||||
// the address capable of executing a MsgUpdateParams message. Typically, this
|
||||
// should be the x/gov module account.
|
||||
authority string
|
||||
}
|
||||
|
||||
func NewBaseSendKeeper(
|
||||
cdc codec.BinaryCodec, storeKey storetypes.StoreKey, ak types.AccountKeeper, paramSpace paramtypes.Subspace, blockedAddrs map[string]bool,
|
||||
cdc codec.BinaryCodec,
|
||||
storeKey storetypes.StoreKey,
|
||||
ak types.AccountKeeper,
|
||||
blockedAddrs map[string]bool,
|
||||
authority string,
|
||||
) BaseSendKeeper {
|
||||
if _, err := sdk.AccAddressFromBech32(authority); err != nil {
|
||||
panic(fmt.Errorf("invalid bank authority address: %w", err))
|
||||
}
|
||||
|
||||
return BaseSendKeeper{
|
||||
BaseViewKeeper: NewBaseViewKeeper(cdc, storeKey, ak),
|
||||
cdc: cdc,
|
||||
ak: ak,
|
||||
storeKey: storeKey,
|
||||
paramSpace: paramSpace,
|
||||
blockedAddrs: blockedAddrs,
|
||||
authority: authority,
|
||||
}
|
||||
}
|
||||
|
||||
// GetAuthority returns the x/bank module's authority.
|
||||
func (k BaseSendKeeper) GetAuthority() string {
|
||||
return k.authority
|
||||
}
|
||||
|
||||
// GetParams returns the total set of bank parameters.
|
||||
func (k BaseSendKeeper) GetParams(ctx sdk.Context) (params types.Params) {
|
||||
k.paramSpace.GetParamSet(ctx, ¶ms)
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
bz := store.Get(types.ParamsKey)
|
||||
if bz == nil {
|
||||
return params
|
||||
}
|
||||
|
||||
k.cdc.MustUnmarshal(bz, ¶ms)
|
||||
return params
|
||||
}
|
||||
|
||||
// SetParams sets the total set of bank parameters.
|
||||
//
|
||||
// nolint:staticcheck
|
||||
func (k BaseSendKeeper) SetParams(ctx sdk.Context, params types.Params) {
|
||||
func (k BaseSendKeeper) SetParams(ctx sdk.Context, params types.Params) error {
|
||||
// normally SendEnabled is deprecated but we still support it for backwards compatibility
|
||||
// using params.Validate() would fail due to the SendEnabled deprecation
|
||||
if len(params.SendEnabled) > 0 {
|
||||
k.SetAllSendEnabled(ctx, params.SendEnabled)
|
||||
// override params without SendEnabled
|
||||
params = types.NewParams(params.DefaultSendEnabled)
|
||||
}
|
||||
|
||||
p := types.NewParams(params.DefaultSendEnabled)
|
||||
k.paramSpace.SetParamSet(ctx, &p)
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
bz, err := k.cdc.Marshal(¶ms)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
store.Set(types.ParamsKey, bz)
|
||||
return nil
|
||||
}
|
||||
|
||||
// InputOutputCoins performs multi-send functionality. It accepts a series of
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package v042
|
||||
package v1
|
||||
|
||||
import (
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
@ -60,7 +60,7 @@ type SupplyI interface {
|
||||
proto.Message
|
||||
}
|
||||
|
||||
// RegisterInterfaces registers interfaces required for the v0.40 migrations.
|
||||
// RegisterInterfaces registers interfaces required for the v1 migrations.
|
||||
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
||||
registry.RegisterInterface(
|
||||
"cosmos.bank.v1beta1.SupplyI",
|
||||
@ -1,4 +1,4 @@
|
||||
package v043
|
||||
package v2
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -1,4 +1,4 @@
|
||||
package v043_test
|
||||
package v2_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@ -9,7 +9,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
v043bank "github.com/cosmos/cosmos-sdk/x/bank/migrations/v043"
|
||||
v2bank "github.com/cosmos/cosmos-sdk/x/bank/migrations/v2"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
)
|
||||
|
||||
@ -41,7 +41,7 @@ func TestMigrateJSON(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
migrated := v043bank.MigrateJSON(bankGenState)
|
||||
migrated := v2bank.MigrateJSON(bankGenState)
|
||||
|
||||
bz, err := clientCtx.Codec.MarshalJSON(migrated)
|
||||
require.NoError(t, err)
|
||||
@ -1,4 +1,4 @@
|
||||
package v043
|
||||
package v2
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@ -1,4 +1,4 @@
|
||||
package v043
|
||||
package v2
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
@ -6,7 +6,7 @@ import (
|
||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
v042auth "github.com/cosmos/cosmos-sdk/x/auth/migrations/v042"
|
||||
v042bank "github.com/cosmos/cosmos-sdk/x/bank/migrations/v042"
|
||||
v1 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v1"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
)
|
||||
|
||||
@ -15,14 +15,14 @@ import (
|
||||
// ref: https://github.com/cosmos/cosmos-sdk/issues/7092
|
||||
func migrateSupply(store sdk.KVStore, cdc codec.BinaryCodec) error {
|
||||
// Old supply was stored as a single blob under the SupplyKey.
|
||||
var oldSupplyI v042bank.SupplyI
|
||||
err := cdc.UnmarshalInterface(store.Get(v042bank.SupplyKey), &oldSupplyI)
|
||||
var oldSupplyI v1.SupplyI
|
||||
err := cdc.UnmarshalInterface(store.Get(v1.SupplyKey), &oldSupplyI)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// We delete the single key holding the whole blob.
|
||||
store.Delete(v042bank.SupplyKey)
|
||||
store.Delete(v1.SupplyKey)
|
||||
|
||||
if oldSupplyI == nil {
|
||||
return nil
|
||||
@ -54,13 +54,13 @@ func migrateBalanceKeys(store sdk.KVStore) {
|
||||
// prefix ("balances") || addrBytes (20 bytes) || denomBytes
|
||||
// new key is of format
|
||||
// prefix (0x02) || addrLen (1 byte) || addrBytes || denomBytes
|
||||
oldStore := prefix.NewStore(store, v042bank.BalancesPrefix)
|
||||
oldStore := prefix.NewStore(store, v1.BalancesPrefix)
|
||||
|
||||
oldStoreIter := oldStore.Iterator(nil, nil)
|
||||
defer oldStoreIter.Close()
|
||||
|
||||
for ; oldStoreIter.Valid(); oldStoreIter.Next() {
|
||||
addr := v042bank.AddressFromBalancesStore(oldStoreIter.Key())
|
||||
addr := v1.AddressFromBalancesStore(oldStoreIter.Key())
|
||||
denom := oldStoreIter.Key()[v042auth.AddrLen:]
|
||||
newStoreKey := append(CreateAccountBalancesPrefix(addr), denom...)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package v043_test
|
||||
package v2_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
@ -10,8 +10,8 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
v042bank "github.com/cosmos/cosmos-sdk/x/bank/migrations/v042"
|
||||
v043bank "github.com/cosmos/cosmos-sdk/x/bank/migrations/v043"
|
||||
v1bank "github.com/cosmos/cosmos-sdk/x/bank/migrations/v1"
|
||||
v2bank "github.com/cosmos/cosmos-sdk/x/bank/migrations/v2"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
)
|
||||
|
||||
@ -21,19 +21,21 @@ func TestSupplyMigration(t *testing.T) {
|
||||
ctx := testutil.DefaultContext(bankKey, sdk.NewTransientStoreKey("transient_test"))
|
||||
store := ctx.KVStore(bankKey)
|
||||
|
||||
v1bank.RegisterInterfaces(encCfg.InterfaceRegistry)
|
||||
|
||||
oldFooCoin := sdk.NewCoin("foo", sdk.NewInt(100))
|
||||
oldBarCoin := sdk.NewCoin("bar", sdk.NewInt(200))
|
||||
oldFooBarCoin := sdk.NewCoin("foobar", sdk.NewInt(0)) // to ensure the zero denom coins pruned.
|
||||
|
||||
// Old supply was stored as a single blob under the `SupplyKey`.
|
||||
var oldSupply v042bank.SupplyI
|
||||
var oldSupply v1bank.SupplyI
|
||||
oldSupply = &types.Supply{Total: sdk.Coins{oldFooCoin, oldBarCoin, oldFooBarCoin}}
|
||||
oldSupplyBz, err := encCfg.Codec.MarshalInterface(oldSupply)
|
||||
require.NoError(t, err)
|
||||
store.Set(v042bank.SupplyKey, oldSupplyBz)
|
||||
store.Set(v1bank.SupplyKey, oldSupplyBz)
|
||||
|
||||
// Run migration.
|
||||
err = v043bank.MigrateStore(ctx, bankKey, encCfg.Codec)
|
||||
err = v2bank.MigrateStore(ctx, bankKey, encCfg.Codec)
|
||||
require.NoError(t, err)
|
||||
|
||||
// New supply is indexed by denom.
|
||||
@ -74,20 +76,20 @@ func TestBalanceKeysMigration(t *testing.T) {
|
||||
|
||||
// set 10 foo coin
|
||||
fooCoin := sdk.NewCoin("foo", sdk.NewInt(10))
|
||||
oldFooKey := append(append(v042bank.BalancesPrefix, addr...), []byte(fooCoin.Denom)...)
|
||||
oldFooKey := append(append(v1bank.BalancesPrefix, addr...), []byte(fooCoin.Denom)...)
|
||||
fooBz, err := encCfg.Codec.Marshal(&fooCoin)
|
||||
require.NoError(t, err)
|
||||
store.Set(oldFooKey, fooBz)
|
||||
|
||||
// set 0 foobar coin
|
||||
fooBarCoin := sdk.NewCoin("foobar", sdk.NewInt(0))
|
||||
oldKeyFooBar := append(append(v042bank.BalancesPrefix, addr...), []byte(fooBarCoin.Denom)...)
|
||||
oldKeyFooBar := append(append(v1bank.BalancesPrefix, addr...), []byte(fooBarCoin.Denom)...)
|
||||
fooBarBz, err := encCfg.Codec.Marshal(&fooBarCoin)
|
||||
require.NoError(t, err)
|
||||
store.Set(oldKeyFooBar, fooBarBz)
|
||||
require.NotNil(t, store.Get(oldKeyFooBar)) // before store migation zero values can also exist in store.
|
||||
|
||||
err = v043bank.MigrateStore(ctx, bankKey, encCfg.Codec)
|
||||
err = v2bank.MigrateStore(ctx, bankKey, encCfg.Codec)
|
||||
require.NoError(t, err)
|
||||
|
||||
newKey := append(types.CreateAccountBalancesPrefix(addr), []byte(fooCoin.Denom)...)
|
||||
@ -1,4 +1,4 @@
|
||||
package v046
|
||||
package v3
|
||||
|
||||
var DenomAddressPrefix = []byte{0x03}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package v046
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
@ -6,7 +6,7 @@ import (
|
||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/address"
|
||||
v043 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v043"
|
||||
v2 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v2"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
)
|
||||
|
||||
@ -27,7 +27,7 @@ func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.Binar
|
||||
}
|
||||
|
||||
func addDenomReverseIndex(store sdk.KVStore, cdc codec.BinaryCodec) error {
|
||||
oldBalancesStore := prefix.NewStore(store, v043.BalancesPrefix)
|
||||
oldBalancesStore := prefix.NewStore(store, v2.BalancesPrefix)
|
||||
|
||||
oldBalancesIter := oldBalancesStore.Iterator(nil, nil)
|
||||
defer oldBalancesIter.Close()
|
||||
@ -40,7 +40,7 @@ func addDenomReverseIndex(store sdk.KVStore, cdc codec.BinaryCodec) error {
|
||||
return err
|
||||
}
|
||||
|
||||
addr, err := v043.AddressFromBalancesStore(oldBalancesIter.Key())
|
||||
addr, err := v2.AddressFromBalancesStore(oldBalancesIter.Key())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -73,7 +73,7 @@ func addDenomReverseIndex(store sdk.KVStore, cdc codec.BinaryCodec) error {
|
||||
}
|
||||
|
||||
func migrateDenomMetadata(store sdk.KVStore) error {
|
||||
oldDenomMetaDataStore := prefix.NewStore(store, v043.DenomMetadataPrefix)
|
||||
oldDenomMetaDataStore := prefix.NewStore(store, v2.DenomMetadataPrefix)
|
||||
|
||||
oldDenomMetaDataIter := oldDenomMetaDataStore.Iterator(nil, nil)
|
||||
defer oldDenomMetaDataIter.Close()
|
||||
@ -1,4 +1,4 @@
|
||||
package v046_test
|
||||
package v3_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
@ -10,8 +10,8 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/address"
|
||||
v043 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v043"
|
||||
v046 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v046"
|
||||
v2 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v2"
|
||||
v3 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v3"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
)
|
||||
|
||||
@ -22,7 +22,7 @@ func TestMigrateStore(t *testing.T) {
|
||||
store := ctx.KVStore(bankKey)
|
||||
|
||||
addr := sdk.AccAddress([]byte("addr________________"))
|
||||
prefixAccStore := prefix.NewStore(store, v043.CreateAccountBalancesPrefix(addr))
|
||||
prefixAccStore := prefix.NewStore(store, v2.CreateAccountBalancesPrefix(addr))
|
||||
|
||||
balances := sdk.NewCoins(
|
||||
sdk.NewCoin("foo", sdk.NewInt(10000)),
|
||||
@ -36,7 +36,7 @@ func TestMigrateStore(t *testing.T) {
|
||||
prefixAccStore.Set([]byte(b.Denom), bz)
|
||||
}
|
||||
|
||||
require.NoError(t, v046.MigrateStore(ctx, bankKey, encCfg.Codec))
|
||||
require.NoError(t, v3.MigrateStore(ctx, bankKey, encCfg.Codec))
|
||||
|
||||
for _, b := range balances {
|
||||
addrPrefixStore := prefix.NewStore(store, types.CreateAccountBalancesPrefix(addr))
|
||||
@ -47,7 +47,7 @@ func TestMigrateStore(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, b := range balances {
|
||||
denomPrefixStore := prefix.NewStore(store, v046.CreateDenomAddressPrefix(b.Denom))
|
||||
denomPrefixStore := prefix.NewStore(store, v3.CreateDenomAddressPrefix(b.Denom))
|
||||
bz := denomPrefixStore.Get(address.MustLengthPrefix(addr))
|
||||
require.NotNil(t, bz)
|
||||
}
|
||||
@ -84,10 +84,10 @@ func TestMigrateDenomMetaData(t *testing.T) {
|
||||
Display: "token",
|
||||
},
|
||||
}
|
||||
denomMetadataStore := prefix.NewStore(store, v043.DenomMetadataPrefix)
|
||||
denomMetadataStore := prefix.NewStore(store, v2.DenomMetadataPrefix)
|
||||
|
||||
for i := range []int{0, 1} {
|
||||
key := append(v043.DenomMetadataPrefix, []byte(metaData[i].Base)...)
|
||||
key := append(v2.DenomMetadataPrefix, []byte(metaData[i].Base)...)
|
||||
// keys before 0.45 had denom two times in the key
|
||||
key = append(key, []byte(metaData[i].Base)...)
|
||||
bz, err := encCfg.Codec.Marshal(&metaData[i])
|
||||
@ -95,9 +95,9 @@ func TestMigrateDenomMetaData(t *testing.T) {
|
||||
denomMetadataStore.Set(key, bz)
|
||||
}
|
||||
|
||||
require.NoError(t, v046.MigrateStore(ctx, bankKey, encCfg.Codec))
|
||||
require.NoError(t, v3.MigrateStore(ctx, bankKey, encCfg.Codec))
|
||||
|
||||
denomMetadataStore = prefix.NewStore(store, v043.DenomMetadataPrefix)
|
||||
denomMetadataStore = prefix.NewStore(store, v2.DenomMetadataPrefix)
|
||||
denomMetadataIter := denomMetadataStore.Iterator(nil, nil)
|
||||
defer denomMetadataIter.Close()
|
||||
for i := 0; denomMetadataIter.Valid(); denomMetadataIter.Next() {
|
||||
@ -1,4 +1,4 @@
|
||||
package v047
|
||||
package v4
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
@ -1,4 +1,4 @@
|
||||
package v047
|
||||
package v4_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
v4 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v4"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
)
|
||||
|
||||
@ -80,16 +81,16 @@ func TestMigrateGenState(t *testing.T) {
|
||||
oldState: &types.GenesisState{
|
||||
Params: types.Params{
|
||||
SendEnabled: []*types.SendEnabled{
|
||||
{"movecointrue", true},
|
||||
{"movecoinfalse", false},
|
||||
{Denom: "movecointrue", Enabled: true},
|
||||
{Denom: "movecoinfalse", Enabled: false},
|
||||
},
|
||||
},
|
||||
},
|
||||
newState: &types.GenesisState{
|
||||
Params: types.Params{},
|
||||
SendEnabled: []types.SendEnabled{
|
||||
{"movecointrue", true},
|
||||
{"movecoinfalse", false},
|
||||
{Denom: "movecointrue", Enabled: true},
|
||||
{Denom: "movecoinfalse", Enabled: false},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -98,20 +99,20 @@ func TestMigrateGenState(t *testing.T) {
|
||||
oldState: &types.GenesisState{
|
||||
Params: types.Params{
|
||||
SendEnabled: []*types.SendEnabled{
|
||||
{"movecointrue", true},
|
||||
{"movecoinfalse", false},
|
||||
{Denom: "movecointrue", Enabled: true},
|
||||
{Denom: "movecoinfalse", Enabled: false},
|
||||
},
|
||||
},
|
||||
SendEnabled: []types.SendEnabled{
|
||||
{"staycoin", true},
|
||||
{Denom: "staycoin", Enabled: true},
|
||||
},
|
||||
},
|
||||
newState: &types.GenesisState{
|
||||
Params: types.Params{},
|
||||
SendEnabled: []types.SendEnabled{
|
||||
{"staycoin", true},
|
||||
{"movecointrue", true},
|
||||
{"movecoinfalse", false},
|
||||
{Denom: "staycoin", Enabled: true},
|
||||
{Denom: "movecointrue", Enabled: true},
|
||||
{Denom: "movecoinfalse", Enabled: false},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -120,17 +121,17 @@ func TestMigrateGenState(t *testing.T) {
|
||||
oldState: &types.GenesisState{
|
||||
Params: types.Params{
|
||||
SendEnabled: []*types.SendEnabled{
|
||||
{"staycoin", false},
|
||||
{Denom: "staycoin", Enabled: false},
|
||||
},
|
||||
},
|
||||
SendEnabled: []types.SendEnabled{
|
||||
{"staycoin", true},
|
||||
{Denom: "staycoin", Enabled: true},
|
||||
},
|
||||
},
|
||||
newState: &types.GenesisState{
|
||||
Params: types.Params{},
|
||||
SendEnabled: []types.SendEnabled{
|
||||
{"staycoin", true},
|
||||
{Denom: "staycoin", Enabled: true},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -138,7 +139,7 @@ func TestMigrateGenState(t *testing.T) {
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
actual := MigrateGenState(tc.oldState)
|
||||
actual := v4.MigrateGenState(tc.oldState)
|
||||
assert.Equal(t, tc.newState, actual)
|
||||
})
|
||||
}
|
||||
@ -147,12 +148,12 @@ func TestMigrateGenState(t *testing.T) {
|
||||
origState := types.GenesisState{
|
||||
Params: types.Params{
|
||||
SendEnabled: []*types.SendEnabled{
|
||||
{"movecointrue", true},
|
||||
{"movecoinfalse", false},
|
||||
{Denom: "movecointrue", Enabled: true},
|
||||
{Denom: "movecoinfalse", Enabled: false},
|
||||
},
|
||||
},
|
||||
}
|
||||
_ = MigrateGenState(&origState)
|
||||
_ = v4.MigrateGenState(&origState)
|
||||
assert.Len(t, origState.Params.SendEnabled, 2)
|
||||
})
|
||||
}
|
||||
36
x/bank/migrations/v4/store.go
Normal file
36
x/bank/migrations/v4/store.go
Normal file
@ -0,0 +1,36 @@
|
||||
package v4
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
)
|
||||
|
||||
const ModuleName = "bank"
|
||||
|
||||
var ParamsKey = []byte{0x05}
|
||||
|
||||
// MigrateStore migrates the x/bank module state from the consensus version 3 to
|
||||
// version 4. Specifically, it takes the parameters that are currently stored
|
||||
// and managed by the x/params module and stores them directly into the x/bank
|
||||
// module state.
|
||||
func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, legacySubspace exported.Subspace, cdc codec.BinaryCodec) error {
|
||||
store := ctx.KVStore(storeKey)
|
||||
var currParams types.Params
|
||||
legacySubspace.GetParamSet(ctx, &currParams)
|
||||
|
||||
if err := currParams.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
bz, err := cdc.Marshal(&currParams)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
store.Set(ParamsKey, bz)
|
||||
|
||||
return nil
|
||||
}
|
||||
44
x/bank/migrations/v4/store_test.go
Normal file
44
x/bank/migrations/v4/store_test.go
Normal file
@ -0,0 +1,44 @@
|
||||
package v4_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/exported"
|
||||
v4 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v4"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type mockSubspace struct {
|
||||
ps types.Params
|
||||
}
|
||||
|
||||
func newMockSubspace(ps types.Params) mockSubspace {
|
||||
return mockSubspace{ps: ps}
|
||||
}
|
||||
|
||||
func (ms mockSubspace) GetParamSet(ctx sdk.Context, ps exported.ParamSet) {
|
||||
*ps.(*types.Params) = ms.ps
|
||||
}
|
||||
|
||||
func TestMigrate(t *testing.T) {
|
||||
encCfg := moduletestutil.MakeTestEncodingConfig(bank.AppModuleBasic{})
|
||||
cdc := encCfg.Codec
|
||||
|
||||
storeKey := sdk.NewKVStoreKey(v4.ModuleName)
|
||||
tKey := sdk.NewTransientStoreKey("transient_test")
|
||||
ctx := testutil.DefaultContext(storeKey, tKey)
|
||||
store := ctx.KVStore(storeKey)
|
||||
|
||||
legacySubspace := newMockSubspace(types.DefaultParams())
|
||||
require.NoError(t, v4.MigrateStore(ctx, storeKey, legacySubspace, cdc))
|
||||
|
||||
var res types.Params
|
||||
bz := store.Get(v4.ParamsKey)
|
||||
require.NoError(t, cdc.Unmarshal(bz, &res))
|
||||
require.Equal(t, legacySubspace.ps, res)
|
||||
}
|
||||
@ -10,7 +10,6 @@ import (
|
||||
modulev1 "cosmossdk.io/api/cosmos/bank/module/v1"
|
||||
"cosmossdk.io/depinject"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
@ -26,13 +25,19 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/client/cli"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
||||
v040 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v042"
|
||||
v1bank "github.com/cosmos/cosmos-sdk/x/bank/migrations/v1"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/simulation"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
)
|
||||
|
||||
// ConsensusVersion defines the current x/bank module consensus version.
|
||||
const ConsensusVersion = 4
|
||||
|
||||
var (
|
||||
_ module.AppModule = AppModule{}
|
||||
_ module.AppModuleBasic = AppModuleBasic{}
|
||||
@ -90,7 +95,7 @@ func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
|
||||
types.RegisterInterfaces(registry)
|
||||
|
||||
// Register legacy interfaces for migration scripts.
|
||||
v040.RegisterInterfaces(registry)
|
||||
v1bank.RegisterInterfaces(registry)
|
||||
}
|
||||
|
||||
// AppModule implements an application module for the bank module.
|
||||
@ -99,6 +104,9 @@ type AppModule struct {
|
||||
|
||||
keeper keeper.Keeper
|
||||
accountKeeper types.AccountKeeper
|
||||
|
||||
// legacySubspace is used solely for migration of x/params managed parameters
|
||||
legacySubspace exported.Subspace
|
||||
}
|
||||
|
||||
// RegisterServices registers module services.
|
||||
@ -106,7 +114,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
|
||||
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
|
||||
types.RegisterQueryServer(cfg.QueryServer(), am.keeper)
|
||||
|
||||
m := keeper.NewMigrator(am.keeper.(keeper.BaseKeeper))
|
||||
m := keeper.NewMigrator(am.keeper.(keeper.BaseKeeper), am.legacySubspace)
|
||||
if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil {
|
||||
panic(fmt.Sprintf("failed to migrate x/bank from version 1 to 2: %v", err))
|
||||
}
|
||||
@ -121,11 +129,12 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
|
||||
}
|
||||
|
||||
// NewAppModule creates a new AppModule object
|
||||
func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper) AppModule {
|
||||
func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper, ss exported.Subspace) AppModule {
|
||||
return AppModule{
|
||||
AppModuleBasic: AppModuleBasic{cdc: cdc},
|
||||
keeper: keeper,
|
||||
accountKeeper: accountKeeper,
|
||||
legacySubspace: ss,
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,7 +179,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
|
||||
}
|
||||
|
||||
// ConsensusVersion implements AppModule/ConsensusVersion.
|
||||
func (AppModule) ConsensusVersion() uint64 { return 4 }
|
||||
func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
@ -184,9 +193,13 @@ func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedP
|
||||
return nil
|
||||
}
|
||||
|
||||
// RandomizedParams creates randomized bank param changes for the simulator.
|
||||
func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange {
|
||||
return simulation.ParamChanges(r)
|
||||
// RandomizedParams creates randomized distribution param changes for the simulator.
|
||||
|
||||
// TODO: Returns an empty slice which will make parameter changes a no-op during
|
||||
// simulations. Once all modules are migrated, remove RandomizedParams from
|
||||
// the simulation interface.
|
||||
func (AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange {
|
||||
return []simtypes.ParamChange{}
|
||||
}
|
||||
|
||||
// RegisterStoreDecoder registers a decoder for supply module's types
|
||||
@ -215,11 +228,15 @@ func provideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
type bankInputs struct {
|
||||
depinject.In
|
||||
|
||||
Config *modulev1.Module
|
||||
Config *modulev1.Module
|
||||
Cdc codec.Codec
|
||||
Key *store.KVStoreKey
|
||||
|
||||
AccountKeeper types.AccountKeeper
|
||||
Cdc codec.Codec
|
||||
Subspace paramtypes.Subspace
|
||||
Key *store.KVStoreKey
|
||||
Authority types.BankAuthority `optional:"true"`
|
||||
|
||||
// LegacySubspace is used solely for migration of x/params managed parameters
|
||||
LegacySubspace exported.Subspace
|
||||
}
|
||||
|
||||
type bankOutputs struct {
|
||||
@ -246,7 +263,20 @@ func provideModule(in bankInputs) bankOutputs {
|
||||
}
|
||||
}
|
||||
|
||||
bankKeeper := keeper.NewBaseKeeper(in.Cdc, in.Key, in.AccountKeeper, in.Subspace, blockedAddresses)
|
||||
m := NewAppModule(in.Cdc, bankKeeper, in.AccountKeeper)
|
||||
authority := in.Authority
|
||||
if authority == nil || len(authority) == 0 {
|
||||
// default to governance authority if not provided
|
||||
authority = types.BankAuthority(authtypes.NewModuleAddress(govtypes.ModuleName))
|
||||
}
|
||||
|
||||
bankKeeper := keeper.NewBaseKeeper(
|
||||
in.Cdc,
|
||||
in.Key,
|
||||
in.AccountKeeper,
|
||||
blockedAddresses,
|
||||
authority.String(),
|
||||
)
|
||||
m := NewAppModule(in.Cdc, bankKeeper, in.AccountKeeper, in.LegacySubspace)
|
||||
|
||||
return bankOutputs{BankKeeper: bankKeeper, Module: runtime.WrapAppModule(m)}
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ type Keeper interface {
|
||||
DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) error
|
||||
UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) error
|
||||
|
||||
// GetAuthority Gets the address capable of executing governance proposal messages. Usually the gov module account.
|
||||
// GetAuthority gets the address capable of executing governance proposal messages. Usually the gov module account.
|
||||
GetAuthority() string
|
||||
|
||||
types.QueryServer
|
||||
@ -108,7 +108,7 @@ type SendKeeper interface {
|
||||
SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
|
||||
|
||||
GetParams(ctx sdk.Context) types.Params
|
||||
SetParams(ctx sdk.Context, params types.Params)
|
||||
SetParams(ctx sdk.Context, params types.Params) error
|
||||
|
||||
IsSendEnabledDenom(ctx sdk.Context, denom string) bool
|
||||
SetSendEnabled(ctx sdk.Context, denom string, value bool)
|
||||
|
||||
@ -26,3 +26,13 @@ The message will fail under the following conditions:
|
||||
* Any of the `to` addresses are restricted
|
||||
* Any of the coins are locked
|
||||
* The inputs and outputs do not correctly correspond to one another
|
||||
|
||||
## MsgUpdateParams
|
||||
|
||||
The `bank` module params can be updated through `MsgUpdateParams`, which can be done using governance proposal. The signer will always be the `gov` module account address.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/e167855c9b99c4e58c1455533c6f88af5ff78ae1/proto/cosmos/bank/v1beta1/tx.proto#L56-L69
|
||||
|
||||
The message handling can fail if:
|
||||
|
||||
* signer is not the gov module account address.
|
||||
|
||||
11
x/bank/types/authority.go
Normal file
11
x/bank/types/authority.go
Normal file
@ -0,0 +1,11 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
type BankAuthority sdk.AccAddress
|
||||
|
||||
func (a BankAuthority) String() string {
|
||||
return sdk.AccAddress(a).String()
|
||||
}
|
||||
@ -460,48 +460,47 @@ func init() {
|
||||
func init() { proto.RegisterFile("cosmos/bank/v1beta1/bank.proto", fileDescriptor_dd052eee12edf988) }
|
||||
|
||||
var fileDescriptor_dd052eee12edf988 = []byte{
|
||||
// 655 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0x31, 0x6f, 0x13, 0x49,
|
||||
0x14, 0xf6, 0xd8, 0xb1, 0xbd, 0x19, 0xdf, 0x35, 0x73, 0xd6, 0xdd, 0x24, 0xc5, 0xda, 0xda, 0xe2,
|
||||
0x64, 0x22, 0xc5, 0x76, 0x02, 0x95, 0x85, 0x84, 0x70, 0x40, 0xc1, 0x48, 0x08, 0xb4, 0x51, 0x84,
|
||||
0x44, 0x63, 0x8d, 0xbd, 0x83, 0x3d, 0xca, 0xee, 0xcc, 0x6a, 0x67, 0x36, 0x8a, 0x5b, 0x2a, 0xa0,
|
||||
0xa2, 0xa4, 0x4c, 0x0b, 0x15, 0x45, 0x24, 0xfe, 0x42, 0x44, 0x15, 0x51, 0x51, 0x05, 0xe4, 0x14,
|
||||
0xf0, 0x33, 0xd0, 0xcc, 0xec, 0x3a, 0x89, 0x14, 0x10, 0x05, 0x05, 0xd5, 0xbe, 0xf7, 0xbe, 0x37,
|
||||
0xdf, 0xfb, 0xfc, 0xe6, 0x1b, 0x43, 0x77, 0x2c, 0x64, 0x24, 0x64, 0x67, 0x44, 0xf8, 0x5e, 0x67,
|
||||
0x7f, 0x63, 0x44, 0x15, 0xd9, 0x30, 0x49, 0x3b, 0x4e, 0x84, 0x12, 0xe8, 0x1f, 0x8b, 0xb7, 0x4d,
|
||||
0x29, 0xc3, 0x57, 0xeb, 0x13, 0x31, 0x11, 0x06, 0xef, 0xe8, 0xc8, 0xb6, 0xae, 0xae, 0xd8, 0xd6,
|
||||
0xa1, 0x05, 0xb2, 0x73, 0x16, 0x3a, 0x9f, 0x22, 0xe9, 0x62, 0xca, 0x58, 0x30, 0x9e, 0xe1, 0xff,
|
||||
0x65, 0x78, 0x24, 0x27, 0x9d, 0xfd, 0x0d, 0xfd, 0xb1, 0x80, 0xf7, 0x02, 0xc0, 0xca, 0x23, 0x92,
|
||||
0x90, 0x48, 0xa2, 0x6d, 0xf8, 0x97, 0xa4, 0x3c, 0x18, 0x52, 0x4e, 0x46, 0x21, 0x0d, 0x30, 0x68,
|
||||
0x96, 0x5a, 0xb5, 0xcd, 0x66, 0xfb, 0x0a, 0x81, 0xed, 0x1d, 0xca, 0x83, 0xbb, 0xb6, 0xaf, 0x5f,
|
||||
0xc4, 0xc0, 0xaf, 0xc9, 0xf3, 0x02, 0xea, 0xc2, 0x7a, 0x40, 0x9f, 0x92, 0x34, 0x54, 0xc3, 0x4b,
|
||||
0x84, 0xc5, 0x26, 0x68, 0x39, 0x3e, 0xca, 0xb0, 0x0b, 0x14, 0xbd, 0xa5, 0xd7, 0x87, 0x8d, 0x82,
|
||||
0xb7, 0x0d, 0x6b, 0x17, 0x8a, 0xa8, 0x0e, 0xcb, 0x01, 0xe5, 0x22, 0xc2, 0xa0, 0x09, 0x5a, 0xcb,
|
||||
0xbe, 0x4d, 0x10, 0x86, 0xd5, 0xcb, 0x7c, 0x79, 0xda, 0x73, 0x34, 0xc9, 0xb7, 0xc3, 0x06, 0xf0,
|
||||
0x8e, 0x00, 0x2c, 0x0f, 0x78, 0x9c, 0x2a, 0xb4, 0x09, 0xab, 0x24, 0x08, 0x12, 0x2a, 0xa5, 0x65,
|
||||
0xe9, 0xe3, 0x8f, 0x47, 0xeb, 0xf5, 0xec, 0x17, 0xdd, 0xb6, 0xc8, 0x8e, 0x4a, 0x18, 0x9f, 0xf8,
|
||||
0x79, 0x23, 0x22, 0xb0, 0xac, 0x37, 0x27, 0x71, 0xd1, 0x2c, 0x60, 0xe5, 0x7c, 0x01, 0x92, 0x2e,
|
||||
0x16, 0xb0, 0x25, 0x18, 0xef, 0x77, 0x8f, 0x4f, 0x1b, 0x85, 0xb7, 0x9f, 0x1b, 0xad, 0x09, 0x53,
|
||||
0xd3, 0x74, 0xd4, 0x1e, 0x8b, 0x28, 0xbb, 0x96, 0xec, 0xb3, 0x2e, 0x83, 0xbd, 0x8e, 0x9a, 0xc5,
|
||||
0x54, 0x9a, 0x03, 0xd2, 0xb7, 0xcc, 0xbd, 0xfa, 0x73, 0x2b, 0xb5, 0xf0, 0xec, 0xeb, 0xbb, 0xb5,
|
||||
0x7c, 0xb0, 0xf7, 0x06, 0xc0, 0xca, 0xc3, 0x54, 0xfd, 0xc1, 0xba, 0x9d, 0x5c, 0xb7, 0xf7, 0x1e,
|
||||
0xc0, 0xca, 0x4e, 0x1a, 0xc7, 0xe1, 0x4c, 0xcf, 0x55, 0x42, 0x91, 0x30, 0x33, 0xcc, 0xef, 0x9d,
|
||||
0x6b, 0x98, 0x7b, 0xf7, 0xb3, 0xb9, 0xe0, 0xc3, 0xd1, 0xfa, 0xcd, 0xb5, 0x9f, 0x9e, 0x3e, 0xb0,
|
||||
0x2f, 0x2d, 0x62, 0x93, 0x84, 0x28, 0x26, 0xb8, 0xec, 0xec, 0x77, 0x6f, 0x74, 0xdb, 0x56, 0xeb,
|
||||
0x00, 0x03, 0xef, 0x31, 0x5c, 0xbe, 0xa3, 0x9d, 0xb4, 0xcb, 0x99, 0xfa, 0x81, 0xc7, 0x56, 0xa1,
|
||||
0x43, 0x0f, 0x62, 0xc1, 0x29, 0x57, 0xc6, 0x64, 0x7f, 0xfb, 0x8b, 0x5c, 0xfb, 0x8f, 0x84, 0x8c,
|
||||
0x48, 0x2a, 0x71, 0xa9, 0x59, 0x6a, 0x2d, 0xfb, 0x79, 0xea, 0xbd, 0x2c, 0x42, 0xe7, 0x01, 0x55,
|
||||
0x24, 0x20, 0x8a, 0xa0, 0x26, 0xac, 0x05, 0x54, 0x8e, 0x13, 0x16, 0x6b, 0x11, 0x19, 0xfd, 0xc5,
|
||||
0x12, 0xba, 0xa5, 0x3b, 0xb8, 0x88, 0x86, 0x29, 0x67, 0x2a, 0xbf, 0x34, 0xf7, 0xca, 0xd7, 0xb6,
|
||||
0xd0, 0xeb, 0xc3, 0x20, 0x0f, 0x25, 0x42, 0x70, 0x49, 0xaf, 0x18, 0x97, 0x0c, 0xb7, 0x89, 0xb5,
|
||||
0xba, 0x80, 0xc9, 0x38, 0x24, 0x33, 0xbc, 0x64, 0xca, 0x79, 0xaa, 0xbb, 0x39, 0x89, 0x28, 0x2e,
|
||||
0xdb, 0x6e, 0x1d, 0xa3, 0x7f, 0x61, 0x45, 0xce, 0xa2, 0x91, 0x08, 0x71, 0xc5, 0x54, 0xb3, 0x0c,
|
||||
0xad, 0xc0, 0x52, 0x9a, 0x30, 0x5c, 0x35, 0xce, 0xab, 0xce, 0x4f, 0x1b, 0xa5, 0x5d, 0x7f, 0xe0,
|
||||
0xeb, 0x1a, 0xfa, 0x1f, 0x3a, 0x69, 0xc2, 0x86, 0x53, 0x22, 0xa7, 0xd8, 0x31, 0x78, 0x6d, 0x7e,
|
||||
0xda, 0xa8, 0xee, 0xfa, 0x83, 0x7b, 0x44, 0x4e, 0xfd, 0x6a, 0x9a, 0x30, 0x1d, 0xf4, 0xb7, 0x8e,
|
||||
0xe7, 0x2e, 0x38, 0x99, 0xbb, 0xe0, 0xcb, 0xdc, 0x05, 0xaf, 0xce, 0xdc, 0xc2, 0xc9, 0x99, 0x5b,
|
||||
0xf8, 0x74, 0xe6, 0x16, 0x9e, 0x5c, 0xfb, 0x95, 0xeb, 0x33, 0x1e, 0x18, 0x55, 0xcc, 0x7f, 0xd4,
|
||||
0xf5, 0xef, 0x01, 0x00, 0x00, 0xff, 0xff, 0xec, 0xf7, 0xce, 0x43, 0x44, 0x05, 0x00, 0x00,
|
||||
// 633 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xb1, 0x6f, 0x13, 0x3f,
|
||||
0x14, 0x8e, 0x93, 0x26, 0x77, 0x75, 0x7e, 0xbf, 0xc5, 0x04, 0x70, 0x3b, 0x5c, 0xa2, 0x1b, 0x50,
|
||||
0x40, 0x6a, 0xd2, 0x96, 0x2d, 0x0b, 0x22, 0x05, 0x95, 0x0c, 0x08, 0x74, 0x55, 0x85, 0xc4, 0x12,
|
||||
0x39, 0x39, 0x93, 0x58, 0xbd, 0xb3, 0x4f, 0x67, 0x5f, 0xd5, 0xac, 0x9d, 0x80, 0x89, 0x91, 0xb1,
|
||||
0x2b, 0x4c, 0x0c, 0xfd, 0x23, 0x2a, 0xa6, 0x8a, 0x89, 0xa9, 0xa0, 0x74, 0x80, 0x3f, 0x03, 0xd9,
|
||||
0xbe, 0x4b, 0x5b, 0xa9, 0x30, 0x31, 0x30, 0xdd, 0x7b, 0xef, 0xfb, 0xfc, 0x7d, 0x2f, 0xcf, 0x2f,
|
||||
0x86, 0xde, 0x58, 0xc8, 0x58, 0xc8, 0xee, 0x88, 0xf0, 0xbd, 0xee, 0xfe, 0xc6, 0x88, 0x2a, 0xb2,
|
||||
0x61, 0x92, 0x4e, 0x92, 0x0a, 0x25, 0xd0, 0x0d, 0x8b, 0x77, 0x4c, 0x29, 0xc7, 0x57, 0x1b, 0x13,
|
||||
0x31, 0x11, 0x06, 0xef, 0xea, 0xc8, 0x52, 0x57, 0x57, 0x2c, 0x75, 0x68, 0x81, 0xfc, 0x9c, 0x85,
|
||||
0x2e, 0x5c, 0x24, 0x5d, 0xb8, 0x8c, 0x05, 0xe3, 0x39, 0x7e, 0x3b, 0xc7, 0x63, 0x39, 0xe9, 0xee,
|
||||
0x6f, 0xe8, 0x8f, 0x05, 0xfc, 0x37, 0x00, 0xd6, 0x9e, 0x93, 0x94, 0xc4, 0x12, 0x6d, 0xc3, 0xff,
|
||||
0x24, 0xe5, 0xe1, 0x90, 0x72, 0x32, 0x8a, 0x68, 0x88, 0x41, 0xab, 0xd2, 0xae, 0x6f, 0xb6, 0x3a,
|
||||
0xd7, 0x34, 0xd8, 0xd9, 0xa1, 0x3c, 0x7c, 0x6c, 0x79, 0xfd, 0x32, 0x06, 0x41, 0x5d, 0x5e, 0x14,
|
||||
0xd0, 0x3a, 0x6c, 0x84, 0xf4, 0x15, 0xc9, 0x22, 0x35, 0xbc, 0x22, 0x58, 0x6e, 0x81, 0xb6, 0x1b,
|
||||
0xa0, 0x1c, 0xbb, 0x24, 0xd1, 0x5b, 0x7a, 0x7f, 0xd4, 0x2c, 0xf9, 0xdb, 0xb0, 0x7e, 0xa9, 0x88,
|
||||
0x1a, 0xb0, 0x1a, 0x52, 0x2e, 0x62, 0x0c, 0x5a, 0xa0, 0xbd, 0x1c, 0xd8, 0x04, 0x61, 0xe8, 0x5c,
|
||||
0xd5, 0x2b, 0xd2, 0x9e, 0xab, 0x45, 0x7e, 0x1e, 0x35, 0x81, 0x7f, 0x0c, 0x60, 0x75, 0xc0, 0x93,
|
||||
0x4c, 0xa1, 0x4d, 0xe8, 0x90, 0x30, 0x4c, 0xa9, 0x94, 0x56, 0xa5, 0x8f, 0xbf, 0x1c, 0xaf, 0x35,
|
||||
0xf2, 0x5f, 0xf4, 0xd0, 0x22, 0x3b, 0x2a, 0x65, 0x7c, 0x12, 0x14, 0x44, 0x44, 0x60, 0x55, 0x4f,
|
||||
0x4e, 0xe2, 0xb2, 0x19, 0xc0, 0xca, 0xc5, 0x00, 0x24, 0x5d, 0x0c, 0x60, 0x4b, 0x30, 0xde, 0x5f,
|
||||
0x3f, 0x39, 0x6b, 0x96, 0x3e, 0x7e, 0x6b, 0xb6, 0x27, 0x4c, 0x4d, 0xb3, 0x51, 0x67, 0x2c, 0xe2,
|
||||
0xfc, 0x5a, 0xf2, 0xcf, 0x9a, 0x0c, 0xf7, 0xba, 0x6a, 0x96, 0x50, 0x69, 0x0e, 0xc8, 0xc0, 0x2a,
|
||||
0xf7, 0x1a, 0xaf, 0x6d, 0xab, 0xa5, 0xc3, 0x1f, 0x9f, 0xee, 0x15, 0xc6, 0xfe, 0x07, 0x00, 0x6b,
|
||||
0xcf, 0x32, 0xf5, 0x0f, 0xf7, 0xed, 0x16, 0x7d, 0xfb, 0x87, 0x00, 0xd6, 0x76, 0xb2, 0x24, 0x89,
|
||||
0x66, 0xda, 0x57, 0x09, 0x45, 0xa2, 0x7c, 0x61, 0xfe, 0xae, 0xaf, 0x51, 0xee, 0xdd, 0xcc, 0x7d,
|
||||
0xc1, 0xe7, 0xe3, 0x35, 0xc7, 0xda, 0x0e, 0x30, 0xf0, 0x5f, 0xc0, 0xe5, 0x47, 0x7a, 0x29, 0x76,
|
||||
0x39, 0x53, 0xbf, 0x59, 0x97, 0x55, 0xe8, 0xd2, 0x83, 0x44, 0x70, 0xca, 0x95, 0xd9, 0x97, 0xff,
|
||||
0x83, 0x45, 0xae, 0x57, 0x89, 0x44, 0x8c, 0x48, 0x2a, 0x71, 0xa5, 0x55, 0x69, 0x2f, 0x07, 0x45,
|
||||
0xea, 0xbf, 0x2d, 0x43, 0xf7, 0x29, 0x55, 0x24, 0x24, 0x8a, 0xa0, 0x16, 0xac, 0x87, 0x54, 0x8e,
|
||||
0x53, 0x96, 0x28, 0x26, 0x78, 0x2e, 0x7f, 0xb9, 0x84, 0x1e, 0x68, 0x06, 0x17, 0xf1, 0x30, 0xe3,
|
||||
0x4c, 0x15, 0xf3, 0xf7, 0xae, 0xfd, 0xe3, 0x2c, 0xfa, 0x0d, 0x60, 0x58, 0x84, 0x12, 0x21, 0xb8,
|
||||
0xa4, 0xa7, 0x85, 0x2b, 0x46, 0xdb, 0xc4, 0xba, 0xbb, 0x90, 0xc9, 0x24, 0x22, 0x33, 0xbc, 0x64,
|
||||
0xca, 0x45, 0xaa, 0xd9, 0x9c, 0xc4, 0x14, 0x57, 0x2d, 0x5b, 0xc7, 0xe8, 0x16, 0xac, 0xc9, 0x59,
|
||||
0x3c, 0x12, 0x11, 0xae, 0x99, 0x6a, 0x9e, 0xa1, 0x15, 0x58, 0xc9, 0x52, 0x86, 0x1d, 0xb3, 0x44,
|
||||
0xce, 0xfc, 0xac, 0x59, 0xd9, 0x0d, 0x06, 0x81, 0xae, 0xa1, 0x3b, 0xd0, 0xcd, 0x52, 0x36, 0x9c,
|
||||
0x12, 0x39, 0xc5, 0xae, 0xc1, 0xeb, 0xf3, 0xb3, 0xa6, 0xb3, 0x1b, 0x0c, 0x9e, 0x10, 0x39, 0x0d,
|
||||
0x9c, 0x2c, 0x65, 0x3a, 0xe8, 0x6f, 0x9d, 0xcc, 0x3d, 0x70, 0x3a, 0xf7, 0xc0, 0xf7, 0xb9, 0x07,
|
||||
0xde, 0x9d, 0x7b, 0xa5, 0xd3, 0x73, 0xaf, 0xf4, 0xf5, 0xdc, 0x2b, 0xbd, 0xbc, 0xfb, 0xc7, 0x7b,
|
||||
0x3c, 0xb0, 0x6f, 0x9e, 0xb9, 0xce, 0x51, 0xcd, 0x3c, 0x37, 0xf7, 0x7f, 0x05, 0x00, 0x00, 0xff,
|
||||
0xff, 0xea, 0x9e, 0xe2, 0x05, 0x0f, 0x05, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *SendEnabled) Equal(that interface{}) bool {
|
||||
|
||||
@ -16,13 +16,17 @@ import (
|
||||
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
||||
legacy.RegisterAminoMsg(cdc, &MsgSend{}, "cosmos-sdk/MsgSend")
|
||||
legacy.RegisterAminoMsg(cdc, &MsgMultiSend{}, "cosmos-sdk/MsgMultiSend")
|
||||
legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/bank/MsgUpdateParams")
|
||||
|
||||
cdc.RegisterConcrete(&SendAuthorization{}, "cosmos-sdk/SendAuthorization", nil)
|
||||
cdc.RegisterConcrete(&Params{}, "cosmos-sdk/x/bank/Params", nil)
|
||||
}
|
||||
|
||||
func RegisterInterfaces(registry types.InterfaceRegistry) {
|
||||
registry.RegisterImplementations((*sdk.Msg)(nil),
|
||||
&MsgSend{},
|
||||
&MsgMultiSend{},
|
||||
&MsgUpdateParams{},
|
||||
)
|
||||
registry.RegisterImplementations(
|
||||
(*authz.Authorization)(nil),
|
||||
|
||||
@ -32,6 +32,9 @@ var (
|
||||
|
||||
// SendEnabledPrefix is the prefix for the SendDisabled flags for a Denom.
|
||||
SendEnabledPrefix = []byte{0x04}
|
||||
|
||||
// ParamsKey is the prefix for x/bank parameters
|
||||
ParamsKey = []byte{0x05}
|
||||
)
|
||||
|
||||
const (
|
||||
@ -10,9 +10,14 @@ const (
|
||||
TypeMsgSend = "send"
|
||||
TypeMsgMultiSend = "multisend"
|
||||
TypeMsgSetSendEnabled = "set-send-enabled"
|
||||
TypeMsgUpdateParams = "update_params"
|
||||
)
|
||||
|
||||
var _ sdk.Msg = &MsgSend{}
|
||||
var (
|
||||
_ sdk.Msg = &MsgSend{}
|
||||
_ sdk.Msg = &MsgMultiSend{}
|
||||
_ sdk.Msg = &MsgUpdateParams{}
|
||||
)
|
||||
|
||||
// NewMsgSend - construct a msg to send coins from one account to another.
|
||||
//nolint:interfacer
|
||||
@ -58,8 +63,6 @@ func (msg MsgSend) GetSigners() []sdk.AccAddress {
|
||||
return []sdk.AccAddress{fromAddress}
|
||||
}
|
||||
|
||||
var _ sdk.Msg = &MsgMultiSend{}
|
||||
|
||||
// NewMsgMultiSend - construct arbitrary multi-in, multi-out send msg.
|
||||
func NewMsgMultiSend(in Input, out []Output) *MsgMultiSend {
|
||||
return &MsgMultiSend{Input: in, Outputs: out}
|
||||
@ -73,7 +76,7 @@ func (msg MsgMultiSend) Type() string { return TypeMsgMultiSend }
|
||||
|
||||
// ValidateBasic Implements Msg.
|
||||
func (msg MsgMultiSend) ValidateBasic() error {
|
||||
// this just makes sure all the inputs and outputs are properly formatted,
|
||||
// this just makes sure the input and all the outputs are properly formatted,
|
||||
// not that they actually have the money inside
|
||||
|
||||
if err := msg.Input.ValidateBasic(); err != nil {
|
||||
@ -176,3 +179,22 @@ func ValidateInputsOutputs(input Input, outputs []Output) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSigners returns the signer addresses that are expected to sign the result
|
||||
// of GetSignBytes.
|
||||
func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress {
|
||||
authority, _ := sdk.AccAddressFromBech32(msg.Authority)
|
||||
return []sdk.AccAddress{authority}
|
||||
}
|
||||
|
||||
// GetSignBytes returns the raw bytes for a MsgUpdateParams message that
|
||||
// the expected signer needs to sign.
|
||||
func (msg MsgUpdateParams) GetSignBytes() []byte {
|
||||
bz := ModuleCdc.MustMarshalJSON(&msg)
|
||||
return sdk.MustSortJSON(bz)
|
||||
}
|
||||
|
||||
// ValidateBasic performs basic MsgUpdateParams message validation.
|
||||
func (msg MsgUpdateParams) ValidateBasic() error {
|
||||
return msg.Params.Validate()
|
||||
}
|
||||
|
||||
@ -7,25 +7,11 @@ import (
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
)
|
||||
|
||||
// DefaultDefaultSendEnabled is the value that DefaultSendEnabled will have from DefaultParams().
|
||||
var DefaultDefaultSendEnabled = true
|
||||
|
||||
var (
|
||||
// KeySendEnabled is store's key for SendEnabled Params
|
||||
// Deprecated: Use the SendEnabled functionality in the keeper.
|
||||
KeySendEnabled = []byte("SendEnabled")
|
||||
// KeyDefaultSendEnabled is store's key for the DefaultSendEnabled option
|
||||
KeyDefaultSendEnabled = []byte("DefaultSendEnabled")
|
||||
)
|
||||
|
||||
// ParamKeyTable for bank module.
|
||||
func ParamKeyTable() paramtypes.KeyTable {
|
||||
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
|
||||
}
|
||||
|
||||
// NewParams creates a new parameter configuration for the bank module
|
||||
func NewParams(defaultSendEnabled bool) Params {
|
||||
return Params{
|
||||
@ -60,14 +46,6 @@ func (p Params) String() string {
|
||||
return fmt.Sprintf("default_send_enabled: %t\nsend_enabled:%s%s", p.DefaultSendEnabled, d, sendEnabled)
|
||||
}
|
||||
|
||||
// ParamSetPairs implements params.ParamSet
|
||||
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
|
||||
return paramtypes.ParamSetPairs{
|
||||
paramtypes.NewParamSetPair(KeySendEnabled, &p.SendEnabled, validateSendEnabledParams),
|
||||
paramtypes.NewParamSetPair(KeyDefaultSendEnabled, &p.DefaultSendEnabled, validateIsBool),
|
||||
}
|
||||
}
|
||||
|
||||
// Validate gets any errors with this SendEnabled entry.
|
||||
func (se SendEnabled) Validate() error {
|
||||
return sdk.ValidateDenom(se.Denom)
|
||||
|
||||
23
x/bank/types/params_legacy.go
Normal file
23
x/bank/types/params_legacy.go
Normal file
@ -0,0 +1,23 @@
|
||||
package types
|
||||
|
||||
import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
|
||||
var (
|
||||
// KeySendEnabled is store's key for SendEnabled Params
|
||||
// DEPRECATED: Use the SendEnabled functionality in the keeper.
|
||||
KeySendEnabled = []byte("SendEnabled")
|
||||
// KeyDefaultSendEnabled is store's key for the DefaultSendEnabled option
|
||||
KeyDefaultSendEnabled = []byte("DefaultSendEnabled")
|
||||
)
|
||||
|
||||
// DEPRECATED: ParamKeyTable for bank module.
|
||||
func ParamKeyTable() paramtypes.KeyTable {
|
||||
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
|
||||
}
|
||||
|
||||
// DEPRECATED: ParamSetPairs implements params.ParamSet
|
||||
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
|
||||
return paramtypes.ParamSetPairs{
|
||||
paramtypes.NewParamSetPair(KeyDefaultSendEnabled, &p.DefaultSendEnabled, validateIsBool),
|
||||
}
|
||||
}
|
||||
@ -199,46 +199,152 @@ func (m *MsgMultiSendResponse) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_MsgMultiSendResponse proto.InternalMessageInfo
|
||||
|
||||
// MsgUpdateParams is the Msg/UpdateParams request type.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
type MsgUpdateParams struct {
|
||||
// authority is the address of the governance account.
|
||||
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
|
||||
// params defines the x/bank parameters to update.
|
||||
//
|
||||
// NOTE: All parameters must be supplied.
|
||||
Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
|
||||
}
|
||||
|
||||
func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} }
|
||||
func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgUpdateParams) ProtoMessage() {}
|
||||
func (*MsgUpdateParams) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_1d8cb1613481f5b7, []int{4}
|
||||
}
|
||||
func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *MsgUpdateParams) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgUpdateParams.Merge(m, src)
|
||||
}
|
||||
func (m *MsgUpdateParams) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgUpdateParams) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgUpdateParams) GetAuthority() string {
|
||||
if m != nil {
|
||||
return m.Authority
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgUpdateParams) GetParams() Params {
|
||||
if m != nil {
|
||||
return m.Params
|
||||
}
|
||||
return Params{}
|
||||
}
|
||||
|
||||
// MsgUpdateParamsResponse defines the response structure for executing a
|
||||
// MsgUpdateParams message.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
type MsgUpdateParamsResponse struct {
|
||||
}
|
||||
|
||||
func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} }
|
||||
func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgUpdateParamsResponse) ProtoMessage() {}
|
||||
func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_1d8cb1613481f5b7, []int{5}
|
||||
}
|
||||
func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src)
|
||||
}
|
||||
func (m *MsgUpdateParamsResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MsgSend)(nil), "cosmos.bank.v1beta1.MsgSend")
|
||||
proto.RegisterType((*MsgSendResponse)(nil), "cosmos.bank.v1beta1.MsgSendResponse")
|
||||
proto.RegisterType((*MsgMultiSend)(nil), "cosmos.bank.v1beta1.MsgMultiSend")
|
||||
proto.RegisterType((*MsgMultiSendResponse)(nil), "cosmos.bank.v1beta1.MsgMultiSendResponse")
|
||||
proto.RegisterType((*MsgUpdateParams)(nil), "cosmos.bank.v1beta1.MsgUpdateParams")
|
||||
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmos.bank.v1beta1.MsgUpdateParamsResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("cosmos/bank/v1beta1/tx.proto", fileDescriptor_1d8cb1613481f5b7) }
|
||||
|
||||
var fileDescriptor_1d8cb1613481f5b7 = []byte{
|
||||
// 464 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x4d, 0x6b, 0xd4, 0x40,
|
||||
0x1c, 0xc6, 0x33, 0x6e, 0x6d, 0xd9, 0xd9, 0xa2, 0x18, 0x17, 0xdd, 0x8d, 0x25, 0x5b, 0x83, 0x87,
|
||||
0xad, 0xd0, 0x89, 0xbb, 0x82, 0x42, 0x7b, 0x32, 0x3d, 0x29, 0x04, 0x21, 0x3d, 0xe9, 0xa5, 0xe4,
|
||||
0x65, 0x1c, 0x43, 0xcd, 0x4c, 0xc8, 0x4c, 0x4a, 0xbd, 0x7a, 0xf2, 0x28, 0xf8, 0x05, 0x7a, 0x16,
|
||||
0x0f, 0x1e, 0xfc, 0x10, 0x3d, 0x16, 0x4f, 0x9e, 0x54, 0x76, 0x0f, 0xfa, 0x2d, 0x94, 0x79, 0x49,
|
||||
0xac, 0xb8, 0x6d, 0x4f, 0x13, 0xf2, 0x7b, 0x9e, 0x67, 0xfe, 0x2f, 0x03, 0xd7, 0x52, 0xc6, 0x0b,
|
||||
0xc6, 0xfd, 0x24, 0xa6, 0xfb, 0xfe, 0xc1, 0x24, 0xc1, 0x22, 0x9e, 0xf8, 0xe2, 0x10, 0x95, 0x15,
|
||||
0x13, 0xcc, 0xbe, 0xae, 0x29, 0x92, 0x14, 0x19, 0xea, 0xf4, 0x09, 0x23, 0x4c, 0x71, 0x5f, 0x7e,
|
||||
0x69, 0xa9, 0xe3, 0xb6, 0x41, 0x1c, 0xb7, 0x41, 0x29, 0xcb, 0xe9, 0x7f, 0xfc, 0xd4, 0x45, 0x2a,
|
||||
0x57, 0xf3, 0xa1, 0xe6, 0x7b, 0x3a, 0xd8, 0xdc, 0xab, 0xd1, 0x4d, 0x63, 0x2d, 0x38, 0xf1, 0x0f,
|
||||
0x26, 0xf2, 0xd0, 0xc0, 0xfb, 0x0d, 0xe0, 0x4a, 0xc8, 0xc9, 0x2e, 0xa6, 0x99, 0xbd, 0x0d, 0x57,
|
||||
0x5f, 0x54, 0xac, 0xd8, 0x8b, 0xb3, 0xac, 0xc2, 0x9c, 0x0f, 0xc0, 0x3a, 0x18, 0x77, 0x83, 0xc1,
|
||||
0x97, 0xcf, 0x9b, 0x7d, 0x13, 0xf6, 0x48, 0x93, 0x5d, 0x51, 0xe5, 0x94, 0x44, 0x3d, 0xa9, 0x36,
|
||||
0xbf, 0xec, 0x87, 0x10, 0x0a, 0xd6, 0x5a, 0x2f, 0x5d, 0x60, 0xed, 0x0a, 0xd6, 0x18, 0x53, 0xb8,
|
||||
0x1c, 0x17, 0xac, 0xa6, 0x62, 0xd0, 0x59, 0xef, 0x8c, 0x7b, 0xd3, 0x21, 0x6a, 0x27, 0xc6, 0x71,
|
||||
0x33, 0x31, 0xb4, 0xc3, 0x72, 0x1a, 0xdc, 0x3b, 0xfe, 0x36, 0xb2, 0x3e, 0x7c, 0x1f, 0x8d, 0x49,
|
||||
0x2e, 0x5e, 0xd6, 0x09, 0x4a, 0x59, 0x61, 0xda, 0x34, 0xc7, 0x26, 0xcf, 0xf6, 0x7d, 0xf1, 0xba,
|
||||
0xc4, 0x5c, 0x19, 0x78, 0x64, 0xa2, 0xb7, 0x86, 0x6f, 0x8f, 0x46, 0xd6, 0xaf, 0xa3, 0x91, 0xf5,
|
||||
0xe6, 0xe7, 0xa7, 0xbb, 0xff, 0x74, 0xe9, 0x5d, 0x83, 0x57, 0xcd, 0x00, 0x22, 0xcc, 0x4b, 0x46,
|
||||
0x39, 0xf6, 0xde, 0x03, 0xb8, 0x1a, 0x72, 0x12, 0xd6, 0xaf, 0x44, 0xae, 0x26, 0xf3, 0x00, 0x5e,
|
||||
0xce, 0x69, 0x59, 0x0b, 0x35, 0x92, 0xde, 0xd4, 0x41, 0x0b, 0x96, 0x8a, 0x1e, 0x4b, 0x45, 0xb0,
|
||||
0x24, 0x6b, 0x8c, 0xb4, 0xdc, 0xde, 0x86, 0x2b, 0xac, 0x16, 0x65, 0x2d, 0xe4, 0x44, 0x64, 0x73,
|
||||
0xb7, 0x16, 0x3a, 0x9f, 0x2a, 0x8d, 0xb1, 0x36, 0x8e, 0xad, 0x2b, 0x4d, 0xbd, 0x3a, 0xcc, 0xbb,
|
||||
0x01, 0xfb, 0xa7, 0x8b, 0x6a, 0xaa, 0x9d, 0x7e, 0x04, 0xb0, 0x13, 0x72, 0x62, 0x3f, 0x81, 0x4b,
|
||||
0xaa, 0xd8, 0xb5, 0x85, 0x77, 0x98, 0x1e, 0x9d, 0x3b, 0xe7, 0xd1, 0x26, 0xd3, 0x7e, 0x06, 0xbb,
|
||||
0x7f, 0xbb, 0xbf, 0x7d, 0x96, 0xa5, 0x95, 0x38, 0x1b, 0x17, 0x4a, 0x9a, 0xe8, 0x60, 0xe7, 0x78,
|
||||
0xe6, 0x82, 0x93, 0x99, 0x0b, 0x7e, 0xcc, 0x5c, 0xf0, 0x6e, 0xee, 0x5a, 0x27, 0x73, 0xd7, 0xfa,
|
||||
0x3a, 0x77, 0xad, 0xe7, 0x1b, 0xe7, 0xae, 0xf5, 0x50, 0xbf, 0x7b, 0xb5, 0xdd, 0x64, 0x59, 0xbd,
|
||||
0xde, 0xfb, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x51, 0xb7, 0xdd, 0x56, 0x7c, 0x03, 0x00, 0x00,
|
||||
// 538 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xbd, 0x6e, 0xd3, 0x50,
|
||||
0x14, 0xb6, 0x9b, 0x92, 0x2a, 0x27, 0x51, 0x11, 0x26, 0xa2, 0x89, 0xa9, 0x9c, 0x62, 0x31, 0xa4,
|
||||
0x88, 0xda, 0x24, 0x48, 0x45, 0xa4, 0x13, 0xe9, 0x04, 0x52, 0x04, 0x4a, 0xc5, 0x00, 0x4b, 0x65,
|
||||
0xc7, 0x17, 0xd7, 0x2a, 0xf6, 0xb5, 0x7c, 0xaf, 0xab, 0x76, 0x65, 0x62, 0xac, 0x04, 0x0f, 0xd0,
|
||||
0x99, 0x89, 0x81, 0x87, 0xe8, 0x58, 0x31, 0x31, 0x01, 0x4a, 0x06, 0x78, 0x0b, 0xd0, 0xfd, 0xb1,
|
||||
0x93, 0x42, 0x7e, 0x3a, 0x39, 0xca, 0xf7, 0x73, 0xbe, 0xf3, 0x1d, 0x27, 0xb0, 0x3e, 0xc0, 0x24,
|
||||
0xc4, 0xc4, 0x76, 0x9d, 0xe8, 0xd0, 0x3e, 0x6a, 0xb9, 0x88, 0x3a, 0x2d, 0x9b, 0x1e, 0x5b, 0x71,
|
||||
0x82, 0x29, 0xd6, 0x6e, 0x0a, 0xd4, 0x62, 0xa8, 0x25, 0x51, 0xbd, 0xea, 0x63, 0x1f, 0x73, 0xdc,
|
||||
0x66, 0x9f, 0x04, 0x55, 0x37, 0x72, 0x23, 0x82, 0x72, 0xa3, 0x01, 0x0e, 0xa2, 0xff, 0xf0, 0x89,
|
||||
0x41, 0xdc, 0x57, 0xe0, 0x75, 0x81, 0xef, 0x0b, 0x63, 0x39, 0x57, 0x40, 0x6b, 0x52, 0x1a, 0x12,
|
||||
0xdf, 0x3e, 0x6a, 0xb1, 0x87, 0x00, 0xcc, 0x3f, 0x2a, 0xac, 0xf4, 0x88, 0xbf, 0x87, 0x22, 0x4f,
|
||||
0xdb, 0x81, 0xca, 0x9b, 0x04, 0x87, 0xfb, 0x8e, 0xe7, 0x25, 0x88, 0x90, 0x9a, 0xba, 0xa1, 0x36,
|
||||
0x4b, 0xdd, 0xda, 0xd7, 0x2f, 0x5b, 0x55, 0x69, 0xf6, 0x44, 0x20, 0x7b, 0x34, 0x09, 0x22, 0xbf,
|
||||
0x5f, 0x66, 0x6c, 0xf9, 0x95, 0xf6, 0x08, 0x80, 0xe2, 0x5c, 0xba, 0xb4, 0x40, 0x5a, 0xa2, 0x38,
|
||||
0x13, 0x0e, 0xa0, 0xe8, 0x84, 0x38, 0x8d, 0x68, 0xad, 0xb0, 0x51, 0x68, 0x96, 0xdb, 0x75, 0x2b,
|
||||
0x6f, 0x8c, 0xa0, 0xac, 0x31, 0x6b, 0x17, 0x07, 0x51, 0xf7, 0xc1, 0xf9, 0xf7, 0x86, 0xf2, 0xe9,
|
||||
0x47, 0xa3, 0xe9, 0x07, 0xf4, 0x20, 0x75, 0xad, 0x01, 0x0e, 0xe5, 0x9a, 0xf2, 0xb1, 0x45, 0xbc,
|
||||
0x43, 0x9b, 0x9e, 0xc4, 0x88, 0x70, 0x01, 0xe9, 0x4b, 0xeb, 0x4e, 0xfd, 0xfd, 0x59, 0x43, 0xf9,
|
||||
0x7d, 0xd6, 0x50, 0xde, 0xfd, 0xfa, 0x7c, 0xef, 0xd2, 0x96, 0xe6, 0x0d, 0xb8, 0x2e, 0x0b, 0xe8,
|
||||
0x23, 0x12, 0xe3, 0x88, 0x20, 0xf3, 0x83, 0x0a, 0x95, 0x1e, 0xf1, 0x7b, 0xe9, 0x5b, 0x1a, 0xf0,
|
||||
0x66, 0xb6, 0xe1, 0x5a, 0x10, 0xc5, 0x29, 0xe5, 0x95, 0x94, 0xdb, 0xba, 0x35, 0xe5, 0xa8, 0xd6,
|
||||
0x53, 0xc6, 0xe8, 0x2e, 0xb3, 0x8c, 0x7d, 0x41, 0xd7, 0x76, 0x60, 0x05, 0xa7, 0x34, 0x4e, 0x29,
|
||||
0x6b, 0x84, 0x2d, 0x77, 0x7b, 0xaa, 0xf2, 0x39, 0xe7, 0x48, 0x69, 0xa6, 0xe8, 0xac, 0x66, 0x79,
|
||||
0x85, 0x99, 0x79, 0x0b, 0xaa, 0x93, 0xa1, 0xf2, 0xb4, 0x1f, 0x55, 0xbe, 0xc1, 0xcb, 0xd8, 0x73,
|
||||
0x28, 0x7a, 0xe1, 0x24, 0x4e, 0x48, 0xb4, 0x6d, 0x28, 0x39, 0x29, 0x3d, 0xc0, 0x49, 0x40, 0x4f,
|
||||
0x16, 0xde, 0x71, 0x4c, 0xd5, 0x1e, 0x43, 0x31, 0xe6, 0x0e, 0xfc, 0x82, 0xb3, 0xf2, 0x8a, 0x21,
|
||||
0x32, 0xaf, 0x14, 0x74, 0x56, 0x59, 0xd4, 0xb1, 0x95, 0x59, 0x87, 0xb5, 0x7f, 0x52, 0x65, 0x89,
|
||||
0xdb, 0xa7, 0x4b, 0x50, 0xe8, 0x11, 0x5f, 0x7b, 0x06, 0xcb, 0xbc, 0xde, 0xf5, 0xa9, 0x53, 0xe4,
|
||||
0x55, 0xf4, 0xbb, 0xf3, 0xd0, 0xcc, 0x53, 0x7b, 0x05, 0xa5, 0xf1, 0xbd, 0xee, 0xcc, 0x92, 0xe4,
|
||||
0x14, 0x7d, 0x73, 0x21, 0x25, 0xb7, 0x76, 0xa1, 0x72, 0xa9, 0xdc, 0x99, 0x81, 0x26, 0x59, 0xfa,
|
||||
0xfd, 0xab, 0xb0, 0xb2, 0x19, 0xdd, 0xdd, 0xf3, 0xa1, 0xa1, 0x5e, 0x0c, 0x0d, 0xf5, 0xe7, 0xd0,
|
||||
0x50, 0x4f, 0x47, 0x86, 0x72, 0x31, 0x32, 0x94, 0x6f, 0x23, 0x43, 0x79, 0xbd, 0x39, 0xf7, 0x65,
|
||||
0x3f, 0x16, 0xff, 0x06, 0xfc, 0x9d, 0x77, 0x8b, 0xfc, 0x37, 0xfd, 0xf0, 0x6f, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0x8a, 0x36, 0x66, 0x7a, 0x92, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -257,6 +363,11 @@ type MsgClient interface {
|
||||
Send(ctx context.Context, in *MsgSend, opts ...grpc.CallOption) (*MsgSendResponse, error)
|
||||
// MultiSend defines a method for sending coins from some accounts to other accounts.
|
||||
MultiSend(ctx context.Context, in *MsgMultiSend, opts ...grpc.CallOption) (*MsgMultiSendResponse, error)
|
||||
// UpdateParams defines a governance operation for updating the x/bank module parameters.
|
||||
// The authority is defined in the keeper.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
@ -285,12 +396,26 @@ func (c *msgClient) MultiSend(ctx context.Context, in *MsgMultiSend, opts ...grp
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
|
||||
out := new(MsgUpdateParamsResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Msg/UpdateParams", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
type MsgServer interface {
|
||||
// Send defines a method for sending coins from one account to another account.
|
||||
Send(context.Context, *MsgSend) (*MsgSendResponse, error)
|
||||
// MultiSend defines a method for sending coins from some accounts to other accounts.
|
||||
MultiSend(context.Context, *MsgMultiSend) (*MsgMultiSendResponse, error)
|
||||
// UpdateParams defines a governance operation for updating the x/bank module parameters.
|
||||
// The authority is defined in the keeper.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
|
||||
@ -303,6 +428,9 @@ func (*UnimplementedMsgServer) Send(ctx context.Context, req *MsgSend) (*MsgSend
|
||||
func (*UnimplementedMsgServer) MultiSend(ctx context.Context, req *MsgMultiSend) (*MsgMultiSendResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method MultiSend not implemented")
|
||||
}
|
||||
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
|
||||
}
|
||||
|
||||
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
|
||||
s.RegisterService(&_Msg_serviceDesc, srv)
|
||||
@ -344,6 +472,24 @@ func _Msg_MultiSend_Handler(srv interface{}, ctx context.Context, dec func(inter
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgUpdateParams)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).UpdateParams(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.bank.v1beta1.Msg/UpdateParams",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "cosmos.bank.v1beta1.Msg",
|
||||
HandlerType: (*MsgServer)(nil),
|
||||
@ -356,6 +502,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "MultiSend",
|
||||
Handler: _Msg_MultiSend_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateParams",
|
||||
Handler: _Msg_UpdateParams_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cosmos/bank/v1beta1/tx.proto",
|
||||
@ -505,6 +655,69 @@ func (m *MsgMultiSendResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
{
|
||||
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
if len(m.Authority) > 0 {
|
||||
i -= len(m.Authority)
|
||||
copy(dAtA[i:], m.Authority)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Authority)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovTx(v)
|
||||
base := offset
|
||||
@ -574,6 +787,30 @@ func (m *MsgMultiSendResponse) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgUpdateParams) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Authority)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = m.Params.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgUpdateParamsResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
return n
|
||||
}
|
||||
|
||||
func sovTx(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
@ -945,6 +1182,171 @@ func (m *MsgMultiSendResponse) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Authority = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTx(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTx(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipTx(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
||||
@ -28,10 +28,6 @@ type Keeper struct {
|
||||
feeCollectorName string // name of the FeeCollector ModuleAccount
|
||||
}
|
||||
|
||||
func (k *Keeper) GetAuthority() string {
|
||||
return k.authority
|
||||
}
|
||||
|
||||
// NewKeeper creates a new Keeper object
|
||||
func NewKeeper(
|
||||
cdc codec.BinaryCodec, storeKey storetypes.StoreKey, invCheckPeriod uint,
|
||||
@ -48,6 +44,11 @@ func NewKeeper(
|
||||
}
|
||||
}
|
||||
|
||||
// GetAuthority returns the x/crisis module's authority.
|
||||
func (k *Keeper) GetAuthority() string {
|
||||
return k.authority
|
||||
}
|
||||
|
||||
// Logger returns a module-specific logger.
|
||||
func (k *Keeper) Logger(ctx sdk.Context) log.Logger {
|
||||
return ctx.Logger().With("module", "x/"+types.ModuleName)
|
||||
|
||||
@ -29,10 +29,9 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/crisis/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/crisis/types"
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
)
|
||||
|
||||
// ConsensusVersion defines the current x/params module consensus version.
|
||||
// ConsensusVersion defines the current x/crisis module consensus version.
|
||||
const ConsensusVersion = 2
|
||||
|
||||
var (
|
||||
@ -198,12 +197,15 @@ func init() {
|
||||
type crisisInputs struct {
|
||||
depinject.In
|
||||
|
||||
Config *modulev1.Module
|
||||
Key *store.KVStoreKey
|
||||
Cdc codec.Codec
|
||||
AppOpts servertypes.AppOptions `optional:"true"`
|
||||
Subspace paramstypes.Subspace
|
||||
Config *modulev1.Module
|
||||
Key *store.KVStoreKey
|
||||
Cdc codec.Codec
|
||||
AppOpts servertypes.AppOptions `optional:"true"`
|
||||
|
||||
BankKeeper types.SupplyKeeper
|
||||
|
||||
// LegacySubspace is used solely for migration of x/params managed parameters
|
||||
LegacySubspace exported.Subspace
|
||||
}
|
||||
|
||||
type crisisOutputs struct {
|
||||
@ -236,7 +238,7 @@ func provideModule(in crisisInputs) crisisOutputs {
|
||||
|
||||
skipGenesisInvariants := cast.ToBool(in.AppOpts.Get(FlagSkipGenesisInvariants))
|
||||
|
||||
m := NewAppModule(k, skipGenesisInvariants, in.Subspace)
|
||||
m := NewAppModule(k, skipGenesisInvariants, in.LegacySubspace)
|
||||
|
||||
return crisisOutputs{CrisisKeeper: k, Module: runtime.WrapAppModule(m)}
|
||||
}
|
||||
|
||||
@ -23,12 +23,12 @@ import (
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/distribution/client/cli"
|
||||
"github.com/cosmos/cosmos-sdk/x/distribution/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/distribution/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/distribution/simulation"
|
||||
"github.com/cosmos/cosmos-sdk/x/distribution/types"
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
|
||||
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
staking "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
)
|
||||
|
||||
@ -104,13 +104,13 @@ type AppModule struct {
|
||||
stakingKeeper types.StakingKeeper
|
||||
|
||||
// legacySubspace is used solely for migration of x/params managed parameters
|
||||
legacySubspace paramstypes.Subspace
|
||||
legacySubspace exported.Subspace
|
||||
}
|
||||
|
||||
// NewAppModule creates a new AppModule object
|
||||
func NewAppModule(
|
||||
cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper,
|
||||
bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper, ss paramstypes.Subspace,
|
||||
bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper, ss exported.Subspace,
|
||||
) AppModule {
|
||||
return AppModule{
|
||||
AppModuleBasic: AppModuleBasic{cdc: cdc},
|
||||
@ -246,7 +246,7 @@ type distrInputs struct {
|
||||
StakingKeeper types.StakingKeeper
|
||||
|
||||
// LegacySubspace is used solely for migration of x/params managed parameters
|
||||
LegacySubspace paramstypes.Subspace
|
||||
LegacySubspace exported.Subspace
|
||||
}
|
||||
|
||||
type distrOutputs struct {
|
||||
|
||||
@ -2,8 +2,8 @@ package v043
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
v042bank "github.com/cosmos/cosmos-sdk/x/bank/migrations/v042"
|
||||
v043bank "github.com/cosmos/cosmos-sdk/x/bank/migrations/v043"
|
||||
v1bank "github.com/cosmos/cosmos-sdk/x/bank/migrations/v1"
|
||||
v2bank "github.com/cosmos/cosmos-sdk/x/bank/migrations/v2"
|
||||
bank "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil/types"
|
||||
v042gov "github.com/cosmos/cosmos-sdk/x/gov/migrations/v042"
|
||||
@ -27,17 +27,17 @@ func Migrate(appState types.AppMap, clientCtx client.Context) types.AppMap {
|
||||
appState[v043gov.ModuleName] = clientCtx.Codec.MustMarshalJSON(v043gov.MigrateJSON(&oldGovState))
|
||||
}
|
||||
|
||||
if appState[v042bank.ModuleName] != nil {
|
||||
if appState[v1bank.ModuleName] != nil {
|
||||
// unmarshal relative source genesis application state
|
||||
var oldBankState bank.GenesisState
|
||||
clientCtx.Codec.MustUnmarshalJSON(appState[v042bank.ModuleName], &oldBankState)
|
||||
clientCtx.Codec.MustUnmarshalJSON(appState[v1bank.ModuleName], &oldBankState)
|
||||
|
||||
// delete deprecated x/bank genesis state
|
||||
delete(appState, v042bank.ModuleName)
|
||||
delete(appState, v1bank.ModuleName)
|
||||
|
||||
// Migrate relative source genesis application state and marshal it into
|
||||
// the respective key.
|
||||
appState[v043bank.ModuleName] = clientCtx.Codec.MustMarshalJSON(v043bank.MigrateJSON(&oldBankState))
|
||||
appState[v2bank.ModuleName] = clientCtx.Codec.MustMarshalJSON(v2bank.MigrateJSON(&oldBankState))
|
||||
}
|
||||
|
||||
return appState
|
||||
|
||||
@ -2,7 +2,7 @@ package v047
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
bankv047 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v047"
|
||||
bankv4 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v4"
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil/types"
|
||||
)
|
||||
@ -14,7 +14,7 @@ func Migrate(appState types.AppMap, clientCtx client.Context) types.AppMap {
|
||||
if len(bankState) > 0 {
|
||||
var oldBankState *banktypes.GenesisState
|
||||
clientCtx.Codec.MustUnmarshalJSON(bankState, oldBankState)
|
||||
newBankState := bankv047.MigrateGenState(oldBankState)
|
||||
newBankState := bankv4.MigrateGenState(oldBankState)
|
||||
appState[banktypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(newBankState)
|
||||
}
|
||||
return appState
|
||||
|
||||
Loading…
Reference in New Issue
Block a user