Skip to content

Conversation

@dylanlott
Copy link
Contributor

@dylanlott dylanlott commented Nov 5, 2025

feat: adds host simulation to block build

This PR adds host simulation to the block build loop.

Note: Requires the signet-sdk release of 0.13.0​ in order to pass CI.

  • bumps bin-base to 0.15.1
  • deprecates the BuilderHelper​ wrapper contract submission in favor of the raw Zenith​ contract
  • wires up the HostProvider​ into the Simulator for host transaction simulation

Copy link
Contributor Author

dylanlott commented Nov 5, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@dylanlott dylanlott force-pushed the dylan/host-simulation branch from 9b8137b to 40a2b56 Compare November 5, 2025 19:38
@dylanlott dylanlott force-pushed the dylan/remove-builder-helper branch from 59afcac to cf31bc9 Compare November 5, 2025 19:38
Copy link
Contributor

@anna-carroll anna-carroll left a comment

Choose a reason for hiding this comment

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

nits

@dylanlott dylanlott marked this pull request as ready for review November 7, 2025 18:12
@dylanlott dylanlott requested a review from Evalir as a code owner November 7, 2025 18:12
@dylanlott dylanlott requested a review from prestwich November 7, 2025 18:55
@dylanlott dylanlott changed the base branch from dylan/remove-builder-helper to graphite-base/167 November 7, 2025 18:56
@dylanlott dylanlott force-pushed the dylan/host-simulation branch from 84b510e to 6166fcb Compare November 7, 2025 18:56
@graphite-app graphite-app bot changed the base branch from graphite-base/167 to main November 7, 2025 18:57
@graphite-app
Copy link

graphite-app bot commented Nov 7, 2025

Merge activity

  • Nov 7, 6:57 PM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.
  • Nov 12, 7:14 PM UTC: @dylanlott merged this pull request with Graphite.

dylanlott and others added 24 commits November 11, 2025 14:21
- properly builds a cfg env and block env from prev host header
- makes max host gas a configurable property
- cleans up the build prep in the sim loop
* fix: move block env creation for host to sim task

* rename vars to clearly distinguish between rollup and host (#170)

* comment

---------

Co-authored-by: Anna Carroll <[email protected]>
Co-authored-by: Anna Carroll <[email protected]>
#[from_env(
var = "MAX_HOST_GAS_COEFFICIENT",
desc = "Optional maximum host gas coefficient, as a percentage, to use when building blocks",
default = 80
Copy link
Member

Choose a reason for hiding this comment

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

should we make this number a constant?

Copy link
Member

Choose a reason for hiding this comment

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

if this is a percentage, it should be f64, and explicitly capped to 99.9% (due to eth consensus rules on limit changes

/// Returns the maximum host gas to use for block building based on the configured max host gas coefficient.
pub fn max_host_gas(&self, gas_limit: u64) -> u64 {
// Set max host gas to a percentage of the host block gas limit
((gas_limit as u128 * (self.max_host_gas_coefficient.unwrap_or(80) as u128)) / 100u128)
Copy link
Member

Choose a reason for hiding this comment

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

ditto, this should be a constant so there's only 1 place that needs to change if we decide to change the coefficient

Copy link
Member

Choose a reason for hiding this comment

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

honestly, I think that this should not be configurable right now. instead of having this be a config struct prop, we could just make it a constant 80%. we can make it configurable later if we want to

Copy link
Member

Choose a reason for hiding this comment

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

yeah i'm happy with that, I think it's safer that way and makes other builders understand that changing this means you're running modified software

1740681556, // pecorino start timestamp as sane default
0, 1,
),
max_host_gas_coefficient: Some(80),
Copy link
Member

Choose a reason for hiding this comment

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

ditto

let host_block_opt = res_unwrap_or_continue!(
self.host_provider.get_block_by_number(host_block_number.into()).await,
span,
error!("error fetching previous host block - skipping block submission")
Copy link
Contributor

@anna-carroll anna-carroll Nov 12, 2025

Choose a reason for hiding this comment

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

would love someone to check my logic here:

it’s occurring to me that if the Builder is configured to use a Host RPC served by a different Node than is running the Rollup ExEx and serving the Rollup RPC, then they are more likely to be out of sync which would cause reliability issues in the Env task

in testnet this is impossible to configure incorrectly because there is only one Host RPC and it’s the exact same Node as is running the ExEx for the Rollup RPC, but in mainnet it would be easy to configure incorrectly

if i'm right we should document this configuration need for Builders.

Copy link
Contributor

Choose a reason for hiding this comment

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

also, possibly add some retry logic for the Host RPC call

@dylanlott dylanlott merged commit 14a7e35 into main Nov 12, 2025
6 checks passed
@dylanlott dylanlott deleted the dylan/host-simulation branch November 12, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants