Skip to content

Commit

Permalink
output raw error data in error logs even if revert reason isn't avail…
Browse files Browse the repository at this point in the history
…able

Signed-off-by: Masanori Yoshida <[email protected]>
  • Loading branch information
siburu committed May 23, 2024
1 parent 5152347 commit f0ac44f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/relay/ethereum/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ func (c *Chain) SendMsgs(msgs []sdk.Msg) ([]core.MsgID, error) {
if err != nil {
var revertReason, rawErrorData string
if reason, data, err := c.getRevertReasonFromEstimateGas(err); err != nil {
// Raw error data may be available even if revert reason isn't available.
rawErrorData = hex.EncodeToString(data)
logger.Error("failed to get revert reason", err,
logAttrRawErrorData, rawErrorData,
logAttrMsgIndex, i,
logAttrRawTxData, rawTxData,
)
Expand Down Expand Up @@ -119,7 +122,10 @@ func (c *Chain) SendMsgs(msgs []sdk.Msg) ([]core.MsgID, error) {
if receipt.Status == gethtypes.ReceiptStatusFailed {
var revertReason, rawErrorData string
if reason, data, err := c.getRevertReasonFromReceipt(ctx, receipt); err != nil {
// Raw error data may be available even if revert reason isn't available.
rawErrorData = hex.EncodeToString(data)
logger.Error("failed to get revert reason", err,
logAttrRawErrorData, rawErrorData,
logAttrMsgIndex, i,
logAttrTxHash, tx.Hash(),
logAttrRawTxData, rawTxData,
Expand Down

0 comments on commit f0ac44f

Please sign in to comment.