-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(sequencer-relayer)!: minimize resubmissions to Celestia (#1234)
## Summary The relayer has been updated to avoid resubmitting the same data to Celestia on restart or on a timeout of the `BroadcastTx` gRPC. ## Background Currently the relayer will likely resubmit the same data when it restarts, since the majority of the time spent in the submit loop is waiting for confirmation of the `BlobTx` having been stored. While in this state, the on-disk files aren't updated to indicate that we're waiting for confirmation. Hence if we restart, the new session begins by submitting all data from the last-confirmed point, i.e. the same data which was already likely successfully submitted in the final attempt of the previous session. A similar situation happens if we timeout while waiting for the `BroadcastTx` response - the retry loop will attempt to resubmit the same data without first checking if the previous attempt succeeded. ## Changes * Replaced the two state files (presubmit and postsubmit) with a single one (submission-state) and similarly for their respective env vars. See [the updated spec](https://github.com/astriaorg/astria/blob/c110bdbf7d0fd05fba04775d07d046c37bbd7372/specs/sequencer-relayer.md#submission-state-file) for further details. * The `submission` module was heavily changed: there are now two primary state structs `StartedSubmission` and `PreparedSubmission`, between which the blob submitter toggles during normal operation. There is also `FreshSubmission` which is only relevant at startup, and an enum covering these three (`SubmissionStateAtStartup`) which is also only used during startup. Finally, the `State` enum is an ephemeral object only used to read/write the relevant state from/to disk. * `BlobSubmitter::run` was modified to try to confirm the last submission attempt from the previous session if the state file indicated the relayer exited while in `prepared` state. If that submission is confirmed (the most likely outcome), then the sequencer blocks in that submission are simply skipped in the write loop. (We could try to avoid even fetching these sequencer blocks, but that would be a significantly more pervasive change, and is probably not worth the complexity). * The relayer's celestia client was changed to split `try_submit` into `try_prepare` and `try_submit` so that the hash of the prepared `BlobTx` can be returned from `try_prepare` to be recorded in the state file before the transaction is broadcast to the Celestia app. * `submit_with_retry` was updated to check for a broadcast timeout error in the previous attempt, and in that case, attempts to just confirm that submission rather than automatically resubmitting the same data. ## Testing * Unit tests for the new `submission` types. * Black box test `later_height_in_state_leads_to_expected_relay` was updated. * Manually observed expected behaviour against a locally-running sequencer and Celestia app. ## Breaking Changelist * Removed `ASTRIA_SEQUENCER_RELAYER_PRE_SUBMIT_PATH` and `ASTRIA_SEQUENCER_RELAYER_POST_SUBMIT_PATH` config env vars. * Added `ASTRIA_SEQUENCER_RELAYER_SUBMISSION_STATE_PATH` config env var. ## Related Issues Closes #1200.
- Loading branch information
Showing
20 changed files
with
1,321 additions
and
739 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
dependencies: | ||
- name: sequencer-relayer | ||
repository: file://../sequencer-relayer | ||
version: 0.11.0 | ||
digest: sha256:70434f4e37c36660ff9b89258d4de6770f206712020bda7398a22772e8f74fa8 | ||
generated: "2024-07-19T12:21:51.250339+02:00" | ||
version: 0.11.1 | ||
digest: sha256:9c44f4901c4b89bbf6261f1a92bb18f71aef6d95e536aadc8a4a275a01eec25b | ||
generated: "2024-07-23T20:01:42.179395482+01:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.