0xPolygonHermez / zkevm-node

Go implementation of a node that operates the Polygon zkEVM Network
Other
531 stars 685 forks source link

synchronizer report an error `timestamp needs to be greater or equal` while is synchronizing from L1 #3613

Closed joanestebanr closed 4 months ago

joanestebanr commented 4 months ago

System information

zkEVM Node version: v0.6.6 Network: Mainnet

Expected behaviour

The synchronizer must sync from L1 and L2

Actual behaviour

The reason behind this error is:

So, it produce in some situations that a batch have been updated from L2 after being sequenced, so the timestamp of same batch from L1 is minor that the moment that was syncrhonized

Fix implemented

Synchronizer update state.batch timestamp when the batch is synced from L1:

Steps to reproduce the behaviour

Backtrace

error:  oldBatch(2013500) tstamp=1714134808 > openingBatch(2013501)=1714134037 err: timestamp needs to be greater or equal
/src/log/log.go:142 github.com/0xPolygonHermez/zkevm-node/log.appendStackTraceMaybeArgs()
/src/log/log.go:217 github.com/0xPolygonHermez/zkevm-node/log.Error()
/src/synchronizer/synchronizer.go:673 github.com/0xPolygonHermez/zkevm-node/synchronizer.(*ClientSynchronizer).ProcessBlockRange()
/src/synchronizer/synchronizer.go:579 github.com/0xPolygonHermez/zkevm-node/synchronizer.(*ClientSynchronizer).syncBlocksSequential()
/src/synchronizer/synchronizer.go:421 github.com/0xPolygonHermez/zkevm-node/synchronizer.(*ClientSynchronizer).Sync()
/src/cmd/run.go:339 main.runSynchronizer()

When submitting logs: please submit them as text and not screenshots.