[ZK Stack] - Bug on block.timestamps
#820
-
Team or ProjectCronos zKEVM Module Affected
Rust Version1.82 Operating System
Issue DescriptionWe received complains from developers that the block.timestamp is not accurate. The block.timestamp refers to the L2 block timestamps and it can be much smaller than the actual time. For example, if we send a tx at 04:30, the block.timestamp could be 04:25 which is 5 minutes before the actual time. This can be easily reproduced on the zkEVM testnet when the chain is idle. If there is no new block generate for few minutes, then you send a tx, the new block will have a timestamp which is few minutes earlier than the actual time. Looking at the code, I notice that we are not allowed to produce empty L2 blocks
Imo an easy fix would be to allow empty blocks so that block.timestamp can have a better reflection of real time Alternatively we can also the l2 block creation logic to start the creation only when the first transaction come in. Anyways looking for suggestion? Expected Behaviorblock.timestamp return real time Current Behaviorblock.timestamp return l2 block timestamp which is not an indication of real time Repository Link (if applicable)No response Additional DetailsNo response Prior Research
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Thank you for providing detailed information about the issue with Your suggestion to allow empty blocks to be produced to better reflect real-time in I recommend discussing this potential solution further with the development team or contributing a proposal for this change. You can engage with the ZKsync development community for more in-depth discussions and feedback on this issue at the ZKsync developers discussions on Github. If you have any more questions or need further assistance, feel free to ask! Your feedback helps us serve you better. If this fully addresses your question, please give it a thumbs up. If it doesn't, please give it a thumbs down. This will inform the community and team so we can improve our support. |
Beta Was this translation helpful? Give feedback.
-
Hey @thomas-nguy 👋 Thanks for posting! Let me look into this for you. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the fantastic suggestion @thomas-nguy! As discussed, this should be implemented by creating the miniblock only when there's a tx to execute, similar to batch creation logic. I'm resolving this issue while waiting for the PR. Thanks! |
Beta Was this translation helpful? Give feedback.
Thanks for the fantastic suggestion @thomas-nguy! As discussed, this should be implemented by creating the miniblock only when there's a tx to execute, similar to batch creation logic. I'm resolving this issue while waiting for the PR. Thanks!