Skip to content

Commit

Permalink
test: add arbitrum fork test (#6800)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jan 15, 2024
1 parent c5fd67b commit 95e8385
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/anvil/src/eth/backend/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,9 @@ impl ClientFork {
#[derive(Clone, Debug)]
pub struct ClientForkConfig {
pub eth_rpc_url: String,
/// The block number of the forked block
pub block_number: u64,
/// The hash of the forked block
pub block_hash: B256,
// TODO make provider agnostic
pub provider: Arc<RetryProvider>,
Expand Down
18 changes: 18 additions & 0 deletions crates/anvil/tests/it/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,3 +1092,21 @@ async fn test_fork_reset_basefee() {
// basefee of the forked block: <https://etherscan.io/block/18835000>
assert_eq!(latest.header.base_fee_per_gas.unwrap(), rU256::from(59017001138u64));
}

// <https://github.com/foundry-rs/foundry/issues/6795>
#[tokio::test(flavor = "multi_thread")]
async fn test_arbitrum_fork_dev_balance() {
let (api, handle) = spawn(
fork_config()
.with_fork_block_number(None::<u64>)
.with_eth_rpc_url(Some("https://arb1.arbitrum.io/rpc".to_string())),
)
.await;

let accounts: Vec<_> = handle.dev_wallets().collect();
for acc in accounts {
let balance =
api.balance(acc.address().to_alloy(), Some(Default::default())).await.unwrap();
assert_eq!(balance, rU256::from(100000000000000000000u128));
}
}

0 comments on commit 95e8385

Please sign in to comment.