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

feat: bump alloy version #9545

Merged
merged 11 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
424 changes: 299 additions & 125 deletions Cargo.lock

Large diffs are not rendered by default.

54 changes: 29 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -389,37 +389,37 @@ alloy-dyn-abi = "0.7.2"
alloy-sol-types = "0.7.2"
alloy-rlp = "0.3.4"
alloy-trie = "0.4"
alloy-rpc-types = { version = "0.1", default-features = false, features = [
alloy-rpc-types = { version = "0.2", default-features = false, features = [
"eth",
] }
alloy-rpc-types-anvil = { version = "0.1", default-features = false }
alloy-rpc-types-beacon = { version = "0.1", default-features = false }
alloy-rpc-types-admin = { version = "0.1", default-features = false }
alloy-rpc-types-txpool = { version = "0.1", default-features = false }
alloy-serde = { version = "0.1", default-features = false }
alloy-rpc-types-engine = { version = "0.1", default-features = false }
alloy-rpc-types-eth = { version = "0.1", default-features = false }
alloy-rpc-types-mev = { version = "0.1", default-features = false }
alloy-rpc-types-trace = { version = "0.1", default-features = false }
alloy-genesis = { version = "0.1", default-features = false }
alloy-node-bindings = { version = "0.1", default-features = false }
alloy-provider = { version = "0.1", default-features = false, features = [
alloy-rpc-types-anvil = { version = "0.2", default-features = false }
alloy-rpc-types-beacon = { version = "0.2", default-features = false }
alloy-rpc-types-admin = { version = "0.2", default-features = false }
alloy-rpc-types-txpool = { version = "0.2", default-features = false }
alloy-serde = { version = "0.2", default-features = false }
alloy-rpc-types-engine = { version = "0.2", default-features = false }
alloy-rpc-types-eth = { version = "0.2", default-features = false }
alloy-rpc-types-mev = { version = "0.2", default-features = false }
alloy-rpc-types-trace = { version = "0.2", default-features = false }
alloy-genesis = { version = "0.2", default-features = false }
alloy-node-bindings = { version = "0.2", default-features = false }
alloy-provider = { version = "0.2", default-features = false, features = [
"reqwest",
] }
alloy-eips = { version = "0.1", default-features = false }
alloy-signer = { version = "0.1", default-features = false }
alloy-signer-local = { version = "0.1", default-features = false }
alloy-network = { version = "0.1", default-features = false }
alloy-consensus = { version = "0.1", default-features = false }
alloy-transport = { version = "0.1" }
alloy-transport-http = { version = "0.1", features = [
alloy-eips = { version = "0.2", default-features = false }
alloy-signer = { version = "0.2", default-features = false }
alloy-signer-local = { version = "0.2", default-features = false }
alloy-network = { version = "0.2", default-features = false }
alloy-consensus = { version = "0.2", default-features = false }
alloy-transport = { version = "0.2" }
alloy-transport-http = { version = "0.2", features = [
"reqwest-rustls-tls",
], default-features = false }
alloy-transport-ws = { version = "0.1", default-features = false }
alloy-transport-ipc = { version = "0.1", default-features = false }
alloy-pubsub = { version = "0.1", default-features = false }
alloy-json-rpc = { version = "0.1", default-features = false }
alloy-rpc-client = { version = "0.1", default-features = false }
alloy-transport-ws = { version = "0.2", default-features = false }
alloy-transport-ipc = { version = "0.2", default-features = false }
alloy-pubsub = { version = "0.2", default-features = false }
alloy-json-rpc = { version = "0.2", default-features = false }
alloy-rpc-client = { version = "0.2", default-features = false }

# op
op-alloy-rpc-types = "0.1"
Expand Down Expand Up @@ -535,3 +535,7 @@ serial_test = "3"
similar-asserts = "1.5.0"
test-fuzz = "5"
iai-callgrind = "0.11"

[patch.crates-io]
revm = { path = "../revm/crates/revm" }
revm-primitives = { path = "../revm/crates/primitives" }
4 changes: 2 additions & 2 deletions crates/primitives/src/transaction/eip7702.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub struct TxEip7702 {
/// Authorizations are used to temporarily set the code of its signer to
/// the code referenced by `address`. These also include a `chain_id` (which
/// can be set to zero and not evaluated) as well as an optional `nonce`.
pub authorization_list: Vec<SignedAuthorization<alloy_primitives::Signature>>,
pub authorization_list: Vec<SignedAuthorization>,
/// Input has two uses depending if the transaction `to` field is [`TxKind::Create`] or
/// [`TxKind::Call`].
///
Expand Down Expand Up @@ -105,7 +105,7 @@ impl TxEip7702 {
self.to.size() + // to
mem::size_of::<U256>() + // value
self.access_list.size() + // access_list
mem::size_of::<SignedAuthorization<alloy_primitives::Signature>>()
mem::size_of::<SignedAuthorization>()
* self.authorization_list.capacity() + // authorization_list
self.input.len() // input
}
Expand Down
4 changes: 1 addition & 3 deletions crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ impl Transaction {
/// Returns the [`SignedAuthorization`] list of the transaction.
///
/// Returns `None` if this transaction is not EIP-7702.
pub fn authorization_list(
&self,
) -> Option<&[SignedAuthorization<alloy_primitives::Signature>]> {
pub fn authorization_list(&self) -> Option<&[SignedAuthorization]> {
match self {
Self::Eip7702(tx) => Some(&tx.authorization_list),
_ => None,
Expand Down
6 changes: 3 additions & 3 deletions crates/rpc/rpc-engine-api/src/engine_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ where
let local_hash = self
.inner
.provider
.block_hash(terminal_block_number.to())
.block_hash(terminal_block_number)
.map_err(|err| EngineApiError::Internal(Box::new(err)))?;

// Transition configuration exchange is successful if block hashes match
Expand Down Expand Up @@ -1154,7 +1154,7 @@ mod tests {
.ttd()
.unwrap(),
terminal_block_hash: consensus_terminal_block.hash(),
terminal_block_number: U64::from(terminal_block_number),
terminal_block_number,
};

// Unknown block number
Expand Down Expand Up @@ -1196,7 +1196,7 @@ mod tests {
.ttd()
.unwrap(),
terminal_block_hash: terminal_block.hash(),
terminal_block_number: U64::from(terminal_block_number),
terminal_block_number,
};

handle.provider.add_block(terminal_block.hash(), terminal_block.unseal());
Expand Down
1 change: 1 addition & 0 deletions crates/rpc/rpc-eth-types/src/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ impl ReceiptBuilder {
// EIP-4844 fields
blob_gas_price,
blob_gas_used: blob_gas_used.map(u128::from),
authorization_list: transaction.authorization_list().map(|l| l.to_vec()),
};

Ok(Self { base, other: Default::default() })
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-eth-types/src/revm_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ where
let mut account_info = DatabaseRef::basic_ref(db, account)?.unwrap_or_default();

if let Some(nonce) = account_override.nonce {
account_info.nonce = nonce.to();
account_info.nonce = nonce;
}
if let Some(code) = account_override.code {
account_info.code = Some(Bytecode::new_raw(code));
Expand Down
3 changes: 1 addition & 2 deletions crates/rpc/rpc-types-compat/src/proof.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Compatibility functions for rpc proof related types.

use reth_primitives::U64;
use reth_rpc_types::{
serde_helpers::JsonStorageKey, EIP1186AccountProofResponse, EIP1186StorageProof,
};
Expand All @@ -18,7 +17,7 @@ pub fn from_primitive_account_proof(proof: AccountProof) -> EIP1186AccountProofR
address: proof.address,
balance: info.balance,
code_hash: info.get_bytecode_hash(),
nonce: U64::from(info.nonce),
nonce: info.nonce,
storage_hash: proof.storage_root,
account_proof: proof.proof,
storage_proof: proof.storage_proofs.into_iter().map(from_primitive_storage_proof).collect(),
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-types-compat/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fn fill(
let chain_id = signed_tx.chain_id();
let blob_versioned_hashes = signed_tx.blob_versioned_hashes();
let access_list = signed_tx.access_list().cloned();
let _authorization_list = signed_tx.authorization_list();
let authorization_list = signed_tx.authorization_list().map(|l| l.to_vec());

let signature =
from_primitive_signature(*signed_tx.signature(), signed_tx.tx_type(), signed_tx.chain_id());
Expand Down Expand Up @@ -101,6 +101,7 @@ fn fill(
// EIP-4844 fields
max_fee_per_blob_gas: signed_tx.max_fee_per_blob_gas(),
blob_versioned_hashes,
authorization_list,
// Optimism fields
#[cfg(feature = "optimism")]
other: reth_rpc_types::optimism::OptimismTransactionFields {
Expand Down
2 changes: 0 additions & 2 deletions crates/rpc/rpc-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#[allow(hidden_glob_reexports)]
mod eth;
mod peer;
mod rpc;

// re-export for convenience
pub use alloy_rpc_types::serde_helpers;
Expand Down Expand Up @@ -54,4 +53,3 @@ pub use eth::{
};

pub use peer::*;
pub use rpc::*;
42 changes: 0 additions & 42 deletions crates/rpc/rpc-types/src/rpc.rs

This file was deleted.

3 changes: 1 addition & 2 deletions crates/rpc/rpc/src/admin.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::sync::Arc;

use alloy_genesis::ChainConfig;
use alloy_primitives::B256;
use async_trait::async_trait;
use jsonrpsee::core::RpcResult;
use reth_chainspec::ChainSpec;
Expand Down Expand Up @@ -116,7 +115,7 @@ where
};

let node_info = NodeInfo {
id: B256::from_slice(&enode.id.as_slice()[..32]),
id: enode.id.to_string(),
name: status.client_version,
enode: enode.to_string(),
enr: self.network.local_enr().to_string(),
Expand Down
5 changes: 3 additions & 2 deletions crates/storage/codecs/src/alloy/access_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ mod tests {
use super::*;
use alloy_primitives::Bytes;
use proptest::proptest;
use proptest_arbitrary_interop::arb;
use serde::Deserialize;

proptest! {
#[test]
fn test_roundtrip_compact_access_list_item(access_list_item: AccessListItem) {
fn test_roundtrip_compact_access_list_item(access_list_item in arb::<AccessListItem>()) {
let mut compacted_access_list_item = Vec::<u8>::new();
let len = access_list_item.clone().to_compact(&mut compacted_access_list_item);

Expand All @@ -64,7 +65,7 @@ mod tests {

proptest! {
#[test]
fn test_roundtrip_compact_access_list(access_list: AccessList) {
fn test_roundtrip_compact_access_list(access_list in arb::<AccessList>()) {
let mut compacted_access_list = Vec::<u8>::new();
let len = access_list.clone().to_compact(&mut compacted_access_list);

Expand Down
2 changes: 1 addition & 1 deletion crates/storage/codecs/src/alloy/authorization_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl Compact for AlloyAuthorization {
}
}

impl Compact for SignedAuthorization<alloy_primitives::Signature> {
impl Compact for SignedAuthorization {
fn to_compact<B>(self, buf: &mut B) -> usize
where
B: bytes::BufMut + AsMut<[u8]>,
Expand Down
3 changes: 2 additions & 1 deletion crates/storage/codecs/src/alloy/withdrawal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ impl Compact for AlloyWithdrawal {
mod tests {
use super::*;
use proptest::proptest;
use proptest_arbitrary_interop::arb;

proptest! {
#[test]
fn roundtrip(withdrawal: AlloyWithdrawal) {
fn roundtrip(withdrawal in arb::<AlloyWithdrawal>()) {
let mut compacted_withdrawal = Vec::<u8>::new();
let len = withdrawal.to_compact(&mut compacted_withdrawal);
let (decoded, _) = AlloyWithdrawal::from_compact(&compacted_withdrawal, len);
Expand Down
Loading