Skip to content

Commit

Permalink
fix: nits
Browse files Browse the repository at this point in the history
  • Loading branch information
nhtyy committed Sep 24, 2024
1 parent 82b555c commit 7662cbf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
3 changes: 1 addition & 2 deletions crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
18 changes: 17 additions & 1 deletion crates/anvil/tests/it/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
8 changes: 4 additions & 4 deletions crates/test-utils/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7662cbf

Please # to comment.