Skip to content

Commit

Permalink
txm: Increase logging
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Feb 28, 2024
1 parent fb7fa08 commit b78003c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions relayer/pkg/chainlink/txm/txm.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ func (txm *starktxm) broadcast(ctx context.Context, publicKey *felt.Felt, accoun
simFlags := []starknetrpc.SimulationFlag{}
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()
}
txm.lggr.Errorw("failed to estimate fee", "error", err, "data", data)
return txhash, fmt.Errorf("failed to estimate fee: %+w", err)
}

Expand Down Expand Up @@ -245,6 +251,12 @@ func (txm *starktxm) broadcast(ctx context.Context, publicKey *felt.Felt, accoun
res, err := account.AddInvokeTransaction(execCtx, tx)
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()
}
txm.lggr.Errorw("failed to invoke tx", "error", err, "data", data)
return txhash, fmt.Errorf("failed to invoke tx: %+w", err)
}
// handle nil pointer
Expand Down

0 comments on commit b78003c

Please sign in to comment.