Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump alloy to 0.8.0 #13268

Merged
merged 9 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 95 additions & 95 deletions Cargo.lock

Large diffs are not rendered by default.

78 changes: 39 additions & 39 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ reth-ethereum-consensus = { path = "crates/ethereum/consensus" }
reth-ethereum-engine-primitives = { path = "crates/ethereum/engine-primitives" }
reth-ethereum-forks = { path = "crates/ethereum-forks", default-features = false }
reth-ethereum-payload-builder = { path = "crates/ethereum/payload" }
reth-ethereum-primitives = { path = "crates/ethereum/primitives", default-features = false }
reth-ethereum-primitives = { path = "crates/ethereum/primitives", default-features = false }
reth-etl = { path = "crates/etl" }
reth-evm = { path = "crates/evm" }
reth-evm-ethereum = { path = "crates/ethereum/evm" }
Expand Down Expand Up @@ -427,58 +427,58 @@ reth-zstd-compressors = { path = "crates/storage/zstd-compressors", default-feat

# revm
revm = { version = "18.0.0", features = ["std"], default-features = false }
revm-inspectors = "0.12.0"
revm-inspectors = "0.13.0"
revm-primitives = { version = "14.0.0", default-features = false }

# eth
alloy-chains = { version = "0.1.32", default-features = false }
alloy-dyn-abi = "0.8.11"
alloy-primitives = { version = "0.8.11", default-features = false }
alloy-dyn-abi = "0.8.15"
alloy-primitives = { version = "0.8.15", default-features = false }
alloy-rlp = { version = "0.3.10", default-features = false }
alloy-sol-types = "0.8.11"
alloy-sol-types = "0.8.15"
alloy-trie = { version = "0.7", default-features = false }

alloy-consensus = { version = "0.7.3", default-features = false }
alloy-contract = { version = "0.7.3", default-features = false }
alloy-eips = { version = "0.7.3", default-features = false }
alloy-genesis = { version = "0.7.3", default-features = false }
alloy-json-rpc = { version = "0.7.3", default-features = false }
alloy-network = { version = "0.7.3", default-features = false }
alloy-network-primitives = { version = "0.7.3", default-features = false }
alloy-node-bindings = { version = "0.7.3", default-features = false }
alloy-provider = { version = "0.7.3", features = [
alloy-consensus = { version = "0.8.0", default-features = false }
alloy-contract = { version = "0.8.0", default-features = false }
alloy-eips = { version = "0.8.0", default-features = false }
alloy-genesis = { version = "0.8.0", default-features = false }
alloy-json-rpc = { version = "0.8.0", default-features = false }
alloy-network = { version = "0.8.0", default-features = false }
alloy-network-primitives = { version = "0.8.0", default-features = false }
alloy-node-bindings = { version = "0.8.0", default-features = false }
alloy-provider = { version = "0.8.0", features = [
"reqwest",
], default-features = false }
alloy-pubsub = { version = "0.7.3", default-features = false }
alloy-rpc-client = { version = "0.7.3", default-features = false }
alloy-rpc-types = { version = "0.7.3", features = [
alloy-pubsub = { version = "0.8.0", default-features = false }
alloy-rpc-client = { version = "0.8.0", default-features = false }
alloy-rpc-types = { version = "0.8.0", features = [
"eth",
], default-features = false }
alloy-rpc-types-admin = { version = "0.7.3", default-features = false }
alloy-rpc-types-anvil = { version = "0.7.3", default-features = false }
alloy-rpc-types-beacon = { version = "0.7.3", default-features = false }
alloy-rpc-types-debug = { version = "0.7.3", default-features = false }
alloy-rpc-types-engine = { version = "0.7.3", default-features = false }
alloy-rpc-types-eth = { version = "0.7.3", default-features = false }
alloy-rpc-types-mev = { version = "0.7.3", default-features = false }
alloy-rpc-types-trace = { version = "0.7.3", default-features = false }
alloy-rpc-types-txpool = { version = "0.7.3", default-features = false }
alloy-serde = { version = "0.7.3", default-features = false }
alloy-signer = { version = "0.7.3", default-features = false }
alloy-signer-local = { version = "0.7.3", default-features = false }
alloy-transport = { version = "0.7.3" }
alloy-transport-http = { version = "0.7.3", features = [
alloy-rpc-types-admin = { version = "0.8.0", default-features = false }
alloy-rpc-types-anvil = { version = "0.8.0", default-features = false }
alloy-rpc-types-beacon = { version = "0.8.0", default-features = false }
alloy-rpc-types-debug = { version = "0.8.0", default-features = false }
alloy-rpc-types-engine = { version = "0.8.0", default-features = false }
alloy-rpc-types-eth = { version = "0.8.0", default-features = false }
alloy-rpc-types-mev = { version = "0.8.0", default-features = false }
alloy-rpc-types-trace = { version = "0.8.0", default-features = false }
alloy-rpc-types-txpool = { version = "0.8.0", default-features = false }
alloy-serde = { version = "0.8.0", default-features = false }
alloy-signer = { version = "0.8.0", default-features = false }
alloy-signer-local = { version = "0.8.0", default-features = false }
alloy-transport = { version = "0.8.0" }
alloy-transport-http = { version = "0.8.0", features = [
"reqwest-rustls-tls",
], default-features = false }
alloy-transport-ipc = { version = "0.7.3", default-features = false }
alloy-transport-ws = { version = "0.7.3", default-features = false }
alloy-transport-ipc = { version = "0.8.0", default-features = false }
alloy-transport-ws = { version = "0.8.0", default-features = false }

# op
op-alloy-rpc-types = "0.7.3"
op-alloy-rpc-types-engine = "0.7.3"
op-alloy-rpc-jsonrpsee = "0.7.3"
op-alloy-network = "0.7.3"
op-alloy-consensus = "0.7.3"
op-alloy-rpc-types = "0.8.0"
op-alloy-rpc-types-engine = "0.8.0"
op-alloy-rpc-jsonrpsee = "0.8.0"
op-alloy-network = "0.8.0"
op-alloy-consensus = "0.8.0"

# misc
aquamarine = "0.6"
Expand All @@ -495,7 +495,7 @@ cfg-if = "1.0"
clap = "4"
const_format = { version = "0.2.32", features = ["rust_1_64"] }
dashmap = "6.0"
derive_more = { version = "1", default-features = false, features = ["full"] }
derive_more = { version = "1", default-features = false, features = ["full"] }
dyn-clone = "1.0.17"
eyre = "0.6"
fdlimit = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/beacon/src/engine/invalid_headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl InvalidHeaderCache {
let entry = self.headers.get(hash)?;
entry.hit_count += 1;
if entry.hit_count < INVALID_HEADER_HIT_EVICTION_THRESHOLD {
return Some(entry.header.clone())
return Some(entry.header);
}
}
// if we get here, the entry has been hit too many times, so we evict it
Expand Down
12 changes: 6 additions & 6 deletions crates/net/eth-wire-types/src/broadcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use alloy_rlp::{
use derive_more::{Constructor, Deref, DerefMut, From, IntoIterator};
use reth_codecs_derive::{add_arbitrary_tests, generate_tests};
use reth_primitives::TransactionSigned;
use reth_primitives_traits::{SignedTransaction, Transaction};
use reth_primitives_traits::SignedTransaction;
use std::{
collections::{HashMap, HashSet},
mem,
Expand Down Expand Up @@ -38,7 +38,7 @@ impl NewBlockHashes {
pub fn latest(&self) -> Option<&BlockHashNumber> {
self.0.iter().fold(None, |latest, block| {
if let Some(latest) = latest {
return if latest.number > block.number { Some(latest) } else { Some(block) }
return if latest.number > block.number { Some(latest) } else { Some(block) };
}
Some(block)
})
Expand Down Expand Up @@ -432,13 +432,13 @@ impl Decodable for NewPooledTransactionHashes68 {
return Err(alloy_rlp::Error::ListLengthMismatch {
expected: msg.hashes.len(),
got: msg.types.len(),
})
});
}
if msg.hashes.len() != msg.sizes.len() {
return Err(alloy_rlp::Error::ListLengthMismatch {
expected: msg.hashes.len(),
got: msg.sizes.len(),
})
});
mattsse marked this conversation as resolved.
Show resolved Hide resolved
}

Ok(msg)
Expand Down Expand Up @@ -711,15 +711,15 @@ impl RequestTxHashes {
pub fn retain_count(&mut self, count: usize) -> Self {
let rest_capacity = self.hashes.len().saturating_sub(count);
if rest_capacity == 0 {
return Self::empty()
return Self::empty();
}
let mut rest = Self::with_capacity(rest_capacity);

let mut i = 0;
self.hashes.retain(|hash| {
if i >= count {
rest.insert(*hash);
return false
return false;
}
i += 1;

Expand Down
12 changes: 7 additions & 5 deletions crates/optimism/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use alloy_primitives::{bytes, Bytes, TxKind, Uint, B256};

#[cfg(any(test, feature = "reth-codec"))]
use alloy_consensus::constants::EIP7702_TX_TYPE_ID;
use alloy_consensus::{SignableTransaction, TxLegacy};
use alloy_consensus::{SignableTransaction, TxLegacy, Typed2718};
use alloy_eips::{eip2930::AccessList, eip7702::SignedAuthorization};
use derive_more::{Constructor, Deref, From};
use op_alloy_consensus::OpTypedTransaction;
Expand Down Expand Up @@ -157,10 +157,6 @@ impl alloy_consensus::Transaction for OpTransaction {
self.0.input()
}

fn ty(&self) -> u8 {
self.0.ty()
}

fn access_list(&self) -> Option<&AccessList> {
self.0.access_list()
}
Expand Down Expand Up @@ -197,3 +193,9 @@ impl InMemorySize for OpTransaction {
}
}
}

impl Typed2718 for OpTransaction {
fn ty(&self) -> u8 {
self.0.ty()
}
}
21 changes: 12 additions & 9 deletions crates/optimism/primitives/src/transaction/signed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::{OpTransaction, OpTxType};
use alloc::vec::Vec;
use alloy_consensus::{
transaction::RlpEcdsaTx, SignableTransaction, Transaction, TxEip1559, TxEip2930, TxEip7702,
Typed2718,
};
use alloy_eips::{
eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718},
Expand Down Expand Up @@ -83,7 +84,7 @@ impl SignedTransaction for OpTransactionSigned {
// Optimism's Deposit transaction does not have a signature. Directly return the
// `from` address.
if let OpTypedTransaction::Deposit(TxDeposit { from, .. }) = *self.transaction {
return Some(from)
return Some(from);
}

let Self { transaction, signature, .. } = self;
Expand All @@ -95,7 +96,7 @@ impl SignedTransaction for OpTransactionSigned {
// Optimism's Deposit transaction does not have a signature. Directly return the
// `from` address.
if let OpTypedTransaction::Deposit(TxDeposit { from, .. }) = *self.transaction {
return Some(from)
return Some(from);
}

let Self { transaction, signature, .. } = self;
Expand All @@ -107,7 +108,7 @@ impl SignedTransaction for OpTransactionSigned {
// Optimism's Deposit transaction does not have a signature. Directly return the
// `from` address.
if let OpTypedTransaction::Deposit(TxDeposit { from, .. }) = *self.transaction {
return Some(from)
return Some(from);
}
self.encode_for_signing(buf);
let signature_hash = keccak256(buf);
Expand Down Expand Up @@ -200,7 +201,7 @@ impl FillTxEnv for OpTransactionSigned {
is_system_transaction: Some(tx.is_system_transaction),
enveloped_tx: Some(envelope.into()),
};
return
return;
}
}

Expand Down Expand Up @@ -228,7 +229,7 @@ impl alloy_rlp::Encodable for OpTransactionSigned {

fn length(&self) -> usize {
let mut payload_length = self.encode_2718_len();
if !self.is_legacy() {
if !Encodable2718::is_legacy(self) {
Copy link
Contributor Author

@moricho moricho Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some parts, we have to specify Encodable2718 or Typed2718 specifically to use is_legacy, but the result will be the same.
Should we consolidate the is_legacy method to one or the other on alloy side?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, I think Encodable2718 should just have Typed2718 as supertrait

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks for the suggestion. I'll address this later

payload_length += Header { list: false, payload_length }.length();
}

Expand Down Expand Up @@ -377,10 +378,6 @@ impl Transaction for OpTransactionSigned {
self.deref().input()
}

fn ty(&self) -> u8 {
self.deref().ty()
}

fn access_list(&self) -> Option<&AccessList> {
self.deref().access_list()
}
Expand All @@ -406,6 +403,12 @@ impl Transaction for OpTransactionSigned {
}
}

impl Typed2718 for OpTransactionSigned {
fn ty(&self) -> u8 {
self.tx_type() as u8
}
}

impl Default for OpTransactionSigned {
fn default() -> Self {
Self {
Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/src/alloy_compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl TryFrom<AnyRpcTransaction> for TransactionSigned {
}
#[cfg(feature = "optimism")]
AnyTxEnvelope::Unknown(alloy_network::UnknownTxEnvelope { hash, inner }) => {
use alloy_consensus::Transaction as _;
use alloy_consensus::{Transaction as _, Typed2718};

if inner.ty() == crate::TxType::Deposit {
let fields: op_alloy_rpc_types::OpTransactionFields = inner
Expand All @@ -152,7 +152,7 @@ impl TryFrom<AnyRpcTransaction> for TransactionSigned {
hash,
)
} else {
return Err(ConversionError::Custom("unknown transaction type".to_string()))
return Err(ConversionError::Custom("unknown transaction type".to_string()));
}
}
_ => return Err(ConversionError::Custom("unknown transaction type".to_string())),
Expand Down
10 changes: 5 additions & 5 deletions crates/primitives/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
RecoveredTx, SealedHeader, TransactionSigned,
};
use alloc::vec::Vec;
use alloy_consensus::Header;
use alloy_consensus::{Header, Typed2718};
use alloy_eips::{eip2718::Encodable2718, eip4895::Withdrawals};
use alloy_primitives::{Address, Bytes, B256};
use alloy_rlp::{Decodable, Encodable, RlpDecodable, RlpEncodable};
Expand Down Expand Up @@ -314,7 +314,7 @@ where
return Err(GotExpected {
got: calculated_root,
expected: self.header.transactions_root(),
})
});
}

Ok(())
Expand Down Expand Up @@ -612,19 +612,19 @@ impl<T: Transaction> BlockBody<T> {
/// Returns whether or not the block body contains any blob transactions.
#[inline]
pub fn has_blob_transactions(&self) -> bool {
self.transactions.iter().any(|tx| tx.is_eip4844())
self.transactions.iter().any(|tx| Typed2718::is_eip4844(tx))
klkvr marked this conversation as resolved.
Show resolved Hide resolved
}

/// Returns whether or not the block body contains any EIP-7702 transactions.
#[inline]
pub fn has_eip7702_transactions(&self) -> bool {
self.transactions.iter().any(|tx| tx.is_eip7702())
self.transactions.iter().any(|tx| Typed2718::is_eip7702(tx))
}

/// Returns an iterator over all blob transactions of the block
#[inline]
pub fn blob_transactions_iter(&self) -> impl Iterator<Item = &T> + '_ {
self.transactions.iter().filter(|tx| tx.is_eip4844())
self.transactions.iter().filter(Typed2718::is_eip4844)
}

/// Returns only the blob transactions, if any, from the block body.
Expand Down
Loading
Loading