Skip to content
Snippets Groups Projects
Bastian Köcher's avatar
Bastian Köcher authored
* 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 <123550+andresilva@users.noreply.github.com>

* Rename to `TooEarly`

* FMT

---------

Co-authored-by: default avatarAndré Silva <123550+andresilva@users.noreply.github.com>
4af64eb0
Name Last commit Last update