Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add arbitrum fork test #6800

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
}
}