Skip to content

Commit

Permalink
fix sync initalization for etrog (#3147)
Browse files Browse the repository at this point in the history
  • Loading branch information
tclemos authored Jan 25, 2024
1 parent 1825164 commit bc51813
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions state/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ func (s *State) StoreL2Block(ctx context.Context, batchNumber uint64, l2Block *P
l2Header.BlockInfoRoot = l2Block.BlockInfoRoot

numTxs := len(l2Block.TransactionResponses)
transactions := make([]*types.Transaction, numTxs)
storeTxsEGPData := make([]StoreTxEGPData, numTxs)
receipts := make([]*types.Receipt, numTxs)
txsL2Hash := make([]common.Hash, numTxs)
transactions := make([]*types.Transaction, 0, numTxs)
storeTxsEGPData := make([]StoreTxEGPData, 0, numTxs)
receipts := make([]*types.Receipt, 0, numTxs)
txsL2Hash := make([]common.Hash, 0, numTxs)

for i, txResponse := range l2Block.TransactionResponses {
// if the transaction has an intrinsic invalid tx error it means
Expand All @@ -235,16 +235,18 @@ func (s *State) StoreL2Block(ctx context.Context, batchNumber uint64, l2Block *P
}

txResp := *txResponse
transactions[i] = &txResp.Tx
txsL2Hash[i] = txResp.TxHashL2_V2
transactions = append(transactions, &txResp.Tx)
txsL2Hash = append(txsL2Hash, txResp.TxHashL2_V2)

storeTxsEGPData[i] = StoreTxEGPData{EGPLog: nil, EffectivePercentage: uint8(txResponse.EffectivePercentage)}
storeTxEGPData := StoreTxEGPData{EGPLog: nil, EffectivePercentage: uint8(txResponse.EffectivePercentage)}
if txsEGPLog != nil {
storeTxsEGPData[i].EGPLog = txsEGPLog[i]
storeTxEGPData.EGPLog = txsEGPLog[i]
}

storeTxsEGPData = append(storeTxsEGPData, storeTxEGPData)

receipt := GenerateReceipt(header.Number, txResponse, uint(i))
receipts[i] = receipt
receipts = append(receipts, receipt)
}

// Create block to be able to calculate its hash
Expand Down

0 comments on commit bc51813

Please sign in to comment.