Skip to content

Commit

Permalink
Improve error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Feb 29, 2024
1 parent 491bcdd commit 03c4528
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions relayer/pkg/chainlink/txm/txm.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-common/pkg/utils"

ethrpc "github.com/ethereum/go-ethereum/rpc"
"github.com/smartcontractkit/chainlink-starknet/relayer/pkg/starknet"
)

Expand Down Expand Up @@ -199,12 +200,11 @@ func (txm *starktxm) broadcast(ctx context.Context, publicKey *felt.Felt, accoun
feeEstimate, err := account.EstimateFee(ctx, []starknetrpc.BroadcastTxn{tx}, simFlags, starknetrpc.BlockID{Tag: "latest"})
if err != nil {
var data any
var rpcError *starknetrpc.RPCError
if errors.As(err, &rpcError) {
data = rpcError.Data()
if err, ok := err.(ethrpc.DataError); ok {
data = err.ErrorData()
}
txm.lggr.Errorw("failed to estimate fee", "error", err, "data", data)
return txhash, fmt.Errorf("failed to estimate fee: %+w", err)
return txhash, fmt.Errorf("failed to estimate fee: %T %+w", err, err)
}

txm.lggr.Infow("Account", "account", account.AccountAddress)
Expand Down Expand Up @@ -252,9 +252,8 @@ func (txm *starktxm) broadcast(ctx context.Context, publicKey *felt.Felt, accoun
if err != nil {
// TODO: handle initial broadcast errors - what kind of errors occur?
var data any
var rpcError *starknetrpc.RPCError
if errors.As(err, &rpcError) {
data = rpcError.Data()
if err, ok := err.(ethrpc.DataError); ok {
data = err.ErrorData()
}
txm.lggr.Errorw("failed to invoke tx", "error", err, "data", data)
return txhash, fmt.Errorf("failed to invoke tx: %+w", err)
Expand Down

0 comments on commit 03c4528

Please sign in to comment.