Skip to content

Commit 04efbfe

Browse files
committed
add jovian extra data
1 parent cdb482e commit 04efbfe

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/platform/optimism/mod.rs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use {
33
alloy::{
44
eips::Encodable2718,
55
optimism::consensus::OpPooledTransaction as AlloyPoolTx,
6-
primitives::Bytes,
76
},
87
reth::{
98
api::NodeTypes,
@@ -61,8 +60,25 @@ impl Platform for Optimism {
6160
where
6261
P: traits::PlatformExecBounds<Self>,
6362
{
63+
let timestamp = attributes.payload_attributes.timestamp;
64+
let extra_data = if chainspec.is_jovian_active_at_timestamp(timestamp) {
65+
attributes
66+
.get_jovian_extra_data(
67+
chainspec.base_fee_params_at_timestamp(timestamp),
68+
)
69+
.unwrap_or_default()
70+
} else if chainspec.is_holocene_active_at_timestamp(timestamp) {
71+
attributes
72+
.get_holocene_extra_data(
73+
chainspec.base_fee_params_at_timestamp(timestamp),
74+
)
75+
.unwrap_or_default()
76+
} else {
77+
Default::default()
78+
};
79+
6480
OpNextBlockEnvAttributes {
65-
timestamp: attributes.payload_attributes.timestamp,
81+
timestamp,
6682
suggested_fee_recipient: attributes
6783
.payload_attributes
6884
.suggested_fee_recipient,
@@ -71,17 +87,7 @@ impl Platform for Optimism {
7187
parent_beacon_block_root: attributes
7288
.payload_attributes
7389
.parent_beacon_block_root,
74-
extra_data: if chainspec.is_holocene_active_at_timestamp(
75-
attributes.payload_attributes.timestamp,
76-
) {
77-
attributes
78-
.get_holocene_extra_data(chainspec.base_fee_params_at_timestamp(
79-
attributes.payload_attributes.timestamp,
80-
))
81-
.unwrap_or_default()
82-
} else {
83-
Bytes::default()
84-
},
90+
extra_data,
8591
}
8692
}
8793

0 commit comments

Comments
 (0)