8000 feat: passes sim result to the submit tasks by dylanlott · Pull Request #100 · init4tech/builder · GitHub
[go: up one dir, main page]

Skip to content

feat: passes sim result to the submit tasks #100

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

Open
wants to merge 7 commits into
base: prestwich/simrevert
Choose a base branch
from

Conversation

dylanlott
Copy link
Contributor
@dylanlott dylanlott commented Jun 4, 2025

feat: Passes SimResult to the submit task

Closes ENG-1046

This PR adds a SimResult type that wraps a BuiltBlock and a BlockEnv together and sends them both to the SubmitTask so that a block's environment is known at submission time for gas calculation purposes.

  • Adds a SimResult type that binds a BlockEnv to a BuiltBlock
  • Passes that SimResult to the SubmitTask for gas calculation purposes
  • Adds some misc. logging and cleanup

Bugfixes

  • Takes cache reference and calculates simulation deadline after the block environment has changed, since that ticks along the loop

Copy link
Contributor Author
dylanlott commented Jun 4, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

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

@dylanlott dylanlott mentioned this pull request Jun 4, 2025
@dylanlott dylanlott force-pushed the dylan/block-env-refactor branch from 4961bf7 to df3f9a2 Compare June 4, 2025 02:31
@dylanlott dylanlott changed the base branch from dylan/submit-channel-refactors to dylan/add-host-fills June 4, 2025 02:31
@dylanlott dylanlott self-assigned this Jun 4, 2025
@dylanlott dylanlott added the enhancement New feature or request label Jun 4, 2025 — with Graphite App
@dylanlott dylanlott force-pushed the dylan/add-host-fills branch 2 times, most recently from f5c2178 to a873d45 Compare June 4, 2025 17:42
@dylanlott dylanlott force-pushed the dylan/block-env-refactor branch from 95a207e to 9a95da4 Compare June 4, 2025 17:42
@dylanlott dylanlott changed the base branch from dylan/add-host-fills to graphite-base/100 June 4, 2025 17:54
@dylanlott dylanlott force-pushed the graphite-base/100 branch from a873d45 to 1fc9892 Compare June 4, 2025 17:55
@dylanlott dylanlott force-pushed the dylan/block-env-refactor branch from 9a95da4 to c2cd1ab Compare June 4, 2025 17:55
@graphite-app graphite-app bot changed the base branch from graphite-base/100 to main June 4, 2025 17:55
@dylanlott dylanlott force-pushed the dylan/block-env-refactor branch 2 times, most recently from 75b8d71 to 41019b6 Compare June 4, 2025 18:13
@dylanlott dylanlott changed the base branch from main to dylan/chore-deps-sdk-main June 4, 2025 18:13
@dylanlott dylanlott force-pushed the dylan/chore-deps-sdk-main branch from acf2569 to 2234717 Compare June 4, 2025 19:35
@dylanlott dylanlott force-pushed the dylan/block-env-refactor branch 2 times, most recently from 501d86e to 92b1dde Compare June 4, 2025 19:46
@dylanlott dylanlott changed the base branch from dylan/chore-deps-sdk-main to prestwich/simrevert June 4, 2025 19:46
@dylanlott dylanlott force-pushed the prestwich/simrevert branch from 2c09604 to a96a88f Compare June 4, 2025 22:53
@dylanlott dylanlott force-pushed the dylan/block-env-refactor branch from 92b1dde to b69451e Compare June 4, 2025 22:53
@dylanlott dylanlott force-pushed the prestwich/simrevert branch from a96a88f to aee1dd3 Compare June 6, 2025 22:08
@dylanlott dylanlott force-pushed the dylan/block-env-refactor branch from b69451e to 0f48d3e Compare June 6, 2025 22:08
@dylanlott dylanlott force-pushed the prestwich/simrevert branch from aee1dd3 to da4a7fd Compare June 6, 2025 22:10
@dylanlott dylanlott force-pushed the < 8000 span > dylan/block-env-refactor branch 2 times, most recently from 3432017 to 6fd3675 Compare June 6, 2025 22:13
@dylanlott dylanlott changed the title passes sim result to the submit tasks feat: passes sim result to the submit tasks Jun 10, 2025
- adds a SimResult type that binds a BlockEnv to a BuiltBlock
- passess that SimResult to the SubmitTask for gas calculations
@dylanlott dylanlott force-pushed the dylan/block-env-refactor branch from 54b51a6 to 3e2c5fa Compare June 10, 2025 03:14
@dylanlott dylanlott marked this pull request as ready for review June 10, 2025 04:05
let mine_time = dispatch_start_time.elapsed().as_secs();
let hash = receipt.transaction_hash.to_string();
Copy link
Member

Choose a reason for hiding this comment

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

nit: better not to bind the var. can just inline it on the trace

debug!(
    success = receipt.status(), 
    hash = %receipt.transaction_hash,
    mine_time, hash, 
    "transaction mined"
);

debug!(block_number = ?built_block.block_number(), "finished building block");
debug!(
tx_count = built_block.tx_count(),
block_number = ?built_block.block_number(),
Copy link
Member

Choose a reason for hiding this comment

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

i know this is preserved from earlier, but i think the ? is unnecessary here?


let env = self.construct_block_env(&previous);
debug!(?env, "constructed block env");
debug!(block_number = ?env.number, env.basefee, "constructed latest block env");
Copy link
Member

Choose a reason for hiding this comment

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

thing the ? is unnecessary as number is a number

pub const BASE_MAX_PRIORITY_FEE_PER_GAS: u128 = 2 * GWEI_TO_WEI as u128;
/// Base maximum fee per blob gas to use as a starting point for retry bumps
pub const BASE_MAX_FEE_PER_BLOB_GAS: u128 = GWEI_TO_WEI as u128;
use super::block::sim::SimResult;
Copy link
Member

Choose a reason for hiding this comment

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

nit: we tend use to fully qualified crate:: paths instead of super

6D40
fn calculate_gas(retry_count: usize, block_env: &BlockEnv) -> (u128, u128, u128) {
let fallback_blob_basefee = 500;

match block_env.blob_excess_gas_and_price {
Copy link
Member
@prestwich prestwich Jun 10, 2025

Choose a reason for hiding this comment

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

the block_env here is the Signet block env, not the host block env, no? it's constructed in EnvTask::construct_block_env and the blob excess gas and price will always be Some(0, 0).

using it to calculate the fee for the host transaction is a bug, as it contains no info about the host

Copy link
Member
@prestwich prestwich Jun 10, 2025

Choose a reason for hiding this comment

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

if you want the host blob gas (which is i think what you're looking for here) you'll need to make the env task's watch channel contain that alongside the constructed BlockEnv by maybe a

struct SimEnv {
    signet: BlockEnv,
    host: alloy::consensus::Header,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0