Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The Genesis State Machine decides whether the node is caught-up or not.
Synopsis
- data CandidateVersusSelection
- data DurationFromNow
- data GsmEntryPoints m = GsmEntryPoints {
- enterCaughtUp ∷ ∀ neverTerminates. m neverTerminates
- enterPreSyncing ∷ ∀ neverTerminates. m neverTerminates
- data GsmNodeKernelArgs m blk = GsmNodeKernelArgs {}
- data GsmState
- data GsmView m upstreamPeer selection chainSyncState = GsmView {
- antiThunderingHerd ∷ Maybe StdGen
- candidateOverSelection ∷ selection → chainSyncState → CandidateVersusSelection
- peerIsIdle ∷ chainSyncState → Bool
- durationUntilTooOld ∷ Maybe (selection → m DurationFromNow)
- equivalent ∷ selection → selection → Bool
- getChainSyncStates ∷ STM m (Map upstreamPeer (StrictTVar m chainSyncState))
- getCurrentSelection ∷ STM m selection
- minCaughtUpDuration ∷ NominalDiffTime
- setCaughtUpPersistentMark ∷ Bool → m ()
- writeGsmState ∷ GsmState → m ()
- isHaaSatisfied ∷ STM m Bool
- data MarkerFileView m = MarkerFileView {
- hasMarkerFile ∷ m Bool
- removeMarkerFile ∷ m ()
- touchMarkerFile ∷ m ()
- newtype WrapDurationUntilTooOld m blk = DurationUntilTooOld {}
- data TraceGsmEvent selection
- = GsmEventEnterCaughtUp !Int !selection
- | GsmEventLeaveCaughtUp !selection !DurationFromNow
- | GsmEventPreSyncingToSyncing
- | GsmEventSyncingToPreSyncing
- gsmStateToLedgerJudgement ∷ GsmState → LedgerStateJudgement
- initializationGsmState ∷ (GetTip (LedgerState blk), Monad m) ⇒ m (LedgerState blk) → Maybe (WrapDurationUntilTooOld m blk) → MarkerFileView m → m GsmState
- realDurationUntilTooOld ∷ (HasHardForkHistory blk, MonadSTM m) ⇒ LedgerConfig blk → STM m (LedgerState blk) → NominalDiffTime → SystemTime m → m (WrapDurationUntilTooOld m blk)
- realGsmEntryPoints ∷ ∀ m upstreamPeer selection tracedSelection candidate. (MonadDelay m, MonadTimer m) ⇒ (selection → tracedSelection, Tracer m (TraceGsmEvent tracedSelection)) → GsmView m upstreamPeer selection candidate → GsmEntryPoints m
- realMarkerFileView ∷ MonadThrow m ⇒ ChainDB m blk → HasFS m h → MarkerFileView m
- module Ouroboros.Consensus.Node.GsmState
Documentation
data CandidateVersusSelection Source #
CandidateDoesNotIntersect | The GSM assumes that this is ephemeral For example, the ChainSync client will either disconnect from the peer or update the candidate to one that is not stale. It's also technically possible that the selection is stale, which the ChainDB would also resolve as soon as possible. |
WhetherCandidateIsBetter !Bool | Whether the candidate is better than the selection |
Instances
data DurationFromNow Source #
After !NominalDiffTime | INVARIANT positive |
Already | This value represents all non-positive durations, ie events from the past |
Instances
Show DurationFromNow Source # | |
Defined in Ouroboros.Consensus.Node.GSM showsPrec ∷ Int → DurationFromNow → ShowS # show ∷ DurationFromNow → String # showList ∷ [DurationFromNow] → ShowS # | |
Eq DurationFromNow Source # | |
Defined in Ouroboros.Consensus.Node.GSM (==) ∷ DurationFromNow → DurationFromNow → Bool # (/=) ∷ DurationFromNow → DurationFromNow → Bool # |
data GsmEntryPoints m Source #
The two proper GSM entrypoints.
See the BootstrapPeersIER.md
document for documentation.
See initializationLedgerJudgement
for the Initializing
pseudo-state.
GsmEntryPoints | |
|
data GsmNodeKernelArgs m blk Source #
Arguments the NodeKernel has to take because of the GSM
Current state of the Genesis State Machine
PreSyncing | We are syncing, and the Honest Availability Assumption is not satisfied. |
Syncing | We are syncing, and the Honest Availability Assumption is satisfied. |
CaughtUp | We are caught-up. |
Instances
Generic GsmState | |
Read GsmState | |
Show GsmState | |
Eq GsmState | |
NoThunks GsmState | |
type Rep GsmState | |
Defined in Ouroboros.Consensus.Node.GsmState type Rep GsmState = D1 ('MetaData "GsmState" "Ouroboros.Consensus.Node.GsmState" "ouroboros-consensus-0.21.0.0-inplace" 'False) (C1 ('MetaCons "PreSyncing" 'PrefixI 'False) (U1 ∷ Type → Type) :+: (C1 ('MetaCons "Syncing" 'PrefixI 'False) (U1 ∷ Type → Type) :+: C1 ('MetaCons "CaughtUp" 'PrefixI 'False) (U1 ∷ Type → Type))) |
data GsmView m upstreamPeer selection chainSyncState Source #
GsmView | |
|
data MarkerFileView m Source #
A view on the GSM's Caught-Up persistent marker file
These comments constrain the result of realMarkerFile
; mock views in
testing are free to be different.
MarkerFileView | |
|
newtype WrapDurationUntilTooOld m blk Source #
Auxiliaries
data TraceGsmEvent selection Source #
GsmEventEnterCaughtUp !Int !selection | how many peers and the current selection |
GsmEventLeaveCaughtUp !selection !DurationFromNow | the current selection and its age |
GsmEventPreSyncingToSyncing | the Honest Availability Assumption is now satisfied |
GsmEventSyncingToPreSyncing | the Honest Availability Assumption is no longer satisfied |
Instances
Show selection ⇒ Show (TraceGsmEvent selection) Source # | |
Defined in Ouroboros.Consensus.Node.GSM showsPrec ∷ Int → TraceGsmEvent selection → ShowS # show ∷ TraceGsmEvent selection → String # showList ∷ [TraceGsmEvent selection] → ShowS # | |
Eq selection ⇒ Eq (TraceGsmEvent selection) Source # | |
Defined in Ouroboros.Consensus.Node.GSM (==) ∷ TraceGsmEvent selection → TraceGsmEvent selection → Bool # (/=) ∷ TraceGsmEvent selection → TraceGsmEvent selection → Bool # |
gsmStateToLedgerJudgement ∷ GsmState → LedgerStateJudgement Source #
For LedgerStateJudgement
as used in the Diffusion layer, there is no
difference between PreSyncing
and Syncing
.
initializationGsmState Source #
∷ (GetTip (LedgerState blk), Monad m) | |
⇒ m (LedgerState blk) | |
→ Maybe (WrapDurationUntilTooOld m blk) |
|
→ MarkerFileView m | |
→ m GsmState |
Determine the initial GsmState
Also initializes the persistent marker file.
Constructors
realDurationUntilTooOld Source #
∷ (HasHardForkHistory blk, MonadSTM m) | |
⇒ LedgerConfig blk | |
→ STM m (LedgerState blk) | |
→ NominalDiffTime | If the volatile tip is older than this, then the node will exit the
WARNING This function returns |
→ SystemTime m | |
→ m (WrapDurationUntilTooOld m blk) |
The real system's durationUntilTooOld
realGsmEntryPoints ∷ ∀ m upstreamPeer selection tracedSelection candidate. (MonadDelay m, MonadTimer m) ⇒ (selection → tracedSelection, Tracer m (TraceGsmEvent tracedSelection)) → GsmView m upstreamPeer selection candidate → GsmEntryPoints m Source #
The actual GSM logic for boot strap peers
See the BootstrapPeersIER.md
document for the specification of most of this
logic, except the transition rules between PreSyncing and Syncing, the two
states OnlyBootstrap is split into:
- PreSyncing ⟶ Syncing: The Honest Availability Assumption is satisfied.
∷ MonadThrow m | |
⇒ ChainDB m blk | |
→ HasFS m h | should be independent of other filesystems, eg |
→ MarkerFileView m |
The real system's MarkerFileView
The strict ChainDB
argument is unused, but its existence ensures there's
only one process using this file system.