Skip to content

Commit

Permalink
Bump alloy to 0.8.0 (paradigmxyz#13268)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthias Seitz <[email protected]>
  • Loading branch information
moricho and mattsse authored Dec 10, 2024
1 parent 62e2cbf commit 73f1583
Show file tree
Hide file tree
Showing 14 changed files with 192 additions and 216 deletions.
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
2 changes: 1 addition & 1 deletion 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
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()
}
}
13 changes: 8 additions & 5 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 @@ -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) {
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.deref().ty()
}
}

impl Default for OpTransactionSigned {
fn default() -> Self {
Self {
Expand Down
34 changes: 0 additions & 34 deletions crates/primitives-traits/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ pub mod tx_type;
use crate::{InMemorySize, MaybeArbitrary, MaybeCompact, MaybeSerde};
use core::{fmt, hash::Hash};

use alloy_consensus::constants::{
EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
LEGACY_TX_TYPE_ID,
};

/// Helper trait that unifies all behaviour required by transaction to support full node operations.
pub trait FullTransaction: Transaction + MaybeCompact {}

Expand All @@ -32,35 +27,6 @@ pub trait Transaction:
+ MaybeSerde
+ MaybeArbitrary
{
/// Returns true if the transaction is a legacy transaction.
#[inline]
fn is_legacy(&self) -> bool {
self.ty() == LEGACY_TX_TYPE_ID
}

/// Returns true if the transaction is an EIP-2930 transaction.
#[inline]
fn is_eip2930(&self) -> bool {
self.ty() == EIP2930_TX_TYPE_ID
}

/// Returns true if the transaction is an EIP-1559 transaction.
#[inline]
fn is_eip1559(&self) -> bool {
self.ty() == EIP1559_TX_TYPE_ID
}

/// Returns true if the transaction is an EIP-4844 transaction.
#[inline]
fn is_eip4844(&self) -> bool {
self.ty() == EIP4844_TX_TYPE_ID
}

/// Returns true if the transaction is an EIP-7702 transaction.
#[inline]
fn is_eip7702(&self) -> bool {
self.ty() == EIP7702_TX_TYPE_ID
}
}

impl<T> Transaction for T where
Expand Down
2 changes: 1 addition & 1 deletion 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 Down
2 changes: 1 addition & 1 deletion 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
40 changes: 22 additions & 18 deletions crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use alloc::vec::Vec;
use alloy_consensus::{
transaction::RlpEcdsaTx, SignableTransaction, Signed, Transaction as _, TxEip1559, TxEip2930,
TxEip4844, TxEip4844Variant, TxEip7702, TxLegacy, TypedTransaction,
TxEip4844, TxEip4844Variant, TxEip7702, TxLegacy, Typed2718, TypedTransaction,
};
use alloy_eips::{
eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718},
Expand Down Expand Up @@ -192,6 +192,20 @@ impl<'a> arbitrary::Arbitrary<'a> for Transaction {
}
}

impl Typed2718 for Transaction {
fn ty(&self) -> u8 {
match self {
Self::Legacy(tx) => tx.ty(),
Self::Eip2930(tx) => tx.ty(),
Self::Eip1559(tx) => tx.ty(),
Self::Eip4844(tx) => tx.ty(),
Self::Eip7702(tx) => tx.ty(),
#[cfg(feature = "optimism")]
Self::Deposit(tx) => tx.ty(),
}
}
}

// === impl Transaction ===

impl Transaction {
Expand Down Expand Up @@ -710,18 +724,6 @@ impl alloy_consensus::Transaction for Transaction {
}
}

fn ty(&self) -> u8 {
match self {
Self::Legacy(tx) => tx.ty(),
Self::Eip2930(tx) => tx.ty(),
Self::Eip1559(tx) => tx.ty(),
Self::Eip4844(tx) => tx.ty(),
Self::Eip7702(tx) => tx.ty(),
#[cfg(feature = "optimism")]
Self::Deposit(tx) => tx.ty(),
}
}

fn access_list(&self) -> Option<&AccessList> {
match self {
Self::Legacy(tx) => tx.access_list(),
Expand Down Expand Up @@ -826,6 +828,12 @@ impl PartialEq for TransactionSigned {
}
}

impl Typed2718 for TransactionSigned {
fn ty(&self) -> u8 {
self.deref().ty()
}
}

// === impl TransactionSigned ===

impl TransactionSigned {
Expand Down Expand Up @@ -1202,10 +1210,6 @@ impl alloy_consensus::Transaction for TransactionSigned {
self.deref().input()
}

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

fn access_list(&self) -> Option<&AccessList> {
self.deref().access_list()
}
Expand Down Expand Up @@ -1240,7 +1244,7 @@ impl Encodable for TransactionSigned {

fn length(&self) -> usize {
let mut payload_length = self.encode_2718_len();
if !self.is_legacy() {
if !Encodable2718::is_legacy(self) {
payload_length += Header { list: false, payload_length }.length();
}

Expand Down
Loading

0 comments on commit 73f1583

Please sign in to comment.