feat(simulation): in-process meter_bundle on mempool (5/n) - #4606
Conversation
Extract meter_parsed_bundle / meter_transaction from the RPC handler so workers can sim without a JSON-RPC hop. --enable-inline-simulation now turns on MeteringExtension so mempool nodes can call meter_bundle before the worker path exists. Co-authored-by: Cursor <cursoragent@cursor.com>
Inline simulation should not expose base_meterBundle on mempool nodes. Restore InvalidParams for missing-block L1 info errors instead of collapsing them to InternalError. Co-authored-by: Cursor <cursoragent@cursor.com>
Review SummaryPR: feat(simulation): in-process meter_bundle on mempool (5/n) This PR extracts the metering logic from the RPC handler into reusable in-process methods ( Block Production SensitivityThis PR touches metering paths but the changes are on the read-only simulation side, not in the payload assembly/finalization critical path. The FindingsNo new findings beyond the two inline comments already posted:
Notes
|
|
Caution This PR may regress performance. 1 benchmark(s) slower by more than 10% beyond the noise band: Benchmark results (advisory)Median time on the PR head versus the base branch, measured on the same host. Wall-clock, so a change is only flagged when it clears ±10% and the confidence intervals do not overlap. Only benchmarks past the ±10% threshold (plus new or dropped ones) are listed. This check never blocks a merge.
47 benchmark(s) within ±10% omitted. |
Motivation
Sim workers need to call
meter_bundleon the mempool process without a JSON-RPC hop. Today that logic only lives insidebase_meterBundle.Changes
MeteringApiImpl::meter_parsed_bundle/meter_transactionas the in-process APIParsedBundle::from_recoveredfor a single recovered tx--enable-inline-simulationenablesMeteringExtensioneven without--enable-meteringbase_meterBundlenow wraps the extracted methodeth_sendRawTransactionstill usesadd_transactionStacked on #4602.
Tests
from_recovered_wraps_a_single_transactioninline_simulation_enables_metering_without_enable_metering_flagforwarding_without_inline_simulation_leaves_metering_disabledin_process_meter_transaction_uses_mempool_statemeter_transactionon harness state returns 21000 gas + execution timeMade with Cursor