#timestamp #chain #relay #inherent #primitive #parachain #slot

no-std cumulus-primitives-timestamp

Provides timestamp related functionality for parachains

19 releases (breaking)

0.16.0 Sep 25, 2024
0.15.0 Jul 18, 2024
0.10.0 Mar 18, 2024
0.6.0 Dec 12, 2023
0.0.0 Nov 21, 2022

#2 in #inherent

Download history 137/week @ 2024-07-03 189/week @ 2024-07-10 338/week @ 2024-07-17 218/week @ 2024-07-24 101/week @ 2024-07-31 144/week @ 2024-08-07 260/week @ 2024-08-14 169/week @ 2024-08-21 91/week @ 2024-08-28 52/week @ 2024-09-04 97/week @ 2024-09-11 174/week @ 2024-09-18 506/week @ 2024-09-25 315/week @ 2024-10-02 402/week @ 2024-10-09 179/week @ 2024-10-16

1,444 downloads per month
Used in 8 crates (6 directly)

Apache-2.0 and GPL-3.0-only

7KB

Release

Polkadot SDK stable2409


lib.rs:

Cumulus timestamp related primitives.

Provides a InherentDataProvider that should be used in the validation phase of the parachain. It will be used to create the inherent data and that will be used to check the inherents inside the parachain block (in this case the timestamp inherent). As we don't have access to any clock from the runtime the timestamp is always passed as an inherent into the runtime. To check this inherent when validating the block, we will use the relay chain slot. As the relay chain slot is derived from a timestamp, we can easily convert it back to a timestamp by multiplying it with the slot duration. By comparing the relay chain slot derived timestamp with the timestamp we can ensure that the parachain timestamp is reasonable.

Dependencies

~19–32MB
~530K SLoC