Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data HeaderInFutureCheck m blk arrival judgment = HeaderInFutureCheck {
- proxyArrival ∷ Proxy arrival
- recordHeaderArrival ∷ Header blk → m arrival
- judgeHeaderArrival ∷ LedgerConfig blk → LedgerState blk → arrival → Except PastHorizonException judgment
- handleHeaderArrival ∷ judgment → m (Except HeaderArrivalException RelativeTime)
- data SomeHeaderInFutureCheck m blk = ∀ arrival judgment. SomeHeaderInFutureCheck (HeaderInFutureCheck m blk arrival judgment)
- data HeaderArrivalException = ∀ blk.HasHeader blk ⇒ FarFutureHeaderException {}
- realHeaderInFutureCheck ∷ (HasHeader blk, HasHeader (Header blk), HasHardForkHistory blk, MonadDelay m) ⇒ ClockSkew → SystemTime m → SomeHeaderInFutureCheck m blk
- clockSkewInSeconds ∷ Double → ClockSkew
- defaultClockSkew ∷ ClockSkew
- data ClockSkew
- unClockSkew ∷ ClockSkew → NominalDiffTime
Interface
data HeaderInFutureCheck m blk arrival judgment Source #
The interface a ChainSync client needs in order to check the arrival time of headers.
Instead of alphabetical, the fields are in the order in which the ChainSync client logic will invoke them for each header.
HeaderInFutureCheck | |
|
data SomeHeaderInFutureCheck m blk Source #
∀ arrival judgment. SomeHeaderInFutureCheck (HeaderInFutureCheck m blk arrival judgment) |
Real Implementation
data HeaderArrivalException Source #
∀ blk.HasHeader blk ⇒ FarFutureHeaderException | The header arrived so early that its issuer either minted it before their clock reached its slot onset or else the difference between their clock and ours is more severe than we're configured to tolerate. INVARIANT: |
realHeaderInFutureCheck ∷ (HasHeader blk, HasHeader (Header blk), HasHardForkHistory blk, MonadDelay m) ⇒ ClockSkew → SystemTime m → SomeHeaderInFutureCheck m blk Source #
Clock skew
clockSkewInSeconds ∷ Double → ClockSkew Source #
Specify maximum clock skew in seconds
defaultClockSkew ∷ ClockSkew Source #
Default maximum permissible clock skew
See ClockSkew
for details. We allow for 5 seconds skew by default.
not exporting the constructor
Maximum permissible clock skew
When running NTP, systems clocks will never be perfectly synchronized. The maximum clock skew records how much of a difference we consider acceptable.
For example. Suppose
- Two nodes A and B
- A's clock is 0.5 ahead of B's
- A produces a block and sends it to B
- When B translates the
SlotNo
of that block to a time, it may find that it is 0.5 seconds ahead of its current clock (worst case).
The maximum permissible clock skew decides if B will consider this block to be valid (even if it will not yet consider it for chain seleciton) or as invalid (and disconnect from A, since A is sending it invalid blocks).
Use defaultClockSkew
when unsure.