Skip to content

Commit

Permalink
to decode ETROG processBatches use ETROG contract (#3360)
Browse files Browse the repository at this point in the history
* decode old ETROG processBatches use ETROG contract
* fix sanity genesis
  • Loading branch information
joanestebanr committed Feb 23, 2024
1 parent 81ba29f commit 562b266
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion etherman/etherman.go
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ func decodeSequencesElderberry(txData []byte, lastBatchNumber uint64, sequencer
func decodeSequencesEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash) ([]SequencedBatch, error) {
// Extract coded txs.
// Load contract ABI
smcAbi, err := abi.JSON(strings.NewReader(polygonzkevm.PolygonzkevmABI))
smcAbi, err := abi.JSON(strings.NewReader(etrogpolygonzkevm.EtrogpolygonzkevmABI))
if err != nil {
return nil, err
}
Expand Down
7 changes: 2 additions & 5 deletions synchronizer/synchronizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,18 +419,15 @@ func (s *ClientSynchronizer) RequestAndProcessRollupGenesisBlock(dbTx pgx.Tx, la
}

func sanityCheckForGenesisBlockRollupInfo(blocks []etherman.Block, order map[common.Hash][]etherman.Order) error {
if len(blocks) != 1 || len(order) != 1 || len(order[blocks[0].BlockHash]) != 2 {
if len(blocks) != 1 || len(order) < 1 || len(order[blocks[0].BlockHash]) < 1 {
log.Errorf("error getting rollupInfoByBlockRange after set the genesis. Expected 1 block with 2 orders")
return fmt.Errorf("error getting rollupInfoByBlockRange after set the genesis. Expected 1 block with 2 orders")
}
if order[blocks[0].BlockHash][0].Name != etherman.ForkIDsOrder {
log.Errorf("error getting rollupInfoByBlockRange after set the genesis. Expected ForkIDsOrder, got %s", order[blocks[0].BlockHash][0].Name)
return fmt.Errorf("error getting rollupInfoByBlockRange after set the genesis. Expected ForkIDsOrder")
}
if order[blocks[0].BlockHash][1].Name != etherman.InitialSequenceBatchesOrder {
log.Errorf("error getting rollupInfoByBlockRange after set the genesis. Expected InitialSequenceBatchesOrder, got %s", order[blocks[0].BlockHash][0].Name)
return fmt.Errorf("error getting rollupInfoByBlockRange after set the genesis. Expected InitialSequenceBatchesOrder")
}

return nil
}

Expand Down

0 comments on commit 562b266

Please sign in to comment.