diff --git a/scripts/tests/api_compare/.env b/scripts/tests/api_compare/.env index dfad69fbd34f..a393f0fc0bb0 100644 --- a/scripts/tests/api_compare/.env +++ b/scripts/tests/api_compare/.env @@ -1,6 +1,6 @@ # Note: this should be a `fat` image so that it contains the pre-downloaded filecoin proof parameters FOREST_IMAGE=ghcr.io/chainsafe/forest:edge-fat -LOTUS_IMAGE=filecoin/lotus-all-in-one:82ce112b1-calibnet +LOTUS_IMAGE=filecoin/lotus-all-in-one:72ac4c059-calibnet FIL_PROOFS_PARAMETER_CACHE=/var/tmp/filecoin-proof-parameters LOTUS_RPC_PORT=1234 LOTUS_VIA_GATEWAY_RPC_PORT=4568 diff --git a/src/tool/subcommands/api_cmd/api_compare_tests.rs b/src/tool/subcommands/api_cmd/api_compare_tests.rs index 529539524b5c..76ff27b83c63 100644 --- a/src/tool/subcommands/api_cmd/api_compare_tests.rs +++ b/src/tool/subcommands/api_cmd/api_compare_tests.rs @@ -73,6 +73,12 @@ const COLLECTION_SAMPLE_SIZE: usize = 5; const SAFE_EPOCH_DELAY_FOR_TESTING: i64 = 20; // `SAFE_HEIGHT_DISTANCE`(200) is too large for testing const MESSAGE_LOOKBACK_LIMIT: i64 = 2000; +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum ServerMode { + Online, + Offline, +} + /// This address has been funded by the calibnet faucet and the private keys /// has been discarded. It should always have a non-zero balance. static KNOWN_CALIBNET_ADDRESS: LazyLock
= LazyLock::new(|| { @@ -482,18 +488,20 @@ fn common_tests() -> Vec { ] } -fn chain_tests(offline: bool) -> Vec { +fn chain_tests(server_mode: ServerMode) -> Vec { vec![ RpcTest::identity(ChainGetGenesis::request(()).unwrap()), - if offline { - RpcTest::basic(ChainHead::request(()).unwrap()) - } else { - RpcTest::identity(ChainHead::request(()).unwrap()) + match server_mode { + ServerMode::Offline => RpcTest::basic(ChainHead::request(()).unwrap()), + ServerMode::Online => RpcTest::identity(ChainHead::request(()).unwrap()), }, - if offline { - RpcTest::basic(ChainGetTipSetFinalityStatus::request(()).unwrap()) - } else { - RpcTest::identity(ChainGetTipSetFinalityStatus::request(()).unwrap()) + match server_mode { + ServerMode::Offline => { + RpcTest::basic(ChainGetTipSetFinalityStatus::request(()).unwrap()) + } + ServerMode::Online => { + RpcTest::identity(ChainGetTipSetFinalityStatus::request(()).unwrap()) + } }, RpcTest::basic(ChainGetFinalizedTipset::request(()).unwrap()), ] @@ -1384,17 +1392,21 @@ fn wallet_tests(worker_address: Option
) -> Vec { tests } -fn eth_tests() -> anyhow::Result> { +fn eth_tests(server_mode: ServerMode) -> anyhow::Result> { let mut tests = vec![]; for use_alias in [false, true] { tests.push(RpcTest::identity(EthAccounts::request_with_alias( (), use_alias, )?)); - tests.push(RpcTest::basic(EthBlockNumber::request_with_alias( - (), - use_alias, - )?)); + tests.push(match server_mode { + ServerMode::Online => { + RpcTest::identity(EthBlockNumber::request_with_alias((), use_alias)?) + } + ServerMode::Offline => { + RpcTest::basic(EthBlockNumber::request_with_alias((), use_alias)?) + } + }); tests.push(RpcTest::identity(EthChainId::request_with_alias( (), use_alias, @@ -1434,6 +1446,10 @@ fn eth_tests() -> anyhow::Result> { (), use_alias, )?)); + tests.push(match server_mode { + ServerMode::Online => RpcTest::identity(EthBaseFee::request_with_alias((), use_alias)?), + ServerMode::Offline => RpcTest::basic(EthBaseFee::request_with_alias((), use_alias)?), + }); let cases = [ ( @@ -2520,15 +2536,20 @@ pub(super) async fn create_tests( snapshot_files, }: CreateTestsArgs, ) -> anyhow::Result> { + let server_mode = if offline { + ServerMode::Offline + } else { + ServerMode::Online + }; let mut tests = vec![]; tests.extend(auth_tests()?); tests.extend(common_tests()); - tests.extend(chain_tests(offline)); + tests.extend(chain_tests(server_mode)); tests.extend(mpool_tests()); tests.extend(net_tests()); tests.extend(node_tests()); tests.extend(wallet_tests(worker_address)); - tests.extend(eth_tests()?); + tests.extend(eth_tests(server_mode)?); tests.extend(f3_tests()?); if !snapshot_files.is_empty() { let store = Arc::new(ManyCar::try_from(snapshot_files.clone())?); diff --git a/src/tool/subcommands/api_cmd/test_snapshots.txt b/src/tool/subcommands/api_cmd/test_snapshots.txt index b2ef48970494..72b7f850012b 100644 --- a/src/tool/subcommands/api_cmd/test_snapshots.txt +++ b/src/tool/subcommands/api_cmd/test_snapshots.txt @@ -48,6 +48,7 @@ filecoin_eam_statedecodeparams_1756139121347364.rpcsnap.json.zst filecoin_ethaccount_statedecodeparams_1756186350854913.rpcsnap.json.zst filecoin_ethaccounts_1737446676689764.rpcsnap.json.zst filecoin_ethaddresstofilecoinaddress_1740132538465536.rpcsnap.json.zst +filecoin_ethbasefee_1778755118342258.rpcsnap.json.zst filecoin_ethblocknumber_1741272348346171.rpcsnap.json.zst filecoin_ethcall_1744204533050503.rpcsnap.json.zst filecoin_ethcall_1744204533058637.rpcsnap.json.zst diff --git a/src/tool/subcommands/api_cmd/test_snapshots_ignored.txt b/src/tool/subcommands/api_cmd/test_snapshots_ignored.txt index 4e7fd4ab7fbb..d2181d5ccc37 100644 --- a/src/tool/subcommands/api_cmd/test_snapshots_ignored.txt +++ b/src/tool/subcommands/api_cmd/test_snapshots_ignored.txt @@ -15,7 +15,6 @@ Filecoin.ChainExport Filecoin.ChainGetEvents Filecoin.ChainGetFinalizedTipset Filecoin.ChainSetHead -Filecoin.EthBaseFee Filecoin.EthEstimateGas Filecoin.EthGetFilterChanges Filecoin.EthGetFilterLogs