From e289a8d04f6f3d2c86db0d38cf0455df6f10d2bb Mon Sep 17 00:00:00 2001 From: DoTheBestToGetTheBest <146037313+DoTheBestToGetTheBest@users.noreply.github.com> Date: Thu, 12 Oct 2023 13:47:57 -0700 Subject: [PATCH 1/8] Update typed.rs --- .../rpc-types/src/eth/transaction/typed.rs | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/crates/rpc/rpc-types/src/eth/transaction/typed.rs b/crates/rpc/rpc-types/src/eth/transaction/typed.rs index b05ab570bfb..e567129a36c 100644 --- a/crates/rpc/rpc-types/src/eth/transaction/typed.rs +++ b/crates/rpc/rpc-types/src/eth/transaction/typed.rs @@ -5,7 +5,8 @@ use alloy_rlp::{BufMut, Decodable, Encodable, Error as RlpError, RlpDecodable, RlpEncodable}; use reth_primitives::{ - AccessList, Address, Bytes, Transaction, TxEip1559, TxEip2930, TxLegacy, U128, U256, U64, + revm_primitives::FixedBytes, AccessList, Address, Bytes, Transaction, TxEip1559, TxEip2930, + TxEip4844, TxLegacy, U128, U256, U64, }; use serde::{Deserialize, Serialize}; @@ -20,6 +21,7 @@ pub enum TypedTransactionRequest { Legacy(LegacyTransactionRequest), EIP2930(EIP2930TransactionRequest), EIP1559(EIP1559TransactionRequest), + EIP4844(Eip4844TransactionRequest), } impl TypedTransactionRequest { @@ -61,6 +63,19 @@ impl TypedTransactionRequest { access_list: tx.access_list, max_priority_fee_per_gas: tx.max_priority_fee_per_gas.to(), }), + TypedTransactionRequest::EIP4844(tx) => Transaction::Eip4844(TxEip4844 { + chain_id: tx.chain_id, + nonce: tx.nonce.to(), + gas_limit: tx.gas_limit.to(), + max_fee_per_gas: tx.max_fee_per_gas.to(), + max_priority_fee_per_gas: tx.max_priority_fee_per_gas.to(), + to: tx.kind.into(), + value: tx.value.into(), + access_list: tx.access_list, + blob_versioned_hashes: tx.blob_versioned_hashes, + max_fee_per_blob_gas: tx.max_fee_per_blob_gas, + input: tx.input, + }), }) } } @@ -95,6 +110,7 @@ pub struct EIP2930TransactionRequest { pub struct EIP1559TransactionRequest { pub chain_id: u64, pub nonce: U64, + pub max_priority_fee_per_gas: U128, pub max_fee_per_gas: U128, pub gas_limit: U256, @@ -103,7 +119,22 @@ pub struct EIP1559TransactionRequest { pub input: Bytes, pub access_list: AccessList, } - +/// Represents an EIP-4844 transaction request +#[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] +pub struct Eip4844TransactionRequest { + pub chain_id: u64, + pub nonce: U64, + pub max_priority_fee_per_gas: U128, + pub max_fee_per_gas: U128, + pub gas_limit: U256, + pub kind: TransactionKind, + pub value: U256, + pub input: Bytes, + pub access_list: AccessList, + pub max_fee_per_blob_gas: u128, + pub blob_versioned_hashes: Vec>, + pub gas_price: U128, +} /// Represents the `to` field of a transaction request /// /// This determines what kind of transaction this is From 409bf889cab6c53de3f84b5b4939d2e0462f60c2 Mon Sep 17 00:00:00 2001 From: DoTheBestToGetTheBest <146037313+DoTheBestToGetTheBest@users.noreply.github.com> Date: Thu, 12 Oct 2023 13:49:34 -0700 Subject: [PATCH 2/8] Update transactions.rs --- crates/rpc/rpc/src/eth/api/transactions.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/rpc/rpc/src/eth/api/transactions.rs b/crates/rpc/rpc/src/eth/api/transactions.rs index 94cc63527d9..00f84941fb2 100644 --- a/crates/rpc/rpc/src/eth/api/transactions.rs +++ b/crates/rpc/rpc/src/eth/api/transactions.rs @@ -501,6 +501,13 @@ where TypedTransactionRequest::EIP1559(m) } + Some(TypedTransactionRequest::EIP4844(mut m)) => { + m.chain_id = chain_id.to(); + m.gas_limit = gas_limit; + m.gas_price = gas_price; + + TypedTransactionRequest::EIP4844(m) + } None => return Err(EthApiError::ConflictingFeeFieldsInRequest), }; From 6ab67b75e23c3daf8795f1310025763a6b4a5093 Mon Sep 17 00:00:00 2001 From: DoTheBestToGetTheBest <146037313+DoTheBestToGetTheBest@users.noreply.github.com> Date: Fri, 13 Oct 2023 05:05:59 -0700 Subject: [PATCH 3/8] Update crates/rpc/rpc-types/src/eth/transaction/typed.rs Co-authored-by: Matthias Seitz --- crates/rpc/rpc-types/src/eth/transaction/typed.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/rpc/rpc-types/src/eth/transaction/typed.rs b/crates/rpc/rpc-types/src/eth/transaction/typed.rs index e567129a36c..12ae8bffbc8 100644 --- a/crates/rpc/rpc-types/src/eth/transaction/typed.rs +++ b/crates/rpc/rpc-types/src/eth/transaction/typed.rs @@ -132,7 +132,7 @@ pub struct Eip4844TransactionRequest { pub input: Bytes, pub access_list: AccessList, pub max_fee_per_blob_gas: u128, - pub blob_versioned_hashes: Vec>, + pub blob_versioned_hashes: Vec, pub gas_price: U128, } /// Represents the `to` field of a transaction request From 2f8cc54908451f62560afc9e8e3c8e2a165e7058 Mon Sep 17 00:00:00 2001 From: DoTheBestToGetTheBest <146037313+DoTheBestToGetTheBest@users.noreply.github.com> Date: Fri, 13 Oct 2023 05:06:13 -0700 Subject: [PATCH 4/8] Update typed.rs --- crates/rpc/rpc-types/src/eth/transaction/typed.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/rpc/rpc-types/src/eth/transaction/typed.rs b/crates/rpc/rpc-types/src/eth/transaction/typed.rs index 12ae8bffbc8..8507e100e31 100644 --- a/crates/rpc/rpc-types/src/eth/transaction/typed.rs +++ b/crates/rpc/rpc-types/src/eth/transaction/typed.rs @@ -4,12 +4,12 @@ //! it can be converted into the container type [`TypedTransactionRequest`]. use alloy_rlp::{BufMut, Decodable, Encodable, Error as RlpError, RlpDecodable, RlpEncodable}; +use reth_primitives::B256; use reth_primitives::{ - revm_primitives::FixedBytes, AccessList, Address, Bytes, Transaction, TxEip1559, TxEip2930, - TxEip4844, TxLegacy, U128, U256, U64, + AccessList, Address, Bytes, Transaction, TxEip1559, TxEip2930, TxEip4844, TxLegacy, U128, U256, + U64, }; use serde::{Deserialize, Serialize}; - /// Container type for various Ethereum transaction requests /// /// Its variants correspond to specific allowed transactions: @@ -134,6 +134,7 @@ pub struct Eip4844TransactionRequest { pub max_fee_per_blob_gas: u128, pub blob_versioned_hashes: Vec, pub gas_price: U128, + //pub sidecar: BlobTransactionSidecar, } /// Represents the `to` field of a transaction request /// From 054e7b4566105e2a1ef885419c7127e87ccac152 Mon Sep 17 00:00:00 2001 From: DoTheBestToGetTheBest <146037313+DoTheBestToGetTheBest@users.noreply.github.com> Date: Fri, 13 Oct 2023 05:07:59 -0700 Subject: [PATCH 5/8] Update typed.rs --- crates/rpc/rpc-types/src/eth/transaction/typed.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/rpc/rpc-types/src/eth/transaction/typed.rs b/crates/rpc/rpc-types/src/eth/transaction/typed.rs index 8507e100e31..4469d7eb8cf 100644 --- a/crates/rpc/rpc-types/src/eth/transaction/typed.rs +++ b/crates/rpc/rpc-types/src/eth/transaction/typed.rs @@ -4,10 +4,9 @@ //! it can be converted into the container type [`TypedTransactionRequest`]. use alloy_rlp::{BufMut, Decodable, Encodable, Error as RlpError, RlpDecodable, RlpEncodable}; -use reth_primitives::B256; use reth_primitives::{ AccessList, Address, Bytes, Transaction, TxEip1559, TxEip2930, TxEip4844, TxLegacy, U128, U256, - U64, + U64,B256, }; use serde::{Deserialize, Serialize}; /// Container type for various Ethereum transaction requests From d6874d50e849ce0e04d5a3e40a08f7ccb9437375 Mon Sep 17 00:00:00 2001 From: DoTheBestToGetTheBest <146037313+DoTheBestToGetTheBest@users.noreply.github.com> Date: Fri, 13 Oct 2023 05:10:20 -0700 Subject: [PATCH 6/8] Update typed.rs --- crates/rpc/rpc-types/src/eth/transaction/typed.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/rpc/rpc-types/src/eth/transaction/typed.rs b/crates/rpc/rpc-types/src/eth/transaction/typed.rs index 4469d7eb8cf..e02739e0438 100644 --- a/crates/rpc/rpc-types/src/eth/transaction/typed.rs +++ b/crates/rpc/rpc-types/src/eth/transaction/typed.rs @@ -4,9 +4,10 @@ //! it can be converted into the container type [`TypedTransactionRequest`]. use alloy_rlp::{BufMut, Decodable, Encodable, Error as RlpError, RlpDecodable, RlpEncodable}; + use reth_primitives::{ - AccessList, Address, Bytes, Transaction, TxEip1559, TxEip2930, TxEip4844, TxLegacy, U128, U256, - U64,B256, + AccessList, Address, Bytes, Transaction, TxEip1559, TxEip2930, TxEip4844, TxLegacy, B256, U128, + U256, U64, }; use serde::{Deserialize, Serialize}; /// Container type for various Ethereum transaction requests From 0382dfaf7d8a1dac23bce93204e6b380592b710d Mon Sep 17 00:00:00 2001 From: DoTheBestToGetTheBest <146037313+DoTheBestToGetTheBest@users.noreply.github.com> Date: Fri, 13 Oct 2023 06:00:31 -0700 Subject: [PATCH 7/8] Update typed.rs --- crates/rpc/rpc-types/src/eth/transaction/typed.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/rpc/rpc-types/src/eth/transaction/typed.rs b/crates/rpc/rpc-types/src/eth/transaction/typed.rs index e02739e0438..3280408dbb3 100644 --- a/crates/rpc/rpc-types/src/eth/transaction/typed.rs +++ b/crates/rpc/rpc-types/src/eth/transaction/typed.rs @@ -6,6 +6,7 @@ use alloy_rlp::{BufMut, Decodable, Encodable, Error as RlpError, RlpDecodable, RlpEncodable}; use reth_primitives::{ + kzg::{Blob, Bytes48}, AccessList, Address, Bytes, Transaction, TxEip1559, TxEip2930, TxEip4844, TxLegacy, B256, U128, U256, U64, }; @@ -120,7 +121,7 @@ pub struct EIP1559TransactionRequest { pub access_list: AccessList, } /// Represents an EIP-4844 transaction request -#[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Eip4844TransactionRequest { pub chain_id: u64, pub nonce: U64, @@ -134,7 +135,7 @@ pub struct Eip4844TransactionRequest { pub max_fee_per_blob_gas: u128, pub blob_versioned_hashes: Vec, pub gas_price: U128, - //pub sidecar: BlobTransactionSidecar, + pub sidecar: BlobTransactionSidecar, } /// Represents the `to` field of a transaction request /// @@ -198,3 +199,12 @@ impl From for reth_primitives::TransactionKind { } } } +#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)] +pub struct BlobTransactionSidecar { + /// The blob data. + pub blobs: Vec, + /// The blob commitments. + pub commitments: Vec, + /// The blob proofs. + pub proofs: Vec, +} From 740d3a6d820f43241b56fc4b948ee01e5b7a8005 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 13 Oct 2023 17:48:14 +0200 Subject: [PATCH 8/8] docs --- crates/rpc/rpc-types/src/eth/transaction/typed.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/rpc/rpc-types/src/eth/transaction/typed.rs b/crates/rpc/rpc-types/src/eth/transaction/typed.rs index 3280408dbb3..58618dacd98 100644 --- a/crates/rpc/rpc-types/src/eth/transaction/typed.rs +++ b/crates/rpc/rpc-types/src/eth/transaction/typed.rs @@ -4,7 +4,6 @@ //! it can be converted into the container type [`TypedTransactionRequest`]. use alloy_rlp::{BufMut, Decodable, Encodable, Error as RlpError, RlpDecodable, RlpEncodable}; - use reth_primitives::{ kzg::{Blob, Bytes48}, AccessList, Address, Bytes, Transaction, TxEip1559, TxEip2930, TxEip4844, TxLegacy, B256, U128, @@ -111,7 +110,6 @@ pub struct EIP2930TransactionRequest { pub struct EIP1559TransactionRequest { pub chain_id: u64, pub nonce: U64, - pub max_priority_fee_per_gas: U128, pub max_fee_per_gas: U128, pub gas_limit: U256, @@ -120,6 +118,7 @@ pub struct EIP1559TransactionRequest { pub input: Bytes, pub access_list: AccessList, } + /// Represents an EIP-4844 transaction request #[derive(Debug, Clone, PartialEq, Eq)] pub struct Eip4844TransactionRequest { @@ -137,6 +136,7 @@ pub struct Eip4844TransactionRequest { pub gas_price: U128, pub sidecar: BlobTransactionSidecar, } + /// Represents the `to` field of a transaction request /// /// This determines what kind of transaction this is @@ -199,6 +199,8 @@ impl From for reth_primitives::TransactionKind { } } } + +/// This represents a set of blobs, and its corresponding commitments and proofs. #[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)] pub struct BlobTransactionSidecar { /// The blob data.