From 4d2bced61714405badc91b0fb3b65cfa5d3fbfa4 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 23 Aug 2022 12:04:47 +0200 Subject: [PATCH 01/19] feat: remove broadcast mode `block` --- CHANGELOG.md | 1 + 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 +- proto/cosmos/tx/v1beta1/service.proto | 6 +- tests/e2e/crisis/suite.go | 6 +- tests/e2e/group/query.go | 2 +- tests/e2e/group/tx.go | 6 +- tests/e2e/nft/tx.go | 4 +- tests/e2e/staking/client/testutil/suite.go | 66 ++++----- .../staking/client/testutil/test_helpers.go | 2 +- tests/e2e/tx/service_test.go | 9 +- 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 | 16 +-- x/authz/client/testutil/grpc.go | 2 +- x/authz/client/testutil/query.go | 4 +- x/authz/client/testutil/tx.go | 120 ++++++++-------- x/bank/client/cli/suite_test.go | 2 +- x/crisis/client/cli/tx_test.go | 13 +- x/distribution/client/cli/tx.go | 2 +- x/distribution/client/testutil/suite.go | 18 +-- .../client/testutil/withdraw_all_suite.go | 10 +- x/feegrant/client/testutil/suite.go | 10 +- x/gov/client/testutil/helpers.go | 2 +- x/gov/client/testutil/tx.go | 30 ++-- x/group/client/cli/tx_test.go | 4 +- 32 files changed, 307 insertions(+), 504 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94b5d614193..ce494fd1f1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -109,6 +109,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes +* (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. diff --git a/api/cosmos/tx/v1beta1/service.pulsar.go b/api/cosmos/tx/v1beta1/service.pulsar.go index eb0f8d308c0..8aa6936cb0c 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 5ecafd1ec0e..2f1c72766ab 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 f3ddc572a5e..fcc67733eb4 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 97c8b00b42c..b38af70dc93 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 d7761f05c01..faf7c16de0e 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 914d19de6f3..ae5d37d857a 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/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index 4dd9b535406..8dd9995d5e3 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/tests/e2e/crisis/suite.go b/tests/e2e/crisis/suite.go index 1205ab71784..e14220276fb 100644 --- a/tests/e2e/crisis/suite.go +++ b/tests/e2e/crisis/suite.go @@ -56,7 +56,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,7 +67,7 @@ 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, @@ -78,7 +78,7 @@ func (s *IntegrationTestSuite) TestNewMsgVerifyInvariantTxCmd() { "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{}, diff --git a/tests/e2e/group/query.go b/tests/e2e/group/query.go index 306d62bb814..92e4def0135 100644 --- a/tests/e2e/group/query.go +++ b/tests/e2e/group/query.go @@ -772,7 +772,7 @@ 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()), } diff --git a/tests/e2e/group/tx.go b/tests/e2e/group/tx.go index 9c9f111fd44..a9d01944ba8 100644 --- a/tests/e2e/group/tx.go +++ b/tests/e2e/group/tx.go @@ -51,7 +51,7 @@ 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()), } @@ -77,7 +77,7 @@ func (s *IntegrationTestSuite) SetupSuite() { 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) @@ -2485,7 +2485,7 @@ func (s *IntegrationTestSuite) createAccounts(quantity int) []string { 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) diff --git a/tests/e2e/nft/tx.go b/tests/e2e/nft/tx.go index 919e8e8bb9f..5b15eb5bbef 100644 --- a/tests/e2e/nft/tx.go +++ b/tests/e2e/nft/tx.go @@ -99,7 +99,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 { @@ -152,7 +152,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/staking/client/testutil/suite.go b/tests/e2e/staking/client/testutil/suite.go index 60947b24c8b..f71faefc48c 100644 --- a/tests/e2e/staking/client/testutil/suite.go +++ b/tests/e2e/staking/client/testutil/suite.go @@ -117,7 +117,7 @@ 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) @@ -142,7 +142,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 +161,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 +181,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 +202,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{}, @@ -975,7 +975,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 +985,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 +996,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 +1007,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 +1018,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 +1029,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 +1043,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{}, @@ -1087,7 +1087,7 @@ 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) @@ -1105,7 +1105,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 +1116,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 +1128,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{}, @@ -1174,7 +1174,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 +1187,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 +1200,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 +1214,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{}, @@ -1258,7 +1258,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 +1269,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 +1281,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{}, @@ -1324,7 +1324,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 +1335,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 +1347,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 +1360,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 +1372,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 +1384,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{}, @@ -1448,7 +1448,7 @@ 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) @@ -1462,7 +1462,7 @@ 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) @@ -1511,7 +1511,7 @@ 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()), @@ -1532,7 +1532,7 @@ 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()), }) diff --git a/tests/e2e/staking/client/testutil/test_helpers.go b/tests/e2e/staking/client/testutil/test_helpers.go index 0fa752e0572..c1358319ca7 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 64e1a75c983..973488d76f0 100644 --- a/tests/e2e/tx/service_test.go +++ b/tests/e2e/tx/service_test.go @@ -124,6 +124,9 @@ func (s *IntegrationTestSuite) TestQueryBySig() { s.Require().NoError(s.network.WaitForNextBlock()) + // wait for tx to be included + s.network.WaitForNextBlock() + // get the signature out of the builder sigs, err := txb.GetTx().GetSignaturesV2() s.Require().NoError(err) @@ -519,9 +522,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, @@ -558,7 +559,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, diff --git a/types/result.go b/types/result.go index 20045d23c65..90849aeba37 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 5c58313b114..a58425c04a5 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 139e8c66ffa..9968a56ea25 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 0a2824ffe6d..303defb6dbd 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 4e413378cde..e3f0ca68a60 100644 --- a/x/auth/client/testutil/suite.go +++ b/x/auth/client/testutil/suite.go @@ -1584,7 +1584,7 @@ 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) @@ -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 f29f858cb22..d5e3269c58f 100644 --- a/x/authz/client/testutil/grpc.go +++ b/x/authz/client/testutil/grpc.go @@ -114,7 +114,7 @@ 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()), }) diff --git a/x/authz/client/testutil/query.go b/x/authz/client/testutil/query.go index f4326ad4173..d62ab8beec9 100644 --- a/x/authz/client/testutil/query.go +++ b/x/authz/client/testutil/query.go @@ -28,7 +28,7 @@ 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()), }, @@ -106,7 +106,7 @@ 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()), }, diff --git a/x/authz/client/testutil/tx.go b/x/authz/client/testutil/tx.go index 96e0fb1878c..c6ab7652a8f 100644 --- a/x/authz/client/testutil/tx.go +++ b/x/authz/client/testutil/tx.go @@ -71,7 +71,7 @@ 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()), }) @@ -91,7 +91,7 @@ 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()), }) @@ -113,7 +113,7 @@ 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]), @@ -150,7 +150,7 @@ 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) @@ -231,7 +231,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 +248,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 +266,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 +283,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 +300,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 +317,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 +334,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 +351,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 +368,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 +385,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 +402,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 +418,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 +434,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 +451,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 +468,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 +484,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 +500,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()), @@ -553,7 +553,7 @@ 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()), }, @@ -569,7 +569,7 @@ 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()), }, @@ -585,7 +585,7 @@ 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), @@ -630,7 +630,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 +643,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 +656,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), @@ -698,7 +698,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()), }, @@ -717,7 +717,7 @@ func (s *IntegrationTestSuite) TestExecAuthorizationWithExpiration() { res, 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), }) @@ -738,7 +738,7 @@ 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()), }, @@ -761,7 +761,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 +773,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 +784,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 +797,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), @@ -840,7 +840,7 @@ 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()), }, @@ -855,7 +855,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 +873,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 +899,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), }, @@ -949,7 +949,7 @@ 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), @@ -967,7 +967,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 +980,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 +991,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), } @@ -1005,7 +1005,7 @@ func (s *IntegrationTestSuite) TestExecSendAuthzWithAllowList() { 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), } @@ -1027,7 +1027,7 @@ 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()), @@ -1055,7 +1055,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 +1068,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 +1081,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), }, @@ -1118,7 +1118,7 @@ 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()), @@ -1145,7 +1145,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 +1158,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), }, @@ -1196,7 +1196,7 @@ 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()), @@ -1207,7 +1207,7 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { 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), } @@ -1231,7 +1231,7 @@ 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()), @@ -1247,7 +1247,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 +1274,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 +1288,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 +1302,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), }, @@ -1339,7 +1339,7 @@ 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()), @@ -1367,7 +1367,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 +1381,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), }, diff --git a/x/bank/client/cli/suite_test.go b/x/bank/client/cli/suite_test.go index cfccd0fe071..27b01e0d0ec 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 ddfa0a2010e..c8b23bf4027 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 6e9dac49017..9b56b6c663b 100644 --- a/x/distribution/client/cli/tx.go +++ b/x/distribution/client/cli/tx.go @@ -168,7 +168,7 @@ $ %[1]s tx distribution withdraw-all-rewards --from mykey } chunkSize, _ := cmd.Flags().GetInt(FlagMaxMessagesPerTx) - if !clientCtx.GenerateOnly && clientCtx.BroadcastMode != flags.BroadcastBlock && chunkSize > 0 { + if !clientCtx.GenerateOnly && clientCtx.BroadcastMode != flags.BroadcastSync && chunkSize > 0 { return fmt.Errorf("cannot use broadcast mode %[1]s with %[2]s != 0", clientCtx.BroadcastMode, FlagMaxMessagesPerTx) } diff --git a/x/distribution/client/testutil/suite.go b/x/distribution/client/testutil/suite.go index 19d7d243361..283ee6007cc 100644 --- a/x/distribution/client/testutil/suite.go +++ b/x/distribution/client/testutil/suite.go @@ -513,7 +513,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 +525,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 +540,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{}, @@ -614,7 +614,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 +625,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{}, @@ -700,7 +700,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 +711,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{}, @@ -755,7 +755,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 +766,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{}, diff --git a/x/distribution/client/testutil/withdraw_all_suite.go b/x/distribution/client/testutil/withdraw_all_suite.go index 9aca56abd26..85df247a187 100644 --- a/x/distribution/client/testutil/withdraw_all_suite.go +++ b/x/distribution/client/testutil/withdraw_all_suite.go @@ -65,7 +65,7 @@ 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) @@ -76,7 +76,7 @@ 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() @@ -89,7 +89,7 @@ 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) @@ -100,7 +100,7 @@ func (s *WithdrawAllTestSuite) TestNewWithdrawAllRewardsGenerateOnly() { 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 +114,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/feegrant/client/testutil/suite.go b/x/feegrant/client/testutil/suite.go index be53704ffd7..65d121e15ea 100644 --- a/x/feegrant/client/testutil/suite.go +++ b/x/feegrant/client/testutil/suite.go @@ -81,7 +81,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()), } @@ -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()), } @@ -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()), } @@ -725,7 +725,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()), } @@ -814,7 +814,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()), } diff --git a/x/gov/client/testutil/helpers.go b/x/gov/client/testutil/helpers.go index 97098783a38..efe751f1245 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 ec741d458a4..bf1f825d05c 100644 --- a/x/gov/client/testutil/tx.go +++ b/x/gov/client/testutil/tx.go @@ -135,7 +135,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{}, @@ -214,7 +214,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 +228,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{}, @@ -270,7 +270,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 +281,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 +293,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 +305,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, @@ -354,7 +354,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 +367,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 +379,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()), }, @@ -428,7 +428,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 +440,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 +452,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 +465,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 +477,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, diff --git a/x/group/client/cli/tx_test.go b/x/group/client/cli/tx_test.go index fb8c65d579a..4493be392d4 100644 --- a/x/group/client/cli/tx_test.go +++ b/x/group/client/cli/tx_test.go @@ -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) From c57d9ba4d7757603654e0f66ce7c98e77ffc1542 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 23 Aug 2022 12:08:30 +0200 Subject: [PATCH 02/19] updates docs --- cosmovisor/README.md | 2 +- docs/run-node/txs.md | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/cosmovisor/README.md b/cosmovisor/README.md index 41610b26ecc..75f3e07a285 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 99643b1cbb6..8f83c2f4753 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). From d20445bf28e7a05094e3fae75d742164af0c0a26 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 25 Aug 2022 21:20:57 +0200 Subject: [PATCH 03/19] updates --- CHANGELOG.md | 4 +- tests/e2e/crisis/suite.go | 24 ++++- tests/e2e/group/tx.go | 70 ++++++++------ tests/e2e/nft/tx.go | 24 +++-- tests/e2e/slashing/client/testutil/suite.go | 22 ++++- tests/e2e/staking/client/testutil/suite.go | 57 ++++++++---- tests/e2e/tx/service_test.go | 3 - x/auth/client/testutil/suite.go | 3 +- x/authz/client/testutil/grpc.go | 1 + x/authz/client/testutil/query.go | 2 + x/authz/client/testutil/tx.go | 92 ++++++++++++++----- x/distribution/client/cli/tx.go | 4 - x/distribution/client/testutil/suite.go | 34 ++++++- .../client/testutil/withdraw_all_suite.go | 3 + x/feegrant/client/testutil/suite.go | 28 ++++-- x/gov/client/testutil/deposits.go | 2 + x/gov/client/testutil/tx.go | 25 ++++- 17 files changed, 288 insertions(+), 110 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce494fd1f1c..e1c1388e886 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,8 +75,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. diff --git a/tests/e2e/crisis/suite.go b/tests/e2e/crisis/suite.go index e14220276fb..1220a0c15ea 100644 --- a/tests/e2e/crisis/suite.go +++ b/tests/e2e/crisis/suite.go @@ -3,14 +3,16 @@ package crisis import ( "fmt" - "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/suite" - + "github.com/cosmos/cosmos-sdk/client" "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" + authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/x/crisis/client/cli" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/suite" + tmcli "github.com/tendermint/tendermint/libs/cli" ) type IntegrationTestSuite struct { @@ -73,7 +75,7 @@ func (s *IntegrationTestSuite) TestNewMsgVerifyInvariantTxCmd() { 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()), @@ -100,8 +102,20 @@ 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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } } + +func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { + s.Require().NoError(s.network.WaitForNextBlock()) + + cmd := authcli.QueryTxCmd() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) + + var response sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + s.Require().Equal(expectedCode, response.Code, out.String()) +} diff --git a/tests/e2e/group/tx.go b/tests/e2e/group/tx.go index a9d01944ba8..0c39afad879 100644 --- a/tests/e2e/group/tx.go +++ b/tests/e2e/group/tx.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/suite" tmcli "github.com/tendermint/tendermint/libs/cli" + sdkclient "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -19,6 +20,7 @@ import ( "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" 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" @@ -81,6 +83,7 @@ func (s *IntegrationTestSuite) SetupSuite() { 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 @@ -105,11 +108,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.checkTxCode(val.ClientCtx, txResp.TxHash, 0) s.group = &group.GroupInfo{Id: 1, Admin: val.Address.String(), Metadata: validMetadata, TotalWeight: "3", Version: 1} @@ -140,7 +142,7 @@ 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.checkTxCode(val.ClientCtx, txResp.TxHash, 0) out, err = cli.ExecTestCLICmd(val.ClientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{"1", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) s.Require().NoError(err, out.String()) @@ -164,7 +166,7 @@ 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.checkTxCode(val.ClientCtx, txResp.TxHash, 0) // vote out, err = cli.ExecTestCLICmd(val.ClientCtx, client.MsgVoteCmd(), @@ -180,7 +182,7 @@ 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.checkTxCode(val.ClientCtx, txResp.TxHash, 0) out, err = cli.ExecTestCLICmd(val.ClientCtx, client.QueryProposalCmd(), []string{"1", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) s.Require().NoError(err, out.String()) @@ -353,7 +355,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroup() { 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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -385,7 +387,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() { 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()) + s.checkTxCode(val.ClientCtx, txResp.TxHash, 0) groupIDs[i] = s.getGroupIDFromTxResponse(txResp) } @@ -554,7 +556,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMetadata() { 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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -676,7 +678,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMembers() { 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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -882,7 +884,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() { 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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -1050,7 +1052,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() { 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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -1150,7 +1152,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -1295,7 +1297,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -1410,7 +1412,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyMetadata() { 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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -1598,7 +1600,7 @@ func (s *IntegrationTestSuite) TestTxSubmitProposal() { 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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -1632,7 +1634,7 @@ 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()) + s.checkTxCode(clientCtx, txResp.TxHash, 0) ids[i] = s.getProposalIDFromTxResponse(txResp) } @@ -1791,7 +1793,7 @@ func (s *IntegrationTestSuite) TestTxVote() { 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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -1819,7 +1821,7 @@ 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()) + s.checkTxCode(clientCtx, txResp.TxHash, 0) ids[i] = s.getProposalIDFromTxResponse(txResp) } @@ -1917,7 +1919,7 @@ func (s *IntegrationTestSuite) TestTxWithdrawProposal() { 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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -1962,7 +1964,7 @@ func (s *IntegrationTestSuite) TestTxExec() { var txResp sdk.TxResponse require.NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - require.Equal(uint32(0), txResp.Code, out.String()) + s.checkTxCode(clientCtx, txResp.TxHash, 0) proposalID := s.getProposalIDFromTxResponse(txResp) proposalIDs = append(proposalIDs, proposalID) @@ -2250,7 +2252,7 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { 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.checkTxCode(clientCtx, resp.TxHash, 0) return err }, @@ -2277,7 +2279,7 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { 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.checkTxCode(clientCtx, resp.TxHash, 0) return err }, @@ -2304,7 +2306,7 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { 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.checkTxCode(clientCtx, resp.TxHash, 0) return err }, @@ -2336,7 +2338,7 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { 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.checkTxCode(clientCtx, resp.TxHash, 0) return err }, @@ -2390,7 +2392,7 @@ 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.checkTxCode(clientCtx, txResp.TxHash, 0) } @@ -2489,8 +2491,10 @@ func (s *IntegrationTestSuite) createAccounts(quantity int) []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(err) } + + s.Require().NoError(s.network.WaitForNextBlock()) + return accounts } @@ -2540,7 +2544,7 @@ 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.checkTxCode(val.ClientCtx, txResp.TxHash, 0) out, err = cli.ExecTestCLICmd(val.ClientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{groupID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) s.Require().NoError(err, out.String()) @@ -2571,3 +2575,15 @@ func (s *IntegrationTestSuite) newValidMembers(weights, membersAddress []string) } return membersValid } + +func (s *IntegrationTestSuite) checkTxCode(clientCtx sdkclient.Context, txHash string, expectedCode uint32) { + s.Require().NoError(s.network.WaitForNextBlock()) + + cmd := authcli.QueryTxCmd() + out, err := cli.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) + + var response sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + s.Require().Equal(expectedCode, response.Code, out.String()) +} diff --git a/tests/e2e/nft/tx.go b/tests/e2e/nft/tx.go index 5b15eb5bbef..b5c0ecc4370 100644 --- a/tests/e2e/nft/tx.go +++ b/tests/e2e/nft/tx.go @@ -4,11 +4,14 @@ import ( "fmt" "github.com/stretchr/testify/suite" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/cosmos/cosmos-sdk/client" "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" + authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/x/nft" ) @@ -80,13 +83,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() { @@ -135,7 +135,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -163,3 +163,15 @@ func (s *IntegrationTestSuite) initAccount() { _, err = clitestutil.MsgSendExec(ctx, val.Address, s.owner, amount, args...) s.Require().NoError(err) } + +func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { + s.Require().NoError(s.network.WaitForNextBlock()) + + cmd := authcli.QueryTxCmd() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) + + var response sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + s.Require().Equal(expectedCode, response.Code, out.String()) +} diff --git a/tests/e2e/slashing/client/testutil/suite.go b/tests/e2e/slashing/client/testutil/suite.go index 49854498bc7..775d203683f 100644 --- a/tests/e2e/slashing/client/testutil/suite.go +++ b/tests/e2e/slashing/client/testutil/suite.go @@ -8,11 +8,14 @@ import ( "github.com/stretchr/testify/suite" tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/cosmos/cosmos-sdk/client" "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" + authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/x/slashing/client/cli" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" ) type EndToEndTestSuite struct { @@ -35,8 +38,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 +161,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,8 +180,20 @@ 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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } } + +func (s *EndToEndTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { + s.Require().NoError(s.network.WaitForNextBlock()) + + cmd := authcli.QueryTxCmd() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) + + var response sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + s.Require().Equal(expectedCode, response.Code, out.String()) +} diff --git a/tests/e2e/staking/client/testutil/suite.go b/tests/e2e/staking/client/testutil/suite.go index f71faefc48c..12586f6ea2a 100644 --- a/tests/e2e/staking/client/testutil/suite.go +++ b/tests/e2e/staking/client/testutil/suite.go @@ -13,6 +13,7 @@ import ( "github.com/tendermint/tendermint/proto/tendermint/crypto" "github.com/tendermint/tendermint/rpc/client/http" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -23,6 +24,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" + authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/x/staking/client/cli" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -48,9 +50,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 +71,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() { @@ -121,6 +121,7 @@ func (s *IntegrationTestSuite) TestNewCreateValidatorCmd() { 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 @@ -223,19 +224,27 @@ 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()) + cmd := authcli.QueryTxCmd() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txResp.TxHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), txResp), out.String()) + 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) } }) } @@ -1065,7 +1074,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -1091,6 +1100,7 @@ func (s *IntegrationTestSuite) TestNewDelegateCmd() { 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 @@ -1150,7 +1160,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -1236,7 +1246,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -1303,7 +1313,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -1422,7 +1432,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -1452,6 +1462,7 @@ func (s *IntegrationTestSuite) TestBlockResults() { 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() @@ -1466,6 +1477,7 @@ func (s *IntegrationTestSuite) TestBlockResults() { 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") @@ -1517,6 +1529,7 @@ func (s *IntegrationTestSuite) TestEditValidatorMoniker() { 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( @@ -1537,13 +1550,25 @@ func (s *IntegrationTestSuite) TestEditValidatorMoniker() { 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) } + +func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { + s.Require().NoError(s.network.WaitForNextBlock()) + + cmd := authcli.QueryTxCmd() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) + + var response sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + s.Require().Equal(expectedCode, response.Code, out.String()) +} diff --git a/tests/e2e/tx/service_test.go b/tests/e2e/tx/service_test.go index 973488d76f0..7d524ec9a14 100644 --- a/tests/e2e/tx/service_test.go +++ b/tests/e2e/tx/service_test.go @@ -124,9 +124,6 @@ func (s *IntegrationTestSuite) TestQueryBySig() { s.Require().NoError(s.network.WaitForNextBlock()) - // wait for tx to be included - s.network.WaitForNextBlock() - // get the signature out of the builder sigs, err := txb.GetTx().GetSignaturesV2() s.Require().NoError(err) diff --git a/x/auth/client/testutil/suite.go b/x/auth/client/testutil/suite.go index e3f0ca68a60..b7579d014b3 100644 --- a/x/auth/client/testutil/suite.go +++ b/x/auth/client/testutil/suite.go @@ -1586,8 +1586,9 @@ func (s *IntegrationTestSuite) TestSignWithMultiSignersAminoJSON() { signedTxFile.Name(), 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) diff --git a/x/authz/client/testutil/grpc.go b/x/authz/client/testutil/grpc.go index d5e3269c58f..f22ea3fbb91 100644 --- a/x/authz/client/testutil/grpc.go +++ b/x/authz/client/testutil/grpc.go @@ -119,6 +119,7 @@ func (s *IntegrationTestSuite) TestQueryGrantsGRPC() { 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 d62ab8beec9..42584a5999c 100644 --- a/x/authz/client/testutil/query.go +++ b/x/authz/client/testutil/query.go @@ -34,6 +34,7 @@ func (s *IntegrationTestSuite) TestQueryAuthorizations() { }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) testCases := []struct { name string @@ -112,6 +113,7 @@ func (s *IntegrationTestSuite) TestQueryAuthorization() { }, ) 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 c6ab7652a8f..18adc6bc05f 100644 --- a/x/authz/client/testutil/tx.go +++ b/x/authz/client/testutil/tx.go @@ -6,7 +6,9 @@ import ( "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/suite" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -14,6 +16,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 +53,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") @@ -76,10 +78,10 @@ func (s *IntegrationTestSuite) SetupSuite() { 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.checkTxCode(val.ClientCtx, response.TxHash, 0) // Create new account in the keyring. s.grantee[2] = s.createAccount("grantee3") @@ -96,6 +98,7 @@ func (s *IntegrationTestSuite) SetupSuite() { 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") @@ -120,14 +123,10 @@ func (s *IntegrationTestSuite) SetupSuite() { }, ) 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.checkTxCode(val.ClientCtx, response.TxHash, 0) } func (s *IntegrationTestSuite) createAccount(uid string) sdk.AccAddress { @@ -155,6 +154,7 @@ func (s *IntegrationTestSuite) msgSendExec(grantee sdk.AccAddress) { ) s.Require().NoError(err) s.Require().Contains(out.String(), `"code":0`) + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { @@ -514,7 +514,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 +524,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.checkTxCode(val.ClientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -559,6 +558,7 @@ func (s *IntegrationTestSuite) TestCmdRevokeAuthorizations() { }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) // generic-authorization _, err = CreateGrant( @@ -575,6 +575,7 @@ func (s *IntegrationTestSuite) TestCmdRevokeAuthorizations() { }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) // generic-authorization used for amino testing _, err = CreateGrant( @@ -592,6 +593,7 @@ func (s *IntegrationTestSuite) TestCmdRevokeAuthorizations() { }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) testCases := []struct { name string @@ -679,7 +681,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.checkTxCode(val.ClientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -714,7 +716,7 @@ 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.BroadcastSync), @@ -722,7 +724,9 @@ func (s *IntegrationTestSuite) TestExecAuthorizationWithExpiration() { 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.checkTxCode(clientCtx, response.TxHash, authz.ErrNoAuthorizationFound.ABCICode()) } func (s *IntegrationTestSuite) TestNewExecGenericAuthorized() { @@ -744,6 +748,7 @@ func (s *IntegrationTestSuite) TestNewExecGenericAuthorized() { }, ) 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()) @@ -820,7 +825,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.checkTxCode(val.ClientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -846,6 +851,8 @@ func (s *IntegrationTestSuite) TestNewExecGrantAuthorized() { }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) + tokens := sdk.NewCoins( sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), sdk.NewInt(12)), ) @@ -928,7 +935,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.checkTxCode(val.ClientCtx, response.TxHash, tc.expectedCode) } }) } @@ -956,6 +963,7 @@ func (s *IntegrationTestSuite) TestExecSendAuthzWithAllowList() { }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) tokens := sdk.NewCoins( sdk.NewCoin("stake", sdk.NewInt(12)), @@ -1000,6 +1008,7 @@ 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{ @@ -1011,6 +1020,13 @@ 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()) + + // query tx and check result + cmd = authcli.QueryTxCmd() + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, []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)) } @@ -1034,6 +1050,7 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) tokens := sdk.NewCoins( sdk.NewCoin("stake", sdk.NewInt(50)), @@ -1105,7 +1122,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.checkTxCode(val.ClientCtx, response.TxHash, tc.expectedCode) } }) } @@ -1125,6 +1142,8 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) + tokens = sdk.NewCoins( sdk.NewCoin("stake", sdk.NewInt(50)), ) @@ -1182,7 +1201,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.checkTxCode(val.ClientCtx, response.TxHash, tc.expectedCode) } }) } @@ -1203,6 +1222,7 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) args := []string{ execMsg.Name(), @@ -1214,6 +1234,15 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { 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 + cmd = authcli.QueryTxCmd() + out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, []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())) } @@ -1238,6 +1267,7 @@ func (s *IntegrationTestSuite) TestExecUndelegateAuthorization() { }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) // delegating stakes to validator _, err = execDelegate( @@ -1326,7 +1356,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.checkTxCode(val.ClientCtx, response.TxHash, tc.expectedCode) } }) } @@ -1346,6 +1376,8 @@ func (s *IntegrationTestSuite) TestExecUndelegateAuthorization() { }, ) s.Require().NoError(err) + s.Require().NoError(s.network.WaitForNextBlock()) + tokens = sdk.NewCoins( sdk.NewCoin("stake", sdk.NewInt(50)), ) @@ -1405,8 +1437,20 @@ 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.checkTxCode(val.ClientCtx, response.TxHash, tc.expectedCode) } }) } } + +func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { + s.Require().NoError(s.network.WaitForNextBlock()) + + cmd := authcli.QueryTxCmd() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) + + var response sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + s.Require().Equal(expectedCode, response.Code, out.String()) +} diff --git a/x/distribution/client/cli/tx.go b/x/distribution/client/cli/tx.go index 9b56b6c663b..e1f0312daf1 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.BroadcastSync && 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/suite.go b/x/distribution/client/testutil/suite.go index 283ee6007cc..cfa374f5114 100644 --- a/x/distribution/client/testutil/suite.go +++ b/x/distribution/client/testutil/suite.go @@ -11,10 +11,12 @@ import ( "github.com/stretchr/testify/suite" tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/cosmos/cosmos-sdk/client" "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" + authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/x/distribution/client/cli" "github.com/cosmos/cosmos-sdk/x/distribution/testutil" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" @@ -564,9 +566,15 @@ 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) - s.Require().Equal(tc.expectedCode, txResp.Code) + cmd := authcli.QueryTxCmd() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txResp.TxHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) + + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), txResp), out.String()) + s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) data, err := hex.DecodeString(txResp.Data) s.Require().NoError(err) @@ -650,9 +658,15 @@ 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) - s.Require().Equal(tc.expectedCode, txResp.Code) + cmd := authcli.QueryTxCmd() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txResp.TxHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) + + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), txResp), out.String()) + s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) data, err := hex.DecodeString(txResp.Data) s.Require().NoError(err) @@ -733,7 +747,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.checkTx(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -788,8 +802,20 @@ 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.checkTx(clientCtx, txResp.TxHash, tc.expectedCode) } }) } } + +func (s *IntegrationTestSuite) checkTx(clientCtx client.Context, txHash string, expectedCode uint32) { + s.Require().NoError(s.network.WaitForNextBlock()) + + cmd := authcli.QueryTxCmd() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) + + var response sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + s.Require().Equal(expectedCode, response.Code, out.String()) +} diff --git a/x/distribution/client/testutil/withdraw_all_suite.go b/x/distribution/client/testutil/withdraw_all_suite.go index 85df247a187..a7067b0a81a 100644 --- a/x/distribution/client/testutil/withdraw_all_suite.go +++ b/x/distribution/client/testutil/withdraw_all_suite.go @@ -69,6 +69,7 @@ func (s *WithdrawAllTestSuite) TestNewWithdrawAllRewardsGenerateOnly() { 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{ @@ -82,6 +83,7 @@ func (s *WithdrawAllTestSuite) TestNewWithdrawAllRewardsGenerateOnly() { cmd := stakingcli.NewDelegateCmd() _, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) require.NoError(err) + require.NoError(s.network.WaitForNextBlock()) // delegate 500 tokens to validator2 args = []string{ @@ -94,6 +96,7 @@ func (s *WithdrawAllTestSuite) TestNewWithdrawAllRewardsGenerateOnly() { } _, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) require.NoError(err) + require.NoError(s.network.WaitForNextBlock()) args = []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, newAddr.String()), diff --git a/x/feegrant/client/testutil/suite.go b/x/feegrant/client/testutil/suite.go index 65d121e15ea..82f4dda3243 100644 --- a/x/feegrant/client/testutil/suite.go +++ b/x/feegrant/client/testutil/suite.go @@ -18,6 +18,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/feegrant" "github.com/cosmos/cosmos-sdk/x/feegrant/client/cli" govtestutil "github.com/cosmos/cosmos-sdk/x/gov/client/testutil" @@ -100,11 +101,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() { @@ -599,7 +598,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -706,7 +705,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -747,8 +746,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 @@ -887,7 +885,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -978,7 +976,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) }) } } @@ -986,3 +984,15 @@ func (s *IntegrationTestSuite) TestFilteredFeeAllowance() { func getFormattedExpiration(duration int64) string { return time.Now().Add(time.Duration(duration) * time.Second).Format(time.RFC3339) } + +func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { + s.Require().NoError(s.network.WaitForNextBlock()) + + cmd := authcli.QueryTxCmd() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) + + var response sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + s.Require().Equal(expectedCode, response.Code, out.String()) +} diff --git a/x/gov/client/testutil/deposits.go b/x/gov/client/testutil/deposits.go index ee609ac9f45..40965a13d25 100644 --- a/x/gov/client/testutil/deposits.go +++ b/x/gov/client/testutil/deposits.go @@ -108,6 +108,7 @@ func (s *DepositTestSuite) TestQueryDepositsWithoutInitialDeposit() { 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 +126,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, "") diff --git a/x/gov/client/testutil/tx.go b/x/gov/client/testutil/tx.go index bf1f825d05c..4a369683729 100644 --- a/x/gov/client/testutil/tx.go +++ b/x/gov/client/testutil/tx.go @@ -4,7 +4,9 @@ import ( "encoding/base64" "fmt" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/testutil" + tmcli "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/suite" @@ -13,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" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -156,7 +159,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -249,7 +252,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -327,7 +330,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.checkTxCode(clientCtx, resp.TxHash, tc.expectedCode) } }) } @@ -401,7 +404,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -498,8 +501,20 @@ 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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } } + +func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { + s.Require().NoError(s.network.WaitForNextBlock()) + + cmd := authcli.QueryTxCmd() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) + + var response sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + s.Require().Equal(expectedCode, response.Code, out.String()) +} From 08b3c80d496b3d7230f9152c3e82ae1d06c0553b Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 7 Sep 2022 15:58:44 +0200 Subject: [PATCH 04/19] fix feegrant tests --- tests/e2e/gov/client/testutil/cli_test.go | 4 ++++ x/feegrant/client/testutil/suite.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/e2e/gov/client/testutil/cli_test.go b/tests/e2e/gov/client/testutil/cli_test.go index 356babaef56..63bb7b4b65b 100644 --- a/tests/e2e/gov/client/testutil/cli_test.go +++ b/tests/e2e/gov/client/testutil/cli_test.go @@ -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/x/feegrant/client/testutil/suite.go b/x/feegrant/client/testutil/suite.go index 82f4dda3243..e542128a76c 100644 --- a/x/feegrant/client/testutil/suite.go +++ b/x/feegrant/client/testutil/suite.go @@ -794,7 +794,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.checkTxCode(clientCtx, resp.TxHash, tc.expErrCode) }) } } From 576a339062a4cfbd9a5e23a991123ed93eb0fe41 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 8 Sep 2022 17:16:58 +0200 Subject: [PATCH 05/19] fix tests --- tests/e2e/feegrant/suite.go | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/tests/e2e/feegrant/suite.go b/tests/e2e/feegrant/suite.go index 822e432c7fc..5980f4dae25 100644 --- a/tests/e2e/feegrant/suite.go +++ b/tests/e2e/feegrant/suite.go @@ -18,6 +18,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/feegrant" "github.com/cosmos/cosmos-sdk/x/feegrant/client/cli" govtestutil "github.com/cosmos/cosmos-sdk/x/gov/client/testutil" @@ -81,7 +82,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()), } @@ -321,7 +322,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 +600,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -612,7 +613,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 +707,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -727,7 +728,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()), } @@ -818,7 +819,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 +892,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) } }) } @@ -982,7 +983,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) }) } } @@ -990,3 +991,15 @@ func (s *IntegrationTestSuite) TestFilteredFeeAllowance() { func getFormattedExpiration(duration int64) string { return time.Now().Add(time.Duration(duration) * time.Second).Format(time.RFC3339) } + +func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { + s.Require().NoError(s.network.WaitForNextBlock()) + + cmd := authcli.QueryTxCmd() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + s.Require().NoError(err) + + var response sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) + s.Require().Equal(expectedCode, response.Code, out.String()) +} From f3fabec9a2b7b0049b0ddb924eb5145063ac2a4f Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 16 Sep 2022 17:47:57 +0200 Subject: [PATCH 06/19] fix test --- x/staking/client/cli/tx_test.go | 50 ++++++++++++++++----------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/x/staking/client/cli/tx_test.go b/x/staking/client/cli/tx_test.go index 0068741dec2..de93e24af96 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{}, From 6648a916f91023995df746af82d97fce55071978 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 16 Sep 2022 18:09:10 +0200 Subject: [PATCH 07/19] remove occurence of BroadcastTxCommit --- x/evidence/client/cli/tx_test.go | 4 ++-- x/genutil/client/cli/gentx_test.go | 4 ++-- x/group/client/cli/tx_test.go | 4 ++-- x/mint/client/cli/query_test.go | 4 ++-- x/staking/client/cli/tx_test.go | 2 +- x/upgrade/client/cli/tx_test.go | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/x/evidence/client/cli/tx_test.go b/x/evidence/client/cli/tx_test.go index 629f12ef3a2..a32532420c6 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/genutil/client/cli/gentx_test.go b/x/genutil/client/cli/gentx_test.go index 5b9bef9f6dd..3fc106ee785 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/group/client/cli/tx_test.go b/x/group/client/cli/tx_test.go index 4493be392d4..1ad4975e7bd 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( diff --git a/x/mint/client/cli/query_test.go b/x/mint/client/cli/query_test.go index bc34c5dec9e..72e79496499 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/staking/client/cli/tx_test.go b/x/staking/client/cli/tx_test.go index de93e24af96..e39a70e6f9c 100644 --- a/x/staking/client/cli/tx_test.go +++ b/x/staking/client/cli/tx_test.go @@ -43,7 +43,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{}, nil } diff --git a/x/upgrade/client/cli/tx_test.go b/x/upgrade/client/cli/tx_test.go index 0daf658ccdb..2de13e1fb62 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( From ff7d1752fc4fa3eb73d040e9936388a6065dc938 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 19 Sep 2022 15:23:08 +0200 Subject: [PATCH 08/19] remove BroadcastBlock added in rebase :cry: --- x/nft/client/cli/tx_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x/nft/client/cli/tx_test.go b/x/nft/client/cli/tx_test.go index 9113147f529..0cc85e642ae 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()), } From ed3b7c38036f0725cdc4e0e98d21e95409bb3ef3 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 19 Sep 2022 15:40:45 +0200 Subject: [PATCH 09/19] `make proto-gen` --- types/query/query.pb.go | 28 ++++++++++++------------- x/auth/types/query.pb.go | 10 +++++++-- x/bank/types/query.pb.go | 30 ++++++++++++++++++++++++++ x/nft/tx.pb.go | 35 +++++++++++++++++-------------- x/staking/types/query.pb.go | 42 +++++++++++++++++++++++++++++++++++++ 5 files changed, 113 insertions(+), 32 deletions(-) diff --git a/types/query/query.pb.go b/types/query/query.pb.go index b253b7a7693..f53f6a88e40 100644 --- a/types/query/query.pb.go +++ b/types/query/query.pb.go @@ -21,34 +21,34 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -var E_Deterministic = &proto.ExtensionDesc{ +var E_ModuleQuerySafe = &proto.ExtensionDesc{ ExtendedType: (*descriptorpb.MethodOptions)(nil), ExtensionType: (*bool)(nil), Field: 11110001, - Name: "cosmos.query.v1.deterministic", - Tag: "varint,11110001,opt,name=deterministic", + Name: "cosmos.query.v1.module_query_safe", + Tag: "varint,11110001,opt,name=module_query_safe", Filename: "cosmos/query/v1/query.proto", } func init() { - proto.RegisterExtension(E_Deterministic) + proto.RegisterExtension(E_ModuleQuerySafe) } func init() { proto.RegisterFile("cosmos/query/v1/query.proto", fileDescriptor_5c815d91553f8dca) } var fileDescriptor_5c815d91553f8dca = []byte{ - // 197 bytes of a gzipped FileDescriptorProto + // 205 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2f, 0x33, 0x84, 0x30, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xf8, 0x21, 0x92, 0x7a, 0x10, 0xb1, 0x32, 0x43, 0x29, 0x85, 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, 0x54, 0x7d, 0xb0, 0x74, 0x52, 0x69, 0x9a, 0x7e, 0x4a, 0x6a, 0x71, 0x72, 0x51, - 0x66, 0x41, 0x49, 0x7e, 0x11, 0x44, 0x8b, 0x95, 0x3b, 0x17, 0x6f, 0x4a, 0x6a, 0x49, 0x6a, 0x51, - 0x6e, 0x66, 0x5e, 0x66, 0x71, 0x49, 0x66, 0xb2, 0x90, 0x9c, 0x1e, 0x44, 0x8f, 0x1e, 0x4c, 0x8f, - 0x9e, 0x6f, 0x6a, 0x49, 0x46, 0x7e, 0x8a, 0x7f, 0x41, 0x49, 0x66, 0x7e, 0x5e, 0xb1, 0xc4, 0xc7, - 0x9e, 0x65, 0xac, 0x0a, 0x8c, 0x1a, 0x1c, 0x41, 0xa8, 0xfa, 0x9c, 0x9c, 0x4e, 0x3c, 0x92, 0x63, - 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, - 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x23, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, - 0x3f, 0x57, 0x1f, 0xea, 0x7a, 0x08, 0xa5, 0x5b, 0x9c, 0x92, 0xad, 0x5f, 0x52, 0x59, 0x90, 0x0a, - 0xf5, 0x4e, 0x12, 0x1b, 0xd8, 0x4e, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb2, 0x7c, 0x10, - 0x02, 0xe5, 0x00, 0x00, 0x00, + 0x66, 0x41, 0x49, 0x7e, 0x11, 0x44, 0x8b, 0x95, 0x2f, 0x97, 0x60, 0x6e, 0x7e, 0x4a, 0x69, 0x4e, + 0x6a, 0x3c, 0x58, 0x53, 0x7c, 0x71, 0x62, 0x5a, 0xaa, 0x90, 0x9c, 0x1e, 0x44, 0x9f, 0x1e, 0x4c, + 0x9f, 0x9e, 0x6f, 0x6a, 0x49, 0x46, 0x7e, 0x8a, 0x7f, 0x41, 0x49, 0x66, 0x7e, 0x5e, 0xb1, 0xc4, + 0xc7, 0x9e, 0x65, 0xac, 0x0a, 0x8c, 0x1a, 0x1c, 0x41, 0xfc, 0x10, 0xbd, 0x81, 0x20, 0xad, 0xc1, + 0x89, 0x69, 0xa9, 0x4e, 0x4e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, + 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, + 0x91, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0xf5, 0x03, 0x84, 0xd2, + 0x2d, 0x4e, 0xc9, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x85, 0x7a, 0x2a, 0x89, 0x0d, 0x6c, 0xab, 0x31, + 0x20, 0x00, 0x00, 0xff, 0xff, 0x7a, 0xfc, 0xd6, 0xfc, 0xeb, 0x00, 0x00, 0x00, } diff --git a/x/auth/types/query.pb.go b/x/auth/types/query.pb.go index f796b8e6670..60192dc7597 100644 --- a/x/auth/types/query.pb.go +++ b/x/auth/types/query.pb.go @@ -947,7 +947,10 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // Accounts returns all the existing accounts + // Accounts returns all the existing accounts. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. // // Since: cosmos-sdk 0.43 Accounts(ctx context.Context, in *QueryAccountsRequest, opts ...grpc.CallOption) (*QueryAccountsResponse, error) @@ -1070,7 +1073,10 @@ func (c *queryClient) AccountInfo(ctx context.Context, in *QueryAccountInfoReque // QueryServer is the server API for Query service. type QueryServer interface { - // Accounts returns all the existing accounts + // Accounts returns all the existing accounts. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. // // Since: cosmos-sdk 0.43 Accounts(context.Context, *QueryAccountsRequest) (*QueryAccountsResponse, error) diff --git a/x/bank/types/query.pb.go b/x/bank/types/query.pb.go index 1e57293ced4..b555ff463a8 100644 --- a/x/bank/types/query.pb.go +++ b/x/bank/types/query.pb.go @@ -1188,15 +1188,27 @@ type QueryClient interface { // Balance queries the balance of a single coin for a single account. Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error) // AllBalances queries the balance of all coins for a single account. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. AllBalances(ctx context.Context, in *QueryAllBalancesRequest, opts ...grpc.CallOption) (*QueryAllBalancesResponse, error) // SpendableBalances queries the spenable balance of all coins for a single // account. // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. + // // Since: cosmos-sdk 0.46 SpendableBalances(ctx context.Context, in *QuerySpendableBalancesRequest, opts ...grpc.CallOption) (*QuerySpendableBalancesResponse, error) // TotalSupply queries the total supply of all coins. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error) // SupplyOf queries the supply of a single coin. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. SupplyOf(ctx context.Context, in *QuerySupplyOfRequest, opts ...grpc.CallOption) (*QuerySupplyOfResponse, error) // Params queries the parameters of x/bank module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) @@ -1208,6 +1220,9 @@ type QueryClient interface { // DenomOwners queries for all account addresses that own a particular token // denomination. // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. + // // Since: cosmos-sdk 0.46 DenomOwners(ctx context.Context, in *QueryDenomOwnersRequest, opts ...grpc.CallOption) (*QueryDenomOwnersResponse, error) // SendEnabled queries for SendEnabled entries. @@ -1323,15 +1338,27 @@ type QueryServer interface { // Balance queries the balance of a single coin for a single account. Balance(context.Context, *QueryBalanceRequest) (*QueryBalanceResponse, error) // AllBalances queries the balance of all coins for a single account. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. AllBalances(context.Context, *QueryAllBalancesRequest) (*QueryAllBalancesResponse, error) // SpendableBalances queries the spenable balance of all coins for a single // account. // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. + // // Since: cosmos-sdk 0.46 SpendableBalances(context.Context, *QuerySpendableBalancesRequest) (*QuerySpendableBalancesResponse, error) // TotalSupply queries the total supply of all coins. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. TotalSupply(context.Context, *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error) // SupplyOf queries the supply of a single coin. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. SupplyOf(context.Context, *QuerySupplyOfRequest) (*QuerySupplyOfResponse, error) // Params queries the parameters of x/bank module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) @@ -1343,6 +1370,9 @@ type QueryServer interface { // DenomOwners queries for all account addresses that own a particular token // denomination. // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. + // // Since: cosmos-sdk 0.46 DenomOwners(context.Context, *QueryDenomOwnersRequest) (*QueryDenomOwnersResponse, error) // SendEnabled queries for SendEnabled entries. diff --git a/x/nft/tx.pb.go b/x/nft/tx.pb.go index b7c0b7486af..00a4f9f40cc 100644 --- a/x/nft/tx.pb.go +++ b/x/nft/tx.pb.go @@ -6,6 +6,7 @@ package nft import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -146,25 +147,27 @@ func init() { func init() { proto.RegisterFile("cosmos/nft/v1beta1/tx.proto", fileDescriptor_35818c6a0ef51f08) } var fileDescriptor_35818c6a0ef51f08 = []byte{ - // 273 bytes of a gzipped FileDescriptorProto + // 308 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0xcf, 0x4b, 0x2b, 0xd1, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0x48, 0xea, 0xe5, 0xa5, 0x95, 0xe8, - 0x41, 0x25, 0xa5, 0xc4, 0xa1, 0x1a, 0x72, 0x8b, 0xd3, 0xf5, 0xcb, 0x0c, 0x41, 0x14, 0x44, 0xb1, - 0x52, 0x29, 0x17, 0xbb, 0x6f, 0x71, 0x7a, 0x70, 0x6a, 0x5e, 0x8a, 0x90, 0x24, 0x17, 0x47, 0x72, - 0x4e, 0x62, 0x71, 0x71, 0x7c, 0x66, 0x8a, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x3b, 0x98, - 0xef, 0x99, 0x22, 0xc4, 0xc7, 0xc5, 0x94, 0x99, 0x22, 0xc1, 0x04, 0x16, 0x64, 0xca, 0x4c, 0x11, - 0x12, 0xe3, 0x62, 0x2b, 0x4e, 0xcd, 0x4b, 0x49, 0x2d, 0x92, 0x60, 0x06, 0x8b, 0x41, 0x79, 0x42, - 0x52, 0x5c, 0x1c, 0x45, 0xa9, 0xc9, 0xa9, 0x99, 0x65, 0xa9, 0x45, 0x12, 0x2c, 0x60, 0x19, 0x38, - 0xdf, 0x8a, 0xbb, 0xe9, 0xf9, 0x06, 0x2d, 0xa8, 0x42, 0x25, 0x41, 0x2e, 0x7e, 0xa8, 0xb5, 0x41, - 0xa9, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x46, 0x61, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0x1e, - 0x5c, 0x2c, 0x60, 0xd7, 0x48, 0xeb, 0x61, 0x7a, 0x43, 0x0f, 0xaa, 0x47, 0x4a, 0x19, 0x8f, 0x24, - 0xcc, 0x40, 0x29, 0xd6, 0x86, 0xe7, 0x1b, 0xb4, 0x18, 0x9d, 0x6c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, - 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, - 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x29, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, - 0x57, 0x1f, 0x1a, 0x3e, 0x10, 0x4a, 0xb7, 0x38, 0x25, 0x5b, 0xbf, 0x02, 0x14, 0xba, 0x49, 0x6c, - 0xe0, 0x60, 0x32, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xd8, 0xef, 0x0a, 0x72, 0x01, 0x00, - 0x00, + 0x41, 0x25, 0xa5, 0x24, 0x21, 0x62, 0xf1, 0x60, 0x15, 0xfa, 0x50, 0x05, 0x60, 0x8e, 0x94, 0x38, + 0xd4, 0xac, 0xdc, 0xe2, 0x74, 0xfd, 0x32, 0x43, 0x10, 0x05, 0x91, 0x50, 0x5a, 0xc9, 0xc8, 0xc5, + 0xee, 0x5b, 0x9c, 0x1e, 0x9c, 0x9a, 0x97, 0x22, 0x24, 0xc9, 0xc5, 0x91, 0x9c, 0x93, 0x58, 0x5c, + 0x1c, 0x9f, 0x99, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0xc4, 0x0e, 0xe6, 0x7b, 0xa6, 0x08, + 0xf1, 0x71, 0x31, 0x65, 0xa6, 0x48, 0x30, 0x81, 0x05, 0x99, 0x32, 0x53, 0x84, 0x0c, 0xb8, 0xd8, + 0x8a, 0x53, 0xf3, 0x52, 0x52, 0x8b, 0x24, 0x98, 0x41, 0x62, 0x4e, 0x12, 0x97, 0xb6, 0xe8, 0x8a, + 0x40, 0x6d, 0x74, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x0e, 0x2e, 0x29, 0xca, 0xcc, 0x4b, 0x0f, + 0x82, 0xaa, 0x13, 0x32, 0xe1, 0xe2, 0x28, 0x4a, 0x4d, 0x4e, 0xcd, 0x2c, 0x4b, 0x2d, 0x92, 0x60, + 0x21, 0xa0, 0x07, 0xae, 0xd2, 0x8a, 0xbb, 0xe9, 0xf9, 0x06, 0x2d, 0xa8, 0x11, 0x4a, 0x82, 0x5c, + 0xfc, 0x50, 0xa7, 0x06, 0xa5, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x1a, 0x85, 0x71, 0x31, 0xfb, + 0x16, 0xa7, 0x0b, 0x79, 0x70, 0xb1, 0x80, 0x7d, 0x20, 0xad, 0x87, 0x19, 0x2c, 0x7a, 0x50, 0x3d, + 0x52, 0xca, 0x78, 0x24, 0x61, 0x06, 0x4a, 0xb1, 0x36, 0x3c, 0xdf, 0xa0, 0xc5, 0xe8, 0x64, 0x73, + 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, + 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x4a, 0xe9, 0x99, 0x25, 0x19, 0xa5, + 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xd0, 0x20, 0x86, 0x52, 0xba, 0xc5, 0x29, 0xd9, 0xfa, 0x15, 0xa0, + 0xd8, 0x4a, 0x62, 0x03, 0x87, 0xad, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x17, 0x66, 0xb6, 0x12, + 0xc2, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/staking/types/query.pb.go b/x/staking/types/query.pb.go index 65b4cc133af..0653c471851 100644 --- a/x/staking/types/query.pb.go +++ b/x/staking/types/query.pb.go @@ -1527,12 +1527,21 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { // Validators queries all validators that match the given status. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. Validators(ctx context.Context, in *QueryValidatorsRequest, opts ...grpc.CallOption) (*QueryValidatorsResponse, error) // Validator queries validator info for given validator address. Validator(ctx context.Context, in *QueryValidatorRequest, opts ...grpc.CallOption) (*QueryValidatorResponse, error) // ValidatorDelegations queries delegate info for given validator. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. ValidatorDelegations(ctx context.Context, in *QueryValidatorDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorDelegationsResponse, error) // ValidatorUnbondingDelegations queries unbonding delegations of a validator. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. ValidatorUnbondingDelegations(ctx context.Context, in *QueryValidatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorUnbondingDelegationsResponse, error) // Delegation queries delegate info for given validator delegator pair. Delegation(ctx context.Context, in *QueryDelegationRequest, opts ...grpc.CallOption) (*QueryDelegationResponse, error) @@ -1540,14 +1549,26 @@ type QueryClient interface { // pair. UnbondingDelegation(ctx context.Context, in *QueryUnbondingDelegationRequest, opts ...grpc.CallOption) (*QueryUnbondingDelegationResponse, error) // DelegatorDelegations queries all delegations of a given delegator address. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. DelegatorDelegations(ctx context.Context, in *QueryDelegatorDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorDelegationsResponse, error) // DelegatorUnbondingDelegations queries all unbonding delegations of a given // delegator address. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. DelegatorUnbondingDelegations(ctx context.Context, in *QueryDelegatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorUnbondingDelegationsResponse, error) // Redelegations queries redelegations of given address. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. Redelegations(ctx context.Context, in *QueryRedelegationsRequest, opts ...grpc.CallOption) (*QueryRedelegationsResponse, error) // DelegatorValidators queries all validators info for given delegator // address. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. DelegatorValidators(ctx context.Context, in *QueryDelegatorValidatorsRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorsResponse, error) // DelegatorValidator queries validator info for given delegator validator // pair. @@ -1697,12 +1718,21 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . // QueryServer is the server API for Query service. type QueryServer interface { // Validators queries all validators that match the given status. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. Validators(context.Context, *QueryValidatorsRequest) (*QueryValidatorsResponse, error) // Validator queries validator info for given validator address. Validator(context.Context, *QueryValidatorRequest) (*QueryValidatorResponse, error) // ValidatorDelegations queries delegate info for given validator. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. ValidatorDelegations(context.Context, *QueryValidatorDelegationsRequest) (*QueryValidatorDelegationsResponse, error) // ValidatorUnbondingDelegations queries unbonding delegations of a validator. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. ValidatorUnbondingDelegations(context.Context, *QueryValidatorUnbondingDelegationsRequest) (*QueryValidatorUnbondingDelegationsResponse, error) // Delegation queries delegate info for given validator delegator pair. Delegation(context.Context, *QueryDelegationRequest) (*QueryDelegationResponse, error) @@ -1710,14 +1740,26 @@ type QueryServer interface { // pair. UnbondingDelegation(context.Context, *QueryUnbondingDelegationRequest) (*QueryUnbondingDelegationResponse, error) // DelegatorDelegations queries all delegations of a given delegator address. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. DelegatorDelegations(context.Context, *QueryDelegatorDelegationsRequest) (*QueryDelegatorDelegationsResponse, error) // DelegatorUnbondingDelegations queries all unbonding delegations of a given // delegator address. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. DelegatorUnbondingDelegations(context.Context, *QueryDelegatorUnbondingDelegationsRequest) (*QueryDelegatorUnbondingDelegationsResponse, error) // Redelegations queries redelegations of given address. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. Redelegations(context.Context, *QueryRedelegationsRequest) (*QueryRedelegationsResponse, error) // DelegatorValidators queries all validators info for given delegator // address. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. DelegatorValidators(context.Context, *QueryDelegatorValidatorsRequest) (*QueryDelegatorValidatorsResponse, error) // DelegatorValidator queries validator info for given delegator validator // pair. From 31c9df90643412099d47849085386f9b2f2dfc8a Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 22 Sep 2022 13:53:52 +0200 Subject: [PATCH 10/19] extract checkTxCode --- tests/e2e/crisis/suite.go | 17 +----- tests/e2e/feegrant/suite.go | 21 ++----- tests/e2e/group/tx.go | 64 ++++++++------------- tests/e2e/nft/tx.go | 17 +----- tests/e2e/slashing/client/testutil/suite.go | 16 +----- tests/e2e/staking/client/testutil/suite.go | 23 ++------ testutil/cli/tx.go | 40 +++++++++++++ x/authz/client/testutil/tx.go | 35 ++++------- x/feegrant/client/testutil/suite.go | 23 ++------ x/gov/client/testutil/tx.go | 25 ++------ 10 files changed, 98 insertions(+), 183 deletions(-) create mode 100644 testutil/cli/tx.go diff --git a/tests/e2e/crisis/suite.go b/tests/e2e/crisis/suite.go index 1220a0c15ea..203bce15a42 100644 --- a/tests/e2e/crisis/suite.go +++ b/tests/e2e/crisis/suite.go @@ -3,16 +3,13 @@ package crisis import ( "fmt" - "github.com/cosmos/cosmos-sdk/client" "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" - authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/x/crisis/client/cli" "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/suite" - tmcli "github.com/tendermint/tendermint/libs/cli" ) type IntegrationTestSuite struct { @@ -102,20 +99,8 @@ func (s *IntegrationTestSuite) TestNewMsgVerifyInvariantTxCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } } - -func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { - s.Require().NoError(s.network.WaitForNextBlock()) - - cmd := authcli.QueryTxCmd() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) - s.Require().NoError(err) - - var response sdk.TxResponse - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(expectedCode, response.Code, out.String()) -} diff --git a/tests/e2e/feegrant/suite.go b/tests/e2e/feegrant/suite.go index 5980f4dae25..a1ba6eea58f 100644 --- a/tests/e2e/feegrant/suite.go +++ b/tests/e2e/feegrant/suite.go @@ -18,7 +18,6 @@ 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/feegrant" "github.com/cosmos/cosmos-sdk/x/feegrant/client/cli" govtestutil "github.com/cosmos/cosmos-sdk/x/gov/client/testutil" @@ -600,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -707,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -892,7 +891,7 @@ func (s *IntegrationTestSuite) TestFilteredFeeAllowance() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -983,7 +982,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) }) } } @@ -991,15 +990,3 @@ func (s *IntegrationTestSuite) TestFilteredFeeAllowance() { func getFormattedExpiration(duration int64) string { return time.Now().Add(time.Duration(duration) * time.Second).Format(time.RFC3339) } - -func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { - s.Require().NoError(s.network.WaitForNextBlock()) - - cmd := authcli.QueryTxCmd() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) - s.Require().NoError(err) - - var response sdk.TxResponse - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(expectedCode, response.Code, out.String()) -} diff --git a/tests/e2e/group/tx.go b/tests/e2e/group/tx.go index 0c39afad879..601bdfe3983 100644 --- a/tests/e2e/group/tx.go +++ b/tests/e2e/group/tx.go @@ -12,7 +12,6 @@ import ( "github.com/stretchr/testify/suite" tmcli "github.com/tendermint/tendermint/libs/cli" - sdkclient "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -20,7 +19,6 @@ import ( "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" 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" @@ -111,7 +109,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.Require().NoError(err, out.String()) txResp := sdk.TxResponse{} s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.checkTxCode(val.ClientCtx, txResp.TxHash, 0) + 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} @@ -142,7 +140,7 @@ func (s *IntegrationTestSuite) SetupSuite() { ) s.Require().NoError(err, out.String()) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.checkTxCode(val.ClientCtx, txResp.TxHash, 0) + 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)}) s.Require().NoError(err, out.String()) @@ -166,7 +164,7 @@ func (s *IntegrationTestSuite) SetupSuite() { ) s.Require().NoError(err, out.String()) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.checkTxCode(val.ClientCtx, txResp.TxHash, 0) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, txResp.TxHash, 0)) // vote out, err = cli.ExecTestCLICmd(val.ClientCtx, client.MsgVoteCmd(), @@ -182,7 +180,7 @@ func (s *IntegrationTestSuite) SetupSuite() { ) s.Require().NoError(err, out.String()) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.checkTxCode(val.ClientCtx, txResp.TxHash, 0) + 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)}) s.Require().NoError(err, out.String()) @@ -355,7 +353,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroup() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -387,7 +385,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() { require.NoError(err, out.String()) var txResp sdk.TxResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.checkTxCode(val.ClientCtx, txResp.TxHash, 0) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, txResp.TxHash, 0)) groupIDs[i] = s.getGroupIDFromTxResponse(txResp) } @@ -556,7 +554,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMetadata() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -678,7 +676,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMembers() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -884,7 +882,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1052,7 +1050,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1152,7 +1150,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyAdmin() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1297,7 +1295,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyDecisionPolicy() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1412,7 +1410,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyMetadata() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1600,7 +1598,7 @@ func (s *IntegrationTestSuite) TestTxSubmitProposal() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1634,7 +1632,7 @@ func (s *IntegrationTestSuite) TestTxVote() { var txResp sdk.TxResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.checkTxCode(clientCtx, txResp.TxHash, 0) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, 0)) ids[i] = s.getProposalIDFromTxResponse(txResp) } @@ -1793,7 +1791,7 @@ func (s *IntegrationTestSuite) TestTxVote() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1821,7 +1819,7 @@ func (s *IntegrationTestSuite) TestTxWithdrawProposal() { var txResp sdk.TxResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.checkTxCode(clientCtx, txResp.TxHash, 0) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, 0)) ids[i] = s.getProposalIDFromTxResponse(txResp) } @@ -1919,7 +1917,7 @@ func (s *IntegrationTestSuite) TestTxWithdrawProposal() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1964,7 +1962,7 @@ func (s *IntegrationTestSuite) TestTxExec() { var txResp sdk.TxResponse require.NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.checkTxCode(clientCtx, txResp.TxHash, 0) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, 0)) proposalID := s.getProposalIDFromTxResponse(txResp) proposalIDs = append(proposalIDs, proposalID) @@ -2252,7 +2250,7 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { s.Require().NoError(err, out.String()) var resp sdk.TxResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) - s.checkTxCode(clientCtx, resp.TxHash, 0) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0)) return err }, @@ -2279,7 +2277,7 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { s.Require().NoError(err, out.String()) var resp sdk.TxResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) - s.checkTxCode(clientCtx, resp.TxHash, 0) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0)) return err }, @@ -2306,7 +2304,7 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { s.Require().NoError(err, out.String()) var resp sdk.TxResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) - s.checkTxCode(clientCtx, resp.TxHash, 0) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0)) return err }, @@ -2338,7 +2336,7 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { s.Require().NoError(err, out.String()) var resp sdk.TxResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) - s.checkTxCode(clientCtx, resp.TxHash, 0) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0)) return err }, @@ -2392,7 +2390,7 @@ 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.checkTxCode(clientCtx, txResp.TxHash, 0) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, 0)) } @@ -2544,7 +2542,7 @@ 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.checkTxCode(val.ClientCtx, txResp.TxHash, 0) + 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)}) s.Require().NoError(err, out.String()) @@ -2575,15 +2573,3 @@ func (s *IntegrationTestSuite) newValidMembers(weights, membersAddress []string) } return membersValid } - -func (s *IntegrationTestSuite) checkTxCode(clientCtx sdkclient.Context, txHash string, expectedCode uint32) { - s.Require().NoError(s.network.WaitForNextBlock()) - - cmd := authcli.QueryTxCmd() - out, err := cli.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) - s.Require().NoError(err) - - var response sdk.TxResponse - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(expectedCode, response.Code, out.String()) -} diff --git a/tests/e2e/nft/tx.go b/tests/e2e/nft/tx.go index b5c0ecc4370..88ef5b3168c 100644 --- a/tests/e2e/nft/tx.go +++ b/tests/e2e/nft/tx.go @@ -4,14 +4,11 @@ import ( "fmt" "github.com/stretchr/testify/suite" - tmcli "github.com/tendermint/tendermint/libs/cli" - "github.com/cosmos/cosmos-sdk/client" "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" - authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/x/nft" ) @@ -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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -163,15 +160,3 @@ func (s *IntegrationTestSuite) initAccount() { _, err = clitestutil.MsgSendExec(ctx, val.Address, s.owner, amount, args...) s.Require().NoError(err) } - -func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { - s.Require().NoError(s.network.WaitForNextBlock()) - - cmd := authcli.QueryTxCmd() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) - s.Require().NoError(err) - - var response sdk.TxResponse - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(expectedCode, response.Code, out.String()) -} diff --git a/tests/e2e/slashing/client/testutil/suite.go b/tests/e2e/slashing/client/testutil/suite.go index 775d203683f..2a8ee58dc33 100644 --- a/tests/e2e/slashing/client/testutil/suite.go +++ b/tests/e2e/slashing/client/testutil/suite.go @@ -8,12 +8,10 @@ import ( "github.com/stretchr/testify/suite" tmcli "github.com/tendermint/tendermint/libs/cli" - "github.com/cosmos/cosmos-sdk/client" "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" - authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/x/slashing/client/cli" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" ) @@ -180,20 +178,8 @@ func (s *EndToEndTestSuite) TestNewUnjailTxCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } } - -func (s *EndToEndTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { - s.Require().NoError(s.network.WaitForNextBlock()) - - cmd := authcli.QueryTxCmd() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) - s.Require().NoError(err) - - var response sdk.TxResponse - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(expectedCode, response.Code, out.String()) -} diff --git a/tests/e2e/staking/client/testutil/suite.go b/tests/e2e/staking/client/testutil/suite.go index 12586f6ea2a..462dc85af5f 100644 --- a/tests/e2e/staking/client/testutil/suite.go +++ b/tests/e2e/staking/client/testutil/suite.go @@ -13,7 +13,6 @@ import ( "github.com/tendermint/tendermint/proto/tendermint/crypto" "github.com/tendermint/tendermint/rpc/client/http" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -1074,7 +1073,7 @@ func (s *IntegrationTestSuite) TestNewEditValidatorCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1160,7 +1159,7 @@ func (s *IntegrationTestSuite) TestNewDelegateCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1246,7 +1245,7 @@ func (s *IntegrationTestSuite) TestNewRedelegateCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1313,7 +1312,7 @@ func (s *IntegrationTestSuite) TestNewUnbondCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1432,7 +1431,7 @@ func (s *IntegrationTestSuite) TestNewCancelUnbondingDelegationCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -1560,15 +1559,3 @@ func (s *IntegrationTestSuite) TestEditValidatorMoniker() { require.NoError(val.ClientCtx.Codec.UnmarshalJSON(res.Bytes(), &result)) require.Equal(result.GetMoniker(), moniker) } - -func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { - s.Require().NoError(s.network.WaitForNextBlock()) - - cmd := authcli.QueryTxCmd() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) - s.Require().NoError(err) - - var response sdk.TxResponse - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(expectedCode, response.Code, out.String()) -} diff --git a/testutil/cli/tx.go b/testutil/cli/tx.go new file mode 100644 index 00000000000..bf5bd1f8f87 --- /dev/null +++ b/testutil/cli/tx.go @@ -0,0 +1,40 @@ +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 +} diff --git a/x/authz/client/testutil/tx.go b/x/authz/client/testutil/tx.go index 18adc6bc05f..a28327c44df 100644 --- a/x/authz/client/testutil/tx.go +++ b/x/authz/client/testutil/tx.go @@ -8,7 +8,6 @@ import ( "github.com/stretchr/testify/suite" tmcli "github.com/tendermint/tendermint/libs/cli" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -81,7 +80,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.Require().NoError(s.network.WaitForNextBlock()) var response sdk.TxResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.checkTxCode(val.ClientCtx, response.TxHash, 0) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, response.TxHash, 0)) // Create new account in the keyring. s.grantee[2] = s.createAccount("grantee3") @@ -126,7 +125,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.Require().NoError(s.network.WaitForNextBlock()) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.checkTxCode(val.ClientCtx, response.TxHash, 0) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, response.TxHash, 0)) } func (s *IntegrationTestSuite) createAccount(uid string) sdk.AccAddress { @@ -525,7 +524,7 @@ func (s *IntegrationTestSuite) TestCLITxGrantAuthorization() { var txResp sdk.TxResponse s.Require().NoError(err) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.checkTxCode(val.ClientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -681,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.checkTxCode(val.ClientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -726,7 +725,7 @@ func (s *IntegrationTestSuite) TestExecAuthorizationWithExpiration() { s.Require().NoError(err) var response sdk.TxResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.checkTxCode(clientCtx, response.TxHash, authz.ErrNoAuthorizationFound.ABCICode()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, response.TxHash, authz.ErrNoAuthorizationFound.ABCICode())) } func (s *IntegrationTestSuite) TestNewExecGenericAuthorized() { @@ -825,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.checkTxCode(val.ClientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -935,7 +934,7 @@ func (s *IntegrationTestSuite) TestNewExecGrantAuthorized() { default: s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.checkTxCode(val.ClientCtx, response.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, response.TxHash, tc.expectedCode)) } }) } @@ -1122,7 +1121,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.checkTxCode(val.ClientCtx, response.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, response.TxHash, tc.expectedCode)) } }) } @@ -1201,7 +1200,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.checkTxCode(val.ClientCtx, response.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, response.TxHash, tc.expectedCode)) } }) } @@ -1356,7 +1355,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.checkTxCode(val.ClientCtx, response.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, response.TxHash, tc.expectedCode)) } }) } @@ -1437,20 +1436,8 @@ func (s *IntegrationTestSuite) TestExecUndelegateAuthorization() { var response sdk.TxResponse s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.checkTxCode(val.ClientCtx, response.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, response.TxHash, tc.expectedCode)) } }) } } - -func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { - s.Require().NoError(s.network.WaitForNextBlock()) - - cmd := authcli.QueryTxCmd() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) - s.Require().NoError(err) - - var response sdk.TxResponse - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(expectedCode, response.Code, out.String()) -} diff --git a/x/feegrant/client/testutil/suite.go b/x/feegrant/client/testutil/suite.go index e542128a76c..454bda24656 100644 --- a/x/feegrant/client/testutil/suite.go +++ b/x/feegrant/client/testutil/suite.go @@ -18,7 +18,6 @@ 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/feegrant" "github.com/cosmos/cosmos-sdk/x/feegrant/client/cli" govtestutil "github.com/cosmos/cosmos-sdk/x/gov/client/testutil" @@ -598,7 +597,7 @@ func (s *IntegrationTestSuite) TestNewCmdFeeGrant() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -705,7 +704,7 @@ func (s *IntegrationTestSuite) TestNewCmdRevokeFeegrant() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -794,7 +793,7 @@ func (s *IntegrationTestSuite) TestTxWithFeeGrant() { var resp sdk.TxResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) - s.checkTxCode(clientCtx, resp.TxHash, tc.expErrCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, tc.expErrCode)) }) } } @@ -885,7 +884,7 @@ func (s *IntegrationTestSuite) TestFilteredFeeAllowance() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -976,7 +975,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) }) } } @@ -984,15 +983,3 @@ func (s *IntegrationTestSuite) TestFilteredFeeAllowance() { func getFormattedExpiration(duration int64) string { return time.Now().Add(time.Duration(duration) * time.Second).Format(time.RFC3339) } - -func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { - s.Require().NoError(s.network.WaitForNextBlock()) - - cmd := authcli.QueryTxCmd() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) - s.Require().NoError(err) - - var response sdk.TxResponse - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(expectedCode, response.Code, out.String()) -} diff --git a/x/gov/client/testutil/tx.go b/x/gov/client/testutil/tx.go index 4a369683729..d0a08efb45c 100644 --- a/x/gov/client/testutil/tx.go +++ b/x/gov/client/testutil/tx.go @@ -4,9 +4,7 @@ import ( "encoding/base64" "fmt" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/testutil" - tmcli "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/suite" @@ -15,7 +13,6 @@ 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" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -159,7 +156,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -252,7 +249,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.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -330,7 +327,7 @@ func (s *IntegrationTestSuite) TestNewCmdDeposit() { s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) - s.checkTxCode(clientCtx, resp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, tc.expectedCode)) } }) } @@ -404,7 +401,7 @@ func (s *IntegrationTestSuite) TestNewCmdVote() { } else { s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -501,20 +498,8 @@ func (s *IntegrationTestSuite) TestNewCmdWeightedVote() { } else { s.Require().NoError(err) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.checkTxCode(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } } - -func (s *IntegrationTestSuite) checkTxCode(clientCtx client.Context, txHash string, expectedCode uint32) { - s.Require().NoError(s.network.WaitForNextBlock()) - - cmd := authcli.QueryTxCmd() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) - s.Require().NoError(err) - - var response sdk.TxResponse - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(expectedCode, response.Code, out.String()) -} From 53efc780bc368fa1044fb9082afc98f23b58c15d Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 22 Sep 2022 15:16:53 +0200 Subject: [PATCH 11/19] fix typo --- tests/e2e/group/tx.go | 88 +++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/tests/e2e/group/tx.go b/tests/e2e/group/tx.go index 601bdfe3983..ab049bb1fc4 100644 --- a/tests/e2e/group/tx.go +++ b/tests/e2e/group/tx.go @@ -16,7 +16,7 @@ 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" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -72,7 +72,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.Require().NoError(err) account := sdk.AccAddress(pk.Address()) - _, err = cli.MsgSendExec( + _, err = clitestutil.MsgSendExec( val.ClientCtx, val.Address, account, @@ -96,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(), @@ -122,12 +122,12 @@ 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()) } 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(), @@ -142,7 +142,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), 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( @@ -167,7 +167,7 @@ func (s *IntegrationTestSuite) SetupSuite() { 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", @@ -182,14 +182,14 @@ func (s *IntegrationTestSuite) SetupSuite() { s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), 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 @@ -345,7 +345,7 @@ 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 { @@ -372,7 +372,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(), @@ -466,7 +466,7 @@ 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) } else { @@ -546,7 +546,7 @@ 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 { @@ -668,7 +668,7 @@ 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 { @@ -874,7 +874,7 @@ 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 { @@ -1042,7 +1042,7 @@ 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 { @@ -1142,7 +1142,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 { @@ -1287,7 +1287,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 { @@ -1402,7 +1402,7 @@ 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 { @@ -1590,7 +1590,7 @@ 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 { @@ -1616,7 +1616,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( @@ -1783,7 +1783,7 @@ 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 { @@ -1804,7 +1804,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( @@ -1909,7 +1909,7 @@ 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 { @@ -1946,7 +1946,7 @@ func (s *IntegrationTestSuite) TestTxExec() { 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( @@ -1966,7 +1966,7 @@ func (s *IntegrationTestSuite) TestTxExec() { 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, @@ -2053,7 +2053,7 @@ 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) } else { @@ -2090,7 +2090,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(), @@ -2106,7 +2106,7 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { 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(), @@ -2119,7 +2119,7 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { ) require.NoError(err, out.String()) - out, err = cli.ExecTestCLICmd(clientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{groupID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + out, err = clitestutil.ExecTestCLICmd(clientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{groupID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) require.NoError(err, out.String()) require.NotNil(out) var resp group.QueryGroupPoliciesByGroupResponse @@ -2204,7 +2204,7 @@ 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) } else { @@ -2246,7 +2246,7 @@ 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()) @@ -2273,7 +2273,7 @@ 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()) @@ -2300,7 +2300,7 @@ 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()) @@ -2332,7 +2332,7 @@ 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()) @@ -2368,14 +2368,14 @@ 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()) 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, @@ -2407,7 +2407,7 @@ 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 @@ -2480,7 +2480,7 @@ 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, @@ -2508,7 +2508,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], @@ -2528,7 +2528,7 @@ func (s *IntegrationTestSuite) createGroupThresholdPolicyWithBalance(adminAddres 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, @@ -2544,7 +2544,7 @@ func (s *IntegrationTestSuite) createGroupThresholdPolicyWithBalance(adminAddres s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), 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 @@ -2553,7 +2553,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..., ) From 1903cba5836d5c617da28661e78e65f1f812ae3f Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 23 Sep 2022 00:33:00 +0200 Subject: [PATCH 12/19] fix e2e tests --- tests/e2e/auth/vesting/client/testutil/suite.go | 8 +++----- tests/e2e/bank/client/suite.go | 3 +-- tests/e2e/client/grpc/tmservice/service_test.go | 3 +-- tests/e2e/crisis/suite.go | 3 +-- .../{client/testutil => }/cli_test.go | 2 +- tests/e2e/evidence/suite.go | 3 +-- tests/e2e/feegrant/suite.go | 11 +++++------ tests/e2e/genutil/suite.go | 3 +-- tests/e2e/gov/{client/testutil => }/cli_test.go | 2 +- tests/e2e/group/tx.go | 6 +++--- tests/e2e/mint/suite.go | 3 +-- tests/e2e/tx/service_test.go | 7 ++----- testutil/network/doc.go | 3 +-- x/auth/client/testutil/suite.go | 3 +-- .../client/testutil/grpc_query_suite.go | 3 +-- x/distribution/client/testutil/suite.go | 3 +-- .../client/testutil/withdraw_all_suite.go | 3 +-- x/feegrant/client/testutil/suite.go | 3 +-- x/gov/client/testutil/deposits.go | 13 +++++-------- x/gov/client/testutil/tx.go | 15 ++++++--------- x/params/client/testutil/suite.go | 3 +-- 21 files changed, 39 insertions(+), 64 deletions(-) rename tests/e2e/distribution/{client/testutil => }/cli_test.go (95%) rename tests/e2e/gov/{client/testutil => }/cli_test.go (98%) diff --git a/tests/e2e/auth/vesting/client/testutil/suite.go b/tests/e2e/auth/vesting/client/testutil/suite.go index aadf2a0a9d6..843523ea0a9 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 6256349fda1..c79a87e7fb8 100644 --- a/tests/e2e/bank/client/suite.go +++ b/tests/e2e/bank/client/suite.go @@ -89,8 +89,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 5ab389ae311..34ca8a1b128 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 203bce15a42..cbcf948fef5 100644 --- a/tests/e2e/crisis/suite.go +++ b/tests/e2e/crisis/suite.go @@ -30,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() { 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 ba7dfb8231d..0029be1e38a 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 7e683a577ad..7851345356e 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 a1ba6eea58f..bcc1d214aed 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 @@ -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) } }) @@ -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 diff --git a/tests/e2e/genutil/suite.go b/tests/e2e/genutil/suite.go index 6560192400d..c4432e353fa 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 98% rename from tests/e2e/gov/client/testutil/cli_test.go rename to tests/e2e/gov/cli_test.go index 63bb7b4b65b..ffea40b2351 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" diff --git a/tests/e2e/group/tx.go b/tests/e2e/group/tx.go index ab049bb1fc4..5cb6add522f 100644 --- a/tests/e2e/group/tx.go +++ b/tests/e2e/group/tx.go @@ -58,9 +58,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] @@ -2525,6 +2523,8 @@ func (s *IntegrationTestSuite) createGroupWithMembers(membersWeight, membersAddr } 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 diff --git a/tests/e2e/mint/suite.go b/tests/e2e/mint/suite.go index 8047f3c86fb..4f62902d157 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/tx/service_test.go b/tests/e2e/tx/service_test.go index c57d7935aee..881804e99e5 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) @@ -603,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/network/doc.go b/testutil/network/doc.go index fa7cc7d7715..b00a75aeded 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/x/auth/client/testutil/suite.go b/x/auth/client/testutil/suite.go index b7579d014b3..f262272f0df 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() { diff --git a/x/distribution/client/testutil/grpc_query_suite.go b/x/distribution/client/testutil/grpc_query_suite.go index 64a9732ae96..ddfa15a6f4b 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 cfa374f5114..9ef7c72b761 100644 --- a/x/distribution/client/testutil/suite.go +++ b/x/distribution/client/testutil/suite.go @@ -63,8 +63,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. diff --git a/x/distribution/client/testutil/withdraw_all_suite.go b/x/distribution/client/testutil/withdraw_all_suite.go index a7067b0a81a..8f1c7fbd2f0 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. diff --git a/x/feegrant/client/testutil/suite.go b/x/feegrant/client/testutil/suite.go index 454bda24656..382c9a10114 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 diff --git a/x/gov/client/testutil/deposits.go b/x/gov/client/testutil/deposits.go index 40965a13d25..3483bdd90dd 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,6 +98,7 @@ 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, "") @@ -189,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/tx.go b/x/gov/client/testutil/tx.go index d0a08efb45c..8a166911424 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() { diff --git a/x/params/client/testutil/suite.go b/x/params/client/testutil/suite.go index 1318cfbd863..beeca2681db 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() { From a92f2b8b7d932cebd0f6a8ada06fa3d53adf30a9 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 23 Sep 2022 00:54:38 +0200 Subject: [PATCH 13/19] updates --- CHANGELOG.md | 2 ++ UPGRADING.md | 4 ++++ server/config/config.go | 48 ++++++++++++++++++++--------------------- server/config/toml.go | 4 ++-- simapp/simd/cmd/root.go | 2 +- tests/e2e/group/tx.go | 5 ++--- 6 files changed, 35 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf55ea672ad..9c5a089a250 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -149,6 +149,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 5e95214ecf8..83cc1554a09 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -35,6 +35,10 @@ 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. + ### `x/gov` #### Minimum Proposal Deposit At Time of Submission diff --git a/server/config/config.go b/server/config/config.go index 21b9ff4490d..eb56824688e 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 3e6e6cbe073..0f8a4c9340c 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 bcfaa1bd361..11719637d73 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/group/tx.go b/tests/e2e/group/tx.go index 5cb6add522f..797fd2b2957 100644 --- a/tests/e2e/group/tx.go +++ b/tests/e2e/group/tx.go @@ -118,10 +118,11 @@ func (s *IntegrationTestSuite) SetupSuite() { threshold = 3 } + s.Require().NoError(s.network.WaitForNextBlock()) s.createGroupThresholdPolicyWithBalance(val.Address.String(), "1", threshold, 1000) - 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 @@ -2523,8 +2524,6 @@ func (s *IntegrationTestSuite) createGroupWithMembers(membersWeight, membersAddr } 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 From c8cbe258557e5d61617bb6410a623a3df7e8224c Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 23 Sep 2022 01:01:49 +0200 Subject: [PATCH 14/19] updates --- tests/e2e/bank/client/suite.go | 4 ++-- tests/e2e/group/tx.go | 5 ++--- x/distribution/client/testutil/suite.go | 21 ++++----------------- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/tests/e2e/bank/client/suite.go b/tests/e2e/bank/client/suite.go index c79a87e7fb8..dcf14fd1fee 100644 --- a/tests/e2e/bank/client/suite.go +++ b/tests/e2e/bank/client/suite.go @@ -520,7 +520,7 @@ func (s *EndToEndTestSuite) TestNewSendTxCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), tc.respType), bz.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)) } }) } @@ -655,7 +655,7 @@ func (s *EndToEndTestSuite) TestNewMultiSendTxCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), tc.respType), bz.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/group/tx.go b/tests/e2e/group/tx.go index 797fd2b2957..422eb875d82 100644 --- a/tests/e2e/group/tx.go +++ b/tests/e2e/group/tx.go @@ -118,7 +118,6 @@ func (s *IntegrationTestSuite) SetupSuite() { threshold = 3 } - s.Require().NoError(s.network.WaitForNextBlock()) s.createGroupThresholdPolicyWithBalance(val.Address.String(), "1", threshold, 1000) out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{"1", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) s.Require().NoError(err, out.String()) @@ -473,7 +472,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() { require.NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - require.Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -2060,7 +2059,7 @@ func (s *IntegrationTestSuite) TestTxExec() { require.NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - require.Equal(tc.expectedCode, txResp.Code, out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } diff --git a/x/distribution/client/testutil/suite.go b/x/distribution/client/testutil/suite.go index 9ef7c72b761..dc65e42c9c9 100644 --- a/x/distribution/client/testutil/suite.go +++ b/x/distribution/client/testutil/suite.go @@ -11,7 +11,6 @@ import ( "github.com/stretchr/testify/suite" tmcli "github.com/tendermint/tendermint/libs/cli" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" @@ -573,7 +572,7 @@ func (s *IntegrationTestSuite) TestNewWithdrawRewardsCmd() { 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)) data, err := hex.DecodeString(txResp.Data) s.Require().NoError(err) @@ -665,7 +664,7 @@ func (s *IntegrationTestSuite) TestNewWithdrawAllRewardsCmd() { 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)) data, err := hex.DecodeString(txResp.Data) s.Require().NoError(err) @@ -746,7 +745,7 @@ func (s *IntegrationTestSuite) TestNewSetWithdrawAddrCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTx(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } @@ -801,20 +800,8 @@ func (s *IntegrationTestSuite) TestNewFundCommunityPoolCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) txResp := tc.respType.(*sdk.TxResponse) - s.checkTx(clientCtx, txResp.TxHash, tc.expectedCode) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) } }) } } - -func (s *IntegrationTestSuite) checkTx(clientCtx client.Context, txHash string, expectedCode uint32) { - s.Require().NoError(s.network.WaitForNextBlock()) - - cmd := authcli.QueryTxCmd() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) - s.Require().NoError(err) - - var response sdk.TxResponse - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Require().Equal(expectedCode, response.Code, out.String()) -} From e621d07d04bf8e5fb77440f94c6f3cafc2f573dd Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 23 Sep 2022 01:39:02 +0200 Subject: [PATCH 15/19] fix bank tests --- tests/e2e/bank/client/suite.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/e2e/bank/client/suite.go b/tests/e2e/bank/client/suite.go index dcf14fd1fee..9172330050a 100644 --- a/tests/e2e/bank/client/suite.go +++ b/tests/e2e/bank/client/suite.go @@ -88,7 +88,6 @@ func (s *EndToEndTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) - s.Require().NoError(s.network.WaitForNextBlock()) } @@ -520,7 +519,7 @@ func (s *EndToEndTestSuite) TestNewSendTxCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), tc.respType), bz.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + s.Require().Equal(tc.expectedCode, txResp.Code) } }) } @@ -655,7 +654,7 @@ func (s *EndToEndTestSuite) TestNewMultiSendTxCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), tc.respType), bz.String()) txResp := tc.respType.(*sdk.TxResponse) - s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + s.Require().Equal(tc.expectedCode, txResp.Code) } }) } From eec02535bd6ba580e549e4e0c8fa0beb870a1c10 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 23 Sep 2022 14:55:24 +0200 Subject: [PATCH 16/19] updates --- tests/e2e/group/query.go | 39 ++++++----- tests/e2e/group/tx.go | 76 +++++++++++++--------- tests/e2e/staking/client/testutil/suite.go | 7 +- testutil/cli/tx.go | 24 +++++++ x/authz/client/testutil/tx.go | 6 +- x/distribution/client/testutil/suite.go | 17 ++--- 6 files changed, 98 insertions(+), 71 deletions(-) diff --git a/tests/e2e/group/query.go b/tests/e2e/group/query.go index 92e4def0135..4a02c7fb4b9 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 { @@ -777,7 +777,7 @@ func (s *IntegrationTestSuite) TestTallyResult() { } // 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 422eb875d82..ef63fc6f4c7 100644 --- a/tests/e2e/group/tx.go +++ b/tests/e2e/group/tx.go @@ -360,7 +360,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++ { @@ -380,10 +379,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().NoError(clitestutil.CheckTxCode(s.network, val.ClientCtx, txResp.TxHash, 0)) + 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) } @@ -466,10 +467,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() { 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) s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) @@ -1630,7 +1631,9 @@ func (s *IntegrationTestSuite) TestTxVote() { var txResp sdk.TxResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, 0)) + 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) } @@ -1817,7 +1820,9 @@ func (s *IntegrationTestSuite) TestTxWithdrawProposal() { var txResp sdk.TxResponse s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, 0)) + 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) } @@ -1939,7 +1944,6 @@ 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 @@ -1956,11 +1960,13 @@ 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()) - s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, 0)) + 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) @@ -1975,7 +1981,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 { @@ -2053,10 +2060,10 @@ func (s *IntegrationTestSuite) TestTxExec() { 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) s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) @@ -2068,7 +2075,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) @@ -2098,9 +2104,11 @@ 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 @@ -2115,14 +2123,15 @@ 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 = clitestutil.ExecTestCLICmd(clientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{groupID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) - require.NoError(err, out.String()) - require.NotNil(out) + 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 @@ -2204,11 +2213,11 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { cmd := client.MsgLeaveGroupCmd() 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()) } }) } @@ -2369,6 +2378,8 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { 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 { @@ -2394,9 +2405,7 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { 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{ @@ -2410,6 +2419,8 @@ func (s *IntegrationTestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { 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) @@ -2487,10 +2498,9 @@ func (s *IntegrationTestSuite) createAccounts(quantity int) []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()) } - s.Require().NoError(s.network.WaitForNextBlock()) - return accounts } @@ -2519,10 +2529,14 @@ 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 diff --git a/tests/e2e/staking/client/testutil/suite.go b/tests/e2e/staking/client/testutil/suite.go index 462dc85af5f..f4ecf45c068 100644 --- a/tests/e2e/staking/client/testutil/suite.go +++ b/tests/e2e/staking/client/testutil/suite.go @@ -23,7 +23,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" - authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/x/staking/client/cli" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -225,11 +224,9 @@ func (s *IntegrationTestSuite) TestNewCreateValidatorCmd() { require.NoError(err, out.String(), "test: %s, output\n:", tc.name, out.String()) s.Require().NoError(s.network.WaitForNextBlock()) - txResp := tc.respType.(*sdk.TxResponse) - cmd := authcli.QueryTxCmd() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txResp.TxHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + txRespHash := tc.respType.(*sdk.TxResponse) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, txRespHash.TxHash) s.Require().NoError(err) - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), txResp), out.String()) s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) var hadEvent bool diff --git a/testutil/cli/tx.go b/testutil/cli/tx.go index bf5bd1f8f87..dcc6f17460c 100644 --- a/testutil/cli/tx.go +++ b/testutil/cli/tx.go @@ -38,3 +38,27 @@ func CheckTxCode(network *network.Network, clientCtx client.Context, txHash stri 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/x/authz/client/testutil/tx.go b/x/authz/client/testutil/tx.go index a28327c44df..1c7f7e4a30a 100644 --- a/x/authz/client/testutil/tx.go +++ b/x/authz/client/testutil/tx.go @@ -1023,8 +1023,7 @@ func (s *IntegrationTestSuite) TestExecSendAuthzWithAllowList() { s.Require().NoError(s.network.WaitForNextBlock()) // query tx and check result - cmd = authcli.QueryTxCmd() - out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, []string{response.TxHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + 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)) } @@ -1239,8 +1238,7 @@ func (s *IntegrationTestSuite) TestExecDelegateAuthorization() { s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) // query tx and check result - cmd = authcli.QueryTxCmd() - out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, []string{response.TxHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + 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())) } diff --git a/x/distribution/client/testutil/suite.go b/x/distribution/client/testutil/suite.go index dc65e42c9c9..e72fba89963 100644 --- a/x/distribution/client/testutil/suite.go +++ b/x/distribution/client/testutil/suite.go @@ -15,7 +15,6 @@ 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/distribution/client/cli" "github.com/cosmos/cosmos-sdk/x/distribution/testutil" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" @@ -566,13 +565,9 @@ func (s *IntegrationTestSuite) TestNewWithdrawRewardsCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz, tc.respType), string(bz)) s.Require().NoError(s.network.WaitForNextBlock()) - txResp := tc.respType.(*sdk.TxResponse) - cmd := authcli.QueryTxCmd() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txResp.TxHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) s.Require().NoError(err) - - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), txResp), out.String()) - s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + s.Require().Equal(tc.expectedCode, txResp.Code) data, err := hex.DecodeString(txResp.Data) s.Require().NoError(err) @@ -658,13 +653,9 @@ func (s *IntegrationTestSuite) TestNewWithdrawAllRewardsCmd() { s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) s.Require().NoError(s.network.WaitForNextBlock()) - txResp := tc.respType.(*sdk.TxResponse) - cmd := authcli.QueryTxCmd() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{txResp.TxHash, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) s.Require().NoError(err) - - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), txResp), out.String()) - s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + s.Require().Equal(tc.expectedCode, txResp.Code) data, err := hex.DecodeString(txResp.Data) s.Require().NoError(err) From 20bef9d14d2a011279d9efd16564f891169d7246 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 23 Sep 2022 16:27:06 +0200 Subject: [PATCH 17/19] updates --- UPGRADING.md | 1 + tests/e2e/group/tx.go | 213 ++++++++++++++++++++++++++---------------- 2 files changed, 132 insertions(+), 82 deletions(-) diff --git a/UPGRADING.md b/UPGRADING.md index 83cc1554a09..6d364475b75 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -38,6 +38,7 @@ This allows you to remove the replace directive `replace github.com/gogo/protobu ### 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` diff --git a/tests/e2e/group/tx.go b/tests/e2e/group/tx.go index ef63fc6f4c7..cea0377dde0 100644 --- a/tests/e2e/group/tx.go +++ b/tests/e2e/group/tx.go @@ -19,9 +19,11 @@ import ( 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 { @@ -285,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", @@ -330,10 +332,10 @@ func (s *IntegrationTestSuite) TestTxCreateGroup() { }, s.commonFlags..., ), - true, + false, "member metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, } @@ -350,8 +352,12 @@ func (s *IntegrationTestSuite) TestTxCreateGroup() { 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().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + 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) + } } }) } @@ -532,10 +538,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMetadata() { }, s.commonFlags..., ), - true, + false, "group metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, } @@ -552,8 +558,12 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMetadata() { 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().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + 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) + } } }) } @@ -639,10 +649,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", @@ -654,10 +664,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMembers() { }, s.commonFlags..., ), - true, + false, "not found", - nil, - 0, + &sdk.TxResponse{}, + sdkerrors.ErrNotFound.ABCICode(), }, } @@ -674,8 +684,12 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMembers() { 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().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + 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) + } } }) } @@ -789,10 +803,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", @@ -807,10 +821,10 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() { }, s.commonFlags..., ), - true, + false, "group policy metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, { "invalid members address", @@ -861,10 +875,10 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() { }, s.commonFlags..., ), - true, + false, "member metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, } for _, tc := range testCases { @@ -880,8 +894,12 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() { 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().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + 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) + } } }) } @@ -980,10 +998,10 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() { }, s.commonFlags..., ), - true, + false, "group policy metadata: limit exceeded", &sdk.TxResponse{}, - 0, + errors.ErrMaxLimit.ABCICode(), }, { "wrong group id", @@ -996,10 +1014,10 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() { }, s.commonFlags..., ), - true, + false, "not found", &sdk.TxResponse{}, - 0, + sdkerrors.ErrNotFound.ABCICode(), }, { "invalid percentage decision policy with negative value", @@ -1048,8 +1066,12 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() { 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().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + 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) + } } }) } @@ -1128,10 +1150,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyAdmin() { }, commonFlags..., ), - true, + false, "load group policy: not found", &sdk.TxResponse{}, - 0, + sdkerrors.ErrNotFound.ABCICode(), }, } @@ -1243,10 +1265,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", @@ -1358,10 +1380,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyMetadata() { }, commonFlags..., ), - true, + false, "group policy metadata: limit exceeded", &sdk.TxResponse{}, - 0, + errors.ErrMaxLimit.ABCICode(), }, { "wrong admin", @@ -1388,10 +1410,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyMetadata() { }, commonFlags..., ), - true, + false, "load group policy: not found", &sdk.TxResponse{}, - 0, + sdkerrors.ErrNotFound.ABCICode(), }, } @@ -1408,8 +1430,12 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyMetadata() { 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().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + 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) + } } }) } @@ -1509,10 +1535,10 @@ func (s *IntegrationTestSuite) TestTxSubmitProposal() { }, s.commonFlags..., ), - true, + false, "metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, { "unauthorized msg", @@ -1525,10 +1551,10 @@ func (s *IntegrationTestSuite) TestTxSubmitProposal() { }, s.commonFlags..., ), - true, + false, "msg does not have group policy authorization", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrUnauthorized.ABCICode(), }, { "invalid proposers", @@ -1576,10 +1602,10 @@ func (s *IntegrationTestSuite) TestTxSubmitProposal() { }, s.commonFlags..., ), - true, + false, "group policy: not found", - nil, - 0, + &sdk.TxResponse{}, + sdkerrors.ErrNotFound.ABCICode(), }, } @@ -1596,8 +1622,12 @@ func (s *IntegrationTestSuite) TestTxSubmitProposal() { 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().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + 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) + } } }) } @@ -1739,10 +1769,10 @@ func (s *IntegrationTestSuite) TestTxVote() { }, s.commonFlags..., ), - true, + false, "proposal: not found", - nil, - 0, + &sdk.TxResponse{}, + sdkerrors.ErrNotFound.ABCICode(), }, { "metadata too long", @@ -1755,10 +1785,10 @@ func (s *IntegrationTestSuite) TestTxVote() { }, s.commonFlags..., ), - true, + false, "metadata: limit exceeded", - nil, - 0, + &sdk.TxResponse{}, + errors.ErrMaxLimit.ABCICode(), }, { "invalid vote option", @@ -1791,8 +1821,12 @@ func (s *IntegrationTestSuite) TestTxVote() { 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().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + 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) + } } }) } @@ -1857,10 +1891,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", @@ -1919,8 +1953,12 @@ func (s *IntegrationTestSuite) TestTxWithdrawProposal() { 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().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + 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) + } } }) } @@ -2045,10 +2083,10 @@ func (s *IntegrationTestSuite) TestTxExec() { }, s.commonFlags..., ), - true, + false, "proposal: not found", - nil, - 0, + &sdk.TxResponse{}, + sdkerrors.ErrNotFound.ABCICode(), }, } @@ -2065,8 +2103,12 @@ func (s *IntegrationTestSuite) TestTxExec() { 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().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + 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) + } } }) } @@ -2134,10 +2176,11 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { 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", @@ -2151,6 +2194,7 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { ), true, "key not found", + 0, }, { "group not found", @@ -2162,8 +2206,9 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { }, s.commonFlags..., ), - true, + false, "group: not found", + sdkerrors.ErrNotFound.ABCICode(), }, { "valid case", @@ -2177,6 +2222,7 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { ), false, "", + 0, }, { "not part of group", @@ -2188,8 +2234,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", @@ -2203,6 +2250,7 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { ), false, "", + 0, }, } @@ -2218,6 +2266,7 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() { s.Require().NoError(err, out.String()) var resp sdk.TxResponse s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, tc.expectedCode)) } }) } From 2602a0bcea5ef355e330549219089ee9f30334ec Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 23 Sep 2022 16:29:14 +0200 Subject: [PATCH 18/19] fix liveness-test --- contrib/images/simd-dlv/Dockerfile | 1 - contrib/images/simd-env/Dockerfile | 1 - 2 files changed, 2 deletions(-) diff --git a/contrib/images/simd-dlv/Dockerfile b/contrib/images/simd-dlv/Dockerfile index 6a81ef3e81f..3227b80c46a 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 dae68a2175b..c634e39e1ac 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/ From e64760f579a5b9e2b35d0549d9cd71a0975049bc Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 23 Sep 2022 16:57:17 +0200 Subject: [PATCH 19/19] fix last test --- tests/e2e/group/tx.go | 16 ++++++++++------ x/group/keeper/proposal_executor.go | 12 ++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/tests/e2e/group/tx.go b/tests/e2e/group/tx.go index cea0377dde0..7488806c798 100644 --- a/tests/e2e/group/tx.go +++ b/tests/e2e/group/tx.go @@ -458,10 +458,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() { }, s.commonFlags..., ), - true, + false, "not found", - nil, - 0, + &sdk.TxResponse{}, + sdkerrors.ErrNotFound.ABCICode(), }, } @@ -478,8 +478,12 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() { 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().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + 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) + } } }) } @@ -1554,7 +1558,7 @@ func (s *IntegrationTestSuite) TestTxSubmitProposal() { false, "msg does not have group policy authorization", &sdk.TxResponse{}, - errors.ErrUnauthorized.ABCICode(), + sdkerrors.ErrUnauthorized.ABCICode(), }, { "invalid proposers", diff --git a/x/group/keeper/proposal_executor.go b/x/group/keeper/proposal_executor.go index 29d9d1e8bed..bc1317c629a 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()) } } }