diff --git a/go/common/l1_transaction.go b/go/common/l1_transaction.go index 5af4ac1f6..1114a687f 100644 --- a/go/common/l1_transaction.go +++ b/go/common/l1_transaction.go @@ -20,18 +20,18 @@ const ( SetImportantContractsTx ) +// ProcessedL1Data is submitted to the enclave by the guardian +type ProcessedL1Data struct { + BlockHeader *types.Header + Events []L1Event +} + // L1Event represents a single event type and its associated transactions type L1Event struct { Type uint8 Txs []*L1TxData } -// ProcessedL1Data is submitted to the enclave by the guardian -type ProcessedL1Data struct { - BlockHeader *types.Header - Events []L1Event // Changed from map to slice of L1Event -} - // L1TxData represents an L1 transaction that are relevant to us type L1TxData struct { Transaction *types.Transaction @@ -51,7 +51,6 @@ func (tx *L1TxData) HasSequencerEnclaveID() bool { func (p *ProcessedL1Data) AddEvent(txType L1TxType, tx *L1TxData) { eventType := uint8(txType) - // Find existing event group for i := range p.Events { if p.Events[i].Type != eventType { continue diff --git a/go/host/enclave/guardian.go b/go/host/enclave/guardian.go index c9144e790..8b3251928 100644 --- a/go/host/enclave/guardian.go +++ b/go/host/enclave/guardian.go @@ -468,12 +468,6 @@ func (g *Guardian) submitL1Block(block *common.L1Block, isLatest bool) (bool, er g.logger.Debug("Unable to submit block, enclave is busy processing data") return false, nil } - //receipts, err := g.sl.L1Repo().FetchObscuroReceipts(block) - //if err != nil { - // g.submitDataLock.Unlock() // lock must be released before returning - // return false, fmt.Errorf("could not fetch obscuro receipts for block=%s - %w", block.Hash(), err) - //} - //txsReceiptsAndBlobs, rollupTxs, contractAddressTxs := g.sl.L1Publisher().ExtractRelevantTenTransactions(block, receipts) processedData, err := g.sl.L1Repo().ExtractTenTransactions(block) if err != nil { g.submitDataLock.Unlock() // lock must be released before returning diff --git a/go/host/l1/blockrepository.go b/go/host/l1/blockrepository.go index 5ae0a2dec..267c97d8e 100644 --- a/go/host/l1/blockrepository.go +++ b/go/host/l1/blockrepository.go @@ -161,12 +161,18 @@ func (r *Repository) ExtractTenTransactions(block *common.L1Block) (*common.Proc } for _, l := range logs { + if len(l.Topics) == 0 { + r.logger.Warn("Log has no topics", "txHash", l.TxHash) + continue + } + txData, err := r.createTransactionData(l.TxHash) if err != nil { r.logger.Error("Error creating transaction data", "txHash", l.TxHash, "error", err) continue } + // first topic is always the event signature switch l.Topics[0] { case crosschain.CrossChainEventID: r.processCrossChainLogs(l, txData, processed) @@ -323,19 +329,6 @@ func (r *Repository) FetchBlockByHeight(height *big.Int) (*types.Block, error) { return r.ethClient.BlockByNumber(height) } -// isObscuroTransaction will look at the 'to' address of the transaction, we are only interested in management contract and bridge transactions -func (r *Repository) isObscuroTransaction(transaction *types.Transaction) bool { - var allAddresses []gethcommon.Address - allAddresses = append(allAddresses, r.contractAddresses[MgmtContract]...) - allAddresses = append(allAddresses, r.contractAddresses[MsgBus]...) - for _, address := range allAddresses { - if transaction.To() != nil && *transaction.To() == address { - return true - } - } - return false -} - // getEnclaveIdFromLog gets the enclave ID from the log topic func getEnclaveIdFromLog(log types.Log) (gethcommon.Address, error) { if len(log.Topics) != 1 { diff --git a/integration/ethereummock/mgmt_contract_lib.go b/integration/ethereummock/mgmt_contract_lib.go index 2c29e6104..6c898131e 100644 --- a/integration/ethereummock/mgmt_contract_lib.go +++ b/integration/ethereummock/mgmt_contract_lib.go @@ -60,6 +60,9 @@ func (m *mockContractLib) GetContractAddr() *gethcommon.Address { func (m *mockContractLib) DecodeTx(tx *types.Transaction) ethadapter.L1Transaction { // Do not decode erc20 transactions, this is the responsibility // of the erc20 contract lib. + if tx.To() == nil { + println("HERE") + } if tx.To().Hex() == depositTxAddr.Hex() { return nil } diff --git a/integration/simulation/simulation_in_mem_test.go b/integration/simulation/simulation_in_mem_test.go index 625efe824..052eaebf9 100644 --- a/integration/simulation/simulation_in_mem_test.go +++ b/integration/simulation/simulation_in_mem_test.go @@ -16,8 +16,6 @@ import ( // Everything else is reported to this value. This number has to be adjusted in conjunction with the number of nodes. If it's too low, // the CPU usage will be very high during the simulation which might give inconclusive results. func TestInMemoryMonteCarloSimulation(t *testing.T) { - //FIXME temporarily disable - t.Skipf("skipping test until mocks are written") setupSimTestLog("in-mem") // todo (#718) - try increasing this back to 7 once faster-finality model is optimised