Skip to content

Commit

Permalink
bump alloy 0.6.4, revm 18.0, alloy-core 0.8.12, reth rev=61d32e9 (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
dexloom authored Nov 15, 2024
1 parent 238b908 commit 1d192c7
Show file tree
Hide file tree
Showing 52 changed files with 1,118 additions and 1,146 deletions.
1,533 changes: 734 additions & 799 deletions Cargo.lock

Large diffs are not rendered by default.

121 changes: 63 additions & 58 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ homepage = "https://github.com/dexloom/loom"
license = "MIT OR Apache-2.0"
repository = "https://github.com/dexloom/loom"
rust-version = "1.82"
version = "0.2.0"
version = "0.3.0"

[workspace.dependencies]
# broadcast
Expand Down Expand Up @@ -132,7 +132,7 @@ tracing-subscriber = "0.3.18"

# error handling
eyre = "0.6.12"
thiserror = "1.0.65"
thiserror = "1.0.69"

# async
async-stream = "0.3.6"
Expand Down Expand Up @@ -196,12 +196,12 @@ wiremock = "0.6.2"
## We keep revm and alloy dependencies pinned to specific versions as reth depends on them

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

# alloy
alloy = { version = "0.5.4", features = [
alloy = { version = "0.6.4", features = [
"consensus",
"full",
"json-rpc",
Expand All @@ -213,60 +213,65 @@ alloy = { version = "0.5.4", features = [
"rpc-types-trace",
"serde",
] }
alloy-chains = "0.1.32"
alloy-consensus = "0.5.4"
alloy-contract = "0.5.4"
alloy-dyn-abi = { version = "0.8.9", features = ["json", "std"] }
alloy-eips = "0.5.4"
alloy-json-rpc = "0.5.4"
alloy-network = "0.5.4"
alloy-node-bindings = "0.5.4"
alloy-primitives = { version = "0.8.9", features = ["rand"] }
alloy-provider = { version = "0.5.4", features = ["anvil-api", "anvil-node", "debug-api", "ipc", "pubsub", "reqwest", "ws"] }
alloy-pubsub = "0.5.4"
alloy-rlp = "0.3.8"
alloy-rpc-client = { version = "0.5.4", features = ["ipc", "pubsub", "reqwest", "ws"] }
alloy-rpc-types = "0.5.4"
alloy-rpc-types-anvil = "0.5.4"
alloy-rpc-types-beacon = "0.5.4"
alloy-rpc-types-engine = "0.5.4"
alloy-rpc-types-eth = "0.5.4"
alloy-rpc-types-trace = "0.5.4"
alloy-serde = "0.5.4"
alloy-signer = "0.5.4"
alloy-signer-local = "0.5.4"
alloy-sol-macro = { version = "0.8.9", features = ["json"] }
alloy-sol-types = { version = "0.8.9", features = ["json"] }
alloy-transport = "0.5.4"
alloy-transport-http = "0.5.4"
alloy-transport-ipc = "0.5.4"
alloy-transport-ws = "0.5.4"
alloy-trie = "0.7.2"
alloy-consensus = "0.6.4"
alloy-contract = "0.6.4"
alloy-eips = "0.6.4"
alloy-json-rpc = "0.6.4"
alloy-network = "0.6.4"
alloy-node-bindings = "0.6.4"
alloy-provider = { version = "0.6.4", features = ["anvil-api", "anvil-node", "debug-api", "ipc", "pubsub", "reqwest", "ws"] }
alloy-pubsub = "0.6.4"
alloy-rpc-client = { version = "0.6.4", features = ["ipc", "pubsub", "reqwest", "ws"] }
alloy-rpc-types = "0.6.4"
alloy-rpc-types-anvil = "0.6.4"
alloy-rpc-types-beacon = "0.6.4"
alloy-rpc-types-engine = "0.6.4"
alloy-rpc-types-eth = "0.6.4"
alloy-rpc-types-trace = "0.6.4"
alloy-serde = "0.6.4"
alloy-signer = "0.6.4"
alloy-signer-local = "0.6.4"
alloy-transport = "0.6.4"
alloy-transport-http = "0.6.4"
alloy-transport-ipc = "0.6.4"
alloy-transport-ws = "0.6.4"

#alloy-core
alloy-dyn-abi = { version = "0.8.12", features = ["json", "std"] }
alloy-primitives = { version = "0.8.12", features = ["rand"] }
alloy-sol-macro = { version = "0.8.12", features = ["json"] }
alloy-sol-types = { version = "0.8.12", features = ["json"] }

#alloy-related
alloy-chains = "0.1.47"
alloy-rlp = "0.3.9"
alloy-trie = "0.7.4"


# reth
reth = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a", features = ["asm-keccak"] }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-codecs = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-codecs-derive = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-db = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-ethereum-forks = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-execution-types = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-exex = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a", features = ["serde"] }
reth-exex-test-utils = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-node-core = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a", features = ["asm-keccak"] }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-node-types = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a", features = ["asm-keccak"] }
reth-provider = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-revm = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-rpc = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-storage-api = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-testing-utils = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-tracing = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", rev = "ff9a42a" }
reth = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9", features = ["asm-keccak"] }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-codecs = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-codecs-derive = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-db = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-ethereum-forks = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-execution-types = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-exex = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9", features = ["serde"] }
reth-exex-test-utils = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-node-core = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9", features = ["asm-keccak"] }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-node-types = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9", features = ["asm-keccak"] }
reth-provider = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-revm = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-rpc = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-storage-api = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-testing-utils = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-tracing = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", rev = "61d32e9" }

[profile.test]
debug = 1
Expand Down
11 changes: 6 additions & 5 deletions bin/gasbench/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use std::collections::{BTreeMap, HashMap};
use std::env;
use std::sync::Arc;

use alloy_network::primitives::BlockTransactionsKind;
use alloy_primitives::{Address, BlockNumber, Bytes, U256};
use alloy_provider::Provider;
use alloy_rpc_types::{BlockNumberOrTag, TransactionInput, TransactionRequest};
Expand All @@ -10,6 +7,9 @@ use colored::*;
use eyre::{OptionExt, Result};
use revm::primitives::Env;
use serde::{Deserialize, Serialize};
use std::collections::{BTreeMap, HashMap};
use std::env;
use std::sync::Arc;
use tokio::fs::File;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tracing::{error, info};
Expand Down Expand Up @@ -53,7 +53,8 @@ async fn main() -> Result<()> {

let client = AnvilDebugProviderFactory::from_node_on_block(node_url, BlockNumber::from(block_number)).await?;

let block_header = client.get_block_by_number(BlockNumberOrTag::Number(block_number), false).await?.unwrap().header;
let block_header =
client.get_block_by_number(BlockNumberOrTag::Number(block_number), BlockTransactionsKind::Hashes).await?.unwrap().header;

let operator_address = Address::repeat_byte(0x12);
let multicaller_address = Address::repeat_byte(0x78);
Expand Down
3 changes: 2 additions & 1 deletion bin/loom_anvil/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "loom_anvil"
version = "0.2.0"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
Expand Down Expand Up @@ -28,6 +28,7 @@ alloy-node-bindings.workspace = true
alloy-primitives.workspace = true
alloy-provider.workspace = true
alloy-rpc-types.workspace = true
alloy-rpc-types-eth.workspace = true
alloy-rpc-types-trace.workspace = true
alloy-transport-http.workspace = true
alloy-transport-ipc.workspace = true
Expand Down
44 changes: 22 additions & 22 deletions bin/loom_anvil/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ use std::fmt::{Display, Formatter};
use std::process::exit;
use std::time::Duration;

use alloy_provider::network::TransactionResponse;

use crate::flashbots_mock::mount_flashbots_mock;
use crate::flashbots_mock::BundleRequest;
use crate::test_config::TestConfig;
use alloy_consensus::TxEnvelope;
use alloy_primitives::{address, TxHash, U256};
use alloy_provider::network::eip2718::Encodable2718;
use alloy_provider::Provider;
Expand Down Expand Up @@ -547,29 +548,28 @@ async fn main() -> Result<()> {
};

let from = tx.from;
let to = tx.to.unwrap_or_default();
if let Ok(tx_env) = TryInto::<TxEnvelope>::try_into(tx.clone()) {
match tx_config.send.to_lowercase().as_str() {
"mempool" => {
let mut mempool_guard = mempool_instance.write().await;
let tx_hash: TxHash = tx.hash;

mempool_guard.add_tx(tx.clone());
if let Err(e) = mempool_events_channel.send(MempoolEvents::MempoolActualTxUpdate { tx_hash }).await {
error!("{e}");
}
let to = tx.to().unwrap_or_default();

match tx_config.send.to_lowercase().as_str() {
"mempool" => {
let mut mempool_guard = mempool_instance.write().await;
let tx_hash: TxHash = tx.tx_hash();

mempool_guard.add_tx(tx.clone());
if let Err(e) = mempool_events_channel.send(MempoolEvents::MempoolActualTxUpdate { tx_hash }).await {
error!("{e}");
}
"block" => match client_clone.send_raw_transaction(tx_env.encoded_2718().as_slice()).await {
Ok(p) => {
debug!("Transaction sent {}", p.tx_hash());
}
Err(e) => {
error!("Error sending transaction : {e}");
}
},
_ => {
debug!("Incorrect action {} for : hash {} from {} to {} ", tx_config.send, tx_env.tx_hash(), from, to);
}
"block" => match client_clone.send_raw_transaction(tx.inner.encoded_2718().as_slice()).await {
Ok(p) => {
debug!("Transaction sent {}", p.tx_hash());
}
Err(e) => {
error!("Error sending transaction : {e}");
}
},
_ => {
debug!("Incorrect action {} for : hash {} from {} to {} ", tx_config.send, tx.tx_hash(), from, to);
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions bin/nodebench/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::cli::Cli;
use alloy::network::primitives::BlockTransactionsKind;
use alloy::primitives::{BlockHash, BlockNumber};
use alloy::transports::BoxTransport;
use alloy::{
Expand Down Expand Up @@ -386,7 +387,7 @@ async fn main() -> Result<()> {
let start_time = Local::now();
for _i in 0u64..10 {
let block_number = provider.get_block_number().await?;
let _ = provider.get_block_by_number(BlockNumberOrTag::Number(block_number), false).await?;
let _ = provider.get_block_by_number(BlockNumberOrTag::Number(block_number), BlockTransactionsKind::Hashes).await?;
}
let ping_time = (Local::now() - start_time) / (10 * 2);
println!("Ping time {idx} : {ping_time}");
Expand All @@ -407,7 +408,8 @@ async fn main() -> Result<()> {

for (block_number, _) in stat.block_headers.iter() {
println!("Getting block {block_number}");
let block = first_provider.get_block_by_number(BlockNumberOrTag::Number(*block_number), false).await?.unwrap();
let block =
first_provider.get_block_by_number(BlockNumberOrTag::Number(*block_number), BlockTransactionsKind::Hashes).await?.unwrap();

calc.total_txs += block.transactions.len();

Expand Down
18 changes: 9 additions & 9 deletions crates/broadcast/accounts/src/accounts_monitor/accounts_actor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::marker::PhantomData;
use std::time::Duration;

use alloy_consensus::Transaction;
use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_network::Network;
use alloy_primitives::{Address, Log, U256};
Expand All @@ -15,6 +13,8 @@ use loom_defi_abi::IERC20::IERC20Events;
use loom_types_entities::{AccountNonceAndBalanceState, LatestBlock};
use loom_types_events::MarketEvents;
use revm::DatabaseRef;
use std::marker::PhantomData;
use std::time::Duration;
use tokio::sync::broadcast::error::RecvError;
use tokio::time::sleep;
use tracing::debug;
Expand Down Expand Up @@ -80,18 +80,18 @@ pub async fn nonce_and_balance_monitor_worker(
let tx_from : Address = tx.from;
if accounts_lock.is_monitored(&tx_from) {
if let Some(&mut ref mut account) = accounts_lock.get_mut_account(&tx_from) {
let spent = (tx.max_fee_per_gas.unwrap() + tx.max_priority_fee_per_gas.unwrap()) * tx.gas as u128 + tx.value.to::<u128>();
let spent = (tx.max_fee_per_gas() + tx.max_priority_fee_per_gas().unwrap()) * tx.gas_limit() as u128 + tx.value().to::<u128>();
let value = U256::from(spent);
account.sub_balance(Address::ZERO, value).set_nonce(tx.nonce+1);
debug!("Account {} : sub ETH balance {} -> {} nonce {}", tx_from, value, account.get_eth_balance(), tx.nonce+1);
account.sub_balance(Address::ZERO, value).set_nonce(tx.nonce()+1);
debug!("Account {} : sub ETH balance {} -> {} nonce {}", tx_from, value, account.get_eth_balance(), tx.nonce()+1);
}
}

if let Some(to ) = tx.to {
if let Some(to ) = tx.to() {
if accounts_lock.is_monitored(&to) {
if let Some(&mut ref mut account) = accounts_lock.get_mut_account(&to) {
account.add_balance(Address::ZERO, tx.value);
debug!("Account {} : add ETH balance {} -> {}", to, tx.value, account.get_eth_balance());
account.add_balance(Address::ZERO, tx.value());
debug!("Account {} : add ETH balance {} -> {}", to, tx.value(), account.get_eth_balance());
}
}
}
Expand Down
16 changes: 2 additions & 14 deletions crates/broadcast/accounts/src/signers/signers_actor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use alloy_consensus::TxEnvelope;
use alloy_rlp::Encodable;
use alloy_eips::eip2718::Encodable2718;
use eyre::{eyre, Result};
use revm::DatabaseRef;
use tokio::sync::broadcast::error::RecvError;
Expand Down Expand Up @@ -29,18 +28,7 @@ async fn sign_task<DB: Send + Sync + Clone>(
.unwrap()
.iter()
.map(|tx_request| match &tx_request {
TxState::Stuffing(t) => {
let typed_tx: Result<TxEnvelope, _> = t.clone().try_into();

match typed_tx {
Ok(typed_tx) => {
let mut v: Vec<u8> = Vec::new();
typed_tx.encode(&mut v);
RlpState::Stuffing(v.into())
}
_ => RlpState::None,
}
}
TxState::Stuffing(t) => RlpState::Stuffing(t.inner.encoded_2718().into()),
TxState::SignatureRequired(t) => {
let (tx_hash, signed_tx_bytes) = signer.sign_sync(t.clone()).unwrap();
info!("Tx signed {tx_hash:?}");
Expand Down
3 changes: 2 additions & 1 deletion crates/broadcast/broadcaster/src/anvil.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::marker::PhantomData;

use alloy_eips::BlockNumberOrTag;
use alloy_network::primitives::BlockTransactionsKind;
use alloy_network::{Ethereum, Network};
use alloy_provider::Provider;
use alloy_rpc_types::BlockTransactions;
Expand Down Expand Up @@ -68,7 +69,7 @@ where
}
client.mine().await?;

let block = client.get_block_by_number(BlockNumberOrTag::Latest, false).await?.unwrap_or_default();
let block = client.get_block_by_number(BlockNumberOrTag::Latest, BlockTransactionsKind::Hashes).await?.unwrap_or_default();
if let BlockTransactions::Hashes(hashes) = block.transactions {
for tx_hash in hashes {
let reciept = client.get_transaction_receipt(tx_hash).await?.unwrap();
Expand Down
Loading

0 comments on commit 1d192c7

Please sign in to comment.