Open
Conversation
revitteth
previously approved these changes
Oct 8, 2025
…zDb. Add methods to write and read precise timestamps, update Block struct to include TimestampNano, and ensure timestamps are recorded during block finalization.
0e2144e to
b36f240
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR implements precise timestamp handling for blocks in the zkEVM system. The main purpose is to capture and store sub-second (nanosecond) precision timestamps for blocks, which are recorded during block finalization and made available through the API.
Key Changes:
- Added
TimestampNanofield to Block structs in RPC types to expose nanosecond precision timestamps - Implemented database methods to read and write precise timestamps with corresponding test coverage
- Updated block finalization to record precise timestamps and API methods to populate them
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| zkevm/jsonrpc/types/types.go | Added TimestampNano field to Block struct |
| zk/rpcdaemon/types.go | Added TimestampNano field to Block struct |
| zk/hermez_db/db.go | Added database table constant, methods for reading/writing precise timestamps, and L1 info root lookup |
| zk/hermez_db/db_test.go | Added test coverage for precise timestamp read/write operations |
| zk/stages/stage_sequence_execute_blocks.go | Added timestamp recording during block finalization |
| turbo/jsonrpc/zkevm_api.go | Updated API to fetch and populate precise timestamps in block responses |
| zk/stages/stage_sequence_blob_recovery.go | Refactored blob recovery logic with control flow and formatting improvements |
| zk/da/blob_da.go | Removed InfoRootTracker and updated to fetch L1 info root directly from database |
| smt/pkg/utils/utils.go | Updated import alias for poseidongold package |
| zk/tx/tx.go | Removed unused constant |
| zk/stages/stages.go | Removed Disabled field setting and added duplicate parameter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add DeleteBlockPreciseTimestamps function to hermez_db - Call DeleteBlockPreciseTimestamps in UnwindBatchesStage - Ensures block_precise_timestamps table is properly cleaned up when unwinding to a previous batch This fixes the failing unwind test where the table contents differed after unwinding.
The block_precise_timestamps table stores timestamps captured at block execution time using time.Now().UnixNano(). When blocks are unwound and then re-executed during sync, the timestamps will naturally differ since they're recorded at different wall-clock times. This is expected behavior - the precise timestamps are meant to record when a block was executed, not to be deterministic across re-executions. - Add block_precise_timestamps.txt to different_files array in unwind test - This allows the test to pass while maintaining proper timestamp tracking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement precise timestamp handling for blocks in ZkEvmAPI and HermezDb. Add methods to write and read precise timestamps, update Block struct to include TimestampNano, and ensure timestamps are recorded during block finalization.