Skip to content

Commit

Permalink
chore: bump alloy 899fc51 (foundry-rs#7905)
Browse files Browse the repository at this point in the history
* chore: bump alloy 899fc51

* fixes

* fixes

* update test
  • Loading branch information
mattsse authored May 10, 2024
1 parent 3ef5466 commit 503792a
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 61 deletions.
46 changes: 23 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 24 additions & 24 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,37 +144,37 @@ foundry-compilers = { version = "0.4.1", default-features = false }
# no default features to avoid c-kzg
revm = { version = "8", default-features = false }
revm-primitives = { version = "3", default-features = false }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "ee6f6be", features = [
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "c1b5dd0", features = [
"serde",
] }

## ethers
ethers-contract-abigen = { version = "2.0.14", default-features = false }

## alloy
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-contract = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-signer-aws = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-signer-ledger = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-signer-trezor = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", default-features = false }
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240", 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 Down
9 changes: 5 additions & 4 deletions crates/anvil/src/eth/backend/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,11 @@ impl ClientFork {
}

let tx = self.provider().get_transaction_by_hash(hash).await?;

let mut storage = self.storage_write();
storage.transactions.insert(hash, tx.clone());
Ok(Some(tx))
if let Some(tx) = tx.clone() {
let mut storage = self.storage_write();
storage.transactions.insert(hash, tx);
}
Ok(tx)
}

pub async fn trace_transaction(&self, hash: B256) -> Result<Vec<Trace>, TransportError> {
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/tests/it/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ async fn can_reset_properly() {
assert_eq!(to_balance, fork_provider.get_balance(to, BlockId::latest()).await.unwrap());

// tx does not exist anymore
assert!(fork_tx_provider.get_transaction_by_hash(tx.transaction_hash).await.is_err())
assert!(fork_tx_provider.get_transaction_by_hash(tx.transaction_hash).await.unwrap().is_none())
}

#[tokio::test(flavor = "multi_thread")]
Expand Down
4 changes: 2 additions & 2 deletions crates/anvil/tests/it/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,9 +695,9 @@ async fn can_get_pending_transaction() {
assert!(pending.is_ok());

api.mine_one().await;
let mined = provider.get_transaction_by_hash(*tx.tx_hash()).await.unwrap();
let mined = provider.get_transaction_by_hash(*tx.tx_hash()).await.unwrap().unwrap();

assert_eq!(mined.hash, pending.unwrap().hash);
assert_eq!(mined.hash, pending.unwrap().unwrap().hash);
}

#[tokio::test(flavor = "multi_thread")]
Expand Down
3 changes: 2 additions & 1 deletion crates/cast/bin/cmd/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ impl RunArgs {
let tx = provider
.get_transaction_by_hash(tx_hash)
.await
.wrap_err_with(|| format!("tx not found: {:?}", tx_hash))?;
.wrap_err_with(|| format!("tx not found: {:?}", tx_hash))?
.ok_or_else(|| eyre::eyre!("tx not found: {:?}", tx_hash))?;

// check if the tx is a system transaction
if is_known_system_sender(tx.from) || tx.transaction_type == Some(SYSTEM_TRANSACTION_TYPE) {
Expand Down
6 changes: 5 additions & 1 deletion crates/cast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,11 @@ where
to_json: bool,
) -> Result<String> {
let tx_hash = TxHash::from_str(&tx_hash).wrap_err("invalid tx hash")?;
let tx = self.provider.get_transaction_by_hash(tx_hash).await?;
let tx = self
.provider
.get_transaction_by_hash(tx_hash)
.await?
.ok_or_else(|| eyre::eyre!("tx not found: {:?}", tx_hash))?;

Ok(if raw {
format!("0x{}", hex::encode(TxEnvelope::try_from(tx.inner)?.encoded_2718()))
Expand Down
3 changes: 2 additions & 1 deletion crates/common/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ impl TransactionReceiptWithRevertReason {
let transaction = provider
.get_transaction_by_hash(self.receipt.transaction_hash)
.await
.map_err(|_| eyre::eyre!("unable to fetch transaction"))?;
.map_err(|err| eyre::eyre!("unable to fetch transaction: {err}"))?
.ok_or_else(|| eyre::eyre!("transaction not found"))?;

if let Some(block_hash) = self.receipt.block_hash {
match provider
Expand Down
5 changes: 4 additions & 1 deletion crates/evm/core/src/fork/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ where
let block = provider
.get_transaction_by_hash(tx)
.await
.wrap_err("could not get transaction {tx}");
.wrap_err_with(|| format!("could not get transaction {tx}"))
.and_then(|maybe| {
maybe.ok_or_else(|| eyre::eyre!("could not get transaction {tx}"))
});
(sender, block, tx)
});

Expand Down
9 changes: 7 additions & 2 deletions crates/verify/src/bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ impl VerifyBytecodeArgs {
let mut transaction = provider
.get_transaction_by_hash(creation_data.transaction_hash)
.await
.or_else(|e| eyre::bail!("Couldn't fetch transaction from RPC: {:?}", e))?;
.or_else(|e| eyre::bail!("Couldn't fetch transaction from RPC: {:?}", e))?
.ok_or_else(|| {
eyre::eyre!("Transaction not found for hash {}", creation_data.transaction_hash)
})?;
let receipt = provider
.get_transaction_receipt(creation_data.transaction_hash)
.await
Expand Down Expand Up @@ -262,7 +265,9 @@ impl VerifyBytecodeArgs {
let provider = utils::get_provider(&config)?;
provider
.get_transaction_by_hash(creation_data.transaction_hash)
.await.or_else(|e| eyre::bail!("Couldn't fetch transaction from RPC: {:?}", e))?
.await.or_else(|e| eyre::bail!("Couldn't fetch transaction from RPC: {:?}", e))?.ok_or_else(|| {
eyre::eyre!("Transaction not found for hash {}", creation_data.transaction_hash)
})?
.block_number.ok_or_else(|| {
eyre::eyre!("Failed to get block number of the contract creation tx, specify using the --block flag")
})?
Expand Down
5 changes: 4 additions & 1 deletion crates/verify/src/etherscan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,10 @@ impl EtherscanVerificationProvider {
)?;

let creation_data = client.contract_creation_data(args.address).await?;
let transaction = provider.get_transaction_by_hash(creation_data.transaction_hash).await?;
let transaction = provider
.get_transaction_by_hash(creation_data.transaction_hash)
.await?
.ok_or_eyre("Transaction not found")?;
let receipt = provider
.get_transaction_receipt(creation_data.transaction_hash)
.await?
Expand Down

0 comments on commit 503792a

Please sign in to comment.