diff --git a/app/grpc/tx/server.go b/app/grpc/tx/server.go index 93b3c9da36..417b7c088b 100644 --- a/app/grpc/tx/server.go +++ b/app/grpc/tx/server.go @@ -76,6 +76,7 @@ func (s *txServer) TxStatus(ctx context.Context, req *TxStatusRequest) (*TxStatu Height: resTx.Height, Index: resTx.Index, ExecutionCode: resTx.ExecutionCode, + Error: resTx.Error, Status: resTx.Status, }, nil } diff --git a/app/grpc/tx/tx.pb.go b/app/grpc/tx/tx.pb.go index c962ec2dd5..de589600d2 100644 --- a/app/grpc/tx/tx.pb.go +++ b/app/grpc/tx/tx.pb.go @@ -82,8 +82,10 @@ type TxStatusResponse struct { // and returns whether it was successful or errored. A non zero // execution code indicated an error. ExecutionCode uint32 `protobuf:"varint,3,opt,name=execution_code,json=executionCode,proto3" json:"execution_code,omitempty"` + // error log for failed transactions. + Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` // status is the status of the transaction. - Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` + Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` } func (m *TxStatusResponse) Reset() { *m = TxStatusResponse{} } @@ -140,6 +142,13 @@ func (m *TxStatusResponse) GetExecutionCode() uint32 { return 0 } +func (m *TxStatusResponse) GetError() string { + if m != nil { + return m.Error + } + return "" +} + func (m *TxStatusResponse) GetStatus() string { if m != nil { return m.Status @@ -155,28 +164,29 @@ func init() { func init() { proto.RegisterFile("celestia/core/v1/tx/tx.proto", fileDescriptor_7d8b070565b0dcb6) } var fileDescriptor_7d8b070565b0dcb6 = []byte{ - // 322 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x51, 0xcd, 0x4a, 0x03, 0x31, - 0x18, 0x6c, 0xfa, 0x87, 0x06, 0xaa, 0x92, 0x8a, 0x2c, 0xa5, 0x84, 0x52, 0x5a, 0xe9, 0xc5, 0x84, - 0xea, 0x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xb3, 0xdf, 0xa2, 0xcb, 0x17, 0x84, 0x8b, 0x43, 0x4b, - 0xe6, 0xf8, 0x60, 0xf7, 0x0e, 0xd2, 0x61, 0x7b, 0xf2, 0xb2, 0x3f, 0x71, 0x1a, 0xdd, 0x7f, 0x54, - 0x9b, 0x30, 0xed, 0xce, 0xf3, 0xc7, 0xf7, 0x5b, 0x91, 0x92, 0x26, 0xdf, 0x57, 0xf1, 0xa3, 0x6b, - 0x64, 0x7e, 0x3d, 0x78, 0x5f, 0x52, 0xb4, 0x58, 0x52, 0xf4, 0xb5, 0xa4, 0xe8, 0x75, 0x45, 0x0b, - 0x8b, 0x15, 0x2d, 0x7c, 0xae, 0x68, 0xe1, 0x8e, 0xc7, 0x12, 0x26, 0xd9, 0x98, 0x85, 0xea, 0x3e, - 0x9f, 0xa0, 0xd2, 0x38, 0xdf, 0x5f, 0x04, 0x5a, 0xf3, 0xf5, 0x8a, 0x53, 0x1d, 0x72, 0xb0, 0xe3, - 0xaa, 0xfb, 0x80, 0xab, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdb, 0x2a, 0x51, 0xff, 0xd3, 0x01, - 0x00, 0x00, + // 337 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x51, 0xcd, 0x4a, 0x33, 0x31, + 0x14, 0x6d, 0xfa, 0xc7, 0xf7, 0x05, 0xfa, 0x7d, 0x92, 0x8a, 0x0c, 0xa5, 0x0c, 0xa5, 0xb4, 0xd2, + 0x8d, 0x13, 0xaa, 0x6f, 0xa0, 0xab, 0x6e, 0xc7, 0xae, 0xdc, 0x94, 0xe9, 0xcc, 0x65, 0x1a, 0xa8, + 0x93, 0x31, 0xb9, 0x53, 0x02, 0xd2, 0x8d, 0xbe, 0x80, 0x20, 0xbe, 0x93, 0xcb, 0x82, 0x1b, 0x97, + 0xd2, 0xfa, 0x20, 0x32, 0x99, 0xb6, 0x82, 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0xc4, + 0x6e, 0xef, 0xe1, 0xed, 0xf3, 0xb9, 0xec, 0xb2, 0x36, 0x3f, 0x94, 0xfc, 0xbd, 0x0d, 0x6a, 0x79, + 0x39, 0x7a, 0x5d, 0xbb, 0x64, 0xb5, 0x76, 0xc9, 0xc7, 0xda, 0x25, 0x4f, 0x1b, 0xb7, 0xb4, 0xda, + 0xb8, 0xa5, 0xf7, 0x8d, 0x5b, 0xba, 0xe1, 0xb1, 0xc0, 0x59, 0x36, 0xf5, 0x42, 0x79, 0xbb, 0x7f, + 0x41, 0xaa, 0x78, 0x7f, 0x3f, 0x0b, 0xd2, 0x94, 0xe7, 0x27, 0x56, 0x69, 0xc8, 0xd1, 0x4c, 0xeb, + 0x76, 0x2f, 0x17, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x5a, 0x2f, 0x1b, 0xd1, 0xea, 0x01, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -324,6 +334,13 @@ func (m *TxStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Status) i = encodeVarintTx(dAtA, i, uint64(len(m.Status))) i-- + dAtA[i] = 0x2a + } + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = encodeVarintTx(dAtA, i, uint64(len(m.Error))) + i-- dAtA[i] = 0x22 } if m.ExecutionCode != 0 { @@ -383,6 +400,10 @@ func (m *TxStatusResponse) Size() (n int) { if m.ExecutionCode != 0 { n += 1 + sovTx(uint64(m.ExecutionCode)) } + l = len(m.Error) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } l = len(m.Status) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -565,6 +586,38 @@ func (m *TxStatusResponse) Unmarshal(dAtA []byte) error { } } case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } diff --git a/app/test/big_blob_test.go b/app/test/big_blob_test.go index ad219c2e3d..ecb257031f 100644 --- a/app/test/big_blob_test.go +++ b/app/test/big_blob_test.go @@ -83,8 +83,7 @@ func (s *BigBlobSuite) TestErrBlobsTooLarge() { res, err := txClient.SubmitPayForBlob(subCtx, []*share.Blob{tc.blob}, user.SetGasLimitAndGasPrice(1e9, appconsts.DefaultMinGasPrice)) require.Error(t, err) require.NotNil(t, res) - // FIXME: assert RawLog once TxStatus supports it. - require.Equal(t, tc.want, res.Code) + require.Equal(t, tc.want, res.Code, err.Error()) }) } } diff --git a/app/test/prepare_proposal_context_test.go b/app/test/prepare_proposal_context_test.go index 7eb14bf9a8..d01fad5a9d 100644 --- a/app/test/prepare_proposal_context_test.go +++ b/app/test/prepare_proposal_context_test.go @@ -81,8 +81,6 @@ func TestTimeInPrepareProposalContext(t *testing.T) { msgs, _ := tt.msgFunc() res, err := txClient.SubmitTx(cctx.GoContext(), msgs, user.SetGasLimit(1000000), user.SetFee(2000)) require.NoError(t, err) - // FIXME: Temporary way of querying the raw log. - // TxStatus will natively support this in the future. serviceClient := sdktx.NewServiceClient(cctx.GRPCClient) getTxResp, err := serviceClient.GetTx(cctx.GoContext(), &sdktx.GetTxRequest{Hash: res.TxHash}) require.NoError(t, err) diff --git a/app/test/square_size_test.go b/app/test/square_size_test.go index 653f4b4ae4..d030b89093 100644 --- a/app/test/square_size_test.go +++ b/app/test/square_size_test.go @@ -174,8 +174,6 @@ func (s *SquareSizeIntegrationTest) setBlockSizeParams(t *testing.T, squareSize, res, err := txClient.SubmitTx(s.cctx.GoContext(), []sdk.Msg{msg}, blobfactory.DefaultTxOpts()...) require.NoError(t, err) - // FIXME: Temporary way of querying the raw log. - // TxStatus will natively support this in the future. serviceClient := sdktx.NewServiceClient(s.cctx.GRPCClient) getTxResp, err := serviceClient.GetTx(s.cctx.GoContext(), &sdktx.GetTxRequest{Hash: res.TxHash}) require.NoError(t, err) diff --git a/app/test/std_sdk_test.go b/app/test/std_sdk_test.go index ca4b401768..8d3e02aa3d 100644 --- a/app/test/std_sdk_test.go +++ b/app/test/std_sdk_test.go @@ -326,8 +326,6 @@ func (s *StandardSDKIntegrationTestSuite) TestStandardSDK() { } else { require.NoError(t, err) } - // FIXME: Temporary way of querying the raw log. - // TxStatus will natively support this in the future. serviceClient := sdktx.NewServiceClient(s.cctx.GRPCClient) getTxResp, err := serviceClient.GetTx(s.cctx.GoContext(), &sdktx.GetTxRequest{Hash: res.TxHash}) require.NoError(t, err) diff --git a/go.mod b/go.mod index 5f1fab11a6..8375b680f5 100644 --- a/go.mod +++ b/go.mod @@ -252,5 +252,5 @@ replace ( github.com/cosmos/ledger-cosmos-go => github.com/cosmos/ledger-cosmos-go v0.12.4 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.39.0-tm-v0.34.29 + github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.40.0-tm-v0.34.29 ) diff --git a/go.sum b/go.sum index 034dabe1c1..d5be2573b4 100644 --- a/go.sum +++ b/go.sum @@ -318,8 +318,8 @@ github.com/celestiaorg/bittwister v0.0.0-20231213180407-65cdbaf5b8c7 h1:nxplQi8w github.com/celestiaorg/bittwister v0.0.0-20231213180407-65cdbaf5b8c7/go.mod h1:1EF5MfOxVf0WC51Gb7pJ6bcZxnXKNAf9pqWtjgPBAYc= github.com/celestiaorg/blobstream-contracts/v3 v3.1.0 h1:h1Y4V3EMQ2mFmNtWt2sIhZIuyASInj1a9ExI8xOsTOw= github.com/celestiaorg/blobstream-contracts/v3 v3.1.0/go.mod h1:x4DKyfKOSv1ZJM9NwV+Pw01kH2CD7N5zTFclXIVJ6GQ= -github.com/celestiaorg/celestia-core v1.39.0-tm-v0.34.29 h1:9Co/2peu4+9S6KMVNPFS0NTI/RYIRirNpM4N7dmi9ak= -github.com/celestiaorg/celestia-core v1.39.0-tm-v0.34.29/go.mod h1:5jJ5magtH7gQOwSYfS/m5fliIS7irKunLV7kLNaD8o0= +github.com/celestiaorg/celestia-core v1.40.0-tm-v0.34.29 h1:J79TAjizxwIvm7/k+WI3PPH1aFj4AjOSjajoq5UzAwI= +github.com/celestiaorg/celestia-core v1.40.0-tm-v0.34.29/go.mod h1:5jJ5magtH7gQOwSYfS/m5fliIS7irKunLV7kLNaD8o0= github.com/celestiaorg/cosmos-sdk v1.24.1-sdk-v0.46.16 h1:SeQ7Y/CyOcUMKo7mQiexaj/pZ/xIgyuZFIwYZwpSkWE= github.com/celestiaorg/cosmos-sdk v1.24.1-sdk-v0.46.16/go.mod h1:Bpl1LSWiDpQumgOhhMTZBMopqa0j7fRasIhvTZB44P0= github.com/celestiaorg/go-square/v2 v2.0.0-rc2 h1:4D+ASgZGYVCsffc2uhPagACrvNiLZu9/CqNYvnlHCgg= diff --git a/pkg/user/tx_client.go b/pkg/user/tx_client.go index 75863f1293..b2c5b750a3 100644 --- a/pkg/user/tx_client.go +++ b/pkg/user/tx_client.go @@ -31,6 +31,7 @@ import ( "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" "github.com/celestiaorg/celestia-app/v3/x/blob/types" "github.com/celestiaorg/celestia-app/v3/x/minfee" + "github.com/tendermint/tendermint/rpc/core" ) const ( @@ -211,10 +212,8 @@ func SetupTxClient( // TxOptions may be provided to set the fee and gas limit. func (client *TxClient) SubmitPayForBlob(ctx context.Context, blobs []*share.Blob, opts ...TxOption) (*TxResponse, error) { resp, err := client.BroadcastPayForBlob(ctx, blobs, opts...) - if err != nil && resp != nil { - return &TxResponse{Code: resp.Code, TxHash: resp.TxHash}, fmt.Errorf("failed to broadcast pay for blob: %v", err) - } else if err != nil { - return &TxResponse{}, fmt.Errorf("failed to broadcast pay for blob: %v", err) + if err != nil { + return parseTxResponse(resp, fmt.Errorf("failed to broadcast pay for blob: %v", err)) } return client.ConfirmTx(ctx, resp.TxHash) @@ -224,10 +223,8 @@ func (client *TxClient) SubmitPayForBlob(ctx context.Context, blobs []*share.Blo // TxOptions may be provided to set the fee and gas limit. func (client *TxClient) SubmitPayForBlobWithAccount(ctx context.Context, account string, blobs []*share.Blob, opts ...TxOption) (*TxResponse, error) { resp, err := client.BroadcastPayForBlobWithAccount(ctx, account, blobs, opts...) - if err != nil && resp != nil { - return &TxResponse{Code: resp.Code, TxHash: resp.TxHash}, fmt.Errorf("failed to broadcast pay for blob with account: %v", err) - } else if err != nil { - return &TxResponse{}, fmt.Errorf("failed to broadcast pay for blob with account: %v", err) + if err != nil { + return parseTxResponse(resp, fmt.Errorf("failed to broadcast pay for blob with account: %v", err)) } return client.ConfirmTx(ctx, resp.TxHash) @@ -270,10 +267,8 @@ func (client *TxClient) BroadcastPayForBlobWithAccount(ctx context.Context, acco // may be provided to set the fee and gas limit. func (client *TxClient) SubmitTx(ctx context.Context, msgs []sdktypes.Msg, opts ...TxOption) (*TxResponse, error) { resp, err := client.BroadcastTx(ctx, msgs, opts...) - if err != nil && resp != nil { - return &TxResponse{Code: resp.Code, TxHash: resp.TxHash}, fmt.Errorf("failed to broadcast tx: %v", err) - } else if err != nil { - return &TxResponse{}, fmt.Errorf("failed to broadcast tx: %v", err) + if err != nil { + return parseTxResponse(resp, fmt.Errorf("failed to broadcast tx: %v", err)) } return client.ConfirmTx(ctx, resp.TxHash) @@ -445,8 +440,7 @@ func (client *TxClient) ConfirmTx(ctx context.Context, txHash string) (*TxRespon if err == nil && resp != nil { switch resp.Status { - // FIXME: replace hardcoded status with constants - case "PENDING": + case core.TxStatusPending: // Continue polling if the transaction is still pending select { case <-ctx.Done(): @@ -454,18 +448,18 @@ func (client *TxClient) ConfirmTx(ctx context.Context, txHash string) (*TxRespon case <-pollTicker.C: continue } - case "COMMITTED": + case core.TxStatusCommitted: txResponse := &TxResponse{ Height: resp.Height, TxHash: txHash, Code: resp.ExecutionCode, } if resp.ExecutionCode != 0 { - return txResponse, fmt.Errorf("tx was included but failed with code %d: %s", resp.ExecutionCode, resp.Status) + return txResponse, fmt.Errorf("tx was committed but failed with code %d: %s", resp.ExecutionCode, resp.Error) } return txResponse, nil - case "EVICTED": - return &TxResponse{}, fmt.Errorf("tx: %s was evicted from the mempool", txHash) + case core.TxStatusEvicted: + return &TxResponse{TxHash: txHash}, fmt.Errorf("tx: %s was evicted from the mempool", txHash) default: return &TxResponse{}, fmt.Errorf("unknown tx: %s", txHash) } @@ -575,6 +569,13 @@ func (client *TxClient) getAccountNameFromMsgs(msgs []sdktypes.Msg) (string, err return record.Name, nil } +func parseTxResponse(resp *sdktypes.TxResponse, err error) (*TxResponse, error) { + if resp != nil { + return &TxResponse{Code: resp.Code, TxHash: resp.TxHash}, err + } + return &TxResponse{}, err +} + // Signer exposes the tx clients underlying signer func (client *TxClient) Signer() *Signer { return client.signer diff --git a/pkg/user/tx_client_test.go b/pkg/user/tx_client_test.go index 1dcfc16822..c416ba2d8e 100644 --- a/pkg/user/tx_client_test.go +++ b/pkg/user/tx_client_test.go @@ -19,6 +19,7 @@ import ( "github.com/celestiaorg/celestia-app/v3/pkg/user" "github.com/celestiaorg/celestia-app/v3/test/util/blobfactory" "github.com/celestiaorg/celestia-app/v3/test/util/testnode" + "github.com/cosmos/cosmos-sdk/x/authz" ) func TestTxClientTestSuite(t *testing.T) { @@ -47,8 +48,6 @@ func (suite *TxClientTestSuite) SetupSuite() { suite.Require().NoError(err) suite.txClient, err = user.SetupTxClient(suite.ctx.GoContext(), suite.ctx.Keyring, suite.ctx.GRPCClient, suite.encCfg, user.WithGasMultiplier(1.2)) suite.Require().NoError(err) - // FIXME: Temporary way of querying the raw log. - // TxStatus will natively support this in the future. suite.serviceClient = sdktx.NewServiceClient(suite.ctx.GRPCClient) } @@ -179,6 +178,16 @@ func (suite *TxClientTestSuite) TestConfirmTx() { require.Contains(t, err.Error(), "unknown tx: E32BD15CAF57AF15D17B0D63CF4E63A9835DD1CEBB059C335C79586BC3013728") }) + t.Run("should return error log when execution fails", func(t *testing.T) { + innerMsg := bank.NewMsgSend(testnode.RandomAddress().(sdk.AccAddress), testnode.RandomAddress().(sdk.AccAddress), sdk.NewCoins(sdk.NewInt64Coin(app.BondDenom, 10))) + msg := authz.NewMsgExec(suite.txClient.DefaultAddress(), []sdk.Msg{innerMsg}) + resp, err := suite.txClient.BroadcastTx(suite.ctx.GoContext(), []sdk.Msg{&msg}, fee, gas) + require.NoError(t, err) + _, err = suite.txClient.ConfirmTx(suite.ctx.GoContext(), resp.TxHash) + require.Error(t, err) + require.Contains(t, err.Error(), "authorization not found") + }) + t.Run("should success when tx is found immediately", func(t *testing.T) { addr := suite.txClient.DefaultAddress() msg := bank.NewMsgSend(addr, testnode.RandomAddress().(sdk.AccAddress), sdk.NewCoins(sdk.NewInt64Coin(app.BondDenom, 10))) diff --git a/proto/celestia/core/v1/tx/tx.proto b/proto/celestia/core/v1/tx/tx.proto index f4a8301606..0da698ad84 100644 --- a/proto/celestia/core/v1/tx/tx.proto +++ b/proto/celestia/core/v1/tx/tx.proto @@ -33,6 +33,8 @@ message TxStatusResponse { // and returns whether it was successful or errored. A non zero // execution code indicated an error. uint32 execution_code = 3; + // error log for failed transactions. + string error = 4; // status is the status of the transaction. - string status = 4; + string status = 5; } \ No newline at end of file diff --git a/test/interchain/go.mod b/test/interchain/go.mod index 8bdd1bf22d..bbcd6956b1 100644 --- a/test/interchain/go.mod +++ b/test/interchain/go.mod @@ -33,7 +33,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/celestiaorg/nmt v0.21.0 // indirect + github.com/celestiaorg/nmt v0.22.0 // indirect github.com/centrifuge/go-substrate-rpc-client/v4 v4.0.10 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect @@ -229,5 +229,5 @@ replace ( github.com/docker/docker => github.com/docker/docker v24.0.1+incompatible github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.38.0-tm-v0.34.29 + github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.40.0-tm-v0.34.29 ) diff --git a/test/interchain/go.sum b/test/interchain/go.sum index 3f306fe454..c24352cb35 100644 --- a/test/interchain/go.sum +++ b/test/interchain/go.sum @@ -249,12 +249,12 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOF github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= -github.com/celestiaorg/celestia-core v1.38.0-tm-v0.34.29 h1:HwbA4OegRvXX0aNchBA7Cmu+oIxnH7xRcOhISuDP0ak= -github.com/celestiaorg/celestia-core v1.38.0-tm-v0.34.29/go.mod h1:MyElURdWAOJkOp84WZnfEUJ+OLvTwOOHG2lbK9E8XRI= +github.com/celestiaorg/celestia-core v1.40.0-tm-v0.34.29 h1:J79TAjizxwIvm7/k+WI3PPH1aFj4AjOSjajoq5UzAwI= +github.com/celestiaorg/celestia-core v1.40.0-tm-v0.34.29/go.mod h1:5jJ5magtH7gQOwSYfS/m5fliIS7irKunLV7kLNaD8o0= github.com/celestiaorg/cosmos-sdk v1.24.0-sdk-v0.46.16 h1:AlBZS4WykzrwfcNbKD+yQQM1RTMz7lYDC1NS7ClAidM= github.com/celestiaorg/cosmos-sdk v1.24.0-sdk-v0.46.16/go.mod h1:Bpl1LSWiDpQumgOhhMTZBMopqa0j7fRasIhvTZB44P0= -github.com/celestiaorg/nmt v0.21.0 h1:81MBqxNn3orByoiCtdNVjwi5WsLgMkzHwP02ZMhTBHM= -github.com/celestiaorg/nmt v0.21.0/go.mod h1:ia/EpCk0enD5yO5frcxoNoFToz2Ghtk2i+blmCRjIY8= +github.com/celestiaorg/nmt v0.22.0 h1:AGtfmBiVgreR1KkIV5R7XFNeMp/H4IUDLlBbLjZZ3zk= +github.com/celestiaorg/nmt v0.22.0/go.mod h1:ia/EpCk0enD5yO5frcxoNoFToz2Ghtk2i+blmCRjIY8= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= diff --git a/x/blobstream/integration_test.go b/x/blobstream/integration_test.go index 9aaa91709d..c4a7b6d9a6 100644 --- a/x/blobstream/integration_test.go +++ b/x/blobstream/integration_test.go @@ -90,8 +90,6 @@ func (s *BlobstreamIntegrationSuite) TestBlobstream() { } else { require.Error(t, err) } - // FIXME: Temporary way of querying the raw log. - // TxStatus will natively support this in the future. serviceClient := sdktx.NewServiceClient(s.cctx.GRPCClient) getTxResp, err := serviceClient.GetTx(s.cctx.GoContext(), &sdktx.GetTxRequest{Hash: res.TxHash}) require.NoError(t, err) diff --git a/x/signal/legacy_test.go b/x/signal/legacy_test.go index 2516c66dc8..aa53038cec 100644 --- a/x/signal/legacy_test.go +++ b/x/signal/legacy_test.go @@ -14,7 +14,6 @@ import ( "github.com/celestiaorg/celestia-app/v3/test/util/testnode" "github.com/cosmos/cosmos-sdk/crypto/keyring" sdk "github.com/cosmos/cosmos-sdk/types" - sdktx "github.com/cosmos/cosmos-sdk/types/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" v1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -55,7 +54,6 @@ type LegacyUpgradeTestSuite struct { mut sync.Mutex accountCounter int - serviceClient sdktx.ServiceClient } // SetupSuite inits a standard chain, with the only exception being a @@ -93,9 +91,6 @@ func (s *LegacyUpgradeTestSuite) SetupSuite() { // Set the gov module address s.govModuleAddress = acc.GetAddress().String() - // FIXME: Temporary way of querying the raw log. - // TxStatus will natively support this in the future. - s.serviceClient = sdktx.NewServiceClient(s.cctx.GRPCClient) } func (s *LegacyUpgradeTestSuite) unusedAccount() string { @@ -189,10 +184,8 @@ func (s *LegacyUpgradeTestSuite) TestIBCUpgradeFailure() { defer cancel() res, err := txClient.SubmitTx(subCtx, []sdk.Msg{msg}, blobfactory.DefaultTxOpts()...) require.Error(t, err) - getTxResp, err := s.serviceClient.GetTx(subCtx, &sdktx.GetTxRequest{Hash: res.TxHash}) - require.NoError(t, err) - require.EqualValues(t, 9, res.Code, getTxResp.TxResponse.RawLog) // we're only submitting the tx, so we expect everything to work - assert.Contains(t, getTxResp.TxResponse.RawLog, "ibc upgrade proposal not supported") + require.EqualValues(t, 9, res.Code) // we're only submitting the tx, so we expect everything to work + assert.Contains(t, err.Error(), "ibc upgrade proposal not supported") } func getAddress(account string, kr keyring.Keyring) sdk.AccAddress {