diff --git a/etherman/etherman.go b/etherman/etherman.go index 9935805545..eb09d6601a 100644 --- a/etherman/etherman.go +++ b/etherman/etherman.go @@ -44,11 +44,6 @@ import ( "golang.org/x/crypto/sha3" ) -const ( - // ETrogUpgradeVersion is the version of the LxLy upgrade - ETrogUpgradeVersion = 2 -) - var ( // Events RollupManager setBatchFeeSignatureHash = crypto.Keccak256Hash([]byte("SetBatchFee(uint256)")) @@ -370,20 +365,17 @@ func (etherMan *Client) VerifyGenBlockNumber(ctx context.Context, genBlockNumber // GetL1BlockUpgradeLxLy It returns the block genesis for LxLy before genesisBlock or error func (etherMan *Client) GetL1BlockUpgradeLxLy(ctx context.Context, genesisBlock uint64) (uint64, error) { - it, err := etherMan.RollupManager.FilterInitialized(&bind.FilterOpts{ + it, err := etherMan.GlobalExitRootManager.FilterUpdateL1InfoTree(&bind.FilterOpts{ Start: 1, End: &genesisBlock, Context: ctx, - }) + }, nil, nil) if err != nil { return uint64(0), err } for it.Next() { - log.Debugf("BlockNumber: %d Topics:Initialized(%d)", it.Event.Raw.BlockNumber, it.Event.Version) - if it.Event.Version == ETrogUpgradeVersion { // 2 is ETROG (LxLy upgrade) - log.Infof("LxLy upgrade found at blockNumber: %d", it.Event.Raw.BlockNumber) - return it.Event.Raw.BlockNumber, nil - } + log.Debugf("BlockNumber: %d Topics:L1InfoTree", it.Event.Raw.BlockNumber) + return it.Event.Raw.BlockNumber, nil } return uint64(0), ErrNotFound } diff --git a/state/genesis.go b/state/genesis.go index 60a7bcba92..47a5c6f2db 100644 --- a/state/genesis.go +++ b/state/genesis.go @@ -17,6 +17,11 @@ import ( "github.com/jackc/pgx/v4" ) +const ( + // AutoDiscoverRollupManagerBlockNumber is the value to auto-discover the RollupManager creation block number + AutoDiscoverRollupManagerBlockNumber = uint64(0) +) + // Genesis contains the information to populate state on creation type Genesis struct { // RollupBlockNumber is the block number where the polygonZKEVM smc was deployed on L1 diff --git a/synchronizer/synchronizer.go b/synchronizer/synchronizer.go index 343f1746a1..796f019169 100644 --- a/synchronizer/synchronizer.go +++ b/synchronizer/synchronizer.go @@ -294,20 +294,21 @@ func (s *ClientSynchronizer) isGenesisProcessed(ctx context.Context, dbTx pgx.Tx // bool -> need to process blocks // uint64 -> first block to synchronize // error -> error -// 1. First try to get last block on DB, if there are could be fully synced or pending blocks -// 2. If DB is empty the LxLy upgrade block as starting point +// 1. Check last synced block on DB, if there are any could be fully synced (>=genesis) or syncing pre-genesis events (