Skip to content

feat(cast): extend call block overrides#15745

Open
mattsse wants to merge 1 commit into
foundry-rs:masterfrom
mattsse:mattsse/cast-call-block-overrides
Open

feat(cast): extend call block overrides#15745
mattsse wants to merge 1 commit into
foundry-rs:masterfrom
mattsse:mattsse/cast-call-block-overrides

Conversation

@mattsse

@mattsse mattsse commented Jul 14, 2026

Copy link
Copy Markdown
Member

Adds block gas limit, fee recipient, base fee, and blob base fee options to cast call, applying them consistently to regular calls, remote debug traces, local traces, and generated curl requests. Outbound block overrides use the execution-client field names, and ordinary curl requests now retain supplied state and block overrides.

This change was developed with AI assistance.

Expose gas limit, fee recipient, base fee, and blob base fee overrides for cast call. Forward state and block overrides consistently through eth_call, debug_traceCall, local traces, and generated curl requests while using execution-client RPC field names.
);

/// Sets the blob gas price directly.
fn set_blob_gasprice(&mut self, _blob_gasprice: u128) {}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could TempoBlockEnv implement the new blob-gas-price setter instead of using the default no-op? With a Tempo test node, cast call --block.blob-base-fee 4660 returns 4660, while the same call with --trace returns 1. A Tempo parity test would catch this.

// execute with the configured environments in that case.
let call_env = preserve_block_base_fee.then(|| {
let mut evm_env = executor.evm_env().clone();
evm_env.cfg_env.disable_balance_check = true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could this call environment also disable REVM’s base-fee check? With --block.base-fee 100 --gas-price 2, the regular call succeeds and returns 100, while the same call with --trace fails with gas price is less than basefee. A regression test for this case would be useful.


let trace = match (tx_kind, call_env) {
(TxKind::Create, Some((evm_env, tx_env))) => {
let deploy_result = executor.deploy_with_env(evm_env, tx_env, None)?;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could this branch preserve traces from reverting constructors like the non-override path does? cast call --trace --create 0x60006000fd renders the CREATE/Revert trace, while adding --block.base-fee 0 exits with execution reverted without rendering it. Using TraceResult::try_from around deploy_with_env should retain the failed deployment trace, and a regression test for this case would be useful.

@grandizzy grandizzy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Request changes: The RPC paths look good, but local trace parity still has unresolved block-environment issues. In addition to the existing comments, --gas-limit overwrites --block.gas-limit; please preserve the block environment independently and add coverage for this combination.

Comment on lines +494 to +495
let preserve_block_base_fee =
block_overrides.as_ref().is_some_and(|overrides| overrides.base_fee.is_some());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could this env-preserving path also cover block gas-limit overrides? Otherwise transact_raw copies Executor.gas_limit into the block environment, so --gas-limit overwrites --block.gas-limit.

Suggested change
let preserve_block_base_fee =
block_overrides.as_ref().is_some_and(|overrides| overrides.base_fee.is_some());
let preserve_block_base_fee = block_overrides.as_ref().is_some_and(|overrides| {
overrides.base_fee.is_some() || overrides.gas_limit.is_some()
});

Please also add a regression test combining --block.gas-limit 100000 with --gas-limit 5000000 and asserting that GASLIMIT returns 100000.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants