From 7b9cc243c4774602aeb6c455bd95882753855c55 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Tue, 16 Apr 2024 17:47:32 -0600 Subject: [PATCH 01/42] [1760]: Stub out the registration of a couple custom GetSigners functions from the exchange module. --- app/app.go | 20 +++++++++++--------- x/exchange/msg.go | 29 +++++++++++++++++++++++++++++ x/exchange/msg_test.go | 2 +- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/app/app.go b/app/app.go index d7013845c7..e1f9076ede 100644 --- a/app/app.go +++ b/app/app.go @@ -330,16 +330,18 @@ func New( homePath string, invCheckPeriod uint, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), ) *App { - interfaceRegistry, _ := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{ - ProtoFiles: proto.HybridResolver, - SigningOptions: signing.Options{ - AddressCodec: address.Bech32Codec{ - Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(), - }, - ValidatorAddressCodec: address.Bech32Codec{ - Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(), - }, + signingOptions := signing.Options{ + AddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(), + }, + ValidatorAddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(), }, + } + exchange.DefineCustomGetSigners(&signingOptions) + interfaceRegistry, _ := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{ + ProtoFiles: proto.HybridResolver, + SigningOptions: signingOptions, }) appCodec := codec.NewProtoCodec(interfaceRegistry) legacyAmino := codec.NewLegacyAmino() diff --git a/x/exchange/msg.go b/x/exchange/msg.go index 7d5ea6b264..4807f8c7fb 100644 --- a/x/exchange/msg.go +++ b/x/exchange/msg.go @@ -4,6 +4,8 @@ import ( "errors" "fmt" + "cosmossdk.io/x/tx/signing" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -845,3 +847,30 @@ func (m MsgGovUpdateParamsRequest) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.Authority) return []sdk.AccAddress{addr} } + +// DefineCustomGetSigners registers all the exchange module custom GetSigners functions with the provided signing options. +func DefineCustomGetSigners(options *signing.Options) { + // TODO[1760]: Uncomment this once we figure out how to make our msgs have the ProtoReflect method. + // options.DefineCustomGetSigners(proto.MessageName(&MsgCreatePaymentRequest{}), func(msg proto.Message) ([][]byte, error) { + // msgCP, ok := msg.(*MsgCreatePaymentRequest) + // if !ok { + // return nil, fmt.Errorf("incorrect message type, actual: %T, expected: %T", msg, &MsgCreatePaymentRequest{}) + // } + // addr, err := options.AddressCodec.StringToBytes(msgCP.Payment.Source) + // if err != nil { + // return nil, err + // } + // return [][]byte{addr}, nil + // }) + // options.DefineCustomGetSigners(proto.MessageName(&MsgAcceptPaymentRequest{}), func(msg proto.Message) ([][]byte, error) { + // msgCP, ok := msg.(*MsgAcceptPaymentRequest) + // if !ok { + // return nil, fmt.Errorf("incorrect message type, actual: %T, expected: %T", msg, &MsgAcceptPaymentRequest{}) + // } + // addr, err := options.AddressCodec.StringToBytes(msgCP.Payment.Target) + // if err != nil { + // return nil, err + // } + // return [][]byte{addr}, nil + // }) +} diff --git a/x/exchange/msg_test.go b/x/exchange/msg_test.go index 2516b380c7..4a0da88a89 100644 --- a/x/exchange/msg_test.go +++ b/x/exchange/msg_test.go @@ -179,7 +179,7 @@ func TestAllMsgsGetSigners(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { smsg, ok := tc.msg.(HasGetSigners) - require.True(t, ok, "%T does not have a .GetSigners method.") + require.True(t, ok, "%T does not have a .GetSigners method.", tc.msg) var signers []sdk.AccAddress testFunc := func() { From 2146d847e090b8ac2ccc086d4f32deb2b9ee9b41 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Tue, 16 Apr 2024 17:50:02 -0600 Subject: [PATCH 02/42] [1760]: Update the exchange CLI tests to handle not having block broadcast anymore. --- cmd/provenanced/cmd/root.go | 2 +- x/exchange/client/cli/cli_test.go | 143 ++++++++++-------------------- 2 files changed, 50 insertions(+), 95 deletions(-) diff --git a/cmd/provenanced/cmd/root.go b/cmd/provenanced/cmd/root.go index 3478e2861d..9a493edbe8 100644 --- a/cmd/provenanced/cmd/root.go +++ b/cmd/provenanced/cmd/root.go @@ -95,7 +95,7 @@ func NewRootCmd(sealConfig bool) (*cobra.Command, params.EncodingConfig) { WithLegacyAmino(encodingConfig.Amino). WithInput(os.Stdin). WithAccountRetriever(types.AccountRetriever{}). - WithBroadcastMode(flags.BroadcastSync). // TODO[1760]: broadcast: Verify that this is right since BroadcastBlock is gone. + WithBroadcastMode(flags.BroadcastSync). WithHomeDir(app.DefaultNodeHome). WithViper("PIO") sdk.SetCoinDenomRegex(app.SdkCoinDenomRegex) diff --git a/x/exchange/client/cli/cli_test.go b/x/exchange/client/cli/cli_test.go index 3f5ed4ea18..ed26b90371 100644 --- a/x/exchange/client/cli/cli_test.go +++ b/x/exchange/client/cli/cli_test.go @@ -39,6 +39,7 @@ import ( "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" "github.com/provenance-io/provenance/testutil/assertions" + "github.com/provenance-io/provenance/testutil/queries" "github.com/provenance-io/provenance/x/exchange" "github.com/provenance-io/provenance/x/exchange/client/cli" "github.com/provenance-io/provenance/x/hold" @@ -574,7 +575,7 @@ func (s *CmdTestSuite) runTxCmdTestCase(tc txCmdTestCase) { args = append(args, "--"+flags.FlagGas, gas, "--"+flags.FlagFees, fees.String(), - "--"+flags.FlagBroadcastMode, flags.BroadcastSync, // TODO[1760]: broadcast + "--"+flags.FlagBroadcastMode, flags.BroadcastSync, "--"+flags.FlagSkipConfirmation, ) @@ -604,14 +605,10 @@ func (s *CmdTestSuite) runTxCmdTestCase(tc txCmdTestCase) { } if len(tc.expInErr) == 0 && err == nil { - var resp sdk.TxResponse - err = clientCtx.Codec.UnmarshalJSON(outBz, &resp) - if s.Assert().NoError(err, "UnmarshalJSON(command output) error") { - txResponse = &resp - s.Assert().Equal(int(tc.expectedCode), int(resp.Code), "response code") - for _, exp := range tc.expInRawLog { - s.Assert().Contains(resp.RawLog, exp, "TxResponse.RawLog should contain:\n%q", exp) - } + resp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Assert().Equal(int(tc.expectedCode), int(resp.Code), "response code") + for _, exp := range tc.expInRawLog { + s.Assert().Contains(resp.RawLog, exp, "TxResponse.RawLog should contain:\n%q", exp) } } } @@ -910,36 +907,19 @@ func (s *CmdTestSuite) assertGovPropMsg(propID string, msg sdk.Msg) bool { return true } - // TODO[1760]: gov: Uncomment once we figure out how to query for a gov proposal again. - return false - /* - if !s.Assert().NotEmpty(propID, "proposal id") { - return false - } - expPropMsgAny, err := codectypes.NewAnyWithValue(msg) - if !s.Assert().NoError(err, "NewAnyWithValue(%T)", msg) { - return false - } - - clientCtx := s.getClientCtx() - getPropCmd := govcli.GetCmdQueryProposal() - propOutBW, err := clitestutil.ExecTestCLICmd(clientCtx, getPropCmd, []string{propID, "--output", "json"}) - propOutBz := propOutBW.Bytes() - s.T().Logf("Query proposal %s output:\n%s", propID, string(propOutBz)) - if !s.Assert().NoError(err, "GetCmdQueryProposal %s error", propID) { - return false - } + if !s.Assert().NotEmpty(propID, "proposal id") { + return false + } + expPropMsgAny, err := codectypes.NewAnyWithValue(msg) + if !s.Assert().NoError(err, "NewAnyWithValue(%T)", msg) { + return false + } - var prop govv1.Proposal - err = clientCtx.Codec.UnmarshalJSON(propOutBz, &prop) - if !s.Assert().NoError(err, "UnmarshalJSON on proposal %s response", propID) { - return false - } - if !s.Assert().Len(prop.Messages, 1, "number of messages in proposal %s", propID) { - return false - } - return s.Assert().Equal(expPropMsgAny, prop.Messages[0], "the message in proposal %s", propID) - */ + prop := queries.GetGovProp(s.T(), s.testnet, propID) + if !s.Assert().Len(prop.Messages, 1, "number of messages in proposal %s", propID) { + return false + } + return s.Assert().Equal(expPropMsgAny, prop.Messages[0], "the message in proposal %s", propID) } // govPropFollowup returns a followup function that identifies the new proposal id, looks it up, @@ -1060,14 +1040,15 @@ func (s *CmdTestSuite) createOrder(order *exchange.Order, creationFee *sdk.Coin) } args = append(args, "--"+flags.FlagFees, s.bondCoins(10).String(), - "--"+flags.FlagBroadcastMode, flags.BroadcastSync, // TODO[1760]: broadcast + "--"+flags.FlagBroadcastMode, flags.BroadcastSync, "--"+flags.FlagSkipConfirmation, ) cmdName := cmd.Name() + failed := true var outBz []byte defer func() { - if s.T().Failed() { + if failed { s.T().Logf("Command: %s\nArgs: %q\nOutput\n%s", cmdName, args, string(outBz)) } }() @@ -1075,15 +1056,15 @@ func (s *CmdTestSuite) createOrder(order *exchange.Order, creationFee *sdk.Coin) clientCtx := s.getClientCtx() out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) outBz = out.Bytes() - s.Require().NoError(err, "ExecTestCLICmd error") - var resp sdk.TxResponse - err = clientCtx.Codec.UnmarshalJSON(outBz, &resp) - s.Require().NoError(err, "UnmarshalJSON(command output) error") + resp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) orderIDStr, err := s.findNewOrderID(&resp) s.Require().NoError(err, "findNewOrderID") - return s.asOrderID(orderIDStr) + + rv := s.asOrderID(orderIDStr) + failed = false + return rv } // commitFunds issues a command to commit funds. @@ -1101,14 +1082,15 @@ func (s *CmdTestSuite) commitFunds(addr sdk.AccAddress, marketID uint32, amount args = append(args, "--"+flags.FlagFees, s.bondCoins(10).String(), - "--"+flags.FlagBroadcastMode, flags.BroadcastSync, // TODO[1760]: broadcast + "--"+flags.FlagBroadcastMode, flags.BroadcastSync, "--"+flags.FlagSkipConfirmation, ) cmdName := cmd.Name() + failed := true var outBz []byte defer func() { - if s.T().Failed() { + if failed { s.T().Logf("Command: %s\nArgs: %q\nOutput\n%s", cmdName, args, string(outBz)) } }() @@ -1116,13 +1098,11 @@ func (s *CmdTestSuite) commitFunds(addr sdk.AccAddress, marketID uint32, amount clientCtx := s.getClientCtx() out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) outBz = out.Bytes() - s.Require().NoError(err, "ExecTestCLICmd error") - var resp sdk.TxResponse - err = clientCtx.Codec.UnmarshalJSON(outBz, &resp) - s.Require().NoError(err, "UnmarshalJSON(command output) error") - s.Require().Equal(int(0), int(resp.Code), "response code:\n%v", resp) + resp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(0, int(resp.Code), "response code:\n%v", resp) + failed = false } // createPayment issues a command to create a payment. @@ -1147,14 +1127,15 @@ func (s *CmdTestSuite) createPayment(payment *exchange.Payment) { fees := s.bondCoins(10).Add(s.feeCoin(exchange.DefaultFeeCreatePaymentFlatAmount)) args = append(args, "--"+flags.FlagFees, fees.String(), - "--"+flags.FlagBroadcastMode, flags.BroadcastSync, // TODO[1760]: broadcast + "--"+flags.FlagBroadcastMode, flags.BroadcastSync, "--"+flags.FlagSkipConfirmation, ) + failed := true cmdName := cmd.Name() var outBz []byte defer func() { - if s.T().Failed() { + if failed { s.T().Logf("Command: %s\nArgs: %q\nOutput\n%s", cmdName, args, string(outBz)) } }() @@ -1162,51 +1143,21 @@ func (s *CmdTestSuite) createPayment(payment *exchange.Payment) { clientCtx := s.getClientCtx() out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) outBz = out.Bytes() - s.Require().NoError(err, "ExecTestCLICmd error") - var resp sdk.TxResponse - err = clientCtx.Codec.UnmarshalJSON(outBz, &resp) - s.Require().NoError(err, "UnmarshalJSON(command output) error") - s.Require().Equal(int(0), int(resp.Code), "response code:\n%v", resp) + resp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(0, int(resp.Code), "response code:\n%v", resp) + failed = false } // queryBankBalances executes a bank query to get an account's balances. func (s *CmdTestSuite) queryBankBalances(addr string) sdk.Coins { - // TODO[1760]: bank: Uncomment once we know how to query for bank balances again. - return nil - /* - clientCtx := s.getClientCtx() - cmd := bankcli.GetBalancesCmd() - args := []string{addr, "--output", "json"} - outBW, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - s.Require().NoError(err, "ExecTestCLICmd %s %q", cmd.Name(), args) - outBz := outBW.Bytes() - - var resp banktypes.QueryAllBalancesResponse - err = clientCtx.Codec.UnmarshalJSON(outBz, &resp) - s.Require().NoError(err, "UnmarshalJSON(%q, %T)", string(outBz), &resp) - return resp.Balances - */ + return queries.GetAllBalances(s.T(), s.testnet, addr) } // queryBankSpendableBalances executes a bank query to get an account's spendable balances. func (s *CmdTestSuite) queryBankSpendableBalances(addr string) sdk.Coins { - // TODO[1760]: bank: Put this back once we know how to query spendable balances again. - /* - clientCtx := s.getClientCtx() - cmd := bankcli.GetSpendableBalancesCmd() - args := []string{addr, "--output", "json"} - outBW, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - s.Require().NoError(err, "ExecTestCLICmd %s %q", cmd.Name(), args) - outBz := outBW.Bytes() - - var resp banktypes.QuerySpendableBalancesResponse - err = clientCtx.Codec.UnmarshalJSON(outBz, &resp) - s.Require().NoError(err, "UnmarshalJSON(%q, %T)", string(outBz), &resp) - return resp.Balances - */ - return nil + return queries.GetSpendableBalances(s.T(), s.testnet, addr) } // execBankSend executes a bank send command. @@ -1218,20 +1169,24 @@ func (s *CmdTestSuite) execBankSend(fromAddr, toAddr, amount string) { args := []string{ fromAddr, toAddr, amount, "--" + flags.FlagFees, s.bondCoins(10).String(), - "--" + flags.FlagBroadcastMode, flags.BroadcastSync, // TODO[1760]: broadcast + "--" + flags.FlagBroadcastMode, flags.BroadcastSync, "--" + flags.FlagSkipConfirmation, } + failed := true - var outStr string + var outBz []byte defer func() { if failed { - s.T().Logf("Command: %s\nArgs: %q\nOutput\n%s", cmdName, args, outStr) + s.T().Logf("Command: %s\nArgs: %q\nOutput\n%s", cmdName, args, string(outBz)) } }() outBW, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outStr = outBW.String() - s.Require().NoError(err, "ExecTestCLICmd %s %q", cmdName, args) + outBz = outBW.Bytes() + s.Require().NoError(err, "ExecTestCLICmd error") + + resp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(0, int(resp.Code), "response code:\n%v", resp) failed = false } From 3311f799657d4360eac9aa1bea04f8bddcd0760c Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Wed, 17 Apr 2024 13:48:47 -0600 Subject: [PATCH 03/42] [1760]: Fix the signers of the msgs in the exchange module. --- proto/provenance/exchange/v1/orders.proto | 3 + proto/provenance/exchange/v1/tx.proto | 10 +- x/exchange/orders.pb.go | 74 ++--- x/exchange/tx.pb.go | 343 +++++++++++----------- 4 files changed, 218 insertions(+), 212 deletions(-) diff --git a/proto/provenance/exchange/v1/orders.proto b/proto/provenance/exchange/v1/orders.proto index 538dbdce13..b488663842 100644 --- a/proto/provenance/exchange/v1/orders.proto +++ b/proto/provenance/exchange/v1/orders.proto @@ -7,6 +7,7 @@ option java_package = "io.provenance.exchange.v1"; option java_multiple_files = true; import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; @@ -27,6 +28,7 @@ message Order { // AskOrder represents someone's desire to sell something at a minimum price. message AskOrder { + option (cosmos.msg.v1.signer) = "seller"; option (gogoproto.goproto_getters) = false; // market_id identifies the market that this order belongs to. @@ -54,6 +56,7 @@ message AskOrder { // BidOrder represents someone's desire to buy something at a specific price. message BidOrder { + option (cosmos.msg.v1.signer) = "buyer"; option (gogoproto.goproto_getters) = false; // market_id identifies the market that this order belongs to. diff --git a/proto/provenance/exchange/v1/tx.proto b/proto/provenance/exchange/v1/tx.proto index 26f5d0ef65..615e986fa0 100644 --- a/proto/provenance/exchange/v1/tx.proto +++ b/proto/provenance/exchange/v1/tx.proto @@ -115,7 +115,7 @@ service Msg { // MsgCreateAskRequest is a request message for the CreateAsk endpoint. message MsgCreateAskRequest { - option (cosmos.msg.v1.signer) = "ask_order.seller"; + option (cosmos.msg.v1.signer) = "ask_order"; // ask_order is the details of the order being created. AskOrder ask_order = 1 [(gogoproto.nullable) = false]; @@ -131,7 +131,7 @@ message MsgCreateAskResponse { // MsgCreateBidRequest is a request message for the CreateBid endpoint. message MsgCreateBidRequest { - option (cosmos.msg.v1.signer) = "bid_order.buyer"; + option (cosmos.msg.v1.signer) = "bid_order"; // bid_order is the details of the order being created. BidOrder bid_order = 1 [(gogoproto.nullable) = false]; @@ -490,7 +490,8 @@ message MsgMarketManageReqAttrsResponse {} // MsgCreatePaymentRequest is a request message for the CreatePayment endpoint. message MsgCreatePaymentRequest { - option (cosmos.msg.v1.signer) = "payment.source"; + // The signer is the payment.source, but we can't define that using the cosmos.msg.v1.signer option. + // So signers for this msg are defined in code using a custom get-signers function. // payment is the details of the payment to create. Payment payment = 1 [(gogoproto.nullable) = false]; @@ -501,7 +502,8 @@ message MsgCreatePaymentResponse {} // MsgAcceptPaymentRequest is a request message for the AcceptPayment endpoint. message MsgAcceptPaymentRequest { - option (cosmos.msg.v1.signer) = "payment.target"; + // The signer is the payment.target, but we can't define that using the cosmos.msg.v1.signer option. + // So signers for this msg are defined in code using a custom get-signers function. // payment is the details of the payment to accept. Payment payment = 1 [(gogoproto.nullable) = false]; diff --git a/x/exchange/orders.pb.go b/x/exchange/orders.pb.go index cbf9a75a03..7684b31522 100644 --- a/x/exchange/orders.pb.go +++ b/x/exchange/orders.pb.go @@ -8,6 +8,7 @@ import ( _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -240,42 +241,43 @@ func init() { } var fileDescriptor_dab7cbe63f582471 = []byte{ - // 545 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x31, 0x6f, 0xd3, 0x40, - 0x18, 0xb5, 0x9b, 0x38, 0x71, 0xae, 0x74, 0x31, 0x05, 0x9c, 0x20, 0x39, 0x51, 0xba, 0x64, 0xc9, - 0xb9, 0x01, 0x21, 0x24, 0x16, 0xd4, 0x20, 0x55, 0x64, 0xa2, 0x72, 0x25, 0x06, 0x16, 0xeb, 0x6c, - 0x7f, 0x4d, 0x4f, 0x71, 0x7c, 0x91, 0xef, 0x1a, 0xd2, 0x89, 0x95, 0x91, 0x81, 0x1f, 0xc0, 0xcc, - 0x0a, 0x3f, 0xa2, 0x63, 0xc5, 0xc4, 0x04, 0x28, 0x99, 0xf9, 0x0f, 0xc8, 0x77, 0x97, 0x34, 0x48, - 0x10, 0x3a, 0xa0, 0x4e, 0xbe, 0xef, 0xdd, 0x7b, 0xef, 0xfb, 0xfc, 0x4e, 0x77, 0x68, 0x6f, 0x92, - 0xb3, 0x29, 0x64, 0x24, 0x8b, 0xc1, 0x87, 0x59, 0x7c, 0x4a, 0xb2, 0x21, 0xf8, 0xd3, 0x9e, 0xcf, - 0xf2, 0x04, 0x72, 0x8e, 0x27, 0x39, 0x13, 0xcc, 0xb9, 0x7b, 0x45, 0xc2, 0x4b, 0x12, 0x9e, 0xf6, - 0x1a, 0x5e, 0xcc, 0xf8, 0x98, 0x71, 0x3f, 0x22, 0xbc, 0x10, 0x45, 0x20, 0x48, 0xcf, 0x8f, 0x19, - 0xcd, 0x94, 0xae, 0x51, 0x57, 0xfb, 0xa1, 0xac, 0x7c, 0x55, 0xe8, 0xad, 0xdd, 0x21, 0x1b, 0x32, - 0x85, 0x17, 0x2b, 0x85, 0xb6, 0x3f, 0x99, 0xc8, 0x7a, 0x51, 0x74, 0x76, 0xea, 0xc8, 0x96, 0x23, - 0x84, 0x34, 0x71, 0xcd, 0x96, 0xd9, 0x29, 0x07, 0x55, 0x59, 0x0f, 0x12, 0xe7, 0x29, 0xaa, 0x11, - 0x3e, 0x0a, 0x65, 0xe9, 0x6e, 0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, 0xcb, 0xec, 0xd8, 0xc1, - 0x2d, 0x09, 0x1e, 0x29, 0xcc, 0x69, 0xa2, 0x6d, 0x98, 0x09, 0xc8, 0x33, 0x92, 0x16, 0xe9, 0x55, - 0x8b, 0x8c, 0x02, 0xb4, 0x84, 0x06, 0x89, 0x0a, 0xbe, 0xfd, 0xbe, 0x84, 0xec, 0xe5, 0xb9, 0x6c, - 0xce, 0x1b, 0x23, 0x2b, 0x3a, 0x3b, 0xbf, 0x46, 0xdc, 0x8a, 0x76, 0xe3, 0x69, 0xbf, 0x41, 0x77, - 0x64, 0xe3, 0xdf, 0xc2, 0x06, 0xe0, 0xae, 0xd5, 0x2a, 0x6d, 0xb6, 0xd9, 0x2f, 0x6c, 0x3e, 0x7e, - 0x6f, 0x76, 0x86, 0x54, 0x9c, 0x9e, 0x45, 0x38, 0x66, 0x63, 0x7d, 0xc1, 0xf4, 0xa7, 0xcb, 0x93, - 0x91, 0x2f, 0xce, 0x27, 0xc0, 0xa5, 0x80, 0x07, 0xb7, 0x65, 0xa7, 0xb5, 0x93, 0x01, 0xe0, 0xff, - 0xf3, 0x58, 0xfa, 0x70, 0x31, 0xf7, 0xcc, 0xcb, 0xb9, 0x67, 0xfe, 0x98, 0x7b, 0xe6, 0xbb, 0x85, - 0x67, 0x5c, 0x2e, 0x3c, 0xe3, 0xeb, 0xc2, 0x33, 0x50, 0x9d, 0xb2, 0xbf, 0xdc, 0xaf, 0x23, 0xf3, - 0x15, 0x5e, 0xfb, 0x83, 0x2b, 0x52, 0x97, 0xb2, 0xb5, 0xca, 0x9f, 0xad, 0x1e, 0xa7, 0xa8, 0x22, - 0x9f, 0x8a, 0x87, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa1, 0x1d, 0x88, 0x31, 0xba, 0x04, 0x00, - 0x00, + // 576 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xb1, 0x6f, 0xd3, 0x4e, + 0x14, 0xb6, 0xdb, 0x38, 0x71, 0xae, 0xbf, 0xfe, 0x90, 0x4c, 0xa1, 0x4e, 0x90, 0x9c, 0x28, 0x5d, + 0x22, 0xa4, 0xd8, 0x0d, 0x08, 0x21, 0x75, 0x41, 0x0d, 0x52, 0x45, 0x26, 0x2a, 0x57, 0x62, 0x60, + 0xb1, 0xce, 0xf6, 0xab, 0x6b, 0xc5, 0xf6, 0x45, 0xbe, 0x6b, 0x48, 0x27, 0x24, 0x26, 0x46, 0xfe, + 0x02, 0xc4, 0xcc, 0x84, 0x04, 0x7f, 0x44, 0xc7, 0x8a, 0x89, 0x09, 0x50, 0x32, 0xf0, 0x2f, 0x30, + 0x22, 0xdf, 0x9d, 0xd3, 0x20, 0x41, 0xe8, 0x80, 0x98, 0x7c, 0xef, 0xbd, 0xef, 0x7d, 0xef, 0xf9, + 0xfb, 0x74, 0x87, 0x76, 0xc6, 0x39, 0x99, 0x40, 0x86, 0xb3, 0x00, 0x1c, 0x98, 0x06, 0x27, 0x38, + 0x8b, 0xc0, 0x99, 0xf4, 0x1d, 0x92, 0x87, 0x90, 0x53, 0x7b, 0x9c, 0x13, 0x46, 0x8c, 0x9b, 0x97, + 0x20, 0xbb, 0x04, 0xd9, 0x93, 0x7e, 0xd3, 0x0a, 0x08, 0x4d, 0x09, 0x75, 0x7c, 0x4c, 0x8b, 0x26, + 0x1f, 0x18, 0xee, 0x3b, 0x01, 0x89, 0x33, 0xd1, 0xd7, 0xdc, 0x96, 0xf5, 0x94, 0x46, 0x05, 0x67, + 0x4a, 0x23, 0x59, 0x68, 0x88, 0x82, 0xc7, 0x23, 0x47, 0x04, 0xb2, 0xb4, 0x15, 0x91, 0x88, 0x88, + 0x7c, 0x71, 0x12, 0xd9, 0xce, 0x7b, 0x15, 0x69, 0x8f, 0x8b, 0x95, 0x8c, 0x06, 0xd2, 0xf9, 0x6e, + 0x5e, 0x1c, 0x9a, 0x6a, 0x5b, 0xed, 0x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xee, 0xfe, 0x08, 0x00, 0x00, 0xff, 0xff, 0xeb, 0x31, 0x83, 0xab, 0xe8, 0x04, 0x00, 0x00, } func (m *Order) Marshal() (dAtA []byte, err error) { diff --git a/x/exchange/tx.pb.go b/x/exchange/tx.pb.go index b59cfd4abb..4c38771ba3 100644 --- a/x/exchange/tx.pb.go +++ b/x/exchange/tx.pb.go @@ -3334,180 +3334,179 @@ func init() { func init() { proto.RegisterFile("provenance/exchange/v1/tx.proto", fileDescriptor_e333fcffc093bd1b) } var fileDescriptor_e333fcffc093bd1b = []byte{ - // 2767 bytes of a gzipped FileDescriptorProto + // 2739 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x5b, 0x4b, 0x6f, 0x1c, 0x59, - 0xf5, 0x4f, 0xb9, 0xfd, 0xea, 0xe3, 0x47, 0x92, 0x6b, 0x3b, 0x69, 0x97, 0xc7, 0x6d, 0xa7, 0x93, + 0xf5, 0x4f, 0xb9, 0xfd, 0xea, 0xe3, 0xc7, 0x24, 0xd7, 0x76, 0xd2, 0x6e, 0xc7, 0x6d, 0xa7, 0x93, 0xfc, 0xff, 0x26, 0xc1, 0xed, 0xd8, 0x23, 0x12, 0x30, 0x33, 0x64, 0xdc, 0x4e, 0x1c, 0x79, 0xa4, - 0x04, 0xab, 0x93, 0x80, 0x04, 0x8b, 0x56, 0xb9, 0xeb, 0xa6, 0x53, 0xb8, 0xba, 0xaa, 0x53, 0xf7, - 0xb6, 0xe3, 0x48, 0x48, 0x23, 0x10, 0x12, 0xb0, 0x18, 0x69, 0x24, 0xb6, 0x6c, 0x40, 0x08, 0x09, - 0x82, 0x04, 0x48, 0x68, 0xc4, 0xcc, 0x27, 0x98, 0x05, 0x8b, 0x11, 0x2b, 0x56, 0x30, 0x4a, 0x24, - 0xf8, 0x08, 0x6c, 0xd1, 0x7d, 0xd4, 0xfb, 0xd9, 0x9e, 0xf4, 0x2a,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x25, 0xd3, 0x69, - 0xf3, 0x73, 0x95, 0xe8, 0xe8, 0x1d, 0x88, 0xc6, 0xac, 0x9b, 0xc6, 0xdb, 0x30, 0x21, 0x5b, 0xb5, - 0xb2, 0x1d, 0xb9, 0x92, 0x36, 0xc0, 0xa4, 0xa2, 0x3b, 0xb8, 0xa4, 0xd6, 0xf6, 0x1c, 0x83, 0x32, - 0x2b, 0x7f, 0xd5, 0x89, 0xdd, 0x77, 0xda, 0xb8, 0xa6, 0xf2, 0x5a, 0x2f, 0xe2, 0x30, 0x04, 0x46, - 0x2c, 0x58, 0xc3, 0x05, 0x43, 0x35, 0xa7, 0x83, 0xa9, 0x04, 0x13, 0x71, 0x28, 0xc1, 0xbc, 0x54, - 0x38, 0x9a, 0x26, 0xfe, 0x01, 0x3f, 0x92, 0x86, 0xd0, 0xdc, 0x80, 0x71, 0x61, 0x21, 0xbf, 0xbb, - 0x25, 0xe4, 0x78, 0x3f, 0x8c, 0x07, 0x80, 0x0f, 0xf0, 0xec, 0x7e, 0x18, 0x97, 0x8b, 0x56, 0xda, - 0xa5, 0x58, 0xa5, 0x2d, 0xfa, 0x3a, 0x21, 0x26, 0x11, 0xb0, 0x92, 0xc9, 0x87, 0x4a, 0xfc, 0x25, - 0x39, 0x3d, 0x95, 0x2d, 0x98, 0x10, 0x10, 0x49, 0x65, 0x84, 0x0d, 0xc6, 0xac, 0xbe, 0xad, 0x14, - 0x0c, 0x63, 0x15, 0x55, 0x6f, 0x14, 0x8e, 0x04, 0xfb, 0x43, 0x31, 0x3e, 0x78, 0xa7, 0x31, 0x01, - 0xab, 0x0c, 0xa2, 0x52, 0x30, 0x88, 0x97, 0x60, 0x3a, 0x10, 0x44, 0x09, 0xb8, 0x39, 0xe5, 0x47, - 0xd1, 0x85, 0x26, 0x47, 0xa7, 0x80, 0x16, 0xf5, 0x2e, 0xa1, 0xfd, 0x55, 0xd4, 0xa7, 0xbb, 0x7c, - 0xa8, 0xc9, 0xb7, 0x8f, 0x38, 0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x12, 0xfa, 0xa5, 0x24, 0x66, 0x51, 0x56, 0xfe, 0x3c, 0xad, 0xc1, 0xff, 0x65, + 0x81, 0xf5, 0xf2, 0xb5, 0x1a, 0x12, 0x7d, 0x4c, 0xdd, 0x7a, 0x68, 0x28, 0x94, 0xb6, 0x60, 0x01, + 0x9b, 0xa6, 0xfd, 0xbc, 0xd9, 0xa3, 0x81, 0x0a, 0x4f, 0xf1, 0x9a, 0x13, 0x37, 0x3d, 0x0c, 0xfc, + 0x56, 0xe2, 0x09, 0x14, 0x05, 0xac, 0x68, 0xfd, 0x55, 0x83, 0x6b, 0x49, 0x11, 0x18, 0xf6, 0x49, + 0xf4, 0x36, 0x2c, 0x78, 0x39, 0xf3, 0x35, 0x6d, 0x14, 0xc1, 0x79, 0x1c, 0x03, 0x24, 0xc0, 0x70, + 0x1d, 0xae, 0xe7, 0xc2, 0xae, 0xb8, 0xfe, 0x41, 0x83, 0xff, 0x0f, 0xc9, 0xef, 0x5b, 0x8c, 0x38, + 0x1d, 0xa2, 0x1b, 0xd8, 0x79, 0x71, 0x87, 0x58, 0x76, 0x67, 0x28, 0x44, 0xd7, 0x01, 0x19, 0x3e, + 0x47, 0x4d, 0x9d, 0x7b, 0x52, 0x4f, 0xe4, 0x73, 0x46, 0x18, 0x42, 0x80, 0xe2, 0x35, 0x58, 0xcb, + 0x86, 0xac, 0xf8, 0xfd, 0x7a, 0xc4, 0x97, 0xf1, 0xfb, 0xd8, 0xc2, 0x6d, 0x72, 0x40, 0x9c, 0x8e, + 0x41, 0xa9, 0x61, 0x5b, 0x74, 0x58, 0x67, 0x8c, 0x43, 0x8e, 0xed, 0x23, 0xd2, 0xc4, 0xa6, 0x29, + 0x8a, 0x89, 0x62, 0xa3, 0x28, 0xaf, 0xec, 0x98, 0x26, 0xda, 0x83, 0xa2, 0xa8, 0x35, 0xf8, 0x6f, + 0x75, 0xcc, 0x5c, 0x4e, 0x29, 0x35, 0x08, 0xa5, 0xf7, 0x1c, 0xdc, 0x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 0x55, 0xd1, 0x3e, 0x7e, 0x5d, 0x39, 0xf3, 0xd9, 0xeb, + 0xca, 0x99, 0x7f, 0xbc, 0xae, 0x9c, 0x81, 0x45, 0xc3, 0x4e, 0xb0, 0x77, 0xa0, 0x7d, 0x50, 0xf3, + 0x7d, 0x50, 0xe4, 0x09, 0xad, 0x1b, 0xb6, 0xef, 0xd7, 0xc6, 0x49, 0xff, 0x6f, 0x28, 0x0e, 0xc7, + 0xc5, 0x1f, 0x4e, 0xbc, 0xfd, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0x09, 0x38, 0xc6, 0x9d, + 0x32, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. From 72a986086478a82ea18af60f3f52f87a6289a864 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Wed, 17 Apr 2024 16:01:04 -0600 Subject: [PATCH 04/42] [1760]: Define and set the custom GetSigners funcs for create and accept payment. --- x/exchange/export_test.go | 8 + x/exchange/msg.go | 66 +++--- x/exchange/msg_sigs_test.go | 388 ++++++++++++++++++++++++++++++++++++ x/exchange/msg_test.go | 182 ----------------- 4 files changed, 439 insertions(+), 205 deletions(-) create mode 100644 x/exchange/export_test.go create mode 100644 x/exchange/msg_sigs_test.go diff --git a/x/exchange/export_test.go b/x/exchange/export_test.go new file mode 100644 index 0000000000..7ad315ae8c --- /dev/null +++ b/x/exchange/export_test.go @@ -0,0 +1,8 @@ +package exchange + +var ( + // CreatePaymentGetSignersFunc is a test-only exposure of createPaymentGetSignersFunc. + CreatePaymentGetSignersFunc = createPaymentGetSignersFunc + // AllRequestMsgs is a test-only exposure of allRequestMsgs. + AllRequestMsgs = allRequestMsgs +) diff --git a/x/exchange/msg.go b/x/exchange/msg.go index 4807f8c7fb..0b3419ee28 100644 --- a/x/exchange/msg.go +++ b/x/exchange/msg.go @@ -4,6 +4,10 @@ import ( "errors" "fmt" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/protoadapt" + "google.golang.org/protobuf/reflect/protoreflect" + "cosmossdk.io/x/tx/signing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -848,29 +852,45 @@ func (m MsgGovUpdateParamsRequest) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{addr} } +// createPaymentGetSignersFunc returns a custom GetSigners function for a Msg that has a signer in a Payment. +// The Payment must be in a field named "payment", and must not be nullable. +// The provided getter will be used to get the string of the signer address, +// which will be decoded using the decoder in the provided signing.Options. +func createPaymentGetSignersFunc(options *signing.Options, fieldName string) signing.GetSignersFunc { + return func(msgIn proto.Message) (addrs [][]byte, err error) { + defer func() { + if r := recover(); r != nil { + err = fmt.Errorf("panic (recovered) getting %s.payment.%s as a signer: %v", proto.MessageName(msgIn), fieldName, r) + } + }() + + msg := msgIn.ProtoReflect() + pmtDesc := msg.Descriptor().Fields().ByName("payment") + if pmtDesc == nil { + return nil, fmt.Errorf("no payment field found in %s", proto.MessageName(msgIn)) + } + + pmt := msg.Get(pmtDesc).Message() + fieldDesc := pmt.Descriptor().Fields().ByName(protoreflect.Name(fieldName)) + if fieldDesc == nil { + return nil, fmt.Errorf("no payment.%s field found in %s", fieldName, proto.MessageName(msgIn)) + } + + b32 := pmt.Get(fieldDesc).Interface().(string) + addr, err := options.AddressCodec.StringToBytes(b32) + if err != nil { + return nil, fmt.Errorf("error decoding payment.%s address %q: %w", fieldName, b32, err) + } + return [][]byte{addr}, nil + } +} + // DefineCustomGetSigners registers all the exchange module custom GetSigners functions with the provided signing options. func DefineCustomGetSigners(options *signing.Options) { - // TODO[1760]: Uncomment this once we figure out how to make our msgs have the ProtoReflect method. - // options.DefineCustomGetSigners(proto.MessageName(&MsgCreatePaymentRequest{}), func(msg proto.Message) ([][]byte, error) { - // msgCP, ok := msg.(*MsgCreatePaymentRequest) - // if !ok { - // return nil, fmt.Errorf("incorrect message type, actual: %T, expected: %T", msg, &MsgCreatePaymentRequest{}) - // } - // addr, err := options.AddressCodec.StringToBytes(msgCP.Payment.Source) - // if err != nil { - // return nil, err - // } - // return [][]byte{addr}, nil - // }) - // options.DefineCustomGetSigners(proto.MessageName(&MsgAcceptPaymentRequest{}), func(msg proto.Message) ([][]byte, error) { - // msgCP, ok := msg.(*MsgAcceptPaymentRequest) - // if !ok { - // return nil, fmt.Errorf("incorrect message type, actual: %T, expected: %T", msg, &MsgAcceptPaymentRequest{}) - // } - // addr, err := options.AddressCodec.StringToBytes(msgCP.Payment.Target) - // if err != nil { - // return nil, err - // } - // return [][]byte{addr}, nil - // }) + options.DefineCustomGetSigners( + proto.MessageName(protoadapt.MessageV2Of(&MsgCreatePaymentRequest{})), + createPaymentGetSignersFunc(options, "source")) + options.DefineCustomGetSigners( + proto.MessageName(protoadapt.MessageV2Of(&MsgAcceptPaymentRequest{})), + createPaymentGetSignersFunc(options, "target")) } diff --git a/x/exchange/msg_sigs_test.go b/x/exchange/msg_sigs_test.go new file mode 100644 index 0000000000..97abed3d86 --- /dev/null +++ b/x/exchange/msg_sigs_test.go @@ -0,0 +1,388 @@ +package exchange_test + +import ( + "fmt" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/protoadapt" + + "cosmossdk.io/x/tx/signing" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/provenance-io/provenance/app" + "github.com/provenance-io/provenance/testutil/assertions" + "github.com/provenance-io/provenance/x/exchange" +) + +const ( + emptyAddrErr = "empty address string is not allowed" + bech32Err = "decoding bech32 failed: " +) + +type HasGetSigners interface { + GetSigners() []sdk.AccAddress +} + +func TestAllMsgsGetSigners(t *testing.T) { + // getTypeName gets just the type name of the provided thing, e.g. "MsgGovCreateMarketRequest". + getTypeName := func(thing interface{}) string { + rv := fmt.Sprintf("%T", thing) // e.g. "*types.MsgGovCreateMarketRequest" + lastDot := strings.LastIndex(rv, ".") + if lastDot < 0 || lastDot+1 >= len(rv) { + return rv + } + return rv[lastDot+1:] + } + + testAddr := sdk.AccAddress("testAddr____________") + badAddrStr := "badaddr" + badAddrErr := bech32Err + "invalid bech32 string length 7" + + msgMakers := []func(signer string) sdk.Msg{ + func(signer string) sdk.Msg { + return &exchange.MsgCreateAskRequest{AskOrder: exchange.AskOrder{Seller: signer}} + }, + func(signer string) sdk.Msg { + return &exchange.MsgCreateBidRequest{BidOrder: exchange.BidOrder{Buyer: signer}} + }, + func(signer string) sdk.Msg { + return &exchange.MsgCommitFundsRequest{Account: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgCancelOrderRequest{Signer: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgFillBidsRequest{Seller: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgFillAsksRequest{Buyer: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgMarketSettleRequest{Admin: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgMarketCommitmentSettleRequest{Admin: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgMarketReleaseCommitmentsRequest{Admin: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgMarketSetOrderExternalIDRequest{Admin: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgMarketWithdrawRequest{Admin: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgMarketUpdateDetailsRequest{Admin: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgMarketUpdateEnabledRequest{Admin: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgMarketUpdateAcceptingOrdersRequest{Admin: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgMarketUpdateUserSettleRequest{Admin: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgMarketUpdateAcceptingCommitmentsRequest{Admin: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgMarketUpdateIntermediaryDenomRequest{Admin: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgMarketManagePermissionsRequest{Admin: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgMarketManageReqAttrsRequest{Admin: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgCreatePaymentRequest{Payment: exchange.Payment{Source: signer}} + }, + func(signer string) sdk.Msg { + return &exchange.MsgAcceptPaymentRequest{Payment: exchange.Payment{Target: signer}} + }, + func(signer string) sdk.Msg { + return &exchange.MsgRejectPaymentRequest{Target: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgRejectPaymentsRequest{Target: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgCancelPaymentsRequest{Source: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgChangePaymentTargetRequest{Source: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgGovCreateMarketRequest{Authority: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgGovManageFeesRequest{Authority: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgGovCloseMarketRequest{Authority: signer} + }, + func(signer string) sdk.Msg { + return &exchange.MsgGovUpdateParamsRequest{Authority: signer} + }, + } + + signerCases := []struct { + name string + msgSigner string + expSigners []sdk.AccAddress + expPanic string + }{ + { + name: "no signer", + msgSigner: "", + expPanic: emptyAddrErr, + }, + { + name: "good signer", + msgSigner: testAddr.String(), + expSigners: []sdk.AccAddress{testAddr}, + }, + { + name: "bad signer", + msgSigner: badAddrStr, + expPanic: badAddrErr, + }, + } + + type testCase struct { + name string + msg sdk.Msg + expSigners []sdk.AccAddress + expPanic string + } + + var tests []testCase + hasMaker := make(map[string]bool) + + for _, msgMaker := range msgMakers { + typeName := getTypeName(msgMaker("")) + hasMaker[typeName] = true + for _, tc := range signerCases { + tests = append(tests, testCase{ + name: typeName + " " + tc.name, + msg: msgMaker(tc.msgSigner), + expSigners: tc.expSigners, + expPanic: tc.expPanic, + }) + } + } + + encCfg := app.MakeTestEncodingConfig(t) + sigCtx := encCfg.InterfaceRegistry.SigningContext() + + // Make sure all of the GetSigners() methods behave as expected. + t.Run("legacy methods", func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name+" legacy", func(t *testing.T) { + smsg, ok := tc.msg.(HasGetSigners) + require.True(t, ok, "%T does not have a .GetSigners method.", tc.msg) + + var signers []sdk.AccAddress + testFunc := func() { + signers = smsg.GetSigners() + } + + assertions.RequirePanicEquals(t, testFunc, tc.expPanic, "GetSigners") + assert.Equal(t, tc.expSigners, signers, "GetSigners") + }) + } + }) + + // Make sure all of the msgs behave as expected with the new generic GetSigners(msg) function. + t.Run("generic GetSigners(msg)", func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name+" generic", func(t *testing.T) { + var expected [][]byte + if tc.expSigners != nil { + expected = make([][]byte, len(tc.expSigners)) + for i, signer := range tc.expSigners { + expected[i] = signer + } + } + + var actual [][]byte + var err error + testFunc := func() { + msgV2 := protoadapt.MessageV2Of(tc.msg) + actual, err = sigCtx.GetSigners(msgV2) + } + require.NotPanics(t, testFunc, "sigCtx.GetSigners(msgV2)") + if len(tc.expPanic) > 0 { + assert.ErrorContains(t, err, tc.expPanic, "sigCtx.GetSigners(msgV2) error") + } else { + assert.NoError(t, err, "sigCtx.GetSigners(msgV2) error") + } + assert.Equal(t, expected, actual, "sigCtx.GetSigners(msgV2) result") + }) + } + }) + + // Make sure all of the GetSigners funcs are tested. + t.Run("all msgs have test case", func(t *testing.T) { + for _, msg := range exchange.AllRequestMsgs { + typeName := getTypeName(msg) + t.Run(typeName, func(t *testing.T) { + // If this fails, a maker needs to be defined above for the missing msg type. + assert.True(t, hasMaker[typeName], "There is not a GetSigners test case for %s", typeName) + }) + } + }) +} + +func TestCreatePaymentGetSignersFunc(t *testing.T) { + encCfg := app.MakeTestEncodingConfig(t) + sigCtx := encCfg.InterfaceRegistry.SigningContext() + opts := &signing.Options{ + AddressCodec: sigCtx.AddressCodec(), + ValidatorAddressCodec: sigCtx.ValidatorAddressCodec(), + } + + tests := []struct { + name string + fieldName string + msg sdk.Msg + expAddrs [][]byte + expInErr []string + }{ + { + name: "msg without a payment field", + fieldName: "whatever", + msg: &exchange.MsgCreateAskRequest{}, + expInErr: []string{"no payment field found in provenance.exchange.v1.MsgCreateAskRequest"}, + }, + { + name: "no such field in the payment", + fieldName: "no_such_thing", + msg: &exchange.MsgCreatePaymentRequest{}, + expInErr: []string{"no payment.no_such_thing field found in provenance.exchange.v1.MsgCreatePaymentRequest"}, + }, + { + name: "field is not a string", + fieldName: "source_amount", + msg: &exchange.MsgCreatePaymentRequest{}, + expInErr: []string{"panic (recovered) getting provenance.exchange.v1.MsgCreatePaymentRequest.payment.source_amount as a signer", + "interface conversion", "not string"}, + }, + { + name: "field is empty", + fieldName: "source", + msg: &exchange.MsgCreatePaymentRequest{}, + expInErr: []string{"error decoding payment.source address \"\"", emptyAddrErr}, + }, + { + name: "invalid bech32", + fieldName: "source", + msg: &exchange.MsgCreatePaymentRequest{Payment: exchange.Payment{Source: "not_an_address"}}, + expInErr: []string{"error decoding payment.source address \"not_an_address\"", bech32Err}, + }, + { + name: "all good: create and source", + fieldName: "source", + msg: &exchange.MsgCreatePaymentRequest{ + Payment: exchange.Payment{Source: sdk.AccAddress("source_address______").String()}, + }, + expAddrs: [][]byte{[]byte("source_address______")}, + }, + { + name: "all good: accept and target", + fieldName: "target", + msg: &exchange.MsgAcceptPaymentRequest{ + Payment: exchange.Payment{Target: sdk.AccAddress("target_address______").String()}, + }, + expAddrs: [][]byte{[]byte("target_address______")}, + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + var getSignersFn signing.GetSignersFunc + testMaker := func() { + getSignersFn = exchange.CreatePaymentGetSignersFunc(opts, tc.fieldName) + } + require.NotPanics(t, testMaker, "CreatePaymentGetSignersFunc(%q)", tc.fieldName) + + var actAddrs [][]byte + var actErr error + testGetter := func() { + msgV2 := protoadapt.MessageV2Of(tc.msg) + actAddrs, actErr = getSignersFn(msgV2) + } + require.NotPanics(t, testGetter, "custom GetSigners function") + assertions.AssertErrorContents(t, actErr, tc.expInErr, "custom GetSigners function error") + assert.Equal(t, tc.expAddrs, actAddrs, "custom GetSigners function addresses") + }) + } +} + +func TestDefineCustomGetSigners(t *testing.T) { + encCfg := app.MakeTestEncodingConfig(t) + sigCtx := encCfg.InterfaceRegistry.SigningContext() + + sigOpts := signing.Options{ + AddressCodec: sigCtx.AddressCodec(), + ValidatorAddressCodec: sigCtx.ValidatorAddressCodec(), + } + + testFunc := func() { + exchange.DefineCustomGetSigners(&sigOpts) + } + require.NotPanics(t, testFunc, "DefineCustomGetSigners") + assert.Len(t, sigOpts.CustomGetSigners, 2, "CustomGetSigners") + + tests := []struct { + msg sdk.Msg + exp []byte + }{ + { + msg: &exchange.MsgCreatePaymentRequest{Payment: exchange.Payment{Source: sdk.AccAddress("source______________").String()}}, + exp: []byte("source______________"), + }, + { + msg: &exchange.MsgAcceptPaymentRequest{Payment: exchange.Payment{Target: sdk.AccAddress("target______________").String()}}, + exp: []byte("target______________"), + }, + } + + for _, tc := range tests { + msgV2 := protoadapt.MessageV2Of(tc.msg) + name := proto.MessageName(msgV2) + expected := [][]byte{tc.exp} + + // Make sure the custom entries are added to the map, and that they work as expected. + t.Run(string(name)+" CustomGetSigners", func(t *testing.T) { + getSignersFn := sigOpts.CustomGetSigners[name] + if assert.NotNil(t, getSignersFn, "sigOpts.CustomGetSigners[%q]", name) { + var actual [][]byte + var err error + testGetSigners := func() { + actual, err = getSignersFn(msgV2) + } + require.NotPanics(t, testGetSigners, "getSignersFn", name) + assert.NoError(t, err, "getSignersFn error", name) + assert.Equal(t, expected, actual, "getSignersFn result", name) + } + }) + + // Make sure the custom entries are added to the encoder and that that works as expected. + t.Run(string(name)+"GetSigners", func(t *testing.T) { + var actual [][]byte + var err error + testGetSigners := func() { + actual, err = sigCtx.GetSigners(msgV2) + } + require.NotPanics(t, testGetSigners, "sigCtx.GetSigners(msg)") + assert.NoError(t, err, "sigCtx.GetSigners(msg) error") + assert.Equal(t, expected, actual, "sigCtx.GetSigners(msg) result") + }) + } +} diff --git a/x/exchange/msg_test.go b/x/exchange/msg_test.go index 4a0da88a89..e87ad26936 100644 --- a/x/exchange/msg_test.go +++ b/x/exchange/msg_test.go @@ -21,188 +21,6 @@ const ( bech32Err = "decoding bech32 failed: " ) -type HasGetSigners interface { - GetSigners() []sdk.AccAddress -} - -func TestAllMsgsGetSigners(t *testing.T) { - // getTypeName gets just the type name of the provided thing, e.g. "MsgGovCreateMarketRequest". - getTypeName := func(thing interface{}) string { - rv := fmt.Sprintf("%T", thing) // e.g. "*types.MsgGovCreateMarketRequest" - lastDot := strings.LastIndex(rv, ".") - if lastDot < 0 || lastDot+1 >= len(rv) { - return rv - } - return rv[lastDot+1:] - } - - testAddr := sdk.AccAddress("testAddr____________") - badAddrStr := "badaddr" - badAddrErr := bech32Err + "invalid bech32 string length 7" - - msgMakers := []func(signer string) sdk.Msg{ - func(signer string) sdk.Msg { - return &MsgCreateAskRequest{AskOrder: AskOrder{Seller: signer}} - }, - func(signer string) sdk.Msg { - return &MsgCreateBidRequest{BidOrder: BidOrder{Buyer: signer}} - }, - func(signer string) sdk.Msg { - return &MsgCommitFundsRequest{Account: signer} - }, - func(signer string) sdk.Msg { - return &MsgCancelOrderRequest{Signer: signer} - }, - func(signer string) sdk.Msg { - return &MsgFillBidsRequest{Seller: signer} - }, - func(signer string) sdk.Msg { - return &MsgFillAsksRequest{Buyer: signer} - }, - func(signer string) sdk.Msg { - return &MsgMarketSettleRequest{Admin: signer} - }, - func(signer string) sdk.Msg { - return &MsgMarketCommitmentSettleRequest{Admin: signer} - }, - func(signer string) sdk.Msg { - return &MsgMarketReleaseCommitmentsRequest{Admin: signer} - }, - func(signer string) sdk.Msg { - return &MsgMarketSetOrderExternalIDRequest{Admin: signer} - }, - func(signer string) sdk.Msg { - return &MsgMarketWithdrawRequest{Admin: signer} - }, - func(signer string) sdk.Msg { - return &MsgMarketUpdateDetailsRequest{Admin: signer} - }, - func(signer string) sdk.Msg { - return &MsgMarketUpdateEnabledRequest{Admin: signer} - }, - func(signer string) sdk.Msg { - return &MsgMarketUpdateAcceptingOrdersRequest{Admin: signer} - }, - func(signer string) sdk.Msg { - return &MsgMarketUpdateUserSettleRequest{Admin: signer} - }, - func(signer string) sdk.Msg { - return &MsgMarketUpdateAcceptingCommitmentsRequest{Admin: signer} - }, - func(signer string) sdk.Msg { - return &MsgMarketUpdateIntermediaryDenomRequest{Admin: signer} - }, - func(signer string) sdk.Msg { - return &MsgMarketManagePermissionsRequest{Admin: signer} - }, - func(signer string) sdk.Msg { - return &MsgMarketManageReqAttrsRequest{Admin: signer} - }, - func(signer string) sdk.Msg { - return &MsgCreatePaymentRequest{Payment: Payment{Source: signer}} - }, - func(signer string) sdk.Msg { - return &MsgAcceptPaymentRequest{Payment: Payment{Target: signer}} - }, - func(signer string) sdk.Msg { - return &MsgRejectPaymentRequest{Target: signer} - }, - func(signer string) sdk.Msg { - return &MsgRejectPaymentsRequest{Target: signer} - }, - func(signer string) sdk.Msg { - return &MsgCancelPaymentsRequest{Source: signer} - }, - func(signer string) sdk.Msg { - return &MsgChangePaymentTargetRequest{Source: signer} - }, - func(signer string) sdk.Msg { - return &MsgGovCreateMarketRequest{Authority: signer} - }, - func(signer string) sdk.Msg { - return &MsgGovManageFeesRequest{Authority: signer} - }, - func(signer string) sdk.Msg { - return &MsgGovCloseMarketRequest{Authority: signer} - }, - func(signer string) sdk.Msg { - return &MsgGovUpdateParamsRequest{Authority: signer} - }, - } - - signerCases := []struct { - name string - msgSigner string - expSigners []sdk.AccAddress - expPanic string - }{ - { - name: "no signer", - msgSigner: "", - expPanic: emptyAddrErr, - }, - { - name: "good signer", - msgSigner: testAddr.String(), - expSigners: []sdk.AccAddress{testAddr}, - }, - { - name: "bad signer", - msgSigner: badAddrStr, - expPanic: badAddrErr, - }, - } - - type testCase struct { - name string - msg sdk.Msg - expSigners []sdk.AccAddress - expPanic string - } - - var tests []testCase - hasMaker := make(map[string]bool) - - for _, msgMaker := range msgMakers { - typeName := getTypeName(msgMaker("")) - hasMaker[typeName] = true - for _, tc := range signerCases { - tests = append(tests, testCase{ - name: typeName + " " + tc.name, - msg: msgMaker(tc.msgSigner), - expSigners: tc.expSigners, - expPanic: tc.expPanic, - }) - } - } - - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - smsg, ok := tc.msg.(HasGetSigners) - require.True(t, ok, "%T does not have a .GetSigners method.", tc.msg) - - var signers []sdk.AccAddress - testFunc := func() { - signers = smsg.GetSigners() - } - - assertions.RequirePanicEquals(t, testFunc, tc.expPanic, "GetSigners") - assert.Equal(t, tc.expSigners, signers, "GetSigners") - }) - } - - // Make sure all of the GetSigners and GetSignerStrs funcs are tested. - t.Run("all msgs have test case", func(t *testing.T) { - for _, msg := range allRequestMsgs { - typeName := getTypeName(msg) - t.Run(typeName, func(t *testing.T) { - // If this fails, a maker needs to be defined above for the missing msg type. - assert.True(t, hasMaker[typeName], "There is not a GetSigners test case for %s", typeName) - }) - } - }) -} - func testValidateBasic(t *testing.T, msg sdk.Msg, expErr []string) { t.Helper() var err error From a012c2f6278ab2deff5dd1b3a9d58cba66c6e970 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Wed, 17 Apr 2024 16:17:57 -0600 Subject: [PATCH 05/42] [1760]: Fix all of the exchange CLi tests. --- x/exchange/client/cli/cli_test.go | 3 +++ x/exchange/client/cli/tx_test.go | 24 +++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/x/exchange/client/cli/cli_test.go b/x/exchange/client/cli/cli_test.go index ed26b90371..f4a189bb04 100644 --- a/x/exchange/client/cli/cli_test.go +++ b/x/exchange/client/cli/cli_test.go @@ -77,6 +77,7 @@ func TestCmdTestSuite(t *testing.T) { func (s *CmdTestSuite) SetupSuite() { s.T().Log("setting up integration test suite") pioconfig.SetProvenanceConfig("", 0) + govv1.DefaultMinDepositRatio = sdkmath.LegacyZeroDec() s.cfg = testutil.DefaultTestNetworkConfig() s.cfg.NumValidators = 1 s.cfg.ChainID = antewrapper.SimAppChainID @@ -606,6 +607,7 @@ func (s *CmdTestSuite) runTxCmdTestCase(tc txCmdTestCase) { if len(tc.expInErr) == 0 && err == nil { resp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + txResponse = &resp s.Assert().Equal(int(tc.expectedCode), int(resp.Code), "response code") for _, exp := range tc.expInRawLog { s.Assert().Contains(resp.RawLog, exp, "TxResponse.RawLog should contain:\n%q", exp) @@ -1194,6 +1196,7 @@ func (s *CmdTestSuite) execBankSend(fromAddr, toAddr, amount string) { func (s *CmdTestSuite) untypeEvent(tev proto.Message) sdk.Event { rv, err := sdk.TypedEventToEvent(tev) s.Require().NoError(err, "TypedEventToEvent(%T)", tev) + rv.Attributes = append(rv.Attributes, abci.EventAttribute{Key: "msg_index", Value: "0", Index: true}) return rv } diff --git a/x/exchange/client/cli/tx_test.go b/x/exchange/client/cli/tx_test.go index f9f2549b3e..7515f193cb 100644 --- a/x/exchange/client/cli/tx_test.go +++ b/x/exchange/client/cli/tx_test.go @@ -1622,7 +1622,10 @@ func (s *CmdTestSuite) TestCmdTxGovCreateMarket() { }, { name: "wrong authority", - args: []string{"create-market", "--from", s.addr2.String(), "--authority", s.addr2.String(), "--name", "Whatever"}, + args: []string{"create-market", "--from", s.addr2.String(), + "--authority", s.addr2.String(), "--name", "Whatever", + "--title", "mwahahaha", "--summary", "your laugh is evil", + }, expInRawLog: []string{"failed to execute message", s.addr2.String(), "expected gov account as only signer for proposal message", }, @@ -1655,6 +1658,7 @@ func (s *CmdTestSuite) TestCmdTxGovCreateMarket() { "--description", "Market 01E6", "--create-ask", "100acorn", "--create-bid", "110acorn", "--accepting-orders", "--access-grants", s.addr4.String() + ":all", + "--title", "Create My New Market", "--summary", "Create the My New Market Market", }, expectedCode: 0, }, @@ -1677,7 +1681,9 @@ func (s *CmdTestSuite) TestCmdTxGovManageFees() { { name: "wrong authority", args: []string{"manage-fees", "--from", s.addr2.String(), "--authority", s.addr2.String(), - "--ask-add", "99banana", "--market", "12"}, + "--ask-add", "99banana", "--market", "12", + "--title", "mwahahaha", "--summary", "your laugh is evil", + }, expInRawLog: []string{"failed to execute message", s.addr2.String(), "expected gov account as only signer for proposal message", }, @@ -1700,6 +1706,7 @@ func (s *CmdTestSuite) TestCmdTxGovManageFees() { args: []string{"update-fees", "--from", s.addr4.String(), "--market", "419", "--ask-add", "99banana", "--seller-flat-remove", "12acorn", "--buyer-ratios-add", "100plum:1plum", + "--title", "Update Market 419 Fees", "--summary", "Update the fees for Market 419", }, expectedCode: 0, }, @@ -1722,7 +1729,9 @@ func (s *CmdTestSuite) TestCmdTxGovCloseMarket() { { name: "wrong authority", args: []string{"close-market", "--market", "419", - "--from", s.addr2.String(), "--authority", s.addr2.String()}, + "--from", s.addr2.String(), "--authority", s.addr2.String(), + "--title", "mwahahaha", "--summary", "your laugh is evil", + }, expInRawLog: []string{"failed to execute message", s.addr2.String(), "expected gov account as only signer for proposal message", }, @@ -1737,7 +1746,9 @@ func (s *CmdTestSuite) TestCmdTxGovCloseMarket() { } return nil, s.govPropFollowup(expMsg) }, - args: []string{"close-market", "--market", "419", "--from", s.addr2.String()}, + args: []string{"close-market", "--market", "419", "--from", s.addr2.String(), + "--title", "Close Marker 419", "--summary", "Cancel everything in Market 419", + }, expectedCode: 0, }, } @@ -1758,7 +1769,9 @@ func (s *CmdTestSuite) TestCmdTxGovUpdateParams() { }, { name: "wrong authority", - args: []string{"gov-params", "--from", s.addr2.String(), "--authority", s.addr2.String(), "--default", "500"}, + args: []string{"gov-params", "--from", s.addr2.String(), "--authority", s.addr2.String(), "--default", "500", + "--title", "mwahahaha", "--summary", "your laugh is evil", + }, expInRawLog: []string{"failed to execute message", s.addr2.String(), "expected gov account as only signer for proposal message", }, @@ -1781,6 +1794,7 @@ func (s *CmdTestSuite) TestCmdTxGovUpdateParams() { }, args: []string{"params", "--from", s.addr4.String(), "--default", "777", "--split", "apple:500", "--split", "acorn:555", + "--title", "Update Params", "--summary", "Change Dem Params", }, expectedCode: 0, }, From b64829a744de2df2b128bbe72a7b3e54617b1c4a Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Wed, 17 Apr 2024 17:06:32 -0600 Subject: [PATCH 06/42] [1760]: Fix the last remaining exchange test failures. --- x/exchange/keeper/keeper.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/x/exchange/keeper/keeper.go b/x/exchange/keeper/keeper.go index e7bdd856a8..9f005423a0 100644 --- a/x/exchange/keeper/keeper.go +++ b/x/exchange/keeper/keeper.go @@ -166,8 +166,13 @@ func deleteAll(store storetypes.KVStore, pre []byte) { // The callback should return false to continue iteration, or true to stop. func iterate(store storetypes.KVStore, keyPrefix []byte, cb func(keySuffix, value []byte) bool) { // Using an open iterator on a prefixed store here so that iter.Key() doesn't contain the prefix. - pStore := prefix.NewStore(store, keyPrefix) - iter := pStore.Iterator(nil, nil) + var iter storetypes.Iterator + if len(keyPrefix) > 0 { + pStore := prefix.NewStore(store, keyPrefix) + iter = pStore.Iterator(nil, nil) + } else { + iter = store.Iterator(nil, nil) + } defer iter.Close() for ; iter.Valid(); iter.Next() { From 6ea9d4f68545f2e4783868d0c7ec840dd5dc8c6e Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Wed, 17 Apr 2024 19:00:28 -0600 Subject: [PATCH 07/42] [1760]: Use the correct signer field for MsgAddAttributeRequest. --- proto/provenance/attribute/v1/tx.proto | 2 +- x/attribute/types/tx.pb.go | 98 +++++++++++++------------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/proto/provenance/attribute/v1/tx.proto b/proto/provenance/attribute/v1/tx.proto index 08dd4474f5..bc1c8993c4 100644 --- a/proto/provenance/attribute/v1/tx.proto +++ b/proto/provenance/attribute/v1/tx.proto @@ -35,7 +35,7 @@ service Msg { // MsgAddAttributeRequest defines an sdk.Msg type that is used to add a new attribute to an account. // Attributes may only be set in an account by the account that the attribute name resolves to. message MsgAddAttributeRequest { - option (cosmos.msg.v1.signer) = "account"; + option (cosmos.msg.v1.signer) = "owner"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = false; diff --git a/x/attribute/types/tx.pb.go b/x/attribute/types/tx.pb.go index 8633c54bb4..630277e562 100644 --- a/x/attribute/types/tx.pb.go +++ b/x/attribute/types/tx.pb.go @@ -599,55 +599,55 @@ func init() { func init() { proto.RegisterFile("provenance/attribute/v1/tx.proto", fileDescriptor_5de344c1a12714be) } var fileDescriptor_5de344c1a12714be = []byte{ - // 761 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4d, 0x6f, 0xd3, 0x4c, - 0x10, 0xf6, 0xd6, 0x69, 0xfa, 0xbe, 0xdb, 0x34, 0x95, 0x96, 0xb6, 0x71, 0x4d, 0x95, 0xb8, 0xa1, - 0x94, 0x08, 0x09, 0x9b, 0xa6, 0xe2, 0x12, 0xe0, 0xd0, 0x2a, 0x1c, 0x23, 0xa1, 0x50, 0x10, 0xea, - 0x81, 0xca, 0x49, 0x17, 0x63, 0x29, 0xf6, 0xba, 0xd9, 0x75, 0xda, 0xc2, 0xa5, 0x70, 0xe2, 0x58, - 0x71, 0x6a, 0x6f, 0xfd, 0x05, 0x88, 0x9f, 0xd1, 0x63, 0x8f, 0x1c, 0x2a, 0x40, 0xad, 0x04, 0xfc, - 0x0c, 0x14, 0x7f, 0xc5, 0xf9, 0x70, 0x88, 0xc3, 0x6d, 0x67, 0x77, 0xe6, 0x99, 0x67, 0x9f, 0x99, - 0x1d, 0x1b, 0x4a, 0x56, 0x93, 0xb4, 0xb0, 0xa9, 0x9a, 0x75, 0xac, 0xa8, 0x8c, 0x35, 0xf5, 0x9a, - 0xcd, 0xb0, 0xd2, 0x5a, 0x53, 0xd8, 0x81, 0x6c, 0x35, 0x09, 0x23, 0x28, 0xd3, 0xf1, 0x90, 0x03, - 0x0f, 0xb9, 0xb5, 0x26, 0x66, 0xea, 0x84, 0x1a, 0x84, 0x2a, 0x06, 0xd5, 0xda, 0x01, 0x06, 0xd5, - 0xdc, 0x08, 0x71, 0x4e, 0x23, 0x1a, 0x71, 0x96, 0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, 0xc7, 0xd7, 0x59, 0xee, - 0xe2, 0x3a, 0xcb, 0x7d, 0xbd, 0xce, 0x72, 0x50, 0xd4, 0x49, 0x14, 0xde, 0x53, 0xb0, 0xfd, 0x40, - 0xd3, 0xd9, 0x1b, 0xbb, 0x26, 0xd7, 0x89, 0xa1, 0x74, 0xbc, 0xee, 0xe9, 0x24, 0x64, 0x29, 0x07, - 0xa1, 0x5f, 0xad, 0xf6, 0xb7, 0x91, 0xd6, 0x92, 0xce, 0xf0, 0x5f, 0xff, 0x13, 0x00, 0x00, 0xff, - 0xff, 0x5e, 0x5a, 0xfb, 0xc3, 0x1a, 0x0a, 0x00, 0x00, + // 757 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0xcd, 0xd6, 0x69, 0x0a, 0xdb, 0x34, 0x95, 0x96, 0xb6, 0x71, 0x0d, 0x4a, 0xdc, 0x50, 0x4a, + 0x84, 0x84, 0x4d, 0x53, 0x71, 0x09, 0x70, 0x68, 0x15, 0x8e, 0x91, 0x50, 0x28, 0x08, 0xf5, 0x40, + 0xe5, 0xa4, 0x8b, 0xb1, 0x14, 0x7b, 0xdd, 0xec, 0x3a, 0x6d, 0xe1, 0x52, 0x38, 0x71, 0xac, 0x38, + 0xb5, 0xb7, 0xfe, 0x00, 0x0e, 0xfc, 0x8c, 0x1e, 0x7b, 0xe4, 0x50, 0x01, 0x6a, 0x25, 0xe0, 0x67, + 0xa0, 0xf8, 0x2b, 0xce, 0x87, 0x4d, 0x1c, 0x6e, 0x9e, 0xf5, 0xcc, 0x7b, 0xcf, 0x6f, 0x66, 0x27, + 0x81, 0xa2, 0xd9, 0x22, 0x6d, 0x6c, 0x28, 0x46, 0x03, 0xcb, 0x0a, 0x63, 0x2d, 0xad, 0x6e, 0x31, + 0x2c, 0xb7, 0x57, 0x65, 0xb6, 0x2f,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0x6a, 0x0f, 0x66, 0x7a, 0x87, 0x17, 0xad, + 0x46, 0xc1, 0x0d, 0xbd, 0x42, 0x42, 0x29, 0x4e, 0x89, 0x43, 0xbc, 0xa1, 0x9f, 0x5d, 0xe6, 0xc0, + 0xf9, 0x65, 0x0e, 0xfc, 0xbc, 0xcc, 0x81, 0xa3, 0xab, 0x5c, 0xe2, 0xfc, 0x2a, 0x97, 0xf8, 0x76, + 0x95, 0x4b, 0x40, 0x41, 0x23, 0x61, 0x78, 0xcf, 0xc0, 0xd6, 0x43, 0x55, 0x63, 0x6f, 0xad, 0xba, + 0xd4, 0x20, 0xba, 0xdc, 0xcd, 0xba, 0xaf, 0x91, 0x40, 0x24, 0xef, 0x07, 0xfe, 0x68, 0x75, 0x7e, + 0x1b, 0x69, 0x3d, 0x65, 0x2f, 0xff, 0xb5, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x1b, 0xf9, 0x08, + 0xfa, 0x18, 0x0a, 0x00, 0x00, } func (this *MsgUpdateAttributeExpirationRequest) Equal(that interface{}) bool { From 450b67b8cb5a0e6b1357a26f845ab2fbf140ac89 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Wed, 17 Apr 2024 19:03:04 -0600 Subject: [PATCH 08/42] [1760]: Fix the attribute module cli tests. --- x/attribute/client/cli/cli_test.go | 116 +++++++++++---------- x/attribute/client/rest/grpc_query_test.go | 3 +- 2 files changed, 60 insertions(+), 59 deletions(-) diff --git a/x/attribute/client/cli/cli_test.go b/x/attribute/client/cli/cli_test.go index 0d1a0b04ec..dfbe259209 100644 --- a/x/attribute/client/cli/cli_test.go +++ b/x/attribute/client/cli/cli_test.go @@ -8,7 +8,6 @@ import ( "testing" "time" - "github.com/cosmos/gogoproto/proto" "github.com/spf13/cobra" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -24,10 +23,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/gogoproto/proto" "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" + "github.com/provenance-io/provenance/testutil/queries" "github.com/provenance-io/provenance/x/attribute/client/cli" attributetypes "github.com/provenance-io/provenance/x/attribute/types" namecli "github.com/provenance-io/provenance/x/name/client/cli" @@ -576,7 +577,6 @@ func (s *IntegrationTestSuite) TestAttributeAccountsCmd() { } func (s *IntegrationTestSuite) TestAttributeTxCommands() { - testCases := []struct { name string cmd *cobra.Command @@ -594,7 +594,7 @@ func (s *IntegrationTestSuite) TestAttributeTxCommands() { "attribute", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -611,7 +611,7 @@ func (s *IntegrationTestSuite) TestAttributeTxCommands() { "test value", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -629,7 +629,7 @@ func (s *IntegrationTestSuite) TestAttributeTxCommands() { "foo", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: true, @@ -647,7 +647,7 @@ func (s *IntegrationTestSuite) TestAttributeTxCommands() { "2050-01-15T00:00:00Z", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -664,7 +664,7 @@ func (s *IntegrationTestSuite) TestAttributeTxCommands() { "test value", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: true, @@ -681,7 +681,7 @@ func (s *IntegrationTestSuite) TestAttributeTxCommands() { "3.14159", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: true, @@ -698,7 +698,7 @@ func (s *IntegrationTestSuite) TestAttributeTxCommands() { "3.14159", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: true, @@ -711,13 +711,14 @@ func (s *IntegrationTestSuite) TestAttributeTxCommands() { s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) if tc.expectErr { s.Require().Error(err) } else { s.Require().NoError(err) - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) s.Require().Equal(tc.expectedCode, txResp.Code) } }) @@ -730,7 +731,7 @@ func (s *IntegrationTestSuite) TestAccountDataCmds() { return append(firstArgs, "--"+flags.FlagFrom, from, "--"+flags.FlagSkipConfirmation, - "--"+flags.FlagBroadcastMode, flags.BroadcastSync, // TODO[1760]: broadcast + "--"+flags.FlagBroadcastMode, flags.BroadcastSync, "--"+flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String(), jsonOut, ) @@ -857,24 +858,24 @@ func (s *IntegrationTestSuite) TestAccountDataCmds() { clientCtx := s.testnet.Validators[0].ClientCtx.WithKeyring(s.keyring) out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) outBz := out.Bytes() - outStr := string(outBz) - s.T().Logf("Args: %q\nOutput:\n%s", tc.args, outStr) + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) + if len(tc.expErr) > 0 { s.Require().EqualError(err, tc.expErr, "cmd execution error") - s.Require().Contains(outStr, tc.expErr, "cmd output") + s.Require().Contains(string(outBz), tc.expErr, "cmd output") } else { s.Require().NoError(err, "cmd execution error") } if tc.respType != nil { - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(outBz, tc.respType), "marshalling output to %T", tc.respType) - txResp, isTxResp := tc.respType.(*sdk.TxResponse) - if isTxResp { + if _, isTxResp := tc.respType.(*sdk.TxResponse); isTxResp { + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) s.Assert().Equal(tc.expCode, int(txResp.Code), "TxResponse code") if len(tc.expRawLog) > 0 { s.Assert().Equal(tc.expRawLog, txResp.RawLog, "txResp.RawLog") } } else { + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(outBz, tc.respType), "marshalling output to %T", tc.respType) s.Assert().Equal(tc.expResp, tc.respType, "command response") } } @@ -883,7 +884,6 @@ func (s *IntegrationTestSuite) TestAccountDataCmds() { } func (s *IntegrationTestSuite) TestUpdateAccountAttributeTxCommands() { - testCases := []struct { name string cmd *cobra.Command @@ -901,7 +901,7 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeTxCommands() { "attribute", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -918,7 +918,7 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeTxCommands() { "test value", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -937,7 +937,7 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeTxCommands() { "10", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: true, @@ -956,7 +956,7 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeTxCommands() { "10", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: true, @@ -975,7 +975,7 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeTxCommands() { "10", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: true, @@ -994,7 +994,7 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeTxCommands() { "nan", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: true, @@ -1013,7 +1013,7 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeTxCommands() { "10", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -1025,22 +1025,23 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeTxCommands() { for _, tc := range testCases { s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx + s.T().Logf("clientCtx: %#v", clientCtx) out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) if tc.expectErr { s.Require().Error(err) } else { 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) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expectedCode), int(txResp.Code)) } }) } } func (s *IntegrationTestSuite) TestDeleteDistinctAccountAttributeTxCommands() { - testCases := []struct { name string cmd *cobra.Command @@ -1058,7 +1059,7 @@ func (s *IntegrationTestSuite) TestDeleteDistinctAccountAttributeTxCommands() { "attribute", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -1075,7 +1076,7 @@ func (s *IntegrationTestSuite) TestDeleteDistinctAccountAttributeTxCommands() { "test value", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -1092,7 +1093,7 @@ func (s *IntegrationTestSuite) TestDeleteDistinctAccountAttributeTxCommands() { "test value", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: true, @@ -1109,7 +1110,7 @@ func (s *IntegrationTestSuite) TestDeleteDistinctAccountAttributeTxCommands() { "test value", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: true, @@ -1126,7 +1127,7 @@ func (s *IntegrationTestSuite) TestDeleteDistinctAccountAttributeTxCommands() { "test value", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -1139,21 +1140,21 @@ func (s *IntegrationTestSuite) TestDeleteDistinctAccountAttributeTxCommands() { s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) if tc.expectErr { s.Require().Error(err) } else { 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) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expectedCode), int(txResp.Code)) } }) } } func (s *IntegrationTestSuite) TestDeleteAccountAttributeTxCommands() { - testCases := []struct { name string cmd *cobra.Command @@ -1171,7 +1172,7 @@ func (s *IntegrationTestSuite) TestDeleteAccountAttributeTxCommands() { "attribute", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -1188,7 +1189,7 @@ func (s *IntegrationTestSuite) TestDeleteAccountAttributeTxCommands() { "test value", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -1203,7 +1204,7 @@ func (s *IntegrationTestSuite) TestDeleteAccountAttributeTxCommands() { s.account2Addr.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -1218,7 +1219,7 @@ func (s *IntegrationTestSuite) TestDeleteAccountAttributeTxCommands() { s.account2Addr.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -1231,14 +1232,15 @@ func (s *IntegrationTestSuite) TestDeleteAccountAttributeTxCommands() { s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) if tc.expectErr { s.Require().Error(err) } else { 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) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expectedCode), int(txResp.Code)) } }) } @@ -1450,13 +1452,12 @@ func (s *IntegrationTestSuite) TestPaginationWithPageKey() { } func (s *IntegrationTestSuite) TestUpdateAccountAttributeExpirationCmd() { - testCases := []struct { name string cmd *cobra.Command args []string expectErr string - expectedCode int32 + expectedCode uint32 }{ { name: "bind a new attribute name for delete testing", @@ -1467,7 +1468,7 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeExpirationCmd() { "attribute", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -1482,7 +1483,7 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeExpirationCmd() { "test value", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -1497,7 +1498,7 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeExpirationCmd() { "test value", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: `invalid address: must be either an account address or scope metadata address: "not-a-address"`, @@ -1512,7 +1513,7 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeExpirationCmd() { "test value", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: `unable to parse time "test value" required format is RFC3339 (2006-01-02T15:04:05Z07:00): parsing time "test value" as "2006-01-02T15:04:05Z07:00": cannot parse "test value" as "2006"`, @@ -1527,7 +1528,7 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeExpirationCmd() { "2050-01-15T00:00:00Z", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -1541,7 +1542,7 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeExpirationCmd() { "test value", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -1552,14 +1553,15 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeExpirationCmd() { s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) if len(tc.expectErr) > 0 { s.Require().EqualError(err, tc.expectErr) } else { - var response sdk.TxResponse s.Assert().NoError(err) - s.Assert().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response), out.String()) - s.Assert().Equal(tc.expectedCode, int32(response.Code), "") + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Assert().Equal(int(tc.expectedCode), int(txResp.Code)) } }) } diff --git a/x/attribute/client/rest/grpc_query_test.go b/x/attribute/client/rest/grpc_query_test.go index eb3b5e98e8..9e9605d06a 100644 --- a/x/attribute/client/rest/grpc_query_test.go +++ b/x/attribute/client/rest/grpc_query_test.go @@ -4,7 +4,6 @@ import ( "fmt" "testing" - "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/suite" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -15,6 +14,7 @@ import ( grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" "github.com/cosmos/cosmos-sdk/types/query" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/gogoproto/proto" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" @@ -96,7 +96,6 @@ func (s *IntegrationTestSuite) SetupSuite() { cfg.GenesisState = genesisState s.cfg = cfg - // TODO -- the following line needs to be patched because we must register our modules into this test node. s.testnet, err = testnet.New(s.T(), s.T().TempDir(), cfg) s.Require().NoError(err, "creating testnet") From f2971a35a8d0a50a60bc73546c20c350da75ec10 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Thu, 18 Apr 2024 11:57:10 -0600 Subject: [PATCH 09/42] [1760]: Fix the name tests. --- x/name/client/cli/cli_test.go | 83 +++++++++++++++++------------------ 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/x/name/client/cli/cli_test.go b/x/name/client/cli/cli_test.go index fb086b2d6c..bf631ddd20 100644 --- a/x/name/client/cli/cli_test.go +++ b/x/name/client/cli/cli_test.go @@ -8,11 +8,12 @@ import ( "testing" "time" - "github.com/cosmos/gogoproto/proto" "github.com/spf13/cobra" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + sdkmath "cosmossdk.io/math" + cmtcli "github.com/cometbft/cometbft/libs/cli" "github.com/cosmos/cosmos-sdk/client/flags" @@ -21,10 +22,13 @@ import ( testnet "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "github.com/cosmos/gogoproto/proto" "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" + "github.com/provenance-io/provenance/testutil/queries" namecli "github.com/provenance-io/provenance/x/name/client/cli" nametypes "github.com/provenance-io/provenance/x/name/types" ) @@ -61,6 +65,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.T().Log("setting up integration test suite") pioconfig.SetProvenanceConfig("", 0) + govv1.DefaultMinDepositRatio = sdkmath.LegacyZeroDec() cfg := testutil.DefaultTestNetworkConfig() @@ -210,8 +215,6 @@ min_segment_length: 1`, } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := namecli.QueryParamsCmd() clientCtx := s.testnet.Validators[0].ClientCtx @@ -247,8 +250,6 @@ func (s *IntegrationTestSuite) TestResolveNameCommand() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := namecli.ResolveNameCommand() clientCtx := s.testnet.Validators[0].ClientCtx @@ -291,8 +292,6 @@ func (s *IntegrationTestSuite) TestReverseLookupCommand() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := namecli.ReverseLookupCommand() clientCtx := s.testnet.Validators[0].ClientCtx @@ -305,7 +304,6 @@ func (s *IntegrationTestSuite) TestReverseLookupCommand() { } func (s *IntegrationTestSuite) TestGetBindNameCommand() { - testCases := []struct { name string cmd *cobra.Command @@ -320,7 +318,7 @@ func (s *IntegrationTestSuite) TestGetBindNameCommand() { []string{"bindnew", s.testnet.Validators[0].Address.String(), "attribute", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -331,7 +329,7 @@ func (s *IntegrationTestSuite) TestGetBindNameCommand() { []string{"bindnew", s.testnet.Validators[0].Address.String(), "", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 1, @@ -342,7 +340,7 @@ func (s *IntegrationTestSuite) TestGetBindNameCommand() { []string{"bindnew", s.testnet.Validators[0].Address.String(), "dne", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 18, @@ -350,18 +348,18 @@ func (s *IntegrationTestSuite) TestGetBindNameCommand() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) if tc.expectErr { s.Require().Error(err) } else { 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) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "response code") } }) } @@ -382,7 +380,7 @@ func (s *IntegrationTestSuite) TestGetDeleteNameCmd() { []string{"todelete", s.testnet.Validators[0].Address.String(), "attribute", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -393,7 +391,7 @@ func (s *IntegrationTestSuite) TestGetDeleteNameCmd() { []string{"todelete.attribute", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -404,7 +402,7 @@ func (s *IntegrationTestSuite) TestGetDeleteNameCmd() { []string{"dne", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 18, @@ -415,7 +413,7 @@ func (s *IntegrationTestSuite) TestGetDeleteNameCmd() { []string{"example.attribute", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 4, @@ -423,18 +421,18 @@ func (s *IntegrationTestSuite) TestGetDeleteNameCmd() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) if tc.expectErr { s.Require().Error(err) } else { 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) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "response code") } }) } @@ -455,7 +453,7 @@ func (s *IntegrationTestSuite) TestGetModifyNameCmd() { args: []string{"tomodify", s.testnet.Validators[0].Address.String(), "attribute", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, errMsg: "", @@ -469,9 +467,10 @@ func (s *IntegrationTestSuite) TestGetModifyNameCmd() { s.testnet.Validators[0].Address.String(), fmt.Sprintf("--%s", namecli.FlagUnrestricted), fmt.Sprintf("--%s=%s", namecli.FlagGovProposal, "true"), + "--title", "Modify The Name", "--summary", "See Title", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, errMsg: "", @@ -488,7 +487,7 @@ func (s *IntegrationTestSuite) TestGetModifyNameCmd() { fmt.Sprintf("--%s=%s", govcli.FlagDeposit, "invalid"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, errMsg: "invalid deposit: invalid decimal coin expression: invalid", @@ -503,7 +502,7 @@ func (s *IntegrationTestSuite) TestGetModifyNameCmd() { fmt.Sprintf("--%s", namecli.FlagUnrestricted), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, errMsg: "", @@ -518,7 +517,7 @@ func (s *IntegrationTestSuite) TestGetModifyNameCmd() { fmt.Sprintf("--%s", namecli.FlagUnrestricted), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, errMsg: "name cannot be empty", @@ -528,18 +527,18 @@ func (s *IntegrationTestSuite) TestGetModifyNameCmd() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) if len(tc.errMsg) > 0 { s.Assert().EqualError(err, tc.errMsg) } else { s.Assert().NoError(err) - s.Assert().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) - s.Assert().Equal(tc.expectedCode, txResp.Code) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "response code") } }) } @@ -617,7 +616,7 @@ func (s *IntegrationTestSuite) TestCreateRootNameCmd() { fmt.Sprintf("--%s=%s", "owner", s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -631,7 +630,7 @@ func (s *IntegrationTestSuite) TestCreateRootNameCmd() { fmt.Sprintf("--%s=%s", "owner", s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -646,7 +645,7 @@ func (s *IntegrationTestSuite) TestCreateRootNameCmd() { fmt.Sprintf("--%s=%s", "owner", s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 1, @@ -659,7 +658,7 @@ func (s *IntegrationTestSuite) TestCreateRootNameCmd() { fmt.Sprintf("--%s=%s%s", namecli.FlagDeposit, "10", s.cfg.BondDenom), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 1, @@ -672,7 +671,7 @@ func (s *IntegrationTestSuite) TestCreateRootNameCmd() { fmt.Sprintf("--%s=%s%s", namecli.FlagDeposit, "10", s.cfg.BondDenom), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 1, @@ -688,7 +687,7 @@ func (s *IntegrationTestSuite) TestCreateRootNameCmd() { fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 1, @@ -696,20 +695,20 @@ func (s *IntegrationTestSuite) TestCreateRootNameCmd() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx // because the cmd runs inside of the gov cmd (which adds flags) we register here so we can use it directly. flags.AddTxFlagsToCmd(tc.cmd) out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) if tc.expectErr { s.Require().Error(err) } else { 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) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "response code") } }) } From 981c11bd7f8710ece536d869250418410769be09 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Thu, 18 Apr 2024 12:41:52 -0600 Subject: [PATCH 10/42] [1760]: Add the signer option to the oracle Msgs. Remove an error that was added to make things compile, but is no longer needed since the rest of the functionality around it has been restored. --- proto/provenance/oracle/v1/tx.proto | 4 ++ x/oracle/client/cli/cli_test.go | 10 +---- x/oracle/keeper/query_server_test.go | 4 +- x/oracle/keeper/relay.go | 1 - x/oracle/simulation/operations.go | 1 + x/oracle/simulation/operations_test.go | 2 +- x/oracle/types/tx.pb.go | 60 +++++++++++++------------- 7 files changed, 40 insertions(+), 42 deletions(-) diff --git a/proto/provenance/oracle/v1/tx.proto b/proto/provenance/oracle/v1/tx.proto index ff1a03d0f6..38b056a99d 100644 --- a/proto/provenance/oracle/v1/tx.proto +++ b/proto/provenance/oracle/v1/tx.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package provenance.oracle.v1; +import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; @@ -18,6 +19,8 @@ service Msg { // MsgSendQueryOracleRequest queries an oracle on another chain message MsgSendQueryOracleRequest { + option (cosmos.msg.v1.signer) = "authority"; + // Query contains the query data passed to the oracle. bytes query = 1 [(gogoproto.casttype) = "github.com/CosmWasm/wasmd/x/wasm/types.RawContractMessage"]; // Channel is the channel to the oracle. @@ -34,6 +37,7 @@ message MsgSendQueryOracleResponse { // MsgUpdateOracleRequest is the request type for updating an oracle's contract address message MsgUpdateOracleRequest { + option (cosmos.msg.v1.signer) = "authority"; option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = true; diff --git a/x/oracle/client/cli/cli_test.go b/x/oracle/client/cli/cli_test.go index dfccae8739..e1942ff7b1 100644 --- a/x/oracle/client/cli/cli_test.go +++ b/x/oracle/client/cli/cli_test.go @@ -109,9 +109,7 @@ func (s *IntegrationTestSuite) SetupSuite() { } func (s *IntegrationTestSuite) TearDownSuite() { - s.Require().NoError(s.network.WaitForNextBlock(), "WaitForNextBlock") - s.T().Log("tearing down integration test suite") - s.network.Cleanup() + testutil.Cleanup(s.network, s.T()) } func (s *IntegrationTestSuite) GenerateAccountsWithKeyrings(number int) { @@ -188,10 +186,7 @@ func (s *IntegrationTestSuite) TestOracleUpdate() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) args := []string{ @@ -260,10 +255,7 @@ func (s *IntegrationTestSuite) TestSendQuery() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) args := []string{ diff --git a/x/oracle/keeper/query_server_test.go b/x/oracle/keeper/query_server_test.go index 5a528810a9..8de66f348a 100644 --- a/x/oracle/keeper/query_server_test.go +++ b/x/oracle/keeper/query_server_test.go @@ -85,12 +85,12 @@ func (s *KeeperTestSuite) TestOracle() { err: "missing oracle address", }, { - name: "failure - should handle error from contract", + name: "failure - should handle contract not found", req: &types.QueryOracleRequest{ Query: []byte("{}"), }, oracle: "cosmos1w6t0l7z0yerj49ehnqwqaayxqpe3u7e23edgma", - err: "contract: not found", + err: "address cosmos1w6t0l7z0yerj49ehnqwqaayxqpe3u7e23edgma: no such contract", }, { name: "success - should handle response from contract", diff --git a/x/oracle/keeper/relay.go b/x/oracle/keeper/relay.go index b12897fcbf..c745411813 100644 --- a/x/oracle/keeper/relay.go +++ b/x/oracle/keeper/relay.go @@ -123,7 +123,6 @@ func (k Keeper) OnAcknowledgementPacket( k.Logger(ctx).Error("interchain query ack response was unable to emit event", "sequence", modulePacket.Sequence, "error", err) return err } - return cerrs.Wrapf(sdkerrors.ErrNotSupported, "not yet updated") case *channeltypes.Acknowledgement_Error: err := ctx.EventManager().EmitTypedEvent(&types.EventOracleQueryError{ SequenceId: strconv.FormatUint(modulePacket.Sequence, 10), diff --git a/x/oracle/simulation/operations.go b/x/oracle/simulation/operations.go index abc357fa2b..6705d77760 100644 --- a/x/oracle/simulation/operations.go +++ b/x/oracle/simulation/operations.go @@ -65,6 +65,7 @@ func SimulateMsgUpdateOracle(simState module.SimulationState, _ keeper.Keeper, a from := raccs[0] to := raccs[1] + // TODO[1760]: Submit this as a gov prop and also return futures for the votes. msg := types.NewMsgUpdateOracle(from.Address.String(), to.Address.String()) return Dispatch(r, app, ctx, simState, from, chainID, msg, ak, bk, nil) diff --git a/x/oracle/simulation/operations_test.go b/x/oracle/simulation/operations_test.go index 1d8874b2a2..8c44c19e5d 100644 --- a/x/oracle/simulation/operations_test.go +++ b/x/oracle/simulation/operations_test.go @@ -141,7 +141,7 @@ func (s *SimTestSuite) TestSimulateMsgSendQueryOracle() { s.Require().NoError(err, "SimulateMsgSendQueryOracle op(...) error") s.LogOperationMsg(operationMsg, "good") - var msg types.MsgUpdateOracleRequest + var msg types.MsgSendQueryOracleRequest s.Require().NoError(s.app.AppCodec().Unmarshal(operationMsg.Msg, &msg), "UnmarshalJSON(operationMsg.Msg)") s.Assert().True(operationMsg.OK, "operationMsg.OK") diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go index c835944cb1..2205e735ab 100644 --- a/x/oracle/types/tx.pb.go +++ b/x/oracle/types/tx.pb.go @@ -8,6 +8,7 @@ import ( fmt "fmt" github_com_CosmWasm_wasmd_x_wasm_types "github.com/CosmWasm/wasmd/x/wasm/types" _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -242,35 +243,36 @@ func init() { func init() { proto.RegisterFile("provenance/oracle/v1/tx.proto", fileDescriptor_66a39dda41c6a784) } var fileDescriptor_66a39dda41c6a784 = []byte{ - // 443 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x41, 0x6f, 0xd3, 0x30, - 0x14, 0xc7, 0x6b, 0x36, 0xd8, 0x66, 0x4d, 0x42, 0xb2, 0x2a, 0x96, 0x46, 0x22, 0x9d, 0x72, 0xda, - 0x81, 0xc6, 0xac, 0x48, 0x08, 0x90, 0x38, 0xd0, 0x9d, 0x23, 0x20, 0x15, 0x42, 0xe2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73, 0xe6, 0x4a, 0xd2, 0x49, 0xd5, - 0x5a, 0x44, 0x47, 0xcb, 0x5d, 0xaa, 0x5c, 0x7a, 0x7e, 0xab, 0xda, 0x82, 0x07, 0xbf, 0x02, 0x00, - 0x00, 0xff, 0xff, 0x49, 0x33, 0xee, 0xe2, 0x6d, 0x03, 0x00, 0x00, + // 463 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xce, 0xd1, 0x42, 0xe9, 0xa9, 0x02, 0xe9, 0x14, 0x35, 0x8e, 0x25, 0x9c, 0x2a, 0x53, 0x85, + 0x88, 0x8f, 0x06, 0x09, 0x01, 0x12, 0x03, 0xe9, 0x1c, 0x01, 0x8e, 0x10, 0x12, 0x0b, 0xba, 0xda, + 0xa7, 0x8b, 0x45, 0x7d, 0xe7, 0xde, 0x3b, 0xa7, 0xc9, 0xca, 0x2f, 0x60, 0x64, 0x60, 0xe8, 0x4f, + 0x60, 0xe0, 0x47, 0x30, 0x56, 0x9d, 0x98, 0x10, 0x4a, 0x06, 0xfa, 0x1b, 0x98, 0x90, 0x7d, 0x09, + 0x4e, 0x83, 0x41, 0x99, 0xec, 0xef, 0x7d, 0xdf, 0xbd, 0x7b, 0xdf, 0xd3, 0x77, 0xf8, 0x4e, 0xaa, + 0xd5, 0x88, 0x4b, 0x26, 0x43, 0x4e, 0x95, 0x66, 0xe1, 0x31, 0xa7, 0xa3, 0x03, 0x6a, 0xc6, 0x7e, + 0xaa, 0x95, 0x51, 0xa4, 0x5e, 0xd2, 0xbe, 0xa5, 0xfd, 0xd1, 0x81, 0xdb, 0x08, 0x15, 0x24, 0x0a, + 0x68, 0x02, 0x22, 0x57, 0x27, 0x20, 0xac, 0xdc, 0x6d, 0x5a, 0xe2, 0x6d, 0x81, 0xa8, 0x05, 0x73, + 0xaa, 0x2e, 0x94, 0x50, 0x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 0x38, 0xf5, 0xbf, 0xd1, 0x16, 0xc2, 0xab, 0x86, + 0xae, 0xad, 0x6f, 0x68, 0xf7, 0xe3, 0x59, 0x0b, 0x5d, 0x9e, 0xb5, 0xd0, 0x8a, 0xb1, 0x26, 0x6e, + 0xfc, 0x35, 0x9d, 0x75, 0xd5, 0xbd, 0x44, 0x78, 0xa3, 0x0f, 0x82, 0xbc, 0xc3, 0x3b, 0xcb, 0x3c, + 0xb9, 0xe7, 0x57, 0x25, 0xc8, 0xaf, 0x36, 0xe9, 0x76, 0xd6, 0x54, 0xcf, 0x57, 0x69, 0xf0, 0xed, + 0x95, 0x2d, 0x13, 0xfa, 0xcf, 0x0e, 0xd5, 0x19, 0x73, 0xef, 0xaf, 0x7f, 0xc0, 0xde, 0xda, 0x13, + 0x5f, 0xa7, 0x1e, 0x3a, 0x9f, 0x7a, 0xe8, 0xc7, 0xd4, 0x43, 0x1f, 0x66, 0x5e, 0xed, 0x7c, 0xe6, + 0xd5, 0xbe, 0xcd, 0xbc, 0x1a, 0x6e, 0xc4, 0xaa, 0xb2, 0xdb, 0x0b, 0xf4, 0xa6, 0xbb, 0x94, 0xdb, + 0x52, 0xd2, 0x89, 0xd5, 0x12, 0xa2, 0xe3, 0xc5, 0x13, 0x2c, 0x32, 0x7c, 0x74, 0xa3, 0x78, 0x23, + 0x0f, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0xb6, 0xe9, 0x52, 0x45, 0xa4, 0x03, 0x00, 0x00, } func (this *MsgUpdateOracleRequest) Equal(that interface{}) bool { From 82486f669cc4a8cf90bbff2cbf5faccdf2ae746b Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Thu, 18 Apr 2024 12:57:15 -0600 Subject: [PATCH 11/42] [1760]: Rename the testutil.Cleanup function (was CleanUp, which I kept getting wrong). Switch all uses of WaitForHeight to the testutil one. --- cmd/provenanced/cmd/simulate_test.go | 4 ++-- testutil/network.go | 18 +++++++++++------- x/attribute/client/cli/cli_test.go | 4 ++-- x/attribute/client/rest/grpc_query_test.go | 4 ++-- x/exchange/client/cli/cli_test.go | 4 ++-- x/hold/client/cli/cli_test.go | 4 ++-- x/ibcratelimit/client/cli/cli_test.go | 6 ++---- x/marker/client/cli/cli_test.go | 6 +++--- x/metadata/client/cli/cli_page_test.go | 4 ++-- x/metadata/client/cli/cli_test.go | 4 ++-- x/metadata/client/rest/grpc_query_test.go | 6 +++--- x/msgfees/client/cli/cli_test.go | 4 ++-- x/name/client/cli/cli_test.go | 4 ++-- x/oracle/client/cli/cli_test.go | 2 +- x/quarantine/client/testutil/common_test.go | 3 +-- x/sanction/client/testutil/common_test.go | 4 +--- x/trigger/client/cli/cli_test.go | 6 ++---- 17 files changed, 42 insertions(+), 45 deletions(-) diff --git a/cmd/provenanced/cmd/simulate_test.go b/cmd/provenanced/cmd/simulate_test.go index 366d485df3..9f09c5df56 100644 --- a/cmd/provenanced/cmd/simulate_test.go +++ b/cmd/provenanced/cmd/simulate_test.go @@ -79,12 +79,12 @@ func (s *SimulateTestSuite) SetupTest() { s.testnet, err = testnet.New(s.T(), s.T().TempDir(), cfg) s.Require().NoError(err, "creating testnet") - _, err = s.testnet.WaitForHeight(1) + _, err = testutil.WaitForHeight(s.testnet, 1) s.Require().NoError(err, "waiting for height 1") } func (s *SimulateTestSuite) TearDownTest() { - testutil.CleanUp(s.testnet, s.T()) + testutil.Cleanup(s.testnet, s.T()) } func TestSimulateTestSuite(t *testing.T) { diff --git a/testutil/network.go b/testutil/network.go index 7a3702d168..cf30549432 100644 --- a/testutil/network.go +++ b/testutil/network.go @@ -80,19 +80,23 @@ func DefaultTestNetworkConfig() testnet.Config { } } -func CleanUp(n *testnet.Network, t *testing.T) { +// Cleanup runs the standard cleanup for our test networks. +func Cleanup(n *testnet.Network, t *testing.T) { + t.Log("Cleanup: Tearing down test network") if n == nil { - t.Log("nothing to tear down") + t.Log("Cleanup: Nothing to tear down. Done.") return } - t.Log("teardown waiting for next block") - //nolint:errcheck // The test shouldn't fail because cleanup was a problem. So ignoring any error from this. - WaitForNextBlock(n) - t.Log("teardown cleaning up testnet") + t.Log("Cleanup: Waiting for next block.") + err := WaitForNextBlock(n) + if err != nil { + t.Logf("Cleanup: Error (ignored) waiting for next block: %v", err) + } + t.Log("Cleanup: Cleaning up testnet.") n.Cleanup() // Give things a chance to finish closing up. Hopefully will prevent things like address collisions. 100ms chosen randomly. time.Sleep(100 * time.Millisecond) - t.Log("teardown done") + t.Log("Cleanup: done") } // queryCurrentHeight executes a query to get the current height in a separate process. diff --git a/x/attribute/client/cli/cli_test.go b/x/attribute/client/cli/cli_test.go index dfbe259209..e38d3946c0 100644 --- a/x/attribute/client/cli/cli_test.go +++ b/x/attribute/client/cli/cli_test.go @@ -235,12 +235,12 @@ func (s *IntegrationTestSuite) SetupSuite() { s.testnet, err = testnet.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "creating testnet") - _, err = s.testnet.WaitForHeight(1) + _, err = testutil.WaitForHeight(s.testnet, 1) s.Require().NoError(err, "waiting for height 1") } func (s *IntegrationTestSuite) TearDownSuite() { - testutil.CleanUp(s.testnet, s.T()) + testutil.Cleanup(s.testnet, s.T()) } // toWritten converts an integer to a written string version. diff --git a/x/attribute/client/rest/grpc_query_test.go b/x/attribute/client/rest/grpc_query_test.go index 9e9605d06a..a694cfa18f 100644 --- a/x/attribute/client/rest/grpc_query_test.go +++ b/x/attribute/client/rest/grpc_query_test.go @@ -99,12 +99,12 @@ func (s *IntegrationTestSuite) SetupSuite() { s.testnet, err = testnet.New(s.T(), s.T().TempDir(), cfg) s.Require().NoError(err, "creating testnet") - _, err = s.testnet.WaitForHeight(1) + _, err = testutil.WaitForHeight(s.testnet, 1) s.Require().NoError(err, "waiting for height 1") } func (s *IntegrationTestSuite) TearDownSuite() { - testutil.CleanUp(s.testnet, s.T()) + testutil.Cleanup(s.testnet, s.T()) } func (s *IntegrationTestSuite) TestGRPCQueries() { diff --git a/x/exchange/client/cli/cli_test.go b/x/exchange/client/cli/cli_test.go index f4a189bb04..dea564520e 100644 --- a/x/exchange/client/cli/cli_test.go +++ b/x/exchange/client/cli/cli_test.go @@ -360,12 +360,12 @@ func (s *CmdTestSuite) SetupSuite() { s.testnet, err = testnet.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "testnet.New(...)") - _, err = s.testnet.WaitForHeight(1) + _, err = testutil.WaitForHeight(s.testnet, 1) s.Require().NoError(err, "s.testnet.WaitForHeight(1)") } func (s *CmdTestSuite) TearDownSuite() { - testutil.CleanUp(s.testnet, s.T()) + testutil.Cleanup(s.testnet, s.T()) } // generateAccountsWithKeyring creates a keyring and adds a number of keys to it. diff --git a/x/hold/client/cli/cli_test.go b/x/hold/client/cli/cli_test.go index f6fdd85566..c50107220a 100644 --- a/x/hold/client/cli/cli_test.go +++ b/x/hold/client/cli/cli_test.go @@ -214,12 +214,12 @@ func (s *IntegrationCLITestSuite) SetupSuite() { s.testnet, err = testnet.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "creating testnet") - _, err = s.testnet.WaitForHeight(1) + _, err = testutil.WaitForHeight(s.testnet, 1) s.Require().NoError(err, "waiting for height 1") } func (s *IntegrationCLITestSuite) TearDownSuite() { - testutil.CleanUp(s.testnet, s.T()) + testutil.Cleanup(s.testnet, s.T()) } // queryCmdTestCase is a test case struct that provides common functionality in these tests. diff --git a/x/ibcratelimit/client/cli/cli_test.go b/x/ibcratelimit/client/cli/cli_test.go index 084d0c035c..178ff861ea 100644 --- a/x/ibcratelimit/client/cli/cli_test.go +++ b/x/ibcratelimit/client/cli/cli_test.go @@ -97,14 +97,12 @@ func (s *TestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "network.New") - _, err = s.network.WaitForHeight(6) + _, err = testutil.WaitForHeight(s.network, 6) s.Require().NoError(err, "WaitForHeight") } func (s *TestSuite) TearDownSuite() { - s.Require().NoError(s.network.WaitForNextBlock(), "WaitForNextBlock") - s.T().Log("tearing down integration test suite") - s.network.Cleanup() + testutil.Cleanup(s.network, s.T()) } func (s *TestSuite) GenerateAccountsWithKeyrings(number int) { diff --git a/x/marker/client/cli/cli_test.go b/x/marker/client/cli/cli_test.go index 042ab3ff3f..7f886f0670 100644 --- a/x/marker/client/cli/cli_test.go +++ b/x/marker/client/cli/cli_test.go @@ -10,7 +10,6 @@ import ( "testing" "time" - "github.com/cosmos/gogoproto/proto" "github.com/spf13/cobra" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -30,6 +29,7 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" + "github.com/cosmos/gogoproto/proto" "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" @@ -301,12 +301,12 @@ func (s *IntegrationTestSuite) SetupSuite() { s.testnet, err = testnet.New(s.T(), s.T().TempDir(), cfg) s.Require().NoError(err, "creating testnet") - _, err = s.testnet.WaitForHeight(1) + _, err = testutil.WaitForHeight(s.testnet, 1) s.Require().NoError(err, "waiting for height 1") } func (s *IntegrationTestSuite) TearDownSuite() { - testutil.CleanUp(s.testnet, s.T()) + testutil.Cleanup(s.testnet, s.T()) } // toWritten converts an integer to a written string version. diff --git a/x/metadata/client/cli/cli_page_test.go b/x/metadata/client/cli/cli_page_test.go index c225ba41be..66070aa967 100644 --- a/x/metadata/client/cli/cli_page_test.go +++ b/x/metadata/client/cli/cli_page_test.go @@ -307,14 +307,14 @@ func (s *IntegrationCLIPageTestSuite) SetupSuite() { s.testnet, err = testnet.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "creating testnet") - _, err = s.testnet.WaitForHeight(1) + _, err = testutil.WaitForHeight(s.testnet, 1) s.Require().NoError(err, "calling s.testnet.WaitForHeight(1)") s.Require().NoError(s.testnet.Validators[0].ClientCtx.Keyring.ImportPrivKey(s.accountAddr.String(), crypto.EncryptArmorPrivKey(s.accountKey, "pasSword0", "secp256k1"), "pasSword0"), "adding s.accountKey to keyring") s.T().Log("done setting up integration test suite") } func (s *IntegrationCLIPageTestSuite) TearDownSuite() { - testutil.CleanUp(s.testnet, s.T()) + testutil.Cleanup(s.testnet, s.T()) } var titleCaser = cases.Title(language.English) diff --git a/x/metadata/client/cli/cli_test.go b/x/metadata/client/cli/cli_test.go index d232ab6b1b..5900354eb6 100644 --- a/x/metadata/client/cli/cli_test.go +++ b/x/metadata/client/cli/cli_test.go @@ -494,12 +494,12 @@ owner: %s`, s.testnet, err = testnet.New(s.T(), s.T().TempDir(), cfg) s.Require().NoError(err, "creating testnet") - _, err = s.testnet.WaitForHeight(1) + _, err = testutil.WaitForHeight(s.testnet, 1) s.Require().NoError(err, "waiting for height 1") } func (s *IntegrationCLITestSuite) TearDownSuite() { - testutil.CleanUp(s.testnet, s.T()) + testutil.Cleanup(s.testnet, s.T()) } func (s *IntegrationCLITestSuite) generateAccountsWithKeyrings(number int) { diff --git a/x/metadata/client/rest/grpc_query_test.go b/x/metadata/client/rest/grpc_query_test.go index b1af709aa0..8e6963ea87 100644 --- a/x/metadata/client/rest/grpc_query_test.go +++ b/x/metadata/client/rest/grpc_query_test.go @@ -5,7 +5,6 @@ import ( "fmt" "testing" - "github.com/cosmos/gogoproto/proto" "github.com/google/uuid" "github.com/stretchr/testify/suite" @@ -18,6 +17,7 @@ import ( grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" "github.com/cosmos/cosmos-sdk/types/query" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/gogoproto/proto" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" @@ -135,12 +135,12 @@ func (s *IntegrationGRPCTestSuite) SetupSuite() { s.testnet, err = testnet.New(s.T(), s.T().TempDir(), cfg) s.Require().NoError(err, "creating testnet") - _, err = s.testnet.WaitForHeight(1) + _, err = testutil.WaitForHeight(s.testnet, 1) s.Require().NoError(err, "waiting for height 1") } func (s *IntegrationGRPCTestSuite) TearDownSuite() { - testutil.CleanUp(s.testnet, s.T()) + testutil.Cleanup(s.testnet, s.T()) } func TestIntegrationGRPCTestSuite(t *testing.T) { diff --git a/x/msgfees/client/cli/cli_test.go b/x/msgfees/client/cli/cli_test.go index 4d88677f52..700203b827 100644 --- a/x/msgfees/client/cli/cli_test.go +++ b/x/msgfees/client/cli/cli_test.go @@ -63,12 +63,12 @@ func (s *IntegrationTestSuite) SetupSuite() { s.testnet, err = testnet.New(s.T(), s.T().TempDir(), cfg) s.Require().NoError(err, "creating testnet") - _, err = s.testnet.WaitForHeight(1) + _, err = testutil.WaitForHeight(s.testnet, 1) s.Require().NoError(err, "waiting for height 1") } func (s *IntegrationTestSuite) TearDownSuite() { - testutil.CleanUp(s.testnet, s.T()) + testutil.Cleanup(s.testnet, s.T()) } func (s *IntegrationTestSuite) TestMsgFeesTxGovProposals() { diff --git a/x/name/client/cli/cli_test.go b/x/name/client/cli/cli_test.go index bf631ddd20..fcf6d606b9 100644 --- a/x/name/client/cli/cli_test.go +++ b/x/name/client/cli/cli_test.go @@ -95,12 +95,12 @@ func (s *IntegrationTestSuite) SetupSuite() { s.testnet, err = testnet.New(s.T(), s.T().TempDir(), cfg) s.Require().NoError(err, "creating testnet") - _, err = s.testnet.WaitForHeight(1) + _, err = testutil.WaitForHeight(s.testnet, 1) s.Require().NoError(err, "waiting for height 1") } func (s *IntegrationTestSuite) TearDownSuite() { - testutil.CleanUp(s.testnet, s.T()) + testutil.Cleanup(s.testnet, s.T()) } // toWritten converts an integer to a written string version. diff --git a/x/oracle/client/cli/cli_test.go b/x/oracle/client/cli/cli_test.go index e1942ff7b1..7619da323f 100644 --- a/x/oracle/client/cli/cli_test.go +++ b/x/oracle/client/cli/cli_test.go @@ -104,7 +104,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "network.New") - _, err = s.network.WaitForHeight(6) + _, err = testutil.WaitForHeight(s.network, 6) s.Require().NoError(err, "WaitForHeight") } diff --git a/x/quarantine/client/testutil/common_test.go b/x/quarantine/client/testutil/common_test.go index 9886dab84b..e6a1f5ead7 100644 --- a/x/quarantine/client/testutil/common_test.go +++ b/x/quarantine/client/testutil/common_test.go @@ -63,8 +63,7 @@ func (s *IntegrationTestSuite) SetupSuite() { } func (s *IntegrationTestSuite) TearDownSuite() { - s.T().Log("tearing down integration test suite") - testutil.CleanUp(s.network, s.T()) + testutil.Cleanup(s.network, s.T()) } func (s *IntegrationTestSuite) stopIfFailed() { diff --git a/x/sanction/client/testutil/common_test.go b/x/sanction/client/testutil/common_test.go index d8ddff8926..e0fb1eab07 100644 --- a/x/sanction/client/testutil/common_test.go +++ b/x/sanction/client/testutil/common_test.go @@ -55,12 +55,10 @@ func (s *IntegrationTestSuite) SetupSuite() { fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, s.bondCoins(10).String()), } - } func (s *IntegrationTestSuite) TearDownSuite() { - s.T().Log("tearing down integration test suite") - testutil.CleanUp(s.network, s.T()) + testutil.Cleanup(s.network, s.T()) } // assertErrorContents calls AssertErrorContents using this suite's t. diff --git a/x/trigger/client/cli/cli_test.go b/x/trigger/client/cli/cli_test.go index 0aae18df7a..48c6bfab77 100644 --- a/x/trigger/client/cli/cli_test.go +++ b/x/trigger/client/cli/cli_test.go @@ -166,14 +166,12 @@ func (s *IntegrationTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "network.New") - _, err = s.network.WaitForHeight(6) + _, err = testutil.WaitForHeight(s.network, 6) s.Require().NoError(err, "WaitForHeight") } func (s *IntegrationTestSuite) TearDownSuite() { - s.Require().NoError(s.network.WaitForNextBlock(), "WaitForNextBlock") - s.T().Log("tearing down integration test suite") - s.network.Cleanup() + testutil.Cleanup(s.network, s.T()) } func (s *IntegrationTestSuite) GenerateAccountsWithKeyrings(number int) { From 63564de51e9f6972cbbefe9a3eb8179f09c66a7e Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Thu, 18 Apr 2024 13:47:41 -0600 Subject: [PATCH 12/42] [1760]: Fix the oracle cli tests. Make queries.GetTxFromResponse return the one provided if the one provided doesn't have code 0. --- testutil/queries/auth.go | 27 +++++++------- x/oracle/client/cli/cli_test.go | 62 +++++++++++++++++---------------- 2 files changed, 47 insertions(+), 42 deletions(-) diff --git a/testutil/queries/auth.go b/testutil/queries/auth.go index 0b441eeee1..6dc99d8f4d 100644 --- a/testutil/queries/auth.go +++ b/testutil/queries/auth.go @@ -53,13 +53,13 @@ func AssertGetModuleAccountByName(t *testing.T, n *network.Network, moduleName s return rv, true } -// GetTxFromResponse extracts a tx hash from the provided txRespBz and executes a query for it, -// requiring everything to be okay. Since the SDK got rid of block broadcast, we now need to query -// for a tx after submitting it in order to find out what happened. +// GetTxFromResponse gets the TxResponse from the provided ExecTestCLICmd output bytes. +// If the provided output indicates a code other than 0, that is what is returned. +// If the provided output has a code of 0, the tx hash is extracted from it, and queries +// are executed to get the TxResponse for it. Three attempts are made to query for the tx, +// waiting a block between each attempt. // -// The provided txRespBz should be the bytes returned from submitting a Tx. -// -// In most cases, you'll have to wait for the next block after submitting your tx, and before calling this. +// This requires that there are no problems getting the TxResponse. func GetTxFromResponse(t *testing.T, n *network.Network, txRespBz []byte) sdk.TxResponse { t.Helper() rv, ok := AssertGetTxFromResponse(t, n, txRespBz) @@ -69,13 +69,13 @@ func GetTxFromResponse(t *testing.T, n *network.Network, txRespBz []byte) sdk.Tx return rv } -// AssertGetTxFromResponse extracts a tx hash from the provided txRespBz and executes a query for it, -// asserting that everything is okay. Since the SDK got rid of block broadcast, we now need to query -// for a tx after submitting it in order to find out what happened. -// -// The provided txRespBz should be the bytes returned from submitting a Tx. +// AssertGetTxFromResponse gets the TxResponse from the provided ExecTestCLICmd output bytes. +// If the provided output indicates a code other than 0, that is what is returned. +// If the provided output has a code of 0, the tx hash is extracted from it, and queries +// are executed to get the TxResponse for it. Three attempts are made to query for the tx, +// waiting a block between each attempt. // -// In most cases, you'll have to wait for the next block after submitting your tx, and before calling this. +// This asserts that there are no problems getting the TxResponse, returning true if no assertions failed. func AssertGetTxFromResponse(t *testing.T, n *network.Network, txRespBz []byte) (sdk.TxResponse, bool) { t.Helper() if !assert.NotEmpty(t, n.Validators, "Network.Validators") { @@ -88,6 +88,9 @@ func AssertGetTxFromResponse(t *testing.T, n *network.Network, txRespBz []byte) if !assert.NoError(t, err, "UnmarshalJSON(%q, %T) (original tx response)", string(txRespBz), &origResp) { return sdk.TxResponse{}, false } + if origResp.Code != 0 { + return origResp, true + } if !assert.NotEmpty(t, origResp.TxHash, "the tx hash") { return sdk.TxResponse{}, false } diff --git a/x/oracle/client/cli/cli_test.go b/x/oracle/client/cli/cli_test.go index 7619da323f..849c65c4f7 100644 --- a/x/oracle/client/cli/cli_test.go +++ b/x/oracle/client/cli/cli_test.go @@ -4,8 +4,12 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/suite" + cmtcli "github.com/cometbft/cometbft/libs/cli" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -15,12 +19,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - "github.com/stretchr/testify/suite" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" + "github.com/provenance-io/provenance/testutil/queries" oraclecli "github.com/provenance-io/provenance/x/oracle/client/cli" "github.com/provenance-io/provenance/x/oracle/types" oracletypes "github.com/provenance-io/provenance/x/oracle/types" @@ -49,6 +53,7 @@ func TestIntegrationTestSuite(t *testing.T) { func (s *IntegrationTestSuite) SetupSuite() { s.T().Log("setting up integration test suite") pioconfig.SetProvenanceConfig("", 0) + govv1.DefaultMinDepositRatio = sdkmath.LegacyZeroDec() s.accountKey = secp256k1.GenPrivKeyFromSecret([]byte("acc2")) addr, err := sdk.AccAddressFromHexUnsafe(s.accountKey.PubKey().Address().String()) s.Require().NoError(err) @@ -180,7 +185,8 @@ func (s *IntegrationTestSuite) TestOracleUpdate() { { name: "failure - unable to pass validate basic with bad address", address: "badaddress", - expectErrMsg: "msg: 0, err: invalid address for oracle: decoding bech32 failed: invalid separator index -1: invalid proposal message", + expectErrMsg: "invalid address for oracle: decoding bech32 failed: invalid separator index -1: invalid proposal message", + expectedCode: 12, signer: s.accountAddresses[0].String(), }, } @@ -189,28 +195,25 @@ func (s *IntegrationTestSuite) TestOracleUpdate() { s.Run(tc.name, func() { clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) + cmd := oraclecli.GetCmdOracleUpdate() args := []string{ tc.address, - } - flagArgs := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, tc.signer), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), + "--title", "Update the oracle", "--summary", "Update it real good", + fmt.Sprintf("--%s=json", cmtcli.OutputFlag), } - args = append(args, flagArgs...) - out, err := clitestutil.ExecTestCLICmd(clientCtx, oraclecli.GetCmdOracleUpdate(), append(args, []string{fmt.Sprintf("--%s=json", cmtcli.OutputFlag)}...)) - var response sdk.TxResponse - marshalErr := clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) - if len(tc.expectErrMsg) > 0 { - s.Assert().EqualError(err, tc.expectErrMsg, "should have correct error for invalid OracleUpdate request") - s.Assert().Equal(tc.expectedCode, response.Code, "should have correct response code for invalid OracleUpdate request") - } else { - s.Assert().NoError(err, "should have no error for valid OracleUpdate request") - s.Assert().NoError(marshalErr, out.String(), "should have no marshal error for valid OracleUpdate request") - s.Assert().Equal(tc.expectedCode, response.Code, "should have correct response code for valid OracleUpdate request") - } + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) + s.Assert().NoError(err, "should have no error for valid OracleUpdate request") + + txResp := queries.GetTxFromResponse(s.T(), s.network, outBz) + s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "should have correct response code for valid OracleUpdate request") + s.Assert().Contains(txResp.RawLog, tc.expectErrMsg, "should have correct error for invalid OracleUpdate request") }) } } @@ -248,7 +251,7 @@ func (s *IntegrationTestSuite) TestSendQuery() { { name: "failure - invalid signer", query: "{}", - expectErrMsg: "abc.info: key not found", + expectErrMsg: "failed to convert address field to address: abc.info: key not found", channel: "channel-1", signer: "abc", }, @@ -258,28 +261,27 @@ func (s *IntegrationTestSuite) TestSendQuery() { s.Run(tc.name, func() { clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) + cmd := oraclecli.GetCmdSendQuery() args := []string{ tc.channel, tc.query, - } - flagArgs := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, tc.signer), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), + fmt.Sprintf("--%s=json", cmtcli.OutputFlag), } - args = append(args, flagArgs...) - out, err := clitestutil.ExecTestCLICmd(clientCtx, oraclecli.GetCmdSendQuery(), append(args, []string{fmt.Sprintf("--%s=json", cmtcli.OutputFlag)}...)) - var response sdk.TxResponse - marshalErr := clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) + if len(tc.expectErrMsg) > 0 { - s.Assert().EqualError(err, tc.expectErrMsg, "should have correct error for invalid SendQuery request") - s.Assert().Equal(tc.expectedCode, response.Code, "should have correct response code for invalid SendQuery request") + s.Assert().ErrorContains(err, tc.expectErrMsg, "should have correct error for invalid SendQuery request") } else { s.Assert().NoError(err, "should have no error for valid SendQuery request") - s.Assert().NoError(marshalErr, out.String(), "should have no marshal error for valid SendQuery request") - s.Assert().Equal(tc.expectedCode, response.Code, "should have correct response code for valid SendQuery request") + txResp := queries.GetTxFromResponse(s.T(), s.network, outBz) + s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "should have correct response code for valid SendQuery request") } }) } From 29351333bf3d1b8a34186088f6b99709320b7118 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Thu, 18 Apr 2024 14:32:24 -0600 Subject: [PATCH 13/42] [1760]: Delete a couple unneeded files. --- app/params/doc.go | 19 ------------------- app/params/params.go | 7 ------- 2 files changed, 26 deletions(-) delete mode 100644 app/params/doc.go delete mode 100644 app/params/params.go diff --git a/app/params/doc.go b/app/params/doc.go deleted file mode 100644 index 1c721342a9..0000000000 --- a/app/params/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Package params defines the simulation parameters in the simapp. - -It contains the default weights used for each transaction used on the module's -simulation. These weights define the chance for a transaction to be simulated at -any gived operation. - -You can repace the default values for the weights by providing a params.json -file with the weights defined for each of the transaction operations: - - { - "op_weight_msg_send": 60, - "op_weight_msg_delegate": 100, - } - -In the example above, the `MsgSend` has 60% chance to be simulated, while the -`MsgDelegate` will always be simulated. -*/ -package params diff --git a/app/params/params.go b/app/params/params.go deleted file mode 100644 index b6aa5fb55e..0000000000 --- a/app/params/params.go +++ /dev/null @@ -1,7 +0,0 @@ -package params - -// Simulation parameter constants -const ( - StakePerAccount = "stake_per_account" - InitiallyBondedValidators = "initially_bonded_validators" -) From 8e806f1cf2ed5aba003f66a402f0799dd0ff2e22 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Thu, 18 Apr 2024 15:46:17 -0600 Subject: [PATCH 14/42] [1760]: Create a global encoding config variable that is set in app.New so that some trigger validate basic things can get the signers of messages. Fix the trigger unit tests. --- app/app.go | 1 + app/params/encoding.go | 4 + testutil/network.go | 2 +- x/trigger/client/cli/cli_test.go | 107 +++++++++++------------- x/trigger/simulation/operations_test.go | 2 +- x/trigger/types/msgs.go | 23 +++-- x/trigger/types/msgs_test.go | 10 ++- 7 files changed, 80 insertions(+), 69 deletions(-) diff --git a/app/app.go b/app/app.go index e1f9076ede..a7e3f4cda1 100644 --- a/app/app.go +++ b/app/app.go @@ -1123,6 +1123,7 @@ func New( app.ScopedICQKeeper = scopedICQKeeper app.ScopedICAHostKeeper = scopedICAHostKeeper + simappparams.AppEncodingConfig = app.GetEncodingConfig() return app } diff --git a/app/params/encoding.go b/app/params/encoding.go index 3d634abf16..f7979af799 100644 --- a/app/params/encoding.go +++ b/app/params/encoding.go @@ -14,3 +14,7 @@ type EncodingConfig struct { TxConfig client.TxConfig Amino *codec.LegacyAmino } + +// AppEncodingConfig is a global encoding config made available for areas where we don't otherwise have access to it. +// It's set (and updated) during app.New. +var AppEncodingConfig EncodingConfig diff --git a/testutil/network.go b/testutil/network.go index cf30549432..4ec19fd015 100644 --- a/testutil/network.go +++ b/testutil/network.go @@ -96,7 +96,7 @@ func Cleanup(n *testnet.Network, t *testing.T) { n.Cleanup() // Give things a chance to finish closing up. Hopefully will prevent things like address collisions. 100ms chosen randomly. time.Sleep(100 * time.Millisecond) - t.Log("Cleanup: done") + t.Log("Cleanup: Done.") } // queryCurrentHeight executes a query to get the current height in a separate process. diff --git a/x/trigger/client/cli/cli_test.go b/x/trigger/client/cli/cli_test.go index 48c6bfab77..d2d3cb3d1d 100644 --- a/x/trigger/client/cli/cli_test.go +++ b/x/trigger/client/cli/cli_test.go @@ -5,6 +5,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + cmtcli "github.com/cometbft/cometbft/libs/cli" "github.com/cosmos/cosmos-sdk/client/flags" @@ -19,13 +21,12 @@ import ( sdktx "github.com/cosmos/cosmos-sdk/types/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - triggercli "github.com/provenance-io/provenance/x/trigger/client/cli" - - "github.com/stretchr/testify/suite" "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" + "github.com/provenance-io/provenance/testutil/queries" + triggercli "github.com/provenance-io/provenance/x/trigger/client/cli" "github.com/provenance-io/provenance/x/trigger/types" triggertypes "github.com/provenance-io/provenance/x/trigger/types" ) @@ -264,23 +265,26 @@ func (s *IntegrationTestSuite) TestQueryTriggers() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { clientCtx := s.network.Validators[0].ClientCtx - out, err := clitestutil.ExecTestCLICmd(clientCtx, triggercli.GetTriggersCmd(), append(tc.args, []string{fmt.Sprintf("--%s=json", cmtcli.OutputFlag)}...)) + cmd := triggercli.GetTriggersCmd() + tc.args = append(tc.args, fmt.Sprintf("--%s=json", cmtcli.OutputFlag)) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), tc.args, string(outBz)) + if len(tc.expectErrMsg) > 0 { s.EqualError(err, tc.expectErrMsg, "should have correct error message for invalid QueryTriggers") } else if tc.byId { var response types.QueryTriggerByIDResponse s.NoError(err, "should have no error message for valid QueryTriggerByID") - err = s.cfg.Codec.UnmarshalJSON(out.Bytes(), &response) + err = s.cfg.Codec.UnmarshalJSON(outBz, &response) s.NoError(err, "should have no error message when unmarshalling response to QueryTriggerByID") - s.Equal(int(tc.expectedIds[0]), int(response.Trigger.Id), "should return correct trigger for QueryTriggerByID") + s.Equal(tc.expectedIds[0], int(response.Trigger.Id), "should return correct trigger for QueryTriggerByID") } else { var response types.QueryTriggersResponse s.NoError(err, "should have no error message for valid QueryTriggers") - err = s.cfg.Codec.UnmarshalJSON(out.Bytes(), &response) + err = s.cfg.Codec.UnmarshalJSON(outBz, &response) s.NoError(err, "should have no error message when unmarshalling response to QueryTriggers") var triggerIDs []int for _, rp := range response.Triggers { @@ -382,8 +386,6 @@ func (s *IntegrationTestSuite) TestAddBlockHeightTrigger() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) @@ -407,28 +409,27 @@ func (s *IntegrationTestSuite) TestAddBlockHeightTrigger() { messageFile := sdktestutil.WriteToNewTempFile(s.T(), message) + cmd := triggercli.GetCmdAddBlockHeightTrigger() args := []string{ tc.height, messageFile.Name(), - } - flagArgs := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddresses[0].String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), + fmt.Sprintf("--%s=json", cmtcli.OutputFlag), } - args = append(args, flagArgs...) - out, err := clitestutil.ExecTestCLICmd(clientCtx, triggercli.GetCmdAddBlockHeightTrigger(), append(args, []string{fmt.Sprintf("--%s=json", cmtcli.OutputFlag)}...)) - var response sdk.TxResponse - marshalErr := clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) + if len(tc.expectErrMsg) > 0 { s.Assert().EqualError(err, tc.expectErrMsg, "should have correct error for invalid AddBlockHeightTrigger request") - s.Assert().Equal(tc.expectedCode, response.Code, "should have correct response code for invalid AddBlockHeightTrigger request") } else { s.Assert().NoError(err, "should have no error for valid AddBlockHeightTrigger request") - s.Assert().NoError(marshalErr, out.String(), "should have no error for marshaling request") - s.Assert().Equal(tc.expectedCode, response.Code, "should have correct response code for AddBlockHeightTrigger request") + txResp := queries.GetTxFromResponse(s.T(), s.network, outBz) + s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "should have correct response code for AddBlockHeightTrigger request") } }) } @@ -516,8 +517,6 @@ func (s *IntegrationTestSuite) TestAddTransactionTrigger() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) @@ -562,28 +561,27 @@ func (s *IntegrationTestSuite) TestAddTransactionTrigger() { } txEventFile := sdktestutil.WriteToNewTempFile(s.T(), txEvent) + cmd := triggercli.GetCmdAddTransactionTrigger() args := []string{ txEventFile.Name(), messageFile.Name(), - } - flagArgs := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddresses[0].String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), + fmt.Sprintf("--%s=json", cmtcli.OutputFlag), } - args = append(args, flagArgs...) - out, err := clitestutil.ExecTestCLICmd(clientCtx, triggercli.GetCmdAddTransactionTrigger(), append(args, []string{fmt.Sprintf("--%s=json", cmtcli.OutputFlag)}...)) - var response sdk.TxResponse - marshalErr := clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) + if len(tc.expectErrMsg) > 0 { s.Assert().EqualError(err, tc.expectErrMsg, "should have correct error for invalid AddTransactionTrigger request") - s.Assert().Equal(tc.expectedCode, response.Code, "should have correct response code for invalid AddTransactionTrigger request") } else { s.Assert().NoError(err, "should have no error for valid AddTransactionTrigger request") - s.Assert().NoError(marshalErr, out.String(), "should have no marshalling error for valid AddTransactionTrigger request") - s.Assert().Equal(tc.expectedCode, response.Code, "should have correct response code for valid AddTransactionTrigger request") + txResp := queries.GetTxFromResponse(s.T(), s.network, outBz) + s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "should have correct response code for valid AddTransactionTrigger request") } }) } @@ -679,8 +677,6 @@ func (s *IntegrationTestSuite) TestAddBlockTimeTrigger() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) @@ -704,28 +700,27 @@ func (s *IntegrationTestSuite) TestAddBlockTimeTrigger() { messageFile := sdktestutil.WriteToNewTempFile(s.T(), message) + cmd := triggercli.GetCmdAddBlockTimeTrigger() args := []string{ tc.blockTime, messageFile.Name(), - } - flagArgs := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddresses[0].String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), + fmt.Sprintf("--%s=json", cmtcli.OutputFlag), } - args = append(args, flagArgs...) - out, err := clitestutil.ExecTestCLICmd(clientCtx, triggercli.GetCmdAddBlockTimeTrigger(), append(args, []string{fmt.Sprintf("--%s=json", cmtcli.OutputFlag)}...)) - var response sdk.TxResponse - marshalErr := clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) + if len(tc.expectErrMsg) > 0 { s.Assert().EqualError(err, tc.expectErrMsg, "should have correct error for invalid AddBlockTimeTrigger request") - s.Assert().Equal(tc.expectedCode, response.Code, "should have correct response code for invalid AddBlockTimeTrigger request") } else { s.Assert().NoError(err, "should have no error for valid AddBlockTimeTrigger request") - s.Assert().NoError(marshalErr, out.String(), "should have no marshal error for valid AddBlockTimeTrigger request") - s.Assert().Equal(tc.expectedCode, response.Code, "should have correct response code for valid AddBlockTimeTrigger request") + txResp := queries.GetTxFromResponse(s.T(), s.network, outBz) + s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "should have correct response code for valid AddBlockTimeTrigger request") } }) } @@ -770,33 +765,29 @@ func (s *IntegrationTestSuite) TestDestroyTrigger() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) + cmd := triggercli.GetCmdDestroyTrigger() args := []string{ tc.triggerID, - } - flagArgs := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, tc.signer), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), + fmt.Sprintf("--%s=json", cmtcli.OutputFlag), } - args = append(args, flagArgs...) - out, err := clitestutil.ExecTestCLICmd(clientCtx, triggercli.GetCmdDestroyTrigger(), append(args, []string{fmt.Sprintf("--%s=json", cmtcli.OutputFlag)}...)) - var response sdk.TxResponse - marshalErr := clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) + if len(tc.expectErrMsg) > 0 { s.Assert().EqualError(err, tc.expectErrMsg, "should have correct error for invalid DestroyTrigger request") - s.Assert().Equal(tc.expectedCode, response.Code, "should have correct response code for invalid DestroyTrigger request") } else { s.Assert().NoError(err, "should have no error for valid DestroyTrigger request") - s.Assert().NoError(marshalErr, out.String(), "should have no marshal error for valid DestroyTrigger request") - s.Assert().Equal(tc.expectedCode, response.Code, "should have correct response code for valid DestroyTrigger request") + txResp := queries.GetTxFromResponse(s.T(), s.network, outBz) + s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "should have correct response code for valid DestroyTrigger request") } }) } diff --git a/x/trigger/simulation/operations_test.go b/x/trigger/simulation/operations_test.go index 0c678dc376..49fa6e5ddd 100644 --- a/x/trigger/simulation/operations_test.go +++ b/x/trigger/simulation/operations_test.go @@ -160,7 +160,7 @@ func (s *SimTestSuite) TestSimulateMsgDestroyTrigger() { s.LogOperationMsg(operationMsg, "good") var msg types.MsgDestroyTriggerRequest - s.Require().NoError(s.app.AppCodec().UnmarshalJSON(operationMsg.Msg, &msg), "UnmarshalJSON(operationMsg.Msg)") + s.Require().NoError(s.app.AppCodec().Unmarshal(operationMsg.Msg, &msg), "Unmarshal(operationMsg.Msg)") s.Assert().True(operationMsg.OK, "operationMsg.OK") s.Assert().Equal(sdk.MsgTypeURL(&msg), operationMsg.Name, "operationMsg.Name") diff --git a/x/trigger/types/msgs.go b/x/trigger/types/msgs.go index d62fe75b6b..4a55a92894 100644 --- a/x/trigger/types/msgs.go +++ b/x/trigger/types/msgs.go @@ -1,12 +1,17 @@ package types import ( - fmt "fmt" + "fmt" + + "google.golang.org/protobuf/protoadapt" + + "cosmossdk.io/x/tx/signing" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdktx "github.com/cosmos/cosmos-sdk/types/tx" + simappparams "github.com/provenance-io/provenance/app/params" "github.com/provenance-io/provenance/internal/helpers" ) @@ -70,14 +75,14 @@ func (msg MsgCreateTriggerRequest) ValidateBasic() error { authorities[string(addr)] = true } + sigCtx := simappparams.AppEncodingConfig.InterfaceRegistry.SigningContext() for idx, action := range actions { if err = helpers.ValidateBasic(action); err != nil { return fmt.Errorf("action: %d: %w", idx, err) } - // TODO[1760]: signers: getting signers now requies a context, so it can' live in this MsgCreateTriggerRequest ValidateBasic(). - // if err = hasSigners(authorities, action.GetSigners()); err != nil { - // return fmt.Errorf("action: %d: %w", idx, err) - // } + if err = hasSigners(sigCtx, authorities, action); err != nil { + return fmt.Errorf("action: %d: %w", idx, err) + } } return nil } @@ -89,10 +94,14 @@ func (msg MsgCreateTriggerRequest) GetSigners() []sdk.AccAddress { // hasSigners checks if the signers are all in the set of the entries // The keys in the available map are a cast of an AccAddress to a string. It is not the result of AccAddress.String(). -func hasSigners(available map[string]bool, signers []sdk.AccAddress) error { +func hasSigners(sigCtx *signing.Context, available map[string]bool, action sdk.Msg) error { + signers, err := sigCtx.GetSigners(protoadapt.MessageV2Of(action)) + if err != nil { + return fmt.Errorf("could not get signers of %T: %w", action, err) + } for i, signer := range signers { if !available[string(signer)] { - return fmt.Errorf("signers[%d] %q is not a signer of the request message", i, signer.String()) + return fmt.Errorf("%T signers[%d] %q is not a signer of the request message", action, i, sdk.AccAddress(signer).String()) } } return nil diff --git a/x/trigger/types/msgs_test.go b/x/trigger/types/msgs_test.go index b193b70649..60b45e7655 100644 --- a/x/trigger/types/msgs_test.go +++ b/x/trigger/types/msgs_test.go @@ -1,4 +1,4 @@ -package types +package types_test import ( fmt "fmt" @@ -10,6 +10,10 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdktx "github.com/cosmos/cosmos-sdk/types/tx" + + "github.com/provenance-io/provenance/app" + + . "github.com/provenance-io/provenance/x/trigger/types" ) func TestNewCreateTriggerRequest(t *testing.T) { @@ -39,6 +43,8 @@ func TestNewDestroyTriggerRequest(t *testing.T) { } func TestMsgCreateTriggerRequestValidateBasic(t *testing.T) { + // Call MakeTestEncodingConfig because it calls app.New which sets the global AppEncodingConfig needed here. + app.MakeTestEncodingConfig(t) tests := []struct { name string authorities []string @@ -86,7 +92,7 @@ func TestMsgCreateTriggerRequestValidateBasic(t *testing.T) { authorities: []string{"cosmos1v57fx2l2rt6ehujuu99u2fw05779m5e2ux4z2h"}, event: &BlockHeightEvent{}, msgs: []sdk.Msg{&MsgDestroyTriggerRequest{Authority: "cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs2m6sx4", Id: 1}}, - err: "action: 0: signers[0] \"cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs2m6sx4\" is not a signer of the request message", + err: "action: 0: *types.MsgDestroyTriggerRequest signers[0] \"cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs2m6sx4\" is not a signer of the request message", }, { name: "valid - the action's signer must be in authorities subset", From 229ef84985249e78d0b7052dd1607bb43ea31d77 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Thu, 18 Apr 2024 17:54:57 -0600 Subject: [PATCH 15/42] [1760]: Fix the ibcratelimit cli tests. --- x/ibcratelimit/client/cli/cli_test.go | 36 ++++++++++++++++----------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/x/ibcratelimit/client/cli/cli_test.go b/x/ibcratelimit/client/cli/cli_test.go index 178ff861ea..4563018443 100644 --- a/x/ibcratelimit/client/cli/cli_test.go +++ b/x/ibcratelimit/client/cli/cli_test.go @@ -6,6 +6,7 @@ import ( cmtcli "github.com/cometbft/cometbft/libs/cli" + sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -15,6 +16,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "github.com/provenance-io/provenance/testutil/queries" "github.com/stretchr/testify/suite" @@ -47,6 +50,7 @@ func TestIntegrationTestSuite(t *testing.T) { func (s *TestSuite) SetupSuite() { s.T().Log("setting up integration test suite") pioconfig.SetProvenanceConfig("", 0) + govv1.DefaultMinDepositRatio = sdkmath.LegacyZeroDec() s.accountKey = secp256k1.GenPrivKeyFromSecret([]byte("acc2")) addr, err := sdk.AccAddressFromHexUnsafe(s.accountKey.PubKey().Address().String()) s.Require().NoError(err) @@ -138,17 +142,21 @@ func (s *TestSuite) TestGetParams() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { clientCtx := s.network.Validators[0].ClientCtx - out, err := clitestutil.ExecTestCLICmd(clientCtx, ibcratelimitcli.GetParamsCmd(), []string{fmt.Sprintf("--%s=json", cmtcli.OutputFlag)}) + cmd := ibcratelimitcli.GetParamsCmd() + args := []string{fmt.Sprintf("--%s=json", cmtcli.OutputFlag)} + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) + if len(tc.expectErrMsg) > 0 { s.EqualError(err, tc.expectErrMsg, "should have correct error message for invalid Params request") } else { var response ibcratelimit.Params s.NoError(err, "should have no error message for valid Params request") - err = s.cfg.Codec.UnmarshalJSON(out.Bytes(), &response) + err = s.cfg.Codec.UnmarshalJSON(outBz, &response) s.NoError(err, "should have no error message when unmarshalling response to Params request") s.Equal(tc.expectedAddress, response.ContractAddress, "should have the correct ratelimit address") } @@ -179,30 +187,30 @@ func (s *TestSuite) TestParamsUpdate() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { - clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) + cmd := ibcratelimitcli.GetCmdParamsUpdate() flagArgs := []string{ + "--title", "Update ibc-rate-limit params", "--summary", "See title.", fmt.Sprintf("--%s=%s", flags.FlagFrom, tc.signer), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), + fmt.Sprintf("--%s=json", cmtcli.OutputFlag), } tc.args = append(tc.args, flagArgs...) - out, err := clitestutil.ExecTestCLICmd(clientCtx, ibcratelimitcli.GetCmdParamsUpdate(), append(tc.args, []string{fmt.Sprintf("--%s=json", cmtcli.OutputFlag)}...)) - var response sdk.TxResponse - marshalErr := clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), tc.args, string(outBz)) + if len(tc.expectErrMsg) > 0 { s.Assert().EqualError(err, tc.expectErrMsg, "should have correct error for invalid ParamsUpdate request") - s.Assert().Equal(tc.expectedCode, response.Code, "should have correct response code for invalid ParamsUpdate request") } else { s.Assert().NoError(err, "should have no error for valid ParamsUpdate request") - s.Assert().NoError(marshalErr, out.String(), "should have no marshal error for valid ParamsUpdate request") - s.Assert().Equal(tc.expectedCode, response.Code, "should have correct response code for valid ParamsUpdate request") + txResp := queries.GetTxFromResponse(s.T(), s.network, outBz) + s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "should have correct response code for valid ParamsUpdate request") } }) } From e8f616f3645670f1fe654cb16b80d90f1de208f9 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Thu, 18 Apr 2024 18:44:07 -0600 Subject: [PATCH 16/42] [1760]: Fix the msgfees cli tests. --- x/msgfees/client/cli/cli_test.go | 91 +++++++++++++++++++------------- x/msgfees/types/errors.go | 4 +- 2 files changed, 57 insertions(+), 38 deletions(-) diff --git a/x/msgfees/client/cli/cli_test.go b/x/msgfees/client/cli/cli_test.go index 700203b827..30859ecd5a 100644 --- a/x/msgfees/client/cli/cli_test.go +++ b/x/msgfees/client/cli/cli_test.go @@ -7,15 +7,20 @@ import ( "github.com/stretchr/testify/suite" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" testnet "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" + "github.com/provenance-io/provenance/testutil/queries" msgfeescli "github.com/provenance-io/provenance/x/msgfees/client/cli" + "github.com/provenance-io/provenance/x/msgfees/types" ) type IntegrationTestSuite struct { @@ -50,17 +55,23 @@ func (s *IntegrationTestSuite) SetupSuite() { s.T().Log("setting up integration test suite") pioconfig.SetProvenanceConfig("atom", 0) - - cfg := testutil.DefaultTestNetworkConfig() - cfg.TimeoutCommit = 500 * time.Millisecond - - genesisState := cfg.GenesisState - cfg.NumValidators = 1 - - cfg.GenesisState = genesisState - - s.cfg = cfg - s.testnet, err = testnet.New(s.T(), s.T().TempDir(), cfg) + govv1.DefaultMinDepositRatio = sdkmath.LegacyZeroDec() + + s.cfg = testutil.DefaultTestNetworkConfig() + s.cfg.TimeoutCommit = 500 * time.Millisecond + s.cfg.NumValidators = 1 + + var msgfeeGen types.GenesisState + err = s.cfg.Codec.UnmarshalJSON(s.cfg.GenesisState[types.ModuleName], &msgfeeGen) + s.Require().NoError(err, "UnmarshalJSON msgfee gen state") + msgfeeGen.MsgFees = append(msgfeeGen.MsgFees, types.MsgFee{ + MsgTypeUrl: "/provenance.metadata.v1.MsgAddContractSpecToScopeSpecRequest", + AdditionalFee: sdk.NewInt64Coin(s.cfg.BondDenom, 3), + }) + s.cfg.GenesisState[types.ModuleName], err = s.cfg.Codec.MarshalJSON(&msgfeeGen) + s.Require().NoError(err, "MarshalJSON msgfee gen state") + + s.testnet, err = testnet.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "creating testnet") _, err = testutil.WaitForHeight(s.testnet, 1) @@ -156,7 +167,7 @@ func (s *IntegrationTestSuite) TestMsgFeesTxGovProposals() { title: "test update msg based fee", description: "description", deposit: sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String(), - msgType: "--msg-type=/provenance.metadata.v1.MsgWriteRecordRequest", + msgType: "--msg-type=/provenance.metadata.v1.MsgAddContractSpecToScopeSpecRequest", additionalFee: fmt.Sprintf("--additional-fee=%s", sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 12)).String()), recipient: "", bips: "", @@ -169,7 +180,7 @@ func (s *IntegrationTestSuite) TestMsgFeesTxGovProposals() { title: "test update msg based fee", description: "description", deposit: sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String(), - msgType: "--msg-type=/provenance.metadata.v1.MsgWriteRecordRequest", + msgType: "--msg-type=/provenance.metadata.v1.MsgAddContractSpecToScopeSpecRequest", additionalFee: fmt.Sprintf("--additional-fee=%s", sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 12)).String()), recipient: fmt.Sprintf("--recipient=%s", s.testnet.Validators[0].Address.String()), bips: "", @@ -182,7 +193,7 @@ func (s *IntegrationTestSuite) TestMsgFeesTxGovProposals() { title: "test update msg based fee", description: "description", deposit: sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String(), - msgType: "--msg-type=/provenance.metadata.v1.MsgWriteRecordRequest", + msgType: "--msg-type=/provenance.metadata.v1.MsgAddContractSpecToScopeSpecRequest", additionalFee: fmt.Sprintf("--additional-fee=%s", sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 12)).String()), recipient: fmt.Sprintf("--recipient=%s", s.testnet.Validators[0].Address.String()), bips: fmt.Sprintf("--bips=%s", "5001"), @@ -195,7 +206,7 @@ func (s *IntegrationTestSuite) TestMsgFeesTxGovProposals() { title: "test update msg based fee", description: "description", deposit: sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String(), - msgType: "--msg-type=/provenance.metadata.v1.MsgWriteRecordRequest", + msgType: "--msg-type=/provenance.metadata.v1.MsgAddContractSpecToScopeSpecRequest", additionalFee: "", recipient: "", bips: "", @@ -205,15 +216,14 @@ func (s *IntegrationTestSuite) TestMsgFeesTxGovProposals() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx + cmd := msgfeescli.GetCmdMsgFeesProposal() args := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), } @@ -228,13 +238,16 @@ func (s *IntegrationTestSuite) TestMsgFeesTxGovProposals() { args = append(args, tc.bips) } - out, err := clitestutil.ExecTestCLICmd(clientCtx, msgfeescli.GetCmdMsgFeesProposal(), args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) + if len(tc.expectErrMsg) != 0 { - s.Require().Error(err) - s.Assert().Equal(tc.expectErrMsg, err.Error()) + s.Assert().EqualError(err, tc.expectErrMsg) } else { s.Require().NoError(err) - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &sdk.TxResponse{}), out.String()) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "response code") } }) } @@ -280,25 +293,28 @@ func (s *IntegrationTestSuite) TestUpdateUsdConversionRateProposal() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx + + cmd := msgfeescli.GetUpdateNhashPerUsdMilProposal() args := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), } args = append(args, tc.name, tc.description, tc.rate, tc.deposit) - out, err := clitestutil.ExecTestCLICmd(clientCtx, msgfeescli.GetUpdateNhashPerUsdMilProposal(), args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) + if len(tc.expectErrMsg) != 0 { - s.Require().Error(err) - s.Assert().Equal(tc.expectErrMsg, err.Error()) + s.Require().EqualError(err, tc.expectErrMsg) } else { s.Require().NoError(err) - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &sdk.TxResponse{}), out.String()) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "response code") } }) } @@ -335,25 +351,28 @@ func (s *IntegrationTestSuite) TestUpdateConversionFeeDenomProposal() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx + + cmd := msgfeescli.GetUpdateConversionFeeDenomProposal() args := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), } args = append(args, tc.name, tc.description, tc.conversionFeeDenom, tc.deposit) - out, err := clitestutil.ExecTestCLICmd(clientCtx, msgfeescli.GetUpdateConversionFeeDenomProposal(), args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) + if len(tc.expectErrMsg) != 0 { - s.Require().Error(err) - s.Assert().Equal(tc.expectErrMsg, err.Error()) + s.Require().EqualError(err, tc.expectErrMsg) } else { s.Require().NoError(err) - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &sdk.TxResponse{}), out.String()) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "response code") } }) } diff --git a/x/msgfees/types/errors.go b/x/msgfees/types/errors.go index 9d513aea62..905c3e17f3 100644 --- a/x/msgfees/types/errors.go +++ b/x/msgfees/types/errors.go @@ -8,8 +8,8 @@ import ( var ( ErrEmptyMsgType = cerrs.Register(ModuleName, 2, "msg type is empty") ErrInvalidFee = cerrs.Register(ModuleName, 3, "invalid fee amount") - ErrMsgFeeAlreadyExists = cerrs.Register(ModuleName, 4, "fee for type already exists.") - ErrMsgFeeDoesNotExist = cerrs.Register(ModuleName, 5, "fee for type does not exist.") + ErrMsgFeeAlreadyExists = cerrs.Register(ModuleName, 4, "fee for type already exists") + ErrMsgFeeDoesNotExist = cerrs.Register(ModuleName, 5, "fee for type does not exist") ErrInvalidFeeProposal = cerrs.Register(ModuleName, 6, "invalid fee proposal") ErrInvalidBipsValue = cerrs.Register(ModuleName, 7, "invalid bips amount") ) From a0ee1f168cd043450d359babb5f48c7ef0d71239 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Thu, 18 Apr 2024 18:52:14 -0600 Subject: [PATCH 17/42] [1760]: Make AssertGetTxFromResponse return the original response if it has something in the raw log or somehow already has a Tx. --- testutil/queries/auth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testutil/queries/auth.go b/testutil/queries/auth.go index 6dc99d8f4d..642e5e513b 100644 --- a/testutil/queries/auth.go +++ b/testutil/queries/auth.go @@ -88,7 +88,7 @@ func AssertGetTxFromResponse(t *testing.T, n *network.Network, txRespBz []byte) if !assert.NoError(t, err, "UnmarshalJSON(%q, %T) (original tx response)", string(txRespBz), &origResp) { return sdk.TxResponse{}, false } - if origResp.Code != 0 { + if origResp.Code != 0 || len(origResp.RawLog) > 0 || origResp.Tx != nil { return origResp, true } if !assert.NotEmpty(t, origResp.TxHash, "the tx hash") { From d8c1d1058d747360e058b64d5da9376b23c4e89b Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Fri, 19 Apr 2024 15:39:17 -0600 Subject: [PATCH 18/42] [1760]: Create ABCIEventsToStrings (same as EventsToStrings, but with the events that come back in a txResp. Create MutateGenesisState as an easier way to update a module's genesis state during test setup. Create createQueryCmd as a helper that will create a query command for a url. Create CmdGetAllGovProps that uses createQueryCmd to get all governance proposals. --- testutil/assertions/events.go | 12 ++++++++++ testutil/genesis.go | 30 +++++++++++++++++++++++++ testutil/queries/generic.go | 42 +++++++++++++++++++++++++++++++++++ testutil/queries/gov.go | 6 +++++ 4 files changed, 90 insertions(+) create mode 100644 testutil/genesis.go diff --git a/testutil/assertions/events.go b/testutil/assertions/events.go index 3cdb55a1d3..0a55d6330e 100644 --- a/testutil/assertions/events.go +++ b/testutil/assertions/events.go @@ -28,6 +28,18 @@ func EventsToStrings(events sdk.Events) []string { return rv } +// ABCIEventsToStrings converts abci Events to strings representing the events, one line per attribute. +func ABCIEventsToStrings(events []abci.Event) []string { + var sdkEvents sdk.Events + if events != nil { + sdkEvents = make(sdk.Events, len(events)) + for i, event := range events { + sdkEvents[i] = sdk.Event(event) + } + } + return EventsToStrings(sdkEvents) +} + // EventToStrings converts a single event to strings, one string per attribute. func EventToStrings(event sdk.Event) []string { if len(event.Attributes) == 0 { diff --git a/testutil/genesis.go b/testutil/genesis.go new file mode 100644 index 0000000000..9b7e60b8d3 --- /dev/null +++ b/testutil/genesis.go @@ -0,0 +1,30 @@ +package testutil + +import ( + "testing" + + "github.com/stretchr/testify/require" + + testnet "github.com/cosmos/cosmos-sdk/testutil/network" + "github.com/cosmos/gogoproto/proto" +) + +// MutateGenesisState will extract a GenesisState object from the provided config and run it through +// the provided mutator. Then it will update the config to have that new genesis state. +// +// G is the type of the specific genesis state struct being used here. +func MutateGenesisState[G proto.Message](t *testing.T, cfg *testnet.Config, moduleName string, emptyState G, mutator func(state G) G) { + err := cfg.Codec.UnmarshalJSON(cfg.GenesisState[moduleName], emptyState) + if err != nil { + t.Logf("initial %s genesis state:\n%s", moduleName, string(cfg.GenesisState[moduleName])) + } + require.NoError(t, err, "UnmarshalJSON %s genesis state as %T", moduleName, emptyState) + + emptyState = mutator(emptyState) + + cfg.GenesisState[moduleName], err = cfg.Codec.MarshalJSON(emptyState) + if err != nil { + t.Logf("%s genesis state after mutator:\n%#v", moduleName, emptyState) + } + require.NoError(t, err, "MarshalJSON %s genesis state from %T after mutator", moduleName, emptyState) +} diff --git a/testutil/queries/generic.go b/testutil/queries/generic.go index 69bfd96c73..c8a1cd927b 100644 --- a/testutil/queries/generic.go +++ b/testutil/queries/generic.go @@ -1,10 +1,14 @@ package queries import ( + "fmt" "testing" + "github.com/spf13/cobra" "github.com/stretchr/testify/assert" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/testutil/network" "github.com/cosmos/gogoproto/proto" @@ -35,3 +39,41 @@ func AssertGetRequest[T proto.Message](t *testing.T, n *network.Network, url str return emptyResp, true } + +// createQueryCmd creates a command that will execute a query on the provided url, +// unmarshal the response into the empty response, and output the result as either +// yaml or json depending on the --output flag. +func createQueryCmd[T proto.Message](n *network.Network, cmdName, url string, emptyResp T) *cobra.Command { + if n == nil || len(n.Validators) == 0 { + panic("network must have at least one validator") + } + url = n.Validators[0].APIAddress + url + + cmd := &cobra.Command{ + Use: "generic-" + cmdName, + Args: cobra.NoArgs, + SilenceUsage: true, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + respBz, err := testutil.GetRequestWithHeaders(url, nil) + if err != nil { + return fmt.Errorf("failed to execute GET %q: %w", url, err) + } + + err = clientCtx.Codec.UnmarshalJSON(respBz, emptyResp) + if err != nil { + _ = clientCtx.PrintString("Response from GET " + url + "\n") + _ = clientCtx.PrintBytes(respBz) + return fmt.Errorf("failed to unmarshal response as %T: %w", emptyResp, err) + } + + return clientCtx.PrintProto(emptyResp) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/testutil/queries/gov.go b/testutil/queries/gov.go index 18a86bf180..f915bc2d97 100644 --- a/testutil/queries/gov.go +++ b/testutil/queries/gov.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/spf13/cobra" "github.com/stretchr/testify/assert" "github.com/cosmos/cosmos-sdk/testutil/network" @@ -79,3 +80,8 @@ func AssertGetGovProp(t *testing.T, n *network.Network, propID string) (*govv1.P } return resp.Proposal, true } + +// CmdGetAllGovProps returns a cobra.Command that will execute a query to get all governance proposals. +func CmdGetAllGovProps(n *network.Network) *cobra.Command { + return createQueryCmd(n, "get-all-gov-props", "/cosmos/gov/v1/proposals?limit=10000", &govv1.QueryProposalsResponse{}) +} From e5f65042187da7e4613ffd321734b65fba039806 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Fri, 19 Apr 2024 15:41:55 -0600 Subject: [PATCH 19/42] [1760]: Add the signer option to MsgGrantAllowanceRequest and fix the marker CLI tests. --- proto/provenance/marker/v1/tx.proto | 2 + x/marker/client/cli/cli_test.go | 730 ++++++++++++++-------------- x/marker/types/tx.pb.go | 251 +++++----- 3 files changed, 504 insertions(+), 479 deletions(-) diff --git a/proto/provenance/marker/v1/tx.proto b/proto/provenance/marker/v1/tx.proto index 7708792f73..a4c30f833f 100644 --- a/proto/provenance/marker/v1/tx.proto +++ b/proto/provenance/marker/v1/tx.proto @@ -67,6 +67,8 @@ service Msg { // MsgGrantAllowanceRequest validates permission to create a fee grant based on marker admin access. If // successful a feegrant is recorded where the marker account itself is the grantor message MsgGrantAllowanceRequest { + option (cosmos.msg.v1.signer) = "administrator"; + string denom = 1; string administrator = 2; diff --git a/x/marker/client/cli/cli_test.go b/x/marker/client/cli/cli_test.go index 7f886f0670..5b847a92be 100644 --- a/x/marker/client/cli/cli_test.go +++ b/x/marker/client/cli/cli_test.go @@ -2,7 +2,6 @@ package cli_test import ( "encoding/base64" - "encoding/json" "fmt" "os" "sort" @@ -15,6 +14,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + abci "github.com/cometbft/cometbft/abci/types" cmtcli "github.com/cometbft/cometbft/libs/cli" sdkmath "cosmossdk.io/math" @@ -29,10 +29,15 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/cosmos/gogoproto/proto" + "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" + "github.com/provenance-io/provenance/testutil/assertions" + "github.com/provenance-io/provenance/testutil/queries" attrcli "github.com/provenance-io/provenance/x/attribute/client/cli" attrtypes "github.com/provenance-io/provenance/x/attribute/types" markercli "github.com/provenance-io/provenance/x/marker/client/cli" @@ -82,223 +87,210 @@ func TestIntegrationTestSuite(t *testing.T) { func (s *IntegrationTestSuite) SetupSuite() { s.T().Log("setting up integration test suite") pioconfig.SetProvenanceConfig("", 0) - cfg := testutil.DefaultTestNetworkConfig() - - genesisState := cfg.GenesisState - cfg.NumValidators = 1 - s.cfg = cfg + govv1.DefaultMinDepositRatio = sdkmath.LegacyZeroDec() + s.cfg = testutil.DefaultTestNetworkConfig() + s.cfg.NumValidators = 1 + s.cfg.ChainID = antewrapper.SimAppChainID s.GenerateAccountsWithKeyrings(4) - // Configure Genesis auth data for adding test accounts - var genAccounts []authtypes.GenesisAccount - var authData authtypes.GenesisState - authData.Params = authtypes.DefaultParams() - genAccounts = append(genAccounts, authtypes.NewBaseAccount(s.accountAddresses[0], nil, 3, 0)) - genAccounts = append(genAccounts, authtypes.NewBaseAccount(s.accountAddresses[1], nil, 4, 0)) - genAccounts = append(genAccounts, authtypes.NewBaseAccount(s.accountAddresses[2], nil, 5, 0)) - genAccounts = append(genAccounts, authtypes.NewBaseAccount(s.accountAddresses[3], nil, 6, 0)) - accounts, err := authtypes.PackAccounts(genAccounts) - s.Require().NoError(err) - authData.Accounts = accounts - authDataBz, err := cfg.Codec.MarshalJSON(&authData) - s.Require().NoError(err) - genesisState[authtypes.ModuleName] = authDataBz - s.holderDenom = "hodlercoin" s.holderCount = 4 + s.markerCount = 20 + + // Configure Genesis auth data for adding test accounts + testutil.MutateGenesisState(s.T(), &s.cfg, authtypes.ModuleName, &authtypes.GenesisState{}, func(authData *authtypes.GenesisState) *authtypes.GenesisState { + var genAccounts []authtypes.GenesisAccount + authData.Params = authtypes.DefaultParams() + genAccounts = append(genAccounts, authtypes.NewBaseAccount(s.accountAddresses[0], nil, 3, 0)) + genAccounts = append(genAccounts, authtypes.NewBaseAccount(s.accountAddresses[1], nil, 4, 0)) + genAccounts = append(genAccounts, authtypes.NewBaseAccount(s.accountAddresses[2], nil, 5, 0)) + genAccounts = append(genAccounts, authtypes.NewBaseAccount(s.accountAddresses[3], nil, 6, 0)) + accounts, err := authtypes.PackAccounts(genAccounts) + s.Require().NoError(err) + authData.Accounts = accounts + return authData + }) // Configure Genesis bank data for test accounts - var genBalances []banktypes.Balance - genBalances = append(genBalances, banktypes.Balance{Address: s.accountAddresses[0].String(), Coins: sdk.NewCoins( - sdk.NewCoin(cfg.BondDenom, cfg.StakingTokens), - sdk.NewInt64Coin("authzhotdog", 100), - sdk.NewInt64Coin(s.holderDenom, 123), - ).Sort()}) - genBalances = append(genBalances, banktypes.Balance{Address: s.accountAddresses[1].String(), Coins: sdk.NewCoins( - sdk.NewCoin(cfg.BondDenom, cfg.StakingTokens), - sdk.NewInt64Coin("authzhotdog", 100), - sdk.NewInt64Coin(s.holderDenom, 234), - ).Sort()}) - genBalances = append(genBalances, banktypes.Balance{Address: s.accountAddresses[2].String(), Coins: sdk.NewCoins( - sdk.NewCoin(cfg.BondDenom, cfg.StakingTokens), - sdk.NewInt64Coin(s.holderDenom, 345), - ).Sort()}) - genBalances = append(genBalances, banktypes.Balance{Address: s.accountAddresses[3].String(), Coins: sdk.NewCoins( - sdk.NewCoin(cfg.BondDenom, cfg.StakingTokens), - sdk.NewInt64Coin(s.holderDenom, 456), - ).Sort()}) - - genBalances = append(genBalances, banktypes.Balance{Address: markertypes.MustGetMarkerAddress("testcoin").String(), Coins: sdk.NewCoins( - sdk.NewInt64Coin("testcoin", 1000), - ).Sort()}) - genBalances = append(genBalances, banktypes.Balance{Address: markertypes.MustGetMarkerAddress("lockedcoin").String(), Coins: sdk.NewCoins( - sdk.NewInt64Coin("lockedcoin", 1000), - ).Sort()}) - genBalances = append(genBalances, banktypes.Balance{Address: markertypes.MustGetMarkerAddress("propcoin").String(), Coins: sdk.NewCoins( - sdk.NewInt64Coin("propcoin", 1000), - ).Sort()}) - genBalances = append(genBalances, banktypes.Balance{Address: markertypes.MustGetMarkerAddress("authzhotdog").String(), Coins: sdk.NewCoins( - sdk.NewInt64Coin("authzhotdog", 800), - ).Sort()}) - - var bankGenState banktypes.GenesisState - bankGenState.Params = banktypes.DefaultParams() - bankGenState.Balances = genBalances - bankDataBz, err := cfg.Codec.MarshalJSON(&bankGenState) - s.Require().NoError(err) - genesisState[banktypes.ModuleName] = bankDataBz + testutil.MutateGenesisState(s.T(), &s.cfg, banktypes.ModuleName, &banktypes.GenesisState{}, func(bankGenState *banktypes.GenesisState) *banktypes.GenesisState { + bondCoin := sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens) + bal := func(addr sdk.AccAddress, coins ...sdk.Coin) banktypes.Balance { + return banktypes.Balance{ + Address: addr.String(), + Coins: sdk.NewCoins(coins...), + } + } + coin := func(amount int64, denom string) sdk.Coin { + return sdk.NewInt64Coin(denom, amount) + } - s.markerCount = 20 + bankGenState.Balances = append(bankGenState.Balances, + bal(s.accountAddresses[0], bondCoin, coin(100, "authzhotdog"), coin(123, s.holderDenom)), + bal(s.accountAddresses[1], bondCoin, coin(100, "authzhotdog"), coin(234, s.holderDenom)), + bal(s.accountAddresses[2], bondCoin, coin(345, s.holderDenom)), + bal(s.accountAddresses[3], bondCoin, coin(456, s.holderDenom)), + + bal(markertypes.MustGetMarkerAddress("testcoin"), coin(1000, "testcoin")), + bal(markertypes.MustGetMarkerAddress("lockedcoin"), coin(1000, "lockedcoin")), + bal(markertypes.MustGetMarkerAddress("propcoin"), coin(1000, "propcoin")), + bal(markertypes.MustGetMarkerAddress("authzhotdog"), coin(800, "authzhotdog")), + ) + + return bankGenState + }) // Configure Genesis data for marker module - var markerData markertypes.GenesisState - markerData.Params.EnableGovernance = true - markerData.Params.MaxTotalSupply = 1000000 - markerData.Params.MaxSupply = sdkmath.NewInt(1000000) - // Note: These account numbers get ignored. - markerData.Markers = []markertypes.MarkerAccount{ - { - BaseAccount: &authtypes.BaseAccount{ - Address: markertypes.MustGetMarkerAddress("testcoin").String(), - AccountNumber: 100, - Sequence: 0, - }, - Status: markertypes.StatusActive, - SupplyFixed: true, - MarkerType: markertypes.MarkerType_Coin, - AllowGovernanceControl: false, - Supply: sdkmath.NewInt(1000), - Denom: "testcoin", - AllowForcedTransfer: false, - }, - { - BaseAccount: &authtypes.BaseAccount{ - Address: markertypes.MustGetMarkerAddress("lockedcoin").String(), - AccountNumber: 110, - Sequence: 0, - }, - Status: markertypes.StatusActive, - SupplyFixed: true, - MarkerType: markertypes.MarkerType_RestrictedCoin, - AllowGovernanceControl: false, - Supply: sdkmath.NewInt(1000), - Denom: "lockedcoin", - AllowForcedTransfer: false, - }, - { - BaseAccount: &authtypes.BaseAccount{ - Address: markertypes.MustGetMarkerAddress("propcoin").String(), - AccountNumber: 120, - Sequence: 0, - }, - Status: markertypes.StatusActive, - SupplyFixed: true, - MarkerType: markertypes.MarkerType_Coin, - AllowGovernanceControl: true, - Supply: sdkmath.NewInt(1000), - Denom: "propcoin", - AllowForcedTransfer: false, - }, - { - BaseAccount: &authtypes.BaseAccount{ - Address: markertypes.MustGetMarkerAddress(cfg.BondDenom).String(), - AccountNumber: 130, - Sequence: 0, - }, - Status: markertypes.StatusActive, - SupplyFixed: false, - MarkerType: markertypes.MarkerType_Coin, - AllowGovernanceControl: true, - Supply: cfg.BondedTokens.MulRaw(int64(cfg.NumValidators)), - Denom: cfg.BondDenom, - AllowForcedTransfer: false, - }, - { - BaseAccount: &authtypes.BaseAccount{ - Address: markertypes.MustGetMarkerAddress("authzhotdog").String(), - AccountNumber: 140, - Sequence: 0, - }, - Status: markertypes.StatusActive, - SupplyFixed: true, - MarkerType: markertypes.MarkerType_RestrictedCoin, - AllowGovernanceControl: false, - Supply: sdkmath.NewInt(1000), - Denom: "authzhotdog", - AccessControl: []markertypes.AccessGrant{ - *markertypes.NewAccessGrant(s.accountAddresses[0], []markertypes.Access{markertypes.Access_Transfer, markertypes.Access_Admin}), - *markertypes.NewAccessGrant(s.accountAddresses[1], []markertypes.Access{markertypes.Access_Transfer, markertypes.Access_Admin}), - *markertypes.NewAccessGrant(s.accountAddresses[2], []markertypes.Access{markertypes.Access_Transfer, markertypes.Access_Admin}), - }, - AllowForcedTransfer: false, - }, - { - BaseAccount: &authtypes.BaseAccount{ - Address: markertypes.MustGetMarkerAddress("hodlercoin").String(), - AccountNumber: 150, - Sequence: 0, - }, - Status: markertypes.StatusActive, - SupplyFixed: false, - MarkerType: markertypes.MarkerType_RestrictedCoin, - AllowGovernanceControl: false, - Supply: sdkmath.NewInt(3000), - Denom: "hodlercoin", - AllowForcedTransfer: true, - }, - } - for _, marker := range markerData.Markers { - var mNav types.MarkerNetAssetValues - mNav.Address = marker.GetAddress().String() - mNav.NetAssetValues = []types.NetAssetValue{types.NewNetAssetValue(sdk.NewInt64Coin(types.UsdDenom, 100), 100)} - markerData.NetAssetValues = append(markerData.NetAssetValues, mNav) - } - for i := len(markerData.Markers); i < s.markerCount; i++ { - denom := toWritten(i + 1) - markerData.Markers = append(markerData.Markers, - markertypes.MarkerAccount{ + testutil.MutateGenesisState(s.T(), &s.cfg, markertypes.ModuleName, &markertypes.GenesisState{}, func(markerData *markertypes.GenesisState) *markertypes.GenesisState { + markerData.Params.EnableGovernance = true + markerData.Params.MaxTotalSupply = 1000000 + markerData.Params.MaxSupply = sdkmath.NewInt(1000000) + + // Define some specific markers to use in the tests. + // Note: These account numbers get ignored. + newMarkers := []markertypes.MarkerAccount{ + { + BaseAccount: &authtypes.BaseAccount{ + Address: markertypes.MustGetMarkerAddress("testcoin").String(), + AccountNumber: 100, + Sequence: 0, + }, + Status: markertypes.StatusActive, + SupplyFixed: true, + MarkerType: markertypes.MarkerType_Coin, + AllowGovernanceControl: false, + Supply: sdkmath.NewInt(1000), + Denom: "testcoin", + AllowForcedTransfer: false, + }, + { + BaseAccount: &authtypes.BaseAccount{ + Address: markertypes.MustGetMarkerAddress("lockedcoin").String(), + AccountNumber: 110, + Sequence: 0, + }, + Status: markertypes.StatusActive, + SupplyFixed: true, + MarkerType: markertypes.MarkerType_RestrictedCoin, + AllowGovernanceControl: false, + Supply: sdkmath.NewInt(1000), + Denom: "lockedcoin", + AllowForcedTransfer: false, + }, + { BaseAccount: &authtypes.BaseAccount{ - Address: markertypes.MustGetMarkerAddress(denom).String(), - AccountNumber: uint64(i * 10), + Address: markertypes.MustGetMarkerAddress("propcoin").String(), + AccountNumber: 120, + Sequence: 0, + }, + Status: markertypes.StatusActive, + SupplyFixed: true, + MarkerType: markertypes.MarkerType_Coin, + AllowGovernanceControl: true, + Supply: sdkmath.NewInt(1000), + Denom: "propcoin", + AllowForcedTransfer: false, + }, + { + BaseAccount: &authtypes.BaseAccount{ + Address: markertypes.MustGetMarkerAddress(s.cfg.BondDenom).String(), + AccountNumber: 130, Sequence: 0, }, Status: markertypes.StatusActive, SupplyFixed: false, MarkerType: markertypes.MarkerType_Coin, AllowGovernanceControl: true, - Supply: sdkmath.NewInt(int64(i * 100000)), - Denom: denom, + Supply: s.cfg.BondedTokens.MulRaw(int64(s.cfg.NumValidators)), + Denom: s.cfg.BondDenom, AllowForcedTransfer: false, }, - ) - var mNav types.MarkerNetAssetValues - mNav.Address = markertypes.MustGetMarkerAddress(denom).String() - mNav.NetAssetValues = []types.NetAssetValue{types.NewNetAssetValue(sdk.NewInt64Coin(types.UsdDenom, 100), 100)} - markerData.NetAssetValues = append(markerData.NetAssetValues, mNav) - } - markerDataBz, err := cfg.Codec.MarshalJSON(&markerData) - s.Require().NoError(err) - genesisState[markertypes.ModuleName] = markerDataBz + { + BaseAccount: &authtypes.BaseAccount{ + Address: markertypes.MustGetMarkerAddress("authzhotdog").String(), + AccountNumber: 140, + Sequence: 0, + }, + Status: markertypes.StatusActive, + SupplyFixed: true, + MarkerType: markertypes.MarkerType_RestrictedCoin, + AllowGovernanceControl: false, + Supply: sdkmath.NewInt(1000), + Denom: "authzhotdog", + AccessControl: []markertypes.AccessGrant{ + *markertypes.NewAccessGrant(s.accountAddresses[0], []markertypes.Access{markertypes.Access_Transfer, markertypes.Access_Admin}), + *markertypes.NewAccessGrant(s.accountAddresses[1], []markertypes.Access{markertypes.Access_Transfer, markertypes.Access_Admin}), + *markertypes.NewAccessGrant(s.accountAddresses[2], []markertypes.Access{markertypes.Access_Transfer, markertypes.Access_Admin}), + }, + AllowForcedTransfer: false, + }, + { + BaseAccount: &authtypes.BaseAccount{ + Address: markertypes.MustGetMarkerAddress(s.holderDenom).String(), + AccountNumber: 150, + Sequence: 0, + }, + Status: markertypes.StatusActive, + SupplyFixed: false, + MarkerType: markertypes.MarkerType_RestrictedCoin, + AllowGovernanceControl: false, + Supply: sdkmath.NewInt(3000), + Denom: s.holderDenom, + AllowForcedTransfer: true, + }, + } + markerData.Markers = append(markerData.Markers, newMarkers...) + + // And define a NAV for each new marker. + for _, marker := range newMarkers { + var mNav types.MarkerNetAssetValues + mNav.Address = marker.GetAddress().String() + mNav.NetAssetValues = []types.NetAssetValue{types.NewNetAssetValue(sdk.NewInt64Coin(types.UsdDenom, 100), 100)} + markerData.NetAssetValues = append(markerData.NetAssetValues, mNav) + } - // Pre-define an accountdata entry - attrData := attrtypes.DefaultGenesisState() - attrData.Attributes = append(attrData.Attributes, - attrtypes.Attribute{ - Name: attrtypes.AccountDataName, - Value: []byte("Do not sell this coin."), - AttributeType: attrtypes.AttributeType_String, - Address: markerData.Markers[5].Address, // Should be hodlercoin's address. - }, - ) - attrDataBz, err := cfg.Codec.MarshalJSON(attrData) - s.Require().NoError(err, "MarshalJSON(attrData)") - genesisState[attrtypes.ModuleName] = attrDataBz + // Now create more markers (and their navs) until we have s.markerCount of them. + for i := len(markerData.Markers); i < s.markerCount; i++ { + denom := toWritten(i + 1) + markerData.Markers = append(markerData.Markers, + markertypes.MarkerAccount{ + BaseAccount: &authtypes.BaseAccount{ + Address: markertypes.MustGetMarkerAddress(denom).String(), + AccountNumber: uint64(i * 10), + Sequence: 0, + }, + Status: markertypes.StatusActive, + SupplyFixed: false, + MarkerType: markertypes.MarkerType_Coin, + AllowGovernanceControl: true, + Supply: sdkmath.NewInt(int64(i * 100000)), + Denom: denom, + AllowForcedTransfer: false, + }, + ) + var mNav types.MarkerNetAssetValues + mNav.Address = markertypes.MustGetMarkerAddress(denom).String() + mNav.NetAssetValues = []types.NetAssetValue{types.NewNetAssetValue(sdk.NewInt64Coin(types.UsdDenom, 100), 100)} + markerData.NetAssetValues = append(markerData.NetAssetValues, mNav) + } + + return markerData + }) - cfg.GenesisState = genesisState - cfg.ChainID = antewrapper.SimAppChainID - cfg.TimeoutCommit = 500 * time.Millisecond + // Pre-define an accountdata entry + testutil.MutateGenesisState(s.T(), &s.cfg, attrtypes.ModuleName, &attrtypes.GenesisState{}, func(attrData *attrtypes.GenesisState) *attrtypes.GenesisState { + attrData.Attributes = append(attrData.Attributes, + attrtypes.Attribute{ + Name: attrtypes.AccountDataName, + Value: []byte("Do not sell this coin."), + AttributeType: attrtypes.AttributeType_String, + Address: markertypes.MustGetMarkerAddress(s.holderDenom).String(), + }, + ) + return attrData + }) - s.testnet, err = testnet.New(s.T(), s.T().TempDir(), cfg) + var err error + s.testnet, err = testnet.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "creating testnet") _, err = testutil.WaitForHeight(s.testnet, 1) @@ -455,7 +447,7 @@ func (s *IntegrationTestSuite) TestMarkerQueryCommands() { []string{ fmt.Sprintf("--%s=json", cmtcli.OutputFlag), }, - `{"max_total_supply":"1000000","enable_governance":true,"unrestricted_denom_regex":"","max_supply":"1000000"}`, + `{"max_total_supply":"1000000","enable_governance":true,"unrestricted_denom_regex":"[a-zA-Z][a-zA-Z0-9\\-\\.]{2,83}","max_supply":"1000000"}`, }, { "get testcoin marker json", @@ -525,7 +517,7 @@ func (s *IntegrationTestSuite) TestMarkerQueryCommands() { address: cosmos1ae2206l700zfkxyqvd6cwn3gddas3rjy6z6g4u pub_key: null sequence: "0" - denom: hodlercoin + denom: ` + s.holderDenom + ` manager: "" marker_type: MARKER_TYPE_RESTRICTED required_attributes: [] @@ -560,7 +552,7 @@ func (s *IntegrationTestSuite) TestMarkerQueryCommands() { { name: "account data", cmd: markercli.AccountDataCmd(), - args: []string{"hodlercoin"}, + args: []string{s.holderDenom}, expectedOutput: "value: Do not sell this coin.", }, { @@ -571,8 +563,6 @@ func (s *IntegrationTestSuite) TestMarkerQueryCommands() { }, } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx @@ -602,7 +592,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { fmt.Sprintf("--%s=%s", markercli.FlagAllowGovernanceControl, "true"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -617,7 +607,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { fmt.Sprintf("--%s=%s", markercli.FlagAllowGovernanceControl, "true"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -632,7 +622,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { fmt.Sprintf("--%s=%s", markercli.FlagAllowGovernanceControl, "wrong"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 0, @@ -647,7 +637,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { fmt.Sprintf("--%s=%s", markercli.FlagAllowGovernanceControl, "true"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 0, @@ -662,7 +652,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { fmt.Sprintf("--%s=%s", markercli.FlagSpendLimit, sdk.NewInt64Coin("stake", 100)), fmt.Sprintf("--%s=%s", markercli.FlagExpiration, getFormattedExpiration(oneYear)), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 4, @@ -676,7 +666,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "admin", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -690,7 +680,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "mint,burn,transfer,withdraw,deposit", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -702,7 +692,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "100hotdog", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -714,7 +704,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "100hotdog", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -726,7 +716,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "hotdog", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -738,7 +728,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "hotdog", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -753,7 +743,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { fmt.Sprintf("--%s=%s", markercli.FlagSpendLimit, sdk.NewInt64Coin("stake", 100)), fmt.Sprintf("--%s=%s", markercli.FlagExpiration, getFormattedExpiration(oneYear)), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -764,12 +754,12 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { []string{ "hotdog", s.testnet.Validators[0].Address.String(), - s.accountAddresses[0].String(), + s.accountAddresses[1].String(), fmt.Sprintf("--%s=%v", markercli.FlagPeriod, oneHour), fmt.Sprintf("--%s=%s", markercli.FlagPeriodLimit, sdk.NewInt64Coin("stake", 100)), fmt.Sprintf("--%s=%s", markercli.FlagExpiration, getFormattedExpiration(oneYear)), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -782,7 +772,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "incorrect-denom-blah", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 0, @@ -796,7 +786,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "invalid-recipient", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 0, @@ -810,7 +800,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { s.accountAddresses[0].String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -823,7 +813,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "200hotdog", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -837,7 +827,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "100hotdog", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 0, @@ -851,7 +841,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "100hotdog", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 0, @@ -865,7 +855,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "hotdog", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 0, @@ -879,7 +869,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "100hotdog,200koinz", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 0, @@ -893,7 +883,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "100hotdog", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -906,7 +896,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { fmt.Sprintf("--%s", attrcli.FlagValue), "Not as good as corndog.", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -921,7 +911,7 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "hotdog", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -933,9 +923,10 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { "hotdog", fmt.Sprintf("--%s", attrcli.FlagValue), "Better than corndog.", fmt.Sprintf("--%s", markercli.FlagGovProposal), + "--title", "Set hotdog account data", "--summary", "Something unique to help identify this proposal. B65B", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErr: false, @@ -945,19 +936,19 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) + if tc.expectErr { s.Require().Error(err) } else { 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) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "txResp.Code") } }) } @@ -982,41 +973,33 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { args: []string{markertypes.MustGetMarkerAddress("hotdog").String()}, expOut: []string{"value: Not as good as corndog."}, }, - // TODO[1760]: gov: Put back once we know how to query proposals again. - /* - { - name: "gov prop created for account data", - cmd: govcli.GetCmdQueryProposals(), - expOut: []string{ - "'@type': /provenance.marker.v1.MsgSetAccountDataRequest", - "denom: hotdog", - "signer: " + authtypes.NewModuleAddress(govtypes.ModuleName).String(), - "value: Better than corndog.", - }, + { + name: "gov prop created for account data cmd", + cmd: queries.CmdGetAllGovProps(s.testnet), + expOut: []string{ + "'@type': /provenance.marker.v1.MsgSetAccountDataRequest", + "denom: hotdog", + "signer: " + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + "value: Better than corndog.", }, - */ + }, } for _, check := range checks { s.Run(check.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx cmdName := check.cmd.Name() - var outStr string - defer func() { - if s.T().Failed() { - s.T().Logf("Command: %s\nArgs: %q\nOutput:\n%s", cmdName, check.args, outStr) - } - }() - if check.args == nil { check.args = []string{} } out, err := clitestutil.ExecTestCLICmd(clientCtx, check.cmd, check.args) - outStr = out.String() - s.Require().NoError(err, "ExecTestCLICmd %s command", cmdName) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmdName, check.args, string(outBz)) + + s.Require().NoError(err, "ExecTestCLICmd %s %q", cmdName, check.args) for _, exp := range check.expOut { - s.Assert().Contains(outStr, exp, "%s command output", cmdName) + s.Assert().Contains(string(outBz), exp, "%s command output", cmdName) } }) } @@ -1087,9 +1070,10 @@ func (s *IntegrationTestSuite) TestMarkerIbcTransfer() { } for _, tc := range testCases { - tc := tc s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx + + cmd := markercli.GetIbcTransferTxCmd() args := []string{ tc.srcPort, tc.srcChannel, @@ -1099,7 +1083,7 @@ func (s *IntegrationTestSuite) TestMarkerIbcTransfer() { } args = append(args, []string{fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }...) if len(tc.flagPacketTimeoutHeight) > 0 { @@ -1111,11 +1095,17 @@ func (s *IntegrationTestSuite) TestMarkerIbcTransfer() { if len(tc.flagMemo) > 0 { args = append(args, fmt.Sprintf("--%s=%s", markercli.FlagMemo, tc.flagMemo)) } - _, err := clitestutil.ExecTestCLICmd(clientCtx, markercli.GetIbcTransferTxCmd(), args) + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) + if len(tc.expectedErr) > 0 { s.Assert().EqualError(err, tc.expectedErr) } else { s.Assert().NoError(err, tc.name) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(0, int(txResp.Code), "txResp.Code") } }) } @@ -1194,23 +1184,24 @@ func (s *IntegrationTestSuite) TestMarkerAuthzTxCommands() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) + cmd := markercli.GetCmdGrantAuthorization() tc.args = append(tc.args, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation)) - tc.args = append(tc.args, fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync)) // TODO[1760]: broadcast + tc.args = append(tc.args, fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync)) tc.args = append(tc.args, fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String())) out, err := clitestutil.ExecTestCLICmd(clientCtx, markercli.GetCmdGrantAuthorization(), tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), tc.args, string(outBz)) + if len(tc.expectedErr) > 0 { s.Assert().EqualError(err, tc.expectedErr) } else { s.Assert().NoError(err) - s.Assert().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) - s.Assert().Equal(tc.expectedCode, txResp.Code) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "txResp.Code") } }) } @@ -1292,8 +1283,6 @@ func (s *IntegrationTestSuite) TestMarkerTxGovProposals() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx p, err := os.CreateTemp("", "*") @@ -1305,25 +1294,28 @@ func (s *IntegrationTestSuite) TestMarkerTxGovProposals() { s.Require().NoError(p.Sync()) s.Require().NoError(p.Close()) + cmd := markercli.GetCmdMarkerProposal() args := []string{ tc.proposaltype, tmpFile, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), fmt.Sprintf("--%s=%s", flags.FlagGas, "500000"), } - s.T().Logf("args: %q", args) - out, err := clitestutil.ExecTestCLICmd(clientCtx, markercli.GetCmdMarkerProposal(), args) + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) + if tc.expectErr { s.Require().Error(err) } else { 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, txResp.RawLog) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "txResp.Code") } s.Require().NoError(os.Remove(tmpFile)) @@ -1455,9 +1447,9 @@ func getFormattedExpiration(duration int64) string { func (s *IntegrationTestSuite) TestAddFinalizeActivateMarkerTxCommands() { getAccessGrantString := func(address sdk.AccAddress, anotherAddress sdk.AccAddress) string { if anotherAddress != nil { - return address.String() + ",mint,admin;" + anotherAddress.String() + ",burn" + return address.String() + ",mint,admin,transfer;" + anotherAddress.String() + ",burn" } - return address.String() + ",mint,admin;" + return address.String() + ",mint,admin,transfer;" } testCases := []struct { @@ -1479,7 +1471,7 @@ func (s *IntegrationTestSuite) TestAddFinalizeActivateMarkerTxCommands() { fmt.Sprintf("--%s=%s", markercli.FlagAllowGovernanceControl, "true"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -1495,7 +1487,7 @@ func (s *IntegrationTestSuite) TestAddFinalizeActivateMarkerTxCommands() { fmt.Sprintf("--%s=%s", markercli.FlagAllowGovernanceControl, "true"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -1510,7 +1502,7 @@ func (s *IntegrationTestSuite) TestAddFinalizeActivateMarkerTxCommands() { fmt.Sprintf("--%s=%s", markercli.FlagAllowGovernanceControl, "true"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 0, @@ -1526,7 +1518,7 @@ func (s *IntegrationTestSuite) TestAddFinalizeActivateMarkerTxCommands() { fmt.Sprintf("--%s=%s", markercli.FlagAllowGovernanceControl, "true"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, false, &sdk.TxResponse{}, 0, @@ -1542,7 +1534,7 @@ func (s *IntegrationTestSuite) TestAddFinalizeActivateMarkerTxCommands() { fmt.Sprintf("--%s=%s", markercli.FlagAllowGovernanceControl, "wrong"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 0, @@ -1558,7 +1550,7 @@ func (s *IntegrationTestSuite) TestAddFinalizeActivateMarkerTxCommands() { fmt.Sprintf("--%s=%s", markercli.FlagAllowGovernanceControl, "true"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, true, &sdk.TxResponse{}, 0, @@ -1566,19 +1558,19 @@ func (s *IntegrationTestSuite) TestAddFinalizeActivateMarkerTxCommands() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) + if tc.expectErr { s.Require().Error(err) } else { 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) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "txResp.Code") } }) } @@ -1598,7 +1590,7 @@ func (s *IntegrationTestSuite) TestUpdateRequiredAttributesTxCommand() { "newhotdog", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedError: "both add and remove lists cannot be empty", @@ -1614,7 +1606,7 @@ func (s *IntegrationTestSuite) TestUpdateRequiredAttributesTxCommand() { fmt.Sprintf("--%s=%s", govcli.FlagDeposit, "blah"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedError: "invalid deposit: invalid decimal coin expression: blah", @@ -1625,12 +1617,12 @@ func (s *IntegrationTestSuite) TestUpdateRequiredAttributesTxCommand() { args: []string{ "newhotdog", fmt.Sprintf("--%s=%s", markercli.FlagGovProposal, "true"), + "--title", "Update newhotdog req attrs", "--summary", "See title.", fmt.Sprintf("--%s=%s", markercli.FlagAdd, "foo.provenance.io"), fmt.Sprintf("--%s=%s", markercli.FlagRemove, "bar.provenance.io"), - fmt.Sprintf("--%s=%s", govcli.FlagDeposit, "100jackthecat"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, }, @@ -1640,26 +1632,28 @@ func (s *IntegrationTestSuite) TestUpdateRequiredAttributesTxCommand() { args: []string{ "newhotdog", fmt.Sprintf("--%s=%s", markercli.FlagAdd, "foo.provenance.io"), - fmt.Sprintf("--%s=%s", markercli.FlagRemove, "bar.provenance.io"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, }, } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { clientCtx := s.testnet.Validators[0].ClientCtx - _, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) + out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) + if len(tc.expectedError) > 0 { s.Require().EqualError(err, tc.expectedError) } else { s.Require().NoError(err) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(0, int(txResp.Code), "txResp.Code") } }) } @@ -1667,47 +1661,57 @@ func (s *IntegrationTestSuite) TestUpdateRequiredAttributesTxCommand() { func (s *IntegrationTestSuite) TestGetCmdUpdateForcedTransfer() { denom := "updateftcoin" - argsWStdFlags := func(args ...string) []string { - return append(args, - fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), - ) - } - s.Run("add a new marker for this", func() { cmd := markercli.GetCmdAddFinalizeActivateMarker() - args := argsWStdFlags( - "1000"+denom, - s.testnet.Validators[0].Address.String()+",mint,burn,deposit,withdraw,delete,admin,transfer", + args := []string{ + "1000" + denom, + s.testnet.Validators[0].Address.String() + ",mint,burn,deposit,withdraw,delete,admin,transfer", fmt.Sprintf("--%s=%s", markercli.FlagType, "RESTRICTED"), - "--"+markercli.FlagSupplyFixed, - "--"+markercli.FlagAllowGovernanceControl, - ) + "--" + markercli.FlagSupplyFixed, + "--" + markercli.FlagAllowGovernanceControl, + fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), + } clientCtx := s.testnet.Validators[0].ClientCtx out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - s.Require().NoError(err, "CmdAddFinalizeActivateMarker error") outBz := out.Bytes() - outStr := string(outBz) - var resp sdk.TxResponse - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(outBz, &resp), "error unmarshalling response JSON:\n%s", outStr) - s.Require().Equal(0, int(resp.Code), "response code:\n%s", outStr) + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) + s.Require().NoError(err, "CmdAddFinalizeActivateMarker error") + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(0, int(txResp.Code), "txResp.Code") }) if s.T().Failed() { s.FailNow("Stopping due to setup error") } + argsWStdFlags := func(denom string, args ...string) []string { + var rv []string + rv = append(rv, denom) + rv = append(rv, args...) + rv = append(rv, + "--title", "Update ft of "+denom, "--summary", "whatever", + fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), + ) + return rv + } + tests := []struct { - name string - args []string - expErr string - incLog bool // set to true to log the output regardless of failure + name string + args []string + expErr string + expCode uint32 + expInRawLog string }{ { - name: "invalid denom", - args: argsWStdFlags("x", "true"), - expErr: "invalid denom: x", + name: "invalid denom", + args: argsWStdFlags("x", "true"), + expCode: 12, + expInRawLog: "invalid denom: x", }, { name: "invalid bool", @@ -1731,29 +1735,47 @@ func (s *IntegrationTestSuite) TestGetCmdUpdateForcedTransfer() { clientCtx := s.testnet.Validators[0].ClientCtx out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) outBz := out.Bytes() - outStr := string(outBz) + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), tc.args, string(outBz)) + outStr := string(outBz) if len(tc.expErr) > 0 { s.Require().EqualError(err, tc.expErr, "CmdUpdateForcedTransfer error") s.Require().Contains(outStr, tc.expErr, "CmdUpdateForcedTransfer output") } else { s.Require().NoError(err, "CmdUpdateForcedTransfer error") - s.Assert().Contains(outStr, `{\"key\":\"action\",\"value\":\"/cosmos.gov.v1.MsgSubmitProposal\"}`) - s.Assert().Contains(outStr, `{\"key\":\"proposal_messages\",\"value\":\",/provenance.marker.v1.MsgUpdateForcedTransferRequest\"}`) - } - if tc.incLog || s.T().Failed() { - // if the test failed, or it was requested, log the output of the command. - // If it's JSON, then pretty-print it, otherwise, just print it raw. - logMsg := outStr - var resp sdk.TxResponse - err = clientCtx.Codec.UnmarshalJSON(outBz, &resp) - if err == nil { - asJSON, err := json.MarshalIndent(resp, "", " ") - if err == nil { - logMsg = string(asJSON) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(int(tc.expCode), int(txResp.Code), "txResp.Code") + + if tc.expCode == 0 { + expAttrs := []abci.EventAttribute{ + { + Key: "action", + Value: "/cosmos.gov.v1.MsgSubmitProposal", + Index: true, + }, + { + Key: "proposal_messages", + Value: ",/provenance.marker.v1.MsgUpdateForcedTransferRequest", + Index: true, + }, + } + + var actAttrs []abci.EventAttribute + for _, event := range txResp.Events { + actAttrs = append(actAttrs, event.Attributes...) + } + + var missingAttrs []abci.EventAttribute + for _, exp := range expAttrs { + if !s.Assert().Contains(actAttrs, exp) { + missingAttrs = append(missingAttrs, exp) + } + } + if len(missingAttrs) > 0 { + s.T().Logf("Events:\n%s", strings.Join(assertions.ABCIEventsToStrings(txResp.Events), "\n")) + s.T().Logf("Missing Expected Attributes:\n%s", strings.Join(assertions.AttrsToStrings(missingAttrs), "\n")) } } - s.T().Logf("args: %q\noutput:\n%s", tc.args, logMsg) } }) } @@ -1765,7 +1787,7 @@ func (s *IntegrationTestSuite) TestGetCmdAddNetAssetValues() { return append(args, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), ) } @@ -1780,13 +1802,14 @@ func (s *IntegrationTestSuite) TestGetCmdAddNetAssetValues() { "--"+markercli.FlagAllowGovernanceControl, ) clientCtx := s.testnet.Validators[0].ClientCtx + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - s.Require().NoError(err, "CmdAddFinalizeActivateMarker error") outBz := out.Bytes() - outStr := string(outBz) - var resp sdk.TxResponse - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(outBz, &resp), "error unmarshalling response JSON:\n%s", outStr) - s.Require().Equal(0, int(resp.Code), "response code:\n%s", outStr) + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) + s.Require().NoError(err, "CmdAddFinalizeActivateMarker error") + + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(0, int(txResp.Code), "txResp.Code") }) if s.T().Failed() { s.FailNow("Stopping due to setup error") @@ -1796,7 +1819,6 @@ func (s *IntegrationTestSuite) TestGetCmdAddNetAssetValues() { name string args []string expErr string - incLog bool // set to true to log the output regardless of failure }{ { name: "invalid net asset string", @@ -1821,13 +1843,15 @@ func (s *IntegrationTestSuite) TestGetCmdAddNetAssetValues() { clientCtx := s.testnet.Validators[0].ClientCtx out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) outBz := out.Bytes() - outStr := string(outBz) + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), tc.args, string(outBz)) if len(tc.expErr) > 0 { s.Require().EqualError(err, tc.expErr, "GetCmdAddNetAssetValues error") - s.Require().Contains(outStr, tc.expErr, "GetCmdAddNetAssetValues output") + s.Require().Contains(string(outBz), tc.expErr, "GetCmdAddNetAssetValues output") } else { s.Require().NoError(err, "GetCmdAddNetAssetValues error") + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Require().Equal(0, int(txResp.Code), "txResp.Code") } }) } @@ -1878,16 +1902,16 @@ func (s *IntegrationTestSuite) TestParseAccessGrantFromString() { }, } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { + var actual []types.AccessGrant + testFunc := func() { + actual = markercli.ParseAccessGrantFromString(tc.accessGrantString) + } if tc.expPanic { - panicFunc := func() { markercli.ParseAccessGrantFromString(tc.accessGrantString) } - s.Assert().Panics(panicFunc) - + s.Require().Panics(testFunc, "ParseAccessGrantFromString") } else { - result := markercli.ParseAccessGrantFromString(tc.accessGrantString) - s.Assert().ElementsMatch(result, tc.expResult) + s.Require().NotPanics(testFunc, "ParseAccessGrantFromString") + s.Assert().ElementsMatch(actual, tc.expResult) } }) } @@ -1938,8 +1962,6 @@ func (s *IntegrationTestSuite) TestParseNetAssertValueString() { }, } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { result, err := markercli.ParseNetAssetValueString(tc.netAssetValues) if len(tc.expErr) > 0 { diff --git a/x/marker/types/tx.pb.go b/x/marker/types/tx.pb.go index 37e63a639d..a363fc3f8a 100644 --- a/x/marker/types/tx.pb.go +++ b/x/marker/types/tx.pb.go @@ -2241,131 +2241,132 @@ func init() { func init() { proto.RegisterFile("provenance/marker/v1/tx.proto", fileDescriptor_bcb203fb73175ed3) } var fileDescriptor_bcb203fb73175ed3 = []byte{ - // 1983 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x59, 0x4f, 0x6c, 0x1b, 0x59, - 0x19, 0xef, 0xe4, 0x8f, 0x1b, 0x7f, 0x6e, 0xd3, 0xe6, 0xc5, 0x49, 0x26, 0x53, 0xe2, 0x38, 0xee, - 0x3f, 0xef, 0xb2, 0xf1, 0x34, 0x5e, 0x28, 0xdd, 0x08, 0x09, 0xd9, 0x09, 0x2d, 0x15, 0x18, 0xad, - 0x9c, 0x05, 0x04, 0x17, 0x6b, 0x3c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dc, 0x15, 0xa2, 0x1f, 0x03, 0x9a, 0xee, 0x92, 0x50, 0xfd, 0x04, 0xff, 0x13, 0xda, 0x47, 0xed, - 0xcd, 0x33, 0xc9, 0x48, 0xf3, 0xef, 0xc2, 0xd2, 0x54, 0xfb, 0x82, 0x76, 0xb2, 0xca, 0x3c, 0xb1, - 0x5d, 0xd3, 0xea, 0x67, 0x11, 0x11, 0xb6, 0x9b, 0xf6, 0x47, 0xcf, 0x4a, 0xca, 0xc7, 0xcf, 0x4a, - 0xca, 0x3f, 0x9e, 0x95, 0x94, 0x9f, 0x3f, 0x2f, 0x5d, 0xf8, 0xf8, 0x79, 0xe9, 0xc2, 0x5f, 0x9f, - 0x97, 0x2e, 0xc0, 0x9a, 0xe3, 0x25, 0xea, 0x7b, 0x5b, 0xf9, 0xd1, 0xf8, 0x5b, 0x53, 0xc4, 0xb2, - 0xed, 0x78, 0x63, 0x2b, 0xfd, 0x69, 0xf0, 0xd3, 0x34, 0x9f, 0x71, 0xbb, 0x39, 0xfe, 0xeb, 0xef, - 0x9b, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xc8, 0x13, 0xd1, 0x2a, 0xe0, 0x1f, 0x00, 0x00, + // 1990 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x59, 0xcd, 0x6f, 0x23, 0x59, + 0x11, 0x9f, 0xce, 0x87, 0x27, 0x2e, 0xcf, 0x64, 0x26, 0x2f, 0x4e, 0xd2, 0xe9, 0x21, 0x8e, 0xe3, + 0xf9, 0xf2, 0x2e, 0x1b, 0xf7, 0xc4, 0x0b, 0xc3, 0x6c, 0x84, 0x84, 0xec, 0x84, 0x19, 0x46, 0x60, + 0xb4, 0x72, 0x16, 0x10, 0x5c, 0xac, 0x76, 0xf7, 0x4b, 0x4f, 0x2b, 0x76, 0xb7, 0xa7, 0xdf, 0xb3, + 0x67, 0xb2, 0x12, 0x17,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e, 0xd7, 0x53, 0xf3, 0x5c, 0x7d, 0x95, 0xcb, 0x1f, 0x84, 0xe2, + 0x3d, 0x21, 0x45, 0x75, 0x58, 0x11, 0x96, 0x87, 0x9e, 0x6f, 0x62, 0xab, 0x13, 0x9c, 0x1c, 0x15, + 0xb8, 0xd9, 0x32, 0x17, 0xde, 0xe7, 0xb2, 0x77, 0xa4, 0x08, 0xe9, 0xb0, 0xec, 0xe3, 0xc7, 0x43, + 0xc7, 0xc7, 0x56, 0xc7, 0xa0, 0xd4, 0x77, 0xba, 0x43, 0x8a, 0x89, 0x5a, 0x28, 0xcf, 0x56, 0xf3, + 0x6d, 0x14, 0x88, 0x1a, 0xa1, 0x04, 0x6d, 0x42, 0x7e, 0x48, 0xac, 0x8e, 0x89, 0x5d, 0x4a, 0xd4, + 0x4b, 0x65, 0xa5, 0x3a, 0xd7, 0x9c, 0x51, 0x95, 0xf6, 0xc2, 0x90, 0x58, 0x7b, 0x6c, 0x0d, 0xad, + 0x42, 0x6e, 0xe4, 0xf5, 0x86, 0x7d, 0xac, 0x5e, 0x66, 0xd2, 0xb6, 0x7c, 0x42, 0xd7, 0x84, 0x61, + 0xdf, 0xe9, 0xf5, 0x88, 0xba, 0xc8, 0x45, 0xcc, 0xa8, 0xc5, 0x9e, 0x77, 0x97, 0x18, 0x95, 0x63, + 0x34, 0xa8, 0xac, 0x42, 0x31, 0xce, 0x55, 0x49, 0xe2, 0xdf, 0x28, 0x01, 0x89, 0x05, 0xd4, 0xe7, + 0x71, 0x54, 0xbf, 0x01, 0x39, 0x51, 0x24, 0x75, 0xf6, 0x6c, 0xb5, 0x95, 0x66, 0x89, 0x47, 0x31, + 0x4c, 0x20, 0x88, 0x53, 0x26, 0xf0, 0x0b, 0x05, 0x56, 0x5b, 0xc4, 0xde, 0xc7, 0x3d, 0x4c, 0xf1, + 0xf9, 0xe5, 0x70, 0x1b, 0xae, 0xf8, 0xb8, 0xef, 0x8d, 0x58, 0x21, 0xe5, 0x49, 0x12,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x1f, 0xb5, 0x37, 0xcf, 0x64, 0x23, 0xdd, 0xbf, 0x0b, 0x4b, 0x53, 0xed, + 0x0b, 0xda, 0xc9, 0xa2, 0x79, 0x62, 0xbb, 0xa6, 0xd5, 0xcf, 0x62, 0x22, 0x7c, 0x37, 0xed, 0x8f, + 0x9e, 0x95, 0x94, 0x8f, 0x9f, 0x95, 0x94, 0x7f, 0x3c, 0x2b, 0x29, 0x3f, 0x7f, 0x5e, 0xba, 0xf0, + 0xf1, 0xf3, 0xd2, 0x85, 0xbf, 0x3e, 0x2f, 0x5d, 0x80, 0x35, 0xc7, 0x4b, 0xdc, 0xef, 0x6d, 0xe5, + 0x47, 0xe3, 0xdf, 0x9a, 0x22, 0x95, 0x6d, 0xc7, 0x1b, 0x7b, 0xd2, 0x9f, 0x06, 0x3f, 0x57, 0xf3, + 0x19, 0xb7, 0x9b, 0xe3, 0xbf, 0x08, 0xbf, 0xf9, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa9, 0x7e, + 0x8a, 0x62, 0xf4, 0x1f, 0x00, 0x00, } func (this *MsgSupplyIncreaseProposalRequest) Equal(that interface{}) bool { From 0a8787899268fa83ced0bb2ad34c39f33551c0fe Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Fri, 19 Apr 2024 15:57:39 -0600 Subject: [PATCH 20/42] [1760]: Add validation to marker params to fix a test. --- x/marker/keeper/denom_test.go | 14 +++++++------- x/marker/keeper/params.go | 3 +++ x/marker/types/params.go | 11 +++++++++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/x/marker/keeper/denom_test.go b/x/marker/keeper/denom_test.go index e5c93a997b..1c9aeaddbd 100644 --- a/x/marker/keeper/denom_test.go +++ b/x/marker/keeper/denom_test.go @@ -3,16 +3,16 @@ package keeper_test import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" simapp "github.com/provenance-io/provenance/app" - + "github.com/provenance-io/provenance/testutil/assertions" "github.com/provenance-io/provenance/x/marker/types" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" ) type DenomTestSuite struct { @@ -34,9 +34,9 @@ func TestDenomTestSuite(t *testing.T) { } func (s *DenomTestSuite) TestInvalidDenomExpression() { s.T().Run("invalid denom expression", func(t *testing.T) { - assert.Panics(t, + assertions.AssertPanicContents(t, func() { s.app.MarkerKeeper.SetParams(s.ctx, types.Params{UnrestrictedDenomRegex: `(invalid`}) }, - "value from ParamSetPair is invalid: error parsing regexp: missing closing ): `^(invalid$`", + []string{"error parsing regexp: missing closing ): `^(invalid$`"}, ) }) } diff --git a/x/marker/keeper/params.go b/x/marker/keeper/params.go index 743cf1b7a6..daadc6062e 100644 --- a/x/marker/keeper/params.go +++ b/x/marker/keeper/params.go @@ -26,6 +26,9 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { // SetParams sets the marker parameters to the store. func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + if err := params.Validate(); err != nil { + panic(err) + } store := ctx.KVStore(k.storeKey) bz := k.cdc.MustMarshal(¶ms) store.Set(types.MarkerParamStoreKey, bz) diff --git a/x/marker/types/params.go b/x/marker/types/params.go index d701e01e1c..354dda0d18 100644 --- a/x/marker/types/params.go +++ b/x/marker/types/params.go @@ -1,6 +1,7 @@ package types import ( + "errors" "fmt" "regexp" @@ -117,6 +118,16 @@ func (p *Params) Equal(that interface{}) bool { return true } +func (p Params) Validate() error { + errs := []error{ + validateEnableGovernance(p.EnableGovernance), + validateIntParam(p.MaxTotalSupply), + validateRegexParam(p.UnrestrictedDenomRegex), + validateBigIntParam(p.MaxSupply), + } + return errors.Join(errs...) +} + func validateIntParam(i interface{}) error { _, ok := i.(uint64) if !ok { From 1fd34291ea14efc849711bbdb29190d4e687fe54 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Fri, 19 Apr 2024 16:43:51 -0600 Subject: [PATCH 21/42] [1760]: Allow ValidateUnrestictedDenom to pass if the regex is blank. Fix marker keeper unit tests. --- x/marker/keeper/export_test.go | 5 +++++ x/marker/keeper/keeper_test.go | 29 +++++++++++++++++++---------- x/marker/keeper/msg_server_test.go | 10 +++++----- x/marker/keeper/params.go | 3 +++ x/marker/keeper/params_test.go | 5 +++-- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/x/marker/keeper/export_test.go b/x/marker/keeper/export_test.go index 59f871de12..9b558a6a8c 100644 --- a/x/marker/keeper/export_test.go +++ b/x/marker/keeper/export_test.go @@ -52,3 +52,8 @@ func (k Keeper) WithAttrKeeper(attrKeeper types.AttrKeeper) Keeper { k.attrKeeper = attrKeeper return k } + +// SetNewMarker is a TEST ONLY function that calls NewMarker, then SetMarker. +func (k Keeper) SetNewMarker(ctx sdk.Context, marker types.MarkerAccountI) { + k.SetMarker(ctx, k.NewMarker(ctx, marker)) +} diff --git a/x/marker/keeper/keeper_test.go b/x/marker/keeper/keeper_test.go index ef478092fa..eeaffa3cd2 100644 --- a/x/marker/keeper/keeper_test.go +++ b/x/marker/keeper/keeper_test.go @@ -34,6 +34,13 @@ import ( "github.com/provenance-io/provenance/x/quarantine" ) +// setNewAccount updates the account's number, then stores the account. +func setNewAccount(app *simapp.App, ctx sdk.Context, acc sdk.AccountI) sdk.AccountI { + newAcc := app.AccountKeeper.NewAccount(ctx, acc) + app.AccountKeeper.SetAccount(ctx, newAcc) + return newAcc +} + func TestAccountMapperGetSet(t *testing.T) { app := simapp.Setup(t) ctx := app.BaseApp.NewContext(false) @@ -59,7 +66,7 @@ func TestAccountMapperGetSet(t *testing.T) { // set some values on the account and save it require.NoError(t, mac.GrantAccess(types.NewAccessGrant(user, []types.Access{types.Access_Mint, types.Access_Admin}))) - app.AccountKeeper.SetAccount(ctx, mac) + setNewAccount(app, ctx, acc) // check the new values acc = app.AccountKeeper.GetAccount(ctx, addr) @@ -99,7 +106,7 @@ func TestExistingAccounts(t *testing.T) { existingBalance := sdk.NewInt64Coin("coin", 1000) // prefund the marker address so an account gets created before the marker does. - app.AccountKeeper.SetAccount(ctx, authtypes.NewBaseAccount(user, pubkey, 0, 0)) + newAcc := setNewAccount(app, ctx, app.AccountKeeper.NewAccount(ctx, authtypes.NewBaseAccount(user, pubkey, 0, 0))) require.NoError(t, testutil.FundAccount(ctx, app.BankKeeper, addr, sdk.NewCoins(existingBalance)), "funding account") require.Equal(t, existingBalance, app.BankKeeper.GetBalance(ctx, addr, "coin"), "account balance must be set") @@ -115,7 +122,9 @@ func TestExistingAccounts(t *testing.T) { require.Error(t, err, "fails because marker already exists") // replace existing test account with a new copy that has a positive sequence number - app.AccountKeeper.SetAccount(ctx, authtypes.NewBaseAccount(user, pubkey, 0, 10)) + err = newAcc.SetSequence(10) + require.NoError(t, err, "newAcc.SetSequence(10)") + app.AccountKeeper.SetAccount(ctx, newAcc) // Creating a marker over an existing account with a positive sequence number fails. _, err = server.AddMarker(ctx, types.NewMsgAddMarkerRequest("testcoin", sdkmath.NewInt(30), user, manager, types.MarkerType_Coin, true, true, false, []string{}, 0, 0)) @@ -829,7 +838,7 @@ func TestInsufficientExisting(t *testing.T) { // setup an existing account with an existing balance (and matching supply) existingSupply := sdk.NewInt64Coin("testcoin", 10000) - app.AccountKeeper.SetAccount(ctx, authtypes.NewBaseAccount(user, pubkey, 0, 0)) + setNewAccount(app, ctx, authtypes.NewBaseAccount(user, pubkey, 0, 0)) require.NoError(t, testutil.FundAccount(ctx, app.BankKeeper, user, sdk.NewCoins(existingSupply)), "funding account") @@ -1601,7 +1610,7 @@ func TestCanForceTransferFrom(t *testing.T) { Supply: sdkmath.NewInt(0), MarkerType: types.MarkerType_RestrictedCoin, } - app.AccountKeeper.SetAccount(ctx, acc) + setNewAccount(app, ctx, acc) return addr } @@ -1612,7 +1621,7 @@ func TestCanForceTransferFrom(t *testing.T) { MarketId: 97531, MarketDetails: exchange.MarketDetails{}, } - app.AccountKeeper.SetAccount(ctx, acc) + setNewAccount(app, ctx, acc) return addr } @@ -1670,7 +1679,7 @@ func TestMarkerFeeGrant(t *testing.T) { // set some values on the account and save it require.NoError(t, mac.GrantAccess(types.NewAccessGrant(user, []types.Access{types.Access_Mint, types.Access_Admin}))) - app.AccountKeeper.SetAccount(ctx, mac) + setNewAccount(app, ctx, mac) existingSupply := sdk.NewInt64Coin("testcoin", 10000) require.NoError(t, testutil.FundAccount(types.WithBypass(ctx), app.BankKeeper, user, sdk.NewCoins(existingSupply)), "funding accont") @@ -1703,7 +1712,7 @@ func TestAddFinalizeActivateMarker(t *testing.T) { existingBalance := sdk.NewInt64Coin("coin", 1000) // prefund the marker address so an account gets created before the marker does. - app.AccountKeeper.SetAccount(ctx, authtypes.NewBaseAccount(user, pubkey, 0, 0)) + setNewAccount(app, ctx, authtypes.NewBaseAccount(user, pubkey, 0, 0)) require.NoError(t, testutil.FundAccount(ctx, app.BankKeeper, addr, sdk.NewCoins(existingBalance)), "funding account") require.Equal(t, existingBalance, app.BankKeeper.GetBalance(ctx, addr, "coin"), "account balance must be set") @@ -1775,7 +1784,7 @@ func TestInvalidAccount(t *testing.T) { manager := testUserAddress("manager") // replace existing test account with a new copy that has a positive sequence number - app.AccountKeeper.SetAccount(ctx, authtypes.NewBaseAccount(user, pubkey, 0, 10)) + setNewAccount(app, ctx, authtypes.NewBaseAccount(user, pubkey, 0, 10)) _, err := server.AddFinalizeActivateMarker(ctx, types.NewMsgAddFinalizeActivateMarkerRequest( "testcoin", @@ -2098,7 +2107,7 @@ func TestMsgUpdateRequiredAttributesRequest(t *testing.T) { reqAttr := []string{"foo.provenance.io", "*.provenance.io", "bar.provenance.io"} rMarkerDenom := "restricted-marker" rMarkerAcct := authtypes.NewBaseAccount(types.MustGetMarkerAddress(rMarkerDenom), nil, 0, 0) - app.MarkerKeeper.SetMarker(ctx, types.NewMarkerAccount(rMarkerAcct, sdk.NewInt64Coin(rMarkerDenom, 1000), transferAuthUser, []types.AccessGrant{{Address: transferAuthUser.String(), Permissions: []types.Access{types.Access_Transfer}}}, types.StatusFinalized, types.MarkerType_RestrictedCoin, true, true, false, reqAttr)) + app.MarkerKeeper.SetNewMarker(ctx, types.NewMarkerAccount(rMarkerAcct, sdk.NewInt64Coin(rMarkerDenom, 1000), transferAuthUser, []types.AccessGrant{{Address: transferAuthUser.String(), Permissions: []types.Access{types.Access_Transfer}}}, types.StatusFinalized, types.MarkerType_RestrictedCoin, true, true, false, reqAttr)) testCases := []struct { name string diff --git a/x/marker/keeper/msg_server_test.go b/x/marker/keeper/msg_server_test.go index ce779ffe1a..36fbb48de1 100644 --- a/x/marker/keeper/msg_server_test.go +++ b/x/marker/keeper/msg_server_test.go @@ -530,11 +530,11 @@ func (s *MsgServerTestSuite) TestUpdateSendDenyList() { rMarkerDenom := "restricted-marker" rMarkerAcct := authtypes.NewBaseAccount(types.MustGetMarkerAddress(rMarkerDenom), nil, 0, 0) - s.app.MarkerKeeper.SetMarker(s.ctx, types.NewMarkerAccount(rMarkerAcct, sdk.NewInt64Coin(rMarkerDenom, 1000), authUser, []types.AccessGrant{{Address: authUser.String(), Permissions: []types.Access{types.Access_Transfer}}}, types.StatusFinalized, types.MarkerType_RestrictedCoin, true, false, false, []string{})) + s.app.MarkerKeeper.SetNewMarker(s.ctx, types.NewMarkerAccount(rMarkerAcct, sdk.NewInt64Coin(rMarkerDenom, 1000), authUser, []types.AccessGrant{{Address: authUser.String(), Permissions: []types.Access{types.Access_Transfer}}}, types.StatusFinalized, types.MarkerType_RestrictedCoin, true, false, false, []string{})) rMarkerGovDenom := "restricted-marker-gov" rMarkerGovAcct := authtypes.NewBaseAccount(types.MustGetMarkerAddress(rMarkerGovDenom), nil, 0, 0) - s.app.MarkerKeeper.SetMarker(s.ctx, types.NewMarkerAccount(rMarkerGovAcct, sdk.NewInt64Coin(rMarkerGovDenom, 1000), authUser, []types.AccessGrant{{Address: authUser.String(), Permissions: []types.Access{}}}, types.StatusFinalized, types.MarkerType_RestrictedCoin, true, true, false, []string{})) + s.app.MarkerKeeper.SetNewMarker(s.ctx, types.NewMarkerAccount(rMarkerGovAcct, sdk.NewInt64Coin(rMarkerGovDenom, 1000), authUser, []types.AccessGrant{{Address: authUser.String(), Permissions: []types.Access{}}}, types.StatusFinalized, types.MarkerType_RestrictedCoin, true, true, false, []string{})) denyAddrToRemove := testUserAddress("denyAddrToRemove") s.app.MarkerKeeper.AddSendDeny(s.ctx, rMarkerAcct.GetAddress(), denyAddrToRemove) @@ -626,14 +626,14 @@ func (s *MsgServerTestSuite) TestAddNetAssetValue() { markerDenom := "jackthecat" markerAcct := authtypes.NewBaseAccount(types.MustGetMarkerAddress(markerDenom), nil, 0, 0) - s.app.MarkerKeeper.SetMarker(s.ctx, types.NewMarkerAccount(markerAcct, sdk.NewInt64Coin(markerDenom, 1000), authUser, []types.AccessGrant{{Address: authUser.String(), Permissions: []types.Access{types.Access_Transfer}}}, types.StatusProposed, types.MarkerType_RestrictedCoin, true, false, false, []string{})) + s.app.MarkerKeeper.SetNewMarker(s.ctx, types.NewMarkerAccount(markerAcct, sdk.NewInt64Coin(markerDenom, 1000), authUser, []types.AccessGrant{{Address: authUser.String(), Permissions: []types.Access{types.Access_Transfer}}}, types.StatusProposed, types.MarkerType_RestrictedCoin, true, false, false, []string{})) valueAcct := authtypes.NewBaseAccount(types.MustGetMarkerAddress(types.UsdDenom), nil, 0, 0) - s.app.MarkerKeeper.SetMarker(s.ctx, types.NewMarkerAccount(valueAcct, sdk.NewInt64Coin(types.UsdDenom, 1000), authUser, []types.AccessGrant{{Address: authUser.String(), Permissions: []types.Access{types.Access_Transfer}}}, types.StatusProposed, types.MarkerType_RestrictedCoin, true, false, false, []string{})) + s.app.MarkerKeeper.SetNewMarker(s.ctx, types.NewMarkerAccount(valueAcct, sdk.NewInt64Coin(types.UsdDenom, 1000), authUser, []types.AccessGrant{{Address: authUser.String(), Permissions: []types.Access{types.Access_Transfer}}}, types.StatusProposed, types.MarkerType_RestrictedCoin, true, false, false, []string{})) finalizedMarkerDenom := "finalizedjackthecat" finalizedMarkerAcct := authtypes.NewBaseAccount(types.MustGetMarkerAddress(finalizedMarkerDenom), nil, 1, 0) - s.app.MarkerKeeper.SetMarker(s.ctx, types.NewMarkerAccount(finalizedMarkerAcct, sdk.NewInt64Coin(finalizedMarkerDenom, 1000), authUser, []types.AccessGrant{{Address: authUser.String(), Permissions: []types.Access{types.Access_Transfer}}}, types.StatusFinalized, types.MarkerType_RestrictedCoin, true, false, false, []string{})) + s.app.MarkerKeeper.SetNewMarker(s.ctx, types.NewMarkerAccount(finalizedMarkerAcct, sdk.NewInt64Coin(finalizedMarkerDenom, 1000), authUser, []types.AccessGrant{{Address: authUser.String(), Permissions: []types.Access{types.Access_Transfer}}}, types.StatusFinalized, types.MarkerType_RestrictedCoin, true, false, false, []string{})) testCases := []struct { name string diff --git a/x/marker/keeper/params.go b/x/marker/keeper/params.go index daadc6062e..7bf647ccd3 100644 --- a/x/marker/keeper/params.go +++ b/x/marker/keeper/params.go @@ -59,6 +59,9 @@ func (k Keeper) ValidateUnrestictedDenom(ctx sdk.Context, denom string) error { // Anchors are enforced on the denom validation expression. Similar to how the SDK does hits. // https://github.com/cosmos/cosmos-sdk/blob/512b533242d34926972a8fc2f5639e8cf182f5bd/types/coin.go#L625 exp := k.GetUnrestrictedDenomRegex(ctx) + if len(exp) == 0 { + return nil + } r := regexp.MustCompile(fmt.Sprintf(`^%s$`, exp)) if !r.MatchString(denom) { return fmt.Errorf("invalid denom [%s] (fails unrestricted marker denom validation %s)", denom, exp) diff --git a/x/marker/keeper/params_test.go b/x/marker/keeper/params_test.go index 57c3e317a7..06072a9c82 100644 --- a/x/marker/keeper/params_test.go +++ b/x/marker/keeper/params_test.go @@ -5,11 +5,12 @@ import ( "time" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/provenance-io/provenance/app" simapp "github.com/provenance-io/provenance/app" "github.com/provenance-io/provenance/x/marker/types" - "github.com/stretchr/testify/suite" ) type ParamTestSuite struct { @@ -37,7 +38,7 @@ func (s *ParamTestSuite) TestGetSetParams() { newMaxTotalSupply := uint64(2000000) newEnableGovernance := false - newUnrestrictedDenomRegex := "^xyz.*$" + newUnrestrictedDenomRegex := "xyz.*" newMaxSupply := "3000000" newParams := types.Params{ From 17ac8a618020de4cf1dfe035631389a5879601d2 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Fri, 19 Apr 2024 17:14:17 -0600 Subject: [PATCH 22/42] [1760]: Fix the rest of the marker tests. --- x/marker/abci_test.go | 2 +- x/marker/simulation/operations.go | 7 +++++ x/marker/simulation/operations_test.go | 36 +++++++++++++++----------- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/x/marker/abci_test.go b/x/marker/abci_test.go index b26dfe3b07..96edf9caa7 100644 --- a/x/marker/abci_test.go +++ b/x/marker/abci_test.go @@ -30,7 +30,7 @@ func TestBeginBlocker(t *testing.T) { Supply: sdkmath.NewInt(100), } - app.MarkerKeeper.SetMarker(ctx, testmint) + app.MarkerKeeper.SetMarker(ctx, app.MarkerKeeper.NewMarker(ctx, testmint)) // Initial supply of testmint must be zero. require.Equal(t, app.BankKeeper.GetSupply(ctx, "testmint").Amount, sdkmath.NewInt(0)) diff --git a/x/marker/simulation/operations.go b/x/marker/simulation/operations.go index cfab08c66d..01e10bf96a 100644 --- a/x/marker/simulation/operations.go +++ b/x/marker/simulation/operations.go @@ -277,6 +277,8 @@ func SimulateMsgAddMarkerProposal(k keeper.Keeper, args *WeightedOpsArgs) simtyp Msg: msg, Deposit: govMinDep, Comment: "marker", + Title: fmt.Sprintf("Add Marker %s", denom), + Summary: fmt.Sprintf("Create the %q marker.", denom), } skip, opMsg, err := SendGovMsg(msgArgs) @@ -559,6 +561,9 @@ type SendGovMsgArgs struct { Msg sdk.Msg Deposit sdk.Coins Comment string + + Title string + Summary string } // SendGovMsg sends a msg as a gov prop. @@ -586,6 +591,8 @@ func SendGovMsg(args *SendGovMsgArgs) (bool, simtypes.OperationMsg, error) { InitialDeposit: args.Deposit, Proposer: args.Sender.Address.String(), Metadata: "", + Title: args.Title, + Summary: args.Summary, } txCtx := simulation.OperationInput{ diff --git a/x/marker/simulation/operations_test.go b/x/marker/simulation/operations_test.go index e57fb12088..bc816727d8 100644 --- a/x/marker/simulation/operations_test.go +++ b/x/marker/simulation/operations_test.go @@ -16,6 +16,7 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/bank/testutil" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "github.com/provenance-io/provenance/testutil/assertions" "github.com/provenance-io/provenance/app" simappparams "github.com/provenance-io/provenance/app/params" @@ -36,6 +37,7 @@ func TestSimTestSuite(t *testing.T) { } func (s *SimTestSuite) SetupTest() { + govtypes.DefaultMinDepositRatio = sdkmath.LegacyZeroDec() s.app = app.Setup(s.T()) s.ctx = s.app.BaseApp.NewContext(false) } @@ -127,9 +129,9 @@ func (s *SimTestSuite) TestWeightedOperations() { s.Require().Equal(expNames, actualNames, "operation message names") for i := range expected { - s.Require().Equal(expected[i].weight, weightedOps[i].Weight(), "weightedOps[i].Weight", i) - s.Require().Equal(expected[i].opMsgRoute, opMsgs[i].Route, "opMsgs[i].Route", i) - s.Require().Equal(expected[i].opMsgName, opMsgs[i].Name, "opMsgs[i].Name", i) + s.Require().Equal(expected[i].weight, weightedOps[i].Weight(), "weightedOps[%d].Weight", i) + s.Require().Equal(expected[i].opMsgRoute, opMsgs[i].Route, "opMsgs[%d].Route", i) + s.Require().Equal(expected[i].opMsgName, opMsgs[i].Name, "opMsgs[%d].Name", i) } } @@ -316,7 +318,6 @@ func (s *SimTestSuite) TestSimulateMsgAddMarkerProposal() { for _, tc := range tests { resetParams(s.T(), s.ctx) s.Run(tc.name, func() { - args := &simulation.SendGovMsgArgs{ WeightedOpsArgs: *s.getWeightedOpsArgs(), R: rand.New(rand.NewSource(1)), @@ -328,15 +329,19 @@ func (s *SimTestSuite) TestSimulateMsgAddMarkerProposal() { Msg: tc.msg, Deposit: tc.deposit, Comment: tc.comment, + Title: "Add marker " + tc.name, + Summary: "Create a marker for " + tc.name, } var skip bool var opMsg simtypes.OperationMsg - + var err error testFunc := func() { - skip, opMsg, _ = simulation.SendGovMsg(args) + skip, opMsg, err = simulation.SendGovMsg(args) } s.Require().NotPanics(testFunc, "SendGovMsg") + s.LogOperationMsg(opMsg) + assertions.AssertErrorContents(s.T(), err, tc.expInErr) s.Assert().Equal(tc.expSkip, skip, "SendGovMsg result skip bool") s.Assert().Equal(tc.expOpMsgRoute, opMsg.Route, "SendGovMsg result op msg route") @@ -485,15 +490,16 @@ func (s *SimTestSuite) getWeightedOpsArgs() *simulation.WeightedOpsArgs { // getLastGovProp gets the last gov prop to be submitted. func (s *SimTestSuite) getLastGovProp() *govtypes.Proposal { - // TODO[1760]: gov: Uncomment when you figure out how to get the last proposal again. - return nil - /* - props := s.app.GovKeeper.GetProposals(s.ctx) - if len(props) == 0 { - return nil - } - return props[len(props)-1] - */ + propID, err := s.app.GovKeeper.ProposalID.Peek(s.ctx) + if !s.Assert().NoError(err, "s.app.GovKeeper.ProposalID.Peek(s.ctx)") { + return nil + } + propID-- + prop, err := s.app.GovKeeper.Proposals.Get(s.ctx, propID) + if !s.Assert().NoError(err, "s.app.GovKeeper.Proposals.Get(s.ctx, %d)", propID) { + return nil + } + return &prop } // freshCtx creates a new context and sets it to this SimTestSuite's ctx field. From 0eab2a2486f058b3b3ed73dcacfde6986fffeceb Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Fri, 19 Apr 2024 17:21:13 -0600 Subject: [PATCH 23/42] [1760]: Fix metadata keeper tests. --- x/metadata/keeper/scope_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/metadata/keeper/scope_test.go b/x/metadata/keeper/scope_test.go index afdfb8ec75..ccb03b0d97 100644 --- a/x/metadata/keeper/scope_test.go +++ b/x/metadata/keeper/scope_test.go @@ -78,7 +78,7 @@ func (s *ScopeKeeperTestSuite) SetupTest() { s.scUserAddr = sdk.AccAddress("smart_contract_addr_") s.scUser = s.scUserAddr.String() - s.app.AccountKeeper.SetAccount(ctx, authtypes.NewBaseAccount(s.scUserAddr, nil, 0, 0)) + s.app.AccountKeeper.SetAccount(ctx, s.app.AccountKeeper.NewAccount(ctx, authtypes.NewBaseAccount(s.scUserAddr, nil, 0, 0))) s.scopeUUID = uuid.New() s.scopeID = types.ScopeMetadataAddress(s.scopeUUID) @@ -2447,7 +2447,7 @@ func (s *ScopeKeeperTestSuite) TestValidateUpdateValueOwners() { func (s *ScopeKeeperTestSuite) TestAddSetNetAssetValues() { markerDenom := "jackthecat" mAccount := authtypes.NewBaseAccount(markertypes.MustGetMarkerAddress(markerDenom), nil, 0, 0) - s.app.MarkerKeeper.SetMarker(s.FreshCtx(), markertypes.NewMarkerAccount(mAccount, sdk.NewInt64Coin(markerDenom, 1000), s.user1Addr, []markertypes.AccessGrant{{Address: s.user1, Permissions: []markertypes.Access{markertypes.Access_Transfer}}}, markertypes.StatusFinalized, markertypes.MarkerType_RestrictedCoin, true, true, false, []string{})) + s.app.MarkerKeeper.SetMarker(s.FreshCtx(), s.app.MarkerKeeper.NewMarker(s.FreshCtx(), markertypes.NewMarkerAccount(mAccount, sdk.NewInt64Coin(markerDenom, 1000), s.user1Addr, []markertypes.AccessGrant{{Address: s.user1, Permissions: []markertypes.Access{markertypes.Access_Transfer}}}, markertypes.StatusFinalized, markertypes.MarkerType_RestrictedCoin, true, true, false, []string{}))) scopeID := types.ScopeMetadataAddress(uuid.New()) tests := []struct { name string From 2a751c84367e7f68efc7086db82be678efd40b09 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Fri, 19 Apr 2024 17:31:09 -0600 Subject: [PATCH 24/42] [1760]: Add signers to all the metadata Msgs. --- .../provenance/metadata/v1/objectstore.proto | 5 + proto/provenance/metadata/v1/tx.proto | 25 ++ x/metadata/types/objectstore.pb.go | 45 +-- x/metadata/types/tx.pb.go | 291 +++++++++--------- 4 files changed, 201 insertions(+), 165 deletions(-) diff --git a/proto/provenance/metadata/v1/objectstore.proto b/proto/provenance/metadata/v1/objectstore.proto index c892d88f46..0cc5e91efa 100644 --- a/proto/provenance/metadata/v1/objectstore.proto +++ b/proto/provenance/metadata/v1/objectstore.proto @@ -1,6 +1,9 @@ syntax = "proto3"; package provenance.metadata.v1; + +import "cosmos/msg/v1/msg.proto"; import "gogoproto/gogo.proto"; + option go_package = "github.com/provenance-io/provenance/x/metadata/types"; option java_package = "io.provenance.metadata.v1"; @@ -9,6 +12,8 @@ option java_multiple_files = true; // Defines an Locator object stored on chain, which represents a owner( blockchain address) associated with a endpoint // uri for it's associated object store. message ObjectStoreLocator { + option (cosmos.msg.v1.signer) = "owner"; + // account address the endpoint is owned by string owner = 1; // locator endpoint uri diff --git a/proto/provenance/metadata/v1/tx.proto b/proto/provenance/metadata/v1/tx.proto index 3219903121..6c0984a8e3 100644 --- a/proto/provenance/metadata/v1/tx.proto +++ b/proto/provenance/metadata/v1/tx.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package provenance.metadata.v1; +import "cosmos/msg/v1/msg.proto"; import "gogoproto/gogo.proto"; import "provenance/metadata/v1/metadata.proto"; import "provenance/metadata/v1/objectstore.proto"; @@ -89,6 +90,7 @@ service Msg { // MsgWriteScopeRequest is the request type for the Msg/WriteScope RPC method. message MsgWriteScopeRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -123,6 +125,7 @@ message MsgWriteScopeResponse { // MsgDeleteScopeRequest is the request type for the Msg/DeleteScope RPC method. message MsgDeleteScopeRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -141,6 +144,7 @@ message MsgDeleteScopeResponse {} // MsgAddScopeDataAccessRequest is the request to add data access AccAddress to scope message MsgAddScopeDataAccessRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -163,6 +167,7 @@ message MsgAddScopeDataAccessResponse {} // MsgDeleteScopeDataAccessRequest is the request to remove data access AccAddress to scope message MsgDeleteScopeDataAccessRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -185,6 +190,7 @@ message MsgDeleteScopeDataAccessResponse {} // MsgAddScopeOwnerRequest is the request to add owner AccAddress to scope message MsgAddScopeOwnerRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -207,6 +213,7 @@ message MsgAddScopeOwnerResponse {} // MsgDeleteScopeOwnerRequest is the request to remove owner AccAddresses to scope message MsgDeleteScopeOwnerRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -229,6 +236,7 @@ message MsgDeleteScopeOwnerResponse {} // MsgUpdateValueOwnersRequest is the request to update the value owner addresses in one or more scopes. message MsgUpdateValueOwnersRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -250,6 +258,7 @@ message MsgUpdateValueOwnersResponse {} // MsgMigrateValueOwnerRequest is the request to migrate all scopes with one value owner to another value owner. message MsgMigrateValueOwnerRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -267,6 +276,7 @@ message MsgMigrateValueOwnerResponse {} // MsgWriteSessionRequest is the request type for the Msg/WriteSession RPC method. message MsgWriteSessionRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -313,6 +323,7 @@ message MsgWriteSessionResponse { // MsgWriteRecordRequest is the request type for the Msg/WriteRecord RPC method. message MsgWriteRecordRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -351,6 +362,7 @@ message MsgWriteRecordResponse { // MsgDeleteRecordRequest is the request type for the Msg/DeleteRecord RPC method. message MsgDeleteRecordRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -369,6 +381,7 @@ message MsgDeleteRecordResponse {} // MsgWriteScopeSpecificationRequest is the request type for the Msg/WriteScopeSpecification RPC method. message MsgWriteScopeSpecificationRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -395,6 +408,7 @@ message MsgWriteScopeSpecificationResponse { // MsgDeleteScopeSpecificationRequest is the request type for the Msg/DeleteScopeSpecification RPC method. message MsgDeleteScopeSpecificationRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -413,6 +427,7 @@ message MsgDeleteScopeSpecificationResponse {} // MsgWriteContractSpecificationRequest is the request type for the Msg/WriteContractSpecification RPC method. message MsgWriteContractSpecificationRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -440,6 +455,7 @@ message MsgWriteContractSpecificationResponse { // MsgAddContractSpecToScopeSpecRequest is the request type for the Msg/AddContractSpecToScopeSpec RPC method. message MsgAddContractSpecToScopeSpecRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -465,6 +481,7 @@ message MsgAddContractSpecToScopeSpecResponse {} // MsgDeleteContractSpecFromScopeSpecRequest is the request type for the Msg/DeleteContractSpecFromScopeSpec RPC method. message MsgDeleteContractSpecFromScopeSpecRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -491,6 +508,7 @@ message MsgDeleteContractSpecFromScopeSpecResponse {} // MsgDeleteContractSpecificationRequest is the request type for the Msg/DeleteContractSpecification RPC method. message MsgDeleteContractSpecificationRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -509,6 +527,7 @@ message MsgDeleteContractSpecificationResponse {} // MsgWriteRecordSpecificationRequest is the request type for the Msg/WriteRecordSpecification RPC method. message MsgWriteRecordSpecificationRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -536,6 +555,7 @@ message MsgWriteRecordSpecificationResponse { // MsgDeleteRecordSpecificationRequest is the request type for the Msg/DeleteRecordSpecification RPC method. message MsgDeleteRecordSpecificationRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -554,6 +574,7 @@ message MsgDeleteRecordSpecificationResponse {} // MsgBindOSLocatorRequest is the request type for the Msg/BindOSLocator RPC method. message MsgBindOSLocatorRequest { + option (cosmos.msg.v1.signer) = "locator"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; // The object locator to bind the address to bind to the URI. @@ -567,6 +588,7 @@ message MsgBindOSLocatorResponse { // MsgDeleteOSLocatorRequest is the request type for the Msg/DeleteOSLocator RPC method. message MsgDeleteOSLocatorRequest { + option (cosmos.msg.v1.signer) = "locator"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -581,6 +603,7 @@ message MsgDeleteOSLocatorResponse { // MsgModifyOSLocatorRequest is the request type for the Msg/ModifyOSLocator RPC method. message MsgModifyOSLocatorRequest { + option (cosmos.msg.v1.signer) = "locator"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; // The object locator to bind the address to bind to the URI. @@ -594,6 +617,7 @@ message MsgModifyOSLocatorResponse { // MsgSetAccountDataRequest is the request to set/update/delete a scope's account data. message MsgSetAccountDataRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; @@ -658,6 +682,7 @@ message MsgP8eMemorializeContractResponse { // MsgAddNetAssetValuesRequest defines the Msg/AddNetAssetValues request type message MsgAddNetAssetValuesRequest { + option (cosmos.msg.v1.signer) = "signers"; option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = true; option (gogoproto.goproto_getters) = false; diff --git a/x/metadata/types/objectstore.pb.go b/x/metadata/types/objectstore.pb.go index 5f4d474606..74f1239bc3 100644 --- a/x/metadata/types/objectstore.pb.go +++ b/x/metadata/types/objectstore.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -136,27 +137,29 @@ func init() { } var fileDescriptor_3d17fc5ccfa1c263 = []byte{ - // 314 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x4e, 0x32, 0x31, - 0x1c, 0xc4, 0xb7, 0xdf, 0x17, 0x49, 0xac, 0x82, 0x49, 0x83, 0x06, 0x3d, 0x74, 0xcd, 0x26, 0x46, - 0x2e, 0x6e, 0x83, 0x78, 0xf2, 0xc8, 0x55, 0x0c, 0x04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0xdb, - 0xfa, 0xf5, 0xe7, 0xca, 0x3f, 0x4e, 0xb9, 0x1a, 0xdf, 0x06, 0xbf, 0xe9, 0xa0, 0x73, 0xa8, 0xf8, - 0xbc, 0x67, 0x64, 0xd3, 0xc9, 0xc6, 0x68, 0xb1, 0xa6, 0x68, 0xb9, 0xa6, 0xe8, 0x63, 0x4d, 0xd1, - 0xeb, 0x86, 0x7a, 0xcb, 0x0d, 0xf5, 0xde, 0x36, 0xd4, 0xc3, 0xa7, 0xd2, 0x5d, 0xfe, 0xc7, 0x40, - 0x6d, 0xf4, 0x70, 0x13, 0x4b, 0x3b, 0x9c, 0x0e, 0xc2, 0x08, 0x14, 0xcb, 0xa1, 0x2b, 0x09, 0x3f, - 0x14, 0x9b, 0xe7, 0xfb, 0xdb, 0x34, 0x11, 0x93, 0x41, 0xc1, 0x2d, 0x59, 0xff, 0x0a, 0x00, 0x00, - 0xff, 0xff, 0x0b, 0x65, 0x9a, 0xf7, 0xa3, 0x01, 0x00, 0x00, + // 344 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xc1, 0x4e, 0xf2, 0x40, + 0x14, 0x85, 0xdb, 0xff, 0x8f, 0x24, 0x8e, 0x82, 0x49, 0x83, 0x8a, 0x2c, 0x5a, 0xd3, 0xc4, 0x48, + 0x4c, 0x6c, 0x83, 0xb8, 0x62, 0xc9, 0x56, 0x0c, 0x04, 0xc2, 0xc6, 0x0d, 0x0e, 0x75, 0x52, 0x46, + 0x98, 0xb9, 0xcd, 0xcc, 0x80, 0x74, 0xe3, 0xc2, 0x27, 0xf0, 0x51, 0x7c, 0x0c, 0x96, 0x2c, 0x8d, + 0x0b, 0x62, 0x60, 0xe1, 0xde, 0x27, 0x30, 0x9d, 0x62, 0xaa, 0x89, 0xbb, 0x7b, 0x4e, 0xbf, 0x7b, + 0x6e, 0x73, 0x06, 0x55, 0x22, 0x01, 0x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41, 0x9b, + 0x5a, 0x36, 0x46, 0xf3, 0x95, 0x6d, 0x2e, 0x56, 0xb6, 0xf9, 0xbe, 0xb2, 0xcd, 0xe7, 0xb5, 0x6d, + 0x2c, 0xd6, 0xb6, 0xf1, 0xba, 0xb6, 0x0d, 0x74, 0x44, 0x75, 0x0b, 0x7f, 0xb4, 0xd8, 0x36, 0x6f, + 0x2e, 0x43, 0xaa, 0x86, 0x93, 0x81, 0x17, 0x00, 0xf3, 0x33, 0xe8, 0x9c, 0xc2, 0x0f, 0xe5, 0xcf, + 0xb2, 0x47, 0x52, 0x71, 0x44, 0xe4, 0x20, 0xa7, 0x5b, 0xad, 0x7d, 0x05, 0x00, 0x00, 0xff, 0xff, + 0x5a, 0x14, 0x30, 0x4a, 0xc8, 0x01, 0x00, 0x00, } func (m *ObjectStoreLocator) Marshal() (dAtA []byte, err error) { diff --git a/x/metadata/types/tx.pb.go b/x/metadata/types/tx.pb.go index f716e423a0..b1840e3ea8 100644 --- a/x/metadata/types/tx.pb.go +++ b/x/metadata/types/tx.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -2390,153 +2391,155 @@ func init() { func init() { proto.RegisterFile("provenance/metadata/v1/tx.proto", fileDescriptor_3a3a0892f91e3036) } var fileDescriptor_3a3a0892f91e3036 = []byte{ - // 2327 bytes of a gzipped FileDescriptorProto + // 2361 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5a, 0xdd, 0x6f, 0x1c, 0x57, 0x15, 0xf7, 0xac, 0x93, 0xd8, 0x7b, 0x6c, 0xc7, 0xce, 0x8d, 0x3f, 0xd6, 0xe3, 0x66, 0xc7, 0x4c, 0x93, 0xd6, 0x75, 0x1a,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bf, 0xf0, 0x23, - 0x46, 0x49, 0x3d, 0x62, 0x98, 0x18, 0x3f, 0x6e, 0x7d, 0xad, 0x8c, 0x03, 0xf7, 0x7d, 0x09, 0xa6, - 0xb8, 0x94, 0x77, 0x04, 0x35, 0xec, 0xfd, 0x96, 0x6d, 0x61, 0xcb, 0x25, 0xf4, 0xf0, 0x1d, 0x59, - 0x39, 0x9f, 0xe3, 0x69, 0xd3, 0x78, 0x2d, 0x50, 0xa9, 0xcf, 0x77, 0x3b, 0xca, 0x33, 0xbc, 0x32, - 0x92, 0x6c, 0xaa, 0xda, 0x69, 0x12, 0x57, 0x3b, 0xc4, 0xf1, 0xdd, 0x93, 0xda, 0x3f, 0x4b, 0x70, - 0x3a, 0x21, 0x1e, 0xf4, 0x65, 0x61, 0x9a, 0x90, 0x32, 0xa6, 0x89, 0x2b, 0x03, 0xd1, 0x79, 0x22, - 0xd0, 0xf3, 0xca, 0x92, 0x17, 0x6e, 0x4c, 0xcf, 0x7b, 0x17, 0xea, 0x79, 0xc5, 0x8a, 0xd6, 0x61, - 0xd4, 0xc7, 0x1d, 0x99, 0x5f, 0x66, 0xba, 0x1d, 0xe5, 0xb4, 0x98, 0x15, 0x06, 0x67, 0x84, 0x3f, - 0x7a, 0x3e, 0xeb, 0x08, 0x26, 0xfc, 0xdd, 0x84, 0x2d, 0xd7, 0xdc, 0x35, 0xb1, 0xa3, 0xfe, 0x88, - 0x35, 0x60, 0xb1, 0x24, 0xf8, 0xf0, 0x61, 0xc2, 0x78, 0x24, 0xc7, 0x91, 0xf1, 0xe3, 0x5c, 0xee, - 0x8a, 0xd1, 0x01, 0x44, 0xee, 0x76, 0x94, 0xe9, 0xd8, 0x5a, 0xb1, 0x11, 0x64, 0x8c, 0x44, 0x45, - 0xd5, 0x9f, 0x0e, 0x86, 0x13, 0x90, 0x86, 0x1b, 0xb6, 0x63, 0xf8, 0x85, 0x79, 0x11, 0x4e, 0x38, - 0xf4, 0x07, 0xee, 0xbb, 0x9a, 0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24, 0x28, 0xfb, + 0x49, 0xf1, 0xca, 0x9a, 0x70, 0x84, 0xf8, 0xfe, 0x69, 0x30, 0xea, 0x67, 0x59, 0x2f, 0x55, 0x64, + 0x25, 0xc2, 0xe6, 0x1a, 0x16, 0xaa, 0x4c, 0x8e, 0xa5, 0x20, 0x23, 0x25, 0xc7, 0x1c, 0xf3, 0xfc, + 0x28, 0x49, 0xea, 0x6f, 0x0b, 0x74, 0xd2, 0x10, 0x6f, 0xd8, 0x13, 0x52, 0x04, 0xa3, 0xdb, 0x30, + 0x19, 0x93, 0xdb, 0xfd, 0xee, 0x7d, 0xfe, 0xb3, 0x42, 0xe9, 0xb4, 0x95, 0xb9, 0xc4, 0xb3, 0x82, + 0xa8, 0xda, 0x89, 0xee, 0xc3, 0x22, 0x04, 0xea, 0xd3, 0x02, 0x9d, 0x5d, 0x5c, 0x59, 0xc3, 0x5b, + 0xb8, 0x61, 0x3b, 0xa6, 0xbe, 0x67, 0xde, 0x0e, 0xe0, 0xf2, 0xd7, 0x70, 0xb6, 0xab, 0x37, 0x5f, + 0x0c, 0xfb, 0xed, 0xb3, 0x30, 0x5c, 0x77, 0xec, 0x56, 0xd3, 0x2f, 0xde, 0x8a, 0xda, 0x10, 0x7d, + 0xde, 0x34, 0xd0, 0x6a, 0x62, 0x95, 0x47, 0x0f, 0xe7, 0x84, 0x8a, 0xed, 0x6b, 0x30, 0xec, 0xe0, + 0x9a, 0xe9, 0xea, 0x7b, 0x84, 0xb6, 0x78, 0x52, 0xda, 0x24, 0x5e, 0xac, 0x68, 0x9c, 0x56, 0x0b, + 0xb8, 0x3c, 0x09, 0x3e, 0xd8, 0x74, 0x78, 0x99, 0x21, 0x21, 0x70, 0x36, 0xe0, 0x42, 0x97, 0x00, + 0xbc, 0x80, 0xd2, 0xdd, 0x96, 0x83, 0x49, 0xe9, 0x58, 0x76, 0xc4, 0x6e, 0xfb, 0xd4, 0xdb, 0xd8, + 0xd5, 0x22, 0xbc, 0x5e, 0xa4, 0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x8a, 0xf4, 0x9d, 0xd5, 0xba, 0xe9, 0x5e, 0x6f, 0x5d, + 0x5b, 0xaa, 0xd9, 0x8d, 0x4a, 0x48, 0x74, 0xce, 0xb4, 0x23, 0x4f, 0x95, 0x9b, 0xe1, 0x0f, 0xaf, + 0xdd, 0x5b, 0x4d, 0x4c, 0xae, 0x1d, 0xa3, 0x3f, 0xb7, 0x7e, 0xe1, 0xbf, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x4b, 0x40, 0xf7, 0x2a, 0x9f, 0x2e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. From 3e3bd286f91f52c064c4af4670971002cadd0351 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Mon, 22 Apr 2024 11:55:10 -0600 Subject: [PATCH 25/42] [1760]: Fix the metadata CLI unit tests. --- x/metadata/client/cli/cli_test.go | 422 ++++++++++++++---------------- 1 file changed, 195 insertions(+), 227 deletions(-) diff --git a/x/metadata/client/cli/cli_test.go b/x/metadata/client/cli/cli_test.go index 5900354eb6..2cddc85e40 100644 --- a/x/metadata/client/cli/cli_test.go +++ b/x/metadata/client/cli/cli_test.go @@ -8,8 +8,6 @@ import ( "github.com/google/uuid" "github.com/spf13/cobra" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" cmtcli "github.com/cometbft/cometbft/libs/cli" @@ -27,11 +25,13 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authzcli "github.com/cosmos/cosmos-sdk/x/authz/client/cli" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/cosmos/gogoproto/proto" "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" + "github.com/provenance-io/provenance/testutil/queries" attrcli "github.com/provenance-io/provenance/x/attribute/client/cli" attrtypes "github.com/provenance-io/provenance/x/attribute/types" "github.com/provenance-io/provenance/x/metadata/client/cli" @@ -134,12 +134,16 @@ func TestIntegrationCLITestSuite(t *testing.T) { func (s *IntegrationCLITestSuite) SetupSuite() { s.T().Log("setting up integration test suite") pioconfig.SetProvenanceConfig("atom", 0) - cfg := testutil.DefaultTestNetworkConfig() - cfg.NumValidators = 1 - genesisState := cfg.GenesisState - s.cfg = cfg + govv1.DefaultMinDepositRatio = sdkmath.LegacyZeroDec() + s.cfg = testutil.DefaultTestNetworkConfig() + s.cfg.NumValidators = 1 + s.cfg.ChainID = antewrapper.SimAppChainID s.generateAccountsWithKeyrings(4) + s.asJson = fmt.Sprintf("--%s=json", cmtcli.OutputFlag) + s.asText = fmt.Sprintf("--%s=text", cmtcli.OutputFlag) + s.includeRequest = "--include-request" + var err error // An account s.accountAddr, err = s.keyringAccounts[0].GetAddress() @@ -166,46 +170,37 @@ func (s *IntegrationCLITestSuite) SetupSuite() { s.userOtherStr = s.userOtherAddr.String() // Configure Genesis auth data for adding test accounts - var genAccounts []authtypes.GenesisAccount - var authData authtypes.GenesisState - authData.Params = authtypes.DefaultParams() - genAccounts = append(genAccounts, authtypes.NewBaseAccount(s.accountAddr, nil, 3, 0)) - genAccounts = append(genAccounts, authtypes.NewBaseAccount(s.user1Addr, nil, 4, 1)) - genAccounts = append(genAccounts, authtypes.NewBaseAccount(s.user2Addr, nil, 5, 1)) - genAccounts = append(genAccounts, authtypes.NewBaseAccount(s.user3Addr, nil, 6, 0)) - accounts, err := authtypes.PackAccounts(genAccounts) - s.Require().NoError(err) - authData.Accounts = accounts - authDataBz, err := cfg.Codec.MarshalJSON(&authData) - s.Require().NoError(err) - genesisState[authtypes.ModuleName] = authDataBz + testutil.MutateGenesisState(s.T(), &s.cfg, authtypes.ModuleName, &authtypes.GenesisState{}, func(authData *authtypes.GenesisState) *authtypes.GenesisState { + curCount := uint64(len(authData.Accounts)) + genAccounts := []authtypes.GenesisAccount{ + authtypes.NewBaseAccount(s.accountAddr, nil, curCount, 0), + authtypes.NewBaseAccount(s.user1Addr, nil, curCount+1, 1), + authtypes.NewBaseAccount(s.user2Addr, nil, curCount+2, 1), + authtypes.NewBaseAccount(s.user3Addr, nil, curCount+3, 0), + } + accounts, err := authtypes.PackAccounts(genAccounts) + s.Require().NoError(err, "PackAccounts") + authData.Accounts = append(authData.Accounts, accounts...) + return authData + }) // Configure Genesis bank data for test accounts - var genBalances []banktypes.Balance - genBalances = append(genBalances, banktypes.Balance{Address: s.accountAddrStr, Coins: sdk.NewCoins( - sdk.NewCoin(cfg.BondDenom, cfg.StakingTokens), - sdk.NewInt64Coin("authzhotdog", 100), - ).Sort()}) - genBalances = append(genBalances, banktypes.Balance{Address: s.user1AddrStr, Coins: sdk.NewCoins( - sdk.NewCoin(cfg.BondDenom, cfg.StakingTokens), - sdk.NewInt64Coin("authzhotdog", 100), - ).Sort()}) - genBalances = append(genBalances, banktypes.Balance{Address: s.user2AddrStr, Coins: sdk.NewCoins( - sdk.NewCoin(cfg.BondDenom, cfg.StakingTokens), - ).Sort()}) - genBalances = append(genBalances, banktypes.Balance{Address: s.user3AddrStr, Coins: sdk.NewCoins( - sdk.NewCoin(cfg.BondDenom, cfg.StakingTokens), - ).Sort()}) - var bankGenState banktypes.GenesisState - bankGenState.Params = banktypes.DefaultParams() - bankGenState.Balances = genBalances - bankDataBz, err := cfg.Codec.MarshalJSON(&bankGenState) - s.Require().NoError(err) - genesisState[banktypes.ModuleName] = bankDataBz - - s.asJson = fmt.Sprintf("--%s=json", cmtcli.OutputFlag) - s.asText = fmt.Sprintf("--%s=text", cmtcli.OutputFlag) - s.includeRequest = "--include-request" + testutil.MutateGenesisState(s.T(), &s.cfg, banktypes.ModuleName, &banktypes.GenesisState{}, func(bankGenState *banktypes.GenesisState) *banktypes.GenesisState { + bal := func(addr sdk.AccAddress, coins ...sdk.Coin) banktypes.Balance { + return banktypes.Balance{Address: addr.String(), Coins: coins} + } + coin := func(denom string, amount int64) sdk.Coin { + return sdk.NewInt64Coin(denom, amount) + } + bondCoin := sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens) + bankGenState.Balances = append(bankGenState.Balances, + bal(s.accountAddr, bondCoin, coin("authzhotdog", 100)), + bal(s.user1Addr, bondCoin, coin("authzhotdog", 100)), + bal(s.user2Addr, bondCoin), + bal(s.user3Addr, bondCoin), + ) + return bankGenState + }) s.scopeUUID = uuid.New() s.sessionUUID = uuid.New() @@ -459,39 +454,33 @@ owner: %s`, s.objectLocator2AsText = locAsText(s.objectLocator2) s.objectLocator2AsJson = locAsJson(s.objectLocator2) - var metadataData metadatatypes.GenesisState - s.Require().NoError(cfg.Codec.UnmarshalJSON(genesisState[metadatatypes.ModuleName], &metadataData)) - metadataData.Scopes = append(metadataData.Scopes, s.scope) - metadataData.Sessions = append(metadataData.Sessions, s.session) - metadataData.Records = append(metadataData.Records, s.record) - metadataData.ScopeSpecifications = append(metadataData.ScopeSpecifications, s.scopeSpec) - metadataData.ContractSpecifications = append(metadataData.ContractSpecifications, s.contractSpec) - metadataData.RecordSpecifications = append(metadataData.RecordSpecifications, s.recordSpec) - metadataData.ObjectStoreLocators = append(metadataData.ObjectStoreLocators, s.objectLocator1, s.objectLocator2) - metadataDataBz, err := cfg.Codec.MarshalJSON(&metadataData) - s.Require().NoError(err) - genesisState[metadatatypes.ModuleName] = metadataDataBz + testutil.MutateGenesisState(s.T(), &s.cfg, metadatatypes.ModuleName, &metadatatypes.GenesisState{}, func(metadataData *metadatatypes.GenesisState) *metadatatypes.GenesisState { + metadataData.Scopes = append(metadataData.Scopes, s.scope) + metadataData.Sessions = append(metadataData.Sessions, s.session) + metadataData.Records = append(metadataData.Records, s.record) + metadataData.ScopeSpecifications = append(metadataData.ScopeSpecifications, s.scopeSpec) + metadataData.ContractSpecifications = append(metadataData.ContractSpecifications, s.contractSpec) + metadataData.RecordSpecifications = append(metadataData.RecordSpecifications, s.recordSpec) + metadataData.ObjectStoreLocators = append(metadataData.ObjectStoreLocators, s.objectLocator1, s.objectLocator2) + return metadataData + }) // Set some account data on a scope. It should be fine even though the scope doesn't actually exist. s.scopeIDWithData = metadatatypes.ScopeMetadataAddress(uuid.MustParse("A11E57A6-7D51-4C43-91F9-AD1F4D16FA35")) - attrData := attrtypes.DefaultGenesisState() - attrData.Attributes = append(attrData.Attributes, - attrtypes.Attribute{ - Name: attrtypes.AccountDataName, - Value: []byte("This is some scope account data."), - AttributeType: attrtypes.AttributeType_String, - Address: s.scopeIDWithData.String(), - }, - ) - attrDataBz, err := cfg.Codec.MarshalJSON(attrData) - s.Require().NoError(err, "MarshalJSON(attrData)") - genesisState[attrtypes.ModuleName] = attrDataBz - cfg.GenesisState = genesisState + testutil.MutateGenesisState(s.T(), &s.cfg, attrtypes.ModuleName, &attrtypes.GenesisState{}, func(attrData *attrtypes.GenesisState) *attrtypes.GenesisState { + attrData.Attributes = append(attrData.Attributes, + attrtypes.Attribute{ + Name: attrtypes.AccountDataName, + Value: []byte("This is some scope account data."), + AttributeType: attrtypes.AttributeType_String, + Address: s.scopeIDWithData.String(), + }, + ) + return attrData + }) - cfg.ChainID = antewrapper.SimAppChainID - cfg.TimeoutCommit = 500 * time.Millisecond - s.testnet, err = testnet.New(s.T(), s.T().TempDir(), cfg) + s.testnet, err = testnet.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "creating testnet") _, err = testutil.WaitForHeight(s.testnet, 1) @@ -621,13 +610,13 @@ func runQueryCmdTestCases(s *IntegrationCLITestSuite, cmdGen func() *cobra.Comma // Providing the command using a generator (cmdGen), we get a new instance of the cmd each time, and the flags won't // carry over between tests on the same command. for _, tc := range testCases { - s.T().Run(tc.name, func(t *testing.T) { + s.Run(tc.name, func() { cmd := cmdGen() cmdName := cmd.Name() var outStr string defer func() { - if t.Failed() { - t.Logf("Command: %s\nArgs: %q\nOutput:\n%s", cmdName, tc.args, outStr) + if s.T().Failed() { + s.T().Logf("Command: %s\nArgs: %q\nOutput:\n%s", cmdName, tc.args, outStr) } }() @@ -636,20 +625,20 @@ func runQueryCmdTestCases(s *IntegrationCLITestSuite, cmdGen func() *cobra.Comma outStr = out.String() if len(tc.expErr) > 0 { - require.ErrorContains(t, err, tc.expErr, "%s error", cmdName) + s.Require().ErrorContains(err, tc.expErr, "%s error", cmdName) // Something deep down is double wrapping the errors. // E.g. "foo: invalid request" has become "foo: invalid request: invalid request" // So we changed from the "Equal" test below to the "Contains" test above. // If you're bored, maybe try swapping back to see if things have been fixed. - //require.EqualError(t, err, tc.expErr, "%s error", cmdName) + //s.Require().EqualError(err, tc.expErr, "%s error", cmdName) } else { - require.NoErrorf(t, err, "%s error", cmdName) + s.Require().NoErrorf(err, "%s error", cmdName) } for _, exp := range tc.expOut { - if !assert.Contains(t, outStr, exp, "%s command output", cmdName) { + if !s.Assert().Contains(outStr, exp, "%s command output", cmdName) { // The expected entry is easily lost in the failure message, so log it now too. // Logging it instead of putting it in the assertion message so it lines up with the deferrable. - t.Logf("Not Found:\n%s", exp) + s.T().Logf("Not Found:\n%s", exp) } } }) @@ -1807,34 +1796,19 @@ type txCmdTestCase struct { func runTxCmdTestCases(s *IntegrationCLITestSuite, testCases []txCmdTestCase) { s.T().Helper() for _, tc := range testCases { - s.T().Run(tc.name, func(t *testing.T) { + s.Run(tc.name, func() { cmdName := tc.cmd.Name() - var outBz []byte - defer func() { - if t.Failed() { - t.Logf("Command: %s\nArgs: %q\nOutput:\n%s", cmdName, tc.args, string(outBz)) - } - }() clientCtx := s.getClientCtx() out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) - outBz = out.Bytes() + outBz := out.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmdName, tc.args, string(outBz)) if len(tc.expectErrMsg) > 0 { - require.EqualError(t, err, tc.expectErrMsg, "%s expected error message", cmdName) + s.Require().EqualError(err, tc.expectErrMsg, "%s expected error message", cmdName) } else { - require.NoError(t, err, "%s unexpected error", cmdName) - - if tc.respType == nil { - tc.respType = &sdk.TxResponse{} - } - umErr := clientCtx.Codec.UnmarshalJSON(outBz, tc.respType) - require.NoError(t, umErr, "%s UnmarshalJSON error", cmdName) - - txResp, isTxResp := tc.respType.(*sdk.TxResponse) - if isTxResp && !assert.Equal(t, int(tc.expectedCode), int(txResp.Code), "%s response code", cmdName) { - // Note: If the above is failing because a 0 is expected, it might mean that the keeper method is returning an error. - t.Logf("txResp:\n%v", txResp) - } + s.Require().NoError(err, "%s unexpected error", cmdName) + txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) + s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "txResp.Code") } }) } @@ -1854,7 +1828,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { s.contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -1870,7 +1844,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { s.accountAddrStr, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -1887,7 +1861,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { fmt.Sprintf("--%s=%s", cli.FlagSigners, s.accountAddrStr), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -1904,7 +1878,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { fmt.Sprintf("--%s", cli.FlagRequirePartyRollup), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -1920,7 +1894,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { s.user1AddrStr, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "invalid scope id: decoding bech32 failed: invalid separator index -1", @@ -1936,7 +1910,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { s.user1AddrStr, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "invalid spec id: decoding bech32 failed: invalid separator index -1", @@ -1952,7 +1926,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { s.user1AddrStr, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: `invalid owners: invalid party "incorrect1,incorrect2": invalid address "incorrect1": decoding bech32 failed: invalid separator index 9`, @@ -1964,7 +1938,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { "not-valid", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "decoding bech32 failed: invalid separator index -1", @@ -1978,7 +1952,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { s.user2AddrStr, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "decoding bech32 failed: invalid separator index -1", @@ -1992,7 +1966,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { s.user2AddrStr, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "incorrect command notaddorremove : required remove or update", @@ -2006,7 +1980,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { s.user2AddrStr, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: fmt.Sprintf("meta address is not a scope: %s", scopeSpecID), @@ -2020,7 +1994,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { "notauser", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "data access address is invalid: notauser", @@ -2034,7 +2008,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { s.user1AddrStr, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2048,7 +2022,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { s.user1AddrStr, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2063,7 +2037,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { s.user2AddrStr, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "decoding bech32 failed: invalid separator index -1", @@ -2077,7 +2051,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { s.user2AddrStr, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "incorrect command notaddorremove : required remove or update", @@ -2091,7 +2065,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { s.user2AddrStr, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: fmt.Sprintf("meta address is not a scope: %s", scopeSpecID), @@ -2105,7 +2079,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { "notauser", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "invalid owners: invalid party address [notauser]: decoding bech32 failed: invalid separator index -1", @@ -2117,7 +2091,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { scopeID, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2129,7 +2103,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { scopeID, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 18, @@ -2145,7 +2119,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { s.accountAddrStr, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "parties can only be optional when require_party_rollup = true", @@ -2162,7 +2136,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { fmt.Sprintf("--%s", cli.FlagRequirePartyRollup), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), fmt.Sprintf("--%s=%s", cli.FlagUsdMills, "blah"), }, @@ -2180,7 +2154,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { fmt.Sprintf("--%s", cli.FlagRequirePartyRollup), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), fmt.Sprintf("--%s=%s", cli.FlagUsdMills, "10"), }, @@ -2205,7 +2179,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { return fmt.Sprintf("--%s=%s", flags.FlagFrom, addr) } skipConfFlag := fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation) - broadcastBlockFlag := fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync) // TODO[1760]: broadcast + broadcastBlockFlag := fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync) queryCmd := func() *cobra.Command { return cli.GetMetadataScopeCmd() @@ -2534,7 +2508,7 @@ func (s *IntegrationCLITestSuite) TestScopeSpecificationTxCommands() { s.contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2553,7 +2527,7 @@ func (s *IntegrationCLITestSuite) TestScopeSpecificationTxCommands() { "http://www.blockchain.com/icon.png", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2568,7 +2542,7 @@ func (s *IntegrationCLITestSuite) TestScopeSpecificationTxCommands() { s.contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "decoding bech32 failed: invalid bech32 string length 7", @@ -2583,7 +2557,7 @@ func (s *IntegrationCLITestSuite) TestScopeSpecificationTxCommands() { specID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "invalid contract specification id prefix at index 0 (expected: contractspec, got scopespec)", @@ -2598,7 +2572,7 @@ func (s *IntegrationCLITestSuite) TestScopeSpecificationTxCommands() { s.contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: `unknown party type: "badpartytype"`, @@ -2610,7 +2584,7 @@ func (s *IntegrationCLITestSuite) TestScopeSpecificationTxCommands() { "notvalid", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "decoding bech32 failed: invalid separator index -1", @@ -2622,7 +2596,7 @@ func (s *IntegrationCLITestSuite) TestScopeSpecificationTxCommands() { specID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2634,7 +2608,7 @@ func (s *IntegrationCLITestSuite) TestScopeSpecificationTxCommands() { specID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 38, @@ -2657,7 +2631,7 @@ func (s *IntegrationCLITestSuite) TestAddObjectLocatorCmd() { userURI, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2670,7 +2644,7 @@ func (s *IntegrationCLITestSuite) TestAddObjectLocatorCmd() { userURIMod, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2683,7 +2657,7 @@ func (s *IntegrationCLITestSuite) TestAddObjectLocatorCmd() { userURIMod, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2710,7 +2684,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationTxCommands() { "`myclassname`", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2727,7 +2701,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationTxCommands() { fmt.Sprintf("--%s=%s", cli.FlagSigners, s.accountAddrStr), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2743,7 +2717,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationTxCommands() { "myclassname", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2763,7 +2737,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationTxCommands() { "http://www.blockchain.com/icon.png", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2775,7 +2749,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationTxCommands() { specificationID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2791,7 +2765,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationTxCommands() { "myclassname", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "decoding bech32 failed: invalid separator index -1", @@ -2807,7 +2781,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationTxCommands() { "`myclassname`", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: `unknown party type: "badpartytype"`, @@ -2819,7 +2793,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationTxCommands() { "not-a-id", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "decoding bech32 failed: invalid separator index -1", @@ -2831,7 +2805,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationTxCommands() { specificationID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 38, @@ -2860,7 +2834,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC "`myclassname`", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2875,7 +2849,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC s.contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2888,7 +2862,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC scopeSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "invalid contract specification id : invalid-contract-specid", @@ -2901,7 +2875,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC scopeSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: fmt.Sprintf("invalid contract specification id : %s", scopeSpecID.String()), @@ -2914,7 +2888,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC "invalid-scope-spec-id", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "invalid scope specification id : invalid-scope-spec-id", @@ -2927,7 +2901,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC specificationID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: fmt.Sprintf("invalid scope specification id : %s", specificationID.String()), @@ -2940,7 +2914,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC scopeSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -2953,7 +2927,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC scopeSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "invalid contract specification id : invalid-contract-specid", @@ -2966,7 +2940,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC scopeSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: fmt.Sprintf("invalid contract specification id : %s", scopeSpecID.String()), @@ -2979,7 +2953,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC "invalid-scope-spec-id", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "invalid scope specification id : invalid-scope-spec-id", @@ -2992,7 +2966,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC specificationID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: fmt.Sprintf("invalid scope specification id : %s", specificationID.String()), @@ -3005,7 +2979,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC scopeSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3035,7 +3009,7 @@ func (s *IntegrationCLITestSuite) TestRecordSpecificationTxCommands() { "`myclassname`", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3052,7 +3026,7 @@ func (s *IntegrationCLITestSuite) TestRecordSpecificationTxCommands() { "validator", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3069,7 +3043,7 @@ func (s *IntegrationCLITestSuite) TestRecordSpecificationTxCommands() { "investor", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3086,7 +3060,7 @@ func (s *IntegrationCLITestSuite) TestRecordSpecificationTxCommands() { "badpartytype", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: `unknown party type: "badpartytype"`, @@ -3103,7 +3077,7 @@ func (s *IntegrationCLITestSuite) TestRecordSpecificationTxCommands() { "custodian", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "record specification name cannot be empty", @@ -3120,7 +3094,7 @@ func (s *IntegrationCLITestSuite) TestRecordSpecificationTxCommands() { "originator", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: `invalid input specification "record1,typename1": expected 3 parts, have 2`, @@ -3137,7 +3111,7 @@ func (s *IntegrationCLITestSuite) TestRecordSpecificationTxCommands() { "servicer,affiliate", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "record specification result type cannot be unspecified", @@ -3155,7 +3129,7 @@ func (s *IntegrationCLITestSuite) TestRecordSpecificationTxCommands() { fmt.Sprintf("--%s=%s", cli.FlagSigners, "incorrect-signer-format"), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "invalid signer address \"incorrect-signer-format\": decoding bech32 failed: invalid separator index -1", @@ -3167,7 +3141,7 @@ func (s *IntegrationCLITestSuite) TestRecordSpecificationTxCommands() { "incorrect-id", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "decoding bech32 failed: invalid separator index -1", @@ -3179,7 +3153,7 @@ func (s *IntegrationCLITestSuite) TestRecordSpecificationTxCommands() { contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: fmt.Sprintf("invalid contract specification id: %v", contractSpecID.String()), @@ -3192,7 +3166,7 @@ func (s *IntegrationCLITestSuite) TestRecordSpecificationTxCommands() { fmt.Sprintf("--%s=%s", cli.FlagSigners, s.accountAddrStr), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3205,7 +3179,7 @@ func (s *IntegrationCLITestSuite) TestRecordSpecificationTxCommands() { fmt.Sprintf("--%s=%s", cli.FlagSigners, s.accountAddrStr), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 38, @@ -3242,7 +3216,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { contractSpecName, fmt.Sprintf("--%s=%s", flags.FlagFrom, userAddress), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3257,7 +3231,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { s.contractSpecID.String() + "," + contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, userAddress), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3273,7 +3247,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { userAddress, fmt.Sprintf("--%s=%s", flags.FlagFrom, userAddress), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3290,7 +3264,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { "owner", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3309,7 +3283,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3328,7 +3302,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "decoding bech32 failed: invalid separator index -1", @@ -3347,7 +3321,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: "decoding bech32 failed: invalid separator index -1", @@ -3366,7 +3340,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: `invalid process "hashvalue,methodname": expected 3 parts, have: 2`, @@ -3385,7 +3359,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: `invalid record input "input1name,typename1,proposed": expected 4 parts, have 3`, @@ -3404,7 +3378,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: `invalid record output "outputhashvalue": expected 2 parts, have 1`, @@ -3423,7 +3397,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: fmt.Sprintf(`invalid party "%s,%s": unknown party type: "%s"`, userAddress, userAddress, userAddress), @@ -3442,7 +3416,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { scopeID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: fmt.Sprintf("id must be a contract or session id: %s", scopeID.String()), @@ -3454,7 +3428,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { recordId.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3471,31 +3445,25 @@ func (s *IntegrationCLITestSuite) TestWriteSessionCmd() { scopeUUID := uuid.New() scopeID := metadatatypes.ScopeMetadataAddress(scopeUUID) - writeScopeCmd := cli.WriteScopeCmd() ctx := s.getClientCtx() - out, err := clitestutil.ExecTestCLICmd( - ctx, - writeScopeCmd, - []string{ - scopeID.String(), - s.scopeSpecID.String(), - owner, - owner, - owner, - fmt.Sprintf("--%s=%s", flags.FlagFrom, sender), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), - }, - ) - require.NoError(s.T(), err, "adding base scope") - scopeResp := sdk.TxResponse{} - umErr := ctx.Codec.UnmarshalJSON(out.Bytes(), &scopeResp) - require.NoError(s.T(), umErr, "%s UnmarshalJSON error", writeScopeCmd.Name()) - if scopeResp.Code != 0 { - s.T().Logf("write-scope response code is not 0.\ntx response:\n%v\n", scopeResp) - s.T().FailNow() + writeScopeCmd := cli.WriteScopeCmd() + scopeArgs := []string{ + scopeID.String(), + s.scopeSpecID.String(), + owner, + owner, + owner, + fmt.Sprintf("--%s=%s", flags.FlagFrom, sender), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), } + scopeOut, scopeErr := clitestutil.ExecTestCLICmd(ctx, writeScopeCmd, scopeArgs) + scopeOutBz := scopeOut.Bytes() + s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", writeScopeCmd.Name(), scopeArgs, string(scopeOutBz)) + s.Require().NoError(scopeErr, "adding base scope") + scopeResp := queries.GetTxFromResponse(s.T(), s.testnet, scopeOutBz) + s.Require().Equal(0, int(scopeResp.Code), "write-scope response code") testCases := []txCmdTestCase{ { @@ -3506,7 +3474,7 @@ func (s *IntegrationCLITestSuite) TestWriteSessionCmd() { s.contractSpecID.String(), fmt.Sprintf("%s,owner", owner), "somename", fmt.Sprintf("--%s=%s", flags.FlagFrom, sender), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3520,7 +3488,7 @@ func (s *IntegrationCLITestSuite) TestWriteSessionCmd() { s.contractSpecID.String(), fmt.Sprintf("%s,owner", owner), "somename", fmt.Sprintf("--%s=%s", flags.FlagFrom, sender), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3534,7 +3502,7 @@ func (s *IntegrationCLITestSuite) TestWriteSessionCmd() { s.contractSpecID.String(), fmt.Sprintf("%s,owner", owner), "somename", fmt.Sprintf("--%s=%s", flags.FlagFrom, sender), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3548,7 +3516,7 @@ func (s *IntegrationCLITestSuite) TestWriteSessionCmd() { "ChFIRUxMTyBQUk9WRU5BTkNFIQ==", fmt.Sprintf("--%s=%s", flags.FlagFrom, sender), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3563,7 +3531,7 @@ func (s *IntegrationCLITestSuite) TestWriteSessionCmd() { "ChFIRUxMTyBQUk9WRU5BTkNFIQ==", fmt.Sprintf("--%s=%s", flags.FlagFrom, sender), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3578,7 +3546,7 @@ func (s *IntegrationCLITestSuite) TestWriteSessionCmd() { "ChFIRUxMTyBQUk9WRU5BTkNFIQ==", fmt.Sprintf("--%s=%s", flags.FlagFrom, sender), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3591,7 +3559,7 @@ func (s *IntegrationCLITestSuite) TestWriteSessionCmd() { s.contractSpecID.String(), fmt.Sprintf("%s,owner", owner), "somename", fmt.Sprintf("--%s=%s", flags.FlagFrom, sender), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: fmt.Sprintf("invalid address type in argument [%s]", s.scopeSpecID), @@ -3604,7 +3572,7 @@ func (s *IntegrationCLITestSuite) TestWriteSessionCmd() { s.contractSpecID.String(), fmt.Sprintf("%s,owner", owner), "somename", fmt.Sprintf("--%s=%s", flags.FlagFrom, sender), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: fmt.Sprintf("argument [%s] is neither a bech32 address (%s) nor UUID (%s)", "invalid", "decoding bech32 failed: invalid bech32 string length 7", "invalid UUID length: 7"), @@ -3618,7 +3586,7 @@ func (s *IntegrationCLITestSuite) TestWriteSessionCmd() { "SEVMTE8gUFJPVkVOQU5DRSEK", fmt.Sprintf("--%s=%s", flags.FlagFrom, sender), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3633,7 +3601,7 @@ func (s *IntegrationCLITestSuite) TestWriteSessionCmd() { "somename", fmt.Sprintf("--%s=%s", flags.FlagFrom, sender), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectErrMsg: `invalid party "` + owner + `,badpartytype": unknown party type: "badpartytype"`, @@ -3656,7 +3624,7 @@ func (s *IntegrationCLITestSuite) TestSetAccountDataCmd() { return append(args, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), ) } @@ -3674,10 +3642,10 @@ func (s *IntegrationCLITestSuite) TestSetAccountDataCmd() { s.accountAddrStr, ), ) - require.NoError(s.T(), err, "adding base scope") + s.Require().NoError(err, "adding base scope") scopeResp := sdk.TxResponse{} umErr := ctx.Codec.UnmarshalJSON(out.Bytes(), &scopeResp) - require.NoError(s.T(), umErr, "%s UnmarshalJSON error", writeScopeCmd.Name()) + s.Require().NoError(umErr, "%s UnmarshalJSON error", writeScopeCmd.Name()) if !s.Assert().Equal(0, int(scopeResp.Code), "write scope response code") { s.T().Logf("tx response:\n%v", scopeResp) s.T().FailNow() @@ -3714,7 +3682,7 @@ func (s *IntegrationCLITestSuite) TestSetAccountDataCmd() { "--" + attrcli.FlagValue, "Some new value.", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.user1AddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 18, @@ -3782,7 +3750,7 @@ func (s *IntegrationCLITestSuite) TestCountAuthorizationIntactTxCommands() { s.contractSpecID.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3798,7 +3766,7 @@ func (s *IntegrationCLITestSuite) TestCountAuthorizationIntactTxCommands() { s.user1AddrStr, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3813,7 +3781,7 @@ func (s *IntegrationCLITestSuite) TestCountAuthorizationIntactTxCommands() { fmt.Sprintf("--%s=%s", authzcli.FlagMsgType, metadatatypes.TypeURLMsgDeleteScopeRequest), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.user1AddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3825,7 +3793,7 @@ func (s *IntegrationCLITestSuite) TestCountAuthorizationIntactTxCommands() { scopeID, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.user3AddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 18, @@ -3840,7 +3808,7 @@ func (s *IntegrationCLITestSuite) TestCountAuthorizationIntactTxCommands() { fmt.Sprintf("--%s=%s", authzcli.FlagMsgType, metadatatypes.TypeURLMsgDeleteScopeRequest), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.user2AddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3852,7 +3820,7 @@ func (s *IntegrationCLITestSuite) TestCountAuthorizationIntactTxCommands() { scopeID, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.user3AddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), }, expectedCode: 0, @@ -3868,7 +3836,7 @@ func (s *IntegrationCLITestSuite) TestGetCmdAddNetAssetValues() { return append(args, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), // TODO[1760]: broadcast + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), ) } From 814265479c2c6ed53dc9def49229658cfeedc54b Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Mon, 22 Apr 2024 12:35:07 -0600 Subject: [PATCH 26/42] [1760]: Put the check back into the msgfees commands that makes sure the provide msgType resolves to a msg (fixes the msgfees unit tests again). --- x/msgfees/client/cli/tx.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/x/msgfees/client/cli/tx.go b/x/msgfees/client/cli/tx.go index 9144ef85ba..a02b89af09 100644 --- a/x/msgfees/client/cli/tx.go +++ b/x/msgfees/client/cli/tx.go @@ -70,6 +70,11 @@ $ %[1]s tx msgfees remove "removing" "removing MsgWriterRecordRequest fee" 10nha return err } + _, err = clientCtx.InterfaceRegistry.Resolve(msgType) + if err != nil { + return err + } + recipient, err := cmd.Flags().GetString(FlagRecipient) if err != nil { return err From 94f4df9d3f3ce92380ca8316f81a5a5d28263904 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Mon, 22 Apr 2024 18:07:27 -0600 Subject: [PATCH 27/42] [1760]: Create a CLITxExecutor to standarize testing of Tx commands. --- testutil/assertions/errors.go | 4 +- testutil/cli/exec.go | 206 ++++++++++++++++++++++++++++++++++ 2 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 testutil/cli/exec.go diff --git a/testutil/assertions/errors.go b/testutil/assertions/errors.go index a625376fc0..6d9179f443 100644 --- a/testutil/assertions/errors.go +++ b/testutil/assertions/errors.go @@ -20,7 +20,9 @@ func AssertErrorContents(t TB, theError error, contains []string, msgAndArgs ... if !assert.Error(t, theError, msgAndArgs...) { // Also output what it was expected to have. if len(contains) == 1 { - t.Logf("Error was expected to contain: %q", contains[0]) + if len(contains[0]) > 0 { + t.Logf("Error was expected to contain: %q", contains[0]) + } } else { var sb strings.Builder for _, c := range contains { diff --git a/testutil/cli/exec.go b/testutil/cli/exec.go new file mode 100644 index 0000000000..2f751abda2 --- /dev/null +++ b/testutil/cli/exec.go @@ -0,0 +1,206 @@ +package cli + +import ( + "testing" + + "github.com/spf13/cobra" + "github.com/stretchr/testify/assert" + + sdkcli "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/cosmos/cosmos-sdk/testutil/network" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/provenance-io/provenance/testutil/assertions" + "github.com/provenance-io/provenance/testutil/queries" +) + +// CLITxExecutor helps facilitate the execution and testing of a CLI command. +// +// The command will be executed when either .Execute() or .AssertExecute() are called. +// The former will halt the test upon failure, the latter will allow test execution to continue. +// +// The error returned from the command is tested against ExpErr, ExpErrMsg, and/or ExpInErrMsg. +// If none of those are set, the error form the command must be nil. +// +// If the command did not return an error, the Tx is queried, so that we can check the actual result. +// That means that this will block for at least one block while it waits for the tx to be processed. +// +// The result code and raw log are only checked if a Tx result is available. +// It's considered a failure if the command did not return an error, but the Tx result is not available. +type CLITxExecutor struct { + // Name is the name of the test. It's not actually used in here, but included + // in case you want to use []CLITxExecutor to define your test cases. + Name string + // Cmd is the cobra.Command to execute. + Cmd *cobra.Command + // Args are all the arguments to provide to the command. + Args []string + + // ExpErr, if true, the command must return an error. + // If ExpErr is false, and both ExpErrMsg and ExpInErrMsg are empty, the command must NOT return an error. + ExpErr bool + // ExpErrMsg, if not empty, the command must return an error that equals this provided string. + // If ExpErr is false, and both ExpErrMsg and ExpInErrMsg are empty, the command must NOT return an error. + ExpErrMsg string + // ExpInErrMsg, if not empty, the command must return an error that contains each of the provided strings. + // If ExpErr is false, and both ExpErrMsg and ExpInErrMsg are empty, the command must NOT return an error. + ExpInErrMsg []string + + // ExpCode is the expected response code from the Tx. + ExpCode uint32 + + // ExpRawLog, if not empty, the TxResponse.RawLog must equal this string. + // If both ExpRawLog and ExpInRawLog are empty, the TxResponse.RawLog is ignored. + ExpRawLog string + // ExpInRawLog, if not empty, the TxResponse.RawLog must contain each of the provided strings. + // If both ExpRawLog and ExpInRawLog are empty, the TxResponse.RawLog is ignored. + ExpInRawLog []string +} + +// NewCLITxExecutor creates a new CLITxExecutor with the provided command and args. +func NewCLITxExecutor(cmd *cobra.Command, args []string) CLITxExecutor { + return CLITxExecutor{ + Cmd: cmd, + Args: args, + } +} + +// WithName returns a copy of this CLITxExecutor that has the provided Name. +func (c CLITxExecutor) WithName(name string) CLITxExecutor { + c.Name = name + return c +} + +// WithCmd returns a copy of this CLITxExecutor that has the provided Cmd. +func (c CLITxExecutor) WithCmd(cmd *cobra.Command) CLITxExecutor { + c.Cmd = cmd + return c +} + +// WithArgs returns a copy of this CLITxExecutor that has the provided Args. +func (c CLITxExecutor) WithArgs(args []string) CLITxExecutor { + c.Args = args + return c +} + +// WithExpErr returns a copy of this CLITxExecutor that has the provided ExpErr. +func (c CLITxExecutor) WithExpErr(expErr bool) CLITxExecutor { + c.ExpErr = expErr + return c +} + +// WithExpErrMsg returns a copy of this CLITxExecutor that has the provided ExpErrMsg. +func (c CLITxExecutor) WithExpErrMsg(expErrMsg string) CLITxExecutor { + c.ExpErrMsg = expErrMsg + return c +} + +// WithExpInErrMsg returns a copy of this CLITxExecutor that has the provided ExpInErrMsg. +func (c CLITxExecutor) WithExpInErrMsg(expInErrMsg []string) CLITxExecutor { + c.ExpInErrMsg = expInErrMsg + return c +} + +// WithExpCode returns a copy of this CLITxExecutor that has the provided ExpCode. +func (c CLITxExecutor) WithExpCode(expCode uint32) CLITxExecutor { + c.ExpCode = expCode + return c +} + +// WithExpRawLog returns a copy of this CLITxExecutor that has the provided ExpRawLog. +func (c CLITxExecutor) WithExpRawLog(expRawLog string) CLITxExecutor { + c.ExpRawLog = expRawLog + return c +} + +// WithExpInRawLog returns a copy of this CLITxExecutor that has the provided ExpInRawLog. +func (c CLITxExecutor) WithExpInRawLog(expInRawLog []string) CLITxExecutor { + c.ExpInRawLog = expInRawLog + return c +} + +// Execute executes the command, requiring everything is as expected. +// +// It is possible for everything to be as expected, and still get a nil TxResponse from this. +// +// To allow test execution to continue on a failure, use AssertExecute. +func (c CLITxExecutor) Execute(t *testing.T, n *network.Network) *sdk.TxResponse { + t.Helper() + rv, ok := c.AssertExecute(t, n) + if !ok { + t.FailNow() + } + return rv +} + +// AssertExecute executes the command, asserting that everything is as expected. +// +// The returned TxResponse is nil if the command did not generate one, which is not dependent on the returned bool. +// The returned bool is true if everything is as expected, false otherwise. +// +// To halt test execution on failure, use Execute. +func (c CLITxExecutor) AssertExecute(t *testing.T, n *network.Network) (*sdk.TxResponse, bool) { + t.Helper() + if !assert.NotNil(t, c.Cmd, "CLITxExecutor.Cmd cannot be nil") { + return nil, false + } + if !assert.NotEmpty(t, n.Validators, "Network.Validators") { + return nil, false + } + + clientCtx := n.Validators[0].ClientCtx + out, err := sdkcli.ExecTestCLICmd(clientCtx, c.Cmd, c.Args) + outBz := out.Bytes() + t.Logf("ExecTestCLICmd %q %q\nOutput:\n%s", c.Cmd.Name(), c.Args, string(outBz)) + + // Make sure the error is as expected. + ok, expNoErr := true, true + if c.ExpErr { + ok = assert.Error(t, err, "ExecTestCLICmd error") && ok + expNoErr = false + } + if len(c.ExpErrMsg) > 0 { + ok = assert.EqualError(t, err, c.ExpErrMsg, "ExecTestCLICmd error") && ok + expNoErr = false + } + if len(c.ExpInErrMsg) > 0 { + ok = assertions.AssertErrorContents(t, err, c.ExpInErrMsg, "ExecTestCLICmd error") && ok + expNoErr = false + } + if expNoErr { + ok = assert.NoError(t, err, "ExecTestCLICmd error") && ok + } + + var txResp sdk.TxResponse + var gotResp bool + if err != nil { + // If there was an error, the output is likely just command help stuff. + // But just in case it's not, attempt to convert it to a TxResponse. + err = clientCtx.Codec.UnmarshalJSON(outBz, &txResp) + gotResp = err == nil + } else { + // If there wasn't an error, the account's sequence number was probably updated. + // So we always want to get the TxResponse in such a case. At the very least, + // it makes us wait a block, keeping the sequence number up-to-date for future tests. + txResp, gotResp = queries.AssertGetTxFromResponse(t, n, outBz) + ok = ok && gotResp + } + + // If we weren't able to get a response, there's nothing left to check. + if !gotResp { + return nil, ok + } + + // Check the response code. + ok = assert.Equal(t, int(c.ExpCode), int(txResp.Code), "response Code") && ok + + if len(c.ExpRawLog) > 0 { + ok = assert.Equal(t, c.ExpRawLog, txResp.RawLog, "response RawLog") && ok + } + if len(c.ExpInRawLog) > 0 { + for _, exp := range c.ExpInRawLog { + ok = assert.Contains(t, txResp.RawLog, exp, "response RawLog") && ok + } + } + + return &txResp, ok +} From 2674721a93d4f6ff933fd01fccc0e7b30b327b56 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Tue, 23 Apr 2024 14:35:56 -0600 Subject: [PATCH 28/42] [1760]: Remove unneccesary call to ValidateBasic from GetCmdAddNetAssetValues. --- x/metadata/client/cli/tx.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/x/metadata/client/cli/tx.go b/x/metadata/client/cli/tx.go index 207ab5c53a..ad36228c41 100644 --- a/x/metadata/client/cli/tx.go +++ b/x/metadata/client/cli/tx.go @@ -1220,10 +1220,6 @@ func GetCmdAddNetAssetValues() *cobra.Command { } msg := types.NewMsgAddNetAssetValuesRequest(scopeID.String(), signers, netAssetValues) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } From 18740580fa5fce5c3da0abc9d81f034830abe7f0 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Tue, 23 Apr 2024 14:37:36 -0600 Subject: [PATCH 29/42] [1760]: Use ErrUnauthorized (instead of ErrorInvalidSigner) when not all required signers have sined a MsgAddNetAssetValuesRequest. The latter doesn't quite make sense for the error, and the former is what's used elsewhere in there. --- x/metadata/keeper/msg_server.go | 4 ++-- x/metadata/keeper/msg_server_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x/metadata/keeper/msg_server.go b/x/metadata/keeper/msg_server.go index 8daf0200f6..3b421dbd78 100644 --- a/x/metadata/keeper/msg_server.go +++ b/x/metadata/keeper/msg_server.go @@ -739,7 +739,7 @@ func (k msgServer) SetAccountData( // AddNetAssetValues adds net asset values to a scope func (k msgServer) AddNetAssetValues(goCtx context.Context, msg *types.MsgAddNetAssetValuesRequest) (*types.MsgAddNetAssetValuesResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) + ctx := UnwrapMetadataContext(goCtx) scopeID, err := types.MetadataAddressFromBech32(msg.ScopeId) if err != nil { @@ -753,7 +753,7 @@ func (k msgServer) AddNetAssetValues(goCtx context.Context, msg *types.MsgAddNet _, err = k.validateAllRequiredSigned(ctx, scope.GetAllOwnerAddresses(), msg) if err != nil { - return nil, sdkerrors.ErrorInvalidSigner.Wrap(err.Error()) + return nil, sdkerrors.ErrUnauthorized.Wrap(err.Error()) } err = k.AddSetNetAssetValues(ctx, scopeID, msg.NetAssetValues, types.ModuleName) diff --git a/x/metadata/keeper/msg_server_test.go b/x/metadata/keeper/msg_server_test.go index 56a5571448..ca74c2d060 100644 --- a/x/metadata/keeper/msg_server_test.go +++ b/x/metadata/keeper/msg_server_test.go @@ -1360,7 +1360,7 @@ func (s *MsgServerTestSuite) TestAddNetAssetValue() { }, Signers: []string{user2}, }, - expErr: fmt.Sprintf("missing signature: %v: tx intended signer does not match the given signer", user1), + expErr: fmt.Sprintf("missing signature: %v: unauthorized", user1), }, { name: "successfully set nav", From 108e5d3cbf3e877b7928fcb7e5cfc7c4da5a9efd Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Tue, 23 Apr 2024 14:41:20 -0600 Subject: [PATCH 30/42] [1760]: Update all the Tx cli tests to use the new CLITxExecutor. --- x/attribute/client/cli/cli_test.go | 82 ++----- x/exchange/client/cli/cli_test.go | 122 ++-------- x/ibcratelimit/client/cli/cli_test.go | 30 +-- x/marker/client/cli/cli_test.go | 238 ++++++------------- x/metadata/client/cli/cli_test.go | 243 ++++++++++---------- x/msgfees/client/cli/cli_test.go | 54 ++--- x/name/client/cli/cli_test.go | 66 ++---- x/oracle/client/cli/cli_test.go | 107 ++++----- x/quarantine/client/testutil/common_test.go | 42 +--- x/quarantine/client/testutil/query_test.go | 33 +-- x/quarantine/client/testutil/tx_test.go | 156 +++---------- x/sanction/client/testutil/cli_test.go | 37 +-- x/sanction/client/testutil/tx_test.go | 83 ++----- x/trigger/client/cli/cli_test.go | 118 ++++------ 14 files changed, 456 insertions(+), 955 deletions(-) diff --git a/x/attribute/client/cli/cli_test.go b/x/attribute/client/cli/cli_test.go index e38d3946c0..29522680ae 100644 --- a/x/attribute/client/cli/cli_test.go +++ b/x/attribute/client/cli/cli_test.go @@ -28,6 +28,7 @@ import ( "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" + testcli "github.com/provenance-io/provenance/testutil/cli" "github.com/provenance-io/provenance/testutil/queries" "github.com/provenance-io/provenance/x/attribute/client/cli" attributetypes "github.com/provenance-io/provenance/x/attribute/types" @@ -709,18 +710,10 @@ func (s *IntegrationTestSuite) TestAttributeTxCommands() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) - - if tc.expectErr { - s.Require().Error(err) - } else { - s.Require().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(tc.expectedCode, txResp.Code) - } + testcli.NewCLITxExecutor(tc.cmd, tc.args). + WithExpErr(tc.expectErr). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } @@ -1024,19 +1017,10 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeTxCommands() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - s.T().Logf("clientCtx: %#v", clientCtx) - out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) - - if tc.expectErr { - s.Require().Error(err) - } else { - s.Require().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expectedCode), int(txResp.Code)) - } + testcli.NewCLITxExecutor(tc.cmd, tc.args). + WithExpErr(tc.expectErr). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } @@ -1138,18 +1122,10 @@ func (s *IntegrationTestSuite) TestDeleteDistinctAccountAttributeTxCommands() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) - - if tc.expectErr { - s.Require().Error(err) - } else { - s.Require().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expectedCode), int(txResp.Code)) - } + testcli.NewCLITxExecutor(tc.cmd, tc.args). + WithExpErr(tc.expectErr). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } @@ -1230,18 +1206,10 @@ func (s *IntegrationTestSuite) TestDeleteAccountAttributeTxCommands() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) - - if tc.expectErr { - s.Require().Error(err) - } else { - s.Require().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expectedCode), int(txResp.Code)) - } + testcli.NewCLITxExecutor(tc.cmd, tc.args). + WithExpErr(tc.expectErr). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } @@ -1551,18 +1519,10 @@ func (s *IntegrationTestSuite) TestUpdateAccountAttributeExpirationCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) - - if len(tc.expectErr) > 0 { - s.Require().EqualError(err, tc.expectErr) - } else { - s.Assert().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Assert().Equal(int(tc.expectedCode), int(txResp.Code)) - } + testcli.NewCLITxExecutor(tc.cmd, tc.args). + WithExpErrMsg(tc.expectErr). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } diff --git a/x/exchange/client/cli/cli_test.go b/x/exchange/client/cli/cli_test.go index dea564520e..0b9eb1de39 100644 --- a/x/exchange/client/cli/cli_test.go +++ b/x/exchange/client/cli/cli_test.go @@ -39,6 +39,7 @@ import ( "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" "github.com/provenance-io/provenance/testutil/assertions" + testcli "github.com/provenance-io/provenance/testutil/cli" "github.com/provenance-io/provenance/testutil/queries" "github.com/provenance-io/provenance/x/exchange" "github.com/provenance-io/provenance/x/exchange/client/cli" @@ -360,6 +361,8 @@ func (s *CmdTestSuite) SetupSuite() { s.testnet, err = testnet.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "testnet.New(...)") + s.testnet.Validators[0].ClientCtx = s.testnet.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) + _, err = testutil.WaitForHeight(s.testnet, 1) s.Require().NoError(err, "s.testnet.WaitForHeight(1)") } @@ -507,9 +510,7 @@ func contains[S ~[]E, E comparable](s S, v E) bool { // getClientCtx get a client context that knows about the suite's keyring. func (s *CmdTestSuite) getClientCtx() client.Context { - return s.testnet.Validators[0].ClientCtx. - WithKeyringDir(s.keyringDir). - WithKeyring(s.keyring) + return s.testnet.Validators[0].ClientCtx } // getAddrName tries to get the variable name (in this suite) of the provided address. @@ -587,35 +588,16 @@ func (s *CmdTestSuite) runTxCmdTestCase(tc txCmdTestCase) { s.T().Skip("Skipping execution due to pre-run failure.") } - cmdName := cmd.Name() - var outBz []byte - defer func() { - if s.T().Failed() { - s.T().Logf("Command: %s\nArgs: %q\nOutput\n%s", cmdName, args, string(outBz)) - cmdFailed = true - } - }() - - clientCtx := s.getClientCtx() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz = out.Bytes() - - s.assertErrorContents(err, tc.expInErr, "ExecTestCLICmd error") - for _, exp := range tc.expInErr { - s.Assert().Contains(string(outBz), exp, "command output should contain:\n%q", exp) - } - - if len(tc.expInErr) == 0 && err == nil { - resp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - txResponse = &resp - s.Assert().Equal(int(tc.expectedCode), int(resp.Code), "response code") - for _, exp := range tc.expInRawLog { - s.Assert().Contains(resp.RawLog, exp, "TxResponse.RawLog should contain:\n%q", exp) - } - } + var cmdOk bool + txResponse, cmdOk = testcli.NewCLITxExecutor(cmd, args). + WithExpInErrMsg(tc.expInErr). + WithExpCode(tc.expectedCode). + WithExpInRawLog(tc.expInRawLog). + AssertExecute(s.T(), s.testnet) + cmdFailed = !cmdOk } - if tc.preRun != nil { + if tc.preRun != nil || followup != nil { s.Run("execute: "+tc.name, testRunner) } else { testRunner() @@ -627,7 +609,7 @@ func (s *CmdTestSuite) runTxCmdTestCase(tc txCmdTestCase) { s.T().Skip("Skipping followup due to pre-run failure.") } if cmdFailed { - s.T().Skip("Skipping followup due to failure with command.") + s.T().Skip("Skipping followup due to execute failure.") } if s.Assert().NotNil(txResponse, "the TxResponse from the command output") { followup(txResponse) @@ -1046,27 +1028,12 @@ func (s *CmdTestSuite) createOrder(order *exchange.Order, creationFee *sdk.Coin) "--"+flags.FlagSkipConfirmation, ) - cmdName := cmd.Name() - failed := true - var outBz []byte - defer func() { - if failed { - s.T().Logf("Command: %s\nArgs: %q\nOutput\n%s", cmdName, args, string(outBz)) - } - }() - - clientCtx := s.getClientCtx() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz = out.Bytes() - s.Require().NoError(err, "ExecTestCLICmd error") - - resp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - orderIDStr, err := s.findNewOrderID(&resp) + resp := testcli.NewCLITxExecutor(cmd, args).Execute(s.T(), s.testnet) + s.Require().NotNil(resp, "TxResponse from creating order") + orderIDStr, err := s.findNewOrderID(resp) s.Require().NoError(err, "findNewOrderID") - rv := s.asOrderID(orderIDStr) - failed = false - return rv + return s.asOrderID(orderIDStr) } // commitFunds issues a command to commit funds. @@ -1088,23 +1055,7 @@ func (s *CmdTestSuite) commitFunds(addr sdk.AccAddress, marketID uint32, amount "--"+flags.FlagSkipConfirmation, ) - cmdName := cmd.Name() - failed := true - var outBz []byte - defer func() { - if failed { - s.T().Logf("Command: %s\nArgs: %q\nOutput\n%s", cmdName, args, string(outBz)) - } - }() - - clientCtx := s.getClientCtx() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz = out.Bytes() - s.Require().NoError(err, "ExecTestCLICmd error") - - resp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(0, int(resp.Code), "response code:\n%v", resp) - failed = false + testcli.NewCLITxExecutor(cmd, args).Execute(s.T(), s.testnet) } // createPayment issues a command to create a payment. @@ -1133,23 +1084,7 @@ func (s *CmdTestSuite) createPayment(payment *exchange.Payment) { "--"+flags.FlagSkipConfirmation, ) - failed := true - cmdName := cmd.Name() - var outBz []byte - defer func() { - if failed { - s.T().Logf("Command: %s\nArgs: %q\nOutput\n%s", cmdName, args, string(outBz)) - } - }() - - clientCtx := s.getClientCtx() - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz = out.Bytes() - s.Require().NoError(err, "ExecTestCLICmd error") - - resp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(0, int(resp.Code), "response code:\n%v", resp) - failed = false + testcli.NewCLITxExecutor(cmd, args).Execute(s.T(), s.testnet) } // queryBankBalances executes a bank query to get an account's balances. @@ -1164,32 +1099,15 @@ func (s *CmdTestSuite) queryBankSpendableBalances(addr string) sdk.Coins { // execBankSend executes a bank send command. func (s *CmdTestSuite) execBankSend(fromAddr, toAddr, amount string) { - clientCtx := s.getClientCtx() addrCdc := s.cfg.Codec.InterfaceRegistry().SigningContext().AddressCodec() cmd := bankcli.NewSendTxCmd(addrCdc) - cmdName := cmd.Name() args := []string{ fromAddr, toAddr, amount, "--" + flags.FlagFees, s.bondCoins(10).String(), "--" + flags.FlagBroadcastMode, flags.BroadcastSync, "--" + flags.FlagSkipConfirmation, } - - failed := true - var outBz []byte - defer func() { - if failed { - s.T().Logf("Command: %s\nArgs: %q\nOutput\n%s", cmdName, args, string(outBz)) - } - }() - - outBW, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz = outBW.Bytes() - s.Require().NoError(err, "ExecTestCLICmd error") - - resp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(0, int(resp.Code), "response code:\n%v", resp) - failed = false + testcli.NewCLITxExecutor(cmd, args).Execute(s.T(), s.testnet) } // untypeEvent calls untypeEvent and requires it to not return an error. diff --git a/x/ibcratelimit/client/cli/cli_test.go b/x/ibcratelimit/client/cli/cli_test.go index 4563018443..1bd8afcf98 100644 --- a/x/ibcratelimit/client/cli/cli_test.go +++ b/x/ibcratelimit/client/cli/cli_test.go @@ -4,9 +4,12 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/suite" + cmtcli "github.com/cometbft/cometbft/libs/cli" sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -17,13 +20,11 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - "github.com/provenance-io/provenance/testutil/queries" - - "github.com/stretchr/testify/suite" "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" + testcli "github.com/provenance-io/provenance/testutil/cli" "github.com/provenance-io/provenance/x/ibcratelimit" ibcratelimitcli "github.com/provenance-io/provenance/x/ibcratelimit/client/cli" ) @@ -101,6 +102,7 @@ func (s *TestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "network.New") + s.network.Validators[0].ClientCtx = s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) _, err = testutil.WaitForHeight(s.network, 6) s.Require().NoError(err, "WaitForHeight") } @@ -188,30 +190,20 @@ func (s *TestSuite) TestParamsUpdate() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) - cmd := ibcratelimitcli.GetCmdParamsUpdate() - flagArgs := []string{ + tc.args = append(tc.args, "--title", "Update ibc-rate-limit params", "--summary", "See title.", fmt.Sprintf("--%s=%s", flags.FlagFrom, tc.signer), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), fmt.Sprintf("--%s=json", cmtcli.OutputFlag), - } - tc.args = append(tc.args, flagArgs...) - - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), tc.args, string(outBz)) + ) - if len(tc.expectErrMsg) > 0 { - s.Assert().EqualError(err, tc.expectErrMsg, "should have correct error for invalid ParamsUpdate request") - } else { - s.Assert().NoError(err, "should have no error for valid ParamsUpdate request") - txResp := queries.GetTxFromResponse(s.T(), s.network, outBz) - s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "should have correct response code for valid ParamsUpdate request") - } + testcli.NewCLITxExecutor(cmd, tc.args). + WithExpErrMsg(tc.expectErrMsg). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.network) }) } } diff --git a/x/marker/client/cli/cli_test.go b/x/marker/client/cli/cli_test.go index 5b847a92be..2e410e2c54 100644 --- a/x/marker/client/cli/cli_test.go +++ b/x/marker/client/cli/cli_test.go @@ -4,6 +4,7 @@ import ( "encoding/base64" "fmt" "os" + "path/filepath" "sort" "strings" "testing" @@ -37,6 +38,7 @@ import ( "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" "github.com/provenance-io/provenance/testutil/assertions" + testcli "github.com/provenance-io/provenance/testutil/cli" "github.com/provenance-io/provenance/testutil/queries" attrcli "github.com/provenance-io/provenance/x/attribute/client/cli" attrtypes "github.com/provenance-io/provenance/x/attribute/types" @@ -937,19 +939,10 @@ func (s *IntegrationTestSuite) TestMarkerTxCommands() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - - out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) - - if tc.expectErr { - s.Require().Error(err) - } else { - s.Require().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "txResp.Code") - } + testcli.NewCLITxExecutor(tc.cmd, tc.args). + WithExpErr(tc.expectErr). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } @@ -1071,8 +1064,6 @@ func (s *IntegrationTestSuite) TestMarkerIbcTransfer() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - cmd := markercli.GetIbcTransferTxCmd() args := []string{ tc.srcPort, @@ -1096,22 +1087,20 @@ func (s *IntegrationTestSuite) TestMarkerIbcTransfer() { args = append(args, fmt.Sprintf("--%s=%s", markercli.FlagMemo, tc.flagMemo)) } - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) - - if len(tc.expectedErr) > 0 { - s.Assert().EqualError(err, tc.expectedErr) - } else { - s.Assert().NoError(err, tc.name) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(0, int(txResp.Code), "txResp.Code") - } + testcli.NewCLITxExecutor(cmd, args). + WithExpErrMsg(tc.expectedErr). + Execute(s.T(), s.testnet) }) } } func (s *IntegrationTestSuite) TestMarkerAuthzTxCommands() { + curClientCtx := s.testnet.Validators[0].ClientCtx + defer func() { + s.testnet.Validators[0].ClientCtx = curClientCtx + }() + s.testnet.Validators[0].ClientCtx = s.testnet.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) + testCases := []struct { name string args []string @@ -1185,24 +1174,16 @@ func (s *IntegrationTestSuite) TestMarkerAuthzTxCommands() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) - cmd := markercli.GetCmdGrantAuthorization() - tc.args = append(tc.args, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation)) - tc.args = append(tc.args, fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync)) - tc.args = append(tc.args, fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String())) - - out, err := clitestutil.ExecTestCLICmd(clientCtx, markercli.GetCmdGrantAuthorization(), tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), tc.args, string(outBz)) - - if len(tc.expectedErr) > 0 { - s.Assert().EqualError(err, tc.expectedErr) - } else { - s.Assert().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "txResp.Code") - } + tc.args = append(tc.args, + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), + ) + testcli.NewCLITxExecutor(cmd, tc.args). + WithExpErrMsg(tc.expectedErr). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } @@ -1284,15 +1265,10 @@ func (s *IntegrationTestSuite) TestMarkerTxGovProposals() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - p, err := os.CreateTemp("", "*") - tmpFile := p.Name() - - s.Require().NoError(err) - _, err = p.WriteString(tc.proposal) - s.Require().NoError(err) - s.Require().NoError(p.Sync()) - s.Require().NoError(p.Close()) + tmpDir := s.T().TempDir() + tmpFile := filepath.Join(tmpDir, "proposal.json") + err := os.WriteFile(tmpFile, []byte(tc.proposal), 0o666) + s.Require().NoError(err, "writing proposal to %s", tmpFile) cmd := markercli.GetCmdMarkerProposal() args := []string{ @@ -1306,19 +1282,10 @@ func (s *IntegrationTestSuite) TestMarkerTxGovProposals() { fmt.Sprintf("--%s=%s", flags.FlagGas, "500000"), } - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) - - if tc.expectErr { - s.Require().Error(err) - } else { - s.Require().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "txResp.Code") - } - - s.Require().NoError(os.Remove(tmpFile)) + testcli.NewCLITxExecutor(cmd, args). + WithExpErr(tc.expectErr). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } @@ -1559,19 +1526,10 @@ func (s *IntegrationTestSuite) TestAddFinalizeActivateMarkerTxCommands() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - - out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) - - if tc.expectErr { - s.Require().Error(err) - } else { - s.Require().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "txResp.Code") - } + testcli.NewCLITxExecutor(tc.cmd, tc.args). + WithExpErr(tc.expectErr). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } @@ -1642,19 +1600,9 @@ func (s *IntegrationTestSuite) TestUpdateRequiredAttributesTxCommand() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - - out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) - - if len(tc.expectedError) > 0 { - s.Require().EqualError(err, tc.expectedError) - } else { - s.Require().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(0, int(txResp.Code), "txResp.Code") - } + testcli.NewCLITxExecutor(tc.cmd, tc.args). + WithExpErrMsg(tc.expectedError). + Execute(s.T(), s.testnet) }) } } @@ -1674,13 +1622,7 @@ func (s *IntegrationTestSuite) TestGetCmdUpdateForcedTransfer() { fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), } - clientCtx := s.testnet.Validators[0].ClientCtx - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) - s.Require().NoError(err, "CmdAddFinalizeActivateMarker error") - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(0, int(txResp.Code), "txResp.Code") + testcli.NewCLITxExecutor(cmd, args).Execute(s.T(), s.testnet) }) if s.T().Failed() { s.FailNow("Stopping due to setup error") @@ -1730,52 +1672,40 @@ func (s *IntegrationTestSuite) TestGetCmdUpdateForcedTransfer() { for _, tc := range tests { s.Run(tc.name, func() { - cmd := markercli.GetCmdUpdateForcedTransfer() - - clientCtx := s.testnet.Validators[0].ClientCtx - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), tc.args, string(outBz)) - - outStr := string(outBz) - if len(tc.expErr) > 0 { - s.Require().EqualError(err, tc.expErr, "CmdUpdateForcedTransfer error") - s.Require().Contains(outStr, tc.expErr, "CmdUpdateForcedTransfer output") - } else { - s.Require().NoError(err, "CmdUpdateForcedTransfer error") - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expCode), int(txResp.Code), "txResp.Code") - - if tc.expCode == 0 { - expAttrs := []abci.EventAttribute{ - { - Key: "action", - Value: "/cosmos.gov.v1.MsgSubmitProposal", - Index: true, - }, - { - Key: "proposal_messages", - Value: ",/provenance.marker.v1.MsgUpdateForcedTransferRequest", - Index: true, - }, - } + txResp := testcli.NewCLITxExecutor(markercli.GetCmdUpdateForcedTransfer(), tc.args). + WithExpErrMsg(tc.expErr). + WithExpCode(tc.expCode). + Execute(s.T(), s.testnet) + + if txResp != nil && txResp.Code == 0 { + expAttrs := []abci.EventAttribute{ + { + Key: "action", + Value: "/cosmos.gov.v1.MsgSubmitProposal", + Index: true, + }, + { + Key: "proposal_messages", + Value: ",/provenance.marker.v1.MsgUpdateForcedTransferRequest", + Index: true, + }, + } - var actAttrs []abci.EventAttribute - for _, event := range txResp.Events { - actAttrs = append(actAttrs, event.Attributes...) - } + var actAttrs []abci.EventAttribute + for _, event := range txResp.Events { + actAttrs = append(actAttrs, event.Attributes...) + } - var missingAttrs []abci.EventAttribute - for _, exp := range expAttrs { - if !s.Assert().Contains(actAttrs, exp) { - missingAttrs = append(missingAttrs, exp) - } - } - if len(missingAttrs) > 0 { - s.T().Logf("Events:\n%s", strings.Join(assertions.ABCIEventsToStrings(txResp.Events), "\n")) - s.T().Logf("Missing Expected Attributes:\n%s", strings.Join(assertions.AttrsToStrings(missingAttrs), "\n")) + var missingAttrs []abci.EventAttribute + for _, exp := range expAttrs { + if !s.Assert().Contains(actAttrs, exp) { + missingAttrs = append(missingAttrs, exp) } } + if len(missingAttrs) > 0 { + s.T().Logf("Events:\n%s", strings.Join(assertions.ABCIEventsToStrings(txResp.Events), "\n")) + s.T().Logf("Missing Expected Attributes:\n%s", strings.Join(assertions.AttrsToStrings(missingAttrs), "\n")) + } } }) } @@ -1801,15 +1731,7 @@ func (s *IntegrationTestSuite) TestGetCmdAddNetAssetValues() { "--"+markercli.FlagSupplyFixed, "--"+markercli.FlagAllowGovernanceControl, ) - clientCtx := s.testnet.Validators[0].ClientCtx - - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) - s.Require().NoError(err, "CmdAddFinalizeActivateMarker error") - - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(0, int(txResp.Code), "txResp.Code") + testcli.NewCLITxExecutor(cmd, args).Execute(s.T(), s.testnet) }) if s.T().Failed() { s.FailNow("Stopping due to setup error") @@ -1838,21 +1760,9 @@ func (s *IntegrationTestSuite) TestGetCmdAddNetAssetValues() { for _, tc := range tests { s.Run(tc.name, func() { - cmd := markercli.GetCmdAddNetAssetValues() - - clientCtx := s.testnet.Validators[0].ClientCtx - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), tc.args, string(outBz)) - - if len(tc.expErr) > 0 { - s.Require().EqualError(err, tc.expErr, "GetCmdAddNetAssetValues error") - s.Require().Contains(string(outBz), tc.expErr, "GetCmdAddNetAssetValues output") - } else { - s.Require().NoError(err, "GetCmdAddNetAssetValues error") - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(0, int(txResp.Code), "txResp.Code") - } + testcli.NewCLITxExecutor(markercli.GetCmdAddNetAssetValues(), tc.args). + WithExpErrMsg(tc.expErr). + Execute(s.T(), s.testnet) }) } } diff --git a/x/metadata/client/cli/cli_test.go b/x/metadata/client/cli/cli_test.go index 2cddc85e40..448c028afd 100644 --- a/x/metadata/client/cli/cli_test.go +++ b/x/metadata/client/cli/cli_test.go @@ -31,9 +31,10 @@ import ( "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" - "github.com/provenance-io/provenance/testutil/queries" + testcli "github.com/provenance-io/provenance/testutil/cli" attrcli "github.com/provenance-io/provenance/x/attribute/client/cli" attrtypes "github.com/provenance-io/provenance/x/attribute/types" + markertypes "github.com/provenance-io/provenance/x/marker/types" "github.com/provenance-io/provenance/x/metadata/client/cli" "github.com/provenance-io/provenance/x/metadata/types" metadatatypes "github.com/provenance-io/provenance/x/metadata/types" @@ -172,11 +173,24 @@ func (s *IntegrationCLITestSuite) SetupSuite() { // Configure Genesis auth data for adding test accounts testutil.MutateGenesisState(s.T(), &s.cfg, authtypes.ModuleName, &authtypes.GenesisState{}, func(authData *authtypes.GenesisState) *authtypes.GenesisState { curCount := uint64(len(authData.Accounts)) + marker := &markertypes.MarkerAccount{ + BaseAccount: &authtypes.BaseAccount{ + Address: markertypes.MustGetMarkerAddress("jackthecat").String(), + AccountNumber: curCount, + }, + Status: markertypes.StatusActive, + Denom: "jackthecat", + Supply: sdkmath.NewInt(0), + MarkerType: markertypes.MarkerType_Coin, + SupplyFixed: false, + AllowGovernanceControl: true, + } genAccounts := []authtypes.GenesisAccount{ - authtypes.NewBaseAccount(s.accountAddr, nil, curCount, 0), - authtypes.NewBaseAccount(s.user1Addr, nil, curCount+1, 1), - authtypes.NewBaseAccount(s.user2Addr, nil, curCount+2, 1), - authtypes.NewBaseAccount(s.user3Addr, nil, curCount+3, 0), + marker, + authtypes.NewBaseAccount(s.accountAddr, nil, curCount+1, 0), + authtypes.NewBaseAccount(s.user1Addr, nil, curCount+2, 1), + authtypes.NewBaseAccount(s.user2Addr, nil, curCount+3, 1), + authtypes.NewBaseAccount(s.user3Addr, nil, curCount+4, 0), } accounts, err := authtypes.PackAccounts(genAccounts) s.Require().NoError(err, "PackAccounts") @@ -483,6 +497,8 @@ owner: %s`, s.testnet, err = testnet.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "creating testnet") + s.testnet.Validators[0].ClientCtx = s.testnet.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) + _, err = testutil.WaitForHeight(s.testnet, 1) s.Require().NoError(err, "waiting for height 1") } @@ -590,7 +606,7 @@ func alternateCase(str string, startUpper bool) string { } func (s *IntegrationCLITestSuite) getClientCtx() client.Context { - return s.getClientCtxWithoutKeyring().WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) + return s.testnet.Validators[0].ClientCtx } func (s *IntegrationCLITestSuite) getClientCtxWithoutKeyring() client.Context { @@ -620,7 +636,7 @@ func runQueryCmdTestCases(s *IntegrationCLITestSuite, cmdGen func() *cobra.Comma } }() - clientCtx := s.getClientCtxWithoutKeyring() + clientCtx := s.getClientCtx() out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) outStr = out.String() @@ -1786,7 +1802,7 @@ func (s *IntegrationCLITestSuite) TestGetAccountDataCmd() { type txCmdTestCase struct { name string - cmd *cobra.Command + cmd func() *cobra.Command args []string expectErrMsg string respType proto.Message // You only need to define this if you're expecting something other than a TxResponse. @@ -1797,19 +1813,10 @@ func runTxCmdTestCases(s *IntegrationCLITestSuite, testCases []txCmdTestCase) { s.T().Helper() for _, tc := range testCases { s.Run(tc.name, func() { - cmdName := tc.cmd.Name() - clientCtx := s.getClientCtx() - out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmdName, tc.args, string(outBz)) - - if len(tc.expectErrMsg) > 0 { - s.Require().EqualError(err, tc.expectErrMsg, "%s expected error message", cmdName) - } else { - s.Require().NoError(err, "%s unexpected error", cmdName) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "txResp.Code") - } + testcli.NewCLITxExecutor(tc.cmd(), tc.args). + WithExpErrMsg(tc.expectErrMsg). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } @@ -1820,7 +1827,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { testCases := []txCmdTestCase{ { name: "should successfully add scope specification for test setup", - cmd: cli.WriteScopeSpecificationCmd(), + cmd: cli.WriteScopeSpecificationCmd, args: []string{ scopeSpecID, s.accountAddrStr, @@ -1835,7 +1842,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should successfully add metadata scope", - cmd: cli.WriteScopeCmd(), + cmd: cli.WriteScopeCmd, args: []string{ scopeID, scopeSpecID, @@ -1851,7 +1858,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should successfully add metadata scope with signers flag", - cmd: cli.WriteScopeCmd(), + cmd: cli.WriteScopeCmd, args: []string{ metadatatypes.ScopeMetadataAddress(uuid.New()).String(), scopeSpecID, @@ -1868,7 +1875,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should successfully add metadata scope with party rollup", - cmd: cli.WriteScopeCmd(), + cmd: cli.WriteScopeCmd, args: []string{ scopeID, scopeSpecID, @@ -1885,7 +1892,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should fail to add metadata scope, incorrect scope id", - cmd: cli.WriteScopeCmd(), + cmd: cli.WriteScopeCmd, args: []string{ "not-a-uuid", metadatatypes.ScopeSpecMetadataAddress(uuid.New()).String(), @@ -1901,7 +1908,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should fail to add metadata scope, incorrect scope spec id", - cmd: cli.WriteScopeCmd(), + cmd: cli.WriteScopeCmd, args: []string{ metadatatypes.ScopeMetadataAddress(uuid.New()).String(), "not-a-uuid", @@ -1917,7 +1924,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should fail to add metadata scope, validate basic will err on owner format", - cmd: cli.WriteScopeCmd(), + cmd: cli.WriteScopeCmd, args: []string{ metadatatypes.ScopeMetadataAddress(uuid.New()).String(), metadatatypes.ScopeSpecMetadataAddress(uuid.New()).String(), @@ -1933,7 +1940,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should fail to remove metadata scope, invalid scopeid", - cmd: cli.RemoveScopeCmd(), + cmd: cli.RemoveScopeCmd, args: []string{ "not-valid", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), @@ -1945,7 +1952,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should fail to add/remove metadata scope data access, invalid scopeid", - cmd: cli.AddRemoveScopeDataAccessCmd(), + cmd: cli.AddRemoveScopeDataAccessCmd, args: []string{ "add", "not-valid", @@ -1959,7 +1966,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should fail to add/remove metadata scope data access, invalid command requires add or remove", - cmd: cli.AddRemoveScopeDataAccessCmd(), + cmd: cli.AddRemoveScopeDataAccessCmd, args: []string{ "notaddorremove", scopeID, @@ -1973,7 +1980,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should fail to add/remove metadata scope data access, not a scope id", - cmd: cli.AddRemoveScopeDataAccessCmd(), + cmd: cli.AddRemoveScopeDataAccessCmd, args: []string{ "add", scopeSpecID, @@ -1987,7 +1994,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should fail to add/remove metadata scope data access, validatebasic fails", - cmd: cli.AddRemoveScopeDataAccessCmd(), + cmd: cli.AddRemoveScopeDataAccessCmd, args: []string{ "add", scopeID, @@ -2001,7 +2008,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should successfully add metadata scope data access", - cmd: cli.AddRemoveScopeDataAccessCmd(), + cmd: cli.AddRemoveScopeDataAccessCmd, args: []string{ "add", scopeID, @@ -2015,7 +2022,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should successfully remove metadata scope data access", - cmd: cli.AddRemoveScopeDataAccessCmd(), + cmd: cli.AddRemoveScopeDataAccessCmd, args: []string{ "remove", scopeID, @@ -2030,7 +2037,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { { name: "should fail to add/remove metadata scope owners, invalid scopeid", - cmd: cli.AddRemoveScopeOwnersCmd(), + cmd: cli.AddRemoveScopeOwnersCmd, args: []string{ "add", "not-valid", @@ -2044,7 +2051,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should fail to add/remove metadata scope owner, invalid command requires add or remove", - cmd: cli.AddRemoveScopeOwnersCmd(), + cmd: cli.AddRemoveScopeOwnersCmd, args: []string{ "notaddorremove", scopeID, @@ -2058,7 +2065,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should fail to add/remove metadata scope owner, not a scope id", - cmd: cli.AddRemoveScopeOwnersCmd(), + cmd: cli.AddRemoveScopeOwnersCmd, args: []string{ "add", scopeSpecID, @@ -2072,7 +2079,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should fail to add/remove metadata scope owner, validatebasic fails", - cmd: cli.AddRemoveScopeOwnersCmd(), + cmd: cli.AddRemoveScopeOwnersCmd, args: []string{ "add", scopeID, @@ -2086,7 +2093,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should successfully remove metadata scope", - cmd: cli.RemoveScopeCmd(), + cmd: cli.RemoveScopeCmd, args: []string{ scopeID, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), @@ -2098,7 +2105,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should fail to delete metadata scope that no longer exists", - cmd: cli.RemoveScopeCmd(), + cmd: cli.RemoveScopeCmd, args: []string{ scopeID, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), @@ -2110,7 +2117,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should fail to write scope with optional party but without rollup", - cmd: cli.WriteScopeCmd(), + cmd: cli.WriteScopeCmd, args: []string{ metadatatypes.ScopeMetadataAddress(uuid.New()).String(), scopeSpecID, @@ -2126,7 +2133,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should fail write scope with invalid usd-mills", - cmd: cli.WriteScopeCmd(), + cmd: cli.WriteScopeCmd, args: []string{ metadatatypes.ScopeMetadataAddress(uuid.New()).String(), scopeSpecID, @@ -2144,7 +2151,7 @@ func (s *IntegrationCLITestSuite) TestScopeTxCommands() { }, { name: "should successfully write scope with optional party and rollup", - cmd: cli.WriteScopeCmd(), + cmd: cli.WriteScopeCmd, args: []string{ metadatatypes.ScopeMetadataAddress(uuid.New()).String(), scopeSpecID, @@ -2213,7 +2220,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { txs: []txCmdTestCase{ { name: "update: only 1 arg", - cmd: cli.UpdateValueOwnersCmd(), + cmd: cli.UpdateValueOwnersCmd, args: []string{ s.user2AddrStr, fromFlag(s.user1AddrStr), skipConfFlag, broadcastBlockFlag, feeFlag(10), @@ -2222,7 +2229,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { }, { name: "update: invalid value owner", - cmd: cli.UpdateValueOwnersCmd(), + cmd: cli.UpdateValueOwnersCmd, // [ ...] args: []string{ "notabech32", scopeID1, scopeID2, @@ -2232,7 +2239,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { }, { name: "update: invalid scope id", - cmd: cli.UpdateValueOwnersCmd(), + cmd: cli.UpdateValueOwnersCmd, // [ ...] args: []string{ s.user1AddrStr, scopeID1, scopeSpecID, @@ -2241,7 +2248,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { }, { name: "update: invalid signers", - cmd: cli.UpdateValueOwnersCmd(), + cmd: cli.UpdateValueOwnersCmd, // [ ...] args: []string{ s.user1AddrStr, scopeID1, scopeID2, @@ -2252,7 +2259,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { }, { name: "migrate: only 1 arg", - cmd: cli.MigrateValueOwnerCmd(), + cmd: cli.MigrateValueOwnerCmd, args: []string{ s.user2AddrStr, fromFlag(s.user1AddrStr), skipConfFlag, broadcastBlockFlag, feeFlag(10), @@ -2261,7 +2268,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { }, { name: "migrate: 3 args", - cmd: cli.MigrateValueOwnerCmd(), + cmd: cli.MigrateValueOwnerCmd, args: []string{ s.user1AddrStr, s.user2AddrStr, s.user3AddrStr, fromFlag(s.user1AddrStr), skipConfFlag, broadcastBlockFlag, feeFlag(10), @@ -2270,7 +2277,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { }, { name: "migrate: invalid existing value owner", - cmd: cli.MigrateValueOwnerCmd(), + cmd: cli.MigrateValueOwnerCmd, // [ ...] args: []string{ "notabech32", s.user2AddrStr, @@ -2280,7 +2287,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { }, { name: "migrate: invalid proposed value owner", - cmd: cli.MigrateValueOwnerCmd(), + cmd: cli.MigrateValueOwnerCmd, // [ ...] args: []string{ s.user2AddrStr, "notabech32", @@ -2290,7 +2297,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { }, { name: "migrate: invalid signers", - cmd: cli.MigrateValueOwnerCmd(), + cmd: cli.MigrateValueOwnerCmd, // [ ...] args: []string{ s.user1AddrStr, s.user2AddrStr, @@ -2306,7 +2313,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { txs: []txCmdTestCase{ { name: "setup: write scope spec", - cmd: cli.WriteScopeSpecificationCmd(), + cmd: cli.WriteScopeSpecificationCmd, // [specification-id] [owner-addresses] [responsible-parties] [contract-specification-ids] [description-name, optional] [description, optional] [website-url, optional] [icon-url, optional] args: []string{ scopeSpecID, s.accountAddrStr, "owner", s.contractSpecID.String(), @@ -2316,7 +2323,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { }, { name: "setup: write scope 1", - cmd: cli.WriteScopeCmd(), + cmd: cli.WriteScopeCmd, // [scope-id] [spec-id] [owners] [data-access] [value-owner-address] args: []string{ scopeID1, scopeSpecID, @@ -2327,7 +2334,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { }, { name: "setup: write scope 2", - cmd: cli.WriteScopeCmd(), + cmd: cli.WriteScopeCmd, // [scope-id] [spec-id] [owners] [data-access] [value-owner-address] args: []string{ scopeID2, scopeSpecID, @@ -2338,7 +2345,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { }, { name: "setup: write scope 3", - cmd: cli.WriteScopeCmd(), + cmd: cli.WriteScopeCmd, // [scope-id] [spec-id] [owners] [data-access] [value-owner-address] args: []string{ scopeID3, scopeSpecID, @@ -2355,7 +2362,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { txs: []txCmdTestCase{ { name: "update: incorrect signer", - cmd: cli.UpdateValueOwnersCmd(), + cmd: cli.UpdateValueOwnersCmd, // [ ...] args: []string{ s.accountAddrStr, scopeID1, scopeID2, @@ -2365,7 +2372,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { }, { name: "update: missing signature", - cmd: cli.UpdateValueOwnersCmd(), + cmd: cli.UpdateValueOwnersCmd, // [ ...] args: []string{ s.user2AddrStr, scopeID1, scopeID2, scopeID3, @@ -2375,7 +2382,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { }, { name: "migrate: incorrect signer", - cmd: cli.MigrateValueOwnerCmd(), + cmd: cli.MigrateValueOwnerCmd, // [ ...] args: []string{ s.user1AddrStr, s.user2AddrStr, @@ -2389,7 +2396,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { // A single update of two scopes. txs: []txCmdTestCase{{ name: "update: scopes 1 and 2 to user 2", - cmd: cli.UpdateValueOwnersCmd(), + cmd: cli.UpdateValueOwnersCmd, // [ ...] args: []string{ s.user2AddrStr, scopeID1, scopeID2, @@ -2403,7 +2410,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { // A single update of 3 scopes. txs: []txCmdTestCase{{ name: "update: scopes 1 2 and 3 to user 3", - cmd: cli.UpdateValueOwnersCmd(), + cmd: cli.UpdateValueOwnersCmd, // [ ...] args: []string{ s.user3AddrStr, scopeID1, scopeID2, scopeID3, @@ -2418,7 +2425,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { txs: []txCmdTestCase{ { name: "update: scope 1 to user 1", - cmd: cli.UpdateValueOwnersCmd(), + cmd: cli.UpdateValueOwnersCmd, // [ ...] args: []string{ s.user1AddrStr, scopeID1, @@ -2428,7 +2435,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { }, { name: "update: scope 2 to user 2", - cmd: cli.UpdateValueOwnersCmd(), + cmd: cli.UpdateValueOwnersCmd, // [ ...] args: []string{ s.user2AddrStr, scopeID2, @@ -2443,7 +2450,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { // A single migrate of 1 scope. txs: []txCmdTestCase{{ name: "migrate: user 1 scope to user 2", - cmd: cli.MigrateValueOwnerCmd(), + cmd: cli.MigrateValueOwnerCmd, // [ ...] args: []string{ s.user1AddrStr, s.user2AddrStr, @@ -2457,7 +2464,7 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { // A single migrate of 2 scopes. txs: []txCmdTestCase{{ name: "migrate: user 2 scopes to user 3", - cmd: cli.MigrateValueOwnerCmd(), + cmd: cli.MigrateValueOwnerCmd, // [ ...] args: []string{ s.user2AddrStr, s.user3AddrStr, @@ -2494,8 +2501,8 @@ func (s *IntegrationCLITestSuite) TestUpdateMigrateValueOwnersCmds() { } func (s *IntegrationCLITestSuite) TestScopeSpecificationTxCommands() { - addCommand := cli.WriteScopeSpecificationCmd() - removeCommand := cli.RemoveScopeSpecificationCmd() + addCommand := cli.WriteScopeSpecificationCmd + removeCommand := cli.RemoveScopeSpecificationCmd specID := metadatatypes.ScopeSpecMetadataAddress(uuid.New()) testCases := []txCmdTestCase{ { @@ -2625,7 +2632,7 @@ func (s *IntegrationCLITestSuite) TestAddObjectLocatorCmd() { testCases := []txCmdTestCase{ { name: "Should successfully add os locator", - cmd: cli.BindOsLocatorCmd(), + cmd: cli.BindOsLocatorCmd, args: []string{ s.accountAddrStr, userURI, @@ -2638,7 +2645,7 @@ func (s *IntegrationCLITestSuite) TestAddObjectLocatorCmd() { }, { name: "Should successfully Modify os locator", - cmd: cli.ModifyOsLocatorCmd(), + cmd: cli.ModifyOsLocatorCmd, args: []string{ s.accountAddrStr, userURIMod, @@ -2651,7 +2658,7 @@ func (s *IntegrationCLITestSuite) TestAddObjectLocatorCmd() { }, { name: "Should successfully delete os locator", - cmd: cli.RemoveOsLocatorCmd(), + cmd: cli.RemoveOsLocatorCmd, args: []string{ s.accountAddrStr, userURIMod, @@ -2668,8 +2675,8 @@ func (s *IntegrationCLITestSuite) TestAddObjectLocatorCmd() { } func (s *IntegrationCLITestSuite) TestContractSpecificationTxCommands() { - addCommand := cli.WriteContractSpecificationCmd() - removeCommand := cli.RemoveContractSpecificationCmd() + addCommand := cli.WriteContractSpecificationCmd + removeCommand := cli.RemoveContractSpecificationCmd contractSpecUUID := uuid.New() specificationID := metadatatypes.ContractSpecMetadataAddress(contractSpecUUID) testCases := []txCmdTestCase{ @@ -2816,8 +2823,8 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationTxCommands() { } func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxCommands() { - addCommand := cli.AddContractSpecToScopeSpecCmd() - removeCommand := cli.RemoveContractSpecFromScopeSpecCmd() + addCommand := cli.AddContractSpecToScopeSpecCmd + removeCommand := cli.RemoveContractSpecFromScopeSpecCmd contractSpecUUID := uuid.New() specificationID := metadatatypes.ContractSpecMetadataAddress(contractSpecUUID) scopeSpecID := metadatatypes.ScopeSpecMetadataAddress(uuid.New()) @@ -2825,7 +2832,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC testCases := []txCmdTestCase{ { name: "should successfully add contract specification for test initialization", - cmd: cli.WriteContractSpecificationCmd(), + cmd: cli.WriteContractSpecificationCmd, args: []string{ specificationID.String(), s.accountAddrStr, @@ -2841,7 +2848,7 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC }, { name: "should successfully add scope specification for test setup", - cmd: cli.WriteScopeSpecificationCmd(), + cmd: cli.WriteScopeSpecificationCmd, args: []string{ scopeSpecID.String(), s.accountAddrStr, @@ -2990,9 +2997,9 @@ func (s *IntegrationCLITestSuite) TestContractSpecificationScopeSpecAddRemoveTxC } func (s *IntegrationCLITestSuite) TestRecordSpecificationTxCommands() { - cmd := cli.WriteRecordSpecificationCmd() - addConractSpecCmd := cli.WriteContractSpecificationCmd() - deleteRecordSpecCmd := cli.RemoveRecordSpecificationCmd() + cmd := cli.WriteRecordSpecificationCmd + addConractSpecCmd := cli.WriteContractSpecificationCmd + deleteRecordSpecCmd := cli.RemoveRecordSpecificationCmd recordName := "testrecordspecid" contractSpecUUID := uuid.New() contractSpecID := metadatatypes.ContractSpecMetadataAddress(contractSpecUUID) @@ -3191,7 +3198,7 @@ func (s *IntegrationCLITestSuite) TestRecordSpecificationTxCommands() { func (s *IntegrationCLITestSuite) TestRecordTxCommands() { userAddress := s.accountAddrStr - addRecordCmd := cli.WriteRecordCmd() + addRecordCmd := cli.WriteRecordCmd scopeSpecID := metadatatypes.ScopeSpecMetadataAddress(uuid.New()) scopeUUID := uuid.New() scopeID := metadatatypes.ScopeMetadataAddress(scopeUUID) @@ -3207,7 +3214,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { testCases := []txCmdTestCase{ { name: "should successfully add contract specification with resource hash for test setup", - cmd: cli.WriteContractSpecificationCmd(), + cmd: cli.WriteContractSpecificationCmd, args: []string{ contractSpecID.String(), userAddress, @@ -3223,7 +3230,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { }, { name: "should successfully add scope specification for test setup", - cmd: cli.WriteScopeSpecificationCmd(), + cmd: cli.WriteScopeSpecificationCmd, args: []string{ scopeSpecID.String(), userAddress, @@ -3238,7 +3245,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { }, { name: "should successfully add metadata scope for test setup", - cmd: cli.WriteScopeCmd(), + cmd: cli.WriteScopeCmd, args: []string{ scopeID.String(), scopeSpecID.String(), @@ -3254,7 +3261,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { }, { name: "should successfully add record specification for test setup", - cmd: cli.WriteRecordSpecificationCmd(), + cmd: cli.WriteRecordSpecificationCmd, args: []string{ recSpecID.String(), recordName, @@ -3423,7 +3430,7 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { }, { name: "should successfully remove record", - cmd: cli.RemoveRecordCmd(), + cmd: cli.RemoveRecordCmd, args: []string{ recordId.String(), fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddrStr), @@ -3438,14 +3445,13 @@ func (s *IntegrationCLITestSuite) TestRecordTxCommands() { } func (s *IntegrationCLITestSuite) TestWriteSessionCmd() { - cmd := cli.WriteSessionCmd() + cmd := cli.WriteSessionCmd owner := s.accountAddrStr sender := s.accountAddrStr scopeUUID := uuid.New() scopeID := metadatatypes.ScopeMetadataAddress(scopeUUID) - ctx := s.getClientCtx() writeScopeCmd := cli.WriteScopeCmd() scopeArgs := []string{ scopeID.String(), @@ -3458,12 +3464,7 @@ func (s *IntegrationCLITestSuite) TestWriteSessionCmd() { fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()), } - scopeOut, scopeErr := clitestutil.ExecTestCLICmd(ctx, writeScopeCmd, scopeArgs) - scopeOutBz := scopeOut.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", writeScopeCmd.Name(), scopeArgs, string(scopeOutBz)) - s.Require().NoError(scopeErr, "adding base scope") - scopeResp := queries.GetTxFromResponse(s.T(), s.testnet, scopeOutBz) - s.Require().Equal(0, int(scopeResp.Code), "write-scope response code") + testcli.NewCLITxExecutor(writeScopeCmd, scopeArgs).Execute(s.T(), s.testnet) testCases := []txCmdTestCase{ { @@ -3612,9 +3613,7 @@ func (s *IntegrationCLITestSuite) TestWriteSessionCmd() { } func (s *IntegrationCLITestSuite) TestSetAccountDataCmd() { - cmd := func() *cobra.Command { - return cli.SetAccountDataCmd() - } + cmd := cli.SetAccountDataCmd scopeUUID := uuid.New() scopeID := metadatatypes.ScopeMetadataAddress(scopeUUID) @@ -3654,19 +3653,19 @@ func (s *IntegrationCLITestSuite) TestSetAccountDataCmd() { tests := []txCmdTestCase{ { name: "invalid address", - cmd: cmd(), + cmd: cmd, args: stdFlagsPlus("notanaddr"), expectErrMsg: `invalid metadata address "notanaddr": decoding bech32 failed: invalid separator index -1`, }, { name: "no value", - cmd: cmd(), + cmd: cmd, args: stdFlagsPlus(scopeIDStr), expectErrMsg: "exactly one of these must be provided: " + attrcli.AccountDataFlagsUse, }, { name: "invalid signers", - cmd: cmd(), + cmd: cmd, args: stdFlagsPlus( scopeIDStr, "--"+attrcli.FlagValue, "Some new value.", @@ -3676,7 +3675,7 @@ func (s *IntegrationCLITestSuite) TestSetAccountDataCmd() { }, { name: "incorrect signer", - cmd: cmd(), + cmd: cmd, args: []string{ scopeIDStr, "--" + attrcli.FlagValue, "Some new value.", @@ -3689,7 +3688,7 @@ func (s *IntegrationCLITestSuite) TestSetAccountDataCmd() { }, { name: "all okay", - cmd: cmd(), + cmd: cmd, args: stdFlagsPlus( scopeIDStr, "--"+attrcli.FlagValue, "This is the account data for a test scope.", @@ -3742,7 +3741,7 @@ func (s *IntegrationCLITestSuite) TestCountAuthorizationIntactTxCommands() { testCases := []txCmdTestCase{ { name: "should successfully add scope specification for test setup", - cmd: cli.WriteScopeSpecificationCmd(), + cmd: cli.WriteScopeSpecificationCmd, args: []string{ scopeSpecID, s.accountAddrStr, @@ -3757,7 +3756,7 @@ func (s *IntegrationCLITestSuite) TestCountAuthorizationIntactTxCommands() { }, { name: "should successfully add metadata scope with two owners - owner 1 as value owner", - cmd: cli.WriteScopeCmd(), + cmd: cli.WriteScopeCmd, args: []string{ scopeID, scopeSpecID, @@ -3773,7 +3772,9 @@ func (s *IntegrationCLITestSuite) TestCountAuthorizationIntactTxCommands() { }, { name: "should successfully add count authorization from owner 1 to signer 3", - cmd: authzcli.NewCmdGrantAuthorization(s.cfg.Codec.InterfaceRegistry().SigningContext().AddressCodec()), + cmd: func() *cobra.Command { + return authzcli.NewCmdGrantAuthorization(s.cfg.Codec.InterfaceRegistry().SigningContext().AddressCodec()) + }, args: []string{ s.user3AddrStr, "count", @@ -3788,7 +3789,7 @@ func (s *IntegrationCLITestSuite) TestCountAuthorizationIntactTxCommands() { }, { name: "should fail to remove metadata scope with signer 3 due to missing authz grant from owner 2", - cmd: cli.RemoveScopeCmd(), + cmd: cli.RemoveScopeCmd, args: []string{ scopeID, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.user3AddrStr), @@ -3800,7 +3801,9 @@ func (s *IntegrationCLITestSuite) TestCountAuthorizationIntactTxCommands() { }, { name: "should successfully add count authorization from owner 2 to signer 3", - cmd: authzcli.NewCmdGrantAuthorization(s.cfg.Codec.InterfaceRegistry().SigningContext().AddressCodec()), + cmd: func() *cobra.Command { + return authzcli.NewCmdGrantAuthorization(s.cfg.Codec.InterfaceRegistry().SigningContext().AddressCodec()) + }, args: []string{ s.user3AddrStr, "count", @@ -3815,7 +3818,7 @@ func (s *IntegrationCLITestSuite) TestCountAuthorizationIntactTxCommands() { }, { name: "should successfully remove metadata scope with signer 3, found grants for owner 1 & 2", - cmd: cli.RemoveScopeCmd(), + cmd: cli.RemoveScopeCmd, args: []string{ scopeID, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.user3AddrStr), @@ -3831,10 +3834,10 @@ func (s *IntegrationCLITestSuite) TestCountAuthorizationIntactTxCommands() { } func (s *IntegrationCLITestSuite) TestGetCmdAddNetAssetValues() { - scopeID := "scope1qzge0zaztu65tx5x5llv5xc9ztsqxlkwel" + scopeID := s.scopeID.String() argsWStdFlags := func(args ...string) []string { return append(args, - fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), + fmt.Sprintf("--%s=%s", flags.FlagFrom, s.user1AddrStr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), @@ -3850,7 +3853,7 @@ func (s *IntegrationCLITestSuite) TestGetCmdAddNetAssetValues() { { name: "invalid net asset string", args: argsWStdFlags(scopeID, "invalid"), - expErr: ("invalid net asset value coin : invalid"), + expErr: "invalid net asset value coin : invalid", }, { name: "address not meta address", @@ -3874,19 +3877,9 @@ func (s *IntegrationCLITestSuite) TestGetCmdAddNetAssetValues() { for _, tc := range tests { s.Run(tc.name, func() { - cmd := cli.GetCmdAddNetAssetValues() - - clientCtx := s.testnet.Validators[0].ClientCtx - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) - outBz := out.Bytes() - outStr := string(outBz) - - if len(tc.expErr) > 0 { - s.Require().EqualError(err, tc.expErr, "GetCmdAddNetAssetValues error") - s.Require().Contains(outStr, tc.expErr, "GetCmdAddNetAssetValues output") - } else { - s.Require().NoError(err, "GetCmdAddNetAssetValues error") - } + testcli.NewCLITxExecutor(cli.GetCmdAddNetAssetValues(), tc.args). + WithExpErrMsg(tc.expErr). + Execute(s.T(), s.testnet) }) } } @@ -3956,8 +3949,6 @@ func (s *IntegrationCLITestSuite) TestParseNetAssertValueString() { }, } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { result, err := cli.ParseNetAssetValueString(tc.netAssetValues) if len(tc.expErr) > 0 { diff --git a/x/msgfees/client/cli/cli_test.go b/x/msgfees/client/cli/cli_test.go index 30859ecd5a..840f877083 100644 --- a/x/msgfees/client/cli/cli_test.go +++ b/x/msgfees/client/cli/cli_test.go @@ -11,14 +11,13 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" testnet "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" - "github.com/provenance-io/provenance/testutil/queries" + testcli "github.com/provenance-io/provenance/testutil/cli" msgfeescli "github.com/provenance-io/provenance/x/msgfees/client/cli" "github.com/provenance-io/provenance/x/msgfees/types" ) @@ -217,8 +216,6 @@ func (s *IntegrationTestSuite) TestMsgFeesTxGovProposals() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - cmd := msgfeescli.GetCmdMsgFeesProposal() args := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), @@ -238,17 +235,10 @@ func (s *IntegrationTestSuite) TestMsgFeesTxGovProposals() { args = append(args, tc.bips) } - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) - - if len(tc.expectErrMsg) != 0 { - s.Assert().EqualError(err, tc.expectErrMsg) - } else { - s.Require().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "response code") - } + testcli.NewCLITxExecutor(cmd, args). + WithExpErrMsg(tc.expectErrMsg). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } @@ -294,8 +284,6 @@ func (s *IntegrationTestSuite) TestUpdateUsdConversionRateProposal() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - cmd := msgfeescli.GetUpdateNhashPerUsdMilProposal() args := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), @@ -305,17 +293,10 @@ func (s *IntegrationTestSuite) TestUpdateUsdConversionRateProposal() { } args = append(args, tc.name, tc.description, tc.rate, tc.deposit) - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) - - if len(tc.expectErrMsg) != 0 { - s.Require().EqualError(err, tc.expectErrMsg) - } else { - s.Require().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "response code") - } + testcli.NewCLITxExecutor(cmd, args). + WithExpErrMsg(tc.expectErrMsg). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } @@ -352,8 +333,6 @@ func (s *IntegrationTestSuite) TestUpdateConversionFeeDenomProposal() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - cmd := msgfeescli.GetUpdateConversionFeeDenomProposal() args := []string{ fmt.Sprintf("--%s=%s", flags.FlagFrom, s.testnet.Validators[0].Address.String()), @@ -363,17 +342,10 @@ func (s *IntegrationTestSuite) TestUpdateConversionFeeDenomProposal() { } args = append(args, tc.name, tc.description, tc.conversionFeeDenom, tc.deposit) - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) - - if len(tc.expectErrMsg) != 0 { - s.Require().EqualError(err, tc.expectErrMsg) - } else { - s.Require().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "response code") - } + testcli.NewCLITxExecutor(cmd, args). + WithExpErrMsg(tc.expectErrMsg). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } diff --git a/x/name/client/cli/cli_test.go b/x/name/client/cli/cli_test.go index fcf6d606b9..220fa2ef28 100644 --- a/x/name/client/cli/cli_test.go +++ b/x/name/client/cli/cli_test.go @@ -28,7 +28,7 @@ import ( "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" - "github.com/provenance-io/provenance/testutil/queries" + testcli "github.com/provenance-io/provenance/testutil/cli" namecli "github.com/provenance-io/provenance/x/name/client/cli" nametypes "github.com/provenance-io/provenance/x/name/types" ) @@ -349,18 +349,10 @@ func (s *IntegrationTestSuite) TestGetBindNameCommand() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) - - if tc.expectErr { - s.Require().Error(err) - } else { - s.Require().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "response code") - } + testcli.NewCLITxExecutor(tc.cmd, tc.args). + WithExpErr(tc.expectErr). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } @@ -422,18 +414,10 @@ func (s *IntegrationTestSuite) TestGetDeleteNameCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) - - if tc.expectErr { - s.Require().Error(err) - } else { - s.Require().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "response code") - } + testcli.NewCLITxExecutor(tc.cmd, tc.args). + WithExpErr(tc.expectErr). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } @@ -528,18 +512,10 @@ func (s *IntegrationTestSuite) TestGetModifyNameCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx - out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) - - if len(tc.errMsg) > 0 { - s.Assert().EqualError(err, tc.errMsg) - } else { - s.Assert().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "response code") - } + testcli.NewCLITxExecutor(tc.cmd, tc.args). + WithExpErrMsg(tc.errMsg). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } @@ -696,20 +672,12 @@ func (s *IntegrationTestSuite) TestCreateRootNameCmd() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.testnet.Validators[0].ClientCtx // because the cmd runs inside of the gov cmd (which adds flags) we register here so we can use it directly. flags.AddTxFlagsToCmd(tc.cmd) - out, err := clitestutil.ExecTestCLICmd(clientCtx, tc.cmd, tc.args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", tc.cmd.Name(), tc.args, string(outBz)) - - if tc.expectErr { - s.Require().Error(err) - } else { - s.Require().NoError(err) - txResp := queries.GetTxFromResponse(s.T(), s.testnet, outBz) - s.Require().Equal(int(tc.expectedCode), int(txResp.Code), "response code") - } + testcli.NewCLITxExecutor(tc.cmd, tc.args). + WithExpErr(tc.expectErr). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.testnet) }) } } diff --git a/x/oracle/client/cli/cli_test.go b/x/oracle/client/cli/cli_test.go index 849c65c4f7..24be33bf44 100644 --- a/x/oracle/client/cli/cli_test.go +++ b/x/oracle/client/cli/cli_test.go @@ -24,7 +24,7 @@ import ( "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" - "github.com/provenance-io/provenance/testutil/queries" + testcli "github.com/provenance-io/provenance/testutil/cli" oraclecli "github.com/provenance-io/provenance/x/oracle/client/cli" "github.com/provenance-io/provenance/x/oracle/types" oracletypes "github.com/provenance-io/provenance/x/oracle/types" @@ -55,60 +55,51 @@ func (s *IntegrationTestSuite) SetupSuite() { pioconfig.SetProvenanceConfig("", 0) govv1.DefaultMinDepositRatio = sdkmath.LegacyZeroDec() s.accountKey = secp256k1.GenPrivKeyFromSecret([]byte("acc2")) - addr, err := sdk.AccAddressFromHexUnsafe(s.accountKey.PubKey().Address().String()) - s.Require().NoError(err) - s.accountAddr = addr + var addrErr error + s.accountAddr, addrErr = sdk.AccAddressFromHexUnsafe(s.accountKey.PubKey().Address().String()) + s.Require().NoError(addrErr) s.cfg = testutil.DefaultTestNetworkConfig() - genesisState := s.cfg.GenesisState - s.cfg.NumValidators = 1 + s.cfg.ChainID = antewrapper.SimAppChainID s.GenerateAccountsWithKeyrings(2) - var genBalances []banktypes.Balance - for i := range s.accountAddresses { - genBalances = append(genBalances, banktypes.Balance{Address: s.accountAddresses[i].String(), Coins: sdk.NewCoins( - sdk.NewInt64Coin("nhash", 100_000_000), sdk.NewInt64Coin(s.cfg.BondDenom, 100_000_000), - ).Sort()}) - } - var bankGenState banktypes.GenesisState - bankGenState.Params = banktypes.DefaultParams() - bankGenState.Balances = genBalances - bankDataBz, err := s.cfg.Codec.MarshalJSON(&bankGenState) - s.Require().NoError(err, "should be able to marshal bank genesis state when setting up suite") - genesisState[banktypes.ModuleName] = bankDataBz - - var authData authtypes.GenesisState - var genAccounts []authtypes.GenesisAccount - authData.Params = authtypes.DefaultParams() - genAccounts = append(genAccounts, authtypes.NewBaseAccount(s.accountAddresses[0], nil, 3, 0)) - genAccounts = append(genAccounts, authtypes.NewBaseAccount(s.accountAddresses[1], nil, 4, 0)) - accounts, err := authtypes.PackAccounts(genAccounts) - s.Require().NoError(err, "should be able to pack accounts for genesis state when setting up suite") - authData.Accounts = accounts - authDataBz, err := s.cfg.Codec.MarshalJSON(&authData) - s.Require().NoError(err, "should be able to marshal auth genesis state when setting up suite") - genesisState[authtypes.ModuleName] = authDataBz + testutil.MutateGenesisState(s.T(), &s.cfg, banktypes.ModuleName, &banktypes.GenesisState{}, func(bankGenState *banktypes.GenesisState) *banktypes.GenesisState { + for i := range s.accountAddresses { + bankGenState.Balances = append(bankGenState.Balances, banktypes.Balance{Address: s.accountAddresses[i].String(), Coins: sdk.NewCoins( + sdk.NewInt64Coin("nhash", 100_000_000), sdk.NewInt64Coin(s.cfg.BondDenom, 100_000_000), + ).Sort()}) + } + return bankGenState + }) + + testutil.MutateGenesisState(s.T(), &s.cfg, authtypes.ModuleName, &authtypes.GenesisState{}, func(authData *authtypes.GenesisState) *authtypes.GenesisState { + var genAccounts []authtypes.GenesisAccount + genAccounts = append(genAccounts, + authtypes.NewBaseAccount(s.accountAddresses[0], nil, 3, 0), + authtypes.NewBaseAccount(s.accountAddresses[1], nil, 4, 0), + ) + accounts, err := authtypes.PackAccounts(genAccounts) + s.Require().NoError(err, "should be able to pack accounts for genesis state when setting up suite") + authData.Accounts = accounts + return authData + }) s.port = oracletypes.PortID s.oracle = "cosmos1w6t0l7z0yerj49ehnqwqaayxqpe3u7e23edgma" - oracleData := oracletypes.NewGenesisState( - s.port, - s.oracle, - ) - - oracleDataBz, err := s.cfg.Codec.MarshalJSON(oracleData) - s.Require().NoError(err, "should be able to marshal trigger genesis state when setting up suite") - genesisState[oracletypes.ModuleName] = oracleDataBz - - s.cfg.GenesisState = genesisState - - s.cfg.ChainID = antewrapper.SimAppChainID + testutil.MutateGenesisState(s.T(), &s.cfg, oracletypes.ModuleName, &oracletypes.GenesisState{}, func(oracleData *oracletypes.GenesisState) *oracletypes.GenesisState { + oracleData.PortId = s.port + oracleData.Oracle = s.oracle + return oracleData + }) + var err error s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "network.New") + s.network.Validators[0].ClientCtx = s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) + _, err = testutil.WaitForHeight(s.network, 6) s.Require().NoError(err, "WaitForHeight") } @@ -193,8 +184,6 @@ func (s *IntegrationTestSuite) TestOracleUpdate() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) - cmd := oraclecli.GetCmdOracleUpdate() args := []string{ tc.address, @@ -205,15 +194,10 @@ func (s *IntegrationTestSuite) TestOracleUpdate() { "--title", "Update the oracle", "--summary", "Update it real good", fmt.Sprintf("--%s=json", cmtcli.OutputFlag), } - - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) - s.Assert().NoError(err, "should have no error for valid OracleUpdate request") - - txResp := queries.GetTxFromResponse(s.T(), s.network, outBz) - s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "should have correct response code for valid OracleUpdate request") - s.Assert().Contains(txResp.RawLog, tc.expectErrMsg, "should have correct error for invalid OracleUpdate request") + testcli.NewCLITxExecutor(cmd, args). + WithExpCode(tc.expectedCode). + WithExpInRawLog([]string{tc.expectErrMsg}). + Execute(s.T(), s.network) }) } } @@ -259,8 +243,6 @@ func (s *IntegrationTestSuite) TestSendQuery() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) - cmd := oraclecli.GetCmdSendQuery() args := []string{ tc.channel, @@ -272,17 +254,10 @@ func (s *IntegrationTestSuite) TestSendQuery() { fmt.Sprintf("--%s=json", cmtcli.OutputFlag), } - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) - - if len(tc.expectErrMsg) > 0 { - s.Assert().ErrorContains(err, tc.expectErrMsg, "should have correct error for invalid SendQuery request") - } else { - s.Assert().NoError(err, "should have no error for valid SendQuery request") - txResp := queries.GetTxFromResponse(s.T(), s.network, outBz) - s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "should have correct response code for valid SendQuery request") - } + testcli.NewCLITxExecutor(cmd, args). + WithExpInErrMsg([]string{tc.expectErrMsg}). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.network) }) } } diff --git a/x/quarantine/client/testutil/common_test.go b/x/quarantine/client/testutil/common_test.go index e6a1f5ead7..f618539e15 100644 --- a/x/quarantine/client/testutil/common_test.go +++ b/x/quarantine/client/testutil/common_test.go @@ -13,14 +13,13 @@ import ( addresscodec "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" bankcli "github.com/cosmos/cosmos-sdk/x/bank/client/cli" "github.com/provenance-io/provenance/testutil" "github.com/provenance-io/provenance/testutil/assertions" - "github.com/provenance-io/provenance/testutil/queries" + testcli "github.com/provenance-io/provenance/testutil/cli" ) type IntegrationTestSuite struct { @@ -105,19 +104,7 @@ func (s *IntegrationTestSuite) addAccountToKeyring(index, count int) string { // createAndFundAccount creates an account, adding the key to the keyring, funded with the provided amount of bond-denom coins. func (s *IntegrationTestSuite) createAndFundAccount(bondCoinAmt int64) string { addr := s.addAccountToKeyring(1, 1) - out, err := clitestutil.MsgSendExec( - s.clientCtx, - s.valAddr, - asStringer(addr), - s.bondCoins(bondCoinAmt), - s.addrCodec, - s.commonFlags..., - ) - s.Require().NoError(err, "MsgSendExec") - outBz := out.Bytes() - s.T().Logf("MsgSendExec response:\n%s", string(outBz)) - s.waitForTx(outBz, "MsgSendExec") - + s.execBankSend(s.valAddr.String(), addr, s.bondCoins(bondCoinAmt).String()) return addr } @@ -137,11 +124,7 @@ func (s *IntegrationTestSuite) createAndFundAccounts(count int, bondCoinAmt int6 args = append(args, amount) args = s.appendCommonFlagsTo(args...) - out, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, args) - s.Require().NoError(err, "ExecTestCLICmd bank multisend") - outBZ := out.Bytes() - s.T().Logf("Multisend response:\n%s", string(outBZ)) - s.waitForTx(outBZ, "Multisend") + testcli.NewCLITxExecutor(cmd, args).Execute(s.T(), s.network) return addrs } @@ -176,19 +159,12 @@ func (s *IntegrationTestSuite) waitForNextBlock(msgAndArgs ...interface{}) { s.Require().NoErrorf(testutil.WaitForNextBlock(s.network), "WaitForNextBlock "+msg, args...) } -// waitForTx calls GetTxFromResponse and makes sure the result code is 0. -func (s *IntegrationTestSuite) waitForTx(respBz []byte, msgAndArgs ...interface{}) { - s.T().Helper() - msg, args := s.splitMsgAndArgs(msgAndArgs) - if len(msg) == 0 { - msg = "tx response code." - } else { - msg = msg + " tx response code." - } - msg = msg + " Tx response:\n%#v" - resp := queries.GetTxFromResponse(s.T(), s.network, respBz) - args = append(args, resp) - s.Require().Equalf(0, int(resp.Code), msg, args...) +// execBankSend executes a bank send command. +func (s *IntegrationTestSuite) execBankSend(fromAddr, toAddr, amount string) { + addrCdc := s.cfg.Codec.InterfaceRegistry().SigningContext().AddressCodec() + cmd := bankcli.NewSendTxCmd(addrCdc) + args := s.appendCommonFlagsTo(fromAddr, toAddr, amount) + testcli.NewCLITxExecutor(cmd, args).Execute(s.T(), s.network) } var _ fmt.Stringer = asStringer("") diff --git a/x/quarantine/client/testutil/query_test.go b/x/quarantine/client/testutil/query_test.go index 1769152197..74701e7482 100644 --- a/x/quarantine/client/testutil/query_test.go +++ b/x/quarantine/client/testutil/query_test.go @@ -6,9 +6,9 @@ import ( tmcli "github.com/cometbft/cometbft/libs/cli" "github.com/cosmos/cosmos-sdk/testutil/cli" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/types/query" + testcli "github.com/provenance-io/provenance/testutil/cli" "github.com/provenance-io/provenance/x/quarantine" client "github.com/provenance-io/provenance/x/quarantine/client/cli" ) @@ -21,19 +21,12 @@ func (s *IntegrationTestSuite) TestQueryQuarantinedFundsCmd() { addr1 := addrs[1] // Opt addr0 into quarantine. - _, err := cli.ExecTestCLICmd(s.clientCtx, client.TxOptInCmd(), - s.appendCommonFlagsTo(addr0), - ) - s.Require().NoError(err, "TxOptInCmd addr0") + testcli.NewCLITxExecutor(client.TxOptInCmd(), s.appendCommonFlagsTo(addr0)). + Execute(s.T(), s.network) quarantinedAmount := int64(50) // Send some funds from 1 to 0 so that there's some quarantined funds to find. - outBW, err := clitestutil.MsgSendExec(s.clientCtx, - asStringer(addr1), asStringer(addr0), s.bondCoins(quarantinedAmount), - s.addrCodec, s.commonFlags..., - ) - s.Require().NoError(err, "MsgSendExec 1 -> 0, 50") - s.waitForTx(outBW.Bytes(), "MsgSendExec") + s.execBankSend(addr1, addr0, s.bondCoins(quarantinedAmount).String()) newQF := func(to, from string, amt int64) *quarantine.QuarantinedFunds { return &quarantine.QuarantinedFunds{ @@ -141,11 +134,8 @@ func (s *IntegrationTestSuite) TestQueryIsQuarantinedCmd() { addr1 := addrs[1] // Opt addr0 into quarantine. - outBW, err := cli.ExecTestCLICmd(s.clientCtx, client.TxOptInCmd(), - s.appendCommonFlagsTo(addr0), - ) - s.Require().NoError(err, "TxOptInCmd addr0") - s.waitForTx(outBW.Bytes(), "TxOptInCmd") + testcli.NewCLITxExecutor(client.TxOptInCmd(), s.appendCommonFlagsTo(addr0)). + Execute(s.T(), s.network) tests := []struct { name string @@ -174,7 +164,7 @@ func (s *IntegrationTestSuite) TestQueryIsQuarantinedCmd() { s.Run(tc.name, func() { cmd := client.QueryIsQuarantinedCmd() args := append(tc.args, fmt.Sprintf("--%s=json", tmcli.OutputFlag)) - outBW, err = cli.ExecTestCLICmd(s.clientCtx, cmd, args) + outBW, err := cli.ExecTestCLICmd(s.clientCtx, cmd, args) out := outBW.String() s.T().Logf("Output:\n%s", out) s.assertErrorContents(err, tc.expErr, "QueryIsQuarantinedCmd error") @@ -204,11 +194,8 @@ func (s *IntegrationTestSuite) TestQueryAutoResponsesCmd() { // Set 0 <- 1 to auto-accept. // Set 0 <- 2 to auto-decline. - outBW, err := cli.ExecTestCLICmd(s.clientCtx, client.TxUpdateAutoResponsesCmd(), - s.appendCommonFlagsTo(addr0, "accept", addr1, "decline", addr2), - ) - s.Require().NoError(err, "TxUpdateAutoResponsesCmd for setup") - s.waitForTx(outBW.Bytes(), "TxUpdateAutoResponsesCmd") + testcli.NewCLITxExecutor(client.TxUpdateAutoResponsesCmd(), s.appendCommonFlagsTo(addr0, "accept", addr1, "decline", addr2)). + Execute(s.T(), s.network) newARE := func(to, from string, response quarantine.AutoResponse) *quarantine.AutoResponseEntry { return &quarantine.AutoResponseEntry{ @@ -289,7 +276,7 @@ func (s *IntegrationTestSuite) TestQueryAutoResponsesCmd() { s.Run(tc.name, func() { cmd := client.QueryAutoResponsesCmd() args := append(tc.args, fmt.Sprintf("--%s=json", tmcli.OutputFlag)) - outBW, err = cli.ExecTestCLICmd(s.clientCtx, cmd, args) + outBW, err := cli.ExecTestCLICmd(s.clientCtx, cmd, args) out := outBW.String() s.T().Logf("Output:\n%s", out) s.assertErrorContents(err, tc.expErr, "QueryAutoResponsesCmd error") diff --git a/x/quarantine/client/testutil/tx_test.go b/x/quarantine/client/testutil/tx_test.go index 646b478689..1dfec16b7e 100644 --- a/x/quarantine/client/testutil/tx_test.go +++ b/x/quarantine/client/testutil/tx_test.go @@ -6,9 +6,9 @@ import ( tmcli "github.com/cometbft/cometbft/libs/cli" "github.com/cosmos/cosmos-sdk/testutil/cli" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" sdk "github.com/cosmos/cosmos-sdk/types" + testcli "github.com/provenance-io/provenance/testutil/cli" "github.com/provenance-io/provenance/testutil/queries" "github.com/provenance-io/provenance/x/quarantine" client "github.com/provenance-io/provenance/x/quarantine/client/cli" @@ -21,7 +21,7 @@ func (s *IntegrationTestSuite) TestTxOptInCmd() { name string args []string expErr []string - expCode int + expCode uint32 }{ { name: "empty addr", @@ -42,25 +42,10 @@ func (s *IntegrationTestSuite) TestTxOptInCmd() { for _, tc := range tests { s.Run(tc.name, func() { - cmd := client.TxOptInCmd() - cmdFuncName := "TxOptInCmd" - args := append(tc.args, s.commonFlags...) - outBW, err := cli.ExecTestCLICmd(s.clientCtx, cmd, args) - out := outBW.String() - s.T().Logf("Output:\n%s", out) - s.assertErrorContents(err, tc.expErr, "%s error", cmdFuncName) - for _, expErr := range tc.expErr { - s.Assert().Contains(out, expErr, "%s output with error", cmdFuncName) - } - if len(tc.expErr) == 0 { - var txResp sdk.TxResponse - testFuncUn := func() { - err = s.clientCtx.Codec.UnmarshalJSON([]byte(out), &txResp) - } - if s.Assert().NotPanics(testFuncUn, "UnmarshalJSON output") { - s.Assert().Equal(tc.expCode, int(txResp.Code), "%s response code", cmdFuncName) - } - } + testcli.NewCLITxExecutor(client.TxOptInCmd(), s.appendCommonFlagsTo(tc.args...)). + WithExpInErrMsg(tc.expErr). + WithExpCode(tc.expCode). + Execute(s.T(), s.network) }) } } @@ -72,7 +57,7 @@ func (s *IntegrationTestSuite) TestTxOptOutCmd() { name string args []string expErr []string - expCode int + expCode uint32 }{ { name: "empty addr", @@ -93,25 +78,10 @@ func (s *IntegrationTestSuite) TestTxOptOutCmd() { for _, tc := range tests { s.Run(tc.name, func() { - cmd := client.TxOptOutCmd() - cmdFuncName := "TxOptOutCmd" - args := append(tc.args, s.commonFlags...) - outBW, err := cli.ExecTestCLICmd(s.clientCtx, cmd, args) - out := outBW.String() - s.T().Logf("Output:\n%s", out) - s.assertErrorContents(err, tc.expErr, "%s error", cmdFuncName) - for _, expErr := range tc.expErr { - s.Assert().Contains(out, expErr, "%s output with error", cmdFuncName) - } - if len(tc.expErr) == 0 { - var txResp sdk.TxResponse - testFuncUn := func() { - err = s.clientCtx.Codec.UnmarshalJSON([]byte(out), &txResp) - } - if s.Assert().NotPanics(testFuncUn, "UnmarshalJSON output") { - s.Assert().Equal(tc.expCode, int(txResp.Code), "%s response code", cmdFuncName) - } - } + testcli.NewCLITxExecutor(client.TxOptOutCmd(), s.appendCommonFlagsTo(tc.args...)). + WithExpInErrMsg(tc.expErr). + WithExpCode(tc.expCode). + Execute(s.T(), s.network) }) } } @@ -128,7 +98,7 @@ func (s *IntegrationTestSuite) TestTxAcceptCmd() { name string args []string expErr []string - expCode int + expCode uint32 }{ { name: "empty to address", @@ -194,22 +164,10 @@ func (s *IntegrationTestSuite) TestTxAcceptCmd() { for _, tc := range tests { s.Run(tc.name, func() { - cmd := client.TxAcceptCmd() - cmdFuncName := "TxAcceptCmd" - args := append(tc.args, s.commonFlags...) - outBW, err := cli.ExecTestCLICmd(s.clientCtx, cmd, args) - out := outBW.String() - s.T().Logf("Output:\n%s", out) - s.assertErrorContents(err, tc.expErr, "%s error", cmdFuncName) - for _, expErr := range tc.expErr { - s.Assert().Contains(out, expErr, "%s output with error", cmdFuncName) - } - if len(tc.expErr) == 0 { - txResp, ok := queries.AssertGetTxFromResponse(s.T(), s.network, []byte(out)) - if ok { - s.Assert().Equal(tc.expCode, int(txResp.Code), "%s response code", cmdFuncName) - } - } + testcli.NewCLITxExecutor(client.TxAcceptCmd(), s.appendCommonFlagsTo(tc.args...)). + WithExpInErrMsg(tc.expErr). + WithExpCode(tc.expCode). + Execute(s.T(), s.network) }) } } @@ -226,7 +184,7 @@ func (s *IntegrationTestSuite) TestTxDeclineCmd() { name string args []string expErr []string - expCode int + expCode uint32 }{ { name: "empty to address", @@ -292,22 +250,10 @@ func (s *IntegrationTestSuite) TestTxDeclineCmd() { for _, tc := range tests { s.Run(tc.name, func() { - cmd := client.TxDeclineCmd() - cmdFuncName := "TxDeclineCmd" - args := append(tc.args, s.commonFlags...) - outBW, err := cli.ExecTestCLICmd(s.clientCtx, cmd, args) - out := outBW.String() - s.T().Logf("Output:\n%s", out) - s.assertErrorContents(err, tc.expErr, "%s error", cmdFuncName) - for _, expErr := range tc.expErr { - s.Assert().Contains(out, expErr, "%s output with error", cmdFuncName) - } - if len(tc.expErr) == 0 { - txResp, ok := queries.AssertGetTxFromResponse(s.T(), s.network, []byte(out)) - if ok { - s.Assert().Equal(tc.expCode, int(txResp.Code), "%s response code", cmdFuncName) - } - } + testcli.NewCLITxExecutor(client.TxDeclineCmd(), s.appendCommonFlagsTo(tc.args...)). + WithExpInErrMsg(tc.expErr). + WithExpCode(tc.expCode). + Execute(s.T(), s.network) }) } } @@ -323,7 +269,7 @@ func (s *IntegrationTestSuite) TestTxUpdateAutoResponsesCmd() { name string args []string expErr []string - expCode int + expCode uint32 }{ { name: "empty to address", @@ -362,22 +308,10 @@ func (s *IntegrationTestSuite) TestTxUpdateAutoResponsesCmd() { for _, tc := range tests { s.Run(tc.name, func() { - cmd := client.TxUpdateAutoResponsesCmd() - cmdFuncName := "TxUpdateAutoResponsesCmd" - args := append(tc.args, s.commonFlags...) - outBW, err := cli.ExecTestCLICmd(s.clientCtx, cmd, args) - out := outBW.String() - s.T().Logf("Output:\n%s", out) - s.assertErrorContents(err, tc.expErr, "%s error", cmdFuncName) - for _, expErr := range tc.expErr { - s.Assert().Contains(out, expErr, "%s output with error", cmdFuncName) - } - if len(tc.expErr) == 0 { - txResp, ok := queries.AssertGetTxFromResponse(s.T(), s.network, []byte(out)) - if ok { - s.Assert().Equal(tc.expCode, int(txResp.Code), "%s response code", cmdFuncName) - } - } + testcli.NewCLITxExecutor(client.TxUpdateAutoResponsesCmd(), s.appendCommonFlagsTo(tc.args...)). + WithExpInErrMsg(tc.expErr). + WithExpCode(tc.expCode). + Execute(s.T(), s.network) }) } } @@ -397,14 +331,10 @@ func (s *IntegrationTestSuite) TestSendAndAcceptQuarantinedFunds() { asJSONFlag := fmt.Sprintf("--%s=json", tmcli.OutputFlag) s.Run("opt toAddr into quarantine", func() { - outBW, err := cli.ExecTestCLICmd(s.clientCtx, client.TxOptInCmd(), s.appendCommonFlagsTo(toAddr)) - out := outBW.String() - s.T().Logf("TxOptInCmd Output:\n%s", out) - s.Require().NoError(err, "TxOptInCmd error") - s.waitForTx([]byte(out)) + testcli.NewCLITxExecutor(client.TxOptInCmd(), s.appendCommonFlagsTo(toAddr)).Execute(s.T(), s.network) - outBW, err = cli.ExecTestCLICmd(s.clientCtx, client.QueryIsQuarantinedCmd(), []string{toAddr, asJSONFlag}) - out = outBW.String() + outBW, err := cli.ExecTestCLICmd(s.clientCtx, client.QueryIsQuarantinedCmd(), []string{toAddr, asJSONFlag}) + out := outBW.String() s.T().Logf("QueryIsQuarantinedCmd Output:\n%s", out) s.Require().NoError(err, "QueryIsQuarantinedCmd error") resp := &quarantine.QueryIsQuarantinedResponse{} @@ -418,20 +348,8 @@ func (s *IntegrationTestSuite) TestSendAndAcceptQuarantinedFunds() { s.stopIfFailed() s.Run("do two sends from different addresses", func() { - outBW, err := clitestutil.MsgSendExec(s.clientCtx, - asStringer(fromAddr1), asStringer(toAddr), s.bondCoins(amt1), - s.addrCodec, s.commonFlags..., - ) - s.T().Logf("MsgSendExec 1 Output:\n%s", outBW.String()) - s.Require().NoError(err, "MsgSendExec 1") - - outBW, err = clitestutil.MsgSendExec(s.clientCtx, - asStringer(fromAddr2), asStringer(toAddr), s.bondCoins(amt2), - s.addrCodec, s.commonFlags..., - ) - s.T().Logf("MsgSendExec 2 Output:\n%s", outBW.String()) - s.Require().NoError(err, "MsgSendExec 2") - s.waitForTx(outBW.Bytes(), "MsgSendExec") + s.execBankSend(fromAddr1, toAddr, s.bondCoins(amt1).String()) + s.execBankSend(fromAddr2, toAddr, s.bondCoins(amt2).String()) expFunds := []*quarantine.QuarantinedFunds{ { @@ -447,10 +365,12 @@ func (s *IntegrationTestSuite) TestSendAndAcceptQuarantinedFunds() { Declined: false, }, } - outBW, err = cli.ExecTestCLICmd(s.clientCtx, client.QueryQuarantinedFundsCmd(), []string{toAddr, asJSONFlag}) + + outBW, err := cli.ExecTestCLICmd(s.clientCtx, client.QueryQuarantinedFundsCmd(), []string{toAddr, asJSONFlag}) out := outBW.String() s.T().Logf("QueryQuarantinedFundsCmd Output:\n%s", out) s.Require().NoError(err, "QueryQuarantinedFundsCmd error") + resp := &quarantine.QueryQuarantinedFundsResponse{} s.Require().NotPanics(func() { err = s.clientCtx.Codec.UnmarshalJSON([]byte(out), resp) @@ -462,12 +382,10 @@ func (s *IntegrationTestSuite) TestSendAndAcceptQuarantinedFunds() { s.stopIfFailed() s.Run("accept the quarantined funds", func() { - outBW, err := cli.ExecTestCLICmd(s.clientCtx, client.TxAcceptCmd(), s.appendCommonFlagsTo(toAddr, fromAddr2, fromAddr1)) - s.T().Logf("TxAcceptCmd Output:\n%s", outBW.String()) - s.Require().NoError(err, "TxAcceptCmd error") - s.waitForTx(outBW.Bytes(), "TxAcceptCmd") + testcli.NewCLITxExecutor(client.TxAcceptCmd(), s.appendCommonFlagsTo(toAddr, fromAddr2, fromAddr1)). + Execute(s.T(), s.network) - outBW, err = cli.ExecTestCLICmd(s.clientCtx, client.QueryQuarantinedFundsCmd(), []string{toAddr, asJSONFlag}) + outBW, err := cli.ExecTestCLICmd(s.clientCtx, client.QueryQuarantinedFundsCmd(), []string{toAddr, asJSONFlag}) out := outBW.String() s.T().Logf("QueryQuarantinedFundsCmd Output:\n%s", out) s.Require().NoError(err, "QueryQuarantinedFundsCmd error") diff --git a/x/sanction/client/testutil/cli_test.go b/x/sanction/client/testutil/cli_test.go index 0b60e66be0..c58f83c409 100644 --- a/x/sanction/client/testutil/cli_test.go +++ b/x/sanction/client/testutil/cli_test.go @@ -25,6 +25,7 @@ import ( "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" + testcli "github.com/provenance-io/provenance/testutil/cli" "github.com/provenance-io/provenance/testutil/queries" "github.com/provenance-io/provenance/x/sanction" client "github.com/provenance-io/provenance/x/sanction/client/cli" @@ -176,15 +177,11 @@ func (s *IntegrationTestSuite) TestSanctionValidatorImmediateUsingGovCmds() { // Finally, wait for the next block. s.waitForNextBlock("wait for next block 2") - startHeight := s.logHeight() // Submit the proposal. s.T().Logf("Proposal: %s\n%s", propFile, propMsgBz) - propOutBW, err := cli.ExecTestCLICmd(s.clientCtx, propCmd, propArgs) - s.Require().NoError(err, "ExecTestCLICmd tx gov submit-proposal") - propOutBz := propOutBW.Bytes() - s.T().Logf("tx gov submit-proposal output:\n%s", propOutBz) - propHeight := s.waitForHeight(startHeight + 1) + testcli.NewCLITxExecutor(propCmd, propArgs).Execute(s.T(), s.network) + propHeight := s.logHeight() // Find the last proposal (assuming it's the one just submitted above). lastProp := queries.GetLastGovProp(s.T(), s.network) @@ -201,13 +198,27 @@ func (s *IntegrationTestSuite) TestSanctionValidatorImmediateUsingGovCmds() { s.Require().NoError(err, "Unmarshal QueryIsSanctionedResponse (first time)") s.Assert().True(isSanctOut1.IsSanctioned, "is sanctioned (first time)") - // Cast votes on it. + // Cast votes on it. We don't use a CLITxExecutor because we can't wait for a new + // block after each vote. We'll check all of them manually once they're submitted. + voteOutBzs := make([][]byte, len(allVoteArgs)) for i, voteArgs := range allVoteArgs { voteArgs[0] = propID voteOutBW, err := cli.ExecTestCLICmd(s.clientCtx, voteCmd, voteArgs) s.Require().NoError(err, "[%d]: ExecTestCLICmd tx gov vote", i) - voteOutBz := voteOutBW.Bytes() - s.T().Logf("[%d]: tx gov vote output:\n%s", i, voteOutBz) + voteOutBzs[i] = voteOutBW.Bytes() + s.T().Logf("[%d]: tx gov vote output:\n%s", i, voteOutBzs[i]) + } + // And now, we check that the votes happened as expected. + for i, voteOutBz := range voteOutBzs { + txResp := queries.GetTxFromResponse(s.T(), s.network, voteOutBz) + if i != sanctionValI { + s.Assert().Equal(0, int(txResp.Code), "vote[%d] response code", i) + } else { + s.Assert().Equal(5, int(txResp.Code), "vote[%d] response code", i) + s.Assert().Contains(txResp.RawLog, "cannot send from "+s.network.Validators[i].Address.String(), "vote[%d] Raw Log") + s.Assert().Contains(txResp.RawLog, "account is sanctioned", "vote[%d] Raw Log") + s.Assert().Contains(txResp.RawLog, "insufficient funds", "vote[%d] Raw Log") + } } // We configured 1/2 second per block, and a 2-second voting period. @@ -230,11 +241,11 @@ func (s *IntegrationTestSuite) TestSanctionValidatorImmediateUsingGovCmds() { s.Require().NoError(err, "Unmarshal QueryIsSanctionedResponse (second time)") s.Assert().True(isSanctOut2.IsSanctioned, "is sanctioned (second time)") - // Wait 10 more blocks to make sure nothing unravels. + // Wait 5 more blocks to make sure nothing unravels. lastHeight := s.logHeight() - s.T().Log("waiting 10 blocks before final checks") - _, err = testutil.WaitForHeightWithTimeout(s.network, lastHeight+10, 30*time.Second) - s.Require().NoError(err, "waiting for block %d (or 30 seconds)", lastHeight+10) + s.T().Log("waiting 5 blocks before final checks") + _, err = testutil.WaitForHeightWithTimeout(s.network, lastHeight+5, 30*time.Second) + s.Require().NoError(err, "waiting for block %d (or 30 seconds)", lastHeight+5) s.logHeight() // Check that that validator is still sanctioned one last time. diff --git a/x/sanction/client/testutil/tx_test.go b/x/sanction/client/testutil/tx_test.go index 578a027874..1ce069a952 100644 --- a/x/sanction/client/testutil/tx_test.go +++ b/x/sanction/client/testutil/tx_test.go @@ -2,11 +2,11 @@ package testutil import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/testutil/cli" sdk "github.com/cosmos/cosmos-sdk/types" govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" "github.com/provenance-io/provenance/internal/provcli" + testcli "github.com/provenance-io/provenance/testutil/cli" "github.com/provenance-io/provenance/testutil/queries" "github.com/provenance-io/provenance/x/sanction" client "github.com/provenance-io/provenance/x/sanction/client/cli" @@ -41,6 +41,9 @@ func (s *IntegrationTestSuite) assertGovPropMsg(propID string, msg sdk.Msg) bool // findProposalID looks through the provided response to find a governance proposal id. // If one is found, it's returned (as a string). Otherwise, an empty string is returned. func (s *IntegrationTestSuite) findProposalID(resp *sdk.TxResponse) string { + if resp == nil { + return "" + } for _, event := range resp.Events { if event.Type == "submit_proposal" { for _, attr := range event.Attributes { @@ -114,30 +117,14 @@ func (s *IntegrationTestSuite) TestTxSanctionCmd() { for _, tc := range tests { s.Run(tc.name, func() { - cmd := client.TxSanctionCmd() - cmdFuncName := "TxSanctionCmd" args := s.appendCommonArgsTo(tc.args...) - args = append(args, "--title", cmdFuncName, "--summary", tc.name) - - outBW, err := cli.ExecTestCLICmd(s.clientCtx, cmd, args) - out := outBW.String() - s.T().Logf("Output:\n%s", out) - s.assertErrorContents(err, tc.expErr, "%s error", cmdFuncName) - for _, expErr := range tc.expErr { - s.Assert().Contains(out, expErr, "%s output with error", cmdFuncName) - } - - var propID string - if len(tc.expErr) == 0 { - s.waitForNextBlock() - txResp, ok := queries.AssertGetTxFromResponse(s.T(), s.network, []byte(out)) - if ok { - s.Assert().Equal(0, int(txResp.Code), "%s response code", cmdFuncName) - } - propID = s.findProposalID(&txResp) - } + args = append(args, "--title", "TxSanctionCmd", "--summary", tc.name) + txResp := testcli.NewCLITxExecutor(client.TxSanctionCmd(), args). + WithExpInErrMsg(tc.expErr). + Execute(s.T(), s.network) if tc.expPropMsg != nil { + propID := s.findProposalID(txResp) s.assertGovPropMsg(propID, tc.expPropMsg) } }) @@ -205,30 +192,14 @@ func (s *IntegrationTestSuite) TestTxUnsanctionCmd() { for _, tc := range tests { s.Run(tc.name, func() { - cmd := client.TxUnsanctionCmd() - cmdFuncName := "TxUnsanctionCmd" args := s.appendCommonArgsTo(tc.args...) - args = append(args, "--title", cmdFuncName, "--summary", tc.name) - - outBW, err := cli.ExecTestCLICmd(s.clientCtx, cmd, args) - out := outBW.String() - s.T().Logf("Output:\n%s", out) - s.assertErrorContents(err, tc.expErr, "%s error", cmdFuncName) - for _, expErr := range tc.expErr { - s.Assert().Contains(out, expErr, "%s output with error", cmdFuncName) - } - - var propID string - if len(tc.expErr) == 0 { - s.waitForNextBlock() - txResp, ok := queries.AssertGetTxFromResponse(s.T(), s.network, []byte(out)) - if ok { - s.Assert().Equal(0, int(txResp.Code), "%s response code", cmdFuncName) - } - propID = s.findProposalID(&txResp) - } + args = append(args, "--title", "TxUnsanctionCmd", "--summary", tc.name) + txResp := testcli.NewCLITxExecutor(client.TxUnsanctionCmd(), args). + WithExpInErrMsg(tc.expErr). + Execute(s.T(), s.network) if tc.expPropMsg != nil { + propID := s.findProposalID(txResp) s.assertGovPropMsg(propID, tc.expPropMsg) } }) @@ -327,30 +298,14 @@ func (s *IntegrationTestSuite) TestTxUpdateParamsCmd() { for _, tc := range tests { s.Run(tc.name, func() { - cmd := client.TxUpdateParamsCmd() - cmdFuncName := "TxUpdateParamsCmd" args := s.appendCommonArgsTo(tc.args...) - args = append(args, "--title", cmdFuncName, "--summary", tc.name) - - outBW, err := cli.ExecTestCLICmd(s.clientCtx, cmd, args) - out := outBW.String() - s.T().Logf("Output:\n%s", out) - s.assertErrorContents(err, tc.expErr, "%s error", cmdFuncName) - for _, expErr := range tc.expErr { - s.Assert().Contains(out, expErr, "%s output with error", cmdFuncName) - } - - var propID string - if len(tc.expErr) == 0 { - s.waitForNextBlock() - txResp, ok := queries.AssertGetTxFromResponse(s.T(), s.network, []byte(out)) - if ok { - s.Assert().Equal(0, int(txResp.Code), "%s response code", cmdFuncName) - } - propID = s.findProposalID(&txResp) - } + args = append(args, "--title", "TxUpdateParamsCmd", "--summary", tc.name) + txResp := testcli.NewCLITxExecutor(client.TxUpdateParamsCmd(), args). + WithExpInErrMsg(tc.expErr). + Execute(s.T(), s.network) if tc.expPropMsg != nil { + propID := s.findProposalID(txResp) s.assertGovPropMsg(propID, tc.expPropMsg) } }) diff --git a/x/trigger/client/cli/cli_test.go b/x/trigger/client/cli/cli_test.go index d2d3cb3d1d..0afcaa5783 100644 --- a/x/trigger/client/cli/cli_test.go +++ b/x/trigger/client/cli/cli_test.go @@ -2,6 +2,8 @@ package cli_test import ( "fmt" + "os" + "path/filepath" "testing" "time" @@ -25,7 +27,7 @@ import ( "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil" - "github.com/provenance-io/provenance/testutil/queries" + testcli "github.com/provenance-io/provenance/testutil/cli" triggercli "github.com/provenance-io/provenance/x/trigger/client/cli" "github.com/provenance-io/provenance/x/trigger/types" triggertypes "github.com/provenance-io/provenance/x/trigger/types" @@ -167,6 +169,8 @@ func (s *IntegrationTestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err, "network.New") + s.network.Validators[0].ClientCtx = s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) + _, err = testutil.WaitForHeight(s.network, 6) s.Require().NoError(err, "WaitForHeight") } @@ -387,10 +391,8 @@ func (s *IntegrationTestSuite) TestAddBlockHeightTrigger() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) - - var message string - if len(tc.fileContent) == 0 { + message := tc.fileContent + if len(message) == 0 { message = fmt.Sprintf(` { "@type": "/cosmos.bank.v1beta1.MsgSend", @@ -403,16 +405,17 @@ func (s *IntegrationTestSuite) TestAddBlockHeightTrigger() { } ] }`, s.accountAddresses[0].String(), s.accountAddresses[1].String()) - } else { - message = tc.fileContent } - messageFile := sdktestutil.WriteToNewTempFile(s.T(), message) + tempDir := s.T().TempDir() + messageFile := filepath.Join(tempDir, "msg.json") + err := os.WriteFile(messageFile, []byte(message), 0o666) + s.Require().NoError(err, "WriteFile(%q, %q)", messageFile, message) cmd := triggercli.GetCmdAddBlockHeightTrigger() args := []string{ tc.height, - messageFile.Name(), + messageFile, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddresses[0].String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), @@ -420,17 +423,10 @@ func (s *IntegrationTestSuite) TestAddBlockHeightTrigger() { fmt.Sprintf("--%s=json", cmtcli.OutputFlag), } - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) - - if len(tc.expectErrMsg) > 0 { - s.Assert().EqualError(err, tc.expectErrMsg, "should have correct error for invalid AddBlockHeightTrigger request") - } else { - s.Assert().NoError(err, "should have no error for valid AddBlockHeightTrigger request") - txResp := queries.GetTxFromResponse(s.T(), s.network, outBz) - s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "should have correct response code for AddBlockHeightTrigger request") - } + testcli.NewCLITxExecutor(cmd, args). + WithExpErrMsg(tc.expectErrMsg). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.network) }) } } @@ -518,10 +514,8 @@ func (s *IntegrationTestSuite) TestAddTransactionTrigger() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) - - var message string - if len(tc.fileContent) == 0 { + message := tc.fileContent + if len(message) == 0 { message = fmt.Sprintf(` { "@type": "/cosmos.bank.v1beta1.MsgSend", @@ -534,13 +528,14 @@ func (s *IntegrationTestSuite) TestAddTransactionTrigger() { } ] }`, s.accountAddresses[0].String(), s.accountAddresses[1].String()) - } else { - message = tc.fileContent } - messageFile := sdktestutil.WriteToNewTempFile(s.T(), message) + tempDir := s.T().TempDir() + messageFile := filepath.Join(tempDir, "message.json") + err := os.WriteFile(messageFile, []byte(message), 0o666) + s.Require().NoError(err, "WriteFile(%q, %q)", messageFile, message) - var txEvent string - if len(tc.txEvent) == 0 { + txEvent := tc.txEvent + if len(txEvent) == 0 { txEvent = fmt.Sprintf(` { "name": "coin_received", @@ -556,15 +551,15 @@ func (s *IntegrationTestSuite) TestAddTransactionTrigger() { ] } `, s.accountAddresses[0].String()) - } else { - txEvent = tc.txEvent } - txEventFile := sdktestutil.WriteToNewTempFile(s.T(), txEvent) + txEventFile := filepath.Join(tempDir, "tx-event.json") + err = os.WriteFile(txEventFile, []byte(txEvent), 0o666) + s.Require().NoError(err, "WriteFile(%q, %q)", txEventFile, txEvent) cmd := triggercli.GetCmdAddTransactionTrigger() args := []string{ - txEventFile.Name(), - messageFile.Name(), + txEventFile, + messageFile, fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountAddresses[0].String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), @@ -572,17 +567,10 @@ func (s *IntegrationTestSuite) TestAddTransactionTrigger() { fmt.Sprintf("--%s=json", cmtcli.OutputFlag), } - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) - - if len(tc.expectErrMsg) > 0 { - s.Assert().EqualError(err, tc.expectErrMsg, "should have correct error for invalid AddTransactionTrigger request") - } else { - s.Assert().NoError(err, "should have no error for valid AddTransactionTrigger request") - txResp := queries.GetTxFromResponse(s.T(), s.network, outBz) - s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "should have correct response code for valid AddTransactionTrigger request") - } + testcli.NewCLITxExecutor(cmd, args). + WithExpErrMsg(tc.expectErrMsg). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.network) }) } } @@ -678,10 +666,8 @@ func (s *IntegrationTestSuite) TestAddBlockTimeTrigger() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) - - var message string - if len(tc.fileContent) == 0 { + message := tc.fileContent + if len(message) == 0 { message = fmt.Sprintf(` { "@type": "/cosmos.bank.v1beta1.MsgSend", @@ -694,8 +680,6 @@ func (s *IntegrationTestSuite) TestAddBlockTimeTrigger() { } ] }`, s.accountAddresses[0].String(), s.accountAddresses[1].String()) - } else { - message = tc.fileContent } messageFile := sdktestutil.WriteToNewTempFile(s.T(), message) @@ -711,17 +695,10 @@ func (s *IntegrationTestSuite) TestAddBlockTimeTrigger() { fmt.Sprintf("--%s=json", cmtcli.OutputFlag), } - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) - - if len(tc.expectErrMsg) > 0 { - s.Assert().EqualError(err, tc.expectErrMsg, "should have correct error for invalid AddBlockTimeTrigger request") - } else { - s.Assert().NoError(err, "should have no error for valid AddBlockTimeTrigger request") - txResp := queries.GetTxFromResponse(s.T(), s.network, outBz) - s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "should have correct response code for valid AddBlockTimeTrigger request") - } + testcli.NewCLITxExecutor(cmd, args). + WithExpErrMsg(tc.expectErrMsg). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.network) }) } } @@ -766,8 +743,6 @@ func (s *IntegrationTestSuite) TestDestroyTrigger() { for _, tc := range testCases { s.Run(tc.name, func() { - clientCtx := s.network.Validators[0].ClientCtx.WithKeyringDir(s.keyringDir).WithKeyring(s.keyring) - cmd := triggercli.GetCmdDestroyTrigger() args := []string{ tc.triggerID, @@ -778,17 +753,10 @@ func (s *IntegrationTestSuite) TestDestroyTrigger() { fmt.Sprintf("--%s=json", cmtcli.OutputFlag), } - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) - outBz := out.Bytes() - s.T().Logf("ExecTestCLICmd %q %q\nOutput:\n%s", cmd.Name(), args, string(outBz)) - - if len(tc.expectErrMsg) > 0 { - s.Assert().EqualError(err, tc.expectErrMsg, "should have correct error for invalid DestroyTrigger request") - } else { - s.Assert().NoError(err, "should have no error for valid DestroyTrigger request") - txResp := queries.GetTxFromResponse(s.T(), s.network, outBz) - s.Assert().Equal(int(tc.expectedCode), int(txResp.Code), "should have correct response code for valid DestroyTrigger request") - } + testcli.NewCLITxExecutor(cmd, args). + WithExpErrMsg(tc.expectErrMsg). + WithExpCode(tc.expectedCode). + Execute(s.T(), s.network) }) } } From de45ca724ec836fac9eb8234198f561328c0a2e0 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Tue, 23 Apr 2024 14:54:17 -0600 Subject: [PATCH 31/42] [1760]: Fix the oracle TestSendQuery which I incorrectly updated when I switched to CLITxExecutor. --- x/oracle/client/cli/cli_test.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/x/oracle/client/cli/cli_test.go b/x/oracle/client/cli/cli_test.go index 24be33bf44..6bc05a1239 100644 --- a/x/oracle/client/cli/cli_test.go +++ b/x/oracle/client/cli/cli_test.go @@ -207,8 +207,9 @@ func (s *IntegrationTestSuite) TestSendQuery() { name string query string channel string - expectErrMsg string + expectErrMsg []string expectedCode uint32 + expInRawLog []string signer string }{ { @@ -216,26 +217,27 @@ func (s *IntegrationTestSuite) TestSendQuery() { query: "{}", channel: "channel-1", expectedCode: 9, + expInRawLog: []string{"module does not own channel capability", "channel capability not found"}, signer: s.accountAddresses[0].String(), }, { name: "failure - invalid query data", query: "abc", - expectErrMsg: "query data must be json", + expectErrMsg: []string{"query data must be json"}, channel: "channel-1", signer: s.accountAddresses[0].String(), }, { name: "failure - invalid channel format", query: "{}", - expectErrMsg: "invalid channel id", + expectErrMsg: []string{"invalid channel id"}, channel: "a", signer: s.accountAddresses[0].String(), }, { name: "failure - invalid signer", query: "{}", - expectErrMsg: "failed to convert address field to address: abc.info: key not found", + expectErrMsg: []string{"failed to convert address field to address: abc.info: key not found"}, channel: "channel-1", signer: "abc", }, @@ -255,8 +257,9 @@ func (s *IntegrationTestSuite) TestSendQuery() { } testcli.NewCLITxExecutor(cmd, args). - WithExpInErrMsg([]string{tc.expectErrMsg}). + WithExpInErrMsg(tc.expectErrMsg). WithExpCode(tc.expectedCode). + WithExpInRawLog(tc.expInRawLog). Execute(s.T(), s.network) }) } From 4a3befc1b991dc94c96c78d15ae69b349e7f9574 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Tue, 23 Apr 2024 15:18:11 -0600 Subject: [PATCH 32/42] [1760]: Use the cmd stdout in the auto-complete generation (instead of os stdout) so that we can hide all that output in unit tests. --- cmd/provenanced/cmd/cmd_test.go | 6 ++++++ cmd/provenanced/cmd/root.go | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/provenanced/cmd/cmd_test.go b/cmd/provenanced/cmd/cmd_test.go index 923e821394..c0b7c05c89 100644 --- a/cmd/provenanced/cmd/cmd_test.go +++ b/cmd/provenanced/cmd/cmd_test.go @@ -2,6 +2,7 @@ package cmd_test import ( "fmt" + "io" "testing" "github.com/stretchr/testify/require" @@ -21,6 +22,8 @@ func TestInitCmd(t *testing.T) { "simapp-test", // Moniker fmt.Sprintf("--%s=%s", cli.FlagOverwrite, "true"), // Overwrite genesis.json, in case it already exists }) + rootCmd.SetOut(io.Discard) + rootCmd.SetErr(io.Discard) err := cmd.Execute(rootCmd) require.NoError(t, err) @@ -73,6 +76,9 @@ func TestGenAutoCompleteCmd(t *testing.T) { rootCmd, _ := cmd.NewRootCmd(false) rootCmd.SetArgs(args) + rootCmd.SetOut(io.Discard) + rootCmd.SetErr(io.Discard) + err := cmd.Execute(rootCmd) assertions.AssertErrorValue(t, err, tc.err, "should have the correct output value") }) diff --git a/cmd/provenanced/cmd/root.go b/cmd/provenanced/cmd/root.go index 939a0853e7..f59990f864 100644 --- a/cmd/provenanced/cmd/root.go +++ b/cmd/provenanced/cmd/root.go @@ -260,13 +260,13 @@ source ~/.zshrc RunE: func(cmd *cobra.Command, args []string) error { switch args[0] { case "bash": - return cmd.Root().GenBashCompletion(os.Stdout) + return cmd.Root().GenBashCompletion(cmd.OutOrStdout()) case "zsh": - return cmd.Root().GenZshCompletion(os.Stdout) + return cmd.Root().GenZshCompletion(cmd.OutOrStdout()) case "fish": - return cmd.Root().GenFishCompletion(os.Stdout, true) + return cmd.Root().GenFishCompletion(cmd.OutOrStdout(), true) case "powershell": - return cmd.Root().GenPowerShellCompletionWithDesc(os.Stdout) + return cmd.Root().GenPowerShellCompletionWithDesc(cmd.OutOrStdout()) } return fmt.Errorf("shell %s is not supported", args[0]) From ea506ab7405153d464c0284a4b0b6f4a5bb5149b Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Tue, 23 Apr 2024 16:55:38 -0600 Subject: [PATCH 33/42] [1760]: In AddGenesisMsgFeeCmd, put back the msg type check. --- cmd/provenanced/cmd/genaccounts.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/cmd/provenanced/cmd/genaccounts.go b/cmd/provenanced/cmd/genaccounts.go index 06ca984a34..2dd679c2ed 100644 --- a/cmd/provenanced/cmd/genaccounts.go +++ b/cmd/provenanced/cmd/genaccounts.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" sdk "github.com/cosmos/cosmos-sdk/types" @@ -624,11 +625,14 @@ func AddGenesisMsgFeeCmd(defaultNodeHome string) *cobra.Command { config.SetRoot(clientCtx.HomeDir) msgType := args[0] - if msgType[0] != '/' { msgType = "/" + msgType } + if err := checkMsgTypeValid(cdc.InterfaceRegistry(), msgType); err != nil { + return err + } + additionalFee, err := sdk.ParseCoinNormalized(args[1]) if err != nil { return fmt.Errorf("failed to parse coin: %w", err) @@ -676,6 +680,19 @@ func AddGenesisMsgFeeCmd(defaultNodeHome string) *cobra.Command { return cmd } +func checkMsgTypeValid(registry types.InterfaceRegistry, msgTypeURL string) error { + msg, err := registry.Resolve(msgTypeURL) + if err != nil { + return err + } + + _, ok := msg.(sdk.Msg) + if !ok { + return fmt.Errorf("message type is not a sdk message: %v", msgTypeURL) + } + return err +} + // AddGenesisDefaultMarketCmd returns add-genesis-default-market cobra command. func AddGenesisDefaultMarketCmd(defaultNodeHome string) *cobra.Command { cmd := &cobra.Command{ From 1888f8f5ea0c96a8be8b96366ac5e531ceab7d0d Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Tue, 23 Apr 2024 17:27:52 -0600 Subject: [PATCH 34/42] [1760]: Clean up some more tests related to the encoders. Make the cmd tests quieter so that it's easier to find test failure info in the output. --- cmd/provenanced/cmd/addresses_test.go | 2 + cmd/provenanced/cmd/config_test.go | 9 ++- cmd/provenanced/cmd/docgen_test.go | 67 +++++++++++-------- cmd/provenanced/cmd/genaccounts_test.go | 37 ++++++---- cmd/provenanced/cmd/pre_upgrade_test.go | 20 +++--- cmd/provenanced/config/manager_test.go | 10 +-- internal/antewrapper/prov_feegrant_test.go | 3 +- internal/antewrapper/testutil_test.go | 14 ++-- .../handlers/bank_send_restriction_test.go | 3 +- internal/handlers/msg_fee_invoker_test.go | 37 +++++----- internal/handlers/msg_service_router_test.go | 26 +++---- x/hold/simulation/decoder_test.go | 5 +- x/ibcratelimit/simulation/decoder_test.go | 5 +- x/oracle/simulation/decoder_test.go | 5 +- 14 files changed, 135 insertions(+), 108 deletions(-) diff --git a/cmd/provenanced/cmd/addresses_test.go b/cmd/provenanced/cmd/addresses_test.go index c3e758fe31..de2e2cfaa1 100644 --- a/cmd/provenanced/cmd/addresses_test.go +++ b/cmd/provenanced/cmd/addresses_test.go @@ -155,6 +155,7 @@ func (s *MetaaddressTestSuite) TestAddMetaAddressDecoder() { command.SetArgs(tc.args) b := bytes.NewBufferString("") command.SetOut(b) + command.SetErr(b) err := command.Execute() if len(tc.err) > 0 { require.EqualErrorf(t, err, tc.err, "%s - expected error", command.Name()) @@ -369,6 +370,7 @@ func (s *MetaaddressTestSuite) TestAddMetaAddressEncoder() { command.SetArgs(tc.args) b := bytes.NewBufferString("") command.SetOut(b) + command.SetErr(b) err := command.Execute() if len(tc.err) > 0 { require.EqualErrorf(t, err, tc.err, "%s - expected error", command.Name()) diff --git a/cmd/provenanced/cmd/config_test.go b/cmd/provenanced/cmd/config_test.go index 1db58bcfca..89306a5350 100644 --- a/cmd/provenanced/cmd/config_test.go +++ b/cmd/provenanced/cmd/config_test.go @@ -21,8 +21,9 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/provenance-io/provenance/app" + simappparams "github.com/provenance-io/provenance/app/params" "github.com/provenance-io/provenance/cmd/provenanced/cmd" provconfig "github.com/provenance-io/provenance/cmd/provenanced/config" "github.com/provenance-io/provenance/internal/pioconfig" @@ -36,6 +37,8 @@ type ConfigTestSuite struct { ServerContext *server.Context Context *context.Context + EncodingConfig simappparams.EncodingConfig + HeaderStrApp string HeaderStrTM string HeaderStrClient string @@ -51,9 +54,9 @@ func (s *ConfigTestSuite) SetupTest() { pioconfig.SetProvenanceConfig("confcoin", 5) - encodingConfig := moduletestutil.MakeTestEncodingConfig() + s.EncodingConfig = app.MakeTestEncodingConfig(s.T()) clientCtx := client.Context{}. - WithCodec(encodingConfig.Codec). + WithCodec(s.EncodingConfig.Marshaler). WithHomeDir(s.Home) clientCtx.Viper = viper.New() serverCtx := server.NewContext(clientCtx.Viper, provconfig.DefaultTmConfig(), log.NewNopLogger()) diff --git a/cmd/provenanced/cmd/docgen_test.go b/cmd/provenanced/cmd/docgen_test.go index 83814c2046..3c652cad8b 100644 --- a/cmd/provenanced/cmd/docgen_test.go +++ b/cmd/provenanced/cmd/docgen_test.go @@ -3,25 +3,29 @@ package cmd_test import ( "context" "fmt" + "io" "os" "path/filepath" "strings" "testing" "github.com/spf13/viper" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" genutiltest "github.com/cosmos/cosmos-sdk/x/genutil/client/testutil" + "github.com/provenance-io/provenance/app" provenancecmd "github.com/provenance-io/provenance/cmd/provenanced/cmd" + "github.com/provenance-io/provenance/testutil/assertions" ) func TestDocGen(t *testing.T) { + appCodec := app.MakeTestEncodingConfig(t).Marshaler tests := []struct { name string target string @@ -118,7 +122,7 @@ func TestDocGen(t *testing.T) { target: "tmp2", createTarget: false, flags: []string{"--yaml"}, - extensions: []string{".md", ".yaml"}, + extensions: []string{".yaml"}, }, } @@ -131,14 +135,10 @@ func TestDocGen(t *testing.T) { require.NoError(t, os.Mkdir(targetPath, 0755), "Mkdir successfully created directory") } - logger := log.NewNopLogger() cfg, err := genutiltest.CreateDefaultCometConfig(home) require.NoError(t, err, "Created default tendermint config") - appCodec := moduletestutil.MakeTestEncodingConfig().Codec - err = genutiltest.ExecInitCmd(testMbm, home, appCodec) - require.NoError(t, err, "Executed init command") - + logger := log.NewNopLogger() serverCtx := server.NewContext(viper.New(), cfg, logger) clientCtx := client.Context{}.WithCodec(appCodec).WithHomeDir(home) @@ -149,39 +149,50 @@ func TestDocGen(t *testing.T) { cmd := provenancecmd.GetDocGenCmd() args := append([]string{targetPath}, tc.flags...) cmd.SetArgs(args) + cmd.SetOut(io.Discard) + cmd.SetErr(io.Discard) + + if strings.Contains(tc.err, "%s") { + tc.err = fmt.Sprintf(tc.err, targetPath) + } + + err = cmd.ExecuteContext(ctx) + assertions.AssertErrorValue(t, err, tc.err, "cmd %q %q error", cmd.Name(), args) if len(tc.err) > 0 { - err := cmd.ExecuteContext(ctx) - require.Error(t, err, "should throw an error") - expected := tc.err - if strings.Contains(expected, "%s") { - expected = fmt.Sprintf(expected, targetPath) - } - require.Equal(t, expected, err.Error(), "should return the correct error") - files, err := os.ReadDir(targetPath) - if err != nil { - require.Equal(t, 0, len(files), "should not generate files when failed") - } + files, _ := os.ReadDir(targetPath) + assert.Equal(t, 0, len(files), "should not generate files when failed") } else { - err := cmd.ExecuteContext(ctx) - require.NoError(t, err, "should not return an error") - files, err := os.ReadDir(targetPath) require.NoError(t, err, "ReadDir should not return an error") - require.NotZero(t, len(files), "should generate files when successful") + require.NotEmpty(t, files, "should generate files when successful") - for _, file := range files { - ext := filepath.Ext(file.Name()) + filenames := make([]string, len(files)) + exts := make([]string, len(files)) + for i, file := range files { + filenames[i] = file.Name() + exts[i] = filepath.Ext(filenames[i]) + } + missingExt := false + for _, extension := range tc.extensions { contains := false - for _, extension := range tc.extensions { - contains = contains || ext == extension + for _, ext := range exts { + if ext == extension { + contains = true + break + } + } + if !assert.True(t, contains, "should generate a file with the extension %q", extension) { + missingExt = true } - require.True(t, contains, "should generate files with correct extension") + } + if missingExt { + t.Logf("Files in %s\n%s", targetPath, strings.Join(filenames, "\n")) } } - if _, err := os.Stat(targetPath); err != nil { + if _, err = os.Stat(targetPath); err != nil { require.NoError(t, os.RemoveAll(targetPath), "RemoveAll should be able to remove the temporary target directory") } }) diff --git a/cmd/provenanced/cmd/genaccounts_test.go b/cmd/provenanced/cmd/genaccounts_test.go index 473e87b0e7..4e18bc4321 100644 --- a/cmd/provenanced/cmd/genaccounts_test.go +++ b/cmd/provenanced/cmd/genaccounts_test.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "io" "testing" "time" @@ -13,6 +14,7 @@ import ( "cosmossdk.io/log" sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" @@ -21,13 +23,14 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltest "github.com/cosmos/cosmos-sdk/x/genutil/client/testutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/provenance-io/provenance/app" provenancecmd "github.com/provenance-io/provenance/cmd/provenanced/cmd" + "github.com/provenance-io/provenance/internal/pioconfig" "github.com/provenance-io/provenance/testutil/assertions" "github.com/provenance-io/provenance/testutil/mocks" "github.com/provenance-io/provenance/x/exchange" @@ -36,6 +39,7 @@ import ( var testMbm = module.NewBasicManager(genutil.AppModuleBasic{}) func TestAddGenesisAccountCmd(t *testing.T) { + appCodec := app.MakeTestEncodingConfig(t).Marshaler _, _, addr1 := testdata.KeyTestPubAddr() tests := []struct { name string @@ -64,14 +68,12 @@ func TestAddGenesisAccountCmd(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { home := t.TempDir() logger := log.NewNopLogger() cfg, err := genutiltest.CreateDefaultCometConfig(home) require.NoError(t, err) - appCodec := moduletestutil.MakeTestEncodingConfig().Codec err = genutiltest.ExecInitCmd(testMbm, home, appCodec) require.NoError(t, err) @@ -87,6 +89,8 @@ func TestAddGenesisAccountCmd(t *testing.T) { tc.addr, tc.denom, fmt.Sprintf("--%s=home", flags.FlagHome)}) + cmd.SetOut(io.Discard) + cmd.SetErr(io.Discard) if tc.expectErr { require.Error(t, cmd.ExecuteContext(ctx)) @@ -98,6 +102,7 @@ func TestAddGenesisAccountCmd(t *testing.T) { } func TestAddGenesisMsgFeeCmd(t *testing.T) { + appCodec := app.MakeTestEncodingConfig(t).Marshaler tests := []struct { name string msgType string @@ -136,14 +141,12 @@ func TestAddGenesisMsgFeeCmd(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { home := t.TempDir() logger := log.NewNopLogger() cfg, err := genutiltest.CreateDefaultCometConfig(home) require.NoError(t, err) - appCodec := moduletestutil.MakeTestEncodingConfig().Codec err = genutiltest.ExecInitCmd(testMbm, home, appCodec) require.NoError(t, err) @@ -154,22 +157,26 @@ func TestAddGenesisMsgFeeCmd(t *testing.T) { ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx) ctx = context.WithValue(ctx, server.ServerContextKey, serverCtx) - cmd := provenancecmd.AddGenesisCustomFloorPriceDenomCmd(home) - cmdFee := provenancecmd.AddGenesisMsgFeeCmd(home) - cmd.SetArgs([]string{ + cmdFloorPrice := provenancecmd.AddGenesisCustomFloorPriceDenomCmd(home) + cmdFloorPrice.SetArgs([]string{ tc.msgFeeFloorCoin, fmt.Sprintf("--%s=home", flags.FlagHome)}) + cmdFloorPrice.SetOut(io.Discard) + cmdFloorPrice.SetErr(io.Discard) + + cmdFee := provenancecmd.AddGenesisMsgFeeCmd(home) cmdFee.SetArgs([]string{ tc.msgType, tc.fee, fmt.Sprintf("--%s=home", flags.FlagHome)}) + cmdFee.SetOut(io.Discard) + cmdFee.SetErr(io.Discard) if len(tc.expectErrMsg) > 0 { err = cmdFee.ExecuteContext(ctx) - require.Error(t, err) - require.Equal(t, tc.expectErrMsg, err.Error()) + require.EqualError(t, err, tc.expectErrMsg) } else { - require.NoError(t, cmd.ExecuteContext(ctx)) + require.NoError(t, cmdFloorPrice.ExecuteContext(ctx)) require.NoError(t, cmdFee.ExecuteContext(ctx)) } }) @@ -262,6 +269,8 @@ func fixEmptiesInExchangeGenState(exGenState *exchange.GenesisState) { } func TestAddGenesisDefaultMarketCmd(t *testing.T) { + pioconfig.SetProvenanceConfig("", 0) + cdc := app.MakeTestEncodingConfig(t).Marshaler expDefaultMarket := func(marketID uint32, denom string, addrs ...string) exchange.Market { rv := provenancecmd.MakeDefaultMarket(denom, addrs) rv.MarketId = marketID @@ -365,7 +374,6 @@ func TestAddGenesisDefaultMarketCmd(t *testing.T) { home := t.TempDir() cfg, err := genutiltest.CreateDefaultCometConfig(home) require.NoError(t, err, "setup: CreateDefaultCometConfig(%q)", home) - cdc := moduletestutil.MakeTestEncodingConfig().Codec err = genutiltest.ExecInitCmd(testMbm, home, cdc) require.NoError(t, err, "setup: ExecInitCmd") @@ -589,6 +597,8 @@ func TestMakeDefaultMarket(t *testing.T) { } func TestAddGenesisCustomMarketCmd(t *testing.T) { + cdc := app.MakeTestEncodingConfig(t).Marshaler + tests := []struct { name string iniExGenState *exchange.GenesisState @@ -696,7 +706,6 @@ func TestAddGenesisCustomMarketCmd(t *testing.T) { home := t.TempDir() cfg, err := genutiltest.CreateDefaultCometConfig(home) require.NoError(t, err, "setup: CreateDefaultCometConfig(%q)", home) - cdc := moduletestutil.MakeTestEncodingConfig().Codec err = genutiltest.ExecInitCmd(testMbm, home, cdc) require.NoError(t, err, "setup: ExecInitCmd") @@ -750,6 +759,7 @@ func TestAddGenesisCustomMarketCmd(t *testing.T) { } func TestAddMarketsToAppState(t *testing.T) { + appCdc := app.MakeTestEncodingConfig(t).Marshaler askOrder := *exchange.NewOrder(1).WithAsk(&exchange.AskOrder{ MarketId: 1, Seller: sdk.AccAddress("seller______________").String(), @@ -852,7 +862,6 @@ func TestAddMarketsToAppState(t *testing.T) { t.Run(tc.name, func(t *testing.T) { fixEmptiesInExchangeGenState(&tc.expExGenState) - appCdc := moduletestutil.MakeTestEncodingConfig().Codec egsBz, err := appCdc.MarshalJSON(&tc.exGenState) require.NoError(t, err, "MarshalJSON initial exchange genesis state") appState := map[string]json.RawMessage{exchange.ModuleName: egsBz} diff --git a/cmd/provenanced/cmd/pre_upgrade_test.go b/cmd/provenanced/cmd/pre_upgrade_test.go index b3525d21c1..cdd2e0ff1f 100644 --- a/cmd/provenanced/cmd/pre_upgrade_test.go +++ b/cmd/provenanced/cmd/pre_upgrade_test.go @@ -21,10 +21,11 @@ import ( "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/server" serverconfig "github.com/cosmos/cosmos-sdk/server/config" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/provenance-io/provenance/app" cmderrors "github.com/provenance-io/provenance/cmd/errors" "github.com/provenance-io/provenance/cmd/provenanced/cmd" "github.com/provenance-io/provenance/cmd/provenanced/config" @@ -181,10 +182,9 @@ func assertContainsAll(t *testing.T, actual string, expected []string, msgAndArg } // makeDummyCmd creates a dummy command with a context in it that can be used to test all the config stuff. -func makeDummyCmd(t *testing.T, home string) *cobra.Command { - encodingConfig := moduletestutil.MakeTestEncodingConfig() +func makeDummyCmd(t *testing.T, cdc codec.Codec, home string) *cobra.Command { clientCtx := client.Context{}. - WithCodec(encodingConfig.Codec). + WithCodec(cdc). WithHomeDir(home) clientCtx.Viper = viper.New() serverCtx := server.NewContext(clientCtx.Viper, config.DefaultTmConfig(), log.NewNopLogger()) @@ -212,6 +212,8 @@ func makeDummyCmd(t *testing.T, home string) *cobra.Command { func TestPreUpgradeCmd(t *testing.T) { pioconfig.SetProvenanceConfig("", 0) + encodingConfig := app.MakeTestEncodingConfig(t) + cdc := encodingConfig.Marshaler tmpDir := t.TempDir() @@ -225,7 +227,7 @@ func TestPreUpgradeCmd(t *testing.T) { return home, false } - dummyCmd := makeDummyCmd(t, home) + dummyCmd := makeDummyCmd(t, cdc, home) success := assert.NotPanics(t, func() { config.SaveConfigs(dummyCmd, appCfg, tmCfg, clientCfg, false) }, "SaveConfigs") return home, success } @@ -236,7 +238,7 @@ func TestPreUpgradeCmd(t *testing.T) { return home, success } - dummyCmd := makeDummyCmd(t, home) + dummyCmd := makeDummyCmd(t, cdc, home) success = assert.NoError(t, config.PackConfig(dummyCmd), "PackConfig") return home, success } @@ -392,7 +394,7 @@ func TestPreUpgradeCmd(t *testing.T) { return home, nil, success } - dummyCmd := makeDummyCmd(t, home) + dummyCmd := makeDummyCmd(t, cdc, home) unwritableFile := config.GetFullPathToPackedConf(dummyCmd) success = assert.NoError(t, os.Chmod(unwritableFile, 0o444), "Chmod") deferrable := func() { @@ -464,7 +466,7 @@ func TestPreUpgradeCmd(t *testing.T) { return home, nil, success } - dummyCmd := makeDummyCmd(t, home) + dummyCmd := makeDummyCmd(t, cdc, home) unwritableFile := config.GetFullPathToPackedConf(dummyCmd) success = assert.NoError(t, os.Chmod(unwritableFile, 0o444), "Chmod") deferrable := func() { @@ -507,7 +509,7 @@ func TestPreUpgradeCmd(t *testing.T) { return } - dummyCmd := makeDummyCmd(t, home) + dummyCmd := makeDummyCmd(t, cdc, home) appCfg, err := config.ExtractAppConfig(dummyCmd) if assert.NoError(t, err, "ExtractAppConfig") { assert.Equal(t, tc.expAppCfg, appCfg, "app config") diff --git a/cmd/provenanced/config/manager_test.go b/cmd/provenanced/config/manager_test.go index ea09d6f956..268383dd37 100644 --- a/cmd/provenanced/config/manager_test.go +++ b/cmd/provenanced/config/manager_test.go @@ -22,15 +22,17 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" serverconfig "github.com/cosmos/cosmos-sdk/server/config" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/provenance-io/provenance/app" + simappparams "github.com/provenance-io/provenance/app/params" "github.com/provenance-io/provenance/internal/pioconfig" ) type ConfigManagerTestSuite struct { suite.Suite - Home string + Home string + EncodingConfig simappparams.EncodingConfig } func TestConfigManagerTestSuite(t *testing.T) { @@ -40,13 +42,13 @@ func TestConfigManagerTestSuite(t *testing.T) { func (s *ConfigManagerTestSuite) SetupTest() { s.Home = s.T().TempDir() s.T().Logf("%s Home: %s", s.T().Name(), s.Home) + s.EncodingConfig = app.MakeTestEncodingConfig(s.T()) } // makeDummyCmd creates a dummy command with a context in it that can be used to test all the manager stuff. func (s *ConfigManagerTestSuite) makeDummyCmd() *cobra.Command { - encodingConfig := moduletestutil.MakeTestEncodingConfig() clientCtx := client.Context{}. - WithCodec(encodingConfig.Codec). + WithCodec(s.EncodingConfig.Marshaler). WithHomeDir(s.Home) clientCtx.Viper = viper.New() serverCtx := server.NewContext(clientCtx.Viper, DefaultTmConfig(), log.NewNopLogger()) diff --git a/internal/antewrapper/prov_feegrant_test.go b/internal/antewrapper/prov_feegrant_test.go index 7c727fbc19..cf578e31eb 100644 --- a/internal/antewrapper/prov_feegrant_test.go +++ b/internal/antewrapper/prov_feegrant_test.go @@ -163,8 +163,7 @@ func (s *AnteTestSuite) TestDeductFeesNoDelegation() { }, } - for _, stc := range cases { - tc := stc // to make scopelint happy + for _, tc := range cases { s.T().Run(tc.name, func(t *testing.T) { fee := sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, tc.fee)) msgs := []sdk.Msg{testdata.NewTestMsg(tc.signer)} diff --git a/internal/antewrapper/testutil_test.go b/internal/antewrapper/testutil_test.go index 36a36bb4df..5230c52f72 100644 --- a/internal/antewrapper/testutil_test.go +++ b/internal/antewrapper/testutil_test.go @@ -11,7 +11,6 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/x/auth/ante" xauthsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" @@ -19,6 +18,7 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" simapp "github.com/provenance-io/provenance/app" + simappparams "github.com/provenance-io/provenance/app/params" "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/pioconfig" msgfeetype "github.com/provenance-io/provenance/x/msgfees/types" @@ -39,6 +39,8 @@ type AnteTestSuite struct { ctx sdk.Context clientCtx client.Context txBuilder client.TxBuilder + + encodingConfig simappparams.EncodingConfig } // returns context and app with params set on account keeper @@ -65,20 +67,20 @@ func (s *AnteTestSuite) SetupTest(isCheckTx bool) { s.ctx = s.ctx.WithBlockHeight(1) // Set up TxConfig. - encodingConfig := moduletestutil.MakeTestEncodingConfig() + s.encodingConfig = s.app.GetEncodingConfig() // We're using TestMsg encoding in some tests, so register it here. - encodingConfig.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil) - testdata.RegisterInterfaces(encodingConfig.InterfaceRegistry) + s.encodingConfig.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil) + testdata.RegisterInterfaces(s.encodingConfig.InterfaceRegistry) s.clientCtx = client.Context{}. - WithTxConfig(encodingConfig.TxConfig) + WithTxConfig(s.encodingConfig.TxConfig) anteHandler, err := antewrapper.NewAnteHandler( antewrapper.HandlerOptions{ AccountKeeper: s.app.AccountKeeper, BankKeeper: s.app.BankKeeper, FeegrantKeeper: s.app.FeeGrantKeeper, - TxSigningHandlerMap: encodingConfig.TxConfig.SignModeHandler(), + TxSigningHandlerMap: s.encodingConfig.TxConfig.SignModeHandler(), SigGasConsumer: ante.DefaultSigVerificationGasConsumer, MsgFeesKeeper: s.app.MsgFeesKeeper, }, diff --git a/internal/handlers/bank_send_restriction_test.go b/internal/handlers/bank_send_restriction_test.go index 2bc72531f2..29840ce0e1 100644 --- a/internal/handlers/bank_send_restriction_test.go +++ b/internal/handlers/bank_send_restriction_test.go @@ -14,7 +14,6 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -175,7 +174,7 @@ func TestBankSend(tt *testing.T) { } func ConstructAndSendTx(tt *testing.T, app piosimapp.App, ctx sdk.Context, acct *authtypes.BaseAccount, priv cryptotypes.PrivKey, msg sdk.Msg, expectedCode uint32, expectedError string) { - encCfg := moduletestutil.MakeTestEncodingConfig() + encCfg := app.GetEncodingConfig() fees := sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, int64(NewTestGasLimit()))) acct = app.AccountKeeper.GetAccount(ctx, acct.GetAddress()).(*authtypes.BaseAccount) txBytes, err := SignTxAndGetBytes(ctx, NewTestGasLimit(), fees, encCfg, priv.PubKey(), priv, *acct, ctx.ChainID(), msg) diff --git a/internal/handlers/msg_fee_invoker_test.go b/internal/handlers/msg_fee_invoker_test.go index 61bcf691b1..429c14b70c 100644 --- a/internal/handlers/msg_fee_invoker_test.go +++ b/internal/handlers/msg_fee_invoker_test.go @@ -20,6 +20,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank/testutil" simapp "github.com/provenance-io/provenance/app" + simappparams "github.com/provenance-io/provenance/app/params" "github.com/provenance-io/provenance/internal/antewrapper" piohandlers "github.com/provenance-io/provenance/internal/handlers" "github.com/provenance-io/provenance/internal/pioconfig" @@ -30,6 +31,20 @@ const ( NHash = "nhash" ) +// HandlerTestSuite is a test suite for these handler tests. +type HandlerTestSuite struct { + suite.Suite + + app *simapp.App + ctx sdk.Context + clientCtx client.Context + txBuilder client.TxBuilder +} + +func TestHandlerTestSuite(t *testing.T) { + suite.Run(t, new(HandlerTestSuite)) +} + func (s *HandlerTestSuite) TestMsgFeeHandlerFeeChargedNoRemainingBaseFee() { encodingConfig, err := setUpApp(s, "atom", 100) testTx, acct1 := createTestTx(s, err, sdk.NewCoins(sdk.NewInt64Coin("atom", 100000), sdk.NewInt64Coin(NHash, 1000000))) @@ -171,14 +186,14 @@ func (s *HandlerTestSuite) TestMsgFeeHandlerBadDecoder() { BankKeeper: s.app.BankKeeper, FeegrantKeeper: s.app.FeeGrantKeeper, MsgFeesKeeper: s.app.MsgFeesKeeper, - Decoder: moduletestutil.MakeTestEncodingConfig().TxConfig.TxDecoder(), + Decoder: moduletestutil.MakeTestTxConfig().TxDecoder(), }) s.Require().NoError(err) s.Require().Panics(func() { feeChargeFn(s.ctx, false) }, "Bad decoder while setting up app.") } -func setUpApp(s *HandlerTestSuite, additionalFeeCoinDenom string, additionalFeeCoinAmt int64) (moduletestutil.TestEncodingConfig, error) { +func setUpApp(s *HandlerTestSuite, additionalFeeCoinDenom string, additionalFeeCoinAmt int64) (simappparams.EncodingConfig, error) { pioconfig.SetProvenanceConfig("", 0) encodingConfig := s.SetupTest(s.T()) // setup s.txBuilder = s.clientCtx.TxConfig.NewTxBuilder() @@ -254,12 +269,12 @@ func createTestTxWithFeeGrant(s *HandlerTestSuite, err error, feeAmount sdk.Coin } // SetupTest setups a new test, with new app, context, and anteHandler. -func (s *HandlerTestSuite) SetupTest(t *testing.T) moduletestutil.TestEncodingConfig { +func (s *HandlerTestSuite) SetupTest(t *testing.T) simappparams.EncodingConfig { s.app, s.ctx = createTestApp(t) s.ctx = s.ctx.WithBlockHeight(1) // Set up TxConfig. - encodingConfig := moduletestutil.MakeTestEncodingConfig() + encodingConfig := s.app.GetEncodingConfig() // We're using TestMsg encoding in some tests, so register it here. encodingConfig.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil) testdata.RegisterInterfaces(encodingConfig.InterfaceRegistry) @@ -329,17 +344,3 @@ func (s *HandlerTestSuite) CreateTestTx(privs []cryptotypes.PrivKey, accNums []u return s.txBuilder.GetTx(), nil } - -// AnteTestSuite is a test s to be used with ante handler tests. -type HandlerTestSuite struct { - suite.Suite - - app *simapp.App - ctx sdk.Context - clientCtx client.Context - txBuilder client.TxBuilder -} - -func TestHandlerTestSuite(t *testing.T) { - suite.Run(t, new(HandlerTestSuite)) -} diff --git a/internal/handlers/msg_service_router_test.go b/internal/handlers/msg_service_router_test.go index 71d5c4cdd8..df2cdce445 100644 --- a/internal/handlers/msg_service_router_test.go +++ b/internal/handlers/msg_service_router_test.go @@ -23,7 +23,6 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/types/tx/signing" authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -34,6 +33,7 @@ import ( govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" piosimapp "github.com/provenance-io/provenance/app" + simappparams "github.com/provenance-io/provenance/app/params" "github.com/provenance-io/provenance/internal/antewrapper" "github.com/provenance-io/provenance/internal/handlers" "github.com/provenance-io/provenance/internal/pioconfig" @@ -176,7 +176,7 @@ func TestRegisterMsgService(t *testing.T) { db := dbm.NewMemDB() // Create an encoding config that doesn't register testdata Msg services. - encCfg := moduletestutil.MakeTestEncodingConfig() + encCfg := piosimapp.MakeTestEncodingConfig(t) log.NewTestLogger(t) app := baseapp.NewBaseApp("test", log.NewTestLogger(t), db, encCfg.TxConfig.TxDecoder()) router := handlers.NewPioMsgServiceRouter(encCfg.TxConfig.TxDecoder()) @@ -202,7 +202,7 @@ func TestRegisterMsgService(t *testing.T) { func TestRegisterMsgServiceTwice(t *testing.T) { // Setup baseapp. db := dbm.NewMemDB() - encCfg := moduletestutil.MakeTestEncodingConfig() + encCfg := piosimapp.MakeTestEncodingConfig(t) app := baseapp.NewBaseApp("test", log.NewTestLogger(t), db, encCfg.TxConfig.TxDecoder()) router := handlers.NewPioMsgServiceRouter(encCfg.TxConfig.TxDecoder()) router.SetInterfaceRegistry(encCfg.InterfaceRegistry) @@ -227,7 +227,6 @@ func TestRegisterMsgServiceTwice(t *testing.T) { } func TestFailedTx(tt *testing.T) { - encCfg := moduletestutil.MakeTestEncodingConfig() pioconfig.SetProvenanceConfig(sdk.DefaultBondDenom, 1) // will create a gas fee of 1stake * gas priv, _, addr1 := testdata.KeyTestPubAddr() _, _, addr2 := testdata.KeyTestPubAddr() @@ -237,6 +236,7 @@ func TestFailedTx(tt *testing.T) { []authtypes.GenesisAccount{acct1}, banktypes.Balance{Address: addr1.String(), Coins: acct1Balance}, ) + encCfg := app.GetEncodingConfig() ctx := app.BaseApp.NewContextLegacy(false, cmtproto.Header{ChainID: "msgfee-testing"}) require.NoError(tt, app.AccountKeeper.Params.Set(ctx, authtypes.DefaultParams()), "Setting default account params") feeModuleAccount := app.AccountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName) @@ -334,7 +334,6 @@ func TestFailedTx(tt *testing.T) { func TestMsgService(tt *testing.T) { pioconfig.SetProvenanceConfig(sdk.DefaultBondDenom, 1) // set denom as stake and floor gas price as 1 stake. - encCfg := moduletestutil.MakeTestEncodingConfig() priv, _, addr1 := testdata.KeyTestPubAddr() _, _, addr2 := testdata.KeyTestPubAddr() acct1 := authtypes.NewBaseAccount(addr1, priv.PubKey(), 0, 0) @@ -343,6 +342,7 @@ func TestMsgService(tt *testing.T) { []authtypes.GenesisAccount{acct1}, banktypes.Balance{Address: addr1.String(), Coins: acct1Balance}, ) + encCfg := app.GetEncodingConfig() ctx := app.BaseApp.NewContextLegacy(false, cmtproto.Header{ChainID: "msgfee-testing"}) require.NoError(tt, app.AccountKeeper.Params.Set(ctx, authtypes.DefaultParams()), "Setting default account params") feeModuleAccount := app.AccountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName) @@ -492,7 +492,6 @@ func TestMsgService(tt *testing.T) { func TestMsgServiceMsgFeeWithRecipient(t *testing.T) { pioconfig.SetProvenanceConfig(sdk.DefaultBondDenom, 1) - encCfg := moduletestutil.MakeTestEncodingConfig() priv, _, addr1 := testdata.KeyTestPubAddr() _, _, addr2 := testdata.KeyTestPubAddr() acct1 := authtypes.NewBaseAccount(addr1, priv.PubKey(), 0, 0) @@ -502,6 +501,7 @@ func TestMsgServiceMsgFeeWithRecipient(t *testing.T) { []authtypes.GenesisAccount{acct1}, banktypes.Balance{Address: addr1.String(), Coins: acct1Balance}, ) + encCfg := app.GetEncodingConfig() ctx := app.BaseApp.NewContextLegacy(false, cmtproto.Header{ChainID: "msgfee-testing"}) require.NoError(t, app.AccountKeeper.Params.Set(ctx, authtypes.DefaultParams()), "Setting default account params") feeModuleAccount := app.AccountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName) @@ -562,7 +562,6 @@ func TestMsgServiceMsgFeeWithRecipient(t *testing.T) { func TestMsgServiceAuthz(tt *testing.T) { pioconfig.SetProvenanceConfig(sdk.DefaultBondDenom, 1) - encCfg := moduletestutil.MakeTestEncodingConfig() priv, _, addr1 := testdata.KeyTestPubAddr() priv2, _, addr2 := testdata.KeyTestPubAddr() _, _, addr3 := testdata.KeyTestPubAddr() @@ -575,6 +574,7 @@ func TestMsgServiceAuthz(tt *testing.T) { banktypes.Balance{Address: addr1.String(), Coins: initBalance}, banktypes.Balance{Address: addr2.String(), Coins: initBalance}, ) + encCfg := app.GetEncodingConfig() ctx := app.BaseApp.NewContextLegacy(false, cmtproto.Header{ChainID: "msgfee-testing"}) require.NoError(tt, app.AccountKeeper.Params.Set(ctx, authtypes.DefaultParams()), "Setting default account params") feeModuleAccount := app.AccountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName) @@ -718,7 +718,6 @@ func TestMsgServiceAssessMsgFee(tt *testing.T) { pioconfig.SetProvenanceConfig("", 0) pioconfig.ChangeMsgFeeFloorDenom(1, sdk.DefaultBondDenom) - encCfg := moduletestutil.MakeTestEncodingConfig() priv, _, addr1 := testdata.KeyTestPubAddr() _, _, addr2 := testdata.KeyTestPubAddr() acct1 := authtypes.NewBaseAccount(addr1, priv.PubKey(), 0, 0) @@ -731,6 +730,7 @@ func TestMsgServiceAssessMsgFee(tt *testing.T) { []authtypes.GenesisAccount{acct1}, banktypes.Balance{Address: addr1.String(), Coins: acct1Balance}, ) + encCfg := app.GetEncodingConfig() ctx := app.BaseApp.NewContextLegacy(false, cmtproto.Header{ChainID: "msgfee-testing"}) require.NoError(tt, app.AccountKeeper.Params.Set(ctx, authtypes.DefaultParams()), "Setting default account params") feeModuleAccount := app.AccountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName) @@ -806,7 +806,6 @@ func TestMsgServiceAssessMsgFeeWithBips(tt *testing.T) { pioconfig.SetProvenanceConfig("", 0) pioconfig.ChangeMsgFeeFloorDenom(1, sdk.DefaultBondDenom) - encCfg := moduletestutil.MakeTestEncodingConfig() priv, _, addr1 := testdata.KeyTestPubAddr() _, _, addr2 := testdata.KeyTestPubAddr() acct1 := authtypes.NewBaseAccount(addr1, priv.PubKey(), 0, 0) @@ -819,6 +818,7 @@ func TestMsgServiceAssessMsgFeeWithBips(tt *testing.T) { []authtypes.GenesisAccount{acct1}, banktypes.Balance{Address: addr1.String(), Coins: acct1Balance}, ) + encCfg := app.GetEncodingConfig() ctx := app.BaseApp.NewContextLegacy(false, cmtproto.Header{ChainID: "msgfee-testing"}) require.NoError(tt, app.AccountKeeper.Params.Set(ctx, authtypes.DefaultParams()), "Setting default account params") feeModuleAccount := app.AccountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName) @@ -895,7 +895,6 @@ func TestMsgServiceAssessMsgFeeNoRecipient(tt *testing.T) { pioconfig.SetProvenanceConfig("", 0) pioconfig.ChangeMsgFeeFloorDenom(1, sdk.DefaultBondDenom) - encCfg := moduletestutil.MakeTestEncodingConfig() priv, _, addr1 := testdata.KeyTestPubAddr() _, _, addr2 := testdata.KeyTestPubAddr() acct1 := authtypes.NewBaseAccount(addr1, priv.PubKey(), 0, 0) @@ -908,6 +907,7 @@ func TestMsgServiceAssessMsgFeeNoRecipient(tt *testing.T) { []authtypes.GenesisAccount{acct1}, banktypes.Balance{Address: addr1.String(), Coins: acct1Balance}, ) + encCfg := app.GetEncodingConfig() ctx := app.BaseApp.NewContextLegacy(false, cmtproto.Header{ChainID: "msgfee-testing"}) require.NoError(tt, app.AccountKeeper.Params.Set(ctx, authtypes.DefaultParams()), "Setting default account params") feeModuleAccount := app.AccountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName) @@ -1000,7 +1000,7 @@ func signAndGenTx( ctx sdk.Context, gaslimit uint64, fees sdk.Coins, - encCfg moduletestutil.TestEncodingConfig, + encCfg simappparams.EncodingConfig, pubKey cryptotypes.PubKey, privKey cryptotypes.PrivKey, acct authtypes.BaseAccount, @@ -1058,7 +1058,7 @@ func SignTxAndGetBytes( ctx sdk.Context, gaslimit uint64, fees sdk.Coins, - encCfg moduletestutil.TestEncodingConfig, + encCfg simappparams.EncodingConfig, pubKey cryptotypes.PubKey, privKey cryptotypes.PrivKey, acct authtypes.BaseAccount, @@ -1081,7 +1081,7 @@ func SignTx( ctx sdk.Context, gaslimit uint64, fees sdk.Coins, - encCfg moduletestutil.TestEncodingConfig, + encCfg simappparams.EncodingConfig, pubKey cryptotypes.PubKey, privKey cryptotypes.PrivKey, acct authtypes.BaseAccount, diff --git a/x/hold/simulation/decoder_test.go b/x/hold/simulation/decoder_test.go index 4dd0707018..cba3ddd268 100644 --- a/x/hold/simulation/decoder_test.go +++ b/x/hold/simulation/decoder_test.go @@ -7,16 +7,15 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/kv" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/provenance-io/provenance/app" "github.com/provenance-io/provenance/testutil/assertions" "github.com/provenance-io/provenance/x/hold/keeper" - holdmodule "github.com/provenance-io/provenance/x/hold/module" "github.com/provenance-io/provenance/x/hold/simulation" ) func TestDecodeStore(t *testing.T) { - cdc := moduletestutil.MakeTestEncodingConfig(holdmodule.AppModuleBasic{}).Codec + cdc := app.MakeTestEncodingConfig(t).Marshaler dec := simulation.NewDecodeStore(cdc) addr0 := sdk.AccAddress("addr0_______________") diff --git a/x/ibcratelimit/simulation/decoder_test.go b/x/ibcratelimit/simulation/decoder_test.go index 94b8889052..a4ae5aa04f 100644 --- a/x/ibcratelimit/simulation/decoder_test.go +++ b/x/ibcratelimit/simulation/decoder_test.go @@ -6,16 +6,15 @@ import ( "github.com/stretchr/testify/assert" "github.com/cosmos/cosmos-sdk/types/kv" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/provenance-io/provenance/app" "github.com/provenance-io/provenance/testutil/assertions" "github.com/provenance-io/provenance/x/ibcratelimit" - ibcratelimitmodule "github.com/provenance-io/provenance/x/ibcratelimit/module" "github.com/provenance-io/provenance/x/ibcratelimit/simulation" ) func TestDecodeStore(t *testing.T) { - cdc := moduletestutil.MakeTestEncodingConfig(ibcratelimitmodule.AppModuleBasic{}).Codec + cdc := app.MakeTestEncodingConfig(t).Marshaler dec := simulation.NewDecodeStore(cdc) params := func(contract string) []byte { p := ibcratelimit.NewParams("contract a") diff --git a/x/oracle/simulation/decoder_test.go b/x/oracle/simulation/decoder_test.go index f0574a5b8f..0f973bca32 100644 --- a/x/oracle/simulation/decoder_test.go +++ b/x/oracle/simulation/decoder_test.go @@ -6,16 +6,15 @@ import ( "github.com/stretchr/testify/assert" "github.com/cosmos/cosmos-sdk/types/kv" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/provenance-io/provenance/app" "github.com/provenance-io/provenance/testutil/assertions" - oraclemodule "github.com/provenance-io/provenance/x/oracle/module" "github.com/provenance-io/provenance/x/oracle/simulation" "github.com/provenance-io/provenance/x/oracle/types" ) func TestDecodeStore(t *testing.T) { - cdc := moduletestutil.MakeTestEncodingConfig(oraclemodule.AppModuleBasic{}).Codec + cdc := app.MakeTestEncodingConfig(t).Marshaler dec := simulation.NewDecodeStore(cdc) tests := []struct { From e7b979f83434cf18d9c992ea4dfca448a2ce24d8 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Tue, 23 Apr 2024 17:47:19 -0600 Subject: [PATCH 35/42] [1760]: Fix some store loader and upgrades tests. --- app/store_loader_test.go | 16 ++++++++-------- app/upgrades_test.go | 30 +++++++++++++----------------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/app/store_loader_test.go b/app/store_loader_test.go index 825906b619..b6a622d5de 100644 --- a/app/store_loader_test.go +++ b/app/store_loader_test.go @@ -104,7 +104,7 @@ func TestValidateWrapper(t *testing.T) { { name: "bad config", appOpts: MockAppOptions{ - db: "cleveldb", + pruning: "10000", }, expLogMsgs: true, expSleep: true, @@ -112,7 +112,7 @@ func TestValidateWrapper(t *testing.T) { { name: "bad config no sleep", appOpts: MockAppOptions{ - db: "cleveldb", + pruning: "10000", }, pioAckWarn: true, expLogMsgs: true, @@ -235,11 +235,11 @@ func TestIssueConfigWarnings(t *testing.T) { name: "bad db", appOpts: MockAppOptions{ pruning: "10", - db: "cleveldb", + db: "otherdb", indexer: "null", }, expLogLines: []string{ - "ERR cleveldb IS NO LONGER SUPPORTED. MIGRATE TO goleveldb.", + "ERR otherdb IS NO LONGER SUPPORTED. MIGRATE TO goleveldb.", sleepErr1, sleepErr2, }, @@ -249,13 +249,13 @@ func TestIssueConfigWarnings(t *testing.T) { name: "all bad with sleep", appOpts: MockAppOptions{ pruning: "1001", - db: "badgerdb", + db: "thisdb", indexer: "psql", }, expLogLines: []string{ "ERR pruning-interval 1001 EXCEEDS 999 AND IS NOT RECOMMENDED, AS IT CAN LEAD TO MISSED BLOCKS ON VALIDATORS.", "ERR indexer \"psql\" IS NOT RECOMMENDED, AND IT IS RECOMMENDED TO USE \"null\".", - "ERR badgerdb IS NO LONGER SUPPORTED. MIGRATE TO goleveldb.", + "ERR thisdb IS NO LONGER SUPPORTED. MIGRATE TO goleveldb.", sleepErr1, sleepErr2, }, @@ -265,14 +265,14 @@ func TestIssueConfigWarnings(t *testing.T) { name: "all bad no sleep", appOpts: MockAppOptions{ pruning: "1001", - db: "badgerdb", + db: "thatdb", indexer: "psql", }, pioAckWarn: "1", expLogLines: []string{ "ERR pruning-interval 1001 EXCEEDS 999 AND IS NOT RECOMMENDED, AS IT CAN LEAD TO MISSED BLOCKS ON VALIDATORS.", "ERR indexer \"psql\" IS NOT RECOMMENDED, AND IT IS RECOMMENDED TO USE \"null\".", - "ERR badgerdb IS NO LONGER SUPPORTED. MIGRATE TO goleveldb.", + "ERR thatdb IS NO LONGER SUPPORTED. MIGRATE TO goleveldb.", }, expSleep: false, }, diff --git a/app/upgrades_test.go b/app/upgrades_test.go index aa7829e18d..2f366ffd08 100644 --- a/app/upgrades_test.go +++ b/app/upgrades_test.go @@ -39,7 +39,7 @@ func TestUpgradeTestSuite(t *testing.T) { suite.Run(t, new(UpgradeTestSuite)) } -func (s *UpgradeTestSuite) SetupSuite() { +func (s *UpgradeTestSuite) SetupTest() { // Alert: This function is SetupSuite. That means all tests in here // will use the same app with the same store and data. defer SetLoggerMaker(SetLoggerMaker(BufferedInfoLoggerMaker(&s.logBuffer))) @@ -315,16 +315,6 @@ func (s *UpgradeTestSuite) TestKeysInHandlersMap() { } }) - s.Run("two or more colors exist", func() { - // We always need the colors currently in use on mainnet and testnet. - // The ones before that shouldn't be removed until we add new ones. - // It's okay to not clean the old ones up immediately, though. - // So we always want at least 2 different colors in there. - s.Assert().GreaterOrEqual(len(colors), 2, "number of distinct colors: %q in %q", colors, handlerKeys) - // If there are more than 3, we need to do some cleanup though. - s.Assert().LessOrEqual(len(colors), 3, "number of distinct colors: %q in %q", colors, handlerKeys) - }) - s.Run("no two colors start with same character", func() { // Little tricky here. i will go from 0 to len(colors) - 2 and the color will go from the 2nd to last. // So colors[i] in here will be the entry just before color. @@ -452,7 +442,8 @@ func (s *UpgradeTestSuite) TestRemoveInactiveValidatorDelegations() { s.Require().Len(validators, 1, "GetAllValidators after setup") expectedLogLines := []string{ - "INF Removing all delegations from validators that have been inactive (unbonded) for 21 days.", + "INF Removing inactive validator delegations.", + "INF Threshold: 21 days", "INF A total of 0 inactive (unbonded) validators have had all their delegators removed.", } s.ExecuteAndAssertLogs(runner, expectedLogLines, nil, true, runnerName) @@ -474,7 +465,8 @@ func (s *UpgradeTestSuite) TestRemoveInactiveValidatorDelegations() { s.Require().Len(validators, 2, "Setup: GetAllValidators should have: 1 bonded, 1 unbonded") expectedLogLines := []string{ - "INF Removing all delegations from validators that have been inactive (unbonded) for 21 days.", + "INF Removing inactive validator delegations.", + "INF Threshold: 21 days", fmt.Sprintf("INF Validator %v has been inactive (unbonded) for %d days and will be removed.", unbondedVal1.OperatorAddress, 30), fmt.Sprintf("INF Undelegate delegator %v from validator %v of all shares (%v).", addr1.String(), unbondedVal1.OperatorAddress, delegationCoinAmt), "INF A total of 1 inactive (unbonded) validators have had all their delegators removed.", @@ -510,7 +502,8 @@ func (s *UpgradeTestSuite) TestRemoveInactiveValidatorDelegations() { s.Require().Len(validators, 2, "Setup: GetAllValidators should have: 1 bonded, 1 unbonded") expectedLogLines := []string{ - "INF Removing all delegations from validators that have been inactive (unbonded) for 21 days.", + "INF Removing inactive validator delegations.", + "INF Threshold: 21 days", fmt.Sprintf("INF Validator %v has been inactive (unbonded) for %d days and will be removed.", unbondedVal1.OperatorAddress, 30), fmt.Sprintf("INF Undelegate delegator %v from validator %v of all shares (%v).", addr1.String(), unbondedVal1.OperatorAddress, delegationCoinAmt), fmt.Sprintf("INF Undelegate delegator %v from validator %v of all shares (%v).", addr2.String(), unbondedVal1.OperatorAddress, delegationCoinAmt), @@ -556,7 +549,8 @@ func (s *UpgradeTestSuite) TestRemoveInactiveValidatorDelegations() { s.Require().Len(validators, 3, "Setup: GetAllValidators should have: 1 bonded, 2 unbonded") expectedLogLines := []string{ - "INF Removing all delegations from validators that have been inactive (unbonded) for 21 days.", + "INF Removing inactive validator delegations.", + "INF Threshold: 21 days", fmt.Sprintf("INF Validator %v has been inactive (unbonded) for %d days and will be removed.", unbondedVal1.OperatorAddress, 30), fmt.Sprintf("INF Undelegate delegator %v from validator %v of all shares (%v).", addr1.String(), unbondedVal1.OperatorAddress, delegationCoinAmt), fmt.Sprintf("INF Undelegate delegator %v from validator %v of all shares (%v).", addr2.String(), unbondedVal1.OperatorAddress, delegationCoinAmt), @@ -604,7 +598,8 @@ func (s *UpgradeTestSuite) TestRemoveInactiveValidatorDelegations() { s.Require().Len(validators, 3, "Setup: GetAllValidators should have: 1 bonded, 1 recently unbonded, 1 old unbonded") expectedLogLines := []string{ - "INF Removing all delegations from validators that have been inactive (unbonded) for 21 days.", + "INF Removing inactive validator delegations.", + "INF Threshold: 21 days", fmt.Sprintf("INF Validator %v has been inactive (unbonded) for %d days and will be removed.", unbondedVal1.OperatorAddress, 30), fmt.Sprintf("INF Undelegate delegator %v from validator %v of all shares (%v).", addr1.String(), unbondedVal1.OperatorAddress, delegationCoinAmt), fmt.Sprintf("INF Undelegate delegator %v from validator %v of all shares (%v).", addr2.String(), unbondedVal1.OperatorAddress, delegationCoinAmt), @@ -640,7 +635,8 @@ func (s *UpgradeTestSuite) TestRemoveInactiveValidatorDelegations() { s.Require().Len(validators, 3, "Setup: GetAllValidators should have: 1 bonded, 1 recently unbonded, 1 empty unbonded") expectedLogLines := []string{ - "INF Removing all delegations from validators that have been inactive (unbonded) for 21 days.", + "INF Removing inactive validator delegations.", + "INF Threshold: 21 days", fmt.Sprintf("INF Validator %v has been inactive (unbonded) for %d days and will be removed.", unbondedVal1.OperatorAddress, 30), "INF A total of 1 inactive (unbonded) validators have had all their delegators removed.", } From ac7b00adf58e2d9a06eebef88aa4b9d1c7cb8842 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Wed, 24 Apr 2024 13:15:36 -0600 Subject: [PATCH 36/42] [1760]: Get rid of the rest of the uses of moduletestutil. --- cmd/provenanced/cmd/genaccounts_test.go | 4 ++-- internal/handlers/msg_fee_invoker_test.go | 21 ++++++++++++--------- testutil/mocks/codec.go | 6 ++---- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/cmd/provenanced/cmd/genaccounts_test.go b/cmd/provenanced/cmd/genaccounts_test.go index 4e18bc4321..39f0dbcce5 100644 --- a/cmd/provenanced/cmd/genaccounts_test.go +++ b/cmd/provenanced/cmd/genaccounts_test.go @@ -784,12 +784,12 @@ func TestAddMarketsToAppState(t *testing.T) { }{ { name: "error unmarshalling exchange gen state", - codec: mocks.NewMockCodec().WithUnmarshalJSONErrs("injected error message"), + codec: mocks.NewMockCodec(appCdc).WithUnmarshalJSONErrs("injected error message"), expErr: "could not extract exchange genesis state: injected error message", }, { name: "error marshalling exchange gen state", - codec: mocks.NewMockCodec().WithMarshalJSONErrs("another injected error message"), + codec: mocks.NewMockCodec(appCdc).WithMarshalJSONErrs("another injected error message"), expErr: "failed to marshal exchange genesis state: another injected error message", }, { diff --git a/internal/handlers/msg_fee_invoker_test.go b/internal/handlers/msg_fee_invoker_test.go index 429c14b70c..7b8e91e2f7 100644 --- a/internal/handlers/msg_fee_invoker_test.go +++ b/internal/handlers/msg_fee_invoker_test.go @@ -10,14 +10,16 @@ import ( "cosmossdk.io/x/feegrant" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/types/tx/signing" xauthsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + "github.com/cosmos/cosmos-sdk/x/auth/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/bank/testutil" + banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" simapp "github.com/provenance-io/provenance/app" simappparams "github.com/provenance-io/provenance/app/params" @@ -76,13 +78,13 @@ func (s *HandlerTestSuite) TestMsgFeeHandlerFeeChargedNoRemainingBaseFee() { // fee gas meter has nothing to charge, so nothing should have been charged. s.Require().True(coins.IsZero(), "coins.IsZero() 1") - s.Require().NoError(testutil.FundAccount(s.ctx, s.app.BankKeeper, acct1.GetAddress(), sdk.NewCoins(sdk.NewInt64Coin(NHash, 900_000))), "fund account") + s.Require().NoError(banktestutil.FundAccount(s.ctx, s.app.BankKeeper, acct1.GetAddress(), sdk.NewCoins(sdk.NewInt64Coin(NHash, 900_000))), "fund account") coins, _, err = feeChargeFn(s.ctx, false) s.Require().ErrorContains(err, "900000nhash is smaller than 1000000nhash: insufficient funds: insufficient funds", "feeChargeFn 2") // fee gas meter has nothing to charge, so nothing should have been charged. s.Require().True(coins.IsZero(), "coins.IsZero() 2") - s.Require().NoError(testutil.FundAccount(s.ctx, s.app.BankKeeper, acct1.GetAddress(), sdk.NewCoins(sdk.NewInt64Coin(NHash, 100_000))), "fund account again") + s.Require().NoError(banktestutil.FundAccount(s.ctx, s.app.BankKeeper, acct1.GetAddress(), sdk.NewCoins(sdk.NewInt64Coin(NHash, 100_000))), "fund account again") coins, _, err = feeChargeFn(s.ctx, false) s.Require().NoError(err, "feeChargeFn 3") // fee gas meter has nothing to charge, so nothing should have been charged. @@ -117,13 +119,13 @@ func (s *HandlerTestSuite) TestMsgFeeHandlerFeeChargedWithRemainingBaseFee() { }) s.Require().NoError(err, "NewAdditionalMsgFeeHandler") - s.Require().NoError(testutil.FundAccount(s.ctx, s.app.BankKeeper, acct1.GetAddress(), sdk.NewCoins(sdk.NewInt64Coin(NHash, 1_000_000))), "funding account") + s.Require().NoError(banktestutil.FundAccount(s.ctx, s.app.BankKeeper, acct1.GetAddress(), sdk.NewCoins(sdk.NewInt64Coin(NHash, 1_000_000))), "funding account") coins, _, err := feeChargeFn(s.ctx, false) s.Require().ErrorContains(err, "spendable balance 0atom is smaller than 20000atom: insufficient funds", "feeChargeFn 1") // fee gas meter has nothing to charge, so nothing should have been charged. s.Require().True(coins.IsZero(), "coins.IsZero() 1") - s.Require().NoError(testutil.FundAccount(s.ctx, s.app.BankKeeper, acct1.GetAddress(), sdk.NewCoins(sdk.NewInt64Coin("atom", 20000), sdk.NewInt64Coin(NHash, 1000000))), "funding account again") + s.Require().NoError(banktestutil.FundAccount(s.ctx, s.app.BankKeeper, acct1.GetAddress(), sdk.NewCoins(sdk.NewInt64Coin("atom", 20000), sdk.NewInt64Coin(NHash, 1000000))), "funding account again") coins, _, err = feeChargeFn(s.ctx, false) s.Require().Nil(err, "Got error when should have successfully paid all msg fees and swept remaining base fees") s.Require().True(coins.Equal(sdk.Coins{sdk.NewInt64Coin(NHash, 1000000), sdk.NewInt64Coin("atom", 20000)})) @@ -181,16 +183,17 @@ func (s *HandlerTestSuite) TestMsgFeeHandlerBadDecoder() { feeGasMeter := antewrapper.NewFeeGasMeterWrapper(log.NewTestLogger(s.T()), storetypes.NewGasMeter(100), false).(*antewrapper.FeeGasMeter) s.ctx = s.ctx.WithGasMeter(feeGasMeter) + emptyTxCfg := tx.NewTxConfig(codec.NewProtoCodec(codectestutil.CodecOptions{}.NewInterfaceRegistry()), tx.DefaultSignModes) + feeChargeFn, err := piohandlers.NewAdditionalMsgFeeHandler(piohandlers.PioBaseAppKeeperOptions{ AccountKeeper: s.app.AccountKeeper, BankKeeper: s.app.BankKeeper, FeegrantKeeper: s.app.FeeGrantKeeper, MsgFeesKeeper: s.app.MsgFeesKeeper, - Decoder: moduletestutil.MakeTestTxConfig().TxDecoder(), + Decoder: emptyTxCfg.TxDecoder(), }) s.Require().NoError(err) s.Require().Panics(func() { feeChargeFn(s.ctx, false) }, "Bad decoder while setting up app.") - } func setUpApp(s *HandlerTestSuite, additionalFeeCoinDenom string, additionalFeeCoinAmt int64) (simappparams.EncodingConfig, error) { @@ -261,7 +264,7 @@ func createTestTxWithFeeGrant(s *HandlerTestSuite, err error, feeAmount sdk.Coin }) s.txBuilder.SetFeeGranter(acct2.GetAddress()) - s.Require().NoError(testutil.FundAccount(s.ctx, s.app.BankKeeper, acct2.GetAddress(), sdk.NewCoins(sdk.NewInt64Coin(NHash, 1_000_000))), "funding account") + s.Require().NoError(banktestutil.FundAccount(s.ctx, s.app.BankKeeper, acct2.GetAddress(), sdk.NewCoins(sdk.NewInt64Coin(NHash, 1_000_000))), "funding account") testTx, err := s.CreateTestTx(privs, accNums, accSeqs, s.ctx.ChainID()) s.Require().NoError(err, "CreateTestTx") diff --git a/testutil/mocks/codec.go b/testutil/mocks/codec.go index 8a57cab0a4..189232bff6 100644 --- a/testutil/mocks/codec.go +++ b/testutil/mocks/codec.go @@ -4,8 +4,6 @@ import ( "errors" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/types/module" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/gogoproto/proto" ) @@ -23,8 +21,8 @@ type MockCodec struct { var _ codec.Codec = (*MockCodec)(nil) // NewMockCodec creates a new mock codec based on the standard test encoding config codec. -func NewMockCodec(modules ...module.AppModuleBasic) *MockCodec { - return &MockCodec{Codec: moduletestutil.MakeTestEncodingConfig(modules...).Codec} +func NewMockCodec(baseCdc codec.Codec) *MockCodec { + return &MockCodec{Codec: baseCdc} } // WithMarshalJSONErrs adds the given errors to be returned from MarshalJSON or MustMarshalJSON. From 5ed6a82c6a483f11bbc9ad5669b6a573087a31a5 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Wed, 24 Apr 2024 13:27:16 -0600 Subject: [PATCH 37/42] [1760]: Change the test workflow to put all the failing tests in one part, and split the rest among the other 3. --- .github/workflows/test.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index de7911bf50..f42f9650c7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,10 +48,29 @@ jobs: # The next longest running is x/metadata/client/cli at 2.5ish minutes. # So take x/marker/simulation out of the list, split the list into 3 parts and create a 4th part # with just the x/marker/simulation test. + # Temporarily, several tests are known to still fail, so we make them all part 3, + # and split the rest among 0-2. + # TODO[1760]: Re-analyze how long tests tests take and change the splitting back to be based on speed. run: | - grep -vF -e 'github.com/provenance-io/provenance/x/marker/simulation' pkgs.txt > pkgs.txt.tmp + grep -vF \ + -e 'github.com/provenance-io/provenance/app' \ + -e 'github.com/provenance-io/provenance/cmd/provenanced/cmd' \ + -e 'github.com/provenance-io/provenance/internal/antewrapper' \ + -e 'github.com/provenance-io/provenance/x/ibchooks' \ + -e 'github.com/provenance-io/provenance/x/ibcratelimit/module' \ + -e 'github.com/provenance-io/provenance/x/ibcratelimit/simulation' \ + -e 'github.com/provenance-io/provenance/x/oracle/simulation' \ + pkgs.txt > pkgs.txt.tmp split -d -n l/3 pkgs.txt.tmp pkgs.txt.part. - printf 'github.com/provenance-io/provenance/x/marker/simulation\n' > pkgs.txt.part.03 + printf '%s\n' \ + 'github.com/provenance-io/provenance/app' \ + 'github.com/provenance-io/provenance/cmd/provenanced/cmd' \ + 'github.com/provenance-io/provenance/internal/antewrapper' \ + 'github.com/provenance-io/provenance/x/ibchooks' \ + 'github.com/provenance-io/provenance/x/ibcratelimit/module' \ + 'github.com/provenance-io/provenance/x/ibcratelimit/simulation' \ + 'github.com/provenance-io/provenance/x/oracle/simulation' \ + > pkgs.txt.part.03 - uses: actions/upload-artifact@v4 with: name: "${{ steps.def-vars.outputs.file-prefix }}-pkgs.txt.part.00" From 517db05adfa90e7f74c70277fb97534653fd22c4 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Wed, 24 Apr 2024 14:24:30 -0600 Subject: [PATCH 38/42] [1760]: Standardize the google.golang.org/protobuf/proto as protov2. Fix some import orderings. --- .github/workflows/test.yml | 3 +-- internal/protocompat/protocompat.go | 28 +++++++++++++------------- testutil/genesis.go | 1 + x/exchange/msg.go | 14 ++++++------- x/exchange/msg_sigs_test.go | 4 ++-- x/marker/keeper/params_test.go | 4 +++- x/marker/simulation/operations_test.go | 3 ++- 7 files changed, 30 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f42f9650c7..6c226729a8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,8 +48,7 @@ jobs: # The next longest running is x/metadata/client/cli at 2.5ish minutes. # So take x/marker/simulation out of the list, split the list into 3 parts and create a 4th part # with just the x/marker/simulation test. - # Temporarily, several tests are known to still fail, so we make them all part 3, - # and split the rest among 0-2. + # Temporarily, several tests are known to still fail, so we make them all part 3, and split the rest among 0-2. # TODO[1760]: Re-analyze how long tests tests take and change the splitting back to be based on speed. run: | grep -vF \ diff --git a/internal/protocompat/protocompat.go b/internal/protocompat/protocompat.go index 7c2a9ab0de..61e96dc57f 100644 --- a/internal/protocompat/protocompat.go +++ b/internal/protocompat/protocompat.go @@ -7,7 +7,7 @@ import ( "github.com/golang/protobuf/proto" //nolint: staticcheck // needed because gogoproto.Merge does not work consistently. See NOTE: comments. "google.golang.org/grpc" - proto2 "google.golang.org/protobuf/proto" + protov2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" "google.golang.org/protobuf/runtime/protoiface" @@ -18,8 +18,8 @@ import ( var ( gogoType = reflect.TypeOf((*gogoproto.Message)(nil)).Elem() - protov2Type = reflect.TypeOf((*proto2.Message)(nil)).Elem() - protov2MarshalOpts = proto2.MarshalOptions{Deterministic: true} + protov2Type = reflect.TypeOf((*protov2.Message)(nil)).Elem() + protov2MarshalOpts = protov2.MarshalOptions{Deterministic: true} ) type Handler = func(ctx context.Context, request, response protoiface.MessageV1) error @@ -51,36 +51,36 @@ func makeProtoV2HybridHandler(prefMethod protoreflect.MethodDescriptor, cdc code gogoExists := gogoproto.MessageType(string(prefMethod.Output().FullName())) != nil if !gogoExists { return func(ctx context.Context, inReq, outResp protoiface.MessageV1) error { - protov2Request, ok := inReq.(proto2.Message) + protov2Request, ok := inReq.(protov2.Message) if !ok { return fmt.Errorf("invalid request type %T, method %s does not accept gogoproto messages", inReq, prefMethod.FullName()) } resp, err := method.Handler(handler, ctx, func(msg any) error { - proto2.Merge(msg.(proto2.Message), protov2Request) + protov2.Merge(msg.(protov2.Message), protov2Request) return nil }, nil) if err != nil { return err } // merge on the resp - proto2.Merge(outResp.(proto2.Message), resp.(proto2.Message)) + protov2.Merge(outResp.(protov2.Message), resp.(protov2.Message)) return nil }, nil } return func(ctx context.Context, inReq, outResp protoiface.MessageV1) error { // we check if the request is a protov2 message. switch m := inReq.(type) { - case proto2.Message: + case protov2.Message: // we can just call the handler after making a copy of the message, for safety reasons. resp, err := method.Handler(handler, ctx, func(msg any) error { - proto2.Merge(msg.(proto2.Message), m) + protov2.Merge(msg.(protov2.Message), m) return nil }, nil) if err != nil { return err } // merge on the resp - proto2.Merge(outResp.(proto2.Message), resp.(proto2.Message)) + protov2.Merge(outResp.(protov2.Message), resp.(protov2.Message)) return nil case gogoproto.Message: // we need to marshal and unmarshal the request. @@ -90,7 +90,7 @@ func makeProtoV2HybridHandler(prefMethod protoreflect.MethodDescriptor, cdc code } resp, err := method.Handler(handler, ctx, func(msg any) error { // unmarshal request into the message. - return proto2.Unmarshal(requestBytes, msg.(proto2.Message)) + return protov2.Unmarshal(requestBytes, msg.(protov2.Message)) }, nil) if err != nil { return err @@ -98,7 +98,7 @@ func makeProtoV2HybridHandler(prefMethod protoreflect.MethodDescriptor, cdc code // the response is a protov2 message, so we cannot just return it. // since the request came as gogoproto, we expect the response // to also be gogoproto. - respBytes, err := protov2MarshalOpts.Marshal(resp.(proto2.Message)) + respBytes, err := protov2MarshalOpts.Marshal(resp.(protov2.Message)) if err != nil { return err } @@ -117,7 +117,7 @@ func makeGogoHybridHandler(prefMethod protoreflect.MethodDescriptor, cdc codec.B if err != nil { // this can only be a gogo message. return func(ctx context.Context, inReq, outResp protoiface.MessageV1) error { - _, ok := inReq.(proto2.Message) + _, ok := inReq.(protov2.Message) if ok { return fmt.Errorf("invalid request type %T, method %s does not accept protov2 messages", inReq, prefMethod.FullName()) } @@ -141,7 +141,7 @@ func makeGogoHybridHandler(prefMethod protoreflect.MethodDescriptor, cdc codec.B // this is a gogo handler, and we have a protov2 counterparty. return func(ctx context.Context, inReq, outResp protoiface.MessageV1) error { switch m := inReq.(type) { - case proto2.Message: + case protov2.Message: // we need to marshal and unmarshal the request. requestBytes, err := protov2MarshalOpts.Marshal(m) if err != nil { @@ -162,7 +162,7 @@ func makeGogoHybridHandler(prefMethod protoreflect.MethodDescriptor, cdc codec.B return err } // now we unmarshal back into a protov2 message. - return proto2.Unmarshal(respBytes, outResp.(proto2.Message)) + return protov2.Unmarshal(respBytes, outResp.(protov2.Message)) case gogoproto.Message: // we can just call the handler after making a copy of the message, for safety reasons. resp, err := method.Handler(handler, ctx, func(msg any) error { diff --git a/testutil/genesis.go b/testutil/genesis.go index 9b7e60b8d3..8750eefae3 100644 --- a/testutil/genesis.go +++ b/testutil/genesis.go @@ -14,6 +14,7 @@ import ( // // G is the type of the specific genesis state struct being used here. func MutateGenesisState[G proto.Message](t *testing.T, cfg *testnet.Config, moduleName string, emptyState G, mutator func(state G) G) { + t.Helper() err := cfg.Codec.UnmarshalJSON(cfg.GenesisState[moduleName], emptyState) if err != nil { t.Logf("initial %s genesis state:\n%s", moduleName, string(cfg.GenesisState[moduleName])) diff --git a/x/exchange/msg.go b/x/exchange/msg.go index 0b3419ee28..12cd657bd1 100644 --- a/x/exchange/msg.go +++ b/x/exchange/msg.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" - "google.golang.org/protobuf/proto" + protov2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/protoadapt" "google.golang.org/protobuf/reflect/protoreflect" @@ -857,23 +857,23 @@ func (m MsgGovUpdateParamsRequest) GetSigners() []sdk.AccAddress { // The provided getter will be used to get the string of the signer address, // which will be decoded using the decoder in the provided signing.Options. func createPaymentGetSignersFunc(options *signing.Options, fieldName string) signing.GetSignersFunc { - return func(msgIn proto.Message) (addrs [][]byte, err error) { + return func(msgIn protov2.Message) (addrs [][]byte, err error) { defer func() { if r := recover(); r != nil { - err = fmt.Errorf("panic (recovered) getting %s.payment.%s as a signer: %v", proto.MessageName(msgIn), fieldName, r) + err = fmt.Errorf("panic (recovered) getting %s.payment.%s as a signer: %v", protov2.MessageName(msgIn), fieldName, r) } }() msg := msgIn.ProtoReflect() pmtDesc := msg.Descriptor().Fields().ByName("payment") if pmtDesc == nil { - return nil, fmt.Errorf("no payment field found in %s", proto.MessageName(msgIn)) + return nil, fmt.Errorf("no payment field found in %s", protov2.MessageName(msgIn)) } pmt := msg.Get(pmtDesc).Message() fieldDesc := pmt.Descriptor().Fields().ByName(protoreflect.Name(fieldName)) if fieldDesc == nil { - return nil, fmt.Errorf("no payment.%s field found in %s", fieldName, proto.MessageName(msgIn)) + return nil, fmt.Errorf("no payment.%s field found in %s", fieldName, protov2.MessageName(msgIn)) } b32 := pmt.Get(fieldDesc).Interface().(string) @@ -888,9 +888,9 @@ func createPaymentGetSignersFunc(options *signing.Options, fieldName string) sig // DefineCustomGetSigners registers all the exchange module custom GetSigners functions with the provided signing options. func DefineCustomGetSigners(options *signing.Options) { options.DefineCustomGetSigners( - proto.MessageName(protoadapt.MessageV2Of(&MsgCreatePaymentRequest{})), + protov2.MessageName(protoadapt.MessageV2Of(&MsgCreatePaymentRequest{})), createPaymentGetSignersFunc(options, "source")) options.DefineCustomGetSigners( - proto.MessageName(protoadapt.MessageV2Of(&MsgAcceptPaymentRequest{})), + protov2.MessageName(protoadapt.MessageV2Of(&MsgAcceptPaymentRequest{})), createPaymentGetSignersFunc(options, "target")) } diff --git a/x/exchange/msg_sigs_test.go b/x/exchange/msg_sigs_test.go index 97abed3d86..2c4148f21b 100644 --- a/x/exchange/msg_sigs_test.go +++ b/x/exchange/msg_sigs_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" + protov2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/protoadapt" "cosmossdk.io/x/tx/signing" @@ -355,7 +355,7 @@ func TestDefineCustomGetSigners(t *testing.T) { for _, tc := range tests { msgV2 := protoadapt.MessageV2Of(tc.msg) - name := proto.MessageName(msgV2) + name := protov2.MessageName(msgV2) expected := [][]byte{tc.exp} // Make sure the custom entries are added to the map, and that they work as expected. diff --git a/x/marker/keeper/params_test.go b/x/marker/keeper/params_test.go index 06072a9c82..5098937605 100644 --- a/x/marker/keeper/params_test.go +++ b/x/marker/keeper/params_test.go @@ -4,10 +4,12 @@ import ( "testing" "time" - cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/suite" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/provenance-io/provenance/app" simapp "github.com/provenance-io/provenance/app" "github.com/provenance-io/provenance/x/marker/types" diff --git a/x/marker/simulation/operations_test.go b/x/marker/simulation/operations_test.go index bc816727d8..e4126fdfb5 100644 --- a/x/marker/simulation/operations_test.go +++ b/x/marker/simulation/operations_test.go @@ -10,16 +10,17 @@ import ( "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/bank/testutil" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - "github.com/provenance-io/provenance/testutil/assertions" "github.com/provenance-io/provenance/app" simappparams "github.com/provenance-io/provenance/app/params" + "github.com/provenance-io/provenance/testutil/assertions" "github.com/provenance-io/provenance/x/marker/keeper" "github.com/provenance-io/provenance/x/marker/simulation" "github.com/provenance-io/provenance/x/marker/types" From 3d6b97e2d60801257de61803beaa4b96afaa7dde Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Wed, 24 Apr 2024 14:44:43 -0600 Subject: [PATCH 39/42] [1760]: Add changelog entry. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba24044648..7582bac5b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * Restore gov-prop cli commands and fix next key decoding [#1930](https://github.com/provenance-io/provenance/pull/1930). * Switch to InputOutputCoinsProv for exchange transfers [#1930](https://github.com/provenance-io/provenance/pull/1930). * Use fields of the SimulationState for the encoders needed for simulations [#1931](https://github.com/provenance-io/provenance/pull/1931). +* Fix most of the failing unit tests [#1943](https://github.com/provenance-io/provenance/pull/1943) ### Dependencies From f3398484731e336ba2593fbb5e59e73d60109bbe Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Wed, 24 Apr 2024 15:21:31 -0600 Subject: [PATCH 40/42] [1760]: In AssertGetTxFromResponse, do 4 tries before giving up, but only log the output on the last attempt. --- testutil/queries/auth.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/testutil/queries/auth.go b/testutil/queries/auth.go index 642e5e513b..77f88b9048 100644 --- a/testutil/queries/auth.go +++ b/testutil/queries/auth.go @@ -72,7 +72,7 @@ func GetTxFromResponse(t *testing.T, n *network.Network, txRespBz []byte) sdk.Tx // AssertGetTxFromResponse gets the TxResponse from the provided ExecTestCLICmd output bytes. // If the provided output indicates a code other than 0, that is what is returned. // If the provided output has a code of 0, the tx hash is extracted from it, and queries -// are executed to get the TxResponse for it. Three attempts are made to query for the tx, +// are executed to get the TxResponse for it. Four attempts are made to query for the tx, // waiting a block between each attempt. // // This asserts that there are no problems getting the TxResponse, returning true if no assertions failed. @@ -98,21 +98,20 @@ func AssertGetTxFromResponse(t *testing.T, n *network.Network, txRespBz []byte) cmd := authcli.QueryTxCmd() args := []string{origResp.TxHash, "--output", "json"} var outBZ []byte - tries := 3 - for i := 1; i <= tries; i++ { + tries := 4 + var i int + for i = 1; i <= tries; i++ { out, cmdErr := cli.ExecTestCLICmd(val.ClientCtx, cmd, args) outBZ = out.Bytes() - t.Logf("Tx %s result (try %d of %d):\n%s", origResp.TxHash, i, tries, string(outBZ)) err = cmdErr - if err == nil || !strings.Contains(err.Error(), fmt.Sprintf("tx (%s) not found", origResp.TxHash)) { + if i == tries || err == nil || !strings.Contains(err.Error(), fmt.Sprintf("tx (%s) not found", origResp.TxHash)) { break } - if i != tries { - if !assert.NoError(t, testutil.WaitForNextBlock(n), "WaitForNextBlock after try %d of %d", i, tries) { - return sdk.TxResponse{}, false - } + if !assert.NoError(t, testutil.WaitForNextBlock(n), "WaitForNextBlock after try %d of %d", i, tries) { + return sdk.TxResponse{}, false } } + t.Logf("Tx %s result (try %d of %d):\n%s", origResp.TxHash, i, tries, outBZ) if !assert.NoError(t, err, "ExecTestCLICmd QueryTxCmd %v", args) { return sdk.TxResponse{}, false } From 0f54784399ca02db1b3d8f9d5564b5e6964e8996 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Wed, 24 Apr 2024 15:44:11 -0600 Subject: [PATCH 41/42] [1760]: In the sanction tests, make the voting period last 5 blocks. --- x/sanction/client/testutil/cli_test.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/x/sanction/client/testutil/cli_test.go b/x/sanction/client/testutil/cli_test.go index c58f83c409..800d3c8e88 100644 --- a/x/sanction/client/testutil/cli_test.go +++ b/x/sanction/client/testutil/cli_test.go @@ -31,11 +31,14 @@ import ( client "github.com/provenance-io/provenance/x/sanction/client/cli" ) +const blocksPerVotingPeriod = 5 + func TestIntegrationTestSuite(t *testing.T) { pioconfig.SetProvenanceConfig(sdk.DefaultBondDenom, 0) govv1.DefaultMinDepositRatio = sdkmath.LegacyZeroDec() cfg := testutil.DefaultTestNetworkConfig() cfg.NumValidators = 5 + // cfg.TimeoutCommit = time.Millisecond * msPerBlock // Define some stuff in the sanction genesis state. sanctionedAddr1 := sdk.AccAddress("1_sanctioned_address_") @@ -79,9 +82,9 @@ func TestIntegrationTestSuite(t *testing.T) { cfg.Codec.MustUnmarshalJSON(govGenBz, &govGen) } govGen.Params.MinDeposit = sdk.NewCoins(sdk.NewInt64Coin(cfg.BondDenom, 6)) - twoSeconds := time.Second * 2 - govGen.Params.MaxDepositPeriod = &twoSeconds - govGen.Params.VotingPeriod = &twoSeconds + votingPeriod := cfg.TimeoutCommit * blocksPerVotingPeriod + govGen.Params.MaxDepositPeriod = &votingPeriod + govGen.Params.VotingPeriod = &votingPeriod cfg.GenesisState[gov.ModuleName] = cfg.Codec.MustMarshalJSON(&govGen) suite.Run(t, NewIntegrationTestSuite(cfg, &sanctionGen)) @@ -221,11 +224,10 @@ func (s *IntegrationTestSuite) TestSanctionValidatorImmediateUsingGovCmds() { } } - // We configured 1/2 second per block, and a 2-second voting period. - // So wait for 4 blocks after the proposal block. + // Wait for the proposal to pass. s.logHeight() s.T().Log("waiting for voting period to end") - s.waitForHeight(propHeight + 4) + s.waitForHeight(propHeight + blocksPerVotingPeriod) // Check that the proposal passed. finalProp := queries.GetGovProp(s.T(), s.network, propID) From 5e81ee5208940a59bc40df506d035232d9964857 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Wed, 24 Apr 2024 16:06:52 -0600 Subject: [PATCH 42/42] [1760]: In the sanction tests, bump blocks per voting period to 6 because TestSanctionValidatorImmediateUsingGovCmds keeps failing the race tests because the votes aren't coming in fast enough. --- x/sanction/client/testutil/cli_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x/sanction/client/testutil/cli_test.go b/x/sanction/client/testutil/cli_test.go index 800d3c8e88..92f0ed29cf 100644 --- a/x/sanction/client/testutil/cli_test.go +++ b/x/sanction/client/testutil/cli_test.go @@ -31,7 +31,7 @@ import ( client "github.com/provenance-io/provenance/x/sanction/client/cli" ) -const blocksPerVotingPeriod = 5 +const blocksPerVotingPeriod = 6 func TestIntegrationTestSuite(t *testing.T) { pioconfig.SetProvenanceConfig(sdk.DefaultBondDenom, 0) @@ -205,12 +205,14 @@ func (s *IntegrationTestSuite) TestSanctionValidatorImmediateUsingGovCmds() { // block after each vote. We'll check all of them manually once they're submitted. voteOutBzs := make([][]byte, len(allVoteArgs)) for i, voteArgs := range allVoteArgs { + s.logHeight() voteArgs[0] = propID voteOutBW, err := cli.ExecTestCLICmd(s.clientCtx, voteCmd, voteArgs) s.Require().NoError(err, "[%d]: ExecTestCLICmd tx gov vote", i) voteOutBzs[i] = voteOutBW.Bytes() s.T().Logf("[%d]: tx gov vote output:\n%s", i, voteOutBzs[i]) } + s.logHeight() // And now, we check that the votes happened as expected. for i, voteOutBz := range voteOutBzs { txResp := queries.GetTxFromResponse(s.T(), s.network, voteOutBz)