Skip to content

Commit 1f45a56

Browse files
committed
feat: make metadata receipts optional
Receipts are almost unused other than returning the nonce of the from field for deposit transactions. This change makes the entire receipts field optional for flashblocks. This means that deposit transactions will not return a nonce from the RPC until the canonical block is processed. While this will change RPC behavior, it will decrease flashblock size significantly, and the tradeoff of size vs a few hundred ms latency to reading the nonce of a deposit transaction is easily worth it.
1 parent 54abd9f commit 1f45a56

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

crates/flashblocks/src/processor.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,9 @@ where
333333
.iter()
334334
.map(|flashblock| flashblock.metadata.receipts.clone())
335335
.fold(HashMap::default(), |mut acc, receipts| {
336-
acc.extend(receipts);
336+
if let Some(receipts) = receipts {
337+
acc.extend(receipts);
338+
}
337339
acc
338340
});
339341

crates/flashtypes/src/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
88
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Default)]
99
pub struct Metadata {
1010
/// Transaction receipts indexed by hash.
11-
pub receipts: HashMap<B256, OpReceipt>,
11+
pub receipts: Option<HashMap<B256, OpReceipt>>,
1212
/// Updated account balances.
1313
pub new_account_balances: HashMap<Address, U256>,
1414
/// Block number this flashblock belongs to.

0 commit comments

Comments
 (0)