| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Fragment.InFuture
Contents
Description
Intended for qualified import
import Ouroboros.Consensus.Fragment.InFuture (CheckInFuture(..), ClockSkew(..)) import qualified Ouroboros.Consensus.Fragment.InFuture as InFuture
Synopsis
- data CheckInFuture m blk = CheckInFuture {
- checkInFuture :: ValidatedFragment (Header blk) (LedgerState blk) -> m (AnchoredFragment (Header blk), [InFuture blk])
- data InFuture blk = InFuture {
- inFutureHeader :: Header blk
- inFutureExceedsClockSkew :: Bool
- reference :: forall m blk. (Monad m, UpdateLedger blk, HasHardForkHistory blk) => LedgerConfig blk -> ClockSkew -> SystemTime m -> CheckInFuture m blk
- data ClockSkew
- clockSkewInSeconds :: Double -> ClockSkew
- defaultClockSkew :: ClockSkew
- dontCheck :: Monad m => CheckInFuture m blk
- miracle :: forall m blk. (MonadSTM m, HasHeader (Header blk)) => STM m SlotNo -> Word64 -> CheckInFuture m blk
Documentation
data CheckInFuture m blk Source #
Constructors
| CheckInFuture | |
Fields
| |
Instances
| NoThunks (CheckInFuture m blk) Source # | |
Defined in Ouroboros.Consensus.Fragment.InFuture | |
Header of block that we found to be in the future
Constructors
| InFuture | |
Fields
| |
reference :: forall m blk. (Monad m, UpdateLedger blk, HasHardForkHistory blk) => LedgerConfig blk -> ClockSkew -> SystemTime m -> CheckInFuture m blk Source #
Clock skew
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
SlotNoof 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.
Instances
| Eq ClockSkew Source # | |
| Ord ClockSkew Source # | |
Defined in Ouroboros.Consensus.Fragment.InFuture | |
| Show ClockSkew Source # | |
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.
Testing
dontCheck :: Monad m => CheckInFuture m blk Source #
Trivial InFuture check that doesn't do any check at all
This is useful for testing and tools such as the DB converter.
Arguments
| :: forall m blk. (MonadSTM m, HasHeader (Header blk)) | |
| => STM m SlotNo | Get current slot |
| -> Word64 | Maximum clock skew (in terms of slots) |
| -> CheckInFuture m blk |
If by some miracle we have a function that can always tell us what the
correct slot is, implementing CheckInFuture is easy
NOTE: Use of miracle in tests means that none of the hard fork
infrastructure for converting slots to time is tested.