| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Node.GSM
Description
The Genesis State Machine decides whether the node is caught-up or not.
Synopsis
- data CandidateVersusSelection
- data DurationFromNow
- data GsmEntryPoints (m ∷ Type → Type) = GsmEntryPoints {
- enterCaughtUp ∷ ∀ neverTerminates. m neverTerminates
- enterPreSyncing ∷ ∀ neverTerminates. m neverTerminates
- data GsmNodeKernelArgs (m ∷ Type → Type) blk = GsmNodeKernelArgs {}
- data GsmState
- data GsmView (m ∷ Type → Type) upstreamPeer selection chainSyncState = GsmView {
- antiThunderingHerd ∷ Maybe StdGen
- getCandidateOverSelection ∷ STM m (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 ∷ Type → Type) = MarkerFileView {
- hasMarkerFile ∷ m Bool
- removeMarkerFile ∷ m ()
- touchMarkerFile ∷ m ()
- newtype WrapDurationUntilTooOld (m ∷ Type → Type) blk = DurationUntilTooOld {}
- data TraceGsmEvent selection
- gsmStateToLedgerJudgement ∷ GsmState → LedgerStateJudgement
- initializationGsmState ∷ (GetTip (LedgerState blk), Monad m) ⇒ m (LedgerState blk EmptyMK) → Maybe (WrapDurationUntilTooOld m blk) → MarkerFileView m → m GsmState
- realDurationUntilTooOld ∷ (HasHardForkHistory blk, MonadSTM m) ⇒ LedgerConfig blk → STM m (LedgerState blk EmptyMK) → NominalDiffTime → SystemTime m → m (WrapDurationUntilTooOld m blk)
- realGsmEntryPoints ∷ ∀ (m ∷ Type → Type) upstreamPeer selection tracedSelection candidate. (MonadDelay m, MonadTimer m) ⇒ (selection → tracedSelection, Tracer m (TraceGsmEvent tracedSelection)) → GsmView m upstreamPeer selection candidate → GsmEntryPoints m
- realMarkerFileView ∷ ∀ (m ∷ Type → Type) blk h. MonadThrow m ⇒ ChainDB m blk → HasFS m h → MarkerFileView m
- module Ouroboros.Consensus.Node.GsmState
Documentation
data CandidateVersusSelection Source #
Constructors
| 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
| Show CandidateVersusSelection Source # | |
Defined in Ouroboros.Consensus.Node.GSM Methods showsPrec ∷ Int → CandidateVersusSelection → ShowS # | |
| Eq CandidateVersusSelection Source # | |
Defined in Ouroboros.Consensus.Node.GSM | |
data DurationFromNow Source #
Constructors
| 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 Methods showsPrec ∷ Int → DurationFromNow → ShowS # show ∷ DurationFromNow → String # showList ∷ [DurationFromNow] → ShowS # | |
| Eq DurationFromNow Source # | |
Defined in Ouroboros.Consensus.Node.GSM Methods (==) ∷ DurationFromNow → DurationFromNow → Bool # (/=) ∷ DurationFromNow → DurationFromNow → Bool # | |
data GsmEntryPoints (m ∷ Type → Type) Source #
The two proper GSM entrypoints.
See the BootstrapPeersIER.md document for documentation.
See initializationLedgerJudgement for the Initializing pseudo-state.
Constructors
| GsmEntryPoints | |
Fields
| |
data GsmNodeKernelArgs (m ∷ Type → Type) blk Source #
Arguments the NodeKernel has to take because of the GSM
Constructors
| GsmNodeKernelArgs | |
Current state of the Genesis State Machine
Constructors
| 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 | |||||
Defined in Ouroboros.Consensus.Node.GsmState Associated Types
| |||||
| 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.28.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 ∷ Type → Type) upstreamPeer selection chainSyncState Source #
Constructors
| GsmView | |
Fields
| |
data MarkerFileView (m ∷ Type → Type) 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.
Constructors
| MarkerFileView | |
Fields
| |
newtype WrapDurationUntilTooOld (m ∷ Type → Type) blk Source #
Constructors
| DurationUntilTooOld | |
Fields | |
Auxiliaries
data TraceGsmEvent selection Source #
Constructors
| GsmEventInitializedInCaughtUp | The GSM was initialized in the |
| GsmEventInitializedInPreSyncing | The GSM was initialized in the |
| GsmEventEnterCaughtUp !Int !selection | The GSM transitioned from Includes the number of peers and the current selection. |
| GsmEventLeaveCaughtUp !selection !DurationFromNow | The GSM transitioned from Includes 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 Methods 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 Methods (==) ∷ 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 #
Arguments
| ∷ (GetTip (LedgerState blk), Monad m) | |
| ⇒ m (LedgerState blk EmptyMK) | |
| → Maybe (WrapDurationUntilTooOld m blk) |
|
| → MarkerFileView m | |
| → m GsmState |
Determine the initial GsmState
Also initializes the persistent marker file.
Constructors
realDurationUntilTooOld Source #
Arguments
| ∷ (HasHardForkHistory blk, MonadSTM m) | |
| ⇒ LedgerConfig blk | |
| → STM m (LedgerState blk EmptyMK) | |
| → 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 ∷ Type → Type) 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.
Arguments
| ∷ ∀ (m ∷ Type → Type) blk h. 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.