From 8db9b1b2b22b8274ee332d4150478bbac0d43113 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 24 Dec 2024 11:48:36 +0100 Subject: [PATCH 1/2] feat: add BlockConditional --- crates/consensus/src/transaction/meta.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/consensus/src/transaction/meta.rs b/crates/consensus/src/transaction/meta.rs index 6aeb54ad7f3..703ca5743a3 100644 --- a/crates/consensus/src/transaction/meta.rs +++ b/crates/consensus/src/transaction/meta.rs @@ -2,6 +2,18 @@ use alloy_primitives::{BlockHash, TxHash, B256}; +/// Contains attributes of a block that are relevant for block conditional transactions. +/// +/// These attributes are used to determine preconditions for inclusion in the block with the given +/// attributes (EIP-4337 transactions) +#[derive(Debug, Clone, Copy, Default, Eq, PartialEq)] +pub struct BlockConditionalAttributes { + /// The number of the block. + pub number: u64, + /// The block's timestamp + pub timestamp: u64, +} + /// Additional fields in the context of a block that contains this _mined_ transaction. /// /// This contains mandatory block fields (block hash, number, timestamp, index). From f32dea0a28f3387c5de066b0af27927c2cc5d1cf Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 24 Dec 2024 11:54:09 +0100 Subject: [PATCH 2/2] chore: restructure --- crates/consensus/src/conditional.rs | 13 +++++++++++++ crates/consensus/src/lib.rs | 1 + crates/consensus/src/transaction/meta.rs | 12 ------------ 3 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 crates/consensus/src/conditional.rs diff --git a/crates/consensus/src/conditional.rs b/crates/consensus/src/conditional.rs new file mode 100644 index 00000000000..90ecd0f96e1 --- /dev/null +++ b/crates/consensus/src/conditional.rs @@ -0,0 +1,13 @@ +//! Helpers for conditional transactions. + +/// Contains attributes of a block that are relevant for block conditional transactions. +/// +/// These attributes are used to determine preconditions for inclusion in the block with the given +/// attributes (EIP-4337 transactions) +#[derive(Debug, Clone, Copy, Default, Eq, PartialEq)] +pub struct BlockConditionalAttributes { + /// The number of the block. + pub number: u64, + /// The block's timestamp + pub timestamp: u64, +} diff --git a/crates/consensus/src/lib.rs b/crates/consensus/src/lib.rs index 90932614ff1..7e71696225c 100644 --- a/crates/consensus/src/lib.rs +++ b/crates/consensus/src/lib.rs @@ -26,6 +26,7 @@ pub use receipt::{ RlpDecodableReceipt, RlpEncodableReceipt, TxReceipt, }; +pub mod conditional; pub mod proofs; pub mod transaction; diff --git a/crates/consensus/src/transaction/meta.rs b/crates/consensus/src/transaction/meta.rs index 703ca5743a3..6aeb54ad7f3 100644 --- a/crates/consensus/src/transaction/meta.rs +++ b/crates/consensus/src/transaction/meta.rs @@ -2,18 +2,6 @@ use alloy_primitives::{BlockHash, TxHash, B256}; -/// Contains attributes of a block that are relevant for block conditional transactions. -/// -/// These attributes are used to determine preconditions for inclusion in the block with the given -/// attributes (EIP-4337 transactions) -#[derive(Debug, Clone, Copy, Default, Eq, PartialEq)] -pub struct BlockConditionalAttributes { - /// The number of the block. - pub number: u64, - /// The block's timestamp - pub timestamp: u64, -} - /// Additional fields in the context of a block that contains this _mined_ transaction. /// /// This contains mandatory block fields (block hash, number, timestamp, index).