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

chore(sequencer): avoid hashing proposal data in execution state #2044

Merged
merged 1 commit into from
Mar 19, 2025

Conversation

Fraser999
Copy link
Contributor

Summary

This changes the new ExecutionState in sequencer to not use hashed info, but rather keep the same information in an unhashed form.

Background

ExecutionState was recently introduced under time pressure to fix an issue. This PR fixes a few nitpicks in that code, as well as changing the approach to not use a fingerprint.

Encoding and hashing the data does not seem necessary since the sequencer only handles a single ExecutionState at any given time. The maximum size of the unhashed data will be roughly the same size as a block, and so there is no concern that this will cause resource issues.

Using unhashed data is significantly more performant. The results of quick benchmarking show that by avoiding encoding then hashing the data, performance for checking the execution state (calling check_if_prepared_proposal) improves by ~10x for empty blocks (no txs), ~50x for full blocks (1MB of txs) and ~10,000x for full blocks where the proposal data doesn't match the cached data.

The changes in this PR do not change the high-level logic around handling block execution - the state machine's states retain the same meaning and transition in the same way as before. This is only changing internal implementation details of the state machine.

Changes

  • replaced the fingerprint hash with CachedProposal
  • changed comments to doc comments where appropriate
  • reduced visibility of execution state types to pub(super)

Testing

Existing tests updated. No further tests required.

Changelogs

No updates required - this is essentially invisible to consumers.

Verified

This commit was signed with the committer’s verified signature.
Fraser999 Fraser Hutchison
@github-actions github-actions bot added the sequencer pertaining to the astria-sequencer crate label Mar 18, 2025
Copy link
Member

@joroshiba joroshiba left a comment

Choose a reason for hiding this comment

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

LGTM

@Fraser999 Fraser999 added this pull request to the merge queue Mar 19, 2025
Merged via the queue into main with commit 373b5c6 Mar 19, 2025
48 checks passed
@Fraser999 Fraser999 deleted the fraser/update-execution-state branch March 19, 2025 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sequencer pertaining to the astria-sequencer crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants