From 6ab909c1414b9d7bae6d8844fdc1ff0e6f8a668e Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 23 Sep 2022 17:16:31 +0200 Subject: [PATCH] refactor!: remove broadcast mode `block` (#12659) --- CHANGELOG.md | 7 +- UPGRADING.md | 5 + api/cosmos/tx/v1beta1/service.pulsar.go | 127 +++--- client/broadcast.go | 40 +- client/broadcast_test.go | 5 - client/config/toml.go | 2 +- client/flags/flags.go | 5 +- codec/amino_codec_test.go | 3 +- contrib/images/simd-dlv/Dockerfile | 1 - contrib/images/simd-env/Dockerfile | 1 - cosmovisor/README.md | 2 +- docs/run-node/txs.md | 1 - proto/cosmos/tx/v1beta1/service.proto | 6 +- server/config/config.go | 48 +- server/config/toml.go | 4 +- simapp/simd/cmd/root.go | 2 +- .../e2e/auth/vesting/client/testutil/suite.go | 8 +- tests/e2e/bank/client/suite.go | 4 +- .../e2e/client/grpc/tmservice/service_test.go | 3 +- tests/e2e/crisis/suite.go | 18 +- .../{client/testutil => }/cli_test.go | 2 +- tests/e2e/evidence/suite.go | 3 +- tests/e2e/feegrant/suite.go | 29 +- tests/e2e/genutil/suite.go | 3 +- .../e2e/gov/{client/testutil => }/cli_test.go | 6 +- tests/e2e/group/query.go | 41 +- tests/e2e/group/tx.go | 429 ++++++++++-------- tests/e2e/mint/suite.go | 3 +- tests/e2e/nft/tx.go | 13 +- tests/e2e/slashing/client/testutil/suite.go | 8 +- tests/e2e/staking/client/testutil/suite.go | 109 +++-- .../staking/client/testutil/test_helpers.go | 2 +- tests/e2e/tx/service_test.go | 13 +- testutil/cli/tx.go | 64 +++ testutil/network/doc.go | 3 +- types/result.go | 68 --- types/result_test.go | 87 ---- types/tx/service.pb.go | 135 +++--- x/auth/client/cli/tx_multisign.go | 4 +- x/auth/client/testutil/suite.go | 22 +- x/authz/client/testutil/grpc.go | 3 +- x/authz/client/testutil/query.go | 6 +- x/authz/client/testutil/tx.go | 197 ++++---- x/bank/client/cli/suite_test.go | 2 +- x/crisis/client/cli/tx_test.go | 13 +- x/distribution/client/cli/tx.go | 4 - .../client/testutil/grpc_query_suite.go | 3 +- x/distribution/client/testutil/suite.go | 33 +- .../client/testutil/withdraw_all_suite.go | 16 +- x/evidence/client/cli/tx_test.go | 4 +- x/feegrant/client/testutil/suite.go | 30 +- x/genutil/client/cli/gentx_test.go | 4 +- x/gov/client/testutil/deposits.go | 15 +- x/gov/client/testutil/helpers.go | 2 +- x/gov/client/testutil/tx.go | 55 ++- x/group/client/cli/tx_test.go | 8 +- x/group/keeper/proposal_executor.go | 12 +- x/mint/client/cli/query_test.go | 4 +- x/nft/client/cli/tx_test.go | 8 +- x/params/client/testutil/suite.go | 3 +- x/staking/client/cli/tx_test.go | 50 +- x/upgrade/client/cli/tx_test.go | 4 +- 62 files changed, 884 insertions(+), 928 deletions(-) rename tests/e2e/distribution/{client/testutil => }/cli_test.go (95%) rename tests/e2e/gov/{client/testutil => }/cli_test.go (86%) create mode 100644 testutil/cli/tx.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 8962afe6590fc..42b560b670682 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,8 +77,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#12596](https://github.com/cosmos/cosmos-sdk/pull/12596) Remove all imports of the non-existent gogo/protobuf v1.3.3 to ease downstream use and go workspaces. * [#12187](https://github.com/cosmos/cosmos-sdk/pull/12187) Add batch operation for x/nft module. * [#12693](https://github.com/cosmos/cosmos-sdk/pull/12693) Make sure the order of each node is consistent when emitting proto events. -* [#12455](https://github.com/cosmos/cosmos-sdk/pull/12455) Show attempts count in error for signing. -* [#12886](https://github.com/cosmos/cosmos-sdk/pull/12886) Amortize cost of processing cache KV store +* [#12455](https://github.com/cosmos/cosmos-sdk/pull/12455) Show attempts count in error for signing. +* [#12885](https://github.com/cosmos/cosmos-sdk/pull/12885) Amortize cost of processing cache KV store * [#12953](https://github.com/cosmos/cosmos-sdk/pull/12953) Change the default priority mechanism to be based on gas price. * [#13048](https://github.com/cosmos/cosmos-sdk/pull/13048) Add handling of AccountNumberStoreKeyPrefix to the x/auth simulation decoder. * [#13101](https://github.com/cosmos/cosmos-sdk/pull/13101) Remove weights from `simapp/params` and `testutil/sims`. They are now in their respective modules. @@ -113,6 +113,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes * !(storev2alpha1) [#13370](https://github.com/cosmos/cosmos-sdk/pull/13370) remove storev2alpha1 +* (tx) [#12659](https://github.com/cosmos/cosmos-sdk/pull/12659) Remove broadcast mode `block`. * (context) [#13063](https://github.com/cosmos/cosmos-sdk/pull/13063) Update `Context#CacheContext` to automatically emit all events on the parent context's `EventManager`. * (x/bank) [#12706](https://github.com/cosmos/cosmos-sdk/pull/12706) Removed the `testutil` package from the `x/bank/client` package. * (simapp) [#12747](https://github.com/cosmos/cosmos-sdk/pull/12747) Remove `simapp.MakeTestEncodingConfig`. Please use `moduletestutil.MakeTestEncodingConfig` (`types/module/testutil`) in tests instead. @@ -149,6 +150,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### CLI Breaking Changes +* (tx) [#12659](https://github.com/cosmos/cosmos-sdk/pull/12659) Remove broadcast mode `block`. + ### Bug Fixes * [#13145](https://github.com/cosmos/cosmos-sdk/pull/13145) Fix panic when calling `String()` to a Record struct type. diff --git a/UPGRADING.md b/UPGRADING.md index 5e95214ecf8fc..6d364475b75c8 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -35,6 +35,11 @@ The SDK has migrated from `gogo/protobuf` (which is currently unmaintained), to This means you should replace all imports of `github.com/gogo/protobuf` to `github.com/cosmos/gogoproto`. This allows you to remove the replace directive `replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1` from your `go.mod` file. +### Transactions + +Broadcast mode `block` was deprecated and has been removed. Please use `sync` mode instead. +When upgrading your tests from `block` to `sync` and checking for a transaction code, you might need to query the transaction first (with its hash) to get the correct code. + ### `x/gov` #### Minimum Proposal Deposit At Time of Submission diff --git a/api/cosmos/tx/v1beta1/service.pulsar.go b/api/cosmos/tx/v1beta1/service.pulsar.go index eb0f8d308c063..8aa6936cb0c96 100644 --- a/api/cosmos/tx/v1beta1/service.pulsar.go +++ b/api/cosmos/tx/v1beta1/service.pulsar.go @@ -5618,8 +5618,10 @@ type BroadcastMode int32 const ( // zero-value for mode ordering BroadcastMode_BROADCAST_MODE_UNSPECIFIED BroadcastMode = 0 - // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for - // the tx to be committed in a block. + // DEPRECATED: use BROADCAST_MODE_SYNC instead, + // BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. + // + // Deprecated: Do not use. BroadcastMode_BROADCAST_MODE_BLOCK BroadcastMode = 1 // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for // a CheckTx execution response only. @@ -6311,68 +6313,69 @@ var file_cosmos_tx_v1beta1_service_proto_rawDesc = []byte{ 0x44, 0x45, 0x52, 0x5f, 0x42, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x5f, 0x42, 0x59, 0x5f, 0x41, 0x53, 0x43, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x5f, - 0x42, 0x59, 0x5f, 0x44, 0x45, 0x53, 0x43, 0x10, 0x02, 0x2a, 0x7c, 0x0a, 0x0d, 0x42, 0x72, 0x6f, - 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1e, 0x0a, 0x1a, 0x42, 0x52, - 0x4f, 0x41, 0x44, 0x43, 0x41, 0x53, 0x54, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, - 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x42, 0x52, - 0x4f, 0x41, 0x44, 0x43, 0x41, 0x53, 0x54, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x42, 0x4c, 0x4f, - 0x43, 0x4b, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x42, 0x52, 0x4f, 0x41, 0x44, 0x43, 0x41, 0x53, - 0x54, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x10, 0x02, 0x12, 0x18, 0x0a, - 0x14, 0x42, 0x52, 0x4f, 0x41, 0x44, 0x43, 0x41, 0x53, 0x54, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, - 0x41, 0x53, 0x59, 0x4e, 0x43, 0x10, 0x03, 0x32, 0x92, 0x05, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x7b, 0x0a, 0x08, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x12, - 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, - 0x22, 0x1b, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2f, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, - 0x12, 0x71, 0x0a, 0x05, 0x47, 0x65, 0x74, 0x54, 0x78, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, - 0x74, 0x54, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, - 0x65, 0x74, 0x54, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, - 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x74, 0x78, 0x73, 0x2f, 0x7b, 0x68, 0x61, - 0x73, 0x68, 0x7d, 0x12, 0x7f, 0x0a, 0x0b, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, - 0x54, 0x78, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, - 0x54, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x42, 0x72, - 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x54, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x22, 0x16, 0x2f, 0x63, 0x6f, 0x73, 0x6d, + 0x42, 0x59, 0x5f, 0x44, 0x45, 0x53, 0x43, 0x10, 0x02, 0x2a, 0x80, 0x01, 0x0a, 0x0d, 0x42, 0x72, + 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1e, 0x0a, 0x1a, 0x42, + 0x52, 0x4f, 0x41, 0x44, 0x43, 0x41, 0x53, 0x54, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x14, 0x42, + 0x52, 0x4f, 0x41, 0x44, 0x43, 0x41, 0x53, 0x54, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x42, 0x4c, + 0x4f, 0x43, 0x4b, 0x10, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x42, 0x52, 0x4f, + 0x41, 0x44, 0x43, 0x41, 0x53, 0x54, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x59, 0x4e, 0x43, + 0x10, 0x02, 0x12, 0x18, 0x0a, 0x14, 0x42, 0x52, 0x4f, 0x41, 0x44, 0x43, 0x41, 0x53, 0x54, 0x5f, + 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x41, 0x53, 0x59, 0x4e, 0x43, 0x10, 0x03, 0x32, 0x92, 0x05, 0x0a, + 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7b, 0x0a, 0x08, 0x53, 0x69, 0x6d, 0x75, + 0x6c, 0x61, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x6d, + 0x75, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x22, 0x1b, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, + 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, + 0x74, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x71, 0x0a, 0x05, 0x47, 0x65, 0x74, 0x54, 0x78, 0x12, 0x1f, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x74, 0x78, - 0x73, 0x3a, 0x01, 0x2a, 0x12, 0x7c, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x54, 0x78, 0x73, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x78, 0x73, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, - 0x65, 0x74, 0x54, 0x78, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x74, - 0x78, 0x73, 0x12, 0x97, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x57, - 0x69, 0x74, 0x68, 0x54, 0x78, 0x73, 0x12, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x73, 0x2f, 0x7b, 0x68, 0x61, 0x73, 0x68, 0x7d, 0x12, 0x7f, 0x0a, 0x0b, 0x42, 0x72, 0x6f, 0x61, + 0x64, 0x63, 0x61, 0x73, 0x74, 0x54, 0x78, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x42, 0x72, 0x6f, 0x61, + 0x64, 0x63, 0x61, 0x73, 0x74, 0x54, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x54, 0x78, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x22, 0x16, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x74, 0x78, 0x73, 0x3a, 0x01, 0x2a, 0x12, 0x7c, 0x0a, 0x0b, 0x47, 0x65, 0x74, + 0x54, 0x78, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x54, 0x78, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x78, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, + 0x16, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2f, 0x74, 0x78, 0x73, 0x12, 0x97, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x54, 0x78, 0x73, 0x12, 0x29, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x54, 0x78, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x54, 0x78, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x57, 0x69, - 0x74, 0x68, 0x54, 0x78, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, - 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x74, 0x78, 0x73, 0x2f, 0x62, 0x6c, - 0x6f, 0x63, 0x6b, 0x2f, 0x7b, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x7d, 0x42, 0xb9, 0x01, 0x0a, - 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, - 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x74, 0x78, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x54, 0x58, 0xaa, 0x02, 0x11, 0x43, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x54, 0x78, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, - 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0xe2, 0x02, 0x1d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, 0x56, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x54, 0x78, 0x3a, - 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x54, 0x78, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x74, + 0x78, 0x73, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x7b, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x7d, 0x42, 0xb9, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0c, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, + 0x74, 0x78, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x54, 0x58, 0xaa, + 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x54, 0x78, 0x2e, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0xca, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, + 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x5c, 0x54, 0x78, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x3a, 0x3a, 0x54, 0x78, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/client/broadcast.go b/client/broadcast.go index 5ecafd1ec0ebc..2f1c72766ab93 100644 --- a/client/broadcast.go +++ b/client/broadcast.go @@ -28,11 +28,8 @@ func (ctx Context) BroadcastTx(txBytes []byte) (res *sdk.TxResponse, err error) case flags.BroadcastAsync: res, err = ctx.BroadcastTxAsync(txBytes) - case flags.BroadcastBlock: - res, err = ctx.BroadcastTxCommit(txBytes) - default: - return nil, fmt.Errorf("unsupported return type %s; supported types: sync, async, block", ctx.BroadcastMode) + return nil, fmt.Errorf("unsupported return type %s; supported types: sync, async", ctx.BroadcastMode) } return res, err @@ -81,39 +78,6 @@ func CheckTendermintError(err error, tx tmtypes.Tx) *sdk.TxResponse { } } -// BroadcastTxCommit broadcasts transaction bytes to a Tendermint node and -// waits for a commit. An error is only returned if there is no RPC node -// connection or if broadcasting fails. -// -// NOTE: This should ideally not be used as the request may timeout but the tx -// may still be included in a block. Use BroadcastTxAsync or BroadcastTxSync -// instead. -func (ctx Context) BroadcastTxCommit(txBytes []byte) (*sdk.TxResponse, error) { - node, err := ctx.GetNode() - if err != nil { - return nil, err - } - - res, err := node.BroadcastTxCommit(context.Background(), txBytes) - if err == nil { - return sdk.NewResponseFormatBroadcastTxCommit(res), nil - } - - // with these changes(https://github.com/tendermint/tendermint/pull/7683) - // in tendermint, we receive both an error and a non-empty res from TM. Here - // we handle the case where both are relevant. Note: without this edge-case handling, - // CLI is breaking (for few transactions ex: executing unathorized messages in feegrant) - // this check is added to tackle the particular case. - if strings.Contains(err.Error(), "transaction encountered error") { - return sdk.NewResponseFormatBroadcastTxCommit(res), nil - } - - if errRes := CheckTendermintError(err, txBytes); errRes != nil { - return errRes, nil - } - return sdk.NewResponseFormatBroadcastTxCommit(res), err -} - // BroadcastTxSync broadcasts transaction bytes to a Tendermint node // synchronously (i.e. returns after CheckTx execution). func (ctx Context) BroadcastTxSync(txBytes []byte) (*sdk.TxResponse, error) { @@ -170,8 +134,6 @@ func normalizeBroadcastMode(mode tx.BroadcastMode) string { switch mode { case tx.BroadcastMode_BROADCAST_MODE_ASYNC: return "async" - case tx.BroadcastMode_BROADCAST_MODE_BLOCK: - return "block" case tx.BroadcastMode_BROADCAST_MODE_SYNC: return "sync" default: diff --git a/client/broadcast_test.go b/client/broadcast_test.go index f3ddc572a5e55..fcc67733eb430 100644 --- a/client/broadcast_test.go +++ b/client/broadcast_test.go @@ -21,10 +21,6 @@ type MockClient struct { err error } -func (c MockClient) BroadcastTxCommit(ctx context.Context, tx tmtypes.Tx) (*coretypes.ResultBroadcastTxCommit, error) { - return nil, c.err -} - func (c MockClient) BroadcastTxAsync(ctx context.Context, tx tmtypes.Tx) (*coretypes.ResultBroadcastTx, error) { return nil, c.err } @@ -50,7 +46,6 @@ func TestBroadcastError(t *testing.T) { modes := []string{ flags.BroadcastAsync, - flags.BroadcastBlock, flags.BroadcastSync, } diff --git a/client/config/toml.go b/client/config/toml.go index 97c8b00b42c59..b38af70dc9368 100644 --- a/client/config/toml.go +++ b/client/config/toml.go @@ -23,7 +23,7 @@ keyring-backend = "{{ .KeyringBackend }}" output = "{{ .Output }}" # : to Tendermint RPC interface for this chain node = "{{ .Node }}" -# Transaction broadcasting mode (sync|async|block) +# Transaction broadcasting mode (sync|async) broadcast-mode = "{{ .BroadcastMode }}" ` diff --git a/client/flags/flags.go b/client/flags/flags.go index d7761f05c0192..faf7c16de0eae 100644 --- a/client/flags/flags.go +++ b/client/flags/flags.go @@ -21,9 +21,6 @@ const ( // DefaultKeyringBackend DefaultKeyringBackend = keyring.BackendOS - // BroadcastBlock defines a tx broadcasting mode where the client waits for - // the tx to be committed in a block. - BroadcastBlock = "block" // BroadcastSync defines a tx broadcasting mode where the client waits for // a CheckTx execution response only. BroadcastSync = "sync" @@ -114,7 +111,7 @@ func AddTxFlagsToCmd(cmd *cobra.Command) { cmd.Flags().String(FlagNode, "tcp://localhost:26657", ": to tendermint rpc interface for this chain") cmd.Flags().Bool(FlagUseLedger, false, "Use a connected Ledger device") cmd.Flags().Float64(FlagGasAdjustment, DefaultGasAdjustment, "adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored ") - cmd.Flags().StringP(FlagBroadcastMode, "b", BroadcastSync, "Transaction broadcasting mode (sync|async|block)") + cmd.Flags().StringP(FlagBroadcastMode, "b", BroadcastSync, "Transaction broadcasting mode (sync|async)") cmd.Flags().Bool(FlagDryRun, false, "ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible)") cmd.Flags().Bool(FlagGenerateOnly, false, "Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name)") cmd.Flags().Bool(FlagOffline, false, "Offline mode (does not allow any online functionality)") diff --git a/codec/amino_codec_test.go b/codec/amino_codec_test.go index 914d19de6f378..ae5d37d857a39 100644 --- a/codec/amino_codec_test.go +++ b/codec/amino_codec_test.go @@ -7,6 +7,7 @@ import ( "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" @@ -135,7 +136,7 @@ func TestAminoCodecFullDecodeAndEncode(t *testing.T) { // Marshalling/unmarshalling the tx wrapped in a struct should work. txRequest := &cli.BroadcastReq{ - Mode: "block", + Mode: flags.BroadcastSync, Tx: tx, } _, err = legacyCdc.MarshalJSON(txRequest) diff --git a/contrib/images/simd-dlv/Dockerfile b/contrib/images/simd-dlv/Dockerfile index 6a81ef3e81f43..3227b80c46a16 100644 --- a/contrib/images/simd-dlv/Dockerfile +++ b/contrib/images/simd-dlv/Dockerfile @@ -5,7 +5,6 @@ RUN go install github.com/go-delve/delve/cmd/dlv@latest WORKDIR /work COPY go.mod go.sum /work/ -COPY db/go.mod db/go.sum /work/db/ COPY errors/go.mod errors/go.sum /work/errors/ COPY math/go.mod math/go.sum /work/math/ COPY api/go.mod api/go.sum /work/api/ diff --git a/contrib/images/simd-env/Dockerfile b/contrib/images/simd-env/Dockerfile index dae68a2175b8b..c634e39e1ac2e 100644 --- a/contrib/images/simd-env/Dockerfile +++ b/contrib/images/simd-env/Dockerfile @@ -4,7 +4,6 @@ RUN apk add build-base git linux-headers WORKDIR /work COPY go.mod go.sum /work/ -COPY db/go.mod db/go.sum /work/db/ COPY errors/go.mod errors/go.sum /work/errors/ COPY math/go.mod math/go.sum /work/math/ COPY api/go.mod api/go.sum /work/api/ diff --git a/cosmovisor/README.md b/cosmovisor/README.md index 41610b26ecc42..75f3e07a2858e 100644 --- a/cosmovisor/README.md +++ b/cosmovisor/README.md @@ -265,7 +265,7 @@ Set up app config: ```sh ./build/simd config chain-id test ./build/simd config keyring-backend test -./build/simd config broadcast-mode block +./build/simd config broadcast-mode sync ``` Initialize the node and overwrite any previous genesis file (never do this in a production environment): diff --git a/docs/run-node/txs.md b/docs/run-node/txs.md index 99643b1cbb622..8f83c2f475375 100644 --- a/docs/run-node/txs.md +++ b/docs/run-node/txs.md @@ -79,7 +79,6 @@ simd tx broadcast tx_signed.json You may optionally pass the `--broadcast-mode` flag to specify which response to receive from the node: -* `block`: the CLI waits for the tx to be committed in a block. * `sync`: the CLI waits for a CheckTx execution response only. * `async`: the CLI returns immediately (transaction might fail). diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index 4dd9b5354067b..8dd9995d5e346 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -95,9 +95,9 @@ message BroadcastTxRequest { enum BroadcastMode { // zero-value for mode ordering BROADCAST_MODE_UNSPECIFIED = 0; - // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for - // the tx to be committed in a block. - BROADCAST_MODE_BLOCK = 1; + // DEPRECATED: use BROADCAST_MODE_SYNC instead, + // BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. + BROADCAST_MODE_BLOCK = 1 [deprecated = true]; // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for // a CheckTx execution response only. BROADCAST_MODE_SYNC = 2; diff --git a/server/config/config.go b/server/config/config.go index 21b9ff4490db5..eb56824688e39 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -85,8 +85,8 @@ type BaseConfig struct { // IavlCacheSize set the size of the iavl tree cache. IAVLCacheSize uint64 `mapstructure:"iavl-cache-size"` - // IAVLDisableFastnNode enables or disables the fast sync node. - IAVLDisableFastnNode bool `mapstructure:"iavl-disable-fastnode"` + // IAVLDisableFastNode enables or disables the fast sync node. + IAVLDisableFastNode bool `mapstructure:"iavl-disable-fastnode"` // AppDBBackend defines the type of Database to use for the application and snapshots databases. // An empty string indicates that the Tendermint config's DBBackend value should be used. @@ -240,16 +240,16 @@ func (c *Config) GetMinGasPrices() sdk.DecCoins { func DefaultConfig() *Config { return &Config{ BaseConfig: BaseConfig{ - MinGasPrices: defaultMinGasPrices, - InterBlockCache: true, - Pruning: pruningtypes.PruningOptionDefault, - PruningKeepRecent: "0", - PruningInterval: "0", - MinRetainBlocks: 0, - IndexEvents: make([]string, 0), - IAVLCacheSize: 781250, // 50 MB - IAVLDisableFastnNode: false, - AppDBBackend: "", + MinGasPrices: defaultMinGasPrices, + InterBlockCache: true, + Pruning: pruningtypes.PruningOptionDefault, + PruningKeepRecent: "0", + PruningInterval: "0", + MinRetainBlocks: 0, + IndexEvents: make([]string, 0), + IAVLCacheSize: 781250, // 50 MB + IAVLDisableFastNode: false, + AppDBBackend: "", }, Telemetry: telemetry.Config{ Enabled: false, @@ -311,18 +311,18 @@ func GetConfig(v *viper.Viper) (Config, error) { return Config{ BaseConfig: BaseConfig{ - MinGasPrices: v.GetString("minimum-gas-prices"), - InterBlockCache: v.GetBool("inter-block-cache"), - Pruning: v.GetString("pruning"), - PruningKeepRecent: v.GetString("pruning-keep-recent"), - PruningInterval: v.GetString("pruning-interval"), - HaltHeight: v.GetUint64("halt-height"), - HaltTime: v.GetUint64("halt-time"), - IndexEvents: v.GetStringSlice("index-events"), - MinRetainBlocks: v.GetUint64("min-retain-blocks"), - IAVLCacheSize: v.GetUint64("iavl-cache-size"), - IAVLDisableFastnNode: v.GetBool("iavl-disable-fastnode"), - AppDBBackend: v.GetString("app-db-backend"), + MinGasPrices: v.GetString("minimum-gas-prices"), + InterBlockCache: v.GetBool("inter-block-cache"), + Pruning: v.GetString("pruning"), + PruningKeepRecent: v.GetString("pruning-keep-recent"), + PruningInterval: v.GetString("pruning-interval"), + HaltHeight: v.GetUint64("halt-height"), + HaltTime: v.GetUint64("halt-time"), + IndexEvents: v.GetStringSlice("index-events"), + MinRetainBlocks: v.GetUint64("min-retain-blocks"), + IAVLCacheSize: v.GetUint64("iavl-cache-size"), + IAVLDisableFastNode: v.GetBool("iavl-disable-fastnode"), + AppDBBackend: v.GetString("app-db-backend"), }, Telemetry: telemetry.Config{ ServiceName: v.GetString("telemetry.service-name"), diff --git a/server/config/toml.go b/server/config/toml.go index 3e6e6cbe07321..0f8a4c9340c63 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -74,9 +74,9 @@ index-events = [{{ range .BaseConfig.IndexEvents }}{{ printf "%q, " . }}{{end}}] # Default cache size is 50mb. iavl-cache-size = {{ .BaseConfig.IAVLCacheSize }} -# IavlDisableFastnNode enables or disables the fast node feature of IAVL. +# IAVLDisableFastNode enables or disables the fast node feature of IAVL. # Default is false. -iavl-disable-fastnode = {{ .BaseConfig.IAVLDisableFastnNode }} +iavl-disable-fastnode = {{ .BaseConfig.IAVLDisableFastNode }} # AppDBBackend defines the database backend type to use for the application and snapshots DBs. # An empty string indicates that a fallback will be used. diff --git a/simapp/simd/cmd/root.go b/simapp/simd/cmd/root.go index bcfaa1bd36190..11719637d73e6 100644 --- a/simapp/simd/cmd/root.go +++ b/simapp/simd/cmd/root.go @@ -145,7 +145,7 @@ func initAppConfig() (string, interface{}) { // // In simapp, we set the min gas prices to 0. srvCfg.MinGasPrices = "0stake" - // srvCfg.BaseConfig.IAVLDisableFastnNode = true // disable fastnode by default + // srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default customAppConfig := CustomAppConfig{ Config: *srvCfg, diff --git a/tests/e2e/auth/vesting/client/testutil/suite.go b/tests/e2e/auth/vesting/client/testutil/suite.go index aadf2a0a9d659..843523ea0a921 100644 --- a/tests/e2e/auth/vesting/client/testutil/suite.go +++ b/tests/e2e/auth/vesting/client/testutil/suite.go @@ -30,9 +30,7 @@ func (s *IntegrationTestSuite) SetupSuite() { var err error s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { @@ -134,7 +132,7 @@ func (s *IntegrationTestSuite) TestNewMsgCreateVestingAccountCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bw.Bytes(), tc.respType), bw.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) @@ -212,7 +210,7 @@ func (s *IntegrationTestSuite) TestNewMsgCreatePermanentLockedAccountCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bw.Bytes(), tc.respType), bw.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) next, err := s.network.WaitForHeight(height + 1) diff --git a/tests/e2e/bank/client/suite.go b/tests/e2e/bank/client/suite.go index 6256349fda189..9172330050a5c 100644 --- a/tests/e2e/bank/client/suite.go +++ b/tests/e2e/bank/client/suite.go @@ -88,9 +88,7 @@ func (s *EndToEndTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *EndToEndTestSuite) TearDownSuite() { diff --git a/tests/e2e/client/grpc/tmservice/service_test.go b/tests/e2e/client/grpc/tmservice/service_test.go index 5ab389ae31119..34ca8a1b12807 100644 --- a/tests/e2e/client/grpc/tmservice/service_test.go +++ b/tests/e2e/client/grpc/tmservice/service_test.go @@ -55,8 +55,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) s.queryClient = tmservice.NewServiceClient(s.network.Validators[0].ClientCtx) } diff --git a/tests/e2e/crisis/suite.go b/tests/e2e/crisis/suite.go index 1205ab7178419..cbcf948fef598 100644 --- a/tests/e2e/crisis/suite.go +++ b/tests/e2e/crisis/suite.go @@ -3,14 +3,13 @@ package crisis import ( "fmt" - "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/suite" - "github.com/cosmos/cosmos-sdk/client/flags" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/crisis/client/cli" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/suite" ) type IntegrationTestSuite struct { @@ -31,8 +30,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { @@ -56,7 +54,7 @@ func (s *IntegrationTestSuite) TestNewMsgVerifyInvariantTxCmd() { "", "total-supply", fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -67,18 +65,18 @@ func (s *IntegrationTestSuite) TestNewMsgVerifyInvariantTxCmd() { "bank", "", fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, }, { - "valid transaction", + "valid traclientCtx.Codec.UnmarshalJSON(out.Bytes(), nsaction", []string{ "bank", "total-supply", fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -100,7 +98,7 @@ func (s *IntegrationTestSuite) TestNewMsgVerifyInvariantTxCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } diff --git a/tests/e2e/distribution/client/testutil/cli_test.go b/tests/e2e/distribution/cli_test.go similarity index 95% rename from tests/e2e/distribution/client/testutil/cli_test.go rename to tests/e2e/distribution/cli_test.go index ba7dfb8231dba..0029be1e38ae2 100644 --- a/tests/e2e/distribution/client/testutil/cli_test.go +++ b/tests/e2e/distribution/cli_test.go @@ -1,7 +1,7 @@ //go:build e2e // +build e2e -package testutil +package distribution import ( "testing" diff --git a/tests/e2e/evidence/suite.go b/tests/e2e/evidence/suite.go index 7e683a577adec..7851345356ea1 100644 --- a/tests/e2e/evidence/suite.go +++ b/tests/e2e/evidence/suite.go @@ -28,8 +28,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { diff --git a/tests/e2e/feegrant/suite.go b/tests/e2e/feegrant/suite.go index 822e432c7fc4f..bcc1d214aede2 100644 --- a/tests/e2e/feegrant/suite.go +++ b/tests/e2e/feegrant/suite.go @@ -56,8 +56,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) val := s.network.Validators[0] granter := val.Address @@ -81,7 +80,7 @@ func (s *IntegrationTestSuite) createGrant(granter, grantee sdk.Address) { clientCtx := val.ClientCtx commonFlags := []string{ - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(100))).String()), } @@ -103,8 +102,8 @@ func (s *IntegrationTestSuite) createGrant(granter, grantee sdk.Address) { _, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { @@ -248,6 +247,7 @@ func (s *IntegrationTestSuite) TestCmdGetFeeGrantsByGrantee() { } else { s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.resp), out.String()) + s.Require().Len(tc.resp.Allowances, tc.expectLength) } }) @@ -321,7 +321,7 @@ func (s *IntegrationTestSuite) TestNewCmdFeeGrant() { s.Require().NoError(err) commonFlags := []string{ - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } @@ -599,7 +599,7 @@ func (s *IntegrationTestSuite) TestNewCmdFeeGrant() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -612,7 +612,7 @@ func (s *IntegrationTestSuite) TestNewCmdRevokeFeegrant() { clientCtx := val.ClientCtx commonFlags := []string{ - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } @@ -706,7 +706,7 @@ func (s *IntegrationTestSuite) TestNewCmdRevokeFeegrant() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -727,7 +727,7 @@ func (s *IntegrationTestSuite) TestTxWithFeeGrant() { grantee := sdk.AccAddress(pub.Address()) commonFlags := []string{ - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } @@ -749,8 +749,7 @@ func (s *IntegrationTestSuite) TestTxWithFeeGrant() { _, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) testcases := []struct { name string @@ -818,7 +817,7 @@ func (s *IntegrationTestSuite) TestFilteredFeeAllowance() { clientCtx := val.ClientCtx commonFlags := []string{ - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(100))).String()), } @@ -891,7 +890,7 @@ func (s *IntegrationTestSuite) TestFilteredFeeAllowance() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -982,7 +981,7 @@ func (s *IntegrationTestSuite) TestFilteredFeeAllowance() { s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) }) } } diff --git a/tests/e2e/genutil/suite.go b/tests/e2e/genutil/suite.go index 6560192400d96..c4432e353fa65 100644 --- a/tests/e2e/genutil/suite.go +++ b/tests/e2e/genutil/suite.go @@ -37,8 +37,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { diff --git a/tests/e2e/gov/client/testutil/cli_test.go b/tests/e2e/gov/cli_test.go similarity index 86% rename from tests/e2e/gov/client/testutil/cli_test.go rename to tests/e2e/gov/cli_test.go index 356babaef5682..ffea40b2351ff 100644 --- a/tests/e2e/gov/client/testutil/cli_test.go +++ b/tests/e2e/gov/cli_test.go @@ -1,7 +1,7 @@ //go:build e2e // +build e2e -package testutil +package gov import ( "testing" @@ -20,7 +20,11 @@ func TestIntegrationTestSuite(t *testing.T) { cfg := network.DefaultConfig(simapp.NewTestNetworkFixture) cfg.NumValidators = 1 suite.Run(t, testutil.NewIntegrationTestSuite(cfg)) +} +func TestDepositTestSuite(t *testing.T) { + cfg := network.DefaultConfig(simapp.NewTestNetworkFixture) + cfg.NumValidators = 1 genesisState := v1.DefaultGenesisState() maxDepPeriod := time.Duration(15) * time.Second votingPeriod := time.Duration(5) * time.Second diff --git a/tests/e2e/group/query.go b/tests/e2e/group/query.go index 306d62bb8140d..4a02c7fb4b983 100644 --- a/tests/e2e/group/query.go +++ b/tests/e2e/group/query.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/testutil/cli" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/group" client "github.com/cosmos/cosmos-sdk/x/group/client/cli" @@ -54,7 +54,7 @@ func (s *IntegrationTestSuite) TestQueryGroupInfo() { s.Run(tc.name, func() { cmd := client.QueryGroupInfoCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { @@ -78,7 +78,7 @@ func (s *IntegrationTestSuite) TestQueryGroupsByMembers() { require := s.Require() cmd := client.QueryGroupsByAdminCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, []string{val.Address.String(), fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{val.Address.String(), fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) require.NoError(err) var groups group.QueryGroupsByAdminResponse @@ -86,7 +86,7 @@ func (s *IntegrationTestSuite) TestQueryGroupsByMembers() { require.Len(groups.Groups, 1) cmd = client.QueryGroupMembersCmd() - out, err = cli.ExecTestCLICmd(clientCtx, cmd, []string{fmt.Sprintf("%d", groups.Groups[0].Id), fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{fmt.Sprintf("%d", groups.Groups[0].Id), fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) require.NoError(err) var members group.QueryGroupMembersResponse @@ -133,7 +133,7 @@ func (s *IntegrationTestSuite) TestQueryGroupsByMembers() { tc := tc s.Run(tc.name, func() { cmd := client.QueryGroupsByMemberCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { require.Contains(out.String(), tc.expectErrMsg) } else { @@ -194,7 +194,7 @@ func (s *IntegrationTestSuite) TestQueryGroupMembers() { s.Run(tc.name, func() { cmd := client.QueryGroupMembersCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { @@ -260,7 +260,7 @@ func (s *IntegrationTestSuite) TestQueryGroupsByAdmin() { s.Run(tc.name, func() { cmd := client.QueryGroupsByAdminCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { @@ -314,7 +314,7 @@ func (s *IntegrationTestSuite) TestQueryGroupPolicyInfo() { s.Run(tc.name, func() { cmd := client.QueryGroupPolicyInfoCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { @@ -388,7 +388,7 @@ func (s *IntegrationTestSuite) TestQueryGroupPoliciesByGroup() { s.Run(tc.name, func() { cmd := client.QueryGroupPoliciesByGroupCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { @@ -464,7 +464,7 @@ func (s *IntegrationTestSuite) TestQueryGroupPoliciesByAdmin() { s.Run(tc.name, func() { cmd := client.QueryGroupPoliciesByAdminCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { @@ -522,7 +522,7 @@ func (s *IntegrationTestSuite) TestQueryProposal() { s.Run(tc.name, func() { cmd := client.QueryProposalCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { @@ -578,7 +578,7 @@ func (s *IntegrationTestSuite) TestQueryProposalsByGroupPolicy() { s.Run(tc.name, func() { cmd := client.QueryProposalsByGroupPolicyCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { @@ -628,7 +628,7 @@ func (s *IntegrationTestSuite) TestQueryVoteByProposalVoter() { s.Run(tc.name, func() { cmd := client.QueryVoteByProposalVoterCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { @@ -684,7 +684,7 @@ func (s *IntegrationTestSuite) TestQueryVotesByProposal() { s.Run(tc.name, func() { cmd := client.QueryVotesByProposalCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { @@ -747,7 +747,7 @@ func (s *IntegrationTestSuite) TestQueryVotesByVoter() { s.Run(tc.name, func() { cmd := client.QueryVotesByVoterCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { @@ -772,12 +772,12 @@ func (s *IntegrationTestSuite) TestTallyResult() { commonFlags := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } // create a proposal - out, err := cli.ExecTestCLICmd(val.ClientCtx, client.MsgSubmitProposalCmd(), + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, client.MsgSubmitProposalCmd(), append( []string{ s.createCLIProposal( @@ -792,7 +792,10 @@ func (s *IntegrationTestSuite) TestTallyResult() { var txResp sdk.TxResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().Equal(uint32(0), txResp.Code, out.String()) + txResp, err = clitestutil.GetTxResponse(s.network, clientCtx, txResp.TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, uint32(0), out.String()) + proposalID := s.getProposalIDFromTxResponse(txResp) testCases := []struct { @@ -860,7 +863,7 @@ func (s *IntegrationTestSuite) TestTallyResult() { s.Run(tc.name, func() { cmd := client.QueryTallyResultCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { diff --git a/tests/e2e/group/tx.go b/tests/e2e/group/tx.go index 9c9f111fd44b3..7488806c798ea 100644 --- a/tests/e2e/group/tx.go +++ b/tests/e2e/group/tx.go @@ -16,12 +16,14 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/testutil" - "github.com/cosmos/cosmos-sdk/testutil/cli" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/group" client "github.com/cosmos/cosmos-sdk/x/group/client/cli" + "github.com/cosmos/cosmos-sdk/x/group/errors" ) type IntegrationTestSuite struct { @@ -51,16 +53,14 @@ func (s *IntegrationTestSuite) SetupSuite() { s.commonFlags = []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } var err error s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) val := s.network.Validators[0] @@ -72,15 +72,16 @@ func (s *IntegrationTestSuite) SetupSuite() { s.Require().NoError(err) account := sdk.AccAddress(pk.Address()) - _, err = cli.MsgSendExec( + _, err = clitestutil.MsgSendExec( val.ClientCtx, val.Address, account, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(2000))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) memberWeight := "3" // create a group @@ -95,7 +96,7 @@ func (s *IntegrationTestSuite) SetupSuite() { ] }`, val.Address.String(), memberWeight, validMetadata) validMembersFile := testutil.WriteToNewTempFile(s.T(), validMembers) - out, err := cli.ExecTestCLICmd(val.ClientCtx, client.MsgCreateGroupCmd(), + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, client.MsgCreateGroupCmd(), append( []string{ val.Address.String(), @@ -105,11 +106,10 @@ func (s *IntegrationTestSuite) SetupSuite() { s.commonFlags..., ), ) - s.Require().NoError(err, out.String()) txResp := sdk.TxResponse{} s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().Equal(uint32(0), txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, txResp.TxHash, 0)) s.group = &group.GroupInfo{Id: 1, Admin: val.Address.String(), Metadata: validMetadata, TotalWeight: "3", Version: 1} @@ -121,13 +121,13 @@ func (s *IntegrationTestSuite) SetupSuite() { } s.createGroupThresholdPolicyWithBalance(val.Address.String(), "1", threshold, 1000) - - out, err = cli.ExecTestCLICmd(val.ClientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{"1", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{"1", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) s.Require().NoError(err, out.String()) + s.Require().NoError(s.network.WaitForNextBlock()) } percentage := 0.5 // create group policy with percentage decision policy - out, err = cli.ExecTestCLICmd(val.ClientCtx, client.MsgCreateGroupPolicyCmd(), + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, client.MsgCreateGroupPolicyCmd(), append( []string{ val.Address.String(), @@ -140,9 +140,9 @@ func (s *IntegrationTestSuite) SetupSuite() { ) s.Require().NoError(err, out.String()) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().Equal(uint32(0), txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, txResp.TxHash, 0)) - out, err = cli.ExecTestCLICmd(val.ClientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{"1", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{"1", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) s.Require().NoError(err, out.String()) var res group.QueryGroupPoliciesByGroupResponse @@ -151,7 +151,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.groupPolicies = res.GroupPolicies // create a proposal - out, err = cli.ExecTestCLICmd(val.ClientCtx, client.MsgSubmitProposalCmd(), + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, client.MsgSubmitProposalCmd(), append( []string{ s.createCLIProposal( @@ -164,10 +164,10 @@ func (s *IntegrationTestSuite) SetupSuite() { ) s.Require().NoError(err, out.String()) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().Equal(uint32(0), txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, txResp.TxHash, 0)) // vote - out, err = cli.ExecTestCLICmd(val.ClientCtx, client.MsgVoteCmd(), + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, client.MsgVoteCmd(), append( []string{ "1", @@ -180,16 +180,16 @@ func (s *IntegrationTestSuite) SetupSuite() { ) s.Require().NoError(err, out.String()) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().Equal(uint32(0), txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, txResp.TxHash, 0)) - out, err = cli.ExecTestCLICmd(val.ClientCtx, client.QueryProposalCmd(), []string{"1", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, client.QueryProposalCmd(), []string{"1", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) s.Require().NoError(err, out.String()) var proposalRes group.QueryProposalResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &proposalRes)) s.proposal = proposalRes.Proposal - out, err = cli.ExecTestCLICmd(val.ClientCtx, client.QueryVoteByProposalVoterCmd(), []string{"1", val.Address.String(), fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, client.QueryVoteByProposalVoterCmd(), []string{"1", val.Address.String(), fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) s.Require().NoError(err, out.String()) var voteRes group.QueryVoteByProposalVoterResponse @@ -287,10 +287,10 @@ func (s *IntegrationTestSuite) TestTxCreateGroup() { }, s.commonFlags..., ), - true, + false, "group metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, { "invalid members address", @@ -332,10 +332,10 @@ func (s *IntegrationTestSuite) TestTxCreateGroup() { }, s.commonFlags..., ), - true, + false, "member metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, } @@ -345,15 +345,19 @@ func (s *IntegrationTestSuite) TestTxCreateGroup() { s.Run(tc.name, func() { cmd := client.MsgCreateGroupCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { s.Require().NoError(err, out.String()) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, tc.expectedCode) + if tc.expectErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectErrMsg) + } } }) } @@ -362,7 +366,6 @@ func (s *IntegrationTestSuite) TestTxCreateGroup() { func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() { val := s.network.Validators[0] clientCtx := val.ClientCtx - require := s.Require() groupIDs := make([]string, 2) for i := 0; i < 2; i++ { @@ -372,7 +375,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() { "metadata": "%s" }]}`, val.Address.String(), validMetadata) validMembersFile := testutil.WriteToNewTempFile(s.T(), validMembers) - out, err := cli.ExecTestCLICmd(val.ClientCtx, client.MsgCreateGroupCmd(), + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, client.MsgCreateGroupCmd(), append( []string{ val.Address.String(), @@ -382,10 +385,12 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() { s.commonFlags..., ), ) - require.NoError(err, out.String()) + s.Require().NoError(err, out.String()) var txResp sdk.TxResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().Equal(uint32(0), txResp.Code, out.String()) + txResp, err = clitestutil.GetTxResponse(s.network, val.ClientCtx, txResp.TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, uint32(0), out.String()) groupIDs[i] = s.getGroupIDFromTxResponse(txResp) } @@ -453,10 +458,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() { }, s.commonFlags..., ), - true, + false, "not found", - nil, - 0, + &sdk.TxResponse{}, + sdkerrors.ErrNotFound.ABCICode(), }, } @@ -466,15 +471,19 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() { s.Run(tc.name, func() { cmd := client.MsgUpdateGroupAdminCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { - require.Contains(out.String(), tc.expectErrMsg) + s.Require().Contains(out.String(), tc.expectErrMsg) } else { - require.NoError(err, out.String()) - require.NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) + s.Require().NoError(err, out.String()) + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) - require.Equal(tc.expectedCode, txResp.Code, out.String()) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, tc.expectedCode) + if tc.expectErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectErrMsg) + } } }) } @@ -533,10 +542,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMetadata() { }, s.commonFlags..., ), - true, + false, "group metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, } @@ -546,15 +555,19 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMetadata() { s.Run(tc.name, func() { cmd := client.MsgUpdateGroupMetadataCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { s.Require().NoError(err, out.String()) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, tc.expectedCode) + if tc.expectErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectErrMsg) + } } }) } @@ -640,10 +653,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMembers() { }, s.commonFlags..., ), - true, + false, "group member metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, { "group doesn't exist", @@ -655,10 +668,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMembers() { }, s.commonFlags..., ), - true, + false, "not found", - nil, - 0, + &sdk.TxResponse{}, + sdkerrors.ErrNotFound.ABCICode(), }, } @@ -668,15 +681,19 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMembers() { s.Run(tc.name, func() { cmd := client.MsgUpdateGroupMembersCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { s.Require().NoError(err, out.String()) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, tc.expectedCode) + if tc.expectErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectErrMsg) + } } }) } @@ -790,10 +807,10 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() { }, s.commonFlags..., ), - true, + false, "group metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, { "group policy metadata too long", @@ -808,10 +825,10 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() { }, s.commonFlags..., ), - true, + false, "group policy metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, { "invalid members address", @@ -862,10 +879,10 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() { }, s.commonFlags..., ), - true, + false, "member metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, } for _, tc := range testCases { @@ -874,15 +891,19 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() { s.Run(tc.name, func() { cmd := client.MsgCreateGroupWithPolicyCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { s.Require().NoError(err, out.String()) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, tc.expectedCode) + if tc.expectErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectErrMsg) + } } }) } @@ -981,10 +1002,10 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() { }, s.commonFlags..., ), - true, + false, "group policy metadata: limit exceeded", &sdk.TxResponse{}, - 0, + errors.ErrMaxLimit.ABCICode(), }, { "wrong group id", @@ -997,10 +1018,10 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() { }, s.commonFlags..., ), - true, + false, "not found", &sdk.TxResponse{}, - 0, + sdkerrors.ErrNotFound.ABCICode(), }, { "invalid percentage decision policy with negative value", @@ -1042,15 +1063,19 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() { s.Run(tc.name, func() { cmd := client.MsgCreateGroupPolicyCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { s.Require().NoError(err, out.String()) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, tc.expectedCode) + if tc.expectErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectErrMsg) + } } }) } @@ -1129,10 +1154,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyAdmin() { }, commonFlags..., ), - true, + false, "load group policy: not found", &sdk.TxResponse{}, - 0, + sdkerrors.ErrNotFound.ABCICode(), }, } @@ -1142,7 +1167,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyAdmin() { s.Run(tc.name, func() { cmd := client.MsgUpdateGroupPolicyAdminCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { @@ -1150,7 +1175,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyAdmin() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1244,10 +1269,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyDecisionPolicy() { }, commonFlags..., ), - true, + false, "load group policy: not found", &sdk.TxResponse{}, - 0, + sdkerrors.ErrNotFound.ABCICode(), }, { "invalid percentage decision policy with negative value", @@ -1287,7 +1312,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyDecisionPolicy() { s.Run(tc.name, func() { cmd := client.MsgUpdateGroupPolicyDecisionPolicyCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { @@ -1295,7 +1320,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyDecisionPolicy() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1359,10 +1384,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyMetadata() { }, commonFlags..., ), - true, + false, "group policy metadata: limit exceeded", &sdk.TxResponse{}, - 0, + errors.ErrMaxLimit.ABCICode(), }, { "wrong admin", @@ -1389,10 +1414,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyMetadata() { }, commonFlags..., ), - true, + false, "load group policy: not found", &sdk.TxResponse{}, - 0, + sdkerrors.ErrNotFound.ABCICode(), }, } @@ -1402,15 +1427,19 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyMetadata() { s.Run(tc.name, func() { cmd := client.MsgUpdateGroupPolicyMetadataCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { s.Require().NoError(err, out.String()) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, tc.expectedCode) + if tc.expectErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectErrMsg) + } } }) } @@ -1510,10 +1539,10 @@ func (s *IntegrationTestSuite) TestTxSubmitProposal() { }, s.commonFlags..., ), - true, + false, "metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, { "unauthorized msg", @@ -1526,10 +1555,10 @@ func (s *IntegrationTestSuite) TestTxSubmitProposal() { }, s.commonFlags..., ), - true, + false, "msg does not have group policy authorization", - nil, - 0, + &sdk.TxResponse{}, + sdkerrors.ErrUnauthorized.ABCICode(), }, { "invalid proposers", @@ -1577,10 +1606,10 @@ func (s *IntegrationTestSuite) TestTxSubmitProposal() { }, s.commonFlags..., ), - true, + false, "group policy: not found", - nil, - 0, + &sdk.TxResponse{}, + sdkerrors.ErrNotFound.ABCICode(), }, } @@ -1590,15 +1619,19 @@ func (s *IntegrationTestSuite) TestTxSubmitProposal() { s.Run(tc.name, func() { cmd := client.MsgSubmitProposalCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { s.Require().NoError(err, out.String()) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, tc.expectedCode) + if tc.expectErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectErrMsg) + } } }) } @@ -1616,7 +1649,7 @@ func (s *IntegrationTestSuite) TestTxVote() { groupPolicyAddress := s.createGroupThresholdPolicyWithBalance(accounts[0], groupID, 3, 100) for i := 0; i < 4; i++ { - out, err := cli.ExecTestCLICmd(val.ClientCtx, client.MsgSubmitProposalCmd(), + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, client.MsgSubmitProposalCmd(), append( []string{ s.createCLIProposal( @@ -1632,7 +1665,9 @@ func (s *IntegrationTestSuite) TestTxVote() { var txResp sdk.TxResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().Equal(uint32(0), txResp.Code, out.String()) + txResp, err = clitestutil.GetTxResponse(s.network, val.ClientCtx, txResp.TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, uint32(0), out.String()) ids[i] = s.getProposalIDFromTxResponse(txResp) } @@ -1738,10 +1773,10 @@ func (s *IntegrationTestSuite) TestTxVote() { }, s.commonFlags..., ), - true, + false, "proposal: not found", - nil, - 0, + &sdk.TxResponse{}, + sdkerrors.ErrNotFound.ABCICode(), }, { "metadata too long", @@ -1754,10 +1789,10 @@ func (s *IntegrationTestSuite) TestTxVote() { }, s.commonFlags..., ), - true, + false, "metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, { "invalid vote option", @@ -1783,15 +1818,19 @@ func (s *IntegrationTestSuite) TestTxVote() { s.Run(tc.name, func() { cmd := client.MsgVoteCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { s.Require().NoError(err, out.String()) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, tc.expectedCode) + if tc.expectErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectErrMsg) + } } }) } @@ -1804,7 +1843,7 @@ func (s *IntegrationTestSuite) TestTxWithdrawProposal() { ids := make([]string, 2) for i := 0; i < 2; i++ { - out, err := cli.ExecTestCLICmd(val.ClientCtx, client.MsgSubmitProposalCmd(), + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, client.MsgSubmitProposalCmd(), append( []string{ s.createCLIProposal( @@ -1819,7 +1858,9 @@ func (s *IntegrationTestSuite) TestTxWithdrawProposal() { var txResp sdk.TxResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().Equal(uint32(0), txResp.Code, out.String()) + txResp, err = clitestutil.GetTxResponse(s.network, val.ClientCtx, txResp.TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, uint32(0), out.String()) ids[i] = s.getProposalIDFromTxResponse(txResp) } @@ -1854,10 +1895,10 @@ func (s *IntegrationTestSuite) TestTxWithdrawProposal() { }, s.commonFlags..., ), - true, + false, "cannot withdraw a proposal with the status of PROPOSAL_STATUS_WITHDRAWN", &sdk.TxResponse{}, - 0, + errors.ErrInvalid.ABCICode(), }, { "proposal not found", @@ -1909,15 +1950,19 @@ func (s *IntegrationTestSuite) TestTxWithdrawProposal() { s.Run(tc.name, func() { cmd := client.MsgWithdrawProposalCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { s.Require().Contains(out.String(), tc.expectErrMsg) } else { s.Require().NoError(err, out.String()) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, tc.expectedCode) + if tc.expectErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectErrMsg) + } } }) } @@ -1941,12 +1986,11 @@ func (s *IntegrationTestSuite) getProposalIDFromTxResponse(txResp sdk.TxResponse func (s *IntegrationTestSuite) TestTxExec() { val := s.network.Validators[0] clientCtx := val.ClientCtx - require := s.Require() var proposalIDs []string // create proposals and vote for i := 0; i < 2; i++ { - out, err := cli.ExecTestCLICmd(val.ClientCtx, client.MsgSubmitProposalCmd(), + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, client.MsgSubmitProposalCmd(), append( []string{ s.createCLIProposal( @@ -1958,15 +2002,17 @@ func (s *IntegrationTestSuite) TestTxExec() { s.commonFlags..., ), ) - require.NoError(err, out.String()) + s.Require().NoError(err, out.String()) var txResp sdk.TxResponse - require.NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - require.Equal(uint32(0), txResp.Code, out.String()) + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) + txResp, err = clitestutil.GetTxResponse(s.network, clientCtx, txResp.TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, uint32(0), out.String()) proposalID := s.getProposalIDFromTxResponse(txResp) proposalIDs = append(proposalIDs, proposalID) - out, err = cli.ExecTestCLICmd(val.ClientCtx, client.MsgVoteCmd(), + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, client.MsgVoteCmd(), append( []string{ proposalID, @@ -1977,7 +2023,8 @@ func (s *IntegrationTestSuite) TestTxExec() { s.commonFlags..., ), ) - require.NoError(err, out.String()) + s.Require().NoError(err, out.String()) + s.Require().NoError(s.network.WaitForNextBlock()) } testCases := []struct { @@ -2040,10 +2087,10 @@ func (s *IntegrationTestSuite) TestTxExec() { }, s.commonFlags..., ), - true, + false, "proposal: not found", - nil, - 0, + &sdk.TxResponse{}, + sdkerrors.ErrNotFound.ABCICode(), }, } @@ -2053,15 +2100,19 @@ func (s *IntegrationTestSuite) TestTxExec() { s.Run(tc.name, func() { cmd := client.MsgExecCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { - require.Contains(out.String(), tc.expectErrMsg) + s.Require().Contains(out.String(), tc.expectErrMsg) } else { - require.NoError(err, out.String()) - require.NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) + s.Require().NoError(err, out.String()) + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) - require.Equal(tc.expectedCode, txResp.Code, out.String()) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, tc.expectedCode) + if tc.expectErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectErrMsg) + } } }) } @@ -2070,7 +2121,6 @@ func (s *IntegrationTestSuite) TestTxExec() { func (s *IntegrationTestSuite) TestTxLeaveGroup() { val := s.network.Validators[0] clientCtx := val.ClientCtx - require := s.Require() // create 3 accounts with some tokens members := s.createAccounts(3) @@ -2090,7 +2140,7 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { "metadata": "AQ==" }]}`, members[0], members[1], members[2]) validMembersFile := testutil.WriteToNewTempFile(s.T(), validMembers) - out, err := cli.ExecTestCLICmd(clientCtx, client.MsgCreateGroupCmd(), + out, err := clitestutil.ExecTestCLICmd(clientCtx, client.MsgCreateGroupCmd(), append( []string{ val.Address.String(), @@ -2100,13 +2150,15 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { s.commonFlags..., ), ) - require.NoError(err, out.String()) + s.Require().NoError(err, out.String()) var txResp sdk.TxResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) + txResp, err = clitestutil.GetTxResponse(s.network, val.ClientCtx, txResp.TxHash) + s.Require().NoError(err) groupID := s.getGroupIDFromTxResponse(txResp) // create group policy - out, err = cli.ExecTestCLICmd(clientCtx, client.MsgCreateGroupPolicyCmd(), + out, err = clitestutil.ExecTestCLICmd(clientCtx, client.MsgCreateGroupPolicyCmd(), append( []string{ val.Address.String(), @@ -2117,20 +2169,22 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { s.commonFlags..., ), ) - require.NoError(err, out.String()) + s.Require().NoError(err, out.String()) + s.Require().NoError(s.network.WaitForNextBlock()) - out, err = cli.ExecTestCLICmd(clientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{groupID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) - require.NoError(err, out.String()) - require.NotNil(out) + out, err = clitestutil.ExecTestCLICmd(clientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{groupID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err, out.String()) + s.Require().NotNil(out) var resp group.QueryGroupPoliciesByGroupResponse - require.NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.Len(resp.GroupPolicies, 1) + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp)) + s.Require().Len(resp.GroupPolicies, 1) testCases := []struct { - name string - args []string - expectErr bool - errMsg string + name string + args []string + expectErr bool + errMsg string + expectedCode uint32 }{ { "invalid member address", @@ -2144,6 +2198,7 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { ), true, "key not found", + 0, }, { "group not found", @@ -2155,8 +2210,9 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { }, s.commonFlags..., ), - true, + false, "group: not found", + sdkerrors.ErrNotFound.ABCICode(), }, { "valid case", @@ -2170,6 +2226,7 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { ), false, "", + 0, }, { "not part of group", @@ -2181,8 +2238,9 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { }, s.commonFlags..., ), - true, + false, "is not part of group", + sdkerrors.ErrNotFound.ABCICode(), }, { "can leave group policy threshold is more than group weight", @@ -2196,6 +2254,7 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { ), false, "", + 0, }, } @@ -2204,13 +2263,14 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { s.Run(tc.name, func() { cmd := client.MsgLeaveGroupCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.expectErr { - require.Contains(out.String(), tc.errMsg) + s.Require().Contains(out.String(), tc.errMsg) } else { - require.NoError(err, out.String()) + s.Require().NoError(err, out.String()) var resp sdk.TxResponse - require.NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, tc.expectedCode)) } }) } @@ -2246,11 +2306,11 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { }, s.commonFlags..., ) - out, err := cli.ExecTestCLICmd(clientCtx, client.MsgLeaveGroupCmd(), args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, client.MsgLeaveGroupCmd(), args) s.Require().NoError(err, out.String()) var resp sdk.TxResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) - s.Require().Equal(uint32(0), resp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0)) return err }, @@ -2273,11 +2333,11 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { }, s.commonFlags..., ) - out, err := cli.ExecTestCLICmd(clientCtx, client.MsgLeaveGroupCmd(), args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, client.MsgLeaveGroupCmd(), args) s.Require().NoError(err, out.String()) var resp sdk.TxResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) - s.Require().Equal(uint32(0), resp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0)) return err }, @@ -2300,11 +2360,11 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { }, s.commonFlags..., ) - out, err := cli.ExecTestCLICmd(clientCtx, client.MsgLeaveGroupCmd(), args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, client.MsgLeaveGroupCmd(), args) s.Require().NoError(err, out.String()) var resp sdk.TxResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) - s.Require().Equal(uint32(0), resp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0)) return err }, @@ -2332,11 +2392,11 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { }, s.commonFlags..., ) - out, err := cli.ExecTestCLICmd(clientCtx, client.MsgUpdateGroupMembersCmd(), args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, client.MsgUpdateGroupMembersCmd(), args) s.Require().NoError(err, out.String()) var resp sdk.TxResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) - s.Require().Equal(uint32(0), resp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0)) return err }, @@ -2368,14 +2428,16 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { s.commonFlags..., ) var submitProposalResp sdk.TxResponse - out, err := cli.ExecTestCLICmd(clientCtx, cmdSubmitProposal, submitProposalArgs) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmdSubmitProposal, submitProposalArgs) s.Require().NoError(err, out.String()) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &submitProposalResp), out.String()) + submitProposalResp, err = clitestutil.GetTxResponse(s.network, val.ClientCtx, submitProposalResp.TxHash) + s.Require().NoError(err) proposalID := s.getProposalIDFromTxResponse(submitProposalResp) for i, vote := range tc.votes { memberAddress := tc.members[i] - out, err = cli.ExecTestCLICmd(val.ClientCtx, client.MsgVoteCmd(), + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, client.MsgVoteCmd(), append( []string{ proposalID, @@ -2390,15 +2452,13 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { var txResp sdk.TxResponse s.Require().NoError(err, out.String()) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().Equal(uint32(0), txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, 0)) } err = tc.malleate(groupID) s.Require().NoError(err) - - err = s.network.WaitForNextBlock() - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) args := append( []string{ @@ -2407,11 +2467,13 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { }, s.commonFlags..., ) - out, err = cli.ExecTestCLICmd(clientCtx, cmdMsgExec, args) + out, err = clitestutil.ExecTestCLICmd(clientCtx, cmdMsgExec, args) s.Require().NoError(err) var execResp sdk.TxResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &execResp), out.String()) + execResp, err = clitestutil.GetTxResponse(s.network, val.ClientCtx, execResp.TxHash) + s.Require().NoError(err) if tc.expectLogErr { s.Require().Contains(execResp.RawLog, tc.errMsg) @@ -2480,17 +2542,18 @@ func (s *IntegrationTestSuite) createAccounts(quantity int) []string { account := sdk.AccAddress(pk.Address()) accounts[i-1] = account.String() - _, err = cli.MsgSendExec( + _, err = clitestutil.MsgSendExec( val.ClientCtx, val.Address, account, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(2000))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), ) s.Require().NoError(err) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } + return accounts } @@ -2506,7 +2569,7 @@ func (s *IntegrationTestSuite) createGroupWithMembers(membersWeight, membersAddr s.Require().NoError(err) validMembersFile := testutil.WriteToNewTempFile(s.T(), string(membersByte)) - out, err := cli.ExecTestCLICmd(clientCtx, client.MsgCreateGroupCmd(), + out, err := clitestutil.ExecTestCLICmd(clientCtx, client.MsgCreateGroupCmd(), append( []string{ membersAddress[0], @@ -2519,14 +2582,18 @@ func (s *IntegrationTestSuite) createGroupWithMembers(membersWeight, membersAddr s.Require().NoError(err, out.String()) var txResp sdk.TxResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) + txResp, err = clitestutil.GetTxResponse(s.network, val.ClientCtx, txResp.TxHash) + s.Require().NoError(err) return s.getGroupIDFromTxResponse(txResp) } func (s *IntegrationTestSuite) createGroupThresholdPolicyWithBalance(adminAddress, groupID string, threshold int, tokens int64) string { + s.Require().NoError(s.network.WaitForNextBlock()) + val := s.network.Validators[0] clientCtx := val.ClientCtx - out, err := cli.ExecTestCLICmd(clientCtx, client.MsgCreateGroupPolicyCmd(), + out, err := clitestutil.ExecTestCLICmd(clientCtx, client.MsgCreateGroupPolicyCmd(), append( []string{ adminAddress, @@ -2540,9 +2607,9 @@ func (s *IntegrationTestSuite) createGroupThresholdPolicyWithBalance(adminAddres txResp := sdk.TxResponse{} s.Require().NoError(err, out.String()) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().Equal(uint32(0), txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, txResp.TxHash, 0)) - out, err = cli.ExecTestCLICmd(val.ClientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{groupID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{groupID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) s.Require().NoError(err, out.String()) var res group.QueryGroupPoliciesByGroupResponse @@ -2551,7 +2618,7 @@ func (s *IntegrationTestSuite) createGroupThresholdPolicyWithBalance(adminAddres addr, err := sdk.AccAddressFromBech32(groupPolicyAddress) s.Require().NoError(err) - _, err = cli.MsgSendExec(clientCtx, val.Address, addr, + _, err = clitestutil.MsgSendExec(clientCtx, val.Address, addr, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(tokens))), s.commonFlags..., ) diff --git a/tests/e2e/mint/suite.go b/tests/e2e/mint/suite.go index 8047f3c86fb93..4f62902d157e5 100644 --- a/tests/e2e/mint/suite.go +++ b/tests/e2e/mint/suite.go @@ -47,8 +47,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { diff --git a/tests/e2e/nft/tx.go b/tests/e2e/nft/tx.go index 919e8e8bb9f97..88ef5b3168c1a 100644 --- a/tests/e2e/nft/tx.go +++ b/tests/e2e/nft/tx.go @@ -80,13 +80,10 @@ func (s *IntegrationTestSuite) SetupSuite() { s.cfg.GenesisState = genesisState s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) s.initAccount() - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { @@ -99,7 +96,7 @@ func (s *IntegrationTestSuite) TestCLITxSend() { args := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, OwnerName), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } testCases := []struct { @@ -135,7 +132,7 @@ func (s *IntegrationTestSuite) TestCLITxSend() { var txResp sdk.TxResponse s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -152,7 +149,7 @@ func (s *IntegrationTestSuite) initAccount() { args := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } diff --git a/tests/e2e/slashing/client/testutil/suite.go b/tests/e2e/slashing/client/testutil/suite.go index 49854498bc703..2a8ee58dc3370 100644 --- a/tests/e2e/slashing/client/testutil/suite.go +++ b/tests/e2e/slashing/client/testutil/suite.go @@ -13,6 +13,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/slashing/client/cli" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" ) type EndToEndTestSuite struct { @@ -35,8 +36,7 @@ func (s *EndToEndTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } // TearDownSuite performs cleanup logic after all the tests, i.e. once after the @@ -159,7 +159,7 @@ func (s *EndToEndTestSuite) TestNewUnjailTxCmd() { fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // sync mode as there are no funds yet fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, - false, 0, &sdk.TxResponse{}, + false, slashingtypes.ErrValidatorNotJailed.ABCICode(), &sdk.TxResponse{}, }, } @@ -178,7 +178,7 @@ func (s *EndToEndTestSuite) TestNewUnjailTxCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } diff --git a/tests/e2e/staking/client/testutil/suite.go b/tests/e2e/staking/client/testutil/suite.go index 60947b24c8b30..f4ecf45c0688e 100644 --- a/tests/e2e/staking/client/testutil/suite.go +++ b/tests/e2e/staking/client/testutil/suite.go @@ -48,9 +48,7 @@ func (s *IntegrationTestSuite) SetupSuite() { var err error s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) unbond, err := sdk.ParseCoinNormalized("10stake") s.Require().NoError(err) @@ -71,24 +69,24 @@ func (s *IntegrationTestSuite) SetupSuite() { var txRes sdk.TxResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txRes)) s.Require().Equal(uint32(0), txRes.Code) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) unbondingAmount := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(5)) + // unbonding the amount out, err = MsgUnbondExec(val.ClientCtx, val.Address, val.ValAddress, unbondingAmount) s.Require().NoError(err) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txRes)) s.Require().Equal(uint32(0), txRes.Code) + s.Require().NoError(s.network.WaitForNextBlock()) + // unbonding the amount out, err = MsgUnbondExec(val.ClientCtx, val.Address, val.ValAddress, unbondingAmount) s.Require().NoError(err) s.Require().NoError(err) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txRes)) s.Require().Equal(uint32(0), txRes.Code) - - err = s.network.WaitForNextBlock() - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { @@ -117,10 +115,11 @@ func (s *IntegrationTestSuite) TestNewCreateValidatorCmd() { val.Address, newAddr, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(200))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), ) require.NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) testCases := []struct { name string @@ -142,7 +141,7 @@ func (s *IntegrationTestSuite) TestNewCreateValidatorCmd() { fmt.Sprintf("--%s=1", cli.FlagMinSelfDelegation), fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -161,7 +160,7 @@ func (s *IntegrationTestSuite) TestNewCreateValidatorCmd() { fmt.Sprintf("--%s=1", cli.FlagMinSelfDelegation), fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -181,7 +180,7 @@ func (s *IntegrationTestSuite) TestNewCreateValidatorCmd() { fmt.Sprintf("--%s=1", cli.FlagMinSelfDelegation), fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -202,7 +201,7 @@ func (s *IntegrationTestSuite) TestNewCreateValidatorCmd() { fmt.Sprintf("--%s=1", cli.FlagMinSelfDelegation), fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -223,19 +222,25 @@ func (s *IntegrationTestSuite) TestNewCreateValidatorCmd() { require.NoError(err, "test: %s\noutput: %s", tc.name, out.String()) err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType) require.NoError(err, out.String(), "test: %s, output\n:", tc.name, out.String()) + s.Require().NoError(s.network.WaitForNextBlock()) - txResp := tc.respType.(*sdk.TxResponse) - require.Equal(tc.expectedCode, txResp.Code, - "test: %s, output\n:", tc.name, out.String()) + txRespHash := tc.respType.(*sdk.TxResponse) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, txRespHash.TxHash) + s.Require().NoError(err) + s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + var hadEvent bool events := txResp.Logs[0].GetEvents() for i := 0; i < len(events); i++ { if events[i].GetType() == "create_validator" { attributes := events[i].GetAttributes() require.Equal(attributes[1].Value, "100stake") + hadEvent = true break } } + + s.Require().True(hadEvent) } }) } @@ -975,7 +980,7 @@ func (s *IntegrationTestSuite) TestNewEditValidatorCmd() { []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, "with wrong from address"), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -985,7 +990,7 @@ func (s *IntegrationTestSuite) TestNewEditValidatorCmd() { []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -996,7 +1001,7 @@ func (s *IntegrationTestSuite) TestNewEditValidatorCmd() { fmt.Sprintf("--details=%s", details), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -1007,7 +1012,7 @@ func (s *IntegrationTestSuite) TestNewEditValidatorCmd() { fmt.Sprintf("--identity=%s", identity), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -1018,7 +1023,7 @@ func (s *IntegrationTestSuite) TestNewEditValidatorCmd() { fmt.Sprintf("--security-contact=%s", securityContact), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -1029,7 +1034,7 @@ func (s *IntegrationTestSuite) TestNewEditValidatorCmd() { fmt.Sprintf("--website=%s", website), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -1043,7 +1048,7 @@ func (s *IntegrationTestSuite) TestNewEditValidatorCmd() { fmt.Sprintf("--website=%s", website), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -1065,7 +1070,7 @@ func (s *IntegrationTestSuite) TestNewEditValidatorCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1087,10 +1092,11 @@ func (s *IntegrationTestSuite) TestNewDelegateCmd() { val.Address, newAddr, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(200))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) testCases := []struct { name string @@ -1105,7 +1111,7 @@ func (s *IntegrationTestSuite) TestNewDelegateCmd() { val.ValAddress.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -1116,7 +1122,7 @@ func (s *IntegrationTestSuite) TestNewDelegateCmd() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(150)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -1128,7 +1134,7 @@ func (s *IntegrationTestSuite) TestNewDelegateCmd() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(150)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -1150,7 +1156,7 @@ func (s *IntegrationTestSuite) TestNewDelegateCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1174,7 +1180,7 @@ func (s *IntegrationTestSuite) TestNewRedelegateCmd() { val2.ValAddress.String(), // dst-validator-addr fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -1187,7 +1193,7 @@ func (s *IntegrationTestSuite) TestNewRedelegateCmd() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(150)).String(), // amount fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 3, &sdk.TxResponse{}, @@ -1200,7 +1206,7 @@ func (s *IntegrationTestSuite) TestNewRedelegateCmd() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(150)).String(), // amount fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 31, &sdk.TxResponse{}, @@ -1214,7 +1220,7 @@ func (s *IntegrationTestSuite) TestNewRedelegateCmd() { fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=%d", flags.FlagGas, 300000), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -1236,7 +1242,7 @@ func (s *IntegrationTestSuite) TestNewRedelegateCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1258,7 +1264,7 @@ func (s *IntegrationTestSuite) TestNewUnbondCmd() { val.ValAddress.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -1269,7 +1275,7 @@ func (s *IntegrationTestSuite) TestNewUnbondCmd() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(150)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -1281,7 +1287,7 @@ func (s *IntegrationTestSuite) TestNewUnbondCmd() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(150)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -1303,7 +1309,7 @@ func (s *IntegrationTestSuite) TestNewUnbondCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1324,7 +1330,7 @@ func (s *IntegrationTestSuite) TestNewCancelUnbondingDelegationCmd() { []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -1335,7 +1341,7 @@ func (s *IntegrationTestSuite) TestNewCancelUnbondingDelegationCmd() { val.ValAddress.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -1347,7 +1353,7 @@ func (s *IntegrationTestSuite) TestNewCancelUnbondingDelegationCmd() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(150)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -1360,7 +1366,7 @@ func (s *IntegrationTestSuite) TestNewCancelUnbondingDelegationCmd() { sdk.NewInt(10000).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, sdkerrors.ErrNotFound.ABCICode(), &sdk.TxResponse{}, @@ -1372,7 +1378,7 @@ func (s *IntegrationTestSuite) TestNewCancelUnbondingDelegationCmd() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10000)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, sdkerrors.ErrInvalidRequest.ABCICode(), &sdk.TxResponse{}, @@ -1384,7 +1390,7 @@ func (s *IntegrationTestSuite) TestNewCancelUnbondingDelegationCmd() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(5)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -1422,7 +1428,7 @@ func (s *IntegrationTestSuite) TestNewCancelUnbondingDelegationCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1448,10 +1454,11 @@ func (s *IntegrationTestSuite) TestBlockResults() { val.Address, newAddr, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(200))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), ) require.NoError(err) + require.NoError(s.network.WaitForNextBlock()) // Use CLI to create a delegation from the new account to validator `val`. delHeight, err := s.network.LatestHeight() @@ -1462,10 +1469,11 @@ func (s *IntegrationTestSuite) TestBlockResults() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(150)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }) require.NoError(err) + require.NoError(s.network.WaitForNextBlock()) // Create a HTTP rpc client. rpcClient, err := http.New(val.RPCAddress, "/websocket") @@ -1511,12 +1519,13 @@ func (s *IntegrationTestSuite) TestEditValidatorMoniker() { val.ValAddress.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", cli.FlagEditMoniker, moniker), fmt.Sprintf("--%s=https://newvalidator.io", cli.FlagWebsite), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }) require.NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) queryCmd := cli.GetCmdQueryValidator() res, err := clitestutil.ExecTestCLICmd( @@ -1532,18 +1541,18 @@ func (s *IntegrationTestSuite) TestEditValidatorMoniker() { val.ValAddress.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=https://newvalidator.io", cli.FlagWebsite), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }) require.NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) res, err = clitestutil.ExecTestCLICmd( val.ClientCtx, queryCmd, []string{val.ValAddress.String(), fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, ) require.NoError(err) - require.NoError(val.ClientCtx.Codec.UnmarshalJSON(res.Bytes(), &result)) require.Equal(result.GetMoniker(), moniker) } diff --git a/tests/e2e/staking/client/testutil/test_helpers.go b/tests/e2e/staking/client/testutil/test_helpers.go index 0fa752e057202..c1358319ca7fa 100644 --- a/tests/e2e/staking/client/testutil/test_helpers.go +++ b/tests/e2e/staking/client/testutil/test_helpers.go @@ -13,7 +13,7 @@ import ( var commonArgs = []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), } diff --git a/tests/e2e/tx/service_test.go b/tests/e2e/tx/service_test.go index 89b32212d4818..881804e99e50a 100644 --- a/tests/e2e/tx/service_test.go +++ b/tests/e2e/tx/service_test.go @@ -59,9 +59,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.Require().NoError(err) val := s.network.Validators[0] - - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) s.queryClient = tx.NewServiceClient(val.ClientCtx) @@ -520,9 +518,7 @@ func (s IntegrationTestSuite) TestBroadcastTx_GRPC() { }{ {"nil request", nil, true, "request cannot be nil"}, {"empty request", &tx.BroadcastTxRequest{}, true, "invalid empty tx"}, - {"no mode", &tx.BroadcastTxRequest{ - TxBytes: txBytes, - }, true, "supported types: sync, async, block"}, + {"no mode", &tx.BroadcastTxRequest{TxBytes: txBytes}, true, "supported types: sync, async"}, {"valid request", &tx.BroadcastTxRequest{ Mode: tx.BroadcastMode_BROADCAST_MODE_SYNC, TxBytes: txBytes, @@ -559,7 +555,7 @@ func (s IntegrationTestSuite) TestBroadcastTx_GRPCGateway() { expErrMsg string }{ {"empty request", &tx.BroadcastTxRequest{}, true, "invalid empty tx"}, - {"no mode", &tx.BroadcastTxRequest{TxBytes: txBytes}, true, "supported types: sync, async, block"}, + {"no mode", &tx.BroadcastTxRequest{TxBytes: txBytes}, true, "supported types: sync, async"}, {"valid request", &tx.BroadcastTxRequest{ Mode: tx.BroadcastMode_BROADCAST_MODE_SYNC, TxBytes: txBytes, @@ -605,8 +601,7 @@ func (s *IntegrationTestSuite) TestSimMultiSigTx() { _, err = kr.SaveMultisig("multi", multi) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) multisigRecord, err := val1.ClientCtx.Keyring.Key("multi") s.Require().NoError(err) diff --git a/testutil/cli/tx.go b/testutil/cli/tx.go new file mode 100644 index 0000000000000..dcc6f17460c88 --- /dev/null +++ b/testutil/cli/tx.go @@ -0,0 +1,64 @@ +package cli + +import ( + "fmt" + + tmcli "github.com/tendermint/tendermint/libs/cli" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/testutil/network" + sdk "github.com/cosmos/cosmos-sdk/types" + authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" +) + +// CheckTxCode verifies that the transaction result returns a specific code +// Takes a network, wait for two blocks and fetch the transaction from its hash +func CheckTxCode(network *network.Network, clientCtx client.Context, txHash string, expectedCode uint32) error { + // wait for 2 blocks + for i := 0; i < 2; i++ { + if err := network.WaitForNextBlock(); err != nil { + return fmt.Errorf("failed to wait for next block: %w", err) + } + } + + cmd := authcli.QueryTxCmd() + out, err := ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + if err != nil { + return err + } + + var response sdk.TxResponse + if err := clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response); err != nil { + return err + } + + if response.Code != expectedCode { + return fmt.Errorf("expected code %d, got %d", expectedCode, response.Code) + } + + return nil +} + +// GetTxResponse returns queries the transaction response of a transaction from its hash +// Takes a network, wait for two blocks and fetch the transaction from its hash +func GetTxResponse(network *network.Network, clientCtx client.Context, txHash string) (sdk.TxResponse, error) { + // wait for 2 blocks + for i := 0; i < 2; i++ { + if err := network.WaitForNextBlock(); err != nil { + return sdk.TxResponse{}, fmt.Errorf("failed to wait for next block: %w", err) + } + } + + cmd := authcli.QueryTxCmd() + out, err := ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + if err != nil { + return sdk.TxResponse{}, err + } + + var response sdk.TxResponse + if err := clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response); err != nil { + return sdk.TxResponse{}, err + } + + return response, nil +} diff --git a/testutil/network/doc.go b/testutil/network/doc.go index fa7cc7d7715cd..b00a75aededfc 100644 --- a/testutil/network/doc.go +++ b/testutil/network/doc.go @@ -39,8 +39,7 @@ A typical testing flow might look like the following: s.network, err = network.New(s.T(), s.T().TempDir(), cfg) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { diff --git a/types/result.go b/types/result.go index 20045d23c6584..90849aeba370f 100644 --- a/types/result.go +++ b/types/result.go @@ -83,74 +83,6 @@ func NewResponseResultTx(res *coretypes.ResultTx, anyTx *codectypes.Any, timesta } } -// NewResponseFormatBroadcastTxCommit returns a TxResponse given a -// ResultBroadcastTxCommit from tendermint. -func NewResponseFormatBroadcastTxCommit(res *coretypes.ResultBroadcastTxCommit) *TxResponse { - if res == nil { - return nil - } - - if !res.CheckTx.IsOK() { - return newTxResponseCheckTx(res) - } - - return newTxResponseDeliverTx(res) -} - -func newTxResponseCheckTx(res *coretypes.ResultBroadcastTxCommit) *TxResponse { - if res == nil { - return nil - } - - var txHash string - if res.Hash != nil { - txHash = res.Hash.String() - } - - parsedLogs, _ := ParseABCILogs(res.CheckTx.Log) - - return &TxResponse{ - Height: res.Height, - TxHash: txHash, - Codespace: res.CheckTx.Codespace, - Code: res.CheckTx.Code, - Data: strings.ToUpper(hex.EncodeToString(res.CheckTx.Data)), - RawLog: res.CheckTx.Log, - Logs: parsedLogs, - Info: res.CheckTx.Info, - GasWanted: res.CheckTx.GasWanted, - GasUsed: res.CheckTx.GasUsed, - Events: res.CheckTx.Events, - } -} - -func newTxResponseDeliverTx(res *coretypes.ResultBroadcastTxCommit) *TxResponse { - if res == nil { - return nil - } - - var txHash string - if res.Hash != nil { - txHash = res.Hash.String() - } - - parsedLogs, _ := ParseABCILogs(res.DeliverTx.Log) - - return &TxResponse{ - Height: res.Height, - TxHash: txHash, - Codespace: res.DeliverTx.Codespace, - Code: res.DeliverTx.Code, - Data: strings.ToUpper(hex.EncodeToString(res.DeliverTx.Data)), - RawLog: res.DeliverTx.Log, - Logs: parsedLogs, - Info: res.DeliverTx.Info, - GasWanted: res.DeliverTx.GasWanted, - GasUsed: res.DeliverTx.GasUsed, - Events: res.DeliverTx.Events, - } -} - // NewResponseFormatBroadcastTx returns a TxResponse given a ResultBroadcastTx from tendermint func NewResponseFormatBroadcastTx(res *coretypes.ResultBroadcastTx) *TxResponse { if res == nil { diff --git a/types/result_test.go b/types/result_test.go index 5c58313b11459..a58425c04a577 100644 --- a/types/result_test.go +++ b/types/result_test.go @@ -135,93 +135,6 @@ txhash: "74657374" s.Require().Equal((*sdk.TxResponse)(nil), sdk.NewResponseFormatBroadcastTx(nil)) } -func (s *resultTestSuite) TestResponseFormatBroadcastTxCommit() { - // test nil - s.Require().Equal((*sdk.TxResponse)(nil), sdk.NewResponseFormatBroadcastTxCommit(nil)) - - logs, err := sdk.ParseABCILogs(`[]`) - s.Require().NoError(err) - - // test checkTx - checkTxResult := &coretypes.ResultBroadcastTxCommit{ - Height: 10, - Hash: bytes.HexBytes([]byte("test")), - CheckTx: abci.ResponseCheckTx{ - Code: 90, - Data: nil, - Log: `[]`, - Info: "info", - GasWanted: 99, - GasUsed: 100, - Codespace: "codespace", - Events: []abci.Event{ - { - Type: "message", - Attributes: []abci.EventAttribute{ - { - Key: "action", - Value: "foo", - Index: true, - }, - }, - }, - }, - }, - } - deliverTxResult := &coretypes.ResultBroadcastTxCommit{ - Height: 10, - Hash: bytes.HexBytes([]byte("test")), - DeliverTx: abci.ResponseDeliverTx{ - Code: 90, - Data: nil, - Log: `[]`, - Info: "info", - GasWanted: 99, - GasUsed: 100, - Codespace: "codespace", - Events: []abci.Event{ - { - Type: "message", - Attributes: []abci.EventAttribute{ - { - Key: "action", - Value: "foo", - Index: true, - }, - }, - }, - }, - }, - } - want := &sdk.TxResponse{ - Height: 10, - TxHash: "74657374", - Codespace: "codespace", - Code: 90, - Data: "", - RawLog: `[]`, - Logs: logs, - Info: "info", - GasWanted: 99, - GasUsed: 100, - Events: []abci.Event{ - { - Type: "message", - Attributes: []abci.EventAttribute{ - { - Key: "action", - Value: "foo", - Index: true, - }, - }, - }, - }, - } - - s.Require().Equal(want, sdk.NewResponseFormatBroadcastTxCommit(checkTxResult)) - s.Require().Equal(want, sdk.NewResponseFormatBroadcastTxCommit(deliverTxResult)) -} - func TestWrapServiceResult(t *testing.T) { ctx := sdk.Context{} diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 139e8c66ffa7f..9968a56ea25e8 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -69,9 +69,9 @@ type BroadcastMode int32 const ( // zero-value for mode ordering BroadcastMode_BROADCAST_MODE_UNSPECIFIED BroadcastMode = 0 - // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for - // the tx to be committed in a block. - BroadcastMode_BROADCAST_MODE_BLOCK BroadcastMode = 1 + // DEPRECATED: use BROADCAST_MODE_SYNC instead, + // BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. + BroadcastMode_BROADCAST_MODE_BLOCK BroadcastMode = 1 // Deprecated: Do not use. // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for // a CheckTx execution response only. BroadcastMode_BROADCAST_MODE_SYNC BroadcastMode = 2 @@ -732,70 +732,71 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 1008 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcf, 0x6f, 0x1a, 0xc7, - 0x17, 0xf7, 0x2e, 0x60, 0xc8, 0xc3, 0x4e, 0xc8, 0xd8, 0x5f, 0x7b, 0x43, 0xf2, 0xc5, 0x64, 0x53, - 0x6c, 0x82, 0xe4, 0x5d, 0x85, 0xa6, 0x52, 0x55, 0x55, 0xaa, 0xcc, 0x8f, 0x50, 0x9a, 0x26, 0x44, - 0x8b, 0xab, 0x28, 0x55, 0x25, 0xb4, 0xc0, 0x04, 0x56, 0x81, 0x1d, 0xcc, 0x0c, 0xd6, 0x22, 0xc7, - 0xaa, 0xd4, 0x63, 0x4f, 0x55, 0x7b, 0xe8, 0xbf, 0xd4, 0x63, 0xa4, 0x5e, 0xda, 0x5b, 0x65, 0xf7, - 0xd4, 0x53, 0xff, 0x84, 0x6a, 0x67, 0x07, 0x58, 0x60, 0x89, 0x93, 0x5c, 0xec, 0x19, 0xe6, 0xf3, - 0xde, 0xfb, 0xbc, 0xcf, 0x9b, 0xf7, 0x66, 0x61, 0xaf, 0x45, 0x68, 0x9f, 0x50, 0x9d, 0x39, 0xfa, - 0xe9, 0x83, 0x26, 0x66, 0xe6, 0x03, 0x9d, 0xe2, 0xe1, 0xa9, 0xd5, 0xc2, 0xda, 0x60, 0x48, 0x18, - 0x41, 0x37, 0x3d, 0x80, 0xc6, 0x1c, 0x4d, 0x00, 0x92, 0x77, 0x3a, 0x84, 0x74, 0x7a, 0x58, 0x37, - 0x07, 0x96, 0x6e, 0xda, 0x36, 0x61, 0x26, 0xb3, 0x88, 0x4d, 0x3d, 0x83, 0xe4, 0x3d, 0xe1, 0xb1, - 0x69, 0x52, 0xac, 0x9b, 0xcd, 0x96, 0x35, 0x75, 0xec, 0x6e, 0x04, 0x28, 0xb9, 0x1c, 0x96, 0x39, - 0xe2, 0x2c, 0xe7, 0x77, 0x70, 0x32, 0xc2, 0xc3, 0xf1, 0x14, 0x33, 0x30, 0x3b, 0x96, 0xcd, 0xa3, - 0x09, 0xec, 0x1d, 0x86, 0xed, 0x36, 0x1e, 0xf6, 0x2d, 0x9b, 0xe9, 0x6c, 0x3c, 0xc0, 0x54, 0x6f, - 0xf6, 0x48, 0xeb, 0xd5, 0xca, 0x53, 0xfe, 0xd7, 0x3b, 0x55, 0xff, 0x94, 0x00, 0x55, 0x30, 0x3b, - 0x76, 0x68, 0xf9, 0x14, 0xdb, 0xcc, 0xc0, 0x27, 0x23, 0x4c, 0x19, 0xda, 0x81, 0x75, 0xec, 0xee, - 0xa9, 0x22, 0xa5, 0x43, 0xd9, 0x6b, 0x86, 0xd8, 0xa1, 0xaf, 0x00, 0x66, 0xe1, 0x15, 0x39, 0x2d, - 0x65, 0xe3, 0xf9, 0x7d, 0x4d, 0xa8, 0xe3, 0x72, 0xd5, 0x38, 0xd7, 0x89, 0x4a, 0xda, 0x33, 0xb3, - 0x83, 0x85, 0xcf, 0x82, 0xac, 0x48, 0x86, 0xcf, 0x1a, 0x7d, 0x02, 0x31, 0x32, 0x6c, 0xe3, 0x61, - 0xa3, 0x39, 0x56, 0x42, 0x69, 0x29, 0x7b, 0x3d, 0x9f, 0xd4, 0x96, 0x74, 0xd6, 0x6a, 0x2e, 0xa4, - 0x30, 0x36, 0xa2, 0xc4, 0x5b, 0x20, 0x04, 0xe1, 0x81, 0xd9, 0xc1, 0x4a, 0x38, 0x2d, 0x65, 0xc3, - 0x06, 0x5f, 0xa3, 0x6d, 0x88, 0xf4, 0xac, 0xbe, 0xc5, 0x94, 0x08, 0xff, 0xd1, 0xdb, 0xa8, 0xff, - 0x48, 0xb0, 0x35, 0x97, 0x1b, 0x1d, 0x10, 0x9b, 0x62, 0x74, 0x00, 0x21, 0xe6, 0x78, 0x99, 0xc5, - 0xf3, 0xff, 0x0b, 0x88, 0x79, 0xec, 0x18, 0x2e, 0x02, 0x55, 0x60, 0x83, 0x39, 0x8d, 0xa1, 0xb0, - 0xa3, 0x8a, 0xcc, 0x2d, 0x3e, 0x9a, 0xcb, 0x97, 0xd7, 0xd3, 0x67, 0x28, 0xc0, 0x46, 0x9c, 0x4d, - 0xd7, 0x14, 0x3d, 0x9e, 0x93, 0x2d, 0xc4, 0x65, 0x3b, 0xb8, 0x52, 0x36, 0xcf, 0x7a, 0x49, 0xb7, - 0x6d, 0x88, 0x30, 0xc2, 0xcc, 0x9e, 0x50, 0xc0, 0xdb, 0xa8, 0x18, 0x50, 0x61, 0x48, 0xcc, 0x76, - 0xcb, 0xa4, 0xcc, 0xa5, 0xe1, 0xd5, 0xf1, 0x16, 0xc4, 0x98, 0xd3, 0x68, 0x8e, 0x19, 0x76, 0xf3, - 0x95, 0xb2, 0x1b, 0x46, 0x94, 0x39, 0x05, 0x77, 0x8b, 0x1e, 0x42, 0xb8, 0x4f, 0xda, 0x98, 0x17, - 0xf1, 0x7a, 0x3e, 0x1d, 0x20, 0xc3, 0xd4, 0xdf, 0x13, 0xd2, 0xc6, 0x06, 0x47, 0xab, 0xdf, 0xc1, - 0xd6, 0x5c, 0x18, 0x21, 0x69, 0x19, 0xe2, 0x3e, 0xa5, 0x78, 0xa8, 0x77, 0x15, 0x0a, 0x66, 0x42, - 0xa9, 0xcf, 0xe1, 0x46, 0xdd, 0xea, 0x8f, 0x7a, 0x26, 0x9b, 0xdc, 0x1a, 0x74, 0x1f, 0x64, 0xe6, - 0x08, 0x87, 0xc1, 0xb5, 0xe2, 0x02, 0xc9, 0xcc, 0x99, 0x4b, 0x56, 0x9e, 0x4b, 0x56, 0xfd, 0x51, - 0x82, 0xc4, 0xcc, 0xb3, 0x20, 0xfd, 0x39, 0xc4, 0x3a, 0x26, 0x6d, 0x58, 0xf6, 0x4b, 0x22, 0x02, - 0xdc, 0x5d, 0xcd, 0xb8, 0x62, 0xd2, 0xaa, 0xfd, 0x92, 0x18, 0xd1, 0x8e, 0xb7, 0x40, 0x9f, 0xc2, - 0xfa, 0x10, 0xd3, 0x51, 0x8f, 0x89, 0x36, 0x48, 0xaf, 0xb6, 0x35, 0x38, 0xce, 0x10, 0x78, 0x55, - 0x85, 0x0d, 0x7e, 0x2d, 0x27, 0x29, 0x22, 0x08, 0x77, 0x4d, 0xda, 0xe5, 0x1c, 0xae, 0x19, 0x7c, - 0xad, 0x9e, 0xc3, 0xa6, 0xc0, 0x08, 0xb2, 0x99, 0x2b, 0x75, 0xe0, 0x1a, 0x2c, 0x14, 0x42, 0xfe, - 0xc0, 0x42, 0x38, 0xb0, 0x53, 0xc1, 0xac, 0xe0, 0x8e, 0x91, 0xe7, 0x16, 0xeb, 0x1e, 0x3b, 0xd4, - 0x37, 0x19, 0xba, 0xd8, 0xea, 0x74, 0x19, 0xe7, 0x12, 0x32, 0xc4, 0x0e, 0x3d, 0xfa, 0xf0, 0xc9, - 0xe0, 0xbf, 0xdd, 0xea, 0xbf, 0x12, 0xec, 0x2e, 0x85, 0x7e, 0xdf, 0xc6, 0x7d, 0x08, 0x31, 0x3e, - 0x02, 0x1b, 0x56, 0x5b, 0x50, 0xb9, 0xa5, 0xcd, 0xc6, 0xa0, 0xe6, 0x0d, 0x40, 0x1e, 0xa2, 0x5a, - 0x32, 0xa2, 0x1c, 0x5a, 0x6d, 0xa3, 0x43, 0x88, 0xf0, 0xa5, 0x68, 0xd0, 0xdd, 0x15, 0x26, 0x86, - 0x87, 0x42, 0x95, 0xb9, 0x8c, 0xc3, 0xef, 0xd5, 0xd4, 0xfe, 0x94, 0x73, 0x5f, 0x42, 0x54, 0x4c, - 0x39, 0xa4, 0xc0, 0x76, 0xcd, 0x28, 0x95, 0x8d, 0x46, 0xe1, 0x45, 0xe3, 0x9b, 0xa7, 0xf5, 0x67, - 0xe5, 0x62, 0xf5, 0x51, 0xb5, 0x5c, 0x4a, 0xac, 0xa1, 0x04, 0x6c, 0x4c, 0x4f, 0x8e, 0xea, 0xc5, - 0x84, 0x84, 0x6e, 0xc2, 0xe6, 0xf4, 0x97, 0x52, 0xb9, 0x5e, 0x4c, 0xc8, 0xb9, 0xd7, 0xb0, 0x39, - 0xd7, 0xb4, 0x28, 0x05, 0xc9, 0x82, 0x51, 0x3b, 0x2a, 0x15, 0x8f, 0xea, 0xc7, 0x8d, 0x27, 0xb5, - 0x52, 0x79, 0xc1, 0xab, 0x02, 0xdb, 0x0b, 0xe7, 0x85, 0xaf, 0x6b, 0xc5, 0xc7, 0x09, 0x09, 0xed, - 0xc2, 0xd6, 0xc2, 0x49, 0xfd, 0xc5, 0xd3, 0x62, 0x42, 0x0e, 0x30, 0x39, 0xe2, 0x27, 0xa1, 0xfc, - 0xcf, 0x11, 0x88, 0xd6, 0xbd, 0x77, 0x13, 0x9d, 0x41, 0x6c, 0xd2, 0x6f, 0x48, 0x0d, 0xa8, 0xd4, - 0x42, 0x9b, 0x27, 0xef, 0xbd, 0x15, 0x23, 0x6e, 0xe5, 0xfe, 0x0f, 0xbf, 0xff, 0xfd, 0x8b, 0x9c, - 0x56, 0x6f, 0xeb, 0x01, 0x0f, 0xb6, 0x00, 0x7f, 0x26, 0xe5, 0xd0, 0x09, 0x44, 0x78, 0xf3, 0xa0, - 0xbd, 0x00, 0xaf, 0xfe, 0xd6, 0x4b, 0xa6, 0x57, 0x03, 0x44, 0xcc, 0x0c, 0x8f, 0xb9, 0x87, 0xfe, - 0xaf, 0x07, 0xbd, 0xd6, 0x54, 0x3f, 0x73, 0xdb, 0xf5, 0x1c, 0x7d, 0x0f, 0x71, 0xdf, 0x5c, 0x44, - 0x99, 0xb7, 0x8d, 0xd3, 0x59, 0xf8, 0xfd, 0xab, 0x60, 0x82, 0xc4, 0x5d, 0x4e, 0xe2, 0xb6, 0xba, - 0x13, 0x4c, 0xc2, 0xcd, 0xf9, 0x35, 0xc4, 0x7d, 0x6f, 0x5d, 0x20, 0x81, 0xe5, 0x77, 0x3e, 0x90, - 0x40, 0xc0, 0x93, 0xa9, 0xa6, 0x38, 0x01, 0x05, 0xad, 0x20, 0x80, 0x7e, 0x95, 0xe0, 0xc6, 0x42, - 0xd7, 0xa2, 0xfb, 0xc1, 0xbe, 0x03, 0x86, 0x4a, 0x32, 0xf7, 0x2e, 0x50, 0x41, 0xe5, 0x90, 0x53, - 0x39, 0x40, 0x99, 0x15, 0x05, 0xe1, 0xcd, 0xa9, 0x9f, 0x79, 0x63, 0xe9, 0xbc, 0xf0, 0xc5, 0x6f, - 0x17, 0x29, 0xe9, 0xcd, 0x45, 0x4a, 0xfa, 0xeb, 0x22, 0x25, 0xfd, 0x74, 0x99, 0x5a, 0x7b, 0x73, - 0x99, 0x5a, 0xfb, 0xe3, 0x32, 0xb5, 0xf6, 0x6d, 0xa6, 0x63, 0xb1, 0xee, 0xa8, 0xa9, 0xb5, 0x48, - 0x7f, 0xe2, 0xca, 0xfb, 0x77, 0x48, 0xdb, 0xaf, 0x26, 0x9f, 0x4a, 0x4e, 0x73, 0x9d, 0x7f, 0x28, - 0x7d, 0xfc, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x12, 0x2b, 0xbc, 0x25, 0x0a, 0x00, 0x00, + // 1013 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcf, 0x6f, 0x1a, 0x47, + 0x14, 0xf6, 0x2e, 0x60, 0xc8, 0xc3, 0x4e, 0xc8, 0xd8, 0xb5, 0x09, 0x71, 0x31, 0xd9, 0xd4, 0x3f, + 0x62, 0xc9, 0xbb, 0x0a, 0x4d, 0xa5, 0xaa, 0xaa, 0x54, 0x99, 0x1f, 0xa1, 0x34, 0x4d, 0x88, 0x06, + 0x57, 0x51, 0xaa, 0x4a, 0x68, 0x81, 0x09, 0xac, 0x02, 0x3b, 0x98, 0x19, 0xac, 0x45, 0xae, 0xd5, + 0xaa, 0xc7, 0x9e, 0xaa, 0xf6, 0xd0, 0x7f, 0xa9, 0xc7, 0x48, 0xbd, 0xb4, 0xb7, 0xca, 0xee, 0xa9, + 0xa7, 0xfe, 0x09, 0xd1, 0xce, 0x0e, 0xb0, 0xc0, 0x12, 0x27, 0xb9, 0xd8, 0x33, 0xcc, 0xf7, 0xde, + 0xfb, 0xde, 0xf7, 0xe6, 0xbd, 0x59, 0xd8, 0x6e, 0x50, 0xd6, 0xa5, 0xcc, 0xe0, 0x8e, 0x71, 0x7a, + 0xbf, 0x4e, 0xb8, 0x79, 0xdf, 0x60, 0xa4, 0x7f, 0x6a, 0x35, 0x88, 0xde, 0xeb, 0x53, 0x4e, 0xd1, + 0x4d, 0x0f, 0xa0, 0x73, 0x47, 0x97, 0x80, 0xd4, 0x56, 0x8b, 0xd2, 0x56, 0x87, 0x18, 0x66, 0xcf, + 0x32, 0x4c, 0xdb, 0xa6, 0xdc, 0xe4, 0x16, 0xb5, 0x99, 0x67, 0x90, 0xba, 0x2b, 0x3d, 0xd6, 0x4d, + 0x46, 0x0c, 0xb3, 0xde, 0xb0, 0xc6, 0x8e, 0xdd, 0x8d, 0x04, 0xa5, 0xe6, 0xc3, 0x72, 0x47, 0x9e, + 0x1d, 0xf8, 0x1d, 0x9c, 0x0c, 0x48, 0x7f, 0x38, 0xc6, 0xf4, 0xcc, 0x96, 0x65, 0x8b, 0x68, 0x12, + 0xbb, 0xc5, 0x89, 0xdd, 0x24, 0xfd, 0xae, 0x65, 0x73, 0x83, 0x0f, 0x7b, 0x84, 0x19, 0xf5, 0x0e, + 0x6d, 0xbc, 0x5c, 0x78, 0x2a, 0xfe, 0x7a, 0xa7, 0xda, 0xdf, 0x0a, 0xa0, 0x12, 0xe1, 0xc7, 0x0e, + 0x2b, 0x9e, 0x12, 0x9b, 0x63, 0x72, 0x32, 0x20, 0x8c, 0xa3, 0x0d, 0x58, 0x26, 0xee, 0x9e, 0x25, + 0x95, 0x4c, 0x68, 0xff, 0x1a, 0x96, 0x3b, 0xf4, 0x15, 0xc0, 0x24, 0x7c, 0x52, 0xcd, 0x28, 0xfb, + 0xf1, 0xec, 0xae, 0x2e, 0xd5, 0x71, 0xb9, 0xea, 0x82, 0xeb, 0x48, 0x25, 0xfd, 0xa9, 0xd9, 0x22, + 0xd2, 0x67, 0x4e, 0x4d, 0x2a, 0xd8, 0x67, 0x8d, 0x3e, 0x81, 0x18, 0xed, 0x37, 0x49, 0xbf, 0x56, + 0x1f, 0x26, 0x43, 0x19, 0x65, 0xff, 0x7a, 0x36, 0xa5, 0xcf, 0xe9, 0xac, 0x57, 0x5c, 0x48, 0x6e, + 0x88, 0xa3, 0xd4, 0x5b, 0x20, 0x04, 0xe1, 0x9e, 0xd9, 0x22, 0xc9, 0x70, 0x46, 0xd9, 0x0f, 0x63, + 0xb1, 0x46, 0xeb, 0x10, 0xe9, 0x58, 0x5d, 0x8b, 0x27, 0x23, 0xe2, 0x47, 0x6f, 0xa3, 0xfd, 0xa7, + 0xc0, 0xda, 0x54, 0x6e, 0xac, 0x47, 0x6d, 0x46, 0xd0, 0x1e, 0x84, 0xb8, 0xe3, 0x65, 0x16, 0xcf, + 0x7e, 0x10, 0x10, 0xf3, 0xd8, 0xc1, 0x2e, 0x02, 0x95, 0x60, 0x85, 0x3b, 0xb5, 0xbe, 0xb4, 0x63, + 0x49, 0x55, 0x58, 0x7c, 0x34, 0x95, 0xaf, 0xa8, 0xa7, 0xcf, 0x50, 0x82, 0x71, 0x9c, 0x8f, 0xd7, + 0x0c, 0x3d, 0x9a, 0x92, 0x2d, 0x24, 0x64, 0xdb, 0xbb, 0x52, 0x36, 0xcf, 0x7a, 0x4e, 0xb7, 0x75, + 0x88, 0x70, 0xca, 0xcd, 0x8e, 0x54, 0xc0, 0xdb, 0x68, 0x04, 0x50, 0xae, 0x4f, 0xcd, 0x66, 0xc3, + 0x64, 0xdc, 0xa5, 0xe1, 0xd5, 0xf1, 0x16, 0xc4, 0xb8, 0x53, 0xab, 0x0f, 0x39, 0x71, 0xf3, 0x55, + 0xf6, 0x57, 0x70, 0x94, 0x3b, 0x39, 0x77, 0x8b, 0x1e, 0x40, 0xb8, 0x4b, 0x9b, 0x44, 0x14, 0xf1, + 0x7a, 0x36, 0x13, 0x20, 0xc3, 0xd8, 0xdf, 0x63, 0xda, 0x24, 0x58, 0xa0, 0xb5, 0xef, 0x60, 0x6d, + 0x2a, 0x8c, 0x94, 0xb4, 0x08, 0x71, 0x9f, 0x52, 0x22, 0xd4, 0xdb, 0x0a, 0x05, 0x13, 0xa1, 0xb4, + 0x67, 0x70, 0xa3, 0x6a, 0x75, 0x07, 0x1d, 0x93, 0x8f, 0x6e, 0x0d, 0xba, 0x07, 0x2a, 0x77, 0xa4, + 0xc3, 0xe0, 0x5a, 0x09, 0x81, 0x54, 0xee, 0x4c, 0x25, 0xab, 0x4e, 0x25, 0xab, 0xfd, 0xac, 0x40, + 0x62, 0xe2, 0x59, 0x92, 0xfe, 0x1c, 0x62, 0x2d, 0x93, 0xd5, 0x2c, 0xfb, 0x05, 0x95, 0x01, 0xee, + 0x2c, 0x66, 0x5c, 0x32, 0x59, 0xd9, 0x7e, 0x41, 0x71, 0xb4, 0xe5, 0x2d, 0xd0, 0xa7, 0xb0, 0xdc, + 0x27, 0x6c, 0xd0, 0xe1, 0xb2, 0x0d, 0x32, 0x8b, 0x6d, 0xb1, 0xc0, 0x61, 0x89, 0xd7, 0x34, 0x58, + 0x11, 0xd7, 0x72, 0x94, 0x22, 0x82, 0x70, 0xdb, 0x64, 0x6d, 0xc1, 0xe1, 0x1a, 0x16, 0x6b, 0xed, + 0x1c, 0x56, 0x25, 0x46, 0x92, 0xdd, 0xb9, 0x52, 0x07, 0xa1, 0xc1, 0x4c, 0x21, 0xd4, 0xf7, 0x2c, + 0x84, 0x03, 0x1b, 0x25, 0xc2, 0x73, 0xee, 0x18, 0x79, 0x66, 0xf1, 0xf6, 0xb1, 0xc3, 0x7c, 0x93, + 0xa1, 0x4d, 0xac, 0x56, 0x9b, 0x0b, 0x2e, 0x21, 0x2c, 0x77, 0xe8, 0xe1, 0xfb, 0x4f, 0x06, 0xff, + 0xed, 0xd6, 0xfe, 0x57, 0x60, 0x73, 0x2e, 0xf4, 0xbb, 0x36, 0xee, 0x03, 0x88, 0x89, 0x11, 0x58, + 0xb3, 0x9a, 0x92, 0xca, 0x2d, 0x7d, 0x32, 0x06, 0x75, 0x6f, 0x00, 0x8a, 0x10, 0xe5, 0x02, 0x8e, + 0x0a, 0x68, 0xb9, 0x89, 0x0e, 0x21, 0x22, 0x96, 0xb2, 0x41, 0x37, 0x17, 0x98, 0x60, 0x0f, 0x85, + 0x4a, 0x53, 0x19, 0x87, 0xdf, 0xa9, 0xa9, 0xfd, 0x29, 0x1f, 0x7c, 0x09, 0x51, 0x39, 0xe5, 0x50, + 0x12, 0xd6, 0x2b, 0xb8, 0x50, 0xc4, 0xb5, 0xdc, 0xf3, 0xda, 0x37, 0x4f, 0xaa, 0x4f, 0x8b, 0xf9, + 0xf2, 0xc3, 0x72, 0xb1, 0x90, 0x58, 0x42, 0x09, 0x58, 0x19, 0x9f, 0x1c, 0x55, 0xf3, 0x09, 0x05, + 0xdd, 0x84, 0xd5, 0xf1, 0x2f, 0x85, 0x62, 0x35, 0x9f, 0x50, 0x0f, 0x7e, 0x54, 0x60, 0x75, 0xaa, + 0x6b, 0x51, 0x1a, 0x52, 0x39, 0x5c, 0x39, 0x2a, 0xe4, 0x8f, 0xaa, 0xc7, 0xb5, 0xc7, 0x95, 0x42, + 0x71, 0xc6, 0xed, 0x16, 0xac, 0xcf, 0x9c, 0xe7, 0xbe, 0xae, 0xe4, 0x1f, 0x25, 0x94, 0x94, 0x1a, + 0x53, 0xd0, 0x26, 0xac, 0xcd, 0x9c, 0x56, 0x9f, 0x3f, 0xc9, 0x27, 0x54, 0x97, 0xe7, 0xcc, 0xc1, + 0x91, 0x38, 0x09, 0x65, 0x7f, 0x8d, 0x40, 0xb4, 0xea, 0x3d, 0x9e, 0xe8, 0x0c, 0x62, 0xa3, 0xa6, + 0x43, 0x5a, 0x40, 0xb9, 0x66, 0x7a, 0x3d, 0x75, 0xf7, 0x8d, 0x18, 0x79, 0x35, 0x77, 0x7f, 0xfa, + 0xf3, 0xdf, 0xdf, 0xd4, 0x8c, 0x76, 0xdb, 0x08, 0x78, 0xb5, 0x25, 0xf8, 0x33, 0xe5, 0x00, 0x9d, + 0x40, 0x44, 0x74, 0x10, 0xda, 0x0e, 0xf0, 0xea, 0xef, 0xbf, 0x54, 0x66, 0x31, 0x40, 0xc6, 0xdc, + 0x11, 0x31, 0xb7, 0xd1, 0x87, 0x46, 0xd0, 0x93, 0xcd, 0x8c, 0x33, 0xb7, 0x67, 0xcf, 0xd1, 0x0f, + 0x10, 0xf7, 0x0d, 0x47, 0xb4, 0xf3, 0xa6, 0x99, 0x3a, 0x09, 0xbf, 0x7b, 0x15, 0x4c, 0x92, 0xb8, + 0x23, 0x48, 0xdc, 0xd6, 0x36, 0x82, 0x49, 0xb8, 0x39, 0x7f, 0x0f, 0x71, 0xdf, 0x83, 0x17, 0x48, + 0x60, 0xfe, 0xb1, 0x0f, 0x24, 0x10, 0xf0, 0x6e, 0x6a, 0x69, 0x41, 0x20, 0x89, 0x16, 0x10, 0x40, + 0xbf, 0x2b, 0x70, 0x63, 0xa6, 0x75, 0xd1, 0xbd, 0x60, 0xdf, 0x01, 0x93, 0x25, 0x75, 0xf0, 0x36, + 0x50, 0x49, 0xe5, 0x50, 0x50, 0xd9, 0x43, 0x3b, 0x0b, 0x0a, 0x22, 0x3a, 0xd4, 0x38, 0xf3, 0x66, + 0xd3, 0x79, 0xee, 0x8b, 0x3f, 0x2e, 0xd2, 0xca, 0xab, 0x8b, 0xb4, 0xf2, 0xcf, 0x45, 0x5a, 0xf9, + 0xe5, 0x32, 0xbd, 0xf4, 0xea, 0x32, 0xbd, 0xf4, 0xd7, 0x65, 0x7a, 0xe9, 0xdb, 0x9d, 0x96, 0xc5, + 0xdb, 0x83, 0xba, 0xde, 0xa0, 0xdd, 0x91, 0x2b, 0xef, 0xdf, 0x21, 0x6b, 0xbe, 0x1c, 0x7d, 0x2f, + 0x39, 0xf5, 0x65, 0xf1, 0xb5, 0xf4, 0xf1, 0xeb, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdb, 0xc8, 0xb5, + 0x68, 0x2a, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/auth/client/cli/tx_multisign.go b/x/auth/client/cli/tx_multisign.go index 0a2824ffe6d0c..303defb6dbdb6 100644 --- a/x/auth/client/cli/tx_multisign.go +++ b/x/auth/client/cli/tx_multisign.go @@ -173,7 +173,7 @@ func makeMultiSignCmd() func(cmd *cobra.Command, args []string) (err error) { req := BroadcastReq{ Tx: stdTx, - Mode: "block|sync|async", + Mode: "sync|async", } json, _ = clientCtx.LegacyAmino.MarshalJSON(req) @@ -366,7 +366,7 @@ func makeBatchMultisignCmd() func(cmd *cobra.Command, args []string) error { req := BroadcastReq{ Tx: stdTx, - Mode: "block|sync|async", + Mode: "sync|async", } json, _ = clientCtx.LegacyAmino.MarshalJSON(req) diff --git a/x/auth/client/testutil/suite.go b/x/auth/client/testutil/suite.go index 4e413378cdec1..f262272f0df2d 100644 --- a/x/auth/client/testutil/suite.go +++ b/x/auth/client/testutil/suite.go @@ -81,8 +81,7 @@ func (s *IntegrationTestSuite) SetupSuite() { _, err = kb.SaveMultisig("multi", multi) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { @@ -1584,10 +1583,11 @@ func (s *IntegrationTestSuite) TestSignWithMultiSignersAminoJSON() { res, err := TxBroadcastExec( val0.ClientCtx, signedTxFile.Name(), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), ) - require.NoError(err) + require.NoError(s.network.WaitForNextBlock()) + var txRes sdk.TxResponse require.NoError(val0.ClientCtx.Codec.UnmarshalJSON(res.Bytes(), &txRes)) require.Equal(uint32(0), txRes.Code, txRes.RawLog) @@ -1726,7 +1726,7 @@ func (s *IntegrationTestSuite) TestAuxToFeeWithTips() { feePayerArgs: []string{ fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), }, @@ -1744,7 +1744,7 @@ func (s *IntegrationTestSuite) TestAuxToFeeWithTips() { feePayerArgs: []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), }, @@ -1761,7 +1761,7 @@ func (s *IntegrationTestSuite) TestAuxToFeeWithTips() { feePayerArgs: []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), }, @@ -1778,7 +1778,7 @@ func (s *IntegrationTestSuite) TestAuxToFeeWithTips() { }, feePayerArgs: []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), }, @@ -1795,7 +1795,7 @@ func (s *IntegrationTestSuite) TestAuxToFeeWithTips() { }, feePayerArgs: []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), }, @@ -1813,7 +1813,7 @@ func (s *IntegrationTestSuite) TestAuxToFeeWithTips() { expectErrAux: false, feePayerArgs: []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), fmt.Sprintf("--%s=%s", flags.FlagChainID, "foobar"), @@ -1833,7 +1833,7 @@ func (s *IntegrationTestSuite) TestAuxToFeeWithTips() { feePayerArgs: []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeDirect), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), }, diff --git a/x/authz/client/testutil/grpc.go b/x/authz/client/testutil/grpc.go index f29f858cb22a9..f22ea3fbb9100 100644 --- a/x/authz/client/testutil/grpc.go +++ b/x/authz/client/testutil/grpc.go @@ -114,11 +114,12 @@ func (s *IntegrationTestSuite) TestQueryGrantsGRPC() { fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=%s", cli.FlagMsgType, typeMsgVote), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=%d", cli.FlagExpiration, time.Now().Add(time.Minute*time.Duration(120)).Unix()), }) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) }, func(g *authz.QueryGrantsResponse) { s.Require().Len(g.Grants, 2) diff --git a/x/authz/client/testutil/query.go b/x/authz/client/testutil/query.go index f4326ad4173fc..42584a5999c74 100644 --- a/x/authz/client/testutil/query.go +++ b/x/authz/client/testutil/query.go @@ -28,12 +28,13 @@ func (s *IntegrationTestSuite) TestQueryAuthorizations() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) testCases := []struct { name string @@ -106,12 +107,13 @@ func (s *IntegrationTestSuite) TestQueryAuthorization() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) testCases := []struct { name string diff --git a/x/authz/client/testutil/tx.go b/x/authz/client/testutil/tx.go index 96e0fb1878c61..1c7f7e4a30a7a 100644 --- a/x/authz/client/testutil/tx.go +++ b/x/authz/client/testutil/tx.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/suite" + tmcli "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" @@ -14,6 +15,7 @@ import ( clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" + authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/x/authz" "github.com/cosmos/cosmos-sdk/x/authz/client/cli" bank "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -50,14 +52,13 @@ func (s *IntegrationTestSuite) SetupSuite() { // Create new account in the keyring. s.grantee[0] = s.createAccount("grantee1") s.msgSendExec(s.grantee[0]) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) // create a proposal with deposit _, err = govtestutil.MsgSubmitLegacyProposal(val.ClientCtx, val.Address.String(), "Text Proposal 1", "Where is the title!?", govv1beta1.ProposalTypeText, fmt.Sprintf("--%s=%s", govcli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, govv1.DefaultMinDepositTokens).String())) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) // Create new account in the keyring. s.grantee[1] = s.createAccount("grantee2") @@ -71,15 +72,15 @@ func (s *IntegrationTestSuite) SetupSuite() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=%d", cli.FlagExpiration, time.Now().Add(time.Minute*time.Duration(120)).Unix()), }) s.Require().NoError(err) - s.Require().Contains(out.String(), `"code":0`) - - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) + var response sdk.TxResponse + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, response.TxHash, 0)) // Create new account in the keyring. s.grantee[2] = s.createAccount("grantee3") @@ -91,11 +92,12 @@ func (s *IntegrationTestSuite) SetupSuite() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=%d", cli.FlagExpiration, time.Now().Add(time.Minute*time.Duration(120)).Unix()), }) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) // Create new accounts in the keyring. s.grantee[3] = s.createAccount("grantee4") @@ -113,21 +115,17 @@ func (s *IntegrationTestSuite) SetupSuite() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, time.Now().Add(time.Minute*time.Duration(120)).Unix()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=%s", cli.FlagAllowList, s.grantee[4]), }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) - err = s.network.WaitForNextBlock() - s.Require().NoError(err) - - var response sdk.TxResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(int(response.Code), 0) - s.Require().NotEqual(int(response.Height), 0) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, response.TxHash, 0)) } func (s *IntegrationTestSuite) createAccount(uid string) sdk.AccAddress { @@ -150,11 +148,12 @@ func (s *IntegrationTestSuite) msgSendExec(grantee sdk.AccAddress) { val.Address, grantee, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(200))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), ) s.Require().NoError(err) s.Require().Contains(out.String(), `"code":0`) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { @@ -231,7 +230,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { "generic", fmt.Sprintf("--%s=invalid-msg-type", cli.FlagMsgType), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), @@ -248,7 +247,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagAllowedValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", cli.FlagDenyValidators, val.ValAddress.String()), @@ -266,7 +265,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { fmt.Sprintf("--%s=100xyz", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagAllowedValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -283,7 +282,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { fmt.Sprintf("--%s=100xyz", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagDenyValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -300,7 +299,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { fmt.Sprintf("--%s=100xyz", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagAllowedValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -317,7 +316,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { fmt.Sprintf("--%s=100xyz", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagAllowedValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -334,7 +333,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { fmt.Sprintf("--%s=100stake,20xyz", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagAllowedValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -351,7 +350,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagAllowedValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -368,7 +367,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagDenyValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -385,7 +384,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagAllowedValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -402,7 +401,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagAllowedValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -418,7 +417,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { "send", fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -434,7 +433,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { "send", fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -451,7 +450,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { "send", fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -468,7 +467,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { "generic", fmt.Sprintf("--%s=%s", cli.FlagMsgType, typeMsgVote), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -484,7 +483,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { "generic", fmt.Sprintf("--%s=%s", cli.FlagMsgType, typeMsgVote), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -500,7 +499,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { "generic", fmt.Sprintf("--%s=%s", cli.FlagMsgType, typeMsgVote), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), @@ -514,7 +513,6 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := val.ClientCtx out, err := CreateGrant( val, tc.args, @@ -525,8 +523,8 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { } else { var txResp sdk.TxResponse s.Require().NoError(err) - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -553,12 +551,13 @@ func (s *IntegrationTestSuite) TestCmdRevokeAuthorizations() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) // generic-authorization _, err = CreateGrant( @@ -569,12 +568,13 @@ func (s *IntegrationTestSuite) TestCmdRevokeAuthorizations() { fmt.Sprintf("--%s=%s", cli.FlagMsgType, typeMsgVote), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) // generic-authorization used for amino testing _, err = CreateGrant( @@ -585,13 +585,14 @@ func (s *IntegrationTestSuite) TestCmdRevokeAuthorizations() { fmt.Sprintf("--%s=%s", cli.FlagMsgType, typeMsgSubmitProposal), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON), }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) testCases := []struct { name string @@ -630,7 +631,7 @@ func (s *IntegrationTestSuite) TestCmdRevokeAuthorizations() { grantee.String(), typeMsgSend, fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, @@ -643,7 +644,7 @@ func (s *IntegrationTestSuite) TestCmdRevokeAuthorizations() { grantee.String(), typeMsgVote, fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, @@ -656,7 +657,7 @@ func (s *IntegrationTestSuite) TestCmdRevokeAuthorizations() { grantee.String(), typeMsgSubmitProposal, fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON), @@ -679,7 +680,7 @@ func (s *IntegrationTestSuite) TestCmdRevokeAuthorizations() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -698,7 +699,7 @@ func (s *IntegrationTestSuite) TestExecAuthorizationWithExpiration() { fmt.Sprintf("--%s=%s", cli.FlagMsgType, typeMsgVote), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, tenSeconds), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, @@ -714,15 +715,17 @@ func (s *IntegrationTestSuite) TestExecAuthorizationWithExpiration() { cmd := cli.NewCmdExecAuthorization() clientCtx := val.ClientCtx - res, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), }) s.Require().NoError(err) - s.Require().Contains(res.String(), authz.ErrNoAuthorizationFound.Error()) + var response sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, response.TxHash, authz.ErrNoAuthorizationFound.ABCICode())) } func (s *IntegrationTestSuite) TestNewExecGenericAuthorized() { @@ -738,12 +741,13 @@ func (s *IntegrationTestSuite) TestNewExecGenericAuthorized() { fmt.Sprintf("--%s=%s", cli.FlagMsgType, typeMsgVote), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) // msg vote voteTx := fmt.Sprintf(`{"body":{"messages":[{"@type":"/cosmos.gov.v1.MsgVote","proposal_id":"1","voter":"%s","option":"VOTE_OPTION_YES"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]}`, val.Address.String()) @@ -761,7 +765,7 @@ func (s *IntegrationTestSuite) TestNewExecGenericAuthorized() { []string{ execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, "grantee"), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagGenerateOnly), }, nil, @@ -773,7 +777,7 @@ func (s *IntegrationTestSuite) TestNewExecGenericAuthorized() { []string{ "/invalid/file.txt", fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), }, nil, 0, @@ -784,7 +788,7 @@ func (s *IntegrationTestSuite) TestNewExecGenericAuthorized() { []string{ execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), }, @@ -797,7 +801,7 @@ func (s *IntegrationTestSuite) TestNewExecGenericAuthorized() { []string{ execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON), @@ -820,7 +824,7 @@ func (s *IntegrationTestSuite) TestNewExecGenericAuthorized() { s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -840,12 +844,14 @@ func (s *IntegrationTestSuite) TestNewExecGrantAuthorized() { fmt.Sprintf("--%s=12%stoken", cli.FlagSpendLimit, val.Moniker), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) + tokens := sdk.NewCoins( sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), sdk.NewInt(12)), ) @@ -855,7 +861,7 @@ func (s *IntegrationTestSuite) TestNewExecGrantAuthorized() { grantee, tokens, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagGenerateOnly), ) @@ -873,7 +879,7 @@ func (s *IntegrationTestSuite) TestNewExecGrantAuthorized() { []string{ execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), }, @@ -899,7 +905,7 @@ func (s *IntegrationTestSuite) TestNewExecGrantAuthorized() { []string{ execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), }, @@ -928,7 +934,7 @@ func (s *IntegrationTestSuite) TestNewExecGrantAuthorized() { default: s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(tc.expectedCode, response.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, response.TxHash, tc.expectedCode)) } }) } @@ -949,13 +955,14 @@ func (s *IntegrationTestSuite) TestExecSendAuthzWithAllowList() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=%s", cli.FlagAllowList, allowedAddr), }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) tokens := sdk.NewCoins( sdk.NewCoin("stake", sdk.NewInt(12)), @@ -967,7 +974,7 @@ func (s *IntegrationTestSuite) TestExecSendAuthzWithAllowList() { allowedAddr, tokens, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagGenerateOnly), ) @@ -980,7 +987,7 @@ func (s *IntegrationTestSuite) TestExecSendAuthzWithAllowList() { notAllowedAddr, tokens, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagGenerateOnly), ) @@ -991,7 +998,7 @@ func (s *IntegrationTestSuite) TestExecSendAuthzWithAllowList() { args := []string{ execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), } @@ -1000,17 +1007,24 @@ func (s *IntegrationTestSuite) TestExecSendAuthzWithAllowList() { out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) s.Require().NoError(err) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + s.Require().NoError(s.network.WaitForNextBlock()) // test sending to not allowed address args = []string{ execMsg1.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), } out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) s.Require().NoError(err) + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + s.Require().NoError(s.network.WaitForNextBlock()) + + // query tx and check result + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, authcli.QueryTxCmd(), []string{response.TxHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) s.Contains(out.String(), fmt.Sprintf("cannot send to %s address", notAllowedAddr)) } @@ -1027,13 +1041,14 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagAllowedValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) tokens := sdk.NewCoins( sdk.NewCoin("stake", sdk.NewInt(50)), @@ -1055,7 +1070,7 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { []string{ execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), }, @@ -1068,7 +1083,7 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { []string{ execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), }, @@ -1081,7 +1096,7 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { []string{ execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), }, @@ -1105,7 +1120,7 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { var response sdk.TxResponse s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(tc.expectedCode, response.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, response.TxHash, tc.expectedCode)) } }) } @@ -1118,13 +1133,15 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { "delegate", fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagAllowedValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) + tokens = sdk.NewCoins( sdk.NewCoin("stake", sdk.NewInt(50)), ) @@ -1145,7 +1162,7 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { []string{ execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), }, @@ -1158,7 +1175,7 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { []string{ execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), }, @@ -1182,7 +1199,7 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { var response sdk.TxResponse s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(tc.expectedCode, response.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, response.TxHash, tc.expectedCode)) } }) } @@ -1196,24 +1213,33 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagDenyValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) args := []string{ execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), } cmd := cli.NewCmdExecAuthorization() out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) + + var response sdk.TxResponse + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + + // query tx and check result + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, authcli.QueryTxCmd(), []string{response.TxHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) s.Contains(out.String(), fmt.Sprintf("cannot delegate/undelegate to %s validator", val.ValAddress.String())) } @@ -1231,13 +1257,14 @@ func (s *IntegrationTestSuite) TestExecUndelegateAuthorization() { fmt.Sprintf("--%s=100stake", cli.FlagSpendLimit), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagAllowedValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) // delegating stakes to validator _, err = execDelegate( @@ -1247,7 +1274,7 @@ func (s *IntegrationTestSuite) TestExecUndelegateAuthorization() { "100stake", fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, ) @@ -1274,7 +1301,7 @@ func (s *IntegrationTestSuite) TestExecUndelegateAuthorization() { execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagGas, "250000"), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), }, @@ -1288,7 +1315,7 @@ func (s *IntegrationTestSuite) TestExecUndelegateAuthorization() { execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagGas, "250000"), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), }, @@ -1302,7 +1329,7 @@ func (s *IntegrationTestSuite) TestExecUndelegateAuthorization() { execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagGas, "250000"), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), }, @@ -1326,7 +1353,7 @@ func (s *IntegrationTestSuite) TestExecUndelegateAuthorization() { var response sdk.TxResponse s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(tc.expectedCode, response.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, response.TxHash, tc.expectedCode)) } }) } @@ -1339,13 +1366,15 @@ func (s *IntegrationTestSuite) TestExecUndelegateAuthorization() { "unbond", fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), fmt.Sprintf("--%s=%s", cli.FlagAllowedValidators, val.ValAddress.String()), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) + tokens = sdk.NewCoins( sdk.NewCoin("stake", sdk.NewInt(50)), ) @@ -1367,7 +1396,7 @@ func (s *IntegrationTestSuite) TestExecUndelegateAuthorization() { execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagGas, "250000"), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), }, @@ -1381,7 +1410,7 @@ func (s *IntegrationTestSuite) TestExecUndelegateAuthorization() { execMsg.Name(), fmt.Sprintf("--%s=%s", flags.FlagGas, "250000"), fmt.Sprintf("--%s=%s", flags.FlagFrom, grantee.String()), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), }, @@ -1405,7 +1434,7 @@ func (s *IntegrationTestSuite) TestExecUndelegateAuthorization() { var response sdk.TxResponse s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(tc.expectedCode, response.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, response.TxHash, tc.expectedCode)) } }) } diff --git a/x/bank/client/cli/suite_test.go b/x/bank/client/cli/suite_test.go index cfccd0fe0719b..27b01e0d0ec35 100644 --- a/x/bank/client/cli/suite_test.go +++ b/x/bank/client/cli/suite_test.go @@ -31,7 +31,7 @@ func newMockTendermintRPC(respQuery abci.ResponseQuery) mockTendermintRPC { return mockTendermintRPC{responseQuery: respQuery} } -func (_ mockTendermintRPC) BroadcastTxSync(context.Context, tmtypes.Tx) (*coretypes.ResultBroadcastTx, error) { +func (mockTendermintRPC) BroadcastTxSync(context.Context, tmtypes.Tx) (*coretypes.ResultBroadcastTx, error) { return &coretypes.ResultBroadcastTx{Code: 0}, nil } diff --git a/x/crisis/client/cli/tx_test.go b/x/crisis/client/cli/tx_test.go index ddfa0a2010e85..c8b23bf402789 100644 --- a/x/crisis/client/cli/tx_test.go +++ b/x/crisis/client/cli/tx_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" rpcclientmock "github.com/tendermint/tendermint/rpc/client/mock" coretypes "github.com/tendermint/tendermint/rpc/core/types" tmtypes "github.com/tendermint/tendermint/types" @@ -27,12 +26,10 @@ var _ client.TendermintRPC = (*mockTendermintRPC)(nil) type mockTendermintRPC struct { rpcclientmock.Client - - responseQuery abci.ResponseQuery } -func (_ mockTendermintRPC) BroadcastTxCommit(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTxCommit, error) { - return &coretypes.ResultBroadcastTxCommit{}, nil +func (mockTendermintRPC) BroadcastTxSync(context.Context, tmtypes.Tx) (*coretypes.ResultBroadcastTx, error) { + return &coretypes.ResultBroadcastTx{}, nil } func TestNewMsgVerifyInvariantTxCmd(t *testing.T) { @@ -61,7 +58,7 @@ func TestNewMsgVerifyInvariantTxCmd(t *testing.T) { "", "total-supply", fmt.Sprintf("--%s=%s", flags.FlagFrom, accounts[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, true, "invalid module name", 0, @@ -72,7 +69,7 @@ func TestNewMsgVerifyInvariantTxCmd(t *testing.T) { "bank", "", fmt.Sprintf("--%s=%s", flags.FlagFrom, accounts[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, true, "invalid invariant route", 0, @@ -83,7 +80,7 @@ func TestNewMsgVerifyInvariantTxCmd(t *testing.T) { "bank", "total-supply", fmt.Sprintf("--%s=%s", flags.FlagFrom, accounts[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, false, "", 0, diff --git a/x/distribution/client/cli/tx.go b/x/distribution/client/cli/tx.go index 6e9dac49017f0..e1f0312daf1cd 100644 --- a/x/distribution/client/cli/tx.go +++ b/x/distribution/client/cli/tx.go @@ -168,10 +168,6 @@ $ %[1]s tx distribution withdraw-all-rewards --from mykey } chunkSize, _ := cmd.Flags().GetInt(FlagMaxMessagesPerTx) - if !clientCtx.GenerateOnly && clientCtx.BroadcastMode != flags.BroadcastBlock && chunkSize > 0 { - return fmt.Errorf("cannot use broadcast mode %[1]s with %[2]s != 0", - clientCtx.BroadcastMode, FlagMaxMessagesPerTx) - } return newSplitAndApply(tx.GenerateOrBroadcastTxCLI, clientCtx, cmd.Flags(), msgs, chunkSize) }, diff --git a/x/distribution/client/testutil/grpc_query_suite.go b/x/distribution/client/testutil/grpc_query_suite.go index 64a9732ae9685..ddfa15a6f4b9d 100644 --- a/x/distribution/client/testutil/grpc_query_suite.go +++ b/x/distribution/client/testutil/grpc_query_suite.go @@ -34,8 +34,7 @@ func (s *GRPCQueryTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), cfg) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } // TearDownSuite cleans up the curret test network after _each_ test. diff --git a/x/distribution/client/testutil/suite.go b/x/distribution/client/testutil/suite.go index 19d7d2433614b..e72fba899639d 100644 --- a/x/distribution/client/testutil/suite.go +++ b/x/distribution/client/testutil/suite.go @@ -61,8 +61,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } // TearDownSuite cleans up the curret test network after _each_ test. @@ -513,7 +512,7 @@ func (s *IntegrationTestSuite) TestNewWithdrawRewardsCmd() { []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -525,7 +524,7 @@ func (s *IntegrationTestSuite) TestNewWithdrawRewardsCmd() { []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -540,7 +539,7 @@ func (s *IntegrationTestSuite) TestNewWithdrawRewardsCmd() { fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=true", cli.FlagCommission), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -564,8 +563,10 @@ func (s *IntegrationTestSuite) TestNewWithdrawRewardsCmd() { } else { s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz, tc.respType), string(bz)) + s.Require().NoError(s.network.WaitForNextBlock()) - txResp := tc.respType.(*sdk.TxResponse) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) s.Require().Equal(tc.expectedCode, txResp.Code) data, err := hex.DecodeString(txResp.Data) @@ -614,7 +615,7 @@ func (s *IntegrationTestSuite) TestNewWithdrawAllRewardsCmd() { []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagOffline), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -625,7 +626,7 @@ func (s *IntegrationTestSuite) TestNewWithdrawAllRewardsCmd() { []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -650,8 +651,10 @@ func (s *IntegrationTestSuite) TestNewWithdrawAllRewardsCmd() { } else { s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) + s.Require().NoError(s.network.WaitForNextBlock()) - txResp := tc.respType.(*sdk.TxResponse) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) s.Require().Equal(tc.expectedCode, txResp.Code) data, err := hex.DecodeString(txResp.Data) @@ -700,7 +703,7 @@ func (s *IntegrationTestSuite) TestNewSetWithdrawAddrCmd() { "foo", fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -711,7 +714,7 @@ func (s *IntegrationTestSuite) TestNewSetWithdrawAddrCmd() { val.Address.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -733,7 +736,7 @@ func (s *IntegrationTestSuite) TestNewSetWithdrawAddrCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -755,7 +758,7 @@ func (s *IntegrationTestSuite) TestNewFundCommunityPoolCmd() { "-43foocoin", fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -766,7 +769,7 @@ func (s *IntegrationTestSuite) TestNewFundCommunityPoolCmd() { sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(5431))).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -788,7 +791,7 @@ func (s *IntegrationTestSuite) TestNewFundCommunityPoolCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } diff --git a/x/distribution/client/testutil/withdraw_all_suite.go b/x/distribution/client/testutil/withdraw_all_suite.go index 9aca56abd2661..8f1c7fbd2f0c0 100644 --- a/x/distribution/client/testutil/withdraw_all_suite.go +++ b/x/distribution/client/testutil/withdraw_all_suite.go @@ -35,8 +35,7 @@ func (s *WithdrawAllTestSuite) SetupSuite() { s.Require().NoError(err) s.network = network - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } // TearDownSuite cleans up the curret test network after _each_ test. @@ -65,10 +64,11 @@ func (s *WithdrawAllTestSuite) TestNewWithdrawAllRewardsGenerateOnly() { val.Address, newAddr, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(2000))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), ) require.NoError(err) + require.NoError(s.network.WaitForNextBlock()) // delegate 500 tokens to validator1 args := []string{ @@ -76,12 +76,13 @@ func (s *WithdrawAllTestSuite) TestNewWithdrawAllRewardsGenerateOnly() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(500)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } cmd := stakingcli.NewDelegateCmd() _, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) require.NoError(err) + require.NoError(s.network.WaitForNextBlock()) // delegate 500 tokens to validator2 args = []string{ @@ -89,18 +90,19 @@ func (s *WithdrawAllTestSuite) TestNewWithdrawAllRewardsGenerateOnly() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(500)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } _, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) require.NoError(err) + require.NoError(s.network.WaitForNextBlock()) args = []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=true", flags.FlagGenerateOnly), fmt.Sprintf("--%s=1", cli.FlagMaxMessagesPerTx), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } cmd = cli.NewWithdrawAllRewardsCmd() @@ -114,7 +116,7 @@ func (s *WithdrawAllTestSuite) TestNewWithdrawAllRewardsGenerateOnly() { fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=true", flags.FlagGenerateOnly), fmt.Sprintf("--%s=2", cli.FlagMaxMessagesPerTx), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } cmd = cli.NewWithdrawAllRewardsCmd() diff --git a/x/evidence/client/cli/tx_test.go b/x/evidence/client/cli/tx_test.go index 629f12ef3a285..a32532420c66f 100644 --- a/x/evidence/client/cli/tx_test.go +++ b/x/evidence/client/cli/tx_test.go @@ -38,8 +38,8 @@ func newMockTendermintRPC(respQuery abci.ResponseQuery) mockTendermintRPC { return mockTendermintRPC{responseQuery: respQuery} } -func (_ mockTendermintRPC) BroadcastTxCommit(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTxCommit, error) { - return &coretypes.ResultBroadcastTxCommit{}, nil +func (mockTendermintRPC) BroadcastTxSync(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTx, error) { + return &coretypes.ResultBroadcastTx{}, nil } func (m mockTendermintRPC) ABCIQueryWithOptions( diff --git a/x/feegrant/client/testutil/suite.go b/x/feegrant/client/testutil/suite.go index be53704ffd757..382c9a1011461 100644 --- a/x/feegrant/client/testutil/suite.go +++ b/x/feegrant/client/testutil/suite.go @@ -56,8 +56,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) val := s.network.Validators[0] granter := val.Address @@ -81,7 +80,7 @@ func (s *IntegrationTestSuite) createGrant(granter, grantee sdk.Address) { clientCtx := val.ClientCtx commonFlags := []string{ - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(100))).String()), } @@ -100,11 +99,9 @@ func (s *IntegrationTestSuite) createGrant(granter, grantee sdk.Address) { ) cmd := cli.NewCmdFeeGrant() - _, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { @@ -321,7 +318,7 @@ func (s *IntegrationTestSuite) TestNewCmdFeeGrant() { s.Require().NoError(err) commonFlags := []string{ - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } @@ -599,7 +596,7 @@ func (s *IntegrationTestSuite) TestNewCmdFeeGrant() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -612,7 +609,7 @@ func (s *IntegrationTestSuite) TestNewCmdRevokeFeegrant() { clientCtx := val.ClientCtx commonFlags := []string{ - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } @@ -706,7 +703,7 @@ func (s *IntegrationTestSuite) TestNewCmdRevokeFeegrant() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -725,7 +722,7 @@ func (s *IntegrationTestSuite) TestTxWithFeeGrant() { grantee := sdk.AccAddress(pub.Address()) commonFlags := []string{ - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), } @@ -747,8 +744,7 @@ func (s *IntegrationTestSuite) TestTxWithFeeGrant() { _, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) testcases := []struct { name string @@ -796,7 +792,7 @@ func (s *IntegrationTestSuite) TestTxWithFeeGrant() { var resp sdk.TxResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) - s.Require().Equal(tc.expErrCode, resp.Code, resp) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, tc.expErrCode)) }) } } @@ -814,7 +810,7 @@ func (s *IntegrationTestSuite) TestFilteredFeeAllowance() { clientCtx := val.ClientCtx commonFlags := []string{ - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(100))).String()), } @@ -887,7 +883,7 @@ func (s *IntegrationTestSuite) TestFilteredFeeAllowance() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -978,7 +974,7 @@ func (s *IntegrationTestSuite) TestFilteredFeeAllowance() { s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) }) } } diff --git a/x/genutil/client/cli/gentx_test.go b/x/genutil/client/cli/gentx_test.go index 5b9bef9f6dd3f..3fc106ee785d7 100644 --- a/x/genutil/client/cli/gentx_test.go +++ b/x/genutil/client/cli/gentx_test.go @@ -41,8 +41,8 @@ func newMockTendermintRPC(respQuery abci.ResponseQuery) mockTendermintRPC { return mockTendermintRPC{responseQuery: respQuery} } -func (_ mockTendermintRPC) BroadcastTxCommit(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTxCommit, error) { - return &coretypes.ResultBroadcastTxCommit{}, nil +func (mockTendermintRPC) BroadcastTxSync(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTx, error) { + return &coretypes.ResultBroadcastTx{}, nil } func (m mockTendermintRPC) ABCIQueryWithOptions( diff --git a/x/gov/client/testutil/deposits.go b/x/gov/client/testutil/deposits.go index ee609ac9f4512..3483bdd90dd48 100644 --- a/x/gov/client/testutil/deposits.go +++ b/x/gov/client/testutil/deposits.go @@ -35,8 +35,7 @@ func (s *DepositTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) val := s.network.Validators[0] @@ -63,9 +62,7 @@ func (s *DepositTestSuite) SetupNewSuite() { var err error s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *DepositTestSuite) submitProposal(val *network.Validator, initialDeposit sdk.Coin, id int) { @@ -83,10 +80,8 @@ func (s *DepositTestSuite) submitProposal(val *network.Validator, initialDeposit v1beta1.ProposalTypeText, exactArgs..., ) - - s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *DepositTestSuite) TearDownSuite() { @@ -103,11 +98,13 @@ func (s *DepositTestSuite) TestQueryDepositsWithoutInitialDeposit() { depositAmount := sdk.NewCoin(s.cfg.BondDenom, v1.DefaultMinDepositTokens.Add(sdk.NewInt(50))).String() _, err := MsgDeposit(clientCtx, val.Address.String(), proposalID, depositAmount) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) // query deposit deposit := s.queryDeposit(val, proposalID, false, "") s.Require().NotNil(deposit) s.Require().Equal(sdk.Coins(deposit.Amount).String(), depositAmount) + s.Require().NoError(s.network.WaitForNextBlock()) // query deposits deposits := s.queryDeposits(val, proposalID, false, "") @@ -125,6 +122,7 @@ func (s *DepositTestSuite) TestQueryDepositsWithInitialDeposit() { deposit := s.queryDeposit(val, proposalID, false, "") s.Require().NotNil(deposit) s.Require().Equal(sdk.Coins(deposit.Amount).String(), s.deposits[1].String()) + s.Require().NoError(s.network.WaitForNextBlock()) // query deposits deposits := s.queryDeposits(val, proposalID, false, "") @@ -187,5 +185,6 @@ func (s *DepositTestSuite) queryDeposit(val *network.Validator, proposalID strin } s.Require().NoError(err) s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(out.Bytes(), &depositRes)) + return depositRes } diff --git a/x/gov/client/testutil/helpers.go b/x/gov/client/testutil/helpers.go index 97098783a38e8..efe751f1245bc 100644 --- a/x/gov/client/testutil/helpers.go +++ b/x/gov/client/testutil/helpers.go @@ -13,7 +13,7 @@ import ( var commonArgs = []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), } diff --git a/x/gov/client/testutil/tx.go b/x/gov/client/testutil/tx.go index ec741d458a4cc..8a166911424bc 100644 --- a/x/gov/client/testutil/tx.go +++ b/x/gov/client/testutil/tx.go @@ -37,9 +37,7 @@ func (s *IntegrationTestSuite) SetupSuite() { var err error s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) val := s.network.Validators[0] @@ -48,31 +46,30 @@ func (s *IntegrationTestSuite) SetupSuite() { "Text Proposal 1", "Where is the title!?", v1beta1.ProposalTypeText, fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, v1.DefaultMinDepositTokens).String())) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) // vote for proposal _, err = MsgVote(val.ClientCtx, val.Address.String(), "1", "yes") s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) // create a proposal without deposit _, err = MsgSubmitLegacyProposal(val.ClientCtx, val.Address.String(), "Text Proposal 2", "Where is the title!?", v1beta1.ProposalTypeText) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) // create a proposal3 with deposit _, err = MsgSubmitLegacyProposal(val.ClientCtx, val.Address.String(), "Text Proposal 3", "Where is the title!?", v1beta1.ProposalTypeText, fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, v1.DefaultMinDepositTokens).String())) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) // vote for proposal3 as val _, err = MsgVote(val.ClientCtx, val.Address.String(), "3", "yes=0.6,no=0.3,abstain=0.05,no_with_veto=0.05") s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { @@ -135,7 +132,7 @@ func (s *IntegrationTestSuite) TestNewCmdSubmitProposal() { validPropFile.Name(), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -156,7 +153,7 @@ func (s *IntegrationTestSuite) TestNewCmdSubmitProposal() { s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -214,7 +211,7 @@ func (s *IntegrationTestSuite) TestNewCmdSubmitLegacyProposal() { fmt.Sprintf("--%s=%s", cli.FlagProposal, validPropFile.Name()), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -228,7 +225,7 @@ func (s *IntegrationTestSuite) TestNewCmdSubmitLegacyProposal() { fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(5431)).String()), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -249,7 +246,7 @@ func (s *IntegrationTestSuite) TestNewCmdSubmitLegacyProposal() { s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -270,7 +267,7 @@ func (s *IntegrationTestSuite) TestNewCmdDeposit() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)).String(), // 10stake fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, @@ -281,7 +278,7 @@ func (s *IntegrationTestSuite) TestNewCmdDeposit() { "1", fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, @@ -293,7 +290,7 @@ func (s *IntegrationTestSuite) TestNewCmdDeposit() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)).String(), // 10stake fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 2, @@ -305,7 +302,7 @@ func (s *IntegrationTestSuite) TestNewCmdDeposit() { sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)).String(), // 10stake fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, @@ -327,7 +324,7 @@ func (s *IntegrationTestSuite) TestNewCmdDeposit() { s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) - s.Require().Equal(tc.expectedCode, resp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, tc.expectedCode)) } }) } @@ -354,7 +351,7 @@ func (s *IntegrationTestSuite) TestNewCmdVote() { "yes", fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--metadata=%s", "AQ=="), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, @@ -367,7 +364,7 @@ func (s *IntegrationTestSuite) TestNewCmdVote() { "yes", fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, @@ -379,7 +376,7 @@ func (s *IntegrationTestSuite) TestNewCmdVote() { "yes", fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--metadata=%s", "AQ=="), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, @@ -401,7 +398,7 @@ func (s *IntegrationTestSuite) TestNewCmdVote() { } else { s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -428,7 +425,7 @@ func (s *IntegrationTestSuite) TestNewCmdWeightedVote() { "yes", fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 2, @@ -440,7 +437,7 @@ func (s *IntegrationTestSuite) TestNewCmdWeightedVote() { "yes", fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, @@ -452,7 +449,7 @@ func (s *IntegrationTestSuite) TestNewCmdWeightedVote() { "yes", fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--metadata=%s", "AQ=="), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, @@ -465,7 +462,7 @@ func (s *IntegrationTestSuite) TestNewCmdWeightedVote() { "yes/0.6,no/0.3,abstain/0.05,no_with_veto/0.05", fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, true, 0, @@ -477,7 +474,7 @@ func (s *IntegrationTestSuite) TestNewCmdWeightedVote() { "yes=0.6,no=0.3,abstain=0.05,no_with_veto=0.05", fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), }, false, 0, @@ -498,7 +495,7 @@ func (s *IntegrationTestSuite) TestNewCmdWeightedVote() { } else { s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } diff --git a/x/group/client/cli/tx_test.go b/x/group/client/cli/tx_test.go index fb8c65d579acf..1ad4975e7bdf8 100644 --- a/x/group/client/cli/tx_test.go +++ b/x/group/client/cli/tx_test.go @@ -49,8 +49,8 @@ func newMockTendermintRPC(respQuery abci.ResponseQuery) mockTendermintRPC { return mockTendermintRPC{responseQuery: respQuery} } -func (_ mockTendermintRPC) BroadcastTxCommit(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTxCommit, error) { - return &coretypes.ResultBroadcastTxCommit{}, nil +func (mockTendermintRPC) BroadcastTxSync(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTx, error) { + return &coretypes.ResultBroadcastTx{}, nil } func (m mockTendermintRPC) ABCIQueryWithOptions( @@ -90,7 +90,7 @@ func (s *CLITestSuite) SetupSuite() { s.commonFlags = []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(10))).String()), } @@ -120,7 +120,7 @@ func (s *CLITestSuite) SetupSuite() { val.Address, account, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(2000))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(10))).String()), ) s.Require().NoError(err) diff --git a/x/group/keeper/proposal_executor.go b/x/group/keeper/proposal_executor.go index 29d9d1e8bed91..bc1317c629ace 100644 --- a/x/group/keeper/proposal_executor.go +++ b/x/group/keeper/proposal_executor.go @@ -5,9 +5,9 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" 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/group" - grouperrors "github.com/cosmos/cosmos-sdk/x/group/errors" + "github.com/cosmos/cosmos-sdk/x/group/errors" ) // doExecuteMsgs routes the messages to the registered handlers. Messages are limited to those that require no authZ or @@ -20,7 +20,7 @@ func (s Keeper) doExecuteMsgs(ctx sdk.Context, router *baseapp.MsgServiceRouter, // this simple and cheap check. expiryDate := proposal.VotingPeriodEnd.Add(s.config.MaxExecutionPeriod) if expiryDate.Before(ctx.BlockTime()) { - return nil, grouperrors.ErrExpired.Wrapf("proposal expired on %s", expiryDate) + return nil, errors.ErrExpired.Wrapf("proposal expired on %s", expiryDate) } msgs, err := proposal.GetMsgs() @@ -35,11 +35,11 @@ func (s Keeper) doExecuteMsgs(ctx sdk.Context, router *baseapp.MsgServiceRouter, for i, msg := range msgs { handler := s.router.Handler(msg) if handler == nil { - return nil, errors.Wrapf(grouperrors.ErrInvalid, "no message handler found for %q", sdk.MsgTypeURL(msg)) + return nil, sdkerrors.Wrapf(errors.ErrInvalid, "no message handler found for %q", sdk.MsgTypeURL(msg)) } r, err := handler(ctx, msg) if err != nil { - return nil, errors.Wrapf(err, "message %s at position %d", sdk.MsgTypeURL(msg), i) + return nil, sdkerrors.Wrapf(err, "message %s at position %d", sdk.MsgTypeURL(msg), i) } // Handler should always return non-nil sdk.Result. if r == nil { @@ -61,7 +61,7 @@ func ensureMsgAuthZ(msgs []sdk.Msg, groupPolicyAcc sdk.AccAddress) error { // but we prefer to loop through all GetSigners just to be sure. for _, acct := range msgs[i].GetSigners() { if !groupPolicyAcc.Equals(acct) { - return errors.Wrapf(errors.ErrUnauthorized, "msg does not have group policy authorization; expected %s, got %s", groupPolicyAcc.String(), acct.String()) + return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "msg does not have group policy authorization; expected %s, got %s", groupPolicyAcc.String(), acct.String()) } } } diff --git a/x/mint/client/cli/query_test.go b/x/mint/client/cli/query_test.go index bc34c5dec9e3e..72e7949649998 100644 --- a/x/mint/client/cli/query_test.go +++ b/x/mint/client/cli/query_test.go @@ -35,8 +35,8 @@ type mockTendermintRPC struct { responseQuery abci.ResponseQuery } -func (_ mockTendermintRPC) BroadcastTxCommit(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTxCommit, error) { - return &coretypes.ResultBroadcastTxCommit{}, nil +func (mockTendermintRPC) BroadcastTxSync(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTx, error) { + return &coretypes.ResultBroadcastTx{}, nil } func (m mockTendermintRPC) ABCIQueryWithOptions( diff --git a/x/nft/client/cli/tx_test.go b/x/nft/client/cli/tx_test.go index 9113147f52992..0cc85e642ae5d 100644 --- a/x/nft/client/cli/tx_test.go +++ b/x/nft/client/cli/tx_test.go @@ -80,8 +80,8 @@ func newMockTendermintRPC(respQuery abci.ResponseQuery) mockTendermintRPC { return mockTendermintRPC{responseQuery: respQuery} } -func (_ mockTendermintRPC) BroadcastTxCommit(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTxCommit, error) { - return &coretypes.ResultBroadcastTxCommit{}, nil +func (mockTendermintRPC) BroadcastTxSync(context.Context, tmtypes.Tx) (*coretypes.ResultBroadcastTx, error) { + return &coretypes.ResultBroadcastTx{Code: 0}, nil } func (m mockTendermintRPC) ABCIQueryWithOptions( @@ -156,7 +156,7 @@ func (s *CLITestSuite) TestCLITxSend() { args := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, OwnerName), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(10))).String()), } @@ -213,7 +213,7 @@ func (s *CLITestSuite) initAccount() { args := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(10))).String()), } diff --git a/x/params/client/testutil/suite.go b/x/params/client/testutil/suite.go index 1318cfbd86303..beeca2681dbe8 100644 --- a/x/params/client/testutil/suite.go +++ b/x/params/client/testutil/suite.go @@ -95,8 +95,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { diff --git a/x/staking/client/cli/tx_test.go b/x/staking/client/cli/tx_test.go index 0068741dec260..e39a70e6f9c89 100644 --- a/x/staking/client/cli/tx_test.go +++ b/x/staking/client/cli/tx_test.go @@ -43,8 +43,8 @@ func newMockTendermintRPC(respQuery abci.ResponseQuery) mockTendermintRPC { return mockTendermintRPC{responseQuery: respQuery} } -func (_ mockTendermintRPC) BroadcastTxCommit(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTxCommit, error) { - return &coretypes.ResultBroadcastTxCommit{}, nil +func (mockTendermintRPC) BroadcastTxSync(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTx, error) { + return &coretypes.ResultBroadcastTx{}, nil } func (m mockTendermintRPC) ABCIQueryWithOptions( @@ -218,7 +218,7 @@ func (s *CLITestSuite) TestNewCreateValidatorCmd() { fmt.Sprintf("--%s=1", cli.FlagMinSelfDelegation), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -237,7 +237,7 @@ func (s *CLITestSuite) TestNewCreateValidatorCmd() { fmt.Sprintf("--%s=1", cli.FlagMinSelfDelegation), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -257,7 +257,7 @@ func (s *CLITestSuite) TestNewCreateValidatorCmd() { fmt.Sprintf("--%s=1", cli.FlagMinSelfDelegation), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -278,7 +278,7 @@ func (s *CLITestSuite) TestNewCreateValidatorCmd() { fmt.Sprintf("--%s=1", cli.FlagMinSelfDelegation), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -324,7 +324,7 @@ func (s *CLITestSuite) TestNewEditValidatorCmd() { []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, "with wrong from address"), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -334,7 +334,7 @@ func (s *CLITestSuite) TestNewEditValidatorCmd() { []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -345,7 +345,7 @@ func (s *CLITestSuite) TestNewEditValidatorCmd() { fmt.Sprintf("--details=%s", details), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -356,7 +356,7 @@ func (s *CLITestSuite) TestNewEditValidatorCmd() { fmt.Sprintf("--identity=%s", identity), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -367,7 +367,7 @@ func (s *CLITestSuite) TestNewEditValidatorCmd() { fmt.Sprintf("--security-contact=%s", securityContact), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -378,7 +378,7 @@ func (s *CLITestSuite) TestNewEditValidatorCmd() { fmt.Sprintf("--website=%s", website), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -392,7 +392,7 @@ func (s *CLITestSuite) TestNewEditValidatorCmd() { fmt.Sprintf("--website=%s", website), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -434,7 +434,7 @@ func (s *CLITestSuite) TestNewDelegateCmd() { sdk.ValAddress(s.addrs[0]).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -445,7 +445,7 @@ func (s *CLITestSuite) TestNewDelegateCmd() { sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(150)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -457,7 +457,7 @@ func (s *CLITestSuite) TestNewDelegateCmd() { sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(150)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -499,7 +499,7 @@ func (s *CLITestSuite) TestNewRedelegateCmd() { sdk.ValAddress(s.addrs[1]).String(), // dst-validator-addr fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -513,7 +513,7 @@ func (s *CLITestSuite) TestNewRedelegateCmd() { fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=%d", flags.FlagGas, 300000), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -554,7 +554,7 @@ func (s *CLITestSuite) TestNewUnbondCmd() { sdk.ValAddress(s.addrs[0]).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -565,7 +565,7 @@ func (s *CLITestSuite) TestNewUnbondCmd() { sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(150)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -577,7 +577,7 @@ func (s *CLITestSuite) TestNewUnbondCmd() { sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(150)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, @@ -617,7 +617,7 @@ func (s *CLITestSuite) TestNewCancelUnbondingDelegationCmd() { []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -628,7 +628,7 @@ func (s *CLITestSuite) TestNewCancelUnbondingDelegationCmd() { sdk.ValAddress(s.addrs[0]).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -640,7 +640,7 @@ func (s *CLITestSuite) TestNewCancelUnbondingDelegationCmd() { sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(150)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, true, 0, nil, @@ -653,7 +653,7 @@ func (s *CLITestSuite) TestNewCancelUnbondingDelegationCmd() { sdk.NewInt(10000).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.addrs[0]), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))).String()), }, false, 0, &sdk.TxResponse{}, diff --git a/x/upgrade/client/cli/tx_test.go b/x/upgrade/client/cli/tx_test.go index 0daf658ccdb20..2de13e1fb62a6 100644 --- a/x/upgrade/client/cli/tx_test.go +++ b/x/upgrade/client/cli/tx_test.go @@ -33,8 +33,8 @@ type mockTendermintRPC struct { responseQuery abci.ResponseQuery } -func (_ mockTendermintRPC) BroadcastTxCommit(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTxCommit, error) { - return &coretypes.ResultBroadcastTxCommit{}, nil +func (mockTendermintRPC) BroadcastTxSync(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTx, error) { + return &coretypes.ResultBroadcastTx{}, nil } func (m mockTendermintRPC) ABCIQueryWithOptions(