Skip to content

Commit

Permalink
test: use alchemy for arbitrum URLs (#8859)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Sep 12, 2024
1 parent fb9dbba commit c6d342d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 4 additions & 4 deletions crates/anvil/tests/it/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ 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())),
.with_eth_rpc_url(Some(next_rpc_endpoint(NamedChain::Arbitrum))),
)
.await;

Expand All @@ -1174,7 +1174,7 @@ async fn test_arbitrum_fork_block_number() {
let (_, handle) = spawn(
fork_config()
.with_fork_block_number(None::<u64>)
.with_eth_rpc_url(Some("https://arb1.arbitrum.io/rpc".to_string())),
.with_eth_rpc_url(Some(next_rpc_endpoint(NamedChain::Arbitrum))),
)
.await;
let provider = handle.http_provider();
Expand All @@ -1186,7 +1186,7 @@ async fn test_arbitrum_fork_block_number() {
let (api, _) = spawn(
fork_config()
.with_fork_block_number(Some(initial_block_number))
.with_eth_rpc_url(Some("https://arb1.arbitrum.io/rpc".to_string())),
.with_eth_rpc_url(Some(next_rpc_endpoint(NamedChain::Arbitrum))),
)
.await;
let block_number = api.block_number().unwrap().to::<u64>();
Expand All @@ -1212,7 +1212,7 @@ async fn test_arbitrum_fork_block_number() {

// reset fork to different block number and compare with block returned by `eth_blockNumber`
api.anvil_reset(Some(Forking {
json_rpc_url: Some("https://arb1.arbitrum.io/rpc".to_string()),
json_rpc_url: Some(next_rpc_endpoint(NamedChain::Arbitrum)),
block_number: Some(initial_block_number - 2),
}))
.await
Expand Down
8 changes: 3 additions & 5 deletions crates/cast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1648,12 +1648,10 @@ impl SimpleCast {
/// ```
pub fn abi_encode(sig: &str, args: &[impl AsRef<str>]) -> Result<String> {
let func = get_func(sig)?;
let calldata = match encode_function_args(&func, args) {
Ok(res) => hex::encode(res),
match encode_function_args(&func, args) {
Ok(res) => Ok(hex::encode_prefixed(&res[4..])),
Err(e) => eyre::bail!("Could not ABI encode the function and arguments. Did you pass in the right types?\nError\n{}", e),
};
let encoded = &calldata[8..];
Ok(format!("0x{encoded}"))
}
}

/// Performs packed ABI encoding based off of the function signature or tuple.
Expand Down

0 comments on commit c6d342d

Please sign in to comment.