Skip to content

Commit a1c7192

Browse files
authored
Revert "feat(rpc-types-eth): add optional timestamp field to Transaction" (#3638)
Revert "feat(rpc-types-eth): add optional timestamp field to Transaction (#3606)" This reverts commit 9f8578d.
1 parent 52127ca commit a1c7192

File tree

2 files changed

+3
-45
lines changed
  • crates
    • consensus/src/transaction
    • rpc-types-eth/src/transaction

2 files changed

+3
-45
lines changed

crates/consensus/src/transaction/meta.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ pub struct TransactionInfo {
4040
pub block_number: Option<u64>,
4141
/// Base fee of the block.
4242
pub base_fee: Option<u64>,
43-
/// Timestamp of the block.
44-
pub block_timestamp: Option<u64>,
4543
}
4644

4745
impl TransactionInfo {

crates/rpc-types-eth/src/transaction/mod.rs

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ pub struct Transaction<T = TxEnvelope> {
6565

6666
/// Deprecated effective gas price value.
6767
pub effective_gas_price: Option<u128>,
68-
69-
/// The Unix block_timestamp (in seconds) when the block containing this transaction was mined.
70-
///
71-
/// `None` if the transaction is pending.
72-
#[cfg_attr(feature = "serde", serde(default, skip_serializing_if = "Option::is_none"))]
73-
pub block_timestamp: Option<u64>,
7468
}
7569

7670
impl<T> Default for Transaction<T>
@@ -84,7 +78,6 @@ where
8478
block_number: Default::default(),
8579
transaction_index: Default::default(),
8680
effective_gas_price: Default::default(),
87-
block_timestamp: Default::default(),
8881
}
8982
}
9083
}
@@ -125,41 +118,25 @@ impl<T> Transaction<T> {
125118

126119
/// Applies the given closure to the inner transaction type.
127120
pub fn map<Tx>(self, f: impl FnOnce(T) -> Tx) -> Transaction<Tx> {
128-
let Self {
129-
inner,
130-
block_hash,
131-
block_number,
132-
transaction_index,
133-
effective_gas_price,
134-
block_timestamp,
135-
} = self;
121+
let Self { inner, block_hash, block_number, transaction_index, effective_gas_price } = self;
136122
Transaction {
137123
inner: inner.map(f),
138124
block_hash,
139125
block_number,
140126
transaction_index,
141127
effective_gas_price,
142-
block_timestamp,
143128
}
144129
}
145130

146131
/// Applies the given fallible closure to the inner transactions.
147132
pub fn try_map<Tx, E>(self, f: impl FnOnce(T) -> Result<Tx, E>) -> Result<Transaction<Tx>, E> {
148-
let Self {
149-
inner,
150-
block_hash,
151-
block_number,
152-
transaction_index,
153-
effective_gas_price,
154-
block_timestamp,
155-
} = self;
133+
let Self { inner, block_hash, block_number, transaction_index, effective_gas_price } = self;
156134
Ok(Transaction {
157135
inner: inner.try_map(f)?,
158136
block_hash,
159137
block_number,
160138
transaction_index,
161139
effective_gas_price,
162-
block_timestamp,
163140
})
164141
}
165142
}
@@ -182,12 +159,7 @@ where
182159
/// Converts a consensus `tx` with an additional context `tx_info` into an RPC [`Transaction`].
183160
pub fn from_transaction(tx: Recovered<T>, tx_info: TransactionInfo) -> Self {
184161
let TransactionInfo {
185-
block_hash,
186-
block_number,
187-
index: transaction_index,
188-
base_fee,
189-
block_timestamp,
190-
..
162+
block_hash, block_number, index: transaction_index, base_fee, ..
191163
} = tx_info;
192164
let effective_gas_price = base_fee
193165
.map(|base_fee| {
@@ -201,7 +173,6 @@ where
201173
block_number,
202174
transaction_index,
203175
effective_gas_price: Some(effective_gas_price),
204-
block_timestamp,
205176
}
206177
}
207178
}
@@ -222,7 +193,6 @@ where
222193
// We don't know the base fee of the block when we're constructing this from
223194
// `Transaction`
224195
base_fee: None,
225-
block_timestamp: self.block_timestamp,
226196
}
227197
}
228198
}
@@ -512,12 +482,6 @@ mod tx_serde {
512482

513483
#[serde(flatten)]
514484
gas_price: MaybeGasPrice,
515-
#[serde(
516-
default,
517-
with = "alloy_serde::quantity::opt",
518-
skip_serializing_if = "Option::is_none"
519-
)]
520-
block_timestamp: Option<u64>,
521485
}
522486

523487
impl<T: TransactionTrait> From<Transaction<T>> for TransactionSerdeHelper<T> {
@@ -528,7 +492,6 @@ mod tx_serde {
528492
block_number,
529493
transaction_index,
530494
effective_gas_price,
531-
block_timestamp,
532495
} = value;
533496

534497
let (inner, from) = inner.into_parts();
@@ -547,7 +510,6 @@ mod tx_serde {
547510
transaction_index,
548511
from,
549512
gas_price: MaybeGasPrice { effective_gas_price },
550-
block_timestamp,
551513
}
552514
}
553515
}
@@ -563,7 +525,6 @@ mod tx_serde {
563525
transaction_index,
564526
from,
565527
gas_price,
566-
block_timestamp,
567528
} = value;
568529

569530
// Try to get `gasPrice` field from inner envelope or from `MaybeGasPrice` (making
@@ -578,7 +539,6 @@ mod tx_serde {
578539
block_number,
579540
transaction_index,
580541
effective_gas_price,
581-
block_timestamp,
582542
})
583543
}
584544
}

0 commit comments

Comments
 (0)