Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add error log to txstatus (backport #3788) #3789

Merged
merged 7 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/grpc/tx/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
99 changes: 76 additions & 23 deletions app/grpc/tx/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions app/test/big_blob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ func (s *BigBlobSuite) TestErrBlobsTooLarge() {
defer cancel()
res, err := txClient.SubmitPayForBlob(subCtx, []*blob.Blob{tc.blob}, user.SetGasLimitAndGasPrice(1e9, appconsts.DefaultMinGasPrice))
require.Error(t, err)
require.NotNil(t, res)
require.Equal(t, tc.want, res.Code, res.Logs)
require.Nil(t, res)
code := err.(*user.BroadcastTxError).Code
require.Equal(t, tc.want, code, err.Error())
})
}
}
6 changes: 5 additions & 1 deletion app/test/prepare_proposal_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
sdktx "github.com/cosmos/cosmos-sdk/types/tx"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -80,8 +81,11 @@ 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)
serviceClient := sdktx.NewServiceClient(cctx.GRPCClient)
getTxResp, err := serviceClient.GetTx(cctx.GoContext(), &sdktx.GetTxRequest{Hash: res.TxHash})
require.NoError(t, err)
require.NotNil(t, res)
assert.Equal(t, abci.CodeTypeOK, res.Code, res.RawLog)
assert.Equal(t, abci.CodeTypeOK, res.Code, getTxResp.TxResponse.RawLog)
})
}
}
6 changes: 5 additions & 1 deletion app/test/square_size_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/celestiaorg/celestia-app/v2/test/util/testnode"
blobtypes "github.com/celestiaorg/celestia-app/v2/x/blob/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdktx "github.com/cosmos/cosmos-sdk/types/tx"
v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
oldgov "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/cosmos/cosmos-sdk/x/params/types/proposal"
Expand Down Expand Up @@ -173,7 +174,10 @@ func (s *SquareSizeIntegrationTest) setBlockSizeParams(t *testing.T, squareSize,

res, err := txClient.SubmitTx(s.cctx.GoContext(), []sdk.Msg{msg}, blobfactory.DefaultTxOpts()...)
require.NoError(t, err)
require.Equal(t, res.Code, abci.CodeTypeOK, res.RawLog)
serviceClient := sdktx.NewServiceClient(s.cctx.GRPCClient)
getTxResp, err := serviceClient.GetTx(s.cctx.GoContext(), &sdktx.GetTxRequest{Hash: res.TxHash})
require.NoError(t, err)
require.Equal(t, res.Code, abci.CodeTypeOK, getTxResp.TxResponse.RawLog)

require.NoError(t, s.cctx.WaitForNextBlock())

Expand Down
14 changes: 12 additions & 2 deletions app/test/std_sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/testutil/mock"
sdk "github.com/cosmos/cosmos-sdk/types"
sdktx "github.com/cosmos/cosmos-sdk/types/tx"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
Expand Down Expand Up @@ -316,17 +317,26 @@ func (s *StandardSDKIntegrationTestSuite) TestStandardSDK() {
// sign and submit the transactions
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
serviceClient := sdktx.NewServiceClient(s.cctx.GRPCClient)
msgs, signer := tt.msgFunc()
txClient, err := user.SetupTxClient(s.cctx.GoContext(), s.cctx.Keyring, s.cctx.GRPCClient, s.ecfg, user.WithDefaultAccount(signer))
require.NoError(t, err)
res, err := txClient.SubmitTx(s.cctx.GoContext(), msgs, blobfactory.DefaultTxOpts()...)
if tt.expectedCode != abci.CodeTypeOK {
require.Error(t, err)
require.Nil(t, res)
txHash := err.(*user.ExecutionError).TxHash
code := err.(*user.ExecutionError).Code
getTxResp, err := serviceClient.GetTx(s.cctx.GoContext(), &sdktx.GetTxRequest{Hash: txHash})
require.NoError(t, err)
assert.Equal(t, tt.expectedCode, code, getTxResp.TxResponse.RawLog)
} else {
require.NoError(t, err)
require.NotNil(t, res)
getTxResp, err := serviceClient.GetTx(s.cctx.GoContext(), &sdktx.GetTxRequest{Hash: res.TxHash})
require.NoError(t, err)
assert.Equal(t, tt.expectedCode, res.Code, getTxResp.TxResponse.RawLog)
}
require.NotNil(t, res)
assert.Equal(t, tt.expectedCode, res.Code, res.RawLog)
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -255,5 +255,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
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,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 v1.1.0 h1:K4tBL5PCJwDtpBfyDxxZ3N962aC9VYb5/bw3LjagEtY=
Expand Down
Loading
Loading