From 62af7efec0d01933eefb7288c753d6dfa0bb33f9 Mon Sep 17 00:00:00 2001 From: Einar Rasmussen Date: Mon, 12 Oct 2026 08:57:07 -0700 Subject: [PATCH 1/3] op-reth: count every post-exec rejection on the payload-builder path The Engine API newPayload preflight and block import count SDM post-exec structural rejections, but the forkchoiceUpdated-with-transactions path validated the same 0x7D rules and rejected without a log line or a metric, so the P1 post-exec alert could not see a CL/EL disagreement that surfaced only as a failed getPayload. OpPayloadBuilderAttributes::from_rpc_attrs now runs the encoded-transaction preflight through the shared sdm_metrics counters before decoding, and the builder's parse of the decoded attributes reports the activation and anchor rules the preflight cannot check through the same block-keyed report. The payload crate depends on the evm crate with std, which the counters need, and check-no-std gains a host-target no_std check of the evm crate. Counting is per conversion: op-reth's payload job converts on every build attempt and premium's generator once per job, so a persistent rejection keeps the series moving for as long as the attempts continue. Co-Authored-By: Claude Fable 5.1 --- rust/justfile | 13 ++- rust/op-reth/crates/evm/src/lib.rs | 19 +++- rust/op-reth/crates/evm/src/sdm_metrics.rs | 75 ++++++++++--- rust/op-reth/crates/payload/Cargo.toml | 2 +- rust/op-reth/crates/payload/src/builder.rs | 8 +- .../crates/payload/src/builder/tests.rs | 66 +++++++++++ rust/op-reth/crates/payload/src/payload.rs | 104 ++++++++++++++---- .../op-reth/crates/payload/src/sdm_metrics.rs | 24 ++++ 8 files changed, 270 insertions(+), 41 deletions(-) diff --git a/rust/justfile b/rust/justfile index 1032d986d2c..bd3a2cc9c51 100644 --- a/rust/justfile +++ b/rust/justfile @@ -399,7 +399,8 @@ rust-review base='': ############################ no_std ################################# -# Check no_std compatibility for proof, protocol, alloy, and op-alloy crates +# Check no_std compatibility for proof, protocol, alloy, and op-alloy crates, plus the host-target +# no_std build of op-reth's evm crate, whose reth dependencies do not build for riscv. check-no-std: #!/usr/bin/env bash set -euo pipefail @@ -444,6 +445,16 @@ check-no-std: echo "Successfully checked no_std build for: $package" done + host_no_std_packages=( + reth-optimism-evm + ) + + for package in "${host_no_std_packages[@]}"; do + echo "Checking host-target no_std build for: $package" + cargo check -p "$package" --no-default-features + echo "Successfully checked host-target no_std build for: $package" + done + ########################### Benchmarks ############################## # Run benchmarks (compile only) diff --git a/rust/op-reth/crates/evm/src/lib.rs b/rust/op-reth/crates/evm/src/lib.rs index 7980ad02497..b05200fb2aa 100644 --- a/rust/op-reth/crates/evm/src/lib.rs +++ b/rust/op-reth/crates/evm/src/lib.rs @@ -18,10 +18,11 @@ use alloy_op_evm::{ block::{OpTxEnv, receipt_builder::OpReceiptBuilder}, evm_env_for_op_block, evm_env_for_op_next_block, }; +use alloy_primitives::B256; use core::fmt::Debug; use op_alloy_consensus::{ - EIP1559ParamError, OpTransaction as OpConsensusTransaction, - parse_post_exec_payload_from_transactions, + EIP1559ParamError, OpTransaction as OpConsensusTransaction, PostExecPayloadValidationError, + parse_post_exec_payload_from_transactions, validate_post_exec_entry_count, }; use op_revm::OpSpecId; use reth_chainspec::EthChainSpec; @@ -45,7 +46,6 @@ use { #[cfg(feature = "std")] use { alloy_op_evm::evm_env_for_op_payload, - op_alloy_consensus::{PostExecPayloadValidationError, validate_post_exec_entry_count}, reth_evm::{ConfigureEngineEvm, ExecutableTxIterator}, }; @@ -80,6 +80,7 @@ mod post_exec_ext; pub use post_exec_ext::*; mod sdm_metrics; +pub use sdm_metrics::report_post_exec_validation_failure; /// Optimism-related EVM configuration. #[derive(Debug)] @@ -189,6 +190,18 @@ pub(crate) fn preflight_post_exec_payload( }) } +/// Runs the encoded-transaction preflight for payload-builder attributes +/// (`forkchoiceUpdated` with transactions); a rejection is logged against the parent block hash +/// and counted under the failed rule and as a failed validation. +pub fn validate_post_exec_attributes( + transactions: &[Bytes], + parent_hash: B256, +) -> Result<(), PostExecPayloadValidationError> { + validate_post_exec_entry_count(transactions).inspect_err(|error| { + sdm_metrics::report_post_exec_attributes_rejection(parent_hash, *error); + }) +} + impl OpEvmConfig where ChainSpec: OpHardforks, diff --git a/rust/op-reth/crates/evm/src/sdm_metrics.rs b/rust/op-reth/crates/evm/src/sdm_metrics.rs index cf28491b4c5..2fde4d4a811 100644 --- a/rust/op-reth/crates/evm/src/sdm_metrics.rs +++ b/rust/op-reth/crates/evm/src/sdm_metrics.rs @@ -4,7 +4,11 @@ //! dashboard can show SDM validation activity rather than inferring it from generic block //! validation. //! -//! Recorded from the execution-context builders and the Engine API payload preflight. Beyond +//! Recorded from the execution-context builders, the Engine API payload preflight, and the +//! payload-builder attributes preflight. Attributes count once per conversion into builder +//! attributes: a builder that re-converts on every build attempt counts attempts, so a +//! persistent rejection keeps the series moving for as long as the attempts continue, and a +//! replay of attributes through the debug RPC namespace counts like an engine delivery. Beyond //! live import, several paths re-execute stored canonical blocks that already passed this check: //! RPC replays, the proofs ExEx's periodic re-execution, and pipeline or backfill sync. //! Re-execution cannot inflate the failure counters, but every pass recounts `ok` — on a @@ -88,9 +92,9 @@ pub(crate) fn report_post_exec_validation_ok() { result_counter(RESULT_OK).increment(1); } -/// Logs a block rejected for its post-exec transaction and, with `std`, counts it under the -/// failed rule and as a failed validation. -pub(crate) fn report_post_exec_validation_failure( +/// Logs a block rejected for its post-exec transaction, whether imported or being built, and +/// with `std` counts it under the failed rule and as a failed validation. +pub fn report_post_exec_validation_failure( block_number: u64, error: PostExecPayloadValidationError, ) { @@ -101,11 +105,34 @@ pub(crate) fn report_post_exec_validation_failure( %error, "block rejected: post-exec transaction failed structural validation" ); + count_post_exec_failure(reason); +} + +/// Counts one failed validation under its rule; a no-op without `std`. +fn count_post_exec_failure(reason: &'static str) { #[cfg(feature = "std")] { failure_counter(reason).increment(1); result_counter(RESULT_FAIL).increment(1); } + #[cfg(not(feature = "std"))] + let _ = reason; +} + +/// Logs payload-builder attributes rejected for their post-exec transaction and counts the +/// rejection like [`report_post_exec_validation_failure`], attributed to the parent block hash. +pub(crate) fn report_post_exec_attributes_rejection( + parent_hash: alloy_primitives::B256, + error: PostExecPayloadValidationError, +) { + let reason = error.as_reason(); + tracing::warn!( + %parent_hash, + reason, + %error, + "payload attributes rejected: post-exec transaction failed structural validation" + ); + count_post_exec_failure(reason); } #[cfg(all(test, feature = "std"))] @@ -244,13 +271,29 @@ mod tests { assert_results(&exposition, /* ok */ 0.0, /* fail */ 1.0); } - /// Drives the Engine API preflight helper with raw encoded transactions against a recorder - /// private to the test, returning the result alongside the rendered exposition. - fn preflight(transactions: Vec) -> (Result<(), ()>, String) { + /// The two encoded-transaction preflights, which share one set of counters. + #[derive(Clone, Copy, Debug)] + enum Preflight { + EngineApi, + Attributes, + } + + /// Drives one preflight with raw encoded transactions against a recorder private to the + /// test, returning the result alongside the rendered exposition. + fn preflight( + entry: Preflight, + transactions: Vec, + ) -> (Result<(), ()>, String) { let (recorder, handle) = recorder(); let result = with_local_recorder(&recorder, || { super::register_sdm_metrics_at_zero(); - crate::preflight_post_exec_payload(&transactions, BLOCK) + match entry { + Preflight::EngineApi => crate::preflight_post_exec_payload(&transactions, BLOCK), + Preflight::Attributes => crate::validate_post_exec_attributes( + &transactions, + alloy_primitives::B256::ZERO, + ), + } }); (result.map_err(drop), handle.render()) } @@ -287,13 +330,14 @@ mod tests { #[case::too_many_entries(vec![filler(), encoded_post_exec(2)], "too_many_gas_refund_entries")] #[case::malformed(vec![bare_post_exec()], "malformed_post_exec_payload")] #[case::unsupported_version(vec![filler(), versioned_post_exec(2)], "unsupported_post_exec_payload_version")] - fn rejected_payload_counts_on_the_engine_api_path( + fn rejected_transactions_count_at_every_preflight( + #[values(Preflight::EngineApi, Preflight::Attributes)] entry: Preflight, #[case] transactions: Vec, #[case] reason: &str, ) { - let (result, exposition) = preflight(transactions); + let (result, exposition) = preflight(entry, transactions); - assert!(result.is_err(), "preflight rejects"); + assert!(result.is_err(), "{entry:?} preflight rejects"); assert_failures(&exposition, Some(reason)); assert_results(&exposition, /* ok */ 0.0, /* fail */ 1.0); } @@ -323,17 +367,18 @@ mod tests { assert_results(&exposition, /* ok */ 0.0, /* fail */ 1.0); } - /// The preflight does not count `ok`: a pass is not yet a validated post-exec transaction — + /// A preflight does not count `ok`: a pass is not yet a validated post-exec transaction — /// the parse on the decoded transactions counts that. #[rstest] #[case::with_post_exec(vec![filler(), encoded_post_exec(1)])] #[case::without_post_exec(vec![filler()])] - fn accepted_payload_counts_nothing_at_preflight( + fn accepted_transactions_count_nothing_at_any_preflight( + #[values(Preflight::EngineApi, Preflight::Attributes)] entry: Preflight, #[case] transactions: Vec, ) { - let (result, exposition) = preflight(transactions); + let (result, exposition) = preflight(entry, transactions); - assert!(result.is_ok(), "preflight passes"); + assert!(result.is_ok(), "{entry:?} preflight passes"); assert_failures(&exposition, None); assert_results(&exposition, /* ok */ 0.0, /* fail */ 0.0); } diff --git a/rust/op-reth/crates/payload/Cargo.toml b/rust/op-reth/crates/payload/Cargo.toml index 973e0658a26..e18c1536e90 100644 --- a/rust/op-reth/crates/payload/Cargo.toml +++ b/rust/op-reth/crates/payload/Cargo.toml @@ -28,7 +28,7 @@ reth-payload-validator.workspace = true reth-metrics.workspace = true # op-reth -reth-optimism-evm.workspace = true +reth-optimism-evm = { workspace = true, features = ["std"] } reth-optimism-forks.workspace = true reth-optimism-primitives = { workspace = true, features = ["reth-codec"] } reth-optimism-txpool.workspace = true diff --git a/rust/op-reth/crates/payload/src/builder.rs b/rust/op-reth/crates/payload/src/builder.rs index 7522d964722..3338ee0d3f6 100644 --- a/rust/op-reth/crates/payload/src/builder.rs +++ b/rust/op-reth/crates/payload/src/builder.rs @@ -380,6 +380,9 @@ where /// Converts `BuildArguments` from [`OpPayloadAttrs`](crate::payload::OpPayloadAttrs) to /// [`OpPayloadBuilderAttributes`], decoding the RPC transaction bytes into typed transactions. +/// +/// Runs once per build attempt, so a post-exec transaction the conversion rejects is logged and +/// counted per attempt rather than once per attributes set. fn convert_build_args( args: BuildArguments>, ) -> Result< @@ -884,7 +887,7 @@ where /// /// Returns `Ok(None)` when no such tx is present; errors if the embedded payload is /// structurally invalid (present before SDM activation, duplicated, not last, or anchored - /// to the wrong block number). + /// to the wrong block number), logging and counting the rejection under its failed rule. fn parse_embedded_post_exec( &self, ) -> Result, PayloadBuilderError> { @@ -898,6 +901,9 @@ where next_block_number, sdm_active, ) + .inspect_err(|error| { + reth_optimism_evm::report_post_exec_validation_failure(next_block_number, *error); + }) .map_err(PayloadBuilderError::other) } diff --git a/rust/op-reth/crates/payload/src/builder/tests.rs b/rust/op-reth/crates/payload/src/builder/tests.rs index 1e32e8c398a..26a85cb04ee 100644 --- a/rust/op-reth/crates/payload/src/builder/tests.rs +++ b/rust/op-reth/crates/payload/src/builder/tests.rs @@ -36,6 +36,7 @@ use reth_payload_util::PayloadTransactionsFixed; use reth_primitives_traits::{Account, InMemorySize, SealedHeader}; use reth_revm::{database::StateProviderDatabase, db::State, test_utils::StateProviderTest}; use reth_transaction_pool::PoolTransaction; +use rstest::rstest; use std::{borrow::Cow, cell::Cell, sync::Arc}; fn entries(specs: &[(u64, u64)]) -> Vec { @@ -988,3 +989,68 @@ fn execute_best_transactions_excludes_interop_txs_when_failsafe_active() { failsafe.set(false); assert_eq!(build(&failsafe), vec![normal_hash, interop_hash]); } + +/// Builds a ctx rebuilding a derived block whose embedded `0x7D` tx anchors to +/// `post_exec_anchor`. The parent is block 0, so block 1 is the only valid anchor, and Lagoon is +/// either active from genesis or not at all. +fn derived_ctx( + lagoon_active: bool, + post_exec_anchor: u64, +) -> OpPayloadBuilderCtx< + OpEvmConfig, + OpChainSpec, + OpPayloadBuilderAttributes, +> { + let spec = OpChainSpecBuilder::optimism_mainnet(); + let spec = if lagoon_active { spec.lagoon_activated() } else { spec }; + let chain_spec = Arc::new(spec.build()); + let parent = SealedHeader::seal_slow(Header { number: 0, timestamp: 0, ..Default::default() }); + let attributes = OpPayloadBuilderAttributes { + no_tx_pool: true, + timestamp: 1, + transactions: vec![ + deposit_with_encoded(), + post_exec_with_encoded(post_exec_anchor, entries(&[(0, 1)])), + ], + ..Default::default() + }; + + OpPayloadBuilderCtx { + evm_config: OpEvmConfig::optimism(chain_spec.clone()), + builder_config: OpBuilderConfig::default(), + chain_spec, + config: PayloadConfig { + parent_header: Arc::new(parent), + parent_block_info: None, + payload_id: attributes.id, + attributes, + }, + cancel: Default::default(), + best_payload: None, + } +} + +/// The rules the encoded-transaction preflight cannot check — activation and the anchor — are +/// applied when the builder parses the decoded attributes, and a rejection there reaches the +/// same counters. +#[rstest] +#[case::wrong_anchor(/* lagoon_active */ true, /* post_exec_anchor */ 2, "block_number_mismatch")] +#[case::before_activation(/* lagoon_active */ false, /* post_exec_anchor */ 1, "unexpected_post_exec_tx")] +fn rejected_embedded_post_exec_counts_under_the_failed_rule( + #[case] lagoon_active: bool, + #[case] post_exec_anchor: u64, + #[case] reason: &str, +) { + use crate::sdm_metrics::test_support::{FAILURES, RESULTS, recorder, series}; + use reth_metrics::metrics::with_local_recorder; + + let (recorder, handle) = recorder(); + let result = with_local_recorder(&recorder, || { + derived_ctx(lagoon_active, post_exec_anchor).post_exec_mode() + }); + let exposition = handle.render(); + + assert!(result.is_err(), "the embedded post-exec tx is rejected"); + assert_eq!(series(&exposition, FAILURES, "reason", reason), Some(1.0), "{exposition}"); + assert_eq!(series(&exposition, RESULTS, "result", "fail"), Some(1.0), "{exposition}"); +} diff --git a/rust/op-reth/crates/payload/src/payload.rs b/rust/op-reth/crates/payload/src/payload.rs index 4ec535e6e88..67b44e47cc0 100644 --- a/rust/op-reth/crates/payload/src/payload.rs +++ b/rust/op-reth/crates/payload/src/payload.rs @@ -17,7 +17,6 @@ use alloy_rpc_types_engine::{ }; use op_alloy_consensus::{ EIP1559ParamError, decode_2718_canonical, encode_holocene_extra_data, encode_jovian_extra_data, - validate_post_exec_entry_count, }; use op_alloy_rpc_types_engine::{ OpExecutionPayloadEnvelope, OpExecutionPayloadEnvelopeV3, OpExecutionPayloadEnvelopeV4, @@ -316,14 +315,15 @@ impl /// Creates a new payload builder from RPC attributes with a pre-computed payload ID. /// /// This is used when the payload ID has already been computed (e.g., by the payload service) - /// and we just need to decode the transaction bytes. + /// and we just need to decode the transaction bytes. A post-exec transaction that fails + /// structural validation is logged and counted before the decode. pub fn from_rpc_attrs( parent: B256, id: PayloadId, attributes: OpPayloadAttributes, ) -> Result { let encoded_transactions = attributes.transactions.unwrap_or_default(); - validate_post_exec_entry_count(&encoded_transactions) + reth_optimism_evm::validate_post_exec_attributes(&encoded_transactions, parent) .map_err(|error| alloy_rlp::Error::Custom(error.as_reason()))?; let transactions = encoded_transactions .into_iter() @@ -682,9 +682,13 @@ where #[cfg(test)] mod tests { use super::*; - use crate::OpPayloadAttributes; + use crate::{ + OpPayloadAttributes, + sdm_metrics::test_support::{FAILURES, RESULTS, recorder, series}, + }; use alloy_primitives::{FixedBytes, address, b256, bytes}; use alloy_rpc_types_engine::PayloadAttributes; + use op_alloy_consensus::PostExecPayloadValidationError; use reth_optimism_primitives::OpTransactionSigned; use reth_payload_primitives::EngineApiMessageVersion; use std::str::FromStr; @@ -841,22 +845,7 @@ mod tests { let mut tagged = vec![0x00]; tagged.extend_from_slice(&legacy); - let attrs = OpPayloadAttributes { - payload_attributes: PayloadAttributes { - timestamp: 1, - prev_randao: B256::ZERO, - suggested_fee_recipient: Address::ZERO, - withdrawals: Some(vec![]), - parent_beacon_block_root: Some(B256::ZERO), - slot_number: None, - target_gas_limit: None, - }, - transactions: Some(vec![tagged.into()]), - no_tx_pool: Some(true), - gas_limit: Some(30_000_000), - eip_1559_params: None, - min_base_fee: None, - }; + let attrs = attrs_with_transactions(vec![tagged.into()]); OpPayloadBuilderAttributes::::try_new(B256::ZERO, attrs.clone(), 3) .unwrap_err(); OpPayloadBuilderAttributes::::from_rpc_attrs( @@ -866,4 +855,79 @@ mod tests { ) .unwrap_err(); } + + /// Derived-block attributes (`no_tx_pool`) carrying exactly `transactions`. + fn attrs_with_transactions(transactions: Vec) -> OpPayloadAttributes { + OpPayloadAttributes { + payload_attributes: PayloadAttributes { + parent_beacon_block_root: Some(B256::ZERO), + prev_randao: B256::ZERO, + slot_number: None, + suggested_fee_recipient: Address::ZERO, + target_gas_limit: None, + timestamp: 1, + withdrawals: Some(vec![]), + }, + eip_1559_params: None, + gas_limit: Some(30_000_000), + min_base_fee: None, + no_tx_pool: Some(true), + transactions: Some(transactions), + } + } + + /// Attributes whose only transaction is a post-exec tx carrying `entries` refund entries. + fn attrs_with_post_exec(entries: usize) -> OpPayloadAttributes { + use alloy_eips::eip2718::Encodable2718; + use op_alloy_consensus::{SDMGasEntry, build_post_exec_tx}; + let tx = build_post_exec_tx( + 1, + (0..entries).map(|index| SDMGasEntry { index: index as u64, gas_refund: 1 }).collect(), + ) + .encoded_2718(); + attrs_with_transactions(vec![tx.into()]) + } + + /// Converts `attrs` against a recorder private to the test, returning the result alongside + /// the rendered exposition. + fn convert( + attrs: OpPayloadAttributes, + ) -> (Result, alloy_rlp::Error>, String) { + use reth_metrics::metrics::with_local_recorder; + let (recorder, handle) = recorder(); + let result = with_local_recorder(&recorder, || { + OpPayloadBuilderAttributes::from_rpc_attrs(B256::ZERO, PayloadId::new([0; 8]), attrs) + }); + (result, handle.render()) + } + + /// A post-exec rejection on the attributes path must reach the same counters as the Engine + /// API preflight: the failed rule and a failed validation. + #[test] + fn rejected_attributes_count_the_failure() { + let (result, exposition) = convert(attrs_with_post_exec(2)); + + assert!(result.is_err(), "two refund entries with no preceding transactions must reject"); + assert_eq!( + series(&exposition, FAILURES, "reason", "too_many_gas_refund_entries"), + Some(1.0), + "{exposition}" + ); + assert_eq!(series(&exposition, RESULTS, "result", "fail"), Some(1.0), "{exposition}"); + } + + /// Accepted attributes count nothing at this stage: like the Engine API preflight, a pass is + /// not yet a validated post-exec transaction — the import path counts that. + #[test] + fn accepted_attributes_count_nothing() { + let (result, exposition) = convert(attrs_with_post_exec(0)); + + assert!(result.is_ok(), "a post-exec transaction with no entries is structurally valid"); + for reason in PostExecPayloadValidationError::ALL_REASONS { + let failures = series(&exposition, FAILURES, "reason", reason).unwrap_or(0.0); + assert_eq!(failures, 0.0, "{reason}: {exposition}"); + } + let fail = series(&exposition, RESULTS, "result", "fail").unwrap_or(0.0); + assert_eq!(fail, 0.0, "the attributes path must not count a pass: {exposition}"); + } } diff --git a/rust/op-reth/crates/payload/src/sdm_metrics.rs b/rust/op-reth/crates/payload/src/sdm_metrics.rs index 19409d5bb71..675106df116 100644 --- a/rust/op-reth/crates/payload/src/sdm_metrics.rs +++ b/rust/op-reth/crates/payload/src/sdm_metrics.rs @@ -58,3 +58,27 @@ pub(crate) fn record_operator_opt_in(enabled: bool) { const fn gauge_value(flag: bool) -> f64 { if flag { 1.0 } else { 0.0 } } + +#[cfg(test)] +pub(crate) mod test_support { + use metrics_exporter_prometheus::{PrometheusBuilder, PrometheusHandle, PrometheusRecorder}; + use metrics_util::layers::{Layer, Prefix, PrefixLayer}; + + pub(crate) const FAILURES: &str = "reth_op_sdm_post_exec_validation_failure_total"; + pub(crate) const RESULTS: &str = "reth_op_sdm_post_exec_validation_total"; + + /// A recorder private to one test, prefixed like the node's recorder stack so the rendered + /// series names are the ones operators query. + pub(crate) fn recorder() -> (Prefix, PrometheusHandle) { + let recorder = PrometheusBuilder::new().build_recorder(); + let handle = recorder.handle(); + (PrefixLayer::new("reth").layer(recorder), handle) + } + + /// Reads one exactly-labeled series out of the exposition. `None` distinguishes a series + /// that was never registered from one reporting 0. + pub(crate) fn series(exposition: &str, metric: &str, label: &str, value: &str) -> Option { + let series = format!("{metric}{{{label}=\"{value}\"}} "); + exposition.lines().find_map(|line| line.strip_prefix(series.as_str())?.trim().parse().ok()) + } +} From abe61d01c92055809b1308e623f0094b53f90f22 Mon Sep 17 00:00:00 2001 From: Einar Rasmussen Date: Thu, 15 Oct 2026 20:01:41 -0700 Subject: [PATCH 2/3] op-reth: describe post-exec attributes counting as per conversion Co-Authored-By: Claude Fable 5.1 --- rust/op-reth/crates/evm/src/sdm_metrics.rs | 3 +-- rust/op-reth/crates/payload/src/builder.rs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/rust/op-reth/crates/evm/src/sdm_metrics.rs b/rust/op-reth/crates/evm/src/sdm_metrics.rs index 2fde4d4a811..c2bf3a867e8 100644 --- a/rust/op-reth/crates/evm/src/sdm_metrics.rs +++ b/rust/op-reth/crates/evm/src/sdm_metrics.rs @@ -6,8 +6,7 @@ //! //! Recorded from the execution-context builders, the Engine API payload preflight, and the //! payload-builder attributes preflight. Attributes count once per conversion into builder -//! attributes: a builder that re-converts on every build attempt counts attempts, so a -//! persistent rejection keeps the series moving for as long as the attempts continue, and a +//! attributes, so a rejection repeats only when a builder reconverts the same attributes, and a //! replay of attributes through the debug RPC namespace counts like an engine delivery. Beyond //! live import, several paths re-execute stored canonical blocks that already passed this check: //! RPC replays, the proofs ExEx's periodic re-execution, and pipeline or backfill sync. diff --git a/rust/op-reth/crates/payload/src/builder.rs b/rust/op-reth/crates/payload/src/builder.rs index 3338ee0d3f6..ceb8a5d7d0f 100644 --- a/rust/op-reth/crates/payload/src/builder.rs +++ b/rust/op-reth/crates/payload/src/builder.rs @@ -381,8 +381,8 @@ where /// Converts `BuildArguments` from [`OpPayloadAttrs`](crate::payload::OpPayloadAttrs) to /// [`OpPayloadBuilderAttributes`], decoding the RPC transaction bytes into typed transactions. /// -/// Runs once per build attempt, so a post-exec transaction the conversion rejects is logged and -/// counted per attempt rather than once per attributes set. +/// Counts a rejected post-exec transaction once per call, so a job that converts the same +/// attributes more than once counts each conversion. fn convert_build_args( args: BuildArguments>, ) -> Result< From 8ade6a5b13741a809a946bf5e2bfd1d4a7e824a8 Mon Sep 17 00:00:00 2001 From: Einar Rasmussen Date: Thu, 15 Oct 2026 20:44:17 -0700 Subject: [PATCH 3/3] op-reth: request the evm crate's std from the txpool and flashblocks crates Both crates are std-only and depend on reth-optimism-evm through the workspace entry, which turns default features off, so a standalone build of either resolved the evm crate without std and its SDM counters compiled to a no-op. The op-reth binary was unaffected because the node crate unifies std in; the edge is now declared where it is needed, as the payload crate already does. Co-Authored-By: Claude Fable 5.1 --- rust/op-reth/crates/flashblocks/Cargo.toml | 2 +- rust/op-reth/crates/txpool/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/op-reth/crates/flashblocks/Cargo.toml b/rust/op-reth/crates/flashblocks/Cargo.toml index 1577c25f504..86bfcb10bb3 100644 --- a/rust/op-reth/crates/flashblocks/Cargo.toml +++ b/rust/op-reth/crates/flashblocks/Cargo.toml @@ -13,7 +13,7 @@ workspace = true [dependencies] # reth reth-optimism-primitives = { workspace = true, features = ["serde"] } -reth-optimism-evm.workspace = true +reth-optimism-evm = { workspace = true, features = ["std"] } reth-chain-state = { workspace = true, features = ["serde"] } reth-primitives-traits = { workspace = true, features = ["serde"] } reth-engine-primitives = { workspace = true, features = ["std"] } diff --git a/rust/op-reth/crates/txpool/Cargo.toml b/rust/op-reth/crates/txpool/Cargo.toml index 50ad217d1c9..2c7fa66d37a 100644 --- a/rust/op-reth/crates/txpool/Cargo.toml +++ b/rust/op-reth/crates/txpool/Cargo.toml @@ -38,7 +38,7 @@ op-revm.workspace = true op-alloy-consensus.workspace = true op-alloy-flz.workspace = true op-alloy-rpc-types.workspace = true -reth-optimism-evm.workspace = true +reth-optimism-evm = { workspace = true, features = ["std"] } reth-optimism-forks.workspace = true reth-optimism-primitives.workspace = true