Skip to content

Commit c6d342d

Browse files
authored
test: use alchemy for arbitrum URLs (#8859)
1 parent fb9dbba commit c6d342d

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

crates/anvil/tests/it/fork.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ async fn test_arbitrum_fork_dev_balance() {
11561156
let (api, handle) = spawn(
11571157
fork_config()
11581158
.with_fork_block_number(None::<u64>)
1159-
.with_eth_rpc_url(Some("https://arb1.arbitrum.io/rpc".to_string())),
1159+
.with_eth_rpc_url(Some(next_rpc_endpoint(NamedChain::Arbitrum))),
11601160
)
11611161
.await;
11621162

@@ -1174,7 +1174,7 @@ async fn test_arbitrum_fork_block_number() {
11741174
let (_, handle) = spawn(
11751175
fork_config()
11761176
.with_fork_block_number(None::<u64>)
1177-
.with_eth_rpc_url(Some("https://arb1.arbitrum.io/rpc".to_string())),
1177+
.with_eth_rpc_url(Some(next_rpc_endpoint(NamedChain::Arbitrum))),
11781178
)
11791179
.await;
11801180
let provider = handle.http_provider();
@@ -1186,7 +1186,7 @@ async fn test_arbitrum_fork_block_number() {
11861186
let (api, _) = spawn(
11871187
fork_config()
11881188
.with_fork_block_number(Some(initial_block_number))
1189-
.with_eth_rpc_url(Some("https://arb1.arbitrum.io/rpc".to_string())),
1189+
.with_eth_rpc_url(Some(next_rpc_endpoint(NamedChain::Arbitrum))),
11901190
)
11911191
.await;
11921192
let block_number = api.block_number().unwrap().to::<u64>();
@@ -1212,7 +1212,7 @@ async fn test_arbitrum_fork_block_number() {
12121212

12131213
// reset fork to different block number and compare with block returned by `eth_blockNumber`
12141214
api.anvil_reset(Some(Forking {
1215-
json_rpc_url: Some("https://arb1.arbitrum.io/rpc".to_string()),
1215+
json_rpc_url: Some(next_rpc_endpoint(NamedChain::Arbitrum)),
12161216
block_number: Some(initial_block_number - 2),
12171217
}))
12181218
.await

crates/cast/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,12 +1648,10 @@ impl SimpleCast {
16481648
/// ```
16491649
pub fn abi_encode(sig: &str, args: &[impl AsRef<str>]) -> Result<String> {
16501650
let func = get_func(sig)?;
1651-
let calldata = match encode_function_args(&func, args) {
1652-
Ok(res) => hex::encode(res),
1651+
match encode_function_args(&func, args) {
1652+
Ok(res) => Ok(hex::encode_prefixed(&res[4..])),
16531653
Err(e) => eyre::bail!("Could not ABI encode the function and arguments. Did you pass in the right types?\nError\n{}", e),
1654-
};
1655-
let encoded = &calldata[8..];
1656-
Ok(format!("0x{encoded}"))
1654+
}
16571655
}
16581656

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

0 commit comments

Comments
 (0)