0xPolygonHermez / zkevm-node

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

Timestamp Mismatch in sequencer processL2Block() for empty Block #3600

Open EthanShang8989 opened 5 months ago

EthanShang8989 commented 5 months ago

System Information

zkEVM Node

Version: fork by v0.6.4 OS & Version: Windows 10 Commit Hash: df539db1493234f0e58d742f32373883cc50fa40 Network: Testnet zkEVM Prover

Version: v6.0.1-RC1 OS & Version: Ubuntu 22.04.4 LTS CPU: AMD EPYC 7282 Config Version: v6.0.0-rc.1-fork.9

Description

During the setup of my custom L2 test environment, I encountered an issue with incorrect timestamp handling. Specifically, the problem occurs in the first block, which contains no transactions other than the "change L2 block" transactions. This leads to a timestamp mismatch in the processL2Block() function, located at line 195 in l2block.go. The problematic timestamp is equal to the deltaTimestamp passed during the "change L2 block" build, which is initialized at the start of executeNewWIPL2Block. Additionally, I would appreciate an update to the prover's download script, as I had some difficulty finding the correct download content.

Expected Behaviour

// l2block.go
// Line 195
// Sanity check: Ensure blockResponse.timestamp matches l2Block.timestamp
if blockResponse.Timestamp != l2Block.timestamp {
    return fmt.Errorf("blockResponse.Timestamp %d doesn't match l2Block.timestamp %d", blockResponse.Timestamp, l2Block.timestamp)
}

Actual Behaviour

The blockResponse.Timestamp ==l2block.deltaTimestamp !=l2Block.timestamp.

Additional Details

In order to test the sequencer independently, I wrote a test function myself. I used mocks and simplified parts of the synchronizer's code (only executing SetGenesis and RequestAndProcessRollupGenesisBlock). The remaining steps follow the typical startup process.