From e5cf4af9e7cd6a1c63e24dd6018942f334cec104 Mon Sep 17 00:00:00 2001 From: 0xrusowsky <0xrusowsky@proton.me> Date: Tue, 28 Apr 2026 11:47:39 +0200 Subject: [PATCH 1/3] chore: bump tempo and validate fork schedule Amp-Thread-ID: https://ampcode.com/threads/T-019dd36a-7d77-772b-8cba-13f2147c9e5c --- .github/workflows/ci-tempo.yml | 8 ++++ Cargo.lock | 52 +++++++++++----------- Cargo.toml | 20 ++++----- crates/cast/tests/cli/main.rs | 81 +++++++++++++++++++++++++++++++++- 4 files changed, 124 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci-tempo.yml b/.github/workflows/ci-tempo.yml index b4bc98391e72d..064acedc43596 100644 --- a/.github/workflows/ci-tempo.yml +++ b/.github/workflows/ci-tempo.yml @@ -59,6 +59,14 @@ jobs: cargo build --profile dev --locked -p forge -p cast -p anvil -p chisel echo "${{ github.workspace }}/target/debug" >> "$GITHUB_PATH" + - name: Check Tempo fork schedule compatibility + env: + TEMPO_MAINNET_RPC_URL: ${{ secrets.TEMPO_MAINNET_RPC_URL }} + TEMPO_TESTNET_RPC_URL: ${{ secrets.TEMPO_TESTNET_RPC_URL }} + TEMPO_DEVNET_RPC_URL: ${{ secrets.TEMPO_DEVNET_RPC_URL }} + run: | + cargo test --locked -p cast --test cli tempo_fork_schedule_parses_configured_rpcs -- --exact --nocapture + # TODO(upstream): re-enable when flaky devnet faucet is fixed # - name: Run Tempo check on devnet # if: | diff --git a/Cargo.lock b/Cargo.lock index 71d56653d7a20..488f3c852513c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1194,7 +1194,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -1218,7 +1218,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -3043,7 +3043,7 @@ dependencies = [ "terminfo", "thiserror 2.0.18", "which", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -3196,7 +3196,7 @@ version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -4000,7 +4000,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -4305,7 +4305,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -6643,7 +6643,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -7590,7 +7590,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -8742,7 +8742,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -10003,7 +10003,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -10062,7 +10062,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -10776,7 +10776,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -11303,13 +11303,13 @@ dependencies = [ "getrandom 0.4.2", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] name = "tempo-alloy" version = "1.6.0" -source = "git+https://github.com/tempoxyz/tempo?rev=1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69#1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69" +source = "git+https://github.com/tempoxyz/tempo?rev=8bd4d01d37e3cc324030baacbce2da0862d7735a#8bd4d01d37e3cc324030baacbce2da0862d7735a" dependencies = [ "alloy-consensus", "alloy-contract", @@ -11336,7 +11336,7 @@ dependencies = [ [[package]] name = "tempo-chainspec" version = "1.5.3" -source = "git+https://github.com/tempoxyz/tempo?rev=1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69#1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69" +source = "git+https://github.com/tempoxyz/tempo?rev=8bd4d01d37e3cc324030baacbce2da0862d7735a#8bd4d01d37e3cc324030baacbce2da0862d7735a" dependencies = [ "alloy-eips 2.0.1", "alloy-evm", @@ -11355,7 +11355,7 @@ dependencies = [ [[package]] name = "tempo-consensus" version = "1.6.0" -source = "git+https://github.com/tempoxyz/tempo?rev=1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69#1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69" +source = "git+https://github.com/tempoxyz/tempo?rev=8bd4d01d37e3cc324030baacbce2da0862d7735a#8bd4d01d37e3cc324030baacbce2da0862d7735a" dependencies = [ "alloy-consensus", "alloy-evm", @@ -11373,7 +11373,7 @@ dependencies = [ [[package]] name = "tempo-contracts" version = "1.6.0" -source = "git+https://github.com/tempoxyz/tempo?rev=1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69#1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69" +source = "git+https://github.com/tempoxyz/tempo?rev=8bd4d01d37e3cc324030baacbce2da0862d7735a#8bd4d01d37e3cc324030baacbce2da0862d7735a" dependencies = [ "alloy-contract", "alloy-primitives", @@ -11384,7 +11384,7 @@ dependencies = [ [[package]] name = "tempo-evm" version = "1.6.0" -source = "git+https://github.com/tempoxyz/tempo?rev=1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69#1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69" +source = "git+https://github.com/tempoxyz/tempo?rev=8bd4d01d37e3cc324030baacbce2da0862d7735a#8bd4d01d37e3cc324030baacbce2da0862d7735a" dependencies = [ "alloy-consensus", "alloy-evm", @@ -11411,7 +11411,7 @@ dependencies = [ [[package]] name = "tempo-precompiles" version = "1.6.0" -source = "git+https://github.com/tempoxyz/tempo?rev=1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69#1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69" +source = "git+https://github.com/tempoxyz/tempo?rev=8bd4d01d37e3cc324030baacbce2da0862d7735a#8bd4d01d37e3cc324030baacbce2da0862d7735a" dependencies = [ "alloy", "alloy-evm", @@ -11431,7 +11431,7 @@ dependencies = [ [[package]] name = "tempo-precompiles-macros" version = "1.6.0" -source = "git+https://github.com/tempoxyz/tempo?rev=1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69#1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69" +source = "git+https://github.com/tempoxyz/tempo?rev=8bd4d01d37e3cc324030baacbce2da0862d7735a#8bd4d01d37e3cc324030baacbce2da0862d7735a" dependencies = [ "alloy", "proc-macro2", @@ -11442,7 +11442,7 @@ dependencies = [ [[package]] name = "tempo-primitives" version = "1.6.0" -source = "git+https://github.com/tempoxyz/tempo?rev=1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69#1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69" +source = "git+https://github.com/tempoxyz/tempo?rev=8bd4d01d37e3cc324030baacbce2da0862d7735a#8bd4d01d37e3cc324030baacbce2da0862d7735a" dependencies = [ "alloy-consensus", "alloy-eips 2.0.1", @@ -11473,7 +11473,7 @@ dependencies = [ [[package]] name = "tempo-revm" version = "1.6.0" -source = "git+https://github.com/tempoxyz/tempo?rev=1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69#1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69" +source = "git+https://github.com/tempoxyz/tempo?rev=8bd4d01d37e3cc324030baacbce2da0862d7735a#8bd4d01d37e3cc324030baacbce2da0862d7735a" dependencies = [ "alloy-consensus", "alloy-evm", @@ -11510,7 +11510,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8c27177b12a6399ffc08b98f76f7c9a1f4fe9fc967c784c5a071fa8d93cf7e1" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -11520,7 +11520,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874" dependencies = [ "rustix", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -12766,7 +12766,7 @@ dependencies = [ "watchexec-events", "watchexec-signals", "watchexec-supervisor", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -12916,7 +12916,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index c27286e7d6ba0..c412dad16366c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -515,17 +515,17 @@ mpp = { git = "https://github.com/tempoxyz/mpp-rs", rev = "554d20112eb014bd223d5 "reqwest-rustls-tls", "ws", ] } -tempo-chainspec = { git = "https://github.com/tempoxyz/tempo", rev = "1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69", default-features = false } -tempo-primitives = { git = "https://github.com/tempoxyz/tempo", rev = "1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69", default-features = false, features = [ +tempo-chainspec = { git = "https://github.com/tempoxyz/tempo", rev = "8bd4d01d37e3cc324030baacbce2da0862d7735a", default-features = false } +tempo-primitives = { git = "https://github.com/tempoxyz/tempo", rev = "8bd4d01d37e3cc324030baacbce2da0862d7735a", default-features = false, features = [ "serde", ] } -tempo-alloy = { git = "https://github.com/tempoxyz/tempo", rev = "1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69", default-features = false } -tempo-evm = { git = "https://github.com/tempoxyz/tempo", rev = "1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69", default-features = false } -tempo-revm = { git = "https://github.com/tempoxyz/tempo", rev = "1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69", default-features = false, features = [ +tempo-alloy = { git = "https://github.com/tempoxyz/tempo", rev = "8bd4d01d37e3cc324030baacbce2da0862d7735a", default-features = false } +tempo-evm = { git = "https://github.com/tempoxyz/tempo", rev = "8bd4d01d37e3cc324030baacbce2da0862d7735a", default-features = false } +tempo-revm = { git = "https://github.com/tempoxyz/tempo", rev = "8bd4d01d37e3cc324030baacbce2da0862d7735a", default-features = false, features = [ "serde", ] } -tempo-contracts = { git = "https://github.com/tempoxyz/tempo", rev = "1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69" } -tempo-precompiles = { git = "https://github.com/tempoxyz/tempo", rev = "1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69" } +tempo-contracts = { git = "https://github.com/tempoxyz/tempo", rev = "8bd4d01d37e3cc324030baacbce2da0862d7735a" } +tempo-precompiles = { git = "https://github.com/tempoxyz/tempo", rev = "8bd4d01d37e3cc324030baacbce2da0862d7735a" } ## Pinned dependencies. Enabled for the workspace in crates/test-utils. @@ -607,9 +607,9 @@ alloy-op-hardforks = { git = "https://github.com/ethereum-optimism/optimism", re # foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-core", rev = "2f90eb86d4549fa15a8cc2d99bfc1039bc083977" } ## tempo — unify crates.io versions (pulled by mpp) with git rev -tempo-primitives = { git = "https://github.com/tempoxyz/tempo", rev = "1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69" } -tempo-alloy = { git = "https://github.com/tempoxyz/tempo", rev = "1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69" } -tempo-contracts = { git = "https://github.com/tempoxyz/tempo", rev = "1e5a82dff207e2cbd6cecdcfb8ff3cd2e39baa69" } +tempo-primitives = { git = "https://github.com/tempoxyz/tempo", rev = "8bd4d01d37e3cc324030baacbce2da0862d7735a" } +tempo-alloy = { git = "https://github.com/tempoxyz/tempo", rev = "8bd4d01d37e3cc324030baacbce2da0862d7735a" } +tempo-contracts = { git = "https://github.com/tempoxyz/tempo", rev = "8bd4d01d37e3cc324030baacbce2da0862d7735a" } # solar solar = { package = "solar-compiler", git = "https://github.com/paradigmxyz/solar", rev = "530f129" } diff --git a/crates/cast/tests/cli/main.rs b/crates/cast/tests/cli/main.rs index da33a34d849db..b26bf9681f827 100644 --- a/crates/cast/tests/cli/main.rs +++ b/crates/cast/tests/cli/main.rs @@ -9,6 +9,7 @@ use alloy_rpc_types::{Authorization, BlockNumberOrTag, Index, TransactionRequest use alloy_signer::Signer; use alloy_signer_local::PrivateKeySigner; use anvil::NodeConfig; +use foundry_evm::hardfork::TempoHardfork; use foundry_test_utils::{ rpc::{ next_etherscan_api_key, next_http_archive_rpc_url, next_http_rpc_endpoint, @@ -18,8 +19,9 @@ use foundry_test_utils::{ str, util::OutputExt, }; +use serde::Deserialize; use serde_json::json; -use std::{fs, path::Path, str::FromStr}; +use std::{env, fs, path::Path, str::FromStr}; #[macro_use] extern crate foundry_test_utils; @@ -181,6 +183,83 @@ casttest!(block_raw, |_prj, cmd| { ); }); +casttest!(tempo_fork_schedule_parses_configured_rpcs, async |_prj, _cmd| { + #[derive(Debug, Deserialize)] + #[serde(rename_all = "camelCase")] + struct TempoForkSchedule { + schedule: Vec, + active: String, + } + + #[derive(Debug, Deserialize)] + #[serde(rename_all = "camelCase")] + struct ForkInfo { + name: String, + active: bool, + } + + let endpoints: Vec<_> = [ + ("mainnet", "TEMPO_MAINNET_RPC_URL"), + ("testnet", "TEMPO_TESTNET_RPC_URL"), + ("devnet", "TEMPO_DEVNET_RPC_URL"), + ] + .into_iter() + .filter_map(|(network, env_key)| { + env::var(env_key).ok().filter(|rpc| !rpc.is_empty()).map(|rpc| (network, env_key, rpc)) + }) + .collect(); + + if endpoints.is_empty() { + eprintln!( + "Skipping Tempo fork schedule compatibility test because no Tempo RPC env vars are set" + ); + return; + } + + for (network, env_key, rpc_url) in endpoints { + let provider = ProviderBuilder::new().connect_http(rpc_url.parse().unwrap()); + let schedule: TempoForkSchedule = provider + .raw_request("tempo_forkSchedule".into(), ()) + .await + .unwrap_or_else(|err| { + panic!( + "failed to fetch tempo_forkSchedule from {network} ({env_key}) at {rpc_url}: {err}" + ) + }); + + let active = schedule.active.parse::().unwrap_or_else(|_| { + panic!( + "{network} ({env_key}) reported active hardfork '{}' which this Foundry pin does not recognize", + schedule.active, + ) + }); + + let parsed_schedule: Vec<_> = schedule + .schedule + .iter() + .map(|fork| { + fork.name.parse::().unwrap_or_else(|_| { + panic!( + "{network} ({env_key}) reported fork '{}' in tempo_forkSchedule which this Foundry pin does not recognize", + fork.name, + ) + }) + }) + .collect(); + + assert!( + parsed_schedule.contains(&active), + "{network} ({env_key}) reported active hardfork '{}' that was not present in the parsed schedule", + schedule.active, + ); + assert!( + schedule.schedule.iter().any(|fork| fork.active && fork.name == schedule.active), + "{network} ({env_key}) returned an inconsistent tempo_forkSchedule response: active='{}' was not marked active in the schedule", + schedule.active, + ); + } +}); + casttest!(block_raw_tempo, |_prj, cmd| { // https://explore.tempo.xyz/block/8386710 let output = cmd From 972f800e334e5caa85ac2d315f7b20dc9ef36ff0 Mon Sep 17 00:00:00 2001 From: 0xrusowsky <0xrusowsky@proton.me> Date: Tue, 28 Apr 2026 13:48:56 +0200 Subject: [PATCH 2/3] test: cleanup + isolate on tempo mod --- Cargo.lock | 1 + crates/cast/tests/cli/main.rs | 79 +------------------------------- crates/common/Cargo.toml | 1 + crates/common/src/tempo/mod.rs | 3 ++ crates/common/src/tempo/tests.rs | 56 ++++++++++++++++++++++ 5 files changed, 62 insertions(+), 78 deletions(-) create mode 100644 crates/common/src/tempo/tests.rs diff --git a/Cargo.lock b/Cargo.lock index 488f3c852513c..6996d21b881d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5062,6 +5062,7 @@ dependencies = [ "foundry-common-fmt", "foundry-compilers", "foundry-config", + "foundry-evm-hardforks", "foundry-wallets", "futures", "itertools 0.14.0", diff --git a/crates/cast/tests/cli/main.rs b/crates/cast/tests/cli/main.rs index b26bf9681f827..ad4dd1326642e 100644 --- a/crates/cast/tests/cli/main.rs +++ b/crates/cast/tests/cli/main.rs @@ -9,7 +9,7 @@ use alloy_rpc_types::{Authorization, BlockNumberOrTag, Index, TransactionRequest use alloy_signer::Signer; use alloy_signer_local::PrivateKeySigner; use anvil::NodeConfig; -use foundry_evm::hardfork::TempoHardfork; +use eyre::{WrapErr, ensure, eyre}; use foundry_test_utils::{ rpc::{ next_etherscan_api_key, next_http_archive_rpc_url, next_http_rpc_endpoint, @@ -183,83 +183,6 @@ casttest!(block_raw, |_prj, cmd| { ); }); -casttest!(tempo_fork_schedule_parses_configured_rpcs, async |_prj, _cmd| { - #[derive(Debug, Deserialize)] - #[serde(rename_all = "camelCase")] - struct TempoForkSchedule { - schedule: Vec, - active: String, - } - - #[derive(Debug, Deserialize)] - #[serde(rename_all = "camelCase")] - struct ForkInfo { - name: String, - active: bool, - } - - let endpoints: Vec<_> = [ - ("mainnet", "TEMPO_MAINNET_RPC_URL"), - ("testnet", "TEMPO_TESTNET_RPC_URL"), - ("devnet", "TEMPO_DEVNET_RPC_URL"), - ] - .into_iter() - .filter_map(|(network, env_key)| { - env::var(env_key).ok().filter(|rpc| !rpc.is_empty()).map(|rpc| (network, env_key, rpc)) - }) - .collect(); - - if endpoints.is_empty() { - eprintln!( - "Skipping Tempo fork schedule compatibility test because no Tempo RPC env vars are set" - ); - return; - } - - for (network, env_key, rpc_url) in endpoints { - let provider = ProviderBuilder::new().connect_http(rpc_url.parse().unwrap()); - let schedule: TempoForkSchedule = provider - .raw_request("tempo_forkSchedule".into(), ()) - .await - .unwrap_or_else(|err| { - panic!( - "failed to fetch tempo_forkSchedule from {network} ({env_key}) at {rpc_url}: {err}" - ) - }); - - let active = schedule.active.parse::().unwrap_or_else(|_| { - panic!( - "{network} ({env_key}) reported active hardfork '{}' which this Foundry pin does not recognize", - schedule.active, - ) - }); - - let parsed_schedule: Vec<_> = schedule - .schedule - .iter() - .map(|fork| { - fork.name.parse::().unwrap_or_else(|_| { - panic!( - "{network} ({env_key}) reported fork '{}' in tempo_forkSchedule which this Foundry pin does not recognize", - fork.name, - ) - }) - }) - .collect(); - - assert!( - parsed_schedule.contains(&active), - "{network} ({env_key}) reported active hardfork '{}' that was not present in the parsed schedule", - schedule.active, - ); - assert!( - schedule.schedule.iter().any(|fork| fork.active && fork.name == schedule.active), - "{network} ({env_key}) returned an inconsistent tempo_forkSchedule response: active='{}' was not marked active in the schedule", - schedule.active, - ); - } -}); - casttest!(block_raw_tempo, |_prj, cmd| { // https://explore.tempo.xyz/block/8386710 let output = cmd diff --git a/crates/common/Cargo.toml b/crates/common/Cargo.toml index 51115fb4a0bae..7fd94c07242e8 100644 --- a/crates/common/Cargo.toml +++ b/crates/common/Cargo.toml @@ -92,6 +92,7 @@ chrono.workspace = true vergen = { workspace = true, features = ["build", "emit_and_set"] } [dev-dependencies] +foundry-evm-hardforks.workspace = true tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } axum = { workspace = true } tempfile.workspace = true diff --git a/crates/common/src/tempo/mod.rs b/crates/common/src/tempo/mod.rs index ef7be1b8e189e..ec51dc607b5ab 100644 --- a/crates/common/src/tempo/mod.rs +++ b/crates/common/src/tempo/mod.rs @@ -3,6 +3,9 @@ mod keystore; pub use keystore::*; +#[cfg(test)] +mod tests; + /// Conservative gas buffer for browser wallet transactions on Tempo chains. /// /// Browser wallets may sign with P256 or WebAuthn instead of secp256k1, which costs more gas diff --git a/crates/common/src/tempo/tests.rs b/crates/common/src/tempo/tests.rs new file mode 100644 index 0000000000000..e00c6c46e0982 --- /dev/null +++ b/crates/common/src/tempo/tests.rs @@ -0,0 +1,56 @@ +use alloy_provider::{Provider, ProviderBuilder}; +use eyre::WrapErr; +use foundry_evm_hardforks::TempoHardfork; +use serde::Deserialize; +use std::env; + +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +struct TempoForkSchedule { + schedule: Vec, + #[allow(dead_code)] + active: String, +} + +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +struct ForkInfo { + name: String, +} + +async fn check_fork_schedule(rpc_url: &str) -> eyre::Result<()> { + let provider = ProviderBuilder::new().connect_http(rpc_url.parse()?); + let schedule: TempoForkSchedule = + provider.raw_request("tempo_forkSchedule".into(), ()).await?; + for fork in &schedule.schedule { + fork.name.parse::()?; + } + Ok(()) +} + +#[tokio::test(flavor = "multi_thread")] +async fn test_fork_schedule_parses_configured_rpcs() -> eyre::Result<()> { + let mut checked_any = false; + + for (network, env_key) in [ + ("mainnet", "TEMPO_MAINNET_RPC_URL"), + ("testnet", "TEMPO_TESTNET_RPC_URL"), + ("devnet", "TEMPO_DEVNET_RPC_URL"), + ] { + let rpc_url = match env::var(env_key) { + Ok(url) if !url.is_empty() => url, + _ => continue, + }; + checked_any = true; + + check_fork_schedule(&rpc_url) + .await + .wrap_err_with(|| format!("[{network}] {env_key}={rpc_url}"))?; + } + + if !checked_any { + eprintln!("Missing Tempo RPC env vars. Skipping Tempo fork schedule compatibility test."); + } + + Ok(()) +} From 132816dc5c8e3601ba1081e88127942b6181229c Mon Sep 17 00:00:00 2001 From: 0xrusowsky <0xrusowsky@proton.me> Date: Tue, 28 Apr 2026 13:49:15 +0200 Subject: [PATCH 3/3] style: fmt --- crates/common/src/tempo/tests.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/common/src/tempo/tests.rs b/crates/common/src/tempo/tests.rs index e00c6c46e0982..19087a93a9e21 100644 --- a/crates/common/src/tempo/tests.rs +++ b/crates/common/src/tempo/tests.rs @@ -20,8 +20,7 @@ struct ForkInfo { async fn check_fork_schedule(rpc_url: &str) -> eyre::Result<()> { let provider = ProviderBuilder::new().connect_http(rpc_url.parse()?); - let schedule: TempoForkSchedule = - provider.raw_request("tempo_forkSchedule".into(), ()).await?; + let schedule: TempoForkSchedule = provider.raw_request("tempo_forkSchedule".into(), ()).await?; for fork in &schedule.schedule { fork.name.parse::()?; }