@@ -320,23 +320,11 @@ func (p *Proposer) ProposeOp(ctx context.Context) error {
320
320
}
321
321
322
322
for i , err := range p .ProposeTxLists (ctx , txListsBytes ) {
323
- var errMsg = err
324
323
if err != nil {
325
- // If a transaction is reverted on chain, the error string will like this:
326
- // fmt.Errorf("%w purpose: %v hash: %v", ErrTransactionReverted, txPurpose, rcpt.Receipt.TxHash)
327
- // Then we try parsing the custom error for more details in log.
328
- if strings .Contains ("purpose: " , err .Error ()) && strings .Contains ("hash: " , err .Error ()) {
329
- txHash := strings .Split (err .Error (), "hash: " )[1 ]
330
- receipt , err := p .rpc .L1 .TransactionReceipt (ctx , common .HexToHash (txHash ))
331
- if err != nil {
332
- return err
333
- }
334
- errMsg = encoding .TryParsingCustomErrorFromReceipt (ctx , p .rpc .L1 , p .proposerAddress , receipt )
335
- }
336
324
log .Error (
337
325
"Failed to send TaikoL1.proposeBlock transaction" ,
338
326
"index" , i ,
339
- "error" , errMsg ,
327
+ "error" , err ,
340
328
)
341
329
continue
342
330
}
@@ -376,7 +364,29 @@ func (p *Proposer) ProposeTxLists(ctx context.Context, txListsBytes [][]byte) []
376
364
txCandidates [i ] = * candidate
377
365
}
378
366
379
- return p .txSender .SendAndWaitDetailed ("proposeBlock" , txCandidates ... )
367
+ // Send the transactions to the TaikoL1 contract, and if any of them fails, try
368
+ // to parse the custom error.
369
+ errors := p .txSender .SendAndWaitDetailed ("proposeBlock" , txCandidates ... )
370
+ for i , err := range errors {
371
+ if err == nil {
372
+ continue
373
+ }
374
+
375
+ // If a transaction is reverted on chain, the error string returned by txSender will like this:
376
+ // fmt.Errorf("%w purpose: %v hash: %v", ErrTransactionReverted, txPurpose, rcpt.Receipt.TxHash)
377
+ // Then we try parsing the custom error for more details in log.
378
+ if strings .Contains ("purpose: " , err .Error ()) && strings .Contains ("hash: " , err .Error ()) {
379
+ txHash := strings .Split (err .Error (), "hash: " )[1 ]
380
+ receipt , err := p .rpc .L1 .TransactionReceipt (ctx , common .HexToHash (txHash ))
381
+ if err != nil {
382
+ log .Error ("Failed to fetch receipt" , "txHash" , txHash , "error" , err )
383
+ continue
384
+ }
385
+ errors [i ] = encoding .TryParsingCustomErrorFromReceipt (ctx , p .rpc .L1 , p .proposerAddress , receipt )
386
+ }
387
+ }
388
+
389
+ return errors
380
390
}
381
391
382
392
// updateProposingTicker updates the internal proposing timer.
0 commit comments