Skip to content

Commit

Permalink
Merge pull request #271 from jacobkaufmann/chore-dep-reth
Browse files Browse the repository at this point in the history
chore: bump alloy and reth versions
  • Loading branch information
ralexstokes authored Oct 23, 2024
2 parents d213263 + b1ce416 commit 9e2b415
Show file tree
Hide file tree
Showing 17 changed files with 3,827 additions and 2,565 deletions.
5,889 changes: 3,552 additions & 2,337 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ incremental = false
ethereum-consensus = { git = "https://github.com/ralexstokes/ethereum-consensus", rev = "cf3c404043230559660810bc0c9d6d5a8498d819" }
beacon-api-client = { git = "https://github.com/ralexstokes/ethereum-consensus", rev = "cf3c404043230559660810bc0c9d6d5a8498d819" }

reth = { git = "https://github.com/paradigmxyz/reth", rev = "5f82993c23164ce8ccdc7bf3ae5085205383a5c8" }
reth-db = { git = "https://github.com/paradigmxyz/reth", rev = "5f82993c23164ce8ccdc7bf3ae5085205383a5c8" }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", rev = "5f82993c23164ce8ccdc7bf3ae5085205383a5c8" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", rev = "5f82993c23164ce8ccdc7bf3ae5085205383a5c8" }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240" }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240" }
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.8" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.8" }
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.8" }
reth-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.8" }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.8" }
alloy = { version = "0.4.2", features = ["consensus", "eips", "signers", "signer-local", "signer-mnemonic"] }

futures = "0.3.21"
tokio = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions bin/mev/src/cmd/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::cmd::config::Config;
use clap::Args;
use reth::cli::Cli;
use reth::{args::utils::EthereumChainSpecParser, cli::Cli};

#[derive(Debug, Args)]
pub struct CliArgs {
Expand All @@ -16,4 +16,4 @@ impl TryFrom<CliArgs> for Config {
}
}

pub type Command = Cli<CliArgs>;
pub type Command = Cli<EthereumChainSpecParser, CliArgs>;
6 changes: 3 additions & 3 deletions mev-build-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ beacon-api-client = { workspace = true }
mev-rs = { path = "../mev-rs" }

reth = { workspace = true }
reth-basic-payload-builder = { workspace = true }
reth-db = { workspace = true }
reth-evm = { workspace = true }
reth-node-ethereum = { workspace = true }
reth-basic-payload-builder = { workspace = true }
alloy-signer = { workspace = true }
alloy-signer-wallet = { workspace = true, features = ["mnemonic"] }
alloy = { workspace = true }

sha2 = { workspace = true }
eyre = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion mev-build-rs/src/auctioneer/auction_schedule.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ethereum_consensus::primitives::{BlsPublicKey, Slot};
use mev_rs::types::ProposerSchedule;
use reth::primitives::Address;
use reth::primitives::revm_primitives::Address;
use std::collections::{HashMap, HashSet};

pub type RelayIndex = usize;
Expand Down
4 changes: 2 additions & 2 deletions mev-build-rs/src/auctioneer/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use mev_rs::{
};
use reth::{
api::{EngineTypes, PayloadBuilderAttributes},
payload::{EthBuiltPayload, Events, PayloadBuilderHandle, PayloadId},
payload::{EthBuiltPayload, Events, PayloadBuilder, PayloadBuilderHandle, PayloadId},
};
use serde::Deserialize;
use std::{
Expand Down Expand Up @@ -320,7 +320,7 @@ impl<
block_number = payload.block().number,
block_hash = %payload.block().hash(),
parent_hash = %payload.block().header.header().parent_hash,
txn_count = %payload.block().body.len(),
txn_count = %payload.block().body.transactions.len(),
blob_count = %payload.sidecars().iter().map(|s| s.blobs.len()).sum::<usize>(),
value = %payload.fees(),
relays=?relay_set,
Expand Down
2 changes: 1 addition & 1 deletion mev-build-rs/src/bidder/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
auctioneer::AuctionContext,
bidder::{strategies::BasicStrategy, Config},
};
use reth::{primitives::U256, tasks::TaskExecutor};
use reth::{primitives::revm_primitives::U256, tasks::TaskExecutor};
use std::sync::Arc;
use tokio::sync::{mpsc::Receiver, oneshot};
use tracing::trace;
Expand Down
2 changes: 1 addition & 1 deletion mev-build-rs/src/bidder/strategies/basic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::auctioneer::AuctionContext;
use reth::primitives::U256;
use reth::primitives::revm_primitives::U256;
use serde::Deserialize;

#[derive(Deserialize, Debug, Default, Clone)]
Expand Down
12 changes: 8 additions & 4 deletions mev-build-rs/src/compat.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
use crate::Error;
use alloy::eips::eip2718::Encodable2718;
use ethereum_consensus::{
crypto::{KzgCommitment, KzgProof},
primitives::{Bytes32, ExecutionAddress},
ssz::prelude::{ByteList, ByteVector, SimpleSerializeError, U256},
Fork,
};
use mev_rs::types::{BlobsBundle, ExecutionPayload};
use reth::primitives::{Address, BlobTransactionSidecar, Bloom, SealedBlock, B256};
use reth::primitives::{
revm_primitives::{alloy_primitives::Bloom, Address, B256},
BlobTransactionSidecar, SealedBlock,
};

#[cfg(not(feature = "minimal-preset"))]
use ethereum_consensus::deneb::mainnet as deneb;
Expand All @@ -28,13 +32,13 @@ fn to_byte_vector(value: Bloom) -> ByteVector<256> {
pub fn to_execution_payload(value: &SealedBlock, fork: Fork) -> Result<ExecutionPayload, Error> {
let hash = value.hash();
let header = &value.header;
let transactions = &value.body;
let withdrawals = &value.withdrawals;
let transactions = &value.body.transactions;
let withdrawals = &value.body.withdrawals;
match fork {
Fork::Deneb => {
let transactions = transactions
.iter()
.map(|t| deneb::Transaction::try_from(t.envelope_encoded().as_ref()).unwrap())
.map(|t| deneb::Transaction::try_from(t.encoded_2718().as_ref()).unwrap())
.collect::<Vec<_>>();
let withdrawals = withdrawals
.as_ref()
Expand Down
6 changes: 3 additions & 3 deletions mev-build-rs/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloy_signer_wallet::WalletError;
use alloy::signers::local::LocalSignerError;
use ethereum_consensus::{Error as ConsensusError, Fork};
use reth::payload::error::PayloadBuilderError;
use reth::payload::PayloadBuilderError;
use thiserror::Error;

#[derive(Error, Debug)]
Expand All @@ -12,5 +12,5 @@ pub enum Error {
#[error(transparent)]
PayloadBuilderError(#[from] PayloadBuilderError),
#[error(transparent)]
WalletError(#[from] WalletError),
SignerError(#[from] LocalSignerError),
}
49 changes: 25 additions & 24 deletions mev-build-rs/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,18 @@ use crate::payload::{
attributes::BuilderPayloadBuilderAttributes, service_builder::PayloadServiceBuilder,
};
use reth::{
api::{
validate_version_specific_fields, EngineApiMessageVersion, EngineObjectValidationError,
EngineTypes, FullNodeTypes, PayloadOrAttributes,
},
builder::{components::ComponentsBuilder, NodeTypes},
api::{EngineTypes, FullNodeTypes, PayloadTypes},
builder::{components::ComponentsBuilder, NodeTypes, NodeTypesWithEngine},
chainspec::ChainSpec,
payload::EthBuiltPayload,
primitives::ChainSpec,
rpc::types::{
engine::{
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3,
PayloadAttributes as EthPayloadAttributes,
},
ExecutionPayloadV1,
rpc::types::engine::{
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4,
ExecutionPayloadV1, PayloadAttributes as EthPayloadAttributes,
},
};
use reth_node_ethereum::node::{
EthereumExecutorBuilder, EthereumNetworkBuilder, EthereumPoolBuilder,
EthereumConsensusBuilder, EthereumEngineValidatorBuilder, EthereumExecutorBuilder,
EthereumNetworkBuilder, EthereumPoolBuilder,
};

#[derive(Debug, Default, Clone, Copy)]
Expand All @@ -36,40 +31,46 @@ impl BuilderNode {
PayloadServiceBuilder,
EthereumNetworkBuilder,
EthereumExecutorBuilder,
EthereumConsensusBuilder,
EthereumEngineValidatorBuilder,
>
where
Node: FullNodeTypes<Engine = BuilderEngineTypes>,
Node: FullNodeTypes<
Types: NodeTypesWithEngine<Engine = BuilderEngineTypes, ChainSpec = ChainSpec>,
>,
{
ComponentsBuilder::default()
.node_types::<Node>()
.pool(EthereumPoolBuilder::default())
.payload(payload_service_builder)
.network(EthereumNetworkBuilder::default())
.executor(EthereumExecutorBuilder::default())
.consensus(EthereumConsensusBuilder::default())
.engine_validator(EthereumEngineValidatorBuilder::default())
}
}

impl NodeTypes for BuilderNode {
type Primitives = ();
type ChainSpec = ChainSpec;
}

impl NodeTypesWithEngine for BuilderNode {
type Engine = BuilderEngineTypes;
}

#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct BuilderEngineTypes;

impl EngineTypes for BuilderEngineTypes {
impl PayloadTypes for BuilderEngineTypes {
type BuiltPayload = EthBuiltPayload;
type PayloadAttributes = EthPayloadAttributes;
type PayloadBuilderAttributes = BuilderPayloadBuilderAttributes;
type BuiltPayload = EthBuiltPayload;
}

impl EngineTypes for BuilderEngineTypes {
type ExecutionPayloadV1 = ExecutionPayloadV1;
type ExecutionPayloadV2 = ExecutionPayloadEnvelopeV2;
type ExecutionPayloadV3 = ExecutionPayloadEnvelopeV3;

fn validate_version_specific_fields(
chain_spec: &ChainSpec,
version: EngineApiMessageVersion,
payload_or_attrs: PayloadOrAttributes<'_, Self::PayloadAttributes>,
) -> Result<(), EngineObjectValidationError> {
validate_version_specific_fields(chain_spec, version, payload_or_attrs)
}
type ExecutionPayloadV4 = ExecutionPayloadEnvelopeV4;
}
16 changes: 5 additions & 11 deletions mev-build-rs/src/payload/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ use reth::{
api::PayloadBuilderAttributes,
payload::{EthPayloadBuilderAttributes, PayloadId},
primitives::{
alloy_primitives::private::alloy_rlp::Encodable,
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
Address, ChainSpec, Header, Withdrawals, B256, B64,
revm_primitives::{
alloy_primitives::{private::alloy_rlp::Encodable, B64},
Address, B256,
},
Withdrawals,
},
rpc::types::engine::PayloadAttributes,
};
Expand Down Expand Up @@ -121,12 +123,4 @@ impl PayloadBuilderAttributes for BuilderPayloadBuilderAttributes {
fn withdrawals(&self) -> &Withdrawals {
&self.inner.withdrawals
}

fn cfg_and_block_env(
&self,
chain_spec: &ChainSpec,
parent: &Header,
) -> (CfgEnvWithHandlerCfg, BlockEnv) {
self.inner.cfg_and_block_env(chain_spec, parent)
}
}
Loading

0 comments on commit 9e2b415

Please sign in to comment.