diff --git a/crates/anvil/src/eth/backend/mem/mod.rs b/crates/anvil/src/eth/backend/mem/mod.rs index 4144b0d53b738..0a11fb38c9fc1 100644 --- a/crates/anvil/src/eth/backend/mem/mod.rs +++ b/crates/anvil/src/eth/backend/mem/mod.rs @@ -441,8 +441,7 @@ impl Backend { *self.fork.write() = Some(fork); *self.env.write() = env; } else { - let gas_limit = - self.node_config.read().await.clone().fork_gas_limit(&fork_block); + let gas_limit = self.node_config.read().await.fork_gas_limit(&fork_block); let mut env = self.env.write(); env.cfg.chain_id = fork.chain_id(); diff --git a/crates/anvil/tests/it/fork.rs b/crates/anvil/tests/it/fork.rs index e118adc6415e8..8d5b0c588d184 100644 --- a/crates/anvil/tests/it/fork.rs +++ b/crates/anvil/tests/it/fork.rs @@ -69,10 +69,26 @@ async fn test_fork_gas_limit_applied_from_config() { #[tokio::test(flavor = "multi_thread")] async fn test_fork_gas_limit_disabled_from_config() { - let (api, _handle) = spawn(fork_config().disable_block_gas_limit(true)).await; + let (api, handle) = spawn(fork_config().disable_block_gas_limit(true)).await; // see https://github.com/foundry-rs/foundry/pull/8933 assert_eq!(api.gas_limit(), U256::from(U64::MAX)); + + // try to mine a couple blocks + let provider = handle.http_provider(); + let tx = TransactionRequest::default() + .to(Address::random()) + .value(U256::from(1337u64)) + .from(handle.dev_wallets().next().unwrap().address()); + let tx = WithOtherFields::new(tx); + let _ = provider.send_transaction(tx).await.unwrap().get_receipt().await.unwrap(); + + let tx = TransactionRequest::default() + .to(Address::random()) + .value(U256::from(1337u64)) + .from(handle.dev_wallets().next().unwrap().address()); + let tx = WithOtherFields::new(tx); + let _ = provider.send_transaction(tx).await.unwrap().get_receipt().await.unwrap(); } #[tokio::test(flavor = "multi_thread")] diff --git a/crates/test-utils/src/rpc.rs b/crates/test-utils/src/rpc.rs index 1839843c2e54f..6f91be10ff70e 100644 --- a/crates/test-utils/src/rpc.rs +++ b/crates/test-utils/src/rpc.rs @@ -130,15 +130,15 @@ pub fn next_mainnet_etherscan_api_key() -> String { fn next_url(is_ws: bool, chain: NamedChain) -> String { use NamedChain::*; + if matches!(chain, NamedChain::Base) { + return "https://mainnet.base.org".to_string(); + } + let idx = next() % num_keys(); let is_infura = idx < INFURA_KEYS.len(); let key = if is_infura { INFURA_KEYS[idx] } else { ALCHEMY_KEYS[idx - INFURA_KEYS.len()] }; - if matches!(chain, NamedChain::Base) { - return "https://mainnet.base.org".to_string(); - } - // Nowhere near complete. let prefix = if is_infura { match chain {