Skip to content

Commit

Permalink
chore(deps): Bump alloy 14ed25d (#8128)
Browse files Browse the repository at this point in the history
* chore: bump alloy 14ed25d

* Format files

* format: Remove unnecessary trailing comma updates

* Fix to update only alloy in Cargo.lock

* common: Enable eth feature for allot-rpc-types

* Enable eth feature for alloy-rpc-types

* bump alloy

* new retry changes

---------

Co-authored-by: Matthias Seitz <[email protected]>
  • Loading branch information
moricho and mattsse authored Jun 12, 2024
1 parent f816059 commit 82f0aaa
Show file tree
Hide file tree
Showing 28 changed files with 297 additions and 226 deletions.
214 changes: 121 additions & 93 deletions Cargo.lock

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,38 +159,38 @@ foundry-compilers = { version = "0.7.0", default-features = false }
# no default features to avoid c-kzg
revm = { version = "9.0.0", default-features = false }
revm-primitives = { version = "4.0.0", default-features = false }
revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors", rev = "a278649", features = [
revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors", rev = "5cf339c", features = [
"serde",
] }

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

## alloy
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-contract = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-signer-aws = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-signer-gcp = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-signer-ledger = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-signer-trezor = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false }
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-contract = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-signer-aws = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-signer-gcp = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-signer-ledger = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-signer-trezor = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "00d81d7", default-features = false }
alloy-primitives = { version = "0.7.1", features = ["getrandom", "rand"] }
alloy-dyn-abi = "0.7.1"
alloy-json-abi = "0.7.1"
Expand Down Expand Up @@ -247,4 +247,4 @@ soldeer = "0.2.15"
revm = { git = "https://github.com/bluealloy/revm.git", rev = "a28a543" }
revm-interpreter = { git = "https://github.com/bluealloy/revm.git", rev = "a28a543" }
revm-precompile = { git = "https://github.com/bluealloy/revm.git", rev = "a28a543" }
revm-primitives = { git = "https://github.com/bluealloy/revm.git", rev = "a28a543" }
revm-primitives = { git = "https://github.com/bluealloy/revm.git", rev = "a28a543" }
14 changes: 7 additions & 7 deletions crates/anvil/core/src/eth/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use alloy_consensus::{
AnyReceiptEnvelope, Receipt, ReceiptEnvelope, ReceiptWithBloom, Signed, TxEip1559, TxEip2930,
TxEnvelope, TxLegacy, TxReceipt,
};
use alloy_eips::eip2718::{Decodable2718, Encodable2718};
use alloy_eips::eip2718::{Decodable2718, Eip2718Error, Encodable2718};
use alloy_primitives::{Address, Bloom, Bytes, Log, Signature, TxHash, TxKind, B256, U256, U64};
use alloy_rlp::{length_of_length, Decodable, Encodable, Header};
use alloy_rpc_types::{
Expand Down Expand Up @@ -962,7 +962,7 @@ impl Encodable2718 for TypedTransaction {
}

impl Decodable2718 for TypedTransaction {
fn typed_decode(ty: u8, buf: &mut &[u8]) -> alloy_rlp::Result<Self> {
fn typed_decode(ty: u8, buf: &mut &[u8]) -> Result<Self, Eip2718Error> {
if ty == 0x7E {
return Ok(Self::Deposit(DepositTransaction::decode(buf)?))
}
Expand All @@ -974,7 +974,7 @@ impl Decodable2718 for TypedTransaction {
}
}

fn fallback_decode(buf: &mut &[u8]) -> alloy_rlp::Result<Self> {
fn fallback_decode(buf: &mut &[u8]) -> Result<Self, Eip2718Error> {
match TxEnvelope::fallback_decode(buf)? {
TxEnvelope::Legacy(tx) => Ok(Self::Legacy(tx)),
_ => unreachable!(),
Expand Down Expand Up @@ -1295,7 +1295,7 @@ impl Encodable2718 for TypedReceipt {
}

impl Decodable2718 for TypedReceipt {
fn typed_decode(ty: u8, buf: &mut &[u8]) -> alloy_rlp::Result<Self> {
fn typed_decode(ty: u8, buf: &mut &[u8]) -> Result<Self, Eip2718Error> {
if ty == 0x7E {
return Ok(Self::Deposit(DepositReceipt::decode(buf)?))
}
Expand All @@ -1307,7 +1307,7 @@ impl Decodable2718 for TypedReceipt {
}
}

fn fallback_decode(buf: &mut &[u8]) -> alloy_rlp::Result<Self> {
fn fallback_decode(buf: &mut &[u8]) -> Result<Self, Eip2718Error> {
match ReceiptEnvelope::fallback_decode(buf)? {
ReceiptEnvelope::Legacy(tx) => Ok(Self::Legacy(tx)),
_ => unreachable!(),
Expand Down Expand Up @@ -1506,7 +1506,7 @@ mod tests {
let mut data = vec![];
let receipt = TypedReceipt::Legacy(ReceiptWithBloom {
receipt: Receipt {
status: false,
status: false.into(),
cumulative_gas_used: 0x1u128,
logs: vec![Log {
address: Address::from_str("0000000000000000000000000000000000000011").unwrap(),
Expand Down Expand Up @@ -1541,7 +1541,7 @@ mod tests {

let expected = TypedReceipt::Legacy(ReceiptWithBloom {
receipt: Receipt {
status: false,
status: false.into(),
cumulative_gas_used: 0x1u128,
logs: vec![Log {
address: Address::from_str("0000000000000000000000000000000000000011").unwrap(),
Expand Down
4 changes: 2 additions & 2 deletions crates/anvil/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ impl NodeConfig {
};

let block = provider
.get_block(BlockNumberOrTag::Number(fork_block_number).into(), false)
.get_block(BlockNumberOrTag::Number(fork_block_number).into(), false.into())
.await
.expect("Failed to get fork block");

Expand Down Expand Up @@ -1282,7 +1282,7 @@ async fn find_latest_fork_block<P: Provider<T, AnyNetwork>, T: Transport + Clone
// walk back from the head of the chain, but at most 2 blocks, which should be more than enough
// leeway
for _ in 0..2 {
if let Some(block) = provider.get_block(num.into(), false).await? {
if let Some(block) = provider.get_block(num.into(), false.into()).await? {
if block.header.hash.is_some() {
break;
}
Expand Down
13 changes: 10 additions & 3 deletions crates/anvil/src/eth/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ impl EthApi {
let number = self.backend.ensure_block_number(Some(BlockId::Number(block_number))).await?;
if let Some(fork) = self.get_fork() {
if fork.predates_fork_inclusive(number) {
return Ok(fork.uncle_by_block_number_and_index(number, idx.into()).await?);
return Ok(fork.uncle_by_block_number_and_index(number, idx.into()).await?)
}
}
// It's impossible to have uncles outside of fork mode
Expand Down Expand Up @@ -1923,7 +1923,14 @@ impl EthApi {
if let Some(receipt) = self.backend.mined_transaction_receipt(tx.hash) {
if let Some(output) = receipt.out {
// insert revert reason if failure
if !receipt.inner.inner.as_receipt_with_bloom().receipt.status {
if !receipt
.inner
.inner
.as_receipt_with_bloom()
.receipt
.status
.coerce_status()
{
if let Some(reason) =
RevertDecoder::new().maybe_decode(&output, None)
{
Expand Down Expand Up @@ -2514,7 +2521,7 @@ impl EthApi {
if let BlockRequest::Number(number) = block_request {
if let Some(fork) = self.get_fork() {
if fork.predates_fork_inclusive(number) {
return Ok(fork.get_nonce(address, number).await?);
return Ok(fork.get_nonce(address, number).await?)
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions crates/anvil/src/eth/backend/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ impl ExecutedTransaction {

// successful return see [Return]
let status_code = u8::from(self.exit_reason as u8 <= InstructionResult::SelfDestruct as u8);
let receipt_with_bloom: ReceiptWithBloom =
Receipt { status: status_code == 1, cumulative_gas_used: *cumulative_gas_used, logs }
.into();
let receipt_with_bloom: ReceiptWithBloom = Receipt {
status: (status_code == 1).into(),
cumulative_gas_used: *cumulative_gas_used,
logs,
}
.into();

match &self.transaction.pending_transaction.transaction.transaction {
TypedTransaction::Legacy(_) => TypedReceipt::Legacy(receipt_with_bloom),
Expand Down
8 changes: 5 additions & 3 deletions crates/anvil/src/eth/backend/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ impl ClientFork {
}

let provider = self.provider();
let block =
provider.get_block(block_number, false).await?.ok_or(BlockchainError::BlockNotFound)?;
let block = provider
.get_block(block_number, false.into())
.await?
.ok_or(BlockchainError::BlockNotFound)?;
let block_hash = block.header.hash.ok_or(BlockchainError::BlockNotFound)?;
let timestamp = block.header.timestamp;
let base_fee = block.header.base_fee_per_gas;
Expand Down Expand Up @@ -482,7 +484,7 @@ impl ClientFork {
&self,
block_id: impl Into<BlockId>,
) -> Result<Option<Block>, TransportError> {
if let Some(block) = self.provider().get_block(block_id.into(), true).await? {
if let Some(block) = self.provider().get_block(block_id.into(), true.into()).await? {
let hash = block.header.hash.unwrap();
let block_number = block.header.number.unwrap();
let mut storage = self.storage_write();
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/src/eth/otterscan/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl EthApi {
node_info!("ots_getTransactionError");

if let Some(receipt) = self.backend.mined_transaction_receipt(hash) {
if !receipt.inner.inner.as_receipt_with_bloom().receipt.status {
if !receipt.inner.inner.as_receipt_with_bloom().receipt.status.coerce_status() {
return Ok(receipt.out.map(|b| b.0.into()).unwrap_or(Bytes::default()))
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/src/tasks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl TaskManager {
let provider = provider.clone();
let api = api.clone();
async move {
if let Ok(Some(block)) = provider.get_block(hash.into(), false).await {
if let Ok(Some(block)) = provider.get_block(hash.into(), false.into()).await {
let _ = api
.anvil_reset(Some(Forking {
json_rpc_url: None,
Expand Down
7 changes: 5 additions & 2 deletions crates/anvil/tests/it/anvil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async fn test_can_set_genesis_timestamp() {

assert_eq!(
genesis_timestamp,
provider.get_block(0.into(), false).await.unwrap().unwrap().header.timestamp
provider.get_block(0.into(), false.into()).await.unwrap().unwrap().header.timestamp
);
}

Expand All @@ -71,5 +71,8 @@ async fn test_can_use_default_genesis_timestamp() {
let (_api, handle) = spawn(NodeConfig::test()).await;
let provider = handle.http_provider();

assert_ne!(0u64, provider.get_block(0.into(), false).await.unwrap().unwrap().header.timestamp);
assert_ne!(
0u64,
provider.get_block(0.into(), false.into()).await.unwrap().unwrap().header.timestamp
);
}
Loading

0 comments on commit 82f0aaa

Please sign in to comment.