Skip to content

Conversation

@itamarreif
Copy link
Contributor

@itamarreif itamarreif commented Oct 4, 2023

Summary

This adds handling for sequencer responses to transaction submission. Failures caused by invalid nonce reset the stored nonce and resubmit the transaction.

Background

See #293 and #307

Changes

  • Bundle submission to the sequencer is now implemented through a SubmitFut future
  • SubmitFut is a state machine that manages bundle submission, nonce refetching, and bundle resubmission as a state machine
  • If sequencer responds with an invalid nonce code to a bundle submission, SubmitFut will fetch a new nonce from the sequencer and resubmit the bundle under the new nonce.
  • Nonce fetch and bundle submission are retried using exponential backoff
  • AbciCode::from_cometbft added to convert from tendermint::abci::Code
  • Bundle submission runs under one tracing span
  • Tests are reworked in terms of startup_guards that are awaited to make sure the startup query guards are only matched in the beginning.

Testing

  • Failed transaction submission due to invalid nonce results in nonce being refetched and the transaction resubmitted.

Related Issues

Link any issues that are related, prefer full github links.

closes #293
closes #307

@itamarreif itamarreif self-assigned this Oct 4, 2023
@github-actions github-actions bot added the composer pertaining to composer label Oct 4, 2023
@itamarreif itamarreif added the bug Something isn't working label Oct 4, 2023
@itamarreif itamarreif marked this pull request as ready for review October 6, 2023 22:41
@itamarreif itamarreif force-pushed the itamarreif/composer-nonce-refetch branch from a784932 to 20c173e Compare October 20, 2023 04:41
@SuperFluffy
Copy link
Contributor

I pushed a change replacing the ping-pong in the select! loop with a typed future that goes between the states NotStarted -> WaitForSubmit <-> WaitForNonce. Rather than cloning around tracing spans I realized that it would be easiest to just have everything run under one future.

All of this was also necessary because expressing retries (using tryhard) was much easier by tucking everything into one future.

@SuperFluffy SuperFluffy requested a review from noot October 25, 2023 14:01
Copy link
Contributor

@noot noot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a few comments to address before merge!

@SuperFluffy
Copy link
Contributor

Addressed all comments. Waiting for the @itamarreif as the original author to give the ok to merge this.

The PR text should be updated before merge.

@itamarreif itamarreif merged commit 43ec06e into main Oct 26, 2023
@itamarreif itamarreif deleted the itamarreif/composer-nonce-refetch branch October 26, 2023 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working composer pertaining to composer proto pertaining to the Astria Protobuf spec sequencer pertaining to the astria-sequencer crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

composer: nonce management composer: refetch nonce on transaction failure due to invalid nonce

4 participants