Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bridge-withdrawer, cli, sequencer-client): migrate from broadcast_tx_commit to broadcast_tx_sync #1376

Merged
merged 10 commits into from
Sep 11, 2024

Conversation

ethanoroshiba
Copy link
Contributor

@ethanoroshiba ethanoroshiba commented Aug 16, 2024

Summary

Deleted all usage of broadcast_tx_commit and instead implemented broadcast_tx_sync.

Background

Previously, we relied on broadcast_tx_commit to submit transactions to the sequencer. CometBFT RPC docs warn against this and instead favor using broadcast_tx_sync.

Changes

  • Deleted all instances of broadcast_tx_commit, replacing with broadcast_tx_sync.
  • Added function wait_for_tx_inclusion() to probe the sequencer client for a new transaction of the given hash with backoff.

Testing

  • Added unit test to sequencer-client to ensure wait_for_tx_inclusion() works properly

Related Issues

closes #1283

@github-actions github-actions bot added the sequencer pertaining to the astria-sequencer crate label Aug 16, 2024
@github-actions github-actions bot added the ci issues that are related to ci and github workflows label Aug 20, 2024
@ethanoroshiba ethanoroshiba added sequencer-client cli pertaining to the cli bridge-withdrawer code touching the bridge-withdrawer service and removed sequencer pertaining to the astria-sequencer crate labels Aug 20, 2024
@github-actions github-actions bot added the sequencer pertaining to the astria-sequencer crate label Aug 20, 2024
@ethanoroshiba ethanoroshiba marked this pull request as ready for review August 20, 2024 19:21
@ethanoroshiba ethanoroshiba requested a review from a team as a code owner August 20, 2024 19:21
@ethanoroshiba ethanoroshiba requested a review from noot August 20, 2024 19:21
/// - If the transaction proof is missing.
#[allow(clippy::blocks_in_conditions)] // Allow: erroneous clippy warning. Should be fixed in Rust 1.81
#[instrument(skip_all, err)]
async fn wait_for_tx_inclusion(
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be worth considering following a similar approach to that taken in the sequencer-relayer for confirm_submission which is essentially doing the same thing, but targeting Celestia rather than a sequencer.

The main differences are:

  • it tries forever, hence the function doesn't return a Result
  • when the server sends a success response, but indicates the tx hash wasn't found, the retry interval stays at the minimum
  • because we can keep retrying fairly frequently, there's a logging strategy to avoid spamming the logs

If you decide to go that way, then bear in mind that the timing consts were chosen for a Celestia block time of 12 seconds, whereas the sequencer block times are closer to 2 seconds I believe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the tip! I changed the logic to reflect the function you sent over. The only differences are:

  • used millis instead of secs since the timeframe of this is much shorter
  • kept the result return value. If we get a response which has a non-ok error code or doesn't include proof of the tx's inclusion in the block, I think it would probably still be good to throw an error.

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like we're always returning Ok, so maybe the return type can be changed to just tendermint_rpc::endpoint::tx::Response?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we also have a wrapper function with a timeout, similar to the one you sent? Seems like it may be problematic to introduce code which will try forever unchecked instead of erroring out at some point.

ethanoroshiba and others added 4 commits August 27, 2024 15:47
Co-authored-by: noot <36753753+noot@users.noreply.github.com>
@ethanoroshiba ethanoroshiba requested a review from noot August 28, 2024 13:35
@ethanoroshiba ethanoroshiba added this pull request to the merge queue Sep 11, 2024
Merged via the queue into main with commit 64b9106 Sep 11, 2024
42 checks passed
@ethanoroshiba ethanoroshiba deleted the ENG-20/use_tx_sync branch September 11, 2024 13:40
steezeburger added a commit that referenced this pull request Sep 23, 2024
* main:
  feat(sequencer): make mempool balance aware (#1408)
  chore(sequencer): change test addresses to versions with known private keys (#1487)
  chore(chart): update geth tag (#1485)
  feat(sequencer): report deposit events (#1447)
  feat(proto, core, sequencer)!: add traceability to rollup deposits (#1410)
  fix(bridge-withdrawer, cli, sequencer-client): migrate from `broadcast_tx_commit` to `broadcast_tx_sync` (#1376)
  fix(sequencer): add `end_block` to `app_execute_transaction_with_every_action_snapshot` (#1455)
  release: end of iteration release cuts (#1456)
  chore(charts): rollupName templates (#1458)
  chore(sequencer-relayer): Add instrumentation (#1375)
  feat(proto, core, sequencer)!: permit bech32 compatible addresses (#1425)
  chore: memoize `address_bytes` of verification key (#1444)
  chore(ci): include `ibc-bridge-test` in `docker` CI target (#1438)
  chore(charts): bump celestia versions (#1431)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bridge-withdrawer code touching the bridge-withdrawer service ci issues that are related to ci and github workflows cli pertaining to the cli sequencer pertaining to the astria-sequencer crate sequencer-client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't use broadcast_tx_commit in bridge-withdrawer
3 participants