[COMPLETE] Upgrade plan for block.timestamp , block.number and blockhash #87
Replies: 35 comments 35 replies
-
Thanks for the heads up. looking forward to the upgrade! |
Beta Was this translation helpful? Give feedback.
-
Thank you for sharing the information. We're eagerly looking forward to the changes. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the update @uF4No. Would it be possible to provide a precompile that already displays L2 block data before the catch-up period ends? Could be useful for certain contracts waiting to be deployed that want to utilize L2 block data right away. |
Beta Was this translation helpful? Give feedback.
-
@uF4No thanks for your update. During the catchup period, is there any temporary RPC method to get the virtual blocks information (just like getting L1 Batches and L2 Blocks now)? |
Beta Was this translation helpful? Give feedback.
-
great update thanks! |
Beta Was this translation helpful? Give feedback.
-
Great work! |
Beta Was this translation helpful? Give feedback.
-
looking for the upgrade, thanks @uF4No |
Beta Was this translation helpful? Give feedback.
-
Thank you |
Beta Was this translation helpful? Give feedback.
-
In this upgrade the stucked 900+ETH will be withdrawable? |
Beta Was this translation helpful? Give feedback.
-
ta bueno niño 🚀 |
Beta Was this translation helpful? Give feedback.
-
This is a highly anticipated enhancement, would be great if the build is ready on testnet by August end. |
Beta Was this translation helpful? Give feedback.
-
Great update, needed it to launch our contracts. Any idea when we see it on testnets / mainnet |
Beta Was this translation helpful? Give feedback.
-
We've updated the original post to include the dates and more information for projects that are planning to deploy. Let us know if you have any questions or want to share any feedback |
Beta Was this translation helpful? Give feedback.
-
спасибо за информацию, с нетерпением ждем перемен, процветания!!! |
Beta Was this translation helpful? Give feedback.
-
📢 UPDATE 📢🕙 Today's mainnet upgrade is planned to start at 10:00 UTC. We'll start with roughly 1 virtual block per 60 L2 miniblocks (and also 1 virtual block per start of batch), which would translate to almost 1x-2x faster than before. ➡️ The current plan right now is the following:
ℹ️ We might adapt the plan as we go, so we may change these parameters based on TPS and/or community feedback. 🙋 As always, please post any questions or concerns in this Discussion. We'll continue to update this Discussion as we progress through the upgrade. |
Beta Was this translation helpful? Give feedback.
-
Nice info,thanks. |
Beta Was this translation helpful? Give feedback.
-
Hey @uF4No @MexicanAce Our Satis Foundation team has made a simple Grafana visualisation for the block catch-up. Would like to share with the community so one can easily check the catch-up progress! Here is the link to the Grafana dashboard: Currently, the virtual block number is so close to the L1 batch number that it is not displayed (yet). Things will look better after 14 Sep I think (when zkSync produces virtual block faster than L2 blocks). |
Beta Was this translation helpful? Give feedback.
-
📢 UPDATE 📢➡️ Testnet catch-up period has exceeded the original 14 days, but we will most likely complete the migration by the end of this week (maybe on Friday September 22) ➡️ Mainnet catch-up is increasing steadily currently at 1 virtual block per 2 L2 miniblocks. We plan to increase this rate to 1:1 today, and then to 2 virtual blocks per 1 L2 miniblock on Friday September 22. 🙋 As always, please post any questions or concerns in this Discussion. We'll continue to update this Discussion as we progress through the upgrade. |
Beta Was this translation helpful? Give feedback.
-
📢 UPDATE 📢Testnet has fully caught up, from now on |
Beta Was this translation helpful? Give feedback.
-
Хорошая работа |
Beta Was this translation helpful? Give feedback.
-
How does the motivation for this upgrade consider the original motivation for the original case?: https://era.zksync.io/docs/reference/concepts/blocks.html#why-do-we-return-l1-batches-inside-evm |
Beta Was this translation helpful? Give feedback.
-
📢 UPDATE 📢➡️ Mainnet reached the max speed of virtual block production at 8 virtual block per 1 L2 miniblock ➡️ Assuming that the speed of catch-up will continue the same as it did in the last 24h, the estimate for catching up is 17 days. This is consistent with the previously planned timeline to end the migration at the late October. 🙋 As always, please post any questions or concerns in this Discussion. We'll continue to update this Discussion as we progress through the upgrade. |
Beta Was this translation helpful? Give feedback.
-
Thank you , i get this |
Beta Was this translation helpful? Give feedback.
-
Has the Mainnet catch up completed? If not, is there a way to monitor the progress (webpage or something)? |
Beta Was this translation helpful? Give feedback.
-
📢 UPDATE 📢➡️ Mainnet has completed the catch-up period as of 15:00 UTC today! No issues were found and the system works as expected. 🤝 Special thanks to sat.is for their monitoring via Grafana Dashboard ➡️ As there are no further updates expected, we are closing this Announcement. 🙋 If you have any questions or concerns, please start a new GitHub Discussion. |
Beta Was this translation helpful? Give feedback.
-
As we announced a few weeks ago, we’re making important changes to how
block.number
,block.timestamp
, andblockHash
behave on zkSync Era.Such an important change on a live protocol comes with risks and unavoidable impact on projects. We've gathered feedback from different teams and, after multiple discussions internally we've come up with a plan.
Here is what you need to know:
⚙️ About L2 blocks and L1 batches
In zkSync Era there are two notions of blocks: L2 blocks and L1 batches.
At the time of this post, the latest L1 batch number is 148131, while the latest L2 block number is 10622404.
🔀 Scope of Changes
block.number
,block.timestamp
andblockHash
currently return the number, timestamp and hash of the L1 batch. After the update is completed (see details below), they will return the number, timestamp and hash of the L2 block. We will also introduce a new set of methods for accessing values in the L1 batch.⏱️ Background & Motivation
Many applications require a higher fidelity of time that can be achieved by referencing L1 batches. With these changes, contracts will be able to measure time at the level of L2 blocks (produced ≈ every few seconds!). This information is already available on the API but with the upcoming changes, developers will be able to access it directly in the smart contracts. For consistency,
block.number
andblockHash
should also correspond to the L2 block.🧙♂️ Upgrade process
In order to maintain consistency and validity of the protocol's state and reduce the impact on existing projects, this update will not be instant. Instead of updating the
number
,timestamp
andblockhash
to return values from the current L2 block immediately after the update, which would result in a big jump from one block number to first one after the update, we'll roll out the changes during a catch-up period.During this period we'll generate multiple "virtual blocks" for every L2 block. These "virtual blocks" will have a sequentially increased
block.number
(starting from the latest L1 batch number), theblock.timestamp
of the corresponding L2 block, and their ownblockhash
generated using the virtual block number.The
timestamp
,number
andblockchash
returned from the protocol will correspond to the latest virtual block during the catch-up.At the beginning, virtual blocks will be generated at the same rate as L1 batches, although we will increase virtual blocks production rate (e.g. generate 4 virtual blocks per L2 block). This will allow us to eventually catch up with the current L2 block number value.
🤨 Why this approach?
This approach is the one with the less impact on existing projects.
Updating the
block.number
immediately would generate problems on indexers and APIs as there would be a big gap between the the latest block number and the first one after the update, which would require projects to re-index all the historic data.The virtual blocks and catch-up period approach will avoid this issue.
🚨 Impact on Projects
block.timestamp
From the moment we start the catch-up period,
block.timestamp
will return the timestamp of the latest virtual block. At the beginning it will return the timestamp of the L1 batch (same as now as virtual blocks will be produced at the same rate as L1 batches) but this value will be updated more frequently as we increase the speed at which virtual blocks are generated.Once the catch-up period ends,
block.timestamp
will be refreshed at the rate of L2 block production (every few seconds).block.number
The number of L2 blocks far exceeds the number of L1 batches (each batch contains a set of blocks). During the catch-up period the
block.number
will return the latest virtual block number. As we will start generating multiple virtual blocks per L2 block, this value will be getting closer to the actual L2 block number until eventually picking up with the latest L2 block.Once the catch-up period ends,
block.number
will return the current L2 block number.blockHash
This upgrade will change the structure of
blockHash
. The hash of the L1 batch is the root of the merkle tree. During the catch-up period, theblockhash
returned will be generated from using the following method:keccak(virtual_block_number)
.After the catch-up period, it will return the hash of the L2 block which has a different composition (a mix of timestamp block number, and potentially additional data about the L2 block).
🔍 Summary
block.timestamp
block.number
blockhash
🗓️ [UPDATED] Upgrade Timeline
The changes for this update are currently being developed. We'll test the update process internally before moving to testnet and finally mainnet. The upgrade will start in the following dates:
⛑ Risks and Considerations
The block production rate and timestamp refresh time will be gradually increased during the catch up period.
If your project has critical logics that rely on the values returned from
block.number
,block.timestamp
orblockhash
you might face unexpected behaviour (e.g. reduced time for governance voting, spike in rewards etc.). These logics could include (non-exhaustive):block.number
to compute rewards.block.number
to calculate when an auction ends or calculate time.block.timestamp
orblock.number
to calculate LP rewards or loan interests.blockhash
to generate randomness.Please check if your project leverages any of these variables, read carefully the detailed information about the upgrade, and contact us if you have any questions.
🛫 Deploying New Projects
If your project does not rely on these variables, you can deploy today or during the catch-up period, there’s no need to wait!
If your project uses
block.number
,block.timestamp
orblockhash
, you should analyse if an increase in the block production rate, timestamp refresh period, or changes in theblockhash
will impact your project. If it doesn't, you can also deploy at any time. You can ask us if you have a specific scenario and you're not sure.If in doubt, wait until the upgrade is completed, deploy your project on testnet, and do extensive tests before deploying on mainnet. Follow the security and recommendations from our docs.
💬 Feedback
If you have any feedback or questions about these changes, reply below and we'll get back to you!
❓FAQ
We have a project on zkSync Era, how will this upgrade impact our project?
Please read carefully the "Impact on Projects" and "Risks and Considerations" sections above.
We're about to deploy a new project; should we wait after the upgrade?
Please read the "Deploying new project" section above. If you have any questions reply to this thread and we'll help.
Would we be able to query the L2 block data during the catch-up period?
Yes! We'll provide a contract getter that will return the L2 block number and timestamp (not the hash though!). The exact method signature will be provided later on.
During the catchup period, is there any temporary RPC method to get the virtual blocks information?
No. We won't have RPC methods to retrieve the virtual block info, but keep in mind that
block.number
,block.timestamp
andblockhash
will reference the virtual blocks during the catch-up period.Is there a contract to query the virtual blocks data?
The Satis Foundation team (thanks @enochSatis 🙏) deployed getter contracts to retrieve the virtual block data. Addresses are:
Will these changes affect the responses from RPC requests?
No, responses for RPC requests already contain information related to L2 blocks.
Edit (07-09-2023): Updated planned timeline for upgrade on mainnet. Updated "NEW" and "UPDATED" tags for some sections
Beta Was this translation helpful? Give feedback.
All reactions