ouroboros-consensus-0.20.1.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Consensus.MiniProtocol.ChainSync.Client.HistoricityCheck

Synopsis

Interface

data HistoricityCheck m blk Source #

Interface for the ChainSync client for deciding whether MsgRollBackwards and MsgAwaitReplys are historical.

Constructors

HistoricityCheck 

Fields

data HistoricityException Source #

Constructors

∀ blk.HasHeader blk ⇒ HistoricityException

We received a MsgRollBackward or a MsgAwaitReply while their candidate chain was too old for it to plausibly have been sent by an honest caught-up peer.

INVARIANT: historicityCutoff < arrivalTime diffRelTime slotTime

Fields

Instances

Instances details
Exception HistoricityException Source # 
Instance details

Defined in Ouroboros.Consensus.MiniProtocol.ChainSync.Client.HistoricityCheck

Show HistoricityException Source # 
Instance details

Defined in Ouroboros.Consensus.MiniProtocol.ChainSync.Client.HistoricityCheck

Eq HistoricityException Source #

The maximum age of a MsgRollBackward or MsgAwaitReply at arrival time, constraining the age of the oldest rewound header or the tip of the candidate fragment, respectively.

This should be set to at least the maximum duration (across all eras) of a stability window (the number of slots in which at least k blocks are guaranteed to arise).

For example, on Cardano mainnet today, the Praos Chain Growth property implies that 3k/f (=129600) slots (=36 hours) will contain at least k (=2160) blocks. (Byron has a smaller stability window, namely 2k (=24 hours as the Byron slot length is 20s). Thus a peer rolling back a header that is older than 36 hours or signals that it doesn't have more headers is either violating the maximum rollback or else isn't a caught-up node. Either way, a syncing node should not be connected to that peer.

Instance details

Defined in Ouroboros.Consensus.MiniProtocol.ChainSync.Client.HistoricityCheck

Real implementation

mkCheck Source #

Arguments

∷ ∀ m blk. (Monad m, HasHeader blk, HasAnnTip blk) 
SystemTime m 
→ m GsmState

Get the current GsmState.

This is used to disable the historicity check when we are caught up. The rationale is extra resilience against disconnects between honest nodes in disaster scenarios with very low chain density.

HistoricityCutoff 
HistoricityCheck m blk 

Deny all rollbacks that rewind blocks older than HistoricityCutoff upon arrival.

noCheckApplicative m ⇒ HistoricityCheck m blk Source #

Do not perform any historicity checks. This is useful when we only sync from trusted peers (Praos mode) or when the impact of historical messages is already mitigated by other means (for example indirectly by the Limit on Patience in the case of Genesis without ChainSync Jumping).