7

In pallet-timestamp, what is InherentError::ValidAtTimestamp supposed to mean exactly?

let minimum = (Self::now() + T::MinimumPeriod::get()).saturated_into::<u64>();
if t > *(data + MAX_TIMESTAMP_DRIFT_MILLIS) {
    Err(InherentError::TooFarInFuture)
} else if t < minimum {
        Err(InherentError::ValidAtTimestamp(minimum.into()))
} else {
        Ok(())
}

Does it mean that we are receiving an "older" timestamp and something newer was expected? I also see it marked as a non-fatal error. What does that mean in terms of the code path of this error type? Thanks.

1 Answer 1

1

The way I understand that particular error variant is by first noting the condition t < minimum. Minimum is the best estimate from the perspective of the local node that of the minimum time period between the block that's already been finalized, to the block that's being proposed.

If the timestamp happens to be less than the local node's minimum it would imply one of two scenarios:

  1. The timestamp was intentionally set to something less than Self::now() + T::Minimum where the underlying assumption is that both nodes system clocks agree to the same time.
  2. The last block author had their current Moment A much behind the local node's Moment B resulting in
[t = A + T::Minimum] < B + T::Minimum

Which would imply that even though the timestamp was set properly w.r.t A, B doesn't agree with the value of Self::now() and subsequently the timestamp set by A.

I am a bit unsure about the circumstance under which such a desynchronization of Self::now() could occur, and I'm even skeptical about how often does this code path trigger, but I'll leave it right here to the other readers to improve the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.