Skip to content

Commit

Permalink
Revert "bump alloy f415827"
Browse files Browse the repository at this point in the history
This reverts commit 48e5d11.
  • Loading branch information
yash-atreya committed May 16, 2024
1 parent 48e5d11 commit 20feac7
Show file tree
Hide file tree
Showing 16 changed files with 145 additions and 270 deletions.
217 changes: 69 additions & 148 deletions Cargo.lock

Large diffs are not rendered by default.

51 changes: 24 additions & 27 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -152,29 +152,29 @@ revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev =
ethers-contract-abigen = { version = "2.0.14", default-features = false }

## alloy
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-contract = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-signer-aws = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-signer-ledger = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-signer-trezor = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "f415827", default-features = false }
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-contract = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-signer-aws = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-signer-ledger = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-signer-trezor = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "899fc51", default-features = false }
alloy-primitives = { version = "0.7.1", features = ["getrandom"] }
alloy-dyn-abi = "0.7.1"
alloy-json-abi = "0.7.1"
Expand All @@ -188,10 +188,7 @@ solang-parser = "=0.3.3"
## misc
arrayvec = "0.7"
base64 = "0.22"
chrono = { version = "0.4", default-features = false, features = [
"clock",
"std",
] }
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
color-eyre = "0.6"
derive_more = "0.99"
evm-disassembler = "0.5"
Expand Down
19 changes: 7 additions & 12 deletions crates/anvil/src/eth/backend/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ impl ClientFork {
keys: Vec<B256>,
block_number: Option<BlockId>,
) -> Result<EIP1186AccountProofResponse, TransportError> {
self.provider()
.get_proof(address, keys)
.block_id(block_number.unwrap_or(BlockId::latest()))
.await
self.provider().get_proof(address, keys, block_number.unwrap_or(BlockId::latest())).await
}

/// Sends `eth_call`
Expand All @@ -188,7 +185,7 @@ impl ClientFork {
block: Option<BlockNumber>,
) -> Result<u128, TransportError> {
let block = block.unwrap_or(BlockNumber::Latest);
let res = self.provider().estimate_gas(request).block_id(block.into()).await?;
let res = self.provider().estimate_gas(request, block.into()).await?;

Ok(res)
}
Expand All @@ -200,8 +197,7 @@ impl ClientFork {
block: Option<BlockNumber>,
) -> Result<AccessListWithGasUsed, TransportError> {
self.provider()
.create_access_list(request)
.block_id(block.unwrap_or(BlockNumber::Latest).into())
.create_access_list(request, block.unwrap_or(BlockNumber::Latest).into())
.await
}

Expand All @@ -212,8 +208,7 @@ impl ClientFork {
number: Option<BlockNumber>,
) -> Result<StorageValue, TransportError> {
self.provider()
.get_storage_at(address, index)
.block_id(number.unwrap_or(BlockNumber::Latest).into())
.get_storage_at(address, index, number.unwrap_or(BlockNumber::Latest).into())
.await
}

Expand Down Expand Up @@ -241,7 +236,7 @@ impl ClientFork {

let block_id = BlockId::Number(blocknumber.into());

let code = self.provider().get_code_at(address).block_id(block_id).await?;
let code = self.provider().get_code_at(address, block_id).await?;

let mut storage = self.storage_write();
storage.code_at.insert((address, blocknumber), code.clone().0.into());
Expand All @@ -255,12 +250,12 @@ impl ClientFork {
blocknumber: u64,
) -> Result<U256, TransportError> {
trace!(target: "backend::fork", "get_balance={:?}", address);
self.provider().get_balance(address).block_id(blocknumber.into()).await
self.provider().get_balance(address, blocknumber.into()).await
}

pub async fn get_nonce(&self, address: Address, block: u64) -> Result<u64, TransportError> {
trace!(target: "backend::fork", "get_nonce={:?}", address);
self.provider().get_transaction_count(address).block_id(block.into()).await
self.provider().get_transaction_count(address, block.into()).await
}

pub async fn transaction_by_block_number_and_index(
Expand Down
2 changes: 1 addition & 1 deletion crates/cast/bin/cmd/estimate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl EstimateArgs {

req.set_input(data);

let gas = provider.estimate_gas(&req).block_id(BlockId::latest()).await?;
let gas = provider.estimate_gas(&req, BlockId::latest()).await?;
println!("{gas}");
Ok(())
}
Expand Down
5 changes: 2 additions & 3 deletions crates/cast/bin/cmd/mktx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ impl MakeTxArgs {
tx::validate_from_address(eth.wallet.from, from)?;

if resend {
tx.nonce = Some(U64::from(
provider.get_transaction_count(from).block_id(BlockId::latest()).await?,
));
tx.nonce =
Some(U64::from(provider.get_transaction_count(from, BlockId::latest()).await?));
}

let provider = get_provider(&config)?;
Expand Down
10 changes: 3 additions & 7 deletions crates/cast/bin/cmd/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,7 @@ impl SendTxArgs {

if resend {
tx.nonce = Some(U64::from(
provider
.get_transaction_count(config.sender)
.block_id(BlockId::latest())
.await?,
provider.get_transaction_count(config.sender, BlockId::latest()).await?,
));
}

Expand Down Expand Up @@ -178,9 +175,8 @@ impl SendTxArgs {
tx::validate_from_address(eth.wallet.from, from)?;

if resend {
tx.nonce = Some(U64::from(
provider.get_transaction_count(from).block_id(BlockId::latest()).await?,
));
tx.nonce =
Some(U64::from(provider.get_transaction_count(from, BlockId::latest()).await?));
}

let signer = EthereumSigner::from(signer);
Expand Down
9 changes: 3 additions & 6 deletions crates/cast/bin/cmd/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ impl StorageArgs {

// No slot was provided
// Get deployed bytecode at given address
let address_code =
provider.get_code_at(address).block_id(block.unwrap_or_default()).await?;
let address_code = provider.get_code_at(address, block.unwrap_or_default()).await?;
if address_code.is_empty() {
eyre::bail!("Provided address has no deployed code and thus no storage");
}
Expand Down Expand Up @@ -238,10 +237,8 @@ async fn fetch_storage_slots<P: Provider<T, AnyNetwork>, T: Transport + Clone>(
) -> Result<Vec<StorageValue>> {
let requests = layout.storage.iter().map(|storage_slot| async {
let slot = B256::from(U256::from_str(&storage_slot.slot)?);
let raw_slot_value = provider
.get_storage_at(address, slot.into())
.block_id(block.unwrap_or_default())
.await?;
let raw_slot_value =
provider.get_storage_at(address, slot.into(), block.unwrap_or_default()).await?;

let value = StorageValue { slot, raw_slot_value: raw_slot_value.into() };

Expand Down
3 changes: 1 addition & 2 deletions crates/cast/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,7 @@ async fn main() -> Result<()> {
let provider = utils::get_provider(&config)?;
let address = address.resolve(&provider).await?;
let value = provider
.get_proof(address, slots.into_iter().collect())
.block_id(block.unwrap_or(BlockId::latest()))
.get_proof(address, slots.into_iter().collect(), block.unwrap_or(BlockId::latest()))
.await?;
println!("{}", serde_json::to_string(&value)?);
}
Expand Down
4 changes: 2 additions & 2 deletions crates/cast/bin/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub async fn build_tx<
req.set_nonce(if let Some(nonce) = tx.nonce {
nonce.to()
} else {
provider.get_transaction_count(from).block_id(BlockId::latest()).await?
provider.get_transaction_count(from, BlockId::latest()).await?
});

if tx.legacy || chain.is_legacy() {
Expand Down Expand Up @@ -119,7 +119,7 @@ pub async fn build_tx<
req.set_gas_limit(if let Some(gas_limit) = tx.gas_limit {
gas_limit.to()
} else {
provider.estimate_gas(&req).block_id(BlockId::latest()).await?
provider.estimate_gas(&req, BlockId::latest()).await?
});

Ok((req, func))
Expand Down
42 changes: 12 additions & 30 deletions crates/cast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,8 @@ where
if res.is_empty() {
// check that the recipient is a contract that can be called
if let Some(TxKind::Call(addr)) = req.to {
if let Ok(code) = self
.provider
.get_code_at(addr)
.block_id(block.unwrap_or_default())
.await
if let Ok(code) =
self.provider.get_code_at(addr, block.unwrap_or_default()).await
{
if code.is_empty() {
eyre::bail!("contract {addr:?} does not have any code")
Expand Down Expand Up @@ -200,11 +197,8 @@ where
block: Option<BlockId>,
to_json: bool,
) -> Result<String> {
let access_list = self
.provider
.create_access_list(req)
.block_id(block.unwrap_or(BlockId::latest()))
.await?;
let access_list =
self.provider.create_access_list(req, block.unwrap_or(BlockId::latest())).await?;
let res = if to_json {
serde_json::to_string(&access_list)?
} else {
Expand All @@ -226,7 +220,7 @@ where
}

pub async fn balance(&self, who: Address, block: Option<BlockId>) -> Result<U256> {
Ok(self.provider.get_balance(who).block_id(block.unwrap_or(BlockId::latest())).await?)
Ok(self.provider.get_balance(who, block.unwrap_or(BlockId::latest())).await?)
}

/// Sends a transaction to the specified address
Expand Down Expand Up @@ -478,11 +472,7 @@ where
/// # }
/// ```
pub async fn nonce(&self, who: Address, block: Option<BlockId>) -> Result<u64> {
Ok(self
.provider
.get_transaction_count(who)
.block_id(block.unwrap_or(BlockId::latest()))
.await?)
Ok(self.provider.get_transaction_count(who, block.unwrap_or(BlockId::latest())).await?)
}

/// # Example
Expand All @@ -508,8 +498,7 @@ where
B256::from_str("0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc")?;
let value = self
.provider
.get_storage_at(who, slot.into())
.block_id(block.unwrap_or(BlockId::latest()))
.get_storage_at(who, slot.into(), block.unwrap_or(BlockId::latest()))
.await?;
let addr = Address::from_word(value.into());
Ok(format!("{addr:?}"))
Expand Down Expand Up @@ -538,8 +527,7 @@ where
B256::from_str("0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103")?;
let value = self
.provider
.get_storage_at(who, slot.into())
.block_id(block.unwrap_or(BlockId::latest()))
.get_storage_at(who, slot.into(), block.unwrap_or(BlockId::latest()))
.await?;
let addr = Address::from_word(value.into());
Ok(format!("{addr:?}"))
Expand Down Expand Up @@ -593,14 +581,10 @@ where
disassemble: bool,
) -> Result<String> {
if disassemble {
let code =
self.provider.get_code_at(who).block_id(block.unwrap_or_default()).await?.to_vec();
let code = self.provider.get_code_at(who, block.unwrap_or_default()).await?.to_vec();
Ok(format_operations(disassemble_bytes(code)?)?)
} else {
Ok(format!(
"{}",
self.provider.get_code_at(who).block_id(block.unwrap_or_default()).await?
))
Ok(format!("{}", self.provider.get_code_at(who, block.unwrap_or_default()).await?))
}
}

Expand All @@ -623,8 +607,7 @@ where
/// # }
/// ```
pub async fn codesize(&self, who: Address, block: Option<BlockId>) -> Result<String> {
let code =
self.provider.get_code_at(who).block_id(block.unwrap_or_default()).await?.to_vec();
let code = self.provider.get_code_at(who, block.unwrap_or_default()).await?.to_vec();
Ok(format!("{}", code.len()))
}

Expand Down Expand Up @@ -790,8 +773,7 @@ where
"{:?}",
B256::from(
self.provider
.get_storage_at(from, slot.into())
.block_id(block.unwrap_or_default())
.get_storage_at(from, slot.into(), block.unwrap_or(BlockId::latest()))
.await?
)
))
Expand Down
14 changes: 5 additions & 9 deletions crates/evm/core/src/fork/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use revm::{
use rustc_hash::FxHashMap;
use std::{
collections::{hash_map::Entry, HashMap, VecDeque},
future::IntoFuture,
marker::PhantomData,
pin::Pin,
sync::{
Expand Down Expand Up @@ -190,11 +189,8 @@ where
let provider = self.provider.clone();
let block_id = self.block_id.unwrap_or(BlockId::latest());
let fut = Box::pin(async move {
let storage = provider
.get_storage_at(address, idx)
.block_id(block_id)
.await
.map_err(Into::into);
let storage =
provider.get_storage_at(address, idx, block_id).await.map_err(Into::into);
(storage, address, idx)
});
self.pending_requests.push(ProviderRequest::Storage(fut));
Expand All @@ -208,9 +204,9 @@ where
let provider = self.provider.clone();
let block_id = self.block_id.unwrap_or(BlockId::latest());
let fut = Box::pin(async move {
let balance = provider.get_balance(address).block_id(block_id).into_future();
let nonce = provider.get_transaction_count(address).block_id(block_id).into_future();
let code = provider.get_code_at(address).block_id(block_id).into_future();
let balance = provider.get_balance(address, block_id);
let nonce = provider.get_transaction_count(address, block_id);
let code = provider.get_code_at(address, block_id);
let resp = tokio::try_join!(balance, nonce, code).map_err(Into::into);
(resp, address)
});
Expand Down
4 changes: 2 additions & 2 deletions crates/forge/bin/cmd/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl CreateArgs {
deployer.tx.set_nonce(if let Some(nonce) = self.tx.nonce {
Ok(nonce.to())
} else {
provider.get_transaction_count(deployer_address).block_id(BlockId::latest()).await
provider.get_transaction_count(deployer_address, BlockId::latest()).await
}?);

// set tx value if specified
Expand All @@ -250,7 +250,7 @@ impl CreateArgs {
deployer.tx.set_gas_limit(if let Some(gas_limit) = self.tx.gas_limit {
Ok(gas_limit.to())
} else {
provider.estimate_gas(&deployer.tx).block_id(BlockId::latest()).await
provider.estimate_gas(&deployer.tx, BlockId::latest()).await
}?);

if is_legacy {
Expand Down
Loading

0 comments on commit 20feac7

Please sign in to comment.