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: André Silva <[email protected]> * Rename to `TooEarly` * FMT --------- Co-authored-by: André Silva <[email protected]>
parent
61ef6baa
Please register or sign in to comment