@@ -16,16 +16,27 @@ use {
1616 futures:: { SinkExt , StreamExt } ,
1717 parking_lot:: RwLock ,
1818 rblib:: {
19- alloy:: { consensus:: BlockHeader , eips:: Encodable2718 , primitives:: U256 } ,
19+ alloy:: {
20+ consensus:: BlockHeader ,
21+ eips:: Encodable2718 ,
22+ optimism:: rpc_types_engine:: {
23+ OpFlashblockPayload ,
24+ OpFlashblockPayloadBase ,
25+ OpFlashblockPayloadDelta ,
26+ OpFlashblockPayloadMetadata ,
27+ } ,
28+ primitives:: U256 ,
29+ } ,
2030 prelude:: { ext:: CheckpointOpExt , * } ,
2131 reth:: node:: builder:: PayloadBuilderAttributes ,
2232 } ,
23- rollup_boost_types:: flashblocks:: {
24- ExecutionPayloadBaseV1 ,
25- ExecutionPayloadFlashblockDeltaV1 ,
26- FlashblocksPayloadV1 ,
33+ std:: {
34+ collections:: BTreeMap ,
35+ io,
36+ net:: TcpListener ,
37+ sync:: Arc ,
38+ time:: Instant ,
2739 } ,
28- std:: { io, net:: TcpListener , sync:: Arc , time:: Instant } ,
2940 tokio:: {
3041 net:: TcpStream ,
3142 sync:: {
@@ -58,7 +69,7 @@ pub struct PublishFlashblock {
5869 /// Set once at the begining of the payload job, captures immutable
5970 /// information about the payload that is being built. This info is derived
6071 /// from the payload attributes parameter on the FCU from the EL node.
61- block_base : RwLock < Option < ExecutionPayloadBaseV1 > > ,
72+ block_base : RwLock < Option < OpFlashblockPayloadBase > > ,
6273
6374 /// Metrics for monitoring flashblock publishing.
6475 metrics : Metrics ,
@@ -107,7 +118,7 @@ impl Step<Flashblocks> for PublishFlashblock {
107118 // TODO: Consider moving this into its own step
108119 let base = self . block_base . write ( ) . take ( ) ;
109120 let ( _excess_blob_gas, blob_gas_used) = payload. blob_fields ( ) ;
110- let diff = ExecutionPayloadFlashblockDeltaV1 {
121+ let diff = OpFlashblockPayloadDelta {
111122 state_root : sealed_block. block ( ) . state_root ,
112123 receipts_root : sealed_block. block ( ) . receipts_root ,
113124 logs_bloom : sealed_block. block ( ) . logs_bloom ,
@@ -128,12 +139,17 @@ impl Step<Flashblocks> for PublishFlashblock {
128139 let index = flashblock_number. index ( ) ;
129140
130141 // Push the contents of the payload
131- if let Err ( e) = self . sink . publish ( & FlashblocksPayloadV1 {
142+ if let Err ( e) = self . sink . publish ( & OpFlashblockPayload {
132143 base,
133144 diff,
134145 payload_id : ctx. block ( ) . payload_id ( ) ,
135146 index,
136- metadata : serde_json:: Value :: Null ,
147+ metadata : OpFlashblockPayloadMetadata {
148+ block_number : ctx. block ( ) . number ( ) ,
149+ // TODO: Fill in the following fields
150+ new_account_balances : BTreeMap :: new ( ) ,
151+ receipts : BTreeMap :: new ( ) ,
152+ } ,
137153 } ) {
138154 self . metrics . websocket_publish_errors_total . increment ( 1 ) ;
139155 tracing:: error!( "Failed to publish flashblock to websocket: {e}" ) ;
@@ -174,7 +190,7 @@ impl Step<Flashblocks> for PublishFlashblock {
174190 self . times . on_job_started ( & self . metrics ) ;
175191
176192 // this remains constant for the entire payload job.
177- self . block_base . write ( ) . replace ( ExecutionPayloadBaseV1 {
193+ self . block_base . write ( ) . replace ( OpFlashblockPayloadBase {
178194 parent_beacon_block_root : ctx
179195 . block ( )
180196 . attributes ( )
@@ -406,7 +422,7 @@ impl WebSocketSink {
406422 /// Called once by the `PublishFlashblock` pipeline step every time there is a
407423 /// non-empty flashblock that needs to be broadcasted to all external
408424 /// subscribers.
409- pub fn publish ( & self , payload : & FlashblocksPayloadV1 ) -> io:: Result < usize > {
425+ pub fn publish ( & self , payload : & OpFlashblockPayload ) -> io:: Result < usize > {
410426 // Serialize the payload to a UTF-8 string
411427 // serialize only once, then just copy around only a pointer
412428 // to the serialized data for each subscription.
0 commit comments