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

feat: Trusted Builder Optimistic Simulation #1404

Draft
wants to merge 43 commits into
base: main
Choose a base branch
from

Conversation

bharath-123
Copy link
Contributor

@bharath-123 bharath-123 commented Aug 23, 2024

Summary

This PR adds support to optimistically simulate bundles in composer. At a high level, we receive sequence actions from process_proposal and simulate the bundle on top of the received sequence actions. This allows us to stay in sync with conductor and gives us more time to submit the simulated bundle.

Background

A Trusted Builder is a sophisticated rollup entity who is responsible for creating high value bundles. Composer is part of the trusted builder. The trusted builder's composer is responsible for simulating the bundle created by the builder and removing any invalid or reverting txs. To achieve this, we have made changes to the ExecuteBlock method/ to have a simulateOnly mode and to return txs that have been successfully included in a block.

More details on Trusted Builder are included in https://www.notion.so/astria-org/Trusted-Block-Builder-MVP-8eba7cd7cbd34e4e90a4adf726879028?pvs=4

One of the key issues, we have observed in the first iteration of trusted builder was that the time taken to simulation and then to submit the transaction was not enough to ensure that our simulated bundle is applied on the parent hash on top of which it was simulated.

To avoid this, we modify sequencer to push sequence actions which are being processed to the composer. We simulate the bundle on top of these sequence actions. We also modify sequencer to push the finalized block hash, we only submit the simulated bundle if this finalized block hash matches the block hash of the sequence actions submitted during process_proposal.

More details on the iterations are listed at: https://app.excalidraw.com/s/11QAdJyeldV/A3su0PdTwsU

Changes

  • Add a BundleBuilderPacket proto which is the artifact containing the simulated sequence actions and the parent hash on top of which we have simulated the sequence actions.
  • Add a SendOptimisticBlockRequest proto which contains the sequence actions sequencer pushes to composer during a process_proposal.
  • Add a SendFinalizedBlockHashRequest proto which contains the finalized block hash sequencer pushes to composer during finalize_block
  • A grpc client to interact with Execution API (This is copied from conductor)
  • Creating of the parent block(i.e the sequence actions received from sequencer in SendOptimisticBlockRequest) and simulation of bundle on top of the parent block hash.
  • Add logic in sequencer to push sequence actions in process_block to composer via the SendOptimisticBlockRequest request.
  • Add logic in sequence to push the finalized block hash in finalize_block to composer via SendFinalizedBlockHash request.

Testing

  • By deploying it locally and running spamooor against it.

Breaking Changelist

  • Bulleted list of breaking changes, any notes on migration. Delete section if none.

closes

@github-actions github-actions bot added conductor pertaining to the astria-conductor crate proto pertaining to the Astria Protobuf spec sequencer pertaining to the astria-sequencer crate composer pertaining to composer cd labels Aug 23, 2024
@bharath-123 bharath-123 added docker-build used to trigger docker builds on PRs evm pertains to EVM demo labels Aug 23, 2024
@quasystaty1 quasystaty1 added docker-build used to trigger docker builds on PRs and removed demo docker-build used to trigger docker builds on PRs labels Aug 23, 2024
@bharath-123 bharath-123 changed the base branch from main to bharath/composer-execution-api-integration August 23, 2024 19:14
@quasystaty1 quasystaty1 force-pushed the bharath/trusted-block-builder-next branch from 3e0bff5 to 5831d37 Compare August 23, 2024 21:17
@quasystaty1 quasystaty1 force-pushed the bharath/trusted-block-builder-next branch from 5831d37 to 20aa9ac Compare August 23, 2024 21:41
@quasystaty1 quasystaty1 removed the demo label Aug 26, 2024
@bharath-123 bharath-123 changed the title trusted block builder second iteration feat: Trusted Builder Optimistic Simulation Aug 27, 2024
@bharath-123 bharath-123 force-pushed the bharath/trusted-block-builder-next branch from 9d1e32a to 1b0e565 Compare August 29, 2024 16:40
@github-actions github-actions bot added ci issues that are related to ci and github workflows sequencer-relayer pertaining to the astria-sequencer-relayer crate labels Aug 29, 2024
@bharath-123 bharath-123 force-pushed the bharath/trusted-block-builder-next branch from fece56c to ab8e7e6 Compare September 2, 2024 17:01
@bharath-123 bharath-123 force-pushed the bharath/trusted-block-builder-next branch from 6ff8a57 to e54d895 Compare September 6, 2024 09:58
@bharath-123 bharath-123 changed the base branch from bharath/composer-execution-api-integration to main September 6, 2024 09:59
maxBytesPerBundle: 200000
maxBundleSize: 200000
Copy link
Contributor Author

Choose a reason for hiding this comment

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

maxBundleSize can be removed.

pub execution_api_url: String,

/// The maximum possible size of a bundle
pub max_bundle_size: usize,
Copy link
Contributor Author

@bharath-123 bharath-123 Sep 13, 2024

Choose a reason for hiding this comment

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

This is not necessary, we can just hard code this in the binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cd ci issues that are related to ci and github workflows composer pertaining to composer conductor pertaining to the astria-conductor crate demo docker-build used to trigger docker builds on PRs evm pertains to EVM proto pertaining to the Astria Protobuf spec sequencer pertaining to the astria-sequencer crate sequencer-relayer pertaining to the astria-sequencer-relayer crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants