-
Notifications
You must be signed in to change notification settings - Fork 8
ADR 003 implementation: custom EvTransaction using EIP-2718, with sponsorship and atomic batch txs. #103
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
Open
randygrok
wants to merge
28
commits into
main
Choose a base branch
from
randygrok/adr-phase2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
ADR 003 implementation: custom EvTransaction using EIP-2718, with sponsorship and atomic batch txs. #103
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
93cb8fd
create primitives
randygrok d525ad2
work until rpc
randygrok 77e5614
reorder paths
randygrok 9e61d28
finish impl phase 1
randygrok 738d8f9
fix lint
randygrok 0992079
fix linter
randygrok 400e072
fix clippy
randygrok d8cf5f5
fix clippy 2
randygrok 3c1af2b
fmt linter
randygrok f5e1c19
Merge remote-tracking branch 'origin/main' into randygrok/adr-phase2
randygrok e182cdd
fix e2e tests
randygrok 185a52e
remove error on payload builder when ev node tx
randygrok dae3ab6
add e2e test for signature of sponsorship
randygrok 0f23ac3
fmt: format e2e tests
jgimeno d10f79e
fix issue with fee payer
jgimeno 46081cc
Merge main
randygrok 073760c
fix clippy
randygrok 5555a95
fmt
randygrok c921f2f
add case where invalid signature was included but did not allow to bu…
randygrok 25c810a
fix lint problems
randygrok b735012
add case where the vector is empty.
randygrok 71b419f
fix max gax limits calculations
randygrok 9b49507
revert and create logic increases nonce
randygrok fb81941
fix linter
randygrok 07bf8ef
improve panic messages and add docs for Compact trait implementations
randygrok 2670b5d
address comments from PR
randygrok 75a4977
Merge branch 'main' into randygrok/adr-phase2
randygrok fd177fd
fix: address clippy warnings and formatting
randygrok File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| //! Pooled transaction envelope for ev-reth. | ||
| //! | ||
| //! This module defines [`EvPooledTxEnvelope`], the transaction type used by Reth's transaction | ||
| //! pool. It wraps both standard Ethereum pooled transactions (which may include blob sidecars) | ||
| //! and EvNode transactions. | ||
| //! | ||
| //! The traits implemented here are required by Reth's transaction pool infrastructure: | ||
| //! - [`InMemorySize`]: Memory accounting for pool size limits | ||
| //! - [`SignerRecoverable`]: Sender address recovery for validation | ||
| //! - [`TxHashRef`]: Transaction hash access for deduplication | ||
| //! - [`SignedTransaction`]: Marker trait for signed transaction types | ||
|
|
||
| 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 { | ||
randygrok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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()), | ||
randygrok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
| 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 {} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.