Created
September 18, 2022 18:31
-
-
Save jdaviderb/9773aedc2c7aaf83653295c4c95ebec3 to your computer and use it in GitHub Desktop.
How solana calculate Clock::get()?.unix_timestamp;
This file contains 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
> It's strongly desired by some users to have a network-controlled best effort timestamp associated with the production time of each block. One such example is https://en.bitcoin.it/wiki/Block_timestamp | |
> | |
> Some important properties of this timestamp are: | |
> | |
> 1. Drift of no worse than a couple hours from the actual block production time | |
> 2. Replaying the ledger at a later time results in the same block production time | |
> 3. The block production time is not controlled by a single centralized oracle, but ideally is a function that uses inputs from all validators | |
> | |
> A rough proposal would be to require validators to submit their current UTC time every N minutes. A median time is then constructed from the latest submission and block times are then computed as `last_median_time + slot_offset * 400ms` until the next median time is constructed. | |
> | |
> This issue can be broken up into: | |
> | |
> 1. The definition/implementation of the `getBlockTime` RPC API | |
> 2. Initial stub implementation where `last_median_time` is fixed to 0. | |
> 3. Adding time submission to all validators and producing a real `last_median_time` | |
> | |
> 1 and 2 are important to implement quickly to unblock some users | |
ref | |
https://github.com/solana-labs/solana/issues/7115 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment