Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
- **Check formatting**: `make fmt-check`
- **Run linter**: `make lint`
- **Run all checks**: `make check-all`
- After changes, run `make check-all`.

### Running the Node
- **Run with defaults**: `make run`
Expand Down
31 changes: 31 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ resolver = "2"
members = [
"bin/ev-reth",
"crates/common",
"crates/ev-primitives",
"crates/evolve",
"crates/node",
"crates/tests",
Expand Down Expand Up @@ -47,13 +48,14 @@ reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth.git", tag =
reth-network = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-network-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-chain-state = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-db-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-ethereum = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-ethereum-cli = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-engine-local = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-engine-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-ethereum-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-ethereum-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-ethereum-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4", features = ["serde", "serde-bincode-compat", "reth-codec"] }
reth-e2e-test-utils = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-evm = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
Expand All @@ -69,8 +71,12 @@ reth-revm = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-rpc-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-rpc-builder = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-rpc-engine-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-rpc = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-rpc-convert = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }
reth-codecs = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.8.4" }

ev-revm = { path = "crates/ev-revm" }
ev-primitives = { path = "crates/ev-primitives" }


# Consensus dependencies
Expand Down Expand Up @@ -106,12 +112,18 @@ alloy-rpc-types-eth = { version = "1.0.37", default-features = false }
alloy-rpc-types-engine = { version = "1.0.37", default-features = false }
alloy-signer = { version = "1.0.37", default-features = false }
alloy-signer-local = { version = "1.0.37", features = ["mnemonic"] }
alloy-serde = { version = "1.0.37", default-features = false }
alloy-primitives = { version = "1.3.1", default-features = false }
alloy-consensus = { version = "1.0.37", default-features = false }
alloy-consensus-any = { version = "1.0.37", default-features = false }
alloy-rlp = { version = "0.3.12", default-features = false }
alloy-genesis = { version = "1.0.37", default-features = false }
alloy-rpc-types-txpool = { version = "1.0.37", default-features = false }
alloy-sol-types = { version = "1.3.1", default-features = false }

# Utility dependencies
bytes = "1.10.1"

revm-inspector = { version = "10.0.1" }
# Core dependencies
eyre = "0.6"
Expand Down
22 changes: 22 additions & 0 deletions crates/ev-primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "ev-primitives"
version = "0.1.0"
edition = "2021"
rust-version = "1.82"
license = "MIT OR Apache-2.0"

[dependencies]
alloy-consensus = { workspace = true }
alloy-eips = { workspace = true, features = ["serde"] }
alloy-primitives = { workspace = true, features = ["k256", "rlp", "serde"] }
alloy-serde = { workspace = true }
alloy-rlp = { workspace = true, features = ["derive"] }
bytes = { workspace = true }
reth-codecs = { workspace = true }
reth-db-api = { workspace = true }
reth-ethereum-primitives = { workspace = true }
reth-primitives-traits = { workspace = true, features = ["serde-bincode-compat"] }
serde = { workspace = true, features = ["derive"] }

[features]
serde-bincode-compat = ["reth-primitives-traits/serde-bincode-compat"]
33 changes: 33 additions & 0 deletions crates/ev-primitives/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//! EV-specific primitive types, including the EvNode 0x76 transaction.

mod pool;
mod tx;

pub use pool::{EvPooledTxEnvelope, EvPooledTxType};
pub use tx::{
Call, EvNodeSignedTx, EvNodeTransaction, EvTxEnvelope, EvTxType, TransactionSigned,
EVNODE_SPONSOR_DOMAIN, EVNODE_TX_TYPE_ID,
};

use reth_primitives_traits::NodePrimitives;

/// Block type alias for ev-reth.
pub type Block = alloy_consensus::Block<TransactionSigned>;

/// Block body type alias for ev-reth.
pub type BlockBody = alloy_consensus::BlockBody<TransactionSigned>;

/// Receipt type alias for ev-reth.
pub type Receipt = reth_ethereum_primitives::Receipt<EvTxType>;

/// Helper struct that specifies the ev-reth NodePrimitives types.
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct EvPrimitives;

impl NodePrimitives for EvPrimitives {
type Block = Block;
type BlockHeader = alloy_consensus::Header;
type BlockBody = BlockBody;
type SignedTx = TransactionSigned;
type Receipt = Receipt;
}
79 changes: 79 additions & 0 deletions crates/ev-primitives/src/pool.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//! Pooled transaction envelope for ev-reth.

use alloy_consensus::{
error::ValueError,
transaction::{SignerRecoverable, TxHashRef},
TransactionEnvelope,
};
use alloy_primitives::{Address, B256};
use reth_primitives_traits::{InMemorySize, SignedTransaction};

use crate::tx::{EvNodeSignedTx, EvTxEnvelope};

/// Pooled transaction envelope with optional blob sidecar support.
#[derive(Clone, Debug, TransactionEnvelope)]
#[envelope(tx_type_name = EvPooledTxType)]
pub enum EvPooledTxEnvelope {
/// Standard Ethereum pooled transaction envelope (may include blob sidecar).
#[envelope(flatten)]
Ethereum(reth_ethereum_primitives::PooledTransactionVariant),
/// EvNode typed transaction (no sidecar).
#[envelope(ty = 0x76)]
EvNode(EvNodeSignedTx),
}

impl InMemorySize for EvPooledTxEnvelope {
fn size(&self) -> usize {
match self {
EvPooledTxEnvelope::Ethereum(tx) => tx.size(),
EvPooledTxEnvelope::EvNode(tx) => tx.size(),
}
}
}

impl SignerRecoverable for EvPooledTxEnvelope {
fn recover_signer(&self) -> Result<Address, alloy_consensus::crypto::RecoveryError> {
match self {
EvPooledTxEnvelope::Ethereum(tx) => tx.recover_signer(),
EvPooledTxEnvelope::EvNode(tx) => tx
.signature()
.recover_address_from_prehash(&tx.tx().executor_signing_hash())
.map_err(|_| alloy_consensus::crypto::RecoveryError::new()),
}
}

fn recover_signer_unchecked(&self) -> Result<Address, alloy_consensus::crypto::RecoveryError> {
self.recover_signer()
}
}

impl TxHashRef for EvPooledTxEnvelope {
fn tx_hash(&self) -> &B256 {
match self {
EvPooledTxEnvelope::Ethereum(tx) => tx.tx_hash(),
EvPooledTxEnvelope::EvNode(tx) => tx.hash(),
}
}
}

impl TryFrom<EvTxEnvelope> for EvPooledTxEnvelope {
type Error = ValueError<reth_ethereum_primitives::TransactionSigned>;

fn try_from(value: EvTxEnvelope) -> Result<Self, Self::Error> {
match value {
EvTxEnvelope::Ethereum(tx) => Ok(Self::Ethereum(tx.try_into()?)),
EvTxEnvelope::EvNode(tx) => Ok(Self::EvNode(tx)),
}
}
}

impl From<EvPooledTxEnvelope> for EvTxEnvelope {
fn from(value: EvPooledTxEnvelope) -> Self {
match value {
EvPooledTxEnvelope::Ethereum(tx) => EvTxEnvelope::Ethereum(tx.into()),
EvPooledTxEnvelope::EvNode(tx) => EvTxEnvelope::EvNode(tx),
}
}
}

impl SignedTransaction for EvPooledTxEnvelope {}
Loading