diff --git a/go/host/l1/publisher.go b/go/host/l1/publisher.go index d17a3301dd..eb1deb3496 100644 --- a/go/host/l1/publisher.go +++ b/go/host/l1/publisher.go @@ -231,56 +231,59 @@ func (p *Publisher) PublishSecretResponse(secretResponse *common.ProducedSecretR // ExtractRelevantTenTransactions will extract any transactions from the block that are relevant to TEN // todo (#2495) we should monitor for relevant L1 events instead of scanning every transaction in the block func (p *Publisher) ExtractRelevantTenTransactions(block *types.Block, receipts types.Receipts) ([]*common.TxAndReceiptAndBlobs, []*ethadapter.L1RollupTx, []*ethadapter.L1SetImportantContractsTx) { - txWithReceiptsAndBlobs := make([]*common.TxAndReceiptAndBlobs, 0) - rollupTxs := make([]*ethadapter.L1RollupTx, 0) - contractAddressTxs := make([]*ethadapter.L1SetImportantContractsTx, 0) - - txs := block.Transactions() - for i, rec := range receipts { - if rec.BlockNumber == nil { - continue // Skip non-relevant transactions - } + // temporarily add this host stopping check to prevent sim test failures until a more robust solution is implemented + for !p.hostStopper.IsStopping() { + txWithReceiptsAndBlobs := make([]*common.TxAndReceiptAndBlobs, 0) + rollupTxs := make([]*ethadapter.L1RollupTx, 0) + contractAddressTxs := make([]*ethadapter.L1SetImportantContractsTx, 0) + + txs := block.Transactions() + for i, rec := range receipts { + if rec.BlockNumber == nil { + continue // Skip non-relevant transactions + } + + decodedTx := p.mgmtContractLib.DecodeTx(txs[i]) + var blobs []*kzg4844.Blob + var err error - decodedTx := p.mgmtContractLib.DecodeTx(txs[i]) - var blobs []*kzg4844.Blob - var err error - - switch typedTx := decodedTx.(type) { - case *ethadapter.L1SetImportantContractsTx: - contractAddressTxs = append(contractAddressTxs, typedTx) - case *ethadapter.L1RollupHashes: - blobs, err = p.blobResolver.FetchBlobs(p.sendingContext, block.Header(), typedTx.BlobHashes) - // temporarily add this host stopping check to prevent sim test failures until a more robust solution is implemented - if err != nil && !p.hostStopper.IsStopping() { - if errors.Is(err, ethereum.NotFound) { - p.logger.Crit("Blobs were not found on beacon chain or archive service", "block", block.Hash(), "error", err) - } else { - p.logger.Crit("could not fetch blobs", log.ErrKey, err) + switch typedTx := decodedTx.(type) { + case *ethadapter.L1SetImportantContractsTx: + contractAddressTxs = append(contractAddressTxs, typedTx) + case *ethadapter.L1RollupHashes: + blobs, err = p.blobResolver.FetchBlobs(p.sendingContext, block.Header(), typedTx.BlobHashes) + // temporarily add this host stopping check to prevent sim test failures until a more robust solution is implemented + if err != nil { + if errors.Is(err, ethereum.NotFound) { + p.logger.Crit("Blobs were not found on beacon chain or archive service", "block", block.Hash(), "error", err) + } else { + p.logger.Crit("could not fetch blobs", log.ErrKey, err) + } + continue } - continue - } - encodedRlp, err := ethadapter.DecodeBlobs(blobs) - if err != nil { - p.logger.Crit("could not decode blobs.", log.ErrKey, err) - continue - } + encodedRlp, err := ethadapter.DecodeBlobs(blobs) + if err != nil { + p.logger.Crit("could not decode blobs.", log.ErrKey, err) + continue + } - rlp := ðadapter.L1RollupTx{ - Rollup: encodedRlp, + rlp := ðadapter.L1RollupTx{ + Rollup: encodedRlp, + } + rollupTxs = append(rollupTxs, rlp) } - rollupTxs = append(rollupTxs, rlp) + + // compile the tx, receipt and blobs into a single struct for submission to the enclave + txWithReceiptsAndBlobs = append(txWithReceiptsAndBlobs, &common.TxAndReceiptAndBlobs{ + Tx: txs[i], + Receipt: rec, + Blobs: blobs, + }) } - // compile the tx, receipt and blobs into a single struct for submission to the enclave - txWithReceiptsAndBlobs = append(txWithReceiptsAndBlobs, &common.TxAndReceiptAndBlobs{ - Tx: txs[i], - Receipt: rec, - Blobs: blobs, - }) + return txWithReceiptsAndBlobs, rollupTxs, contractAddressTxs } - - return txWithReceiptsAndBlobs, rollupTxs, contractAddressTxs } // FindSecretResponseTx will scan the block for any secret response transactions. This is separate from the above method