From c167695116598a9c8365316014abf1a247508307 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Thu, 5 Nov 2026 10:00:17 +0000 Subject: [PATCH 1/9] ci: stub tempoxyz's secure-runner under act --- .circleci/config.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 970fc6f12b5..26c75120147 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,8 @@ version: 2.1 # act's local cache is not reusable across these machines; Pages plumbing is skipped after the # validation build. Lint and unit jobs are distributed; other workflows run up to four jobs. # -# Excluded: pr-title.yml, label-pr.yml, and the privileged cyclops-audit.yml integration. +# Excluded: pr-title.yml, label-pr.yml, the privileged cyclops-audit.yml integration, and +# scan-github-actions.yml, whose reusable workflow needs a GitHub OIDC token. jobs: # Replaces lint.yml's `deny` job. That job calls a reusable workflow from tempoxyz, whose deny job @@ -123,6 +124,27 @@ jobs: ' - run: echo "Service plumbing disabled under act"' \ ' shell: bash' \ > /tmp/noop-action/action.yml + - run: + name: Stub unsupported secure-runner + # Stub tempoxyz's secure-runner: it fetches its policy with a GitHub OIDC token that act + # never receives, and it hardens GitHub-hosted runners, not these machines. act maps whole + # repositories, and this one also serves vendored actions the checks need, so replace only + # secure-runner in a copy at the sha the workflows pin, reusing the no-op action from the + # step above. When re-applying this CI patch, move TEMPOXYZ_GH_ACTIONS_SHA with that pin; + # the guard below names any mismatch. + command: | + readonly TEMPOXYZ_GH_ACTIONS_SHA="ee2960a6cc25d99bda45614135bfe1197d879bac" + if grep -rhoE 'tempoxyz/gh-actions/[^@ ]+@[0-9a-f]{40}' .github/workflows/ \ + | grep -v "@${TEMPOXYZ_GH_ACTIONS_SHA}\$"; then + echo "workflows pin tempoxyz/gh-actions at a sha other than ${TEMPOXYZ_GH_ACTIONS_SHA}" >&2 + exit 1 + fi + git init --quiet /tmp/tempoxyz-gh-actions + git -C /tmp/tempoxyz-gh-actions fetch --quiet --depth 1 \ + https://github.com/tempoxyz/gh-actions "${TEMPOXYZ_GH_ACTIONS_SHA}" + git -C /tmp/tempoxyz-gh-actions checkout --quiet --detach FETCH_HEAD + cp /tmp/noop-action/action.yml /tmp/tempoxyz-gh-actions/actions/secure-runner/action.yml + echo "export TEMPOXYZ_GH_ACTIONS_SHA=${TEMPOXYZ_GH_ACTIONS_SHA}" >> "$BASH_ENV" - run: name: Run << parameters.wf >> via act no_output_timeout: 45m @@ -176,7 +198,8 @@ jobs: --local-repository "mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba=/tmp/noop-action" \ --local-repository "Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6=/tmp/noop-action" \ --local-repository "actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d=/tmp/noop-action" \ - --local-repository "actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9=/tmp/noop-action" + --local-repository "actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9=/tmp/noop-action" \ + --local-repository "tempoxyz/gh-actions@${TEMPOXYZ_GH_ACTIONS_SHA}=/tmp/tempoxyz-gh-actions" workflows: reth-act: From f13963a4bee7c6f6adec9b36058c8beddfa55ce4 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Thu, 5 Nov 2026 10:12:55 +0000 Subject: [PATCH 2/9] ci: ignore the pin-utils unmaintained advisory RUSTSEC-2026-0441 marks pin-utils unmaintained with no safe upgrade. It is reachable only on wasm targets, through alloy-provider's wasmtimer. --- deny.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deny.toml b/deny.toml index cf907cb3124..cfded2b83d5 100644 --- a/deny.toml +++ b/deny.toml @@ -19,6 +19,9 @@ ignore = [ # zstd-safe 7 comes from reth-zstd-compressors 0.7; the patched zstd-safe 8.2.0 needs reth-core 0.8 and Rust 1.96. "RUSTSEC-2026-0398", "RUSTSEC-2026-0403", + # https://rustsec.org/advisories/RUSTSEC-2026-0441 pin-utils is unmaintained, no safe upgrade; + # only reachable on wasm targets through alloy-provider's wasmtimer + "RUSTSEC-2026-0441", ] # This section is considered when running `cargo deny check bans`. From d751e1f39d1f30cc65a7bcb0e949033d1def841b Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 30 Sep 2026 14:42:44 +0000 Subject: [PATCH 3/9] test(e2e): wait for pruner in RocksDB pruning tests (#27601) Co-authored-by: Matthias Seitz <19890894+mattsse@users.noreply.github.com> (cherry picked from commit f269bccbc0f007d7295ccd0b986ecfd36805ef56) --- Cargo.lock | 1 + crates/e2e-test-utils/Cargo.toml | 3 ++ crates/e2e-test-utils/tests/rocksdb/main.rs | 46 +++++++++++++++++++-- 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 475ef86c651..f1ff609d056 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8485,6 +8485,7 @@ dependencies = [ "reth-payload-primitives", "reth-primitives-traits", "reth-provider", + "reth-prune-types", "reth-rpc-api", "reth-rpc-builder", "reth-rpc-eth-api", diff --git a/crates/e2e-test-utils/Cargo.toml b/crates/e2e-test-utils/Cargo.toml index fcf902070fa..a6ea110ed11 100644 --- a/crates/e2e-test-utils/Cargo.toml +++ b/crates/e2e-test-utils/Cargo.toml @@ -70,6 +70,9 @@ serde_json.workspace = true tracing.workspace = true derive_more.workspace = true +[dev-dependencies] +reth-prune-types.workspace = true + [[test]] name = "e2e_testsuite" path = "tests/e2e-testsuite/main.rs" diff --git a/crates/e2e-test-utils/tests/rocksdb/main.rs b/crates/e2e-test-utils/tests/rocksdb/main.rs index 15d5d00b131..c2f6dd12a1b 100644 --- a/crates/e2e-test-utils/tests/rocksdb/main.rs +++ b/crates/e2e-test-utils/tests/rocksdb/main.rs @@ -9,7 +9,8 @@ use reth_chainspec::EthereumHardfork; use reth_db::tables; use reth_e2e_test_utils::{transaction::TransactionTestContext, wait::poll_until, E2ETestSetupExt}; use reth_node_ethereum::EthereumNode; -use reth_provider::RocksDBProviderFactory; +use reth_provider::{PruneCheckpointReader, RocksDBProviderFactory}; +use reth_prune_types::PruneSegment; use std::time::Duration; /// Polls RPC until the given `tx_hash` is visible as pending (not yet mined). @@ -40,6 +41,25 @@ async fn poll_tx_in_rocksdb(provider: &P, tx_hash: B2 .await } +/// Polls until the pruner has pruned `segment` up to at least `block`. +/// +/// The persistence service acknowledges saved blocks before it runs the pruner in a separate +/// commit, so a block being visible in `RocksDB` does not mean the pruner has run for it yet. +async fn wait_for_prune_checkpoint( + provider: &P, + segment: PruneSegment, + block: u64, +) -> Result<()> { + poll_until(format!("{segment} to be pruned up to block {block}"), || async move { + let checkpoint = provider.get_prune_checkpoint(segment)?; + Ok(checkpoint + .and_then(|checkpoint| checkpoint.block_number) + .is_some_and(|n| n >= block) + .then_some(())) + }) + .await +} + /// Smoke test: node boots with `RocksDB` routing enabled. #[tokio::test] async fn test_rocksdb_node_startup() -> Result<()> { @@ -665,12 +685,21 @@ async fn test_rocksdb_account_history_pruning() -> Result<()> { let payload = node.advance_block().await?; assert_eq!(payload.block().number(), nonce + 1); - // Let the persistence cycle (save_blocks → pruner → commit) complete before - // producing the next block, so each cycle processes exactly one block. The - // transaction becomes visible in RocksDB with the commit. + // Wait for the block's save to commit before producing the next block, so each save + // processes exactly one block. The transaction becomes visible in RocksDB with the + // commit, and the persistence service runs the pruner before it handles the next save. poll_tx_in_rocksdb(&node.inner.provider, tx_hash).await?; } + // The pruner runs after the save of the last block is acknowledged, so wait for it to prune + // the blocks outside the retention window. + wait_for_prune_checkpoint( + &node.inner.provider, + PruneSegment::AccountHistory, + TOTAL_BLOCKS - PRUNE_DISTANCE, + ) + .await?; + // Read the AccountsHistory shard for `sender` directly from RocksDB. // This is the data structure corrupted by the race. let rocksdb = node.inner.provider.rocksdb_provider(); @@ -843,6 +872,15 @@ async fn test_rocksdb_storage_history_pruning() -> Result<()> { poll_tx_in_rocksdb(&node.inner.provider, tx_hash).await?; } + // The pruner runs after the save of the last block is acknowledged, so wait for it to prune + // the blocks outside the retention window. + wait_for_prune_checkpoint( + &node.inner.provider, + PruneSegment::StorageHistory, + TOTAL_BLOCKS - PRUNE_DISTANCE, + ) + .await?; + // Read StoragesHistory shard for (contract_address, slot 0) directly from RocksDB let rocksdb = node.inner.provider.rocksdb_provider(); let shards = rocksdb.storage_history_shards(contract_address, storage_slot).unwrap(); From 452436786022f147d7843b0ebe2fabc0b780adf4 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 28 Sep 2026 17:51:04 +0200 Subject: [PATCH 4/9] test(e2e): replace fixed sleeps with pool waits (#27500) Co-authored-by: Matthias Seitz <19890894+mattsse@users.noreply.github.com> (cherry picked from commit 0fc98b4d82c717e01d99e2c285fd7516c4e19b79) --- Cargo.lock | 1 + crates/e2e-test-utils/Cargo.toml | 1 + crates/e2e-test-utils/src/node.rs | 13 +++++++++---- crates/ethereum/node/tests/e2e/blobs.rs | 14 +++++++++++--- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f1ff609d056..790692cff43 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8494,6 +8494,7 @@ dependencies = [ "reth-tasks", "reth-tokio-util", "reth-tracing", + "reth-transaction-pool", "reth-trie", "reth-trie-db", "revm", diff --git a/crates/e2e-test-utils/Cargo.toml b/crates/e2e-test-utils/Cargo.toml index a6ea110ed11..f314cf93fbd 100644 --- a/crates/e2e-test-utils/Cargo.toml +++ b/crates/e2e-test-utils/Cargo.toml @@ -41,6 +41,7 @@ reth-db-common.workspace = true reth-primitives-traits.workspace = true reth-trie.workspace = true reth-trie-db.workspace = true +reth-transaction-pool.workspace = true revm.workspace = true tempfile.workspace = true diff --git a/crates/e2e-test-utils/src/node.rs b/crates/e2e-test-utils/src/node.rs index 7eb43c73b7d..ef836698a6a 100644 --- a/crates/e2e-test-utils/src/node.rs +++ b/crates/e2e-test-utils/src/node.rs @@ -30,6 +30,7 @@ use reth_rpc_api::TestingBuildBlockRequestV1; use reth_rpc_builder::auth::AuthServerHandle; use reth_rpc_eth_api::helpers::{EthApiSpec, EthTransactions, TraceExt}; use reth_stages_types::StageId; +use reth_transaction_pool::TransactionPool; use std::{pin::Pin, sync::Arc, time::Duration}; use tokio_stream::StreamExt; use url::Url; @@ -344,10 +345,14 @@ where .await .map_err(|_| eyre!("timed out syncing to block {block}"))??; - // Hack to make sure that all components have time to process canonical state update. - // Otherwise, this might result in e.g "nonce too low" errors when advancing chain further, - // making tests flaky. - tokio::time::sleep(Duration::from_millis(1000)).await; + // The transaction pool processes the canonical state update in the background, and + // advancing the chain before it did can fail with e.g. "nonce too low" errors. Blocks + // synced by backfill don't notify the pool, so wait for at most a second. + let _ = tokio::time::timeout( + Duration::from_secs(1), + self.wait_for_pool(|pool| pool.block_info().last_seen_block_hash == block), + ) + .await; Ok(()) } diff --git a/crates/ethereum/node/tests/e2e/blobs.rs b/crates/ethereum/node/tests/e2e/blobs.rs index feef4cc18a9..c7f7941f725 100644 --- a/crates/ethereum/node/tests/e2e/blobs.rs +++ b/crates/ethereum/node/tests/e2e/blobs.rs @@ -9,7 +9,7 @@ use reth_node_ethereum::EthereumNode; use reth_transaction_pool::TransactionPool; use std::{ sync::Arc, - time::{Duration, SystemTime, UNIX_EPOCH}, + time::{SystemTime, UNIX_EPOCH}, }; #[tokio::test] @@ -51,7 +51,11 @@ async fn can_handle_blobs() -> eyre::Result<()> { let block_hash = node.submit_payload(payload).await?; node.update_forkchoice(genesis_hash, block_hash).await?; - tokio::time::sleep(std::time::Duration::from_secs(3)).await; + // wait for the pool to process the reorg, which re-injects the blob tx + node.wait_for_pool(|pool| { + pool.block_info().last_seen_block_hash == block_hash && pool.contains(&blob_tx_hash) + }) + .await?; // expects the blob tx to be back in the pool let envelope = node.rpc.envelope_by_hash(blob_tx_hash).await?; @@ -164,7 +168,11 @@ async fn blob_conversion_at_osaka() -> eyre::Result<()> { // validate sidecar TransactionTestContext::validate_sidecar(envelope); - tokio::time::sleep(Duration::from_secs(6)).await; + // wait for the pool to convert the sidecar ahead of the Osaka activation + node.wait_for_pool(|pool| { + pool.get_blob(blob_tx_hash).ok().flatten().is_some_and(|sidecar| sidecar.is_eip7594()) + }) + .await?; // fetch second blob tx from rpc again let envelope = node.rpc.envelope_by_hash(blob_tx_hash).await?; From 8d0a06b320a213e0aec3ccc3e50b0c1b3d84c1d4 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 30 Sep 2026 14:14:14 +0000 Subject: [PATCH 5/9] feat(e2e): control the next payload timestamp (#27596) Co-authored-by: Matthias Seitz <19890894+mattsse@users.noreply.github.com> (cherry picked from commit e29c3433cfbe4cae25e80dae3086d9dc13652e51) --- crates/e2e-test-utils/src/node.rs | 24 +++++++++++++++ crates/e2e-test-utils/src/payload.rs | 7 +++++ crates/ethereum/node/tests/e2e/blobs.rs | 11 ++++--- .../ethereum/node/tests/e2e/custom_genesis.rs | 29 +++++++++++++++++++ crates/ethereum/node/tests/e2e/p2p.rs | 4 +-- 5 files changed, 69 insertions(+), 6 deletions(-) diff --git a/crates/e2e-test-utils/src/node.rs b/crates/e2e-test-utils/src/node.rs index ef836698a6a..824c33111fc 100644 --- a/crates/e2e-test-utils/src/node.rs +++ b/crates/e2e-test-utils/src/node.rs @@ -169,6 +169,30 @@ where }) } + /// Sets the timestamp of the next payload built by [`Self::new_payload`] and the methods + /// built on it, such as [`Self::advance_block`]. + /// + /// Later payloads continue from this timestamp, one second apart. The attributes generator is + /// called with the new timestamp, so fork-dependent attributes follow it. + /// + /// Returns an error if the timestamp is not greater than the timestamp of the current latest + /// block, which is the parent of the next payload. + pub fn set_next_payload_timestamp(&mut self, timestamp: u64) -> eyre::Result<()> { + let latest = self + .inner + .provider + .sealed_header_by_number_or_tag(BlockNumberOrTag::Latest)? + .ok_or_else(|| eyre!("latest block not found"))?; + ensure!( + timestamp > latest.timestamp(), + "next payload timestamp {timestamp} must be greater than the latest block timestamp {}", + latest.timestamp() + ); + // The payload context increments its timestamp before generating the next attributes. + self.payload.timestamp = timestamp - 1; + Ok(()) + } + /// Creates a new payload from given attributes generator /// expects a payload attribute event and waits until the payload is built. /// diff --git a/crates/e2e-test-utils/src/payload.rs b/crates/e2e-test-utils/src/payload.rs index fe0d4452c9f..c920b1bf065 100644 --- a/crates/e2e-test-utils/src/payload.rs +++ b/crates/e2e-test-utils/src/payload.rs @@ -10,6 +10,13 @@ use tokio_stream::wrappers::BroadcastStream; pub struct PayloadTestContext { pub payload_event_stream: BroadcastStream>, payload_builder: PayloadBuilderHandle, + /// Timestamp of the last generated payload attributes, or the starting point if none were + /// generated yet. + /// + /// [`Self::next_attributes`] increments it before generating the next attributes. Prefer + /// [`NodeTestContext::set_next_payload_timestamp`] over setting it directly. + /// + /// [`NodeTestContext::set_next_payload_timestamp`]: crate::node::NodeTestContext::set_next_payload_timestamp pub timestamp: u64, #[debug(skip)] attributes_generator: Box T::PayloadAttributes + Send + Sync>, diff --git a/crates/ethereum/node/tests/e2e/blobs.rs b/crates/ethereum/node/tests/e2e/blobs.rs index c7f7941f725..324c7560312 100644 --- a/crates/ethereum/node/tests/e2e/blobs.rs +++ b/crates/ethereum/node/tests/e2e/blobs.rs @@ -122,8 +122,9 @@ async fn blob_conversion_at_osaka() -> eyre::Result<()> { // build a dummy payload at `current_timestamp` let raw_tx = TransactionTestContext::transfer_tx_bytes(1, wallet.signer(0)).await; node.rpc.inject_tx(raw_tx).await?; - node.payload.timestamp = current_timestamp - 1; - node.advance_block().await?; + node.set_next_payload_timestamp(current_timestamp)?; + let dummy_payload = node.advance_block().await?; + assert_eq!(dummy_payload.block().timestamp, current_timestamp); // build blob txs let first_blob = TransactionTestContext::tx_with_blobs_bytes(1, wallet.signer(1)).await?; @@ -155,8 +156,9 @@ async fn blob_conversion_at_osaka() -> eyre::Result<()> { TransactionTestContext::validate_sidecar(envelope); // build last Prague payload - node.payload.timestamp = current_timestamp + 1; + node.set_next_payload_timestamp(current_timestamp + 2)?; let prague_payload = node.new_payload().await?; + assert_eq!(prague_payload.block().timestamp, current_timestamp + 2); assert!(matches!(prague_payload.sidecars(), BlobSidecars::Eip4844(_))); // inject second blob tx to the pool @@ -185,8 +187,9 @@ async fn blob_conversion_at_osaka() -> eyre::Result<()> { node.update_forkchoice(genesis_hash, node.submit_payload(prague_payload).await?).await?; // Build first Osaka payload - node.payload.timestamp = osaka_timestamp - 1; + node.set_next_payload_timestamp(osaka_timestamp)?; let osaka_payload = node.new_payload().await?; + assert_eq!(osaka_payload.block().timestamp, osaka_timestamp); // Assert that it includes the second blob tx with eip7594 sidecar assert!(osaka_payload.block().body().transactions().any(|tx| *tx.hash() == blob_tx_hash)); diff --git a/crates/ethereum/node/tests/e2e/custom_genesis.rs b/crates/ethereum/node/tests/e2e/custom_genesis.rs index 0b11d6a1e14..12127e9143f 100644 --- a/crates/ethereum/node/tests/e2e/custom_genesis.rs +++ b/crates/ethereum/node/tests/e2e/custom_genesis.rs @@ -92,3 +92,32 @@ async fn can_advance_on_genesis_newer_than_payload_timestamp() -> eyre::Result<( Ok(()) } + +/// Tests that the next payload is built at the timestamp set on the test context, that later +/// payloads continue from it, and that timestamps not after the latest block are rejected. +#[tokio::test] +async fn can_set_next_payload_timestamp() -> eyre::Result<()> { + reth_tracing::init_test_tracing(); + + let genesis_timestamp = 2_000_000_000; + let mut genesis = test_genesis(); + genesis.timestamp = genesis_timestamp; + let chain_spec = + Arc::new(test_chain_spec_builder().genesis(genesis).cancun_activated().build()); + + let (mut node, _) = EthereumNode::test_setup(1, chain_spec).build_single().await?; + + assert_eq!( + node.set_next_payload_timestamp(genesis_timestamp).unwrap_err().to_string(), + "next payload timestamp 2000000000 must be greater than the latest block timestamp 2000000000" + ); + + let timestamp = genesis_timestamp + 100; + node.set_next_payload_timestamp(timestamp)?; + assert_eq!(node.advance_block().await?.block().timestamp, timestamp); + assert_eq!(node.advance_block().await?.block().timestamp, timestamp + 1); + + assert!(node.set_next_payload_timestamp(timestamp + 1).is_err()); + + Ok(()) +} diff --git a/crates/ethereum/node/tests/e2e/p2p.rs b/crates/ethereum/node/tests/e2e/p2p.rs index cb076baf906..9aa52c74c78 100644 --- a/crates/ethereum/node/tests/e2e/p2p.rs +++ b/crates/ethereum/node/tests/e2e/p2p.rs @@ -242,7 +242,7 @@ async fn test_long_reorg() -> eyre::Result<()> { second_node.sync_to(head.header.hash).await?; // Produce a fork chain with blocks 21..60 - second_node.payload.timestamp = head.header.timestamp; + second_node.set_next_payload_timestamp(head.header.timestamp + 1)?; advance_with_random_transactions(&mut second_node, 40, &mut rng, true).await?; // Reorg first node from 100th block to new 60th block. @@ -332,7 +332,7 @@ async fn test_reorg_through_backfill() -> eyre::Result<()> { second_node.sync_to(head.header.hash).await?; // Produce an unfinalized fork chain with 30 blocks - second_node.payload.timestamp = head.header.timestamp; + second_node.set_next_payload_timestamp(head.header.timestamp + 1)?; advance_with_random_transactions(&mut second_node, 30, &mut rng, false).await?; // Now reorg second node to the finalized canonical head From f38c1f40fec9145943815679002f458b3e8d793c Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 30 Sep 2026 14:42:21 +0000 Subject: [PATCH 6/9] feat(e2e): wait for the pool to process a new head (#27597) Co-authored-by: Matthias Seitz <19890894+mattsse@users.noreply.github.com> (cherry picked from commit cdc4e096f140562f5d2a9f78ead17f3e16bdb3ca) --- crates/e2e-test-utils/src/node.rs | 39 +++++++++++++++++++++---- crates/ethereum/node/tests/e2e/blobs.rs | 8 ++--- crates/ethereum/node/tests/e2e/pool.rs | 31 ++++++++++++++++++++ 3 files changed, 68 insertions(+), 10 deletions(-) diff --git a/crates/e2e-test-utils/src/node.rs b/crates/e2e-test-utils/src/node.rs index 824c33111fc..1cc977e6d08 100644 --- a/crates/e2e-test-utils/src/node.rs +++ b/crates/e2e-test-utils/src/node.rs @@ -234,6 +234,14 @@ where Ok(payload) } + /// Advances the node forward one block like [`Self::advance_block`] and waits until the + /// transaction pool processed the new block, see [`Self::wait_for_pool_head`]. + pub async fn advance_block_synced(&mut self) -> eyre::Result { + let payload = self.advance_block().await?; + self.wait_for_pool_head(payload.block().hash()).await?; + Ok(payload) + } + /// Waits for block to be available on node. /// /// Returns an error if the block is not available within [`WAIT_TIMEOUT`]. @@ -296,6 +304,29 @@ where .await } + /// Waits until the transaction pool of the node processed the canonical state update that made + /// the block with the given hash its head. + /// + /// The pool maintenance task processes new heads in the background, so right after e.g. a + /// forkchoice update the pool can still contain the transactions mined in the new block or use + /// outdated sender nonces and pending fees. The pool updates its last seen block together with + /// these, so they are up to date once this returns. Exceptions are reorgs, after which the + /// maintenance task re-injects the transactions of the old chain only afterwards, so wait for + /// them with [`Self::wait_for_pool`], and commits deeper than the maximum update depth of the + /// maintenance task, e.g. after a long sync, which only update the last seen block. + /// + /// Returns an error if the pool does not process the block within [`WAIT_TIMEOUT`], e.g. + /// because the block is not the canonical head, the pool already processed a newer head, or + /// the block was synced by backfill, which does not notify the pool. + pub async fn wait_for_pool_head(&self, hash: B256) -> eyre::Result<()> { + let pool = &self.inner.pool; + poll_until(format!("transaction pool to process block {hash}"), move || { + let ready = pool.block_info().last_seen_block_hash == hash; + async move { Ok(ready.then_some(())) } + }) + .await + } + /// Asserts that a new block has been added to the blockchain and the tx has been included in /// the block, at any position. /// @@ -372,11 +403,7 @@ where // The transaction pool processes the canonical state update in the background, and // advancing the chain before it did can fail with e.g. "nonce too low" errors. Blocks // synced by backfill don't notify the pool, so wait for at most a second. - let _ = tokio::time::timeout( - Duration::from_secs(1), - self.wait_for_pool(|pool| pool.block_info().last_seen_block_hash == block), - ) - .await; + let _ = tokio::time::timeout(Duration::from_secs(1), self.wait_for_pool_head(block)).await; Ok(()) } @@ -560,10 +587,12 @@ mod tests { #[expect(dead_code)] fn test_helper_futures_are_send(node: &mut NodeHelperType) { assert_send(node.advance_block()); + assert_send(node.advance_block_synced()); assert_send(node.inject_and_advance(Bytes::new())); assert_send(node.wait_block(0, B256::ZERO, false)); assert_send(node.wait_unwind(0)); assert_send(node.wait_for_pool(|_| true)); + assert_send(node.wait_for_pool_head(B256::ZERO)); assert_send(node.assert_new_block(B256::ZERO, B256::ZERO, 0)); assert_send(node.sync_to(B256::ZERO)); } diff --git a/crates/ethereum/node/tests/e2e/blobs.rs b/crates/ethereum/node/tests/e2e/blobs.rs index 324c7560312..21fc991ecc1 100644 --- a/crates/ethereum/node/tests/e2e/blobs.rs +++ b/crates/ethereum/node/tests/e2e/blobs.rs @@ -51,11 +51,9 @@ async fn can_handle_blobs() -> eyre::Result<()> { let block_hash = node.submit_payload(payload).await?; node.update_forkchoice(genesis_hash, block_hash).await?; - // wait for the pool to process the reorg, which re-injects the blob tx - node.wait_for_pool(|pool| { - pool.block_info().last_seen_block_hash == block_hash && pool.contains(&blob_tx_hash) - }) - .await?; + // wait for the pool to process the reorg, and then re-inject the blob tx + node.wait_for_pool_head(block_hash).await?; + node.wait_for_pool(|pool| pool.contains(&blob_tx_hash)).await?; // expects the blob tx to be back in the pool let envelope = node.rpc.envelope_by_hash(blob_tx_hash).await?; diff --git a/crates/ethereum/node/tests/e2e/pool.rs b/crates/ethereum/node/tests/e2e/pool.rs index 9b68ff9ff80..56ddcfb703c 100644 --- a/crates/ethereum/node/tests/e2e/pool.rs +++ b/crates/ethereum/node/tests/e2e/pool.rs @@ -289,3 +289,34 @@ async fn maintain_txpool_commit() -> eyre::Result<()> { Ok(()) } + +// Test that the pool processed the new block once `advance_block_synced` returns. +#[tokio::test] +async fn advance_block_synced_waits_for_pool() -> eyre::Result<()> { + reth_tracing::init_test_tracing(); + + let (mut node, wallet) = + EthereumNode::test_setup_for(EthereumHardfork::Cancun).build_single().await?; + + for nonce in 0..3 { + let raw_tx = TransactionTestContext::transfer_tx_bytes_with_nonce( + wallet.chain_id, + wallet.inner.clone(), + nonce, + ) + .await; + let tx_hash = node.rpc.inject_tx(raw_tx).await?; + + let payload = node.advance_block_synced().await?; + let block = payload.block(); + assert!(block.body().transactions().any(|tx| *tx.hash() == tx_hash)); + + // the mined transaction is removed from the pool without waiting any further + let info = node.inner.pool.block_info(); + assert_eq!(info.last_seen_block_hash, block.hash()); + assert_eq!(info.last_seen_block_number, block.header().number); + assert!(node.inner.pool.is_empty()); + } + + Ok(()) +} From 910feb33b3f9c2146d13b6987d423bc903378cff Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 30 Sep 2026 14:43:27 +0000 Subject: [PATCH 7/9] feat(e2e): add import_payload helper (#27599) Co-authored-by: Matthias Seitz <19890894+mattsse@users.noreply.github.com> (cherry picked from commit 569c770ca893ac59f13cfcf5c46b0e26efd64fc9) --- crates/e2e-test-utils/src/node.rs | 40 +++++++++++++++++++++---- crates/ethereum/node/tests/e2e/blobs.rs | 14 ++++----- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/crates/e2e-test-utils/src/node.rs b/crates/e2e-test-utils/src/node.rs index 1cc977e6d08..43b2b1cc665 100644 --- a/crates/e2e-test-utils/src/node.rs +++ b/crates/e2e-test-utils/src/node.rs @@ -224,12 +224,12 @@ where Ok(payload) } - /// Advances the node forward one block + /// Advances the node forward one block by building a payload and importing it with + /// [`Self::import_payload`]. pub async fn advance_block(&mut self) -> eyre::Result { - let payload = self.build_and_submit_payload().await?; + let payload = self.new_payload().await?; - // trigger forkchoice update via engine api to commit the block to the blockchain - self.update_forkchoice(payload.block().hash(), payload.block().hash()).await?; + self.import_payload(payload.clone()).await?; Ok(payload) } @@ -446,6 +446,30 @@ where Ok(block_hash) } + /// Submits a payload to the engine and makes its block the canonical head, returning the block + /// hash. + /// + /// The forkchoice update marks the block as head, safe, and finalized block, like + /// [`Self::advance_block`] does, so the node can't reorg to a chain without the block + /// afterwards. The engine only reports the forkchoice update valid after making the head + /// canonical, so the block is the latest block of the node once this returns. The transaction + /// pool processes the new block in the background, see [`Self::wait_for_pool`]. + /// + /// The parent of the payload must be known to the node, e.g. to import a payload built by + /// another node into its peers. Returns an error if the engine does not report the forkchoice + /// update valid, e.g. because the payload is invalid. + pub async fn import_payload(&self, payload: Payload::BuiltPayload) -> eyre::Result { + let block_hash = self.submit_payload(payload).await?; + let updated = self.update_forkchoice(block_hash, block_hash).await?; + ensure!( + updated.is_valid(), + "forkchoice update to block {block_hash} is not valid: {}", + updated.payload_status.status + ); + + Ok(block_hash) + } + /// Returns the RPC URL. pub fn rpc_url(&self) -> Url { let addr = self.inner.rpc_server_handle().http_local_addr().unwrap(); @@ -578,14 +602,17 @@ where mod tests { use super::*; use crate::NodeHelperType; - use reth_node_ethereum::EthereumNode; + use reth_node_ethereum::{EthEngineTypes, EthereumNode}; fn assert_send(_: T) {} /// Tests of downstream nodes await these helpers in spawned tasks, so their futures must be /// `Send`. #[expect(dead_code)] - fn test_helper_futures_are_send(node: &mut NodeHelperType) { + fn test_helper_futures_are_send( + node: &mut NodeHelperType, + payload: ::BuiltPayload, + ) { assert_send(node.advance_block()); assert_send(node.advance_block_synced()); assert_send(node.inject_and_advance(Bytes::new())); @@ -595,5 +622,6 @@ mod tests { assert_send(node.wait_for_pool_head(B256::ZERO)); assert_send(node.assert_new_block(B256::ZERO, B256::ZERO, 0)); assert_send(node.sync_to(B256::ZERO)); + assert_send(node.import_payload(payload)); } } diff --git a/crates/ethereum/node/tests/e2e/blobs.rs b/crates/ethereum/node/tests/e2e/blobs.rs index 21fc991ecc1..3882080fd75 100644 --- a/crates/ethereum/node/tests/e2e/blobs.rs +++ b/crates/ethereum/node/tests/e2e/blobs.rs @@ -68,7 +68,6 @@ async fn can_send_legacy_sidecar_post_activation() -> eyre::Result<()> { reth_tracing::init_test_tracing(); let chain_spec = test_chain_spec(EthereumHardfork::Osaka); - let genesis_hash = chain_spec.genesis_hash(); let (mut node, wallet) = EthereumNode::test_setup(1, chain_spec) .with_rpc_modifier(|rpc| rpc.with_force_blob_sidecar_upcasting()) .build_single() @@ -92,10 +91,8 @@ async fn can_send_legacy_sidecar_post_activation() -> eyre::Result<()> { // build a payload let blob_payload = node.new_payload().await?; - // submit the blob payload - let blob_block_hash = node.submit_payload(blob_payload).await?; - - node.update_forkchoice(genesis_hash, blob_block_hash).await?; + // import the blob payload + node.import_payload(blob_payload).await?; Ok(()) } @@ -111,7 +108,6 @@ async fn blob_conversion_at_osaka() -> eyre::Result<()> { let chain_spec = Arc::new( test_chain_spec_builder().prague_activated().with_osaka_at(osaka_timestamp).build(), ); - let genesis_hash = chain_spec.genesis_hash(); let (mut node, wallet) = EthereumNode::test_setup(1, chain_spec) .with_rpc_modifier(|rpc| rpc.with_force_blob_sidecar_upcasting()) .build_single() @@ -181,8 +177,8 @@ async fn blob_conversion_at_osaka() -> eyre::Result<()> { // validate sidecar TransactionTestContext::validate_sidecar(envelope); - // submit the Prague payload - node.update_forkchoice(genesis_hash, node.submit_payload(prague_payload).await?).await?; + // import the Prague payload + node.import_payload(prague_payload).await?; // Build first Osaka payload node.set_next_payload_timestamp(osaka_timestamp)?; @@ -193,7 +189,7 @@ async fn blob_conversion_at_osaka() -> eyre::Result<()> { assert!(osaka_payload.block().body().transactions().any(|tx| *tx.hash() == blob_tx_hash)); assert!(matches!(osaka_payload.sidecars(), BlobSidecars::Eip7594(_))); - node.update_forkchoice(genesis_hash, node.submit_payload(osaka_payload).await?).await?; + node.import_payload(osaka_payload).await?; Ok(()) } From 3b69ad1dbc2e553f84e7526ac53b4827a91291c0 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Sat, 3 Oct 2026 16:04:23 +0200 Subject: [PATCH 8/9] test: harden Osaka blob conversion e2e (#27687) (cherry picked from commit 7a5c817ab841b8b5ceea6dccb4f100a4d973b9e0) --- crates/ethereum/node/tests/e2e/blobs.rs | 32 ++++++++++--------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/crates/ethereum/node/tests/e2e/blobs.rs b/crates/ethereum/node/tests/e2e/blobs.rs index 3882080fd75..02532194737 100644 --- a/crates/ethereum/node/tests/e2e/blobs.rs +++ b/crates/ethereum/node/tests/e2e/blobs.rs @@ -1,4 +1,4 @@ -use alloy_eips::Decodable2718; +use alloy_eips::{merge::SLOT_DURATION_SECS, Decodable2718}; use reth_chainspec::EthereumHardfork; use reth_e2e_test_utils::{ test_chain_spec, test_chain_spec_builder, transaction::TransactionTestContext, E2ETestSetupExt, @@ -7,10 +7,7 @@ use reth_ethereum_engine_primitives::BlobSidecars; use reth_ethereum_primitives::PooledTransactionVariant; use reth_node_ethereum::EthereumNode; use reth_transaction_pool::TransactionPool; -use std::{ - sync::Arc, - time::{SystemTime, UNIX_EPOCH}, -}; +use std::sync::Arc; #[tokio::test] async fn can_handle_blobs() -> eyre::Result<()> { @@ -101,9 +98,10 @@ async fn can_send_legacy_sidecar_post_activation() -> eyre::Result<()> { async fn blob_conversion_at_osaka() -> eyre::Result<()> { reth_tracing::init_test_tracing(); - let current_timestamp = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(); - // Osaka activates in 2 slots - let osaka_timestamp = current_timestamp + 24; + // Keep genesis outside the conversion window. Importing the Prague payload below starts + // conversion two slots before Osaka, after all legacy sidecar assertions have completed. + let prague_timestamp = 2 * SLOT_DURATION_SECS; + let osaka_timestamp = prague_timestamp + 2 * SLOT_DURATION_SECS; let chain_spec = Arc::new( test_chain_spec_builder().prague_activated().with_osaka_at(osaka_timestamp).build(), @@ -113,13 +111,6 @@ async fn blob_conversion_at_osaka() -> eyre::Result<()> { .build_single() .await?; - // build a dummy payload at `current_timestamp` - let raw_tx = TransactionTestContext::transfer_tx_bytes(1, wallet.signer(0)).await; - node.rpc.inject_tx(raw_tx).await?; - node.set_next_payload_timestamp(current_timestamp)?; - let dummy_payload = node.advance_block().await?; - assert_eq!(dummy_payload.block().timestamp, current_timestamp); - // build blob txs let first_blob = TransactionTestContext::tx_with_blobs_bytes(1, wallet.signer(1)).await?; let second_blob = TransactionTestContext::tx_with_blobs_bytes(1, wallet.signer(2)).await?; @@ -150,9 +141,10 @@ async fn blob_conversion_at_osaka() -> eyre::Result<()> { TransactionTestContext::validate_sidecar(envelope); // build last Prague payload - node.set_next_payload_timestamp(current_timestamp + 2)?; + node.set_next_payload_timestamp(prague_timestamp)?; let prague_payload = node.new_payload().await?; - assert_eq!(prague_payload.block().timestamp, current_timestamp + 2); + assert_eq!(prague_payload.block().timestamp, prague_timestamp); + assert!(prague_payload.block().body().transactions().any(|tx| *tx.hash() == blob_tx_hash)); assert!(matches!(prague_payload.sidecars(), BlobSidecars::Eip4844(_))); // inject second blob tx to the pool @@ -164,6 +156,9 @@ async fn blob_conversion_at_osaka() -> eyre::Result<()> { // validate sidecar TransactionTestContext::validate_sidecar(envelope); + // Import the Prague payload to trigger conversion only after checking both legacy sidecars. + node.import_payload(prague_payload).await?; + // wait for the pool to convert the sidecar ahead of the Osaka activation node.wait_for_pool(|pool| { pool.get_blob(blob_tx_hash).ok().flatten().is_some_and(|sidecar| sidecar.is_eip7594()) @@ -177,9 +172,6 @@ async fn blob_conversion_at_osaka() -> eyre::Result<()> { // validate sidecar TransactionTestContext::validate_sidecar(envelope); - // import the Prague payload - node.import_payload(prague_payload).await?; - // Build first Osaka payload node.set_next_payload_timestamp(osaka_timestamp)?; let osaka_payload = node.new_payload().await?; From bc2744c3a7062d84afcec316f350c042e77f4e21 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Wed, 11 Nov 2026 18:16:01 +0000 Subject: [PATCH 9/9] ci: pin the docs job's Playwright CLI The docs job ran an unpinned `npx playwright install`, which resolves the newest `playwright` at run time and broke while npm had 1.65.0 of the CLI but not of `playwright-core`. Pin it to 1.64.1, as op-v2.6.0 does since ethereum-optimism/reth#38. Nothing in the docs lockfile depends on a Playwright version. (cherry picked from the book.yml half of commit 806fa3b2aa) --- .github/workflows/book.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index ffc7eb13c1e..a7d070a7a3a 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -44,7 +44,7 @@ jobs: run: | cd docs/vocs/ bun i - npx playwright install --with-deps chromium + npx playwright@1.64.1 install --with-deps chromium - name: Install Rust nightly uses: dtolnay/rust-toolchain@02cb101ec7c40f2c49e1d9714d64511d8e1b74de # v1