refactor: remove bytes/HexBytes (#15211)
Co-authored-by: chixiaowen <chixiaowen@zhigui.com>
This commit is contained in:
parent
23ef32a35c
commit
a49151d693
19
UPGRADING.md
19
UPGRADING.md
@ -7,7 +7,8 @@ This guide provides instructions for upgrading to specific versions of Cosmos SD
|
||||
### Migration to CometBFT (Part 2)
|
||||
|
||||
The Cosmos SDK has migrated in, its previous versions, to CometBFT.
|
||||
Some functions have been renamed to reflect the naming change.
|
||||
Some functions have been renamed to reflect the naming change. And the Cosmos SDK has removed the import of cmtbytes "github.com/cometbft/cometbft/libs/bytes".
|
||||
There is something changed.Due to the import changes, this is a breaking change. Chains need to remove **entirely** their imports in their codebase, from direct and indirects imports.
|
||||
|
||||
Following an exhaustive list:
|
||||
|
||||
@ -15,6 +16,9 @@ Following an exhaustive list:
|
||||
* `clitestutil.MockTendermintRPC` -> `clitestutil.MockCometRPC`
|
||||
* `clitestutilgenutil.CreateDefaultTendermintConfig` -> `clitestutilgenutil.CreateDefaultCometConfig`
|
||||
* Package `client/grpc/tmservice` -> `client/grpc/cmtservice`
|
||||
* Remove `github.com/cometbft/cometbft/libs/bytes` & Replace All `cmtbytes.HexBytes` by `[]byte` except `*pb.go`files
|
||||
* Verify `github.com/cometbft/cometbft/libs/bytes` is not an indirect or direct dependency
|
||||
* Run `make proto-gen`
|
||||
|
||||
Additionally, the commands and flags mentionning `tendermint` have been renamed to `comet`.
|
||||
However, these commands and flags is still supported for backward compatibility.
|
||||
@ -52,6 +56,7 @@ See related issues:
|
||||
### Protobuf
|
||||
|
||||
The SDK is in the process of removing all `gogoproto` annotations.
|
||||
The SDK is in the process of removing all `(gogoproto.casttype) = "github.com/cometbft/cometbft/libs/bytes.HexBytes"`.
|
||||
|
||||
#### Stringer
|
||||
|
||||
@ -101,6 +106,18 @@ By default, the new `ProposalCancelRatio` parameter is set to 0.5 during migrati
|
||||
|
||||
The `x/evidence` module is extracted to have a separate go.mod file which allows it be a standalone module.
|
||||
All the evidence imports are now renamed to use `cosmossdk.io/x/evidence` instead of `github.com/cosmos/cosmos-sdk/x/evidence` across the SDK.
|
||||
All the evidence removed `github.com/cometbft/cometbft/libs/bytes`.
|
||||
All the evidence functions or params are now renamed to use `cmtbytes.HexBytes` or `bytes.HexBytes` instead of `[]byte` across the SDK.
|
||||
|
||||
#### `x/bank`
|
||||
|
||||
All the bank removed `github.com/cometbft/cometbft/libs/bytes`.
|
||||
All the bank functions or params are now renamed to use `[]byte` instead of `cmtbytes.HexBytes` or `bytes.HexBytes` across the SDK.
|
||||
|
||||
#### `x/simulation`
|
||||
|
||||
All the simulation removed `github.com/cometbft/cometbft/libs/bytes`
|
||||
All the simulation functions or params are now renamed to use `cmtbytes.HexBytes` or `bytes.HexBytes` instead of `[]byte` across the SDK.
|
||||
|
||||
#### `x/nft`
|
||||
|
||||
|
||||
@ -2146,71 +2146,68 @@ var file_cosmos_evidence_v1beta1_query_proto_rawDesc = []byte{
|
||||
0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||
0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f,
|
||||
0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x87, 0x01, 0x0a, 0x14, 0x51, 0x75,
|
||||
0x65, 0x72, 0x79, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x12, 0x5b, 0x0a, 0x0d, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x68,
|
||||
0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x36, 0x18, 0x01, 0xfa, 0xde, 0x1f,
|
||||
0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6d, 0x65,
|
||||
0x74, 0x62, 0x66, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2f, 0x6c, 0x69,
|
||||
0x62, 0x73, 0x2f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x78, 0x42, 0x79, 0x74, 0x65,
|
||||
0x73, 0x52, 0x0c, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68,
|
||||
0x61, 0x73, 0x68, 0x22, 0x49, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x45, 0x76, 0x69, 0x64,
|
||||
0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08,
|
||||
0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14,
|
||||
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||||
0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x61,
|
||||
0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e,
|
||||
0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67,
|
||||
0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e,
|
||||
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72,
|
||||
0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x22, 0x95, 0x01, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x45, 0x76,
|
||||
0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30,
|
||||
0x0a, 0x08, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||
0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65,
|
||||
0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61,
|
||||
0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31,
|
||||
0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70,
|
||||
0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xc5, 0x02, 0x0a, 0x05, 0x51, 0x75,
|
||||
0x65, 0x72, 0x79, 0x12, 0x9b, 0x01, 0x0a, 0x08, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65,
|
||||
0x12, 0x2d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e,
|
||||
0x63, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79,
|
||||
0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x2e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63,
|
||||
0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x45,
|
||||
0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
|
||||
0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
|
||||
0x2f, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61,
|
||||
0x31, 0x2f, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x7b, 0x68, 0x61, 0x73, 0x68,
|
||||
0x7d, 0x12, 0x9d, 0x01, 0x0a, 0x0b, 0x41, 0x6c, 0x6c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63,
|
||||
0x65, 0x12, 0x30, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, 0x64, 0x65,
|
||||
0x6e, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72,
|
||||
0x79, 0x41, 0x6c, 0x6c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69,
|
||||
0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75,
|
||||
0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x12, 0x21,
|
||||
0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65,
|
||||
0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63,
|
||||
0x65, 0x42, 0xe1, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
|
||||
0x2e, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61,
|
||||
0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a,
|
||||
0x38, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70,
|
||||
0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63,
|
||||
0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e,
|
||||
0x63, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x45, 0x58, 0xaa,
|
||||
0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63,
|
||||
0x65, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x5c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x65,
|
||||
0x74, 0x61, 0x31, 0xe2, 0x02, 0x23, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x69,
|
||||
0x64, 0x65, 0x6e, 0x63, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50,
|
||||
0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x3a, 0x3a, 0x56, 0x31,
|
||||
0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x53, 0x0a, 0x14, 0x51, 0x75, 0x65,
|
||||
0x72, 0x79, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x12, 0x27, 0x0a, 0x0d, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x68, 0x61,
|
||||
0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0c, 0x65, 0x76,
|
||||
0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61,
|
||||
0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0x49,
|
||||
0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x65, 0x76, 0x69, 0x64, 0x65,
|
||||
0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
|
||||
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52,
|
||||
0x08, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x61, 0x0a, 0x17, 0x51, 0x75, 0x65,
|
||||
0x72, 0x79, 0x41, 0x6c, 0x6c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
|
||||
0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62,
|
||||
0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x95, 0x01, 0x0a,
|
||||
0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63,
|
||||
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x65, 0x76, 0x69,
|
||||
0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e,
|
||||
0x79, 0x52, 0x08, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x70,
|
||||
0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75,
|
||||
0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x32, 0xc5, 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x9b,
|
||||
0x01, 0x0a, 0x08, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2d, 0x2e, 0x63, 0x6f,
|
||||
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x76, 0x31,
|
||||
0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x45, 0x76, 0x69, 0x64, 0x65,
|
||||
0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x62,
|
||||
0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e,
|
||||
0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93,
|
||||
0x02, 0x2a, 0x12, 0x28, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x69, 0x64,
|
||||
0x65, 0x6e, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x65, 0x76, 0x69,
|
||||
0x64, 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x7b, 0x68, 0x61, 0x73, 0x68, 0x7d, 0x12, 0x9d, 0x01, 0x0a,
|
||||
0x0b, 0x41, 0x6c, 0x6c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x30, 0x2e, 0x63,
|
||||
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x76,
|
||||
0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x45,
|
||||
0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31,
|
||||
0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65,
|
||||
0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c,
|
||||
0x6c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x12, 0x21, 0x2f, 0x63, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x2f, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65,
|
||||
0x74, 0x61, 0x31, 0x2f, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x42, 0xe1, 0x01, 0x0a,
|
||||
0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, 0x64,
|
||||
0x65, 0x6e, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0a, 0x51, 0x75,
|
||||
0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x38, 0x63, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x62,
|
||||
0x65, 0x74, 0x61, 0x31, 0x3b, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x76, 0x31, 0x62,
|
||||
0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x45, 0x58, 0xaa, 0x02, 0x17, 0x43, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x2e, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x56, 0x31, 0x62,
|
||||
0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76,
|
||||
0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02,
|
||||
0x23, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65,
|
||||
0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
|
||||
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x45,
|
||||
0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
|
||||
"github.com/cockroachdb/errors"
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
cmtbytes "github.com/cometbft/cometbft/libs/bytes"
|
||||
rpcclient "github.com/cometbft/cometbft/rpc/client"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
@ -45,7 +44,7 @@ func (ctx Context) QueryWithData(path string, data []byte) ([]byte, int64, error
|
||||
// QueryStore performs a query to a CometBFT node with the provided key and
|
||||
// store name. It returns the result and height of the query upon success
|
||||
// or an error if the query fails.
|
||||
func (ctx Context) QueryStore(key cmtbytes.HexBytes, storeName string) ([]byte, int64, error) {
|
||||
func (ctx Context) QueryStore(key []byte, storeName string) ([]byte, int64, error) {
|
||||
return ctx.queryStore(key, storeName, "key")
|
||||
}
|
||||
|
||||
@ -129,7 +128,7 @@ func sdkErrorToGRPCError(resp abci.ResponseQuery) error {
|
||||
// query performs a query to a CometBFT node with the provided store name
|
||||
// and path. It returns the result and height of the query upon success
|
||||
// or an error if the query fails.
|
||||
func (ctx Context) query(path string, key cmtbytes.HexBytes) ([]byte, int64, error) {
|
||||
func (ctx Context) query(path string, key []byte) ([]byte, int64, error) {
|
||||
resp, err := ctx.queryABCI(abci.RequestQuery{
|
||||
Path: path,
|
||||
Data: key,
|
||||
@ -145,7 +144,7 @@ func (ctx Context) query(path string, key cmtbytes.HexBytes) ([]byte, int64, err
|
||||
// queryStore performs a query to a CometBFT node with the provided a store
|
||||
// name and path. It returns the result and height of the query upon success
|
||||
// or an error if the query fails.
|
||||
func (ctx Context) queryStore(key cmtbytes.HexBytes, storeName, endPath string) ([]byte, int64, error) {
|
||||
func (ctx Context) queryStore(key []byte, storeName, endPath string) ([]byte, int64, error) {
|
||||
path := fmt.Sprintf("/store/%s/%s", storeName, endPath)
|
||||
return ctx.query(path, key)
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cometbft/cometbft/libs/bytes"
|
||||
"github.com/cometbft/cometbft/p2p"
|
||||
coretypes "github.com/cometbft/cometbft/rpc/core/types"
|
||||
|
||||
@ -18,7 +17,7 @@ import (
|
||||
// ValidatorInfo is info about the node's validator, same as CometBFT,
|
||||
// except that we use our own PubKey.
|
||||
type validatorInfo struct {
|
||||
Address bytes.HexBytes
|
||||
Address []byte
|
||||
PubKey cryptotypes.PubKey
|
||||
VotingPower int64
|
||||
}
|
||||
|
||||
@ -25,8 +25,7 @@ service Query {
|
||||
message QueryEvidenceRequest {
|
||||
// evidence_hash defines the hash of the requested evidence.
|
||||
// Deprecated: Use hash, a HEX encoded string, instead.
|
||||
bytes evidence_hash = 1
|
||||
[deprecated = true, (gogoproto.casttype) = "github.com/cometbft/cometbft/libs/bytes.HexBytes"];
|
||||
bytes evidence_hash = 1 [deprecated = true];
|
||||
|
||||
// hash defines the evidence hash of the requested evidence.
|
||||
//
|
||||
|
||||
@ -6,7 +6,6 @@ import (
|
||||
|
||||
"cosmossdk.io/log"
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
cmtbytes "github.com/cometbft/cometbft/libs/bytes"
|
||||
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
|
||||
@ -26,7 +25,7 @@ type Context struct {
|
||||
baseCtx context.Context
|
||||
ms storetypes.MultiStore
|
||||
header cmtproto.Header
|
||||
headerHash cmtbytes.HexBytes
|
||||
headerHash []byte
|
||||
chainID string
|
||||
txBytes []byte
|
||||
logger log.Logger
|
||||
@ -72,7 +71,7 @@ func (c Context) BlockHeader() cmtproto.Header {
|
||||
}
|
||||
|
||||
// HeaderHash returns a copy of the header hash obtained during abci.RequestBeginBlock
|
||||
func (c Context) HeaderHash() cmtbytes.HexBytes {
|
||||
func (c Context) HeaderHash() []byte {
|
||||
hash := make([]byte, len(c.headerHash))
|
||||
copy(hash, c.headerHash)
|
||||
return hash
|
||||
|
||||
@ -121,7 +121,7 @@ func (s *contextTestSuite) TestContextWithCustom() {
|
||||
s.Require().Equal(meter, ctx.GasMeter())
|
||||
s.Require().Equal(minGasPrices, ctx.MinGasPrices())
|
||||
s.Require().Equal(blockGasMeter, ctx.BlockGasMeter())
|
||||
s.Require().Equal(headerHash, ctx.HeaderHash().Bytes())
|
||||
s.Require().Equal(headerHash, ctx.HeaderHash())
|
||||
s.Require().False(ctx.WithIsCheckTx(false).IsCheckTx())
|
||||
s.Require().Equal(zeroGasCfg, ctx.KVGasConfig())
|
||||
s.Require().Equal(zeroGasCfg, ctx.TransientKVGasConfig())
|
||||
|
||||
@ -8,7 +8,6 @@ import (
|
||||
"time"
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
"github.com/cometbft/cometbft/libs/bytes"
|
||||
coretypes "github.com/cometbft/cometbft/rpc/core/types"
|
||||
"github.com/golang/protobuf/proto" //nolint:staticcheck // grpc-gateway uses deprecated golang/protobuf
|
||||
"github.com/stretchr/testify/require"
|
||||
@ -81,7 +80,7 @@ func (s *resultTestSuite) TestResponseResultTx() {
|
||||
GasUsed: 90,
|
||||
}
|
||||
resultTx := &coretypes.ResultTx{
|
||||
Hash: bytes.HexBytes([]byte("test")),
|
||||
Hash: []byte("test"),
|
||||
Height: 10,
|
||||
TxResult: deliverTxResult,
|
||||
}
|
||||
@ -128,7 +127,7 @@ txhash: "74657374"
|
||||
Codespace: "codespace",
|
||||
Data: []byte("data"),
|
||||
Log: `[]`,
|
||||
Hash: bytes.HexBytes([]byte("test")),
|
||||
Hash: []byte("test"),
|
||||
}
|
||||
|
||||
s.Require().Equal(&sdk.TxResponse{
|
||||
|
||||
@ -2,6 +2,7 @@ package keeper_test
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
@ -16,7 +17,6 @@ import (
|
||||
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
|
||||
cmtbytes "github.com/cometbft/cometbft/libs/bytes"
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -79,10 +79,10 @@ func newIbcCoin(amt int64) sdk.Coin {
|
||||
}
|
||||
|
||||
func getIBCDenom(path string, baseDenom string) string {
|
||||
return fmt.Sprintf("%s/%s", "ibc", getIBCHash(path, baseDenom))
|
||||
return fmt.Sprintf("%s/%s", "ibc", hex.EncodeToString(getIBCHash(path, baseDenom)))
|
||||
}
|
||||
|
||||
func getIBCHash(path string, baseDenom string) cmtbytes.HexBytes {
|
||||
func getIBCHash(path string, baseDenom string) []byte {
|
||||
hash := sha256.Sum256([]byte(path + "/" + baseDenom))
|
||||
return hash[:]
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ type Evidence interface {
|
||||
|
||||
Route() string
|
||||
String() string
|
||||
Hash() cmtbytes.HexBytes
|
||||
Hash() []byte
|
||||
ValidateBasic() error
|
||||
|
||||
// Height at which the infraction occurred
|
||||
@ -153,7 +153,7 @@ as follows:
|
||||
```go
|
||||
func SubmitEvidence(ctx Context, evidence Evidence) error {
|
||||
if _, ok := GetEvidence(ctx, evidence.Hash()); ok {
|
||||
return errorsmod.Wrap(types.ErrEvidenceExists, evidence.Hash().String())
|
||||
return errorsmod.Wrap(types.ErrEvidenceExists, strings.ToUpper(hex.EncodeToString(evidence.Hash())))
|
||||
}
|
||||
if !router.HasRoute(evidence.Route()) {
|
||||
return errorsmod.Wrap(types.ErrNoEvidenceHandlerExists, evidence.Route())
|
||||
@ -167,7 +167,7 @@ func SubmitEvidence(ctx Context, evidence Evidence) error {
|
||||
ctx.EventManager().EmitEvent(
|
||||
sdk.NewEvent(
|
||||
types.EventTypeSubmitEvidence,
|
||||
sdk.NewAttribute(types.AttributeKeyEvidenceHash, evidence.Hash().String()),
|
||||
sdk.NewAttribute(types.AttributeKeyEvidenceHash, strings.ToUpper(hex.EncodeToString(evidence.Hash()))),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package exported
|
||||
|
||||
import (
|
||||
cmtbytes "github.com/cometbft/cometbft/libs/bytes"
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -14,7 +13,7 @@ type Evidence interface {
|
||||
|
||||
Route() string
|
||||
String() string
|
||||
Hash() cmtbytes.HexBytes
|
||||
Hash() []byte
|
||||
ValidateBasic() error
|
||||
|
||||
// Height at which the infraction occurred
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@ -37,7 +38,7 @@ func (suite *KeeperTestSuite) TestQueryEvidence() {
|
||||
func() {
|
||||
numEvidence := 1
|
||||
evidence = suite.populateEvidence(suite.ctx, numEvidence)
|
||||
evidenceHash := evidence[0].Hash().String()
|
||||
evidenceHash := strings.ToUpper(hex.EncodeToString(evidence[0].Hash()))
|
||||
reqHash := strings.Repeat("a", len(evidenceHash))
|
||||
req = types.NewQueryEvidenceRequest(reqHash)
|
||||
},
|
||||
@ -51,7 +52,7 @@ func (suite *KeeperTestSuite) TestQueryEvidence() {
|
||||
func() {
|
||||
numEvidence := 100
|
||||
evidence = suite.populateEvidence(suite.ctx, numEvidence)
|
||||
req = types.NewQueryEvidenceRequest(evidence[0].Hash().String())
|
||||
req = types.NewQueryEvidenceRequest(strings.ToUpper(hex.EncodeToString(evidence[0].Hash())))
|
||||
},
|
||||
true,
|
||||
"",
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"cosmossdk.io/log"
|
||||
"cosmossdk.io/x/evidence/exported"
|
||||
"cosmossdk.io/x/evidence/types"
|
||||
cmtbytes "github.com/cometbft/cometbft/libs/bytes"
|
||||
|
||||
"cosmossdk.io/errors"
|
||||
"cosmossdk.io/store/prefix"
|
||||
@ -79,7 +80,7 @@ func (k Keeper) GetEvidenceHandler(evidenceRoute string) (types.Handler, error)
|
||||
// persisted.
|
||||
func (k Keeper) SubmitEvidence(ctx sdk.Context, evidence exported.Evidence) error {
|
||||
if _, ok := k.GetEvidence(ctx, evidence.Hash()); ok {
|
||||
return errors.Wrap(types.ErrEvidenceExists, evidence.Hash().String())
|
||||
return errors.Wrap(types.ErrEvidenceExists, strings.ToUpper(hex.EncodeToString(evidence.Hash())))
|
||||
}
|
||||
if !k.router.HasRoute(evidence.Route()) {
|
||||
return errors.Wrap(types.ErrNoEvidenceHandlerExists, evidence.Route())
|
||||
@ -93,7 +94,7 @@ func (k Keeper) SubmitEvidence(ctx sdk.Context, evidence exported.Evidence) erro
|
||||
ctx.EventManager().EmitEvent(
|
||||
sdk.NewEvent(
|
||||
types.EventTypeSubmitEvidence,
|
||||
sdk.NewAttribute(types.AttributeKeyEvidenceHash, evidence.Hash().String()),
|
||||
sdk.NewAttribute(types.AttributeKeyEvidenceHash, strings.ToUpper(hex.EncodeToString(evidence.Hash()))),
|
||||
),
|
||||
)
|
||||
|
||||
@ -109,7 +110,7 @@ func (k Keeper) SetEvidence(ctx sdk.Context, evidence exported.Evidence) {
|
||||
|
||||
// GetEvidence retrieves Evidence by hash if it exists. If no Evidence exists for
|
||||
// the given hash, (nil, false) is returned.
|
||||
func (k Keeper) GetEvidence(ctx sdk.Context, hash cmtbytes.HexBytes) (exported.Evidence, bool) {
|
||||
func (k Keeper) GetEvidence(ctx sdk.Context, hash []byte) (exported.Evidence, bool) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixEvidence)
|
||||
|
||||
bz := store.Get(hash)
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
"cosmossdk.io/x/evidence/exported"
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
"github.com/cometbft/cometbft/crypto/tmhash"
|
||||
cmtbytes "github.com/cometbft/cometbft/libs/bytes"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
@ -21,7 +20,7 @@ var _ exported.Evidence = &Equivocation{}
|
||||
func (e *Equivocation) Route() string { return RouteEquivocation }
|
||||
|
||||
// Hash returns the hash of an Equivocation object.
|
||||
func (e *Equivocation) Hash() cmtbytes.HexBytes {
|
||||
func (e *Equivocation) Hash() []byte {
|
||||
bz, err := e.Marshal()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package types_test
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -28,7 +30,7 @@ func TestEquivocation_Valid(t *testing.T) {
|
||||
require.Equal(t, e.GetConsensusAddress().String(), e.ConsensusAddress)
|
||||
require.Equal(t, e.GetHeight(), e.Height)
|
||||
require.Equal(t, e.Route(), types.RouteEquivocation)
|
||||
require.Equal(t, e.Hash().String(), "1E10F9267BEA3A9A4AB5302C2C510CC1AFD7C54E232DA5B2E3360DFAFACF7A76")
|
||||
require.Equal(t, strings.ToUpper(hex.EncodeToString(e.Hash())), "1E10F9267BEA3A9A4AB5302C2C510CC1AFD7C54E232DA5B2E3360DFAFACF7A76")
|
||||
require.Equal(t, "height:100 time:<seconds:1136214245 > power:1000000 consensus_address:\"cosmosvalcons1vehk7h6lta047h6lta047h6lta047h6l8m4r53\" ", e.String())
|
||||
require.NoError(t, e.ValidateBasic())
|
||||
|
||||
@ -38,7 +40,7 @@ func TestEquivocation_Valid(t *testing.T) {
|
||||
require.Equal(t, e.ConsensusAddress, e.GetConsensusAddress().String())
|
||||
require.Equal(t, e.Height, e.GetHeight())
|
||||
require.Equal(t, types.RouteEquivocation, e.Route())
|
||||
require.Equal(t, "1E10F9267BEA3A9A4AB5302C2C510CC1AFD7C54E232DA5B2E3360DFAFACF7A76", e.Hash().String())
|
||||
require.Equal(t, "1E10F9267BEA3A9A4AB5302C2C510CC1AFD7C54E232DA5B2E3360DFAFACF7A76", strings.ToUpper(hex.EncodeToString(e.Hash())))
|
||||
require.Equal(t, "height:100 time:<seconds:1136214245 > power:1000000 consensus_address:\"cosmosvalcons1vehk7h6lta047h6lta047h6lta047h6l8m4r53\" ", e.String())
|
||||
require.NoError(t, e.ValidateBasic())
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
|
||||
"cosmossdk.io/x/evidence/exported"
|
||||
"cosmossdk.io/x/evidence/types"
|
||||
cmtbytes "github.com/cometbft/cometbft/libs/bytes"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
@ -171,8 +170,8 @@ func (*TestEvidence) Route() string {
|
||||
func (*TestEvidence) ProtoMessage() {}
|
||||
func (*TestEvidence) Reset() {}
|
||||
|
||||
func (*TestEvidence) Hash() cmtbytes.HexBytes {
|
||||
return cmtbytes.HexBytes([]byte("test-hash"))
|
||||
func (*TestEvidence) Hash() []byte {
|
||||
return []byte("test-hash")
|
||||
}
|
||||
|
||||
func (*TestEvidence) ValidateBasic() error {
|
||||
|
||||
@ -6,7 +6,6 @@ package types
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
github_com_cometbft_cometbft_libs_bytes "github.com/cometbft/cometbft/libs/bytes"
|
||||
types "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
query "github.com/cosmos/cosmos-sdk/types/query"
|
||||
_ "github.com/cosmos/gogoproto/gogoproto"
|
||||
@ -36,7 +35,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
type QueryEvidenceRequest struct {
|
||||
// evidence_hash defines the hash of the requested evidence.
|
||||
// Deprecated: Use hash, a HEX encoded string, instead.
|
||||
EvidenceHash github_com_cometbft_cometbft_libs_bytes.HexBytes `protobuf:"bytes,1,opt,name=evidence_hash,json=evidenceHash,proto3,casttype=github.com/cometbft/cometbft/libs/bytes.HexBytes" json:"evidence_hash,omitempty"` // Deprecated: Do not use.
|
||||
EvidenceHash []byte `protobuf:"bytes,1,opt,name=evidence_hash,json=evidenceHash,proto3" json:"evidence_hash,omitempty"` // Deprecated: Do not use.
|
||||
// hash defines the evidence hash of the requested evidence.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
@ -77,7 +76,7 @@ func (m *QueryEvidenceRequest) XXX_DiscardUnknown() {
|
||||
var xxx_messageInfo_QueryEvidenceRequest proto.InternalMessageInfo
|
||||
|
||||
// Deprecated: Do not use.
|
||||
func (m *QueryEvidenceRequest) GetEvidenceHash() github_com_cometbft_cometbft_libs_bytes.HexBytes {
|
||||
func (m *QueryEvidenceRequest) GetEvidenceHash() []byte {
|
||||
if m != nil {
|
||||
return m.EvidenceHash
|
||||
}
|
||||
@ -252,37 +251,35 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_07043de1a84d215a = []byte{
|
||||
// 477 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x4f, 0x6f, 0xd3, 0x30,
|
||||
0x18, 0xc6, 0xeb, 0xf2, 0x47, 0xc3, 0x1b, 0x17, 0xab, 0x68, 0x25, 0x82, 0x30, 0x32, 0x09, 0xca,
|
||||
0x24, 0xec, 0x74, 0x48, 0x70, 0x5e, 0x25, 0x60, 0xdc, 0x20, 0x47, 0x38, 0x20, 0x3b, 0xf3, 0x92,
|
||||
0x88, 0xd4, 0xce, 0x66, 0x67, 0x5a, 0x84, 0xb8, 0x70, 0xe1, 0x8a, 0x84, 0x38, 0x21, 0x3e, 0x0e,
|
||||
0x12, 0xc7, 0x49, 0x5c, 0x38, 0x21, 0xd4, 0xf2, 0x29, 0x38, 0xa1, 0xd8, 0x4e, 0x5b, 0xb6, 0x95,
|
||||
0xb2, 0xdb, 0x5b, 0xfb, 0x7d, 0x9e, 0xf7, 0xe7, 0xf7, 0x69, 0xe0, 0x7a, 0x2c, 0xd5, 0x50, 0x2a,
|
||||
0xc2, 0x0f, 0xb2, 0x1d, 0x2e, 0x62, 0x4e, 0x0e, 0xfa, 0x8c, 0x6b, 0xda, 0x27, 0x7b, 0x25, 0xdf,
|
||||
0xaf, 0x70, 0xb1, 0x2f, 0xb5, 0x44, 0xab, 0xb6, 0x09, 0x37, 0x4d, 0xd8, 0x35, 0x79, 0x1b, 0x4e,
|
||||
0xcd, 0xa8, 0xe2, 0x56, 0x31, 0xd1, 0x17, 0x34, 0xc9, 0x04, 0xd5, 0x99, 0x14, 0xd6, 0xc4, 0xeb,
|
||||
0x24, 0x32, 0x91, 0xa6, 0x24, 0x75, 0xe5, 0x4e, 0xaf, 0x26, 0x52, 0x26, 0x39, 0x27, 0xe6, 0x17,
|
||||
0x2b, 0x77, 0x09, 0x15, 0x6e, 0xaa, 0x77, 0xcd, 0x5d, 0xd1, 0x22, 0x23, 0x54, 0x08, 0xa9, 0x8d,
|
||||
0x9b, 0xb2, 0xb7, 0xc1, 0x3b, 0x00, 0x3b, 0xcf, 0xea, 0x89, 0x0f, 0x1d, 0x54, 0xc4, 0xf7, 0x4a,
|
||||
0xae, 0x34, 0x7a, 0x01, 0x2f, 0x37, 0x9c, 0x2f, 0x53, 0xaa, 0xd2, 0x2e, 0x58, 0x03, 0xbd, 0x95,
|
||||
0xc1, 0xfd, 0xdf, 0x3f, 0x6e, 0x84, 0x49, 0xa6, 0xd3, 0x92, 0xe1, 0x58, 0x0e, 0x49, 0x2c, 0x87,
|
||||
0x5c, 0xb3, 0x5d, 0x3d, 0x2d, 0xf2, 0x8c, 0x29, 0xc2, 0x2a, 0xcd, 0x15, 0xde, 0xe6, 0x87, 0x83,
|
||||
0xba, 0xe8, 0x82, 0x68, 0xa5, 0x31, 0xdb, 0xa6, 0x2a, 0x45, 0x08, 0x9e, 0x37, 0x9e, 0xed, 0x35,
|
||||
0xd0, 0xbb, 0x14, 0x99, 0x3a, 0x78, 0x02, 0xaf, 0x1c, 0x03, 0x51, 0x85, 0x14, 0x8a, 0xa3, 0x10,
|
||||
0x2e, 0x35, 0x62, 0x03, 0xb1, 0xbc, 0xd9, 0xc1, 0xf6, 0x4d, 0xb8, 0x79, 0x2e, 0xde, 0x12, 0x55,
|
||||
0x34, 0xe9, 0x0a, 0x28, 0x5c, 0x35, 0x56, 0x5b, 0x79, 0x7e, 0xfc, 0x59, 0x8f, 0x20, 0x9c, 0xae,
|
||||
0xd4, 0xd9, 0xdd, 0xc2, 0x2e, 0x98, 0x7a, 0xff, 0xd8, 0x26, 0xe6, 0xf6, 0x8f, 0x9f, 0xd2, 0xa4,
|
||||
0xd1, 0x46, 0x33, 0xca, 0xe0, 0x23, 0x80, 0xdd, 0x93, 0x33, 0x4e, 0x25, 0x3e, 0xb7, 0x98, 0x18,
|
||||
0x3d, 0xfe, 0x0b, 0xab, 0x6d, 0xb0, 0x6e, 0x2f, 0xc4, 0xb2, 0xe3, 0x66, 0xb9, 0x36, 0xbf, 0xb4,
|
||||
0xe1, 0x05, 0xc3, 0x85, 0x3e, 0x01, 0xb8, 0xd4, 0x90, 0xa1, 0xbb, 0x78, 0xce, 0x7f, 0x0f, 0x9f,
|
||||
0x16, 0xbe, 0x87, 0xff, 0xb7, 0xdd, 0x12, 0x04, 0xe1, 0xdb, 0x6f, 0xbf, 0x3e, 0xb4, 0x37, 0x50,
|
||||
0x8f, 0xcc, 0xfb, 0x0e, 0x26, 0x07, 0xaf, 0xeb, 0xb0, 0xdf, 0xa0, 0xcf, 0x00, 0x2e, 0xcf, 0xac,
|
||||
0x0e, 0x85, 0xff, 0x9e, 0x78, 0x32, 0x49, 0xaf, 0x7f, 0x06, 0x85, 0xc3, 0xbc, 0x63, 0x30, 0xd7,
|
||||
0xd1, 0xcd, 0x85, 0x98, 0x83, 0x07, 0x5f, 0x47, 0x3e, 0x38, 0x1a, 0xf9, 0xe0, 0xe7, 0xc8, 0x07,
|
||||
0xef, 0xc7, 0x7e, 0xeb, 0x68, 0xec, 0xb7, 0xbe, 0x8f, 0xfd, 0xd6, 0xf3, 0xeb, 0x56, 0xab, 0x76,
|
||||
0x5e, 0xe1, 0x4c, 0x92, 0xc3, 0xa9, 0x87, 0xae, 0x0a, 0xae, 0xd8, 0x45, 0x93, 0xf0, 0xbd, 0x3f,
|
||||
0x01, 0x00, 0x00, 0xff, 0xff, 0xec, 0x43, 0xd3, 0x6e, 0x12, 0x04, 0x00, 0x00,
|
||||
// 438 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xcb, 0x8e, 0x12, 0x41,
|
||||
0x14, 0x86, 0xa9, 0xf6, 0x12, 0x2c, 0x70, 0x53, 0xc1, 0x80, 0x1d, 0xed, 0x60, 0x93, 0x08, 0x92,
|
||||
0x58, 0x05, 0xb8, 0x70, 0x0d, 0x89, 0xb7, 0x9d, 0xb6, 0x3b, 0x37, 0xa6, 0x1a, 0xca, 0xa6, 0x23,
|
||||
0x56, 0x35, 0x54, 0x43, 0x24, 0xc6, 0x8d, 0x4f, 0x60, 0x62, 0x5c, 0x19, 0x1f, 0x67, 0x92, 0x59,
|
||||
0x92, 0xcc, 0x66, 0x96, 0x13, 0x98, 0x07, 0x99, 0x74, 0x55, 0x35, 0x30, 0x5c, 0x86, 0x99, 0xdd,
|
||||
0xe9, 0x3e, 0xe7, 0xff, 0xcf, 0x97, 0xff, 0x14, 0xac, 0x74, 0x85, 0xfc, 0x26, 0x24, 0x61, 0x93,
|
||||
0xb0, 0xc7, 0x78, 0x97, 0x91, 0x49, 0xd3, 0x67, 0x31, 0x6d, 0x92, 0xe1, 0x98, 0x8d, 0xa6, 0x38,
|
||||
0x1a, 0x89, 0x58, 0xa0, 0xa2, 0x1e, 0xc2, 0xe9, 0x10, 0x36, 0x43, 0x76, 0xdd, 0xa8, 0x7d, 0x2a,
|
||||
0x99, 0x56, 0x2c, 0xf5, 0x11, 0x0d, 0x42, 0x4e, 0xe3, 0x50, 0x70, 0x6d, 0x62, 0x17, 0x02, 0x11,
|
||||
0x08, 0x55, 0x92, 0xa4, 0x32, 0x7f, 0x1f, 0x06, 0x42, 0x04, 0x03, 0x46, 0xd4, 0x97, 0x3f, 0xfe,
|
||||
0x42, 0x28, 0x37, 0x5b, 0xed, 0x47, 0xa6, 0x45, 0xa3, 0x90, 0x50, 0xce, 0x45, 0xac, 0xdc, 0xa4,
|
||||
0xee, 0xba, 0x1f, 0x61, 0xe1, 0x43, 0xb2, 0xf0, 0x95, 0x61, 0xf2, 0xd8, 0x70, 0xcc, 0x64, 0x8c,
|
||||
0xaa, 0xf0, 0x7e, 0x8a, 0xf9, 0xb9, 0x4f, 0x65, 0xbf, 0x04, 0xca, 0xa0, 0x96, 0xef, 0x58, 0x25,
|
||||
0xe0, 0xe5, 0xd3, 0xc6, 0x5b, 0x2a, 0xfb, 0x08, 0xc1, 0xdb, 0xaa, 0x6f, 0x95, 0x41, 0xed, 0x9e,
|
||||
0xa7, 0x6a, 0xf7, 0x1d, 0x7c, 0xb0, 0x61, 0x2a, 0x23, 0xc1, 0x25, 0x43, 0x0d, 0x98, 0x4d, 0xc5,
|
||||
0xca, 0x30, 0xd7, 0x2a, 0x60, 0x8d, 0x87, 0x53, 0x72, 0xdc, 0xe6, 0x53, 0x6f, 0x39, 0xe5, 0x52,
|
||||
0x58, 0x54, 0x56, 0xed, 0xc1, 0x60, 0x13, 0xf1, 0x35, 0x84, 0xab, 0x74, 0x8c, 0xdd, 0x53, 0x6c,
|
||||
0x32, 0x4e, 0xa2, 0xc4, 0x3a, 0x7c, 0x13, 0x25, 0x7e, 0x4f, 0x83, 0x54, 0xeb, 0xad, 0x29, 0xdd,
|
||||
0xbf, 0x00, 0x96, 0xb6, 0x77, 0xec, 0x24, 0xbe, 0x75, 0x98, 0x18, 0xbd, 0xb9, 0x84, 0x65, 0x29,
|
||||
0xac, 0xea, 0x41, 0x2c, 0xbd, 0x6e, 0x9d, 0xab, 0x75, 0x64, 0xc1, 0x3b, 0x8a, 0x0b, 0xfd, 0x03,
|
||||
0x30, 0x9b, 0x92, 0xa1, 0xe7, 0x78, 0xcf, 0x33, 0xc2, 0xbb, 0x0e, 0x69, 0xe3, 0xeb, 0x8e, 0x6b,
|
||||
0x02, 0xb7, 0xf1, 0xeb, 0xe4, 0xfc, 0x8f, 0x55, 0x47, 0x35, 0xb2, 0xef, 0x49, 0x2f, 0x7f, 0xfc,
|
||||
0x48, 0x8e, 0xfd, 0x13, 0xfd, 0x07, 0x30, 0xb7, 0x16, 0x1d, 0x6a, 0x5c, 0xbd, 0x71, 0xfb, 0x92,
|
||||
0x76, 0xf3, 0x06, 0x0a, 0x83, 0xf9, 0x4c, 0x61, 0x56, 0xd0, 0x93, 0x83, 0x98, 0x9d, 0x97, 0xc7,
|
||||
0x73, 0x07, 0xcc, 0xe6, 0x0e, 0x38, 0x9b, 0x3b, 0xe0, 0xf7, 0xc2, 0xc9, 0xcc, 0x16, 0x4e, 0xe6,
|
||||
0x74, 0xe1, 0x64, 0x3e, 0x3d, 0xd6, 0x5a, 0xd9, 0xfb, 0x8a, 0x43, 0x41, 0xbe, 0xaf, 0x3c, 0xe2,
|
||||
0x69, 0xc4, 0xa4, 0x7f, 0x57, 0x5d, 0xf8, 0xc5, 0x45, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9c, 0x24,
|
||||
0xb4, 0x3c, 0xdd, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
||||
@ -9,7 +9,6 @@ import (
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
cryptoenc "github.com/cometbft/cometbft/crypto/encoding"
|
||||
cmtbytes "github.com/cometbft/cometbft/libs/bytes"
|
||||
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
||||
)
|
||||
|
||||
@ -60,7 +59,7 @@ func (vals mockValidators) getKeys() []string {
|
||||
}
|
||||
|
||||
// randomProposer picks a random proposer from the current validator set
|
||||
func (vals mockValidators) randomProposer(r *rand.Rand) cmtbytes.HexBytes {
|
||||
func (vals mockValidators) randomProposer(r *rand.Rand) []byte {
|
||||
keys := vals.getKeys()
|
||||
if len(keys) == 0 {
|
||||
return nil
|
||||
|
||||
Loading…
Reference in New Issue
Block a user