Skip to content

Commit

Permalink
retry on estimation failure if nonce error
Browse files Browse the repository at this point in the history
  • Loading branch information
augustbleeds authored and cfal committed Mar 21, 2024
1 parent 840621d commit 664d04c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions relayer/pkg/chainlink/txm/txm.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ func (txm *starktxm) broadcastLoop() {
}

func (txm *starktxm) handleNonceErr(ctx context.Context, accountAddress *felt.Felt) error {

txm.lggr.Debugw("Handling Nonce Validation Error By Resubmitting Txs...", "account", accountAddress)

// resync nonce so that new queued txs can be unblocked
client, err := txm.client.Get()
if err != nil {
Expand Down Expand Up @@ -294,7 +297,7 @@ func (txm *starktxm) broadcast(ctx context.Context, publicKey *felt.Felt, accoun
if errors.As(err, &dataErr) {
data = dataErr.ErrorData()
}
txm.lggr.Errorw("failed to invoke tx", "error", err, "data", data)
txm.lggr.Errorw("failed to invoke tx from address", accountAddress, "error", err, "data", data)
return txhash, fmt.Errorf("failed to invoke tx: %+w", err)
}
// handle nil pointer
Expand Down Expand Up @@ -342,7 +345,7 @@ func (txm *starktxm) confirmLoop() {
}
response, err := client.Provider.GetTransactionStatus(ctx, f)

// tx can be rejected due to a nonce error. but we cannot know from the Starknet RPC :/ , so we have to wait for
// tx can be rejected due to a nonce error. but we cannot know from the Starknet RPC directly so we have to wait for
// a broadcasted tx to fail in order to fix the nonce errors

if err != nil {
Expand Down

0 comments on commit 664d04c

Please sign in to comment.