Skip to content

Commit

Permalink
feat: bump alloy (#12215)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
  • Loading branch information
klkvr and mattsse authored Nov 6, 2024
1 parent 12b0637 commit 38fdc93
Show file tree
Hide file tree
Showing 52 changed files with 589 additions and 1,047 deletions.
216 changes: 112 additions & 104 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 @@ -418,60 +418,60 @@ reth-trie-db = { path = "crates/trie/db" }
reth-trie-parallel = { path = "crates/trie/parallel" }

# revm
revm = { version = "17.0.0", features = ["std"], default-features = false }
revm-inspectors = "0.10.0"
revm-primitives = { version = "13.0.0", features = [
revm = { version = "18.0.0", features = ["std"], default-features = false }
revm-inspectors = "0.11.0"
revm-primitives = { version = "14.0.0", features = [
"std",
], default-features = false }

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

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

# op
op-alloy-rpc-types = "0.5"
op-alloy-rpc-types-engine = "0.5"
op-alloy-network = "0.5"
op-alloy-consensus = "0.5"
op-alloy-rpc-types = "0.6"
op-alloy-rpc-types-engine = "0.6"
op-alloy-network = "0.6"
op-alloy-consensus = "0.6"

# misc
aquamarine = "0.6"
Expand Down Expand Up @@ -633,4 +633,4 @@ tracy-client = "0.17.3"
#op-alloy-rpc-types = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" }
#op-alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" }
#op-alloy-network = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" }
#op-alloy-consensus = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" }
#op-alloy-consensus = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" }
7 changes: 5 additions & 2 deletions bin/reth-bench/src/bench/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,17 @@ impl BenchContext {
let first_block = match benchmark_mode {
BenchMode::Continuous => {
// fetch Latest block
block_provider.get_block_by_number(BlockNumberOrTag::Latest, true).await?.unwrap()
block_provider
.get_block_by_number(BlockNumberOrTag::Latest, true.into())
.await?
.unwrap()
}
BenchMode::Range(ref mut range) => {
match range.next() {
Some(block_number) => {
// fetch first block in range
block_provider
.get_block_by_number(block_number.into(), true)
.get_block_by_number(block_number.into(), true.into())
.await?
.unwrap()
}
Expand Down
9 changes: 5 additions & 4 deletions bin/reth-bench/src/bench/new_payload_fcu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,17 @@ impl Command {
let (sender, mut receiver) = tokio::sync::mpsc::channel(1000);
tokio::task::spawn(async move {
while benchmark_mode.contains(next_block) {
let block_res = block_provider.get_block_by_number(next_block.into(), true).await;
let block_res =
block_provider.get_block_by_number(next_block.into(), true.into()).await;
let block = block_res.unwrap().unwrap();
let block_hash = block.header.hash;
let block = Block::try_from(block.inner).unwrap().seal(block_hash);
let block = Block::try_from(block).unwrap().seal(block_hash);
let head_block_hash = block.hash();
let safe_block_hash = block_provider
.get_block_by_number(block.number.saturating_sub(32).into(), false);
.get_block_by_number(block.number.saturating_sub(32).into(), false.into());

let finalized_block_hash = block_provider
.get_block_by_number(block.number.saturating_sub(64).into(), false);
.get_block_by_number(block.number.saturating_sub(64).into(), false.into());

let (safe, finalized) = tokio::join!(safe_block_hash, finalized_block_hash,);

Expand Down
5 changes: 3 additions & 2 deletions bin/reth-bench/src/bench/new_payload_only.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ impl Command {
let (sender, mut receiver) = tokio::sync::mpsc::channel(1000);
tokio::task::spawn(async move {
while benchmark_mode.contains(next_block) {
let block_res = block_provider.get_block_by_number(next_block.into(), true).await;
let block_res =
block_provider.get_block_by_number(next_block.into(), true.into()).await;
let block = block_res.unwrap().unwrap();
let block_hash = block.header.hash;
let block = Block::try_from(block.inner).unwrap().seal(block_hash);
let block = Block::try_from(block).unwrap().seal(block_hash);

next_block += 1;
sender.send(block).await.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion crates/blockchain-tree/src/blockchain_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ mod tests {
use alloy_consensus::{TxEip1559, EMPTY_ROOT_HASH};
use alloy_eips::eip1559::INITIAL_BASE_FEE;
use alloy_genesis::{Genesis, GenesisAccount};
use alloy_primitives::{keccak256, Address, Sealable, Signature, B256};
use alloy_primitives::{keccak256, Address, PrimitiveSignature as Signature, Sealable, B256};
use assert_matches::assert_matches;
use linked_hash_set::LinkedHashSet;
use reth_chainspec::{ChainSpecBuilder, MAINNET, MIN_TRANSACTION_GAS};
Expand Down
5 changes: 3 additions & 2 deletions crates/consensus/common/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ mod tests {
use alloy_consensus::{TxEip4844, EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH};
use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber};
use alloy_primitives::{
hex_literal::hex, Address, BlockHash, BlockNumber, Bytes, Parity, Sealable, Signature, U256,
hex_literal::hex, Address, BlockHash, BlockNumber, Bytes, PrimitiveSignature as Signature,
Sealable, U256,
};
use mockall::mock;
use rand::Rng;
Expand Down Expand Up @@ -403,7 +404,7 @@ mod tests {
blob_versioned_hashes: std::iter::repeat_with(|| rng.gen()).take(num_blobs).collect(),
});

let signature = Signature::new(U256::default(), U256::default(), Parity::Parity(true));
let signature = Signature::new(U256::default(), U256::default(), true);

TransactionSigned::from_transaction_and_signature(request, signature)
}
Expand Down
18 changes: 7 additions & 11 deletions crates/consensus/debug-client/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloy_consensus::TxEnvelope;
use alloy_consensus::Transaction;
use alloy_eips::eip2718::Encodable2718;
use alloy_primitives::B256;
use alloy_rpc_types::{Block, BlockTransactions};
Expand Down Expand Up @@ -184,18 +184,19 @@ pub fn block_to_execution_payload_v3(block: Block) -> ExecutionNewPayload {
// https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#specification
let versioned_hashes = transactions
.iter()
.flat_map(|tx| tx.blob_versioned_hashes.clone().unwrap_or_default())
.flat_map(|tx| tx.blob_versioned_hashes().unwrap_or_default())
.copied()
.collect();

let payload: ExecutionPayloadV3 = ExecutionPayloadV3 {
payload_inner: ExecutionPayloadV2 {
payload_inner: ExecutionPayloadV1 {
parent_hash: block.header.parent_hash,
fee_recipient: block.header.miner,
fee_recipient: block.header.beneficiary,
state_root: block.header.state_root,
receipts_root: block.header.receipts_root,
logs_bloom: block.header.logs_bloom,
prev_randao: block.header.mix_hash.unwrap(),
prev_randao: block.header.mix_hash,
block_number: block.header.number,
gas_limit: block.header.gas_limit,
gas_used: block.header.gas_used,
Expand All @@ -205,15 +206,10 @@ pub fn block_to_execution_payload_v3(block: Block) -> ExecutionNewPayload {
block_hash: block.header.hash,
transactions: transactions
.into_iter()
.map(|tx| {
let envelope: TxEnvelope = tx.try_into().unwrap();
let mut buffer: Vec<u8> = vec![];
envelope.encode_2718(&mut buffer);
buffer.into()
})
.map(|tx| tx.inner.encoded_2718().into())
.collect(),
},
withdrawals: block.withdrawals.clone().unwrap_or_default(),
withdrawals: block.withdrawals.clone().unwrap_or_default().into_inner(),
},
blob_gas_used: block.header.blob_gas_used.unwrap(),
excess_blob_gas: block.header.excess_blob_gas.unwrap(),
Expand Down
6 changes: 3 additions & 3 deletions crates/consensus/debug-client/src/providers/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ impl BlockProvider for RpcBlockProvider {
.expect("failed to subscribe on new blocks")
.into_stream();

while let Some(block) = stream.next().await {
while let Some(header) = stream.next().await {
let full_block = ws_provider
.get_block_by_hash(block.header.hash, BlockTransactionsKind::Full)
.get_block_by_hash(header.hash, BlockTransactionsKind::Full)
.await
.expect("failed to get block")
.expect("block not found");
Expand All @@ -49,7 +49,7 @@ impl BlockProvider for RpcBlockProvider {
.await
.expect("failed to create WS provider");
let block: Block = ws_provider
.get_block_by_number(BlockNumberOrTag::Number(block_number), true)
.get_block_by_number(BlockNumberOrTag::Number(block_number), true.into())
.await?
.ok_or_else(|| eyre::eyre!("block not found by number {}", block_number))?;
Ok(block)
Expand Down
3 changes: 2 additions & 1 deletion crates/ethereum/node/tests/e2e/p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ async fn e2e_test_send_transactions() -> eyre::Result<()> {

assert_eq!(second_provider.get_block_number().await?, 0);

let head = provider.get_block_by_number(Default::default(), false).await?.unwrap().header.hash;
let head =
provider.get_block_by_number(Default::default(), false.into()).await?.unwrap().header.hash;
second_node.engine_api.update_forkchoice(head, head).await?;

let start = std::time::Instant::now();
Expand Down
7 changes: 4 additions & 3 deletions crates/ethereum/node/tests/e2e/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async fn test_fee_history() -> eyre::Result<()> {
let receipt = builder.get_receipt().await?;
assert!(receipt.status());

let block = provider.get_block_by_number(1.into(), false).await?.unwrap();
let block = provider.get_block_by_number(1.into(), false.into()).await?.unwrap();
assert_eq!(block.header.gas_used as u128, receipt.gas_used,);
assert_eq!(block.header.base_fee_per_gas.unwrap(), expected_first_base_fee as u64);

Expand All @@ -89,7 +89,7 @@ async fn test_fee_history() -> eyre::Result<()> {
let fee_history = provider.get_fee_history(block_count, latest_block.into(), &[]).await?;

let mut prev_header = provider
.get_block_by_number((latest_block + 1 - block_count).into(), false)
.get_block_by_number((latest_block + 1 - block_count).into(), false.into())
.await?
.unwrap()
.header;
Expand All @@ -101,7 +101,8 @@ async fn test_fee_history() -> eyre::Result<()> {
chain_spec.base_fee_params_at_block(block),
);

let header = provider.get_block_by_number(block.into(), false).await?.unwrap().header;
let header =
provider.get_block_by_number(block.into(), false.into()).await?.unwrap().header;

assert_eq!(header.base_fee_per_gas.unwrap(), expected_base_fee as u64);
assert_eq!(
Expand Down
10 changes: 5 additions & 5 deletions crates/net/eth-wire-types/src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ mod tests {
};
use alloy_consensus::TxLegacy;
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{hex, Parity, Signature, TxKind, U256};
use alloy_primitives::{hex, PrimitiveSignature as Signature, TxKind, U256};
use alloy_rlp::{Decodable, Encodable};
use reth_primitives::{Header, Transaction, TransactionSigned};
use std::str::FromStr;
Expand Down Expand Up @@ -373,7 +373,7 @@ mod tests {
}), Signature::new(
U256::from_str("0x64b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12").unwrap(),
U256::from_str("0x64b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10").unwrap(),
Parity::Parity(false),
false,
),
),
TransactionSigned::from_transaction_and_signature(Transaction::Legacy(TxLegacy {
Expand All @@ -387,7 +387,7 @@ mod tests {
}), Signature::new(
U256::from_str("0x52f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb").unwrap(),
U256::from_str("0x52f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb").unwrap(),
Parity::Parity(false),
false,
),
),
],
Expand Down Expand Up @@ -446,7 +446,7 @@ mod tests {
Signature::new(
U256::from_str("0x64b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12").unwrap(),
U256::from_str("0x64b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10").unwrap(),
Parity::Eip155(37),
false,
),
),
TransactionSigned::from_transaction_and_signature(
Expand All @@ -462,7 +462,7 @@ mod tests {
Signature::new(
U256::from_str("0x52f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb").unwrap(),
U256::from_str("0x52f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb").unwrap(),
Parity::Eip155(37),
false,
),
),
],
Expand Down
Loading

0 comments on commit 38fdc93

Please sign in to comment.