Skip to content

Commit

Permalink
deps: bump alloy next
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrasiuk committed Jan 31, 2025
1 parent 4ce5a60 commit 07a7c04
Show file tree
Hide file tree
Showing 16 changed files with 205 additions and 237 deletions.
196 changes: 86 additions & 110 deletions Cargo.lock

Large diffs are not rendered by default.

125 changes: 64 additions & 61 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -434,34 +434,34 @@ alloy-rlp = { version = "0.3.10", default-features = false }
alloy-sol-types = "0.8.15"
alloy-trie = { version = "0.7", default-features = false }

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

# op
op-alloy-rpc-types = { version = "0.9.6", default-features = false }
Expand Down Expand Up @@ -602,36 +602,39 @@ snmalloc-rs = { version = "0.3.7", features = ["build_cc"] }
# See: https://github.com/eira-fransham/crunchy/issues/13
crunchy = "=0.2.2"

# [patch.crates-io]
# alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-network-primitives = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-rpc-types-admin = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-rpc-types-anvil = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-rpc-types-beacon = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-rpc-types-debug = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-rpc-types-eth = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-rpc-types-mev = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-rpc-types-txpool = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-signer-local = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }
# alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" }

# op-alloy-consensus = { git = "https://github.com/alloy-rs/op-alloy", rev = "debfc29" }
# op-alloy-network = { git = "https://github.com/alloy-rs/op-alloy", rev = "debfc29" }
# op-alloy-rpc-types = { git = "https://github.com/alloy-rs/op-alloy", rev = "debfc29" }
# op-alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/op-alloy", rev = "debfc29" }
[patch.crates-io]
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-contract = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-network-primitives = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-rpc-types-admin = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-rpc-types-anvil = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-rpc-types-beacon = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-rpc-types-debug = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-rpc-types-eth = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-rpc-types-mev = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-rpc-types-txpool = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-signer-local = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "cfb13aa" }

op-alloy-consensus = { git = "https://github.com/alloy-rs/op-alloy", rev = "ad607c1" }
op-alloy-network = { git = "https://github.com/alloy-rs/op-alloy", rev = "ad607c1" }
op-alloy-rpc-types = { git = "https://github.com/alloy-rs/op-alloy", rev = "ad607c1" }
op-alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/op-alloy", rev = "ad607c1" }

revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors", rev = "1207e33" }
8 changes: 3 additions & 5 deletions crates/chainspec/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ use alloy_consensus::{
Header,
};
use alloy_eips::{
eip1559::INITIAL_BASE_FEE,
eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS,
eip7685::EMPTY_REQUESTS_HASH,
eip7840::{BlobParams, BlobScheduleItem},
eip1559::INITIAL_BASE_FEE, eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS,
eip7685::EMPTY_REQUESTS_HASH, eip7840::BlobParams,
};
use alloy_genesis::Genesis;
use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256};
Expand Down Expand Up @@ -174,7 +172,7 @@ pub struct HardforkBlobParams {
impl HardforkBlobParams {
/// Constructs params for chainspec from a provided blob schedule.
/// Falls back to defaults if the schedule is empty.
pub fn from_schedule(blob_schedule: &BTreeMap<String, BlobScheduleItem>) -> Self {
pub fn from_schedule(blob_schedule: &BTreeMap<String, BlobParams>) -> Self {
let extract = |key: &str, default: fn() -> BlobParams| {
blob_schedule
.get(key)
Expand Down
7 changes: 7 additions & 0 deletions crates/optimism/cli/src/ovm_file_codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use alloy_consensus::{
use alloy_eips::{
eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718},
eip4895::Withdrawals,
Typed2718,
};
use alloy_primitives::{
bytes::{Buf, BytesMut},
Expand Down Expand Up @@ -217,6 +218,12 @@ impl Decodable for OvmTransactionSigned {
}
}

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

impl Encodable2718 for OvmTransactionSigned {
fn type_flag(&self) -> Option<u8> {
match self.transaction.tx_type() {
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/primitives/src/transaction/signed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl alloy_rlp::Encodable for OpTransactionSigned {

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

Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/rpc/src/eth/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ where
} else {
base_fee
.map(|base_fee| {
inner.effective_tip_per_gas(base_fee as u64).unwrap_or_default() + base_fee
inner.effective_tip_per_gas(base_fee).unwrap_or_default() + base_fee as u128
})
.unwrap_or_else(|| inner.max_fee_per_gas())
};
Expand Down
47 changes: 27 additions & 20 deletions crates/primitives-traits/src/serde_bincode_compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ pub type BincodeReprFor<'a, T> = <T as SerdeBincodeCompat>::BincodeRepr<'a>;
mod block_bincode {
use crate::serde_bincode_compat::SerdeBincodeCompat;
use alloc::{borrow::Cow, vec::Vec};
use alloy_consensus::serde_bincode_compat::Header;
use alloy_eips::eip4895::Withdrawals;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde_with::{DeserializeAs, SerializeAs};
Expand All @@ -60,8 +59,8 @@ mod block_bincode {
#[debug(bound())]
pub struct Block<'a, T: SerdeBincodeCompat, H: SerdeBincodeCompat> {
header: H::BincodeRepr<'a>,
#[serde(bound = "BlockBody<'a, T>: Serialize + serde::de::DeserializeOwned")]
body: BlockBody<'a, T>,
#[serde(bound = "BlockBody<'a, T, H>: Serialize + serde::de::DeserializeOwned")]
body: BlockBody<'a, T, H>,
}

impl<'a, T: SerdeBincodeCompat, H: SerdeBincodeCompat> From<&'a alloy_consensus::Block<T, H>>
Expand Down Expand Up @@ -125,31 +124,35 @@ mod block_bincode {
///
/// #[serde_as]
/// #[derive(Serialize, Deserialize)]
/// struct Data<T: SerdeBincodeCompat> {
/// #[serde_as(as = "serde_bincode_compat::BlockBody<'_, T>")]
/// body: alloy_consensus::BlockBody<T>,
/// struct Data<T: SerdeBincodeCompat, H: SerdeBincodeCompat> {
/// #[serde_as(as = "serde_bincode_compat::BlockBody<'_, T, H>")]
/// body: alloy_consensus::BlockBody<T, H>,
/// }
/// ```
#[derive(derive_more::Debug, Serialize, Deserialize)]
#[debug(bound())]
pub struct BlockBody<'a, T: SerdeBincodeCompat> {
pub struct BlockBody<'a, T: SerdeBincodeCompat, H: SerdeBincodeCompat> {
transactions: Vec<T::BincodeRepr<'a>>,
ommers: Vec<Header<'a>>,
ommers: Vec<H::BincodeRepr<'a>>,
withdrawals: Cow<'a, Option<Withdrawals>>,
}

impl<'a, T: SerdeBincodeCompat> From<&'a alloy_consensus::BlockBody<T>> for BlockBody<'a, T> {
fn from(value: &'a alloy_consensus::BlockBody<T>) -> Self {
impl<'a, T: SerdeBincodeCompat, H: SerdeBincodeCompat>
From<&'a alloy_consensus::BlockBody<T, H>> for BlockBody<'a, T, H>
{
fn from(value: &'a alloy_consensus::BlockBody<T, H>) -> Self {
Self {
transactions: value.transactions.iter().map(|tx| tx.as_repr()).collect(),
ommers: value.ommers.iter().map(Into::into).collect(),
ommers: value.ommers.iter().map(|h| h.as_repr()).collect(),
withdrawals: Cow::Borrowed(&value.withdrawals),
}
}
}

impl<'a, T: SerdeBincodeCompat> From<BlockBody<'a, T>> for alloy_consensus::BlockBody<T> {
fn from(value: BlockBody<'a, T>) -> Self {
impl<'a, T: SerdeBincodeCompat, H: SerdeBincodeCompat> From<BlockBody<'a, T, H>>
for alloy_consensus::BlockBody<T, H>
{
fn from(value: BlockBody<'a, T, H>) -> Self {
Self {
transactions: value.transactions.into_iter().map(Into::into).collect(),
ommers: value.ommers.into_iter().map(Into::into).collect(),
Expand All @@ -158,9 +161,11 @@ mod block_bincode {
}
}

impl<T: SerdeBincodeCompat> SerializeAs<alloy_consensus::BlockBody<T>> for BlockBody<'_, T> {
impl<T: SerdeBincodeCompat, H: SerdeBincodeCompat> SerializeAs<alloy_consensus::BlockBody<T, H>>
for BlockBody<'_, T, H>
{
fn serialize_as<S>(
source: &alloy_consensus::BlockBody<T>,
source: &alloy_consensus::BlockBody<T, H>,
serializer: S,
) -> Result<S::Ok, S::Error>
where
Expand All @@ -170,19 +175,21 @@ mod block_bincode {
}
}

impl<'de, T: SerdeBincodeCompat> DeserializeAs<'de, alloy_consensus::BlockBody<T>>
for BlockBody<'de, T>
impl<'de, T: SerdeBincodeCompat, H: SerdeBincodeCompat>
DeserializeAs<'de, alloy_consensus::BlockBody<T, H>> for BlockBody<'de, T, H>
{
fn deserialize_as<D>(deserializer: D) -> Result<alloy_consensus::BlockBody<T>, D::Error>
fn deserialize_as<D>(deserializer: D) -> Result<alloy_consensus::BlockBody<T, H>, D::Error>
where
D: Deserializer<'de>,
{
BlockBody::deserialize(deserializer).map(Into::into)
}
}

impl<T: SerdeBincodeCompat> SerdeBincodeCompat for alloy_consensus::BlockBody<T> {
type BincodeRepr<'a> = BlockBody<'a, T>;
impl<T: SerdeBincodeCompat, H: SerdeBincodeCompat> SerdeBincodeCompat
for alloy_consensus::BlockBody<T, H>
{
type BincodeRepr<'a> = BlockBody<'a, T, H>;

fn as_repr(&self) -> Self::BincodeRepr<'_> {
self.into()
Expand Down
18 changes: 3 additions & 15 deletions crates/rpc/rpc-eth-api/src/helpers/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
};
use alloy_consensus::BlockHeader;
use alloy_eips::{eip1559::calc_next_block_base_fee, eip2930::AccessListResult};
use alloy_primitives::{Address, Bytes, TxKind, B256, U256};
use alloy_primitives::{Address, Bytes, B256, U256};
use alloy_rpc_types_eth::{
simulate::{SimBlock, SimulatePayload, SimulatedBlock},
state::{EvmOverrides, StateOverride},
Expand All @@ -31,9 +31,7 @@ use reth_revm::{
use reth_rpc_eth_types::{
cache::db::{StateCacheDbRefMutWrapper, StateProviderTraitObjWrapper},
error::{api::FromEvmHalt, ensure_success},
revm_utils::{
apply_block_overrides, apply_state_overrides, caller_gas_allowance, get_precompiles,
},
revm_utils::{apply_block_overrides, apply_state_overrides, caller_gas_allowance},
simulate::{self, EthSimulateError},
EthApiError, RevertError, RpcInvalidTransactionError, StateCacheDb,
};
Expand Down Expand Up @@ -419,20 +417,10 @@ pub trait EthCall: EstimateCall + Call + LoadPendingBlock + LoadBlock + FullEthA
tx_env.set_gas_limit(cap.min(evm_env.block_env.gas_limit).saturating_to());
}

let from = request.from.unwrap_or_default();
let to = if let Some(TxKind::Call(to)) = request.to {
to
} else {
let nonce =
db.basic_ref(from).map_err(Self::Error::from_eth_err)?.unwrap_or_default().nonce;
from.create(nonce)
};

// can consume the list since we're not using the request anymore
let initial = request.access_list.take().unwrap_or_default();

let precompiles = get_precompiles(evm_env.spec.into());
let mut inspector = AccessListInspector::new(initial, from, to, precompiles);
let mut inspector = AccessListInspector::new(initial);

let (result, (evm_env, mut tx_env)) =
self.inspect(&mut db, evm_env, tx_env, &mut inspector)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-eth-api/src/helpers/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ pub trait Trace:
let block_hash = block.hash();

let block_number = evm_env.block_env.number.saturating_to::<u64>();
let base_fee = evm_env.block_env.basefee.saturating_to::<u128>();
let base_fee = evm_env.block_env.basefee.saturating_to::<u64>();

// now get the state
let state = this.state_at_block_id(state_at.into())?;
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc-eth-api/src/helpers/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ pub trait EthTransactions: LoadTransaction<Provider: BlockReaderIdExt> {
hash: Some(*tx.tx_hash()),
block_hash: Some(block_hash),
block_number: Some(block_number),
base_fee: base_fee_per_gas.map(u128::from),
base_fee: base_fee_per_gas,
index: Some(index as u64),
};

Expand Down Expand Up @@ -296,7 +296,7 @@ pub trait EthTransactions: LoadTransaction<Provider: BlockReaderIdExt> {
hash: Some(*tx.tx_hash()),
block_hash: Some(block_hash),
block_number: Some(block_number),
base_fee: base_fee_per_gas.map(u128::from),
base_fee: base_fee_per_gas,
index: Some(index as u64),
};
self.tx_resp_builder().fill(tx.clone().with_signer(*signer), tx_info)
Expand Down
Loading

0 comments on commit 07a7c04

Please sign in to comment.