@@ -195,15 +195,24 @@ func (i *BlocksInserterPacaya) InsertBlocks(
195
195
196
196
log .Debug ("Payload data" , "hash" , lastPayloadData .BlockHash , "txs" , len (lastPayloadData .Transactions ))
197
197
198
+ // Wait till the corresponding L2 header to be existed in the L2 EE.
199
+ if _ , err := i .rpc .WaitL2Header (ctx , new (big.Int ).SetUint64 (lastPayloadData .Number )); err != nil {
200
+ return fmt .Errorf ("failed to wait for L2 header (%d): %w" , lastPayloadData .Number , err )
201
+ }
202
+
198
203
log .Info (
199
204
"🔗 New L2 block inserted" ,
200
205
"blockID" , lastPayloadData .Number ,
201
206
"hash" , lastPayloadData .BlockHash ,
207
+ "coinbase" , lastPayloadData .FeeRecipient .Hex (),
202
208
"transactions" , len (lastPayloadData .Transactions ),
203
209
"timestamp" , lastPayloadData .Timestamp ,
204
210
"baseFee" , utils .WeiToGWei (lastPayloadData .BaseFeePerGas ),
205
211
"withdrawals" , len (lastPayloadData .Withdrawals ),
206
212
"batchID" , meta .GetBatchID (),
213
+ "gasLimit" , lastPayloadData .GasLimit ,
214
+ "gasUsed" , lastPayloadData .GasUsed ,
215
+ "parentHash" , lastPayloadData .ParentHash ,
207
216
"indexInBatch" , j ,
208
217
)
209
218
@@ -213,14 +222,31 @@ func (i *BlocksInserterPacaya) InsertBlocks(
213
222
return nil
214
223
}
215
224
216
- // InsertPreconfBlockFromExecutionPayload inserts a preconf block from the given execution payload .
217
- func (i * BlocksInserterPacaya ) InsertPreconfBlockFromExecutionPayload (
225
+ // InsertPreconfBlocksFromExecutionPayloads inserts preconf blocks from the given execution payloads .
226
+ func (i * BlocksInserterPacaya ) InsertPreconfBlocksFromExecutionPayloads (
218
227
ctx context.Context ,
219
- executableData * eth.ExecutionPayload ,
220
- ) (* types.Header , error ) {
228
+ executionPayloads [] * eth.ExecutionPayload ,
229
+ ) ([] * types.Header , error ) {
221
230
i .mutex .Lock ()
222
231
defer i .mutex .Unlock ()
223
232
233
+ headers := make ([]* types.Header , len (executionPayloads ))
234
+ for j , executableData := range executionPayloads {
235
+ header , err := i .insertPreconfBlockFromExecutionPayload (ctx , executableData )
236
+ if err != nil {
237
+ return nil , fmt .Errorf ("failed to insert preconf block: %w" , err )
238
+ }
239
+ headers [j ] = header
240
+ }
241
+
242
+ return headers , nil
243
+ }
244
+
245
+ // insertPreconfBlockFromExecutionPayload the inner method to insert a preconf block from the given execution payload.
246
+ func (i * BlocksInserterPacaya ) insertPreconfBlockFromExecutionPayload (
247
+ ctx context.Context ,
248
+ executableData * eth.ExecutionPayload ,
249
+ ) (* types.Header , error ) {
224
250
// Ensure the preconfirmation block number is greater than the current head L1 origin block ID.
225
251
headL1Origin , err := i .rpc .L2 .HeadL1Origin (ctx )
226
252
if err != nil && err .Error () != ethereum .NotFound .Error () {
@@ -231,7 +257,7 @@ func (i *BlocksInserterPacaya) InsertPreconfBlockFromExecutionPayload(
231
257
if headL1Origin != nil {
232
258
if uint64 (executableData .BlockNumber ) <= headL1Origin .BlockID .Uint64 () {
233
259
return nil , fmt .Errorf (
234
- "preconfirmation block number (%d) is less than or equal to the current head L1 origin block ID (%d)" ,
260
+ "preconfirmation block ID (%d) is less than or equal to the current head L1 origin block ID (%d)" ,
235
261
executableData .BlockNumber ,
236
262
headL1Origin .BlockID ,
237
263
)
@@ -242,6 +268,11 @@ func (i *BlocksInserterPacaya) InsertPreconfBlockFromExecutionPayload(
242
268
return nil , fmt .Errorf ("no transactions data in the payload" )
243
269
}
244
270
271
+ // Decompress the transactions list.
272
+ if executableData .Transactions [0 ], err = utils .DecompressPacaya (executableData .Transactions [0 ]); err != nil {
273
+ return nil , fmt .Errorf ("failed to decompress transactions list bytes: %w" , err )
274
+ }
275
+
245
276
var u256BaseFee = uint256 .Int (executableData .BaseFeePerGas )
246
277
payload , err := createExecutionPayloadsAndSetHead (
247
278
ctx ,
0 commit comments