Skip to content
Commit 4af64eb0 authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

pallet-timestamp: Remove `ValidAtTimestamp` error variant (#13346)



* pallet-timestamp: Remove `ValidAtTimestamp` error variant

The error variant wasn't that useful and it was also used wrongly in the code. In the code we
returned this variant when the `timestamp < minimum`. The problem of this is that we waited on the
node side some time, but then `set` function rejects the timestamp because of the same check (the
timestamp in the block stays the same). We ensure that the timestamp isn't drifting too much in the
future, but waiting for the timestamp to be "valid" would open some attack vector. The consensus
protocols also compare the slots in the blocks to ensure that there isn't a block from the future
and in the runtime we then ensure that `slot = timestamp / slot_duration`. So, we can just remove
this variant and replace it with a new variant `TimeBetweenBlocksTooShort` to not even try importing
a block which uses a too short delay since the last block.

* Update primitives/timestamp/src/lib.rs

Co-authored-by: default avatarAndré Silva <[email protected]>

* Rename to `TooEarly`

* FMT

---------

Co-authored-by: default avatarAndré Silva <[email protected]>
parent 61ef6baa
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment