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

Ouroboros.Consensus.MiniProtocol.ChainSync.Client.State

Synopsis

Documentation

data ChainSyncClientHandle m blk Source #

An interface to a ChainSync client that's used by other components, like the GDD governor.

Constructors

ChainSyncClientHandle 

Fields

Instances

Instances details
Generic (ChainSyncClientHandle m blk) Source # 
Instance details

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

Associated Types

type Rep (ChainSyncClientHandle m blk) ∷ TypeType #

(IOLike m, HasHeader blk, LedgerSupportsProtocol blk, NoThunks (Header blk)) ⇒ NoThunks (ChainSyncClientHandle m blk) Source # 
Instance details

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

type Rep (ChainSyncClientHandle m blk) Source # 
Instance details

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

type Rep (ChainSyncClientHandle m blk) = D1 ('MetaData "ChainSyncClientHandle" "Ouroboros.Consensus.MiniProtocol.ChainSync.Client.State" "ouroboros-consensus-0.21.0.0-inplace" 'False) (C1 ('MetaCons "ChainSyncClientHandle" 'PrefixI 'True) ((S1 ('MetaSel ('Just "cschGDDKill") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (m ())) :*: S1 ('MetaSel ('Just "cschOnGsmStateChanged") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (GsmStateTimeSTM m ()))) :*: (S1 ('MetaSel ('Just "cschState") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictTVar m (ChainSyncState blk))) :*: (S1 ('MetaSel ('Just "cschJumping") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictTVar m (ChainSyncJumpingState m blk))) :*: S1 ('MetaSel ('Just "cschJumpInfo") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictTVar m (Maybe (JumpInfo blk))))))))

data ChainSyncJumpingJumperState blk Source #

The specific state of a jumper peer. This state is to be understood as “to the best of our knowledge”, that is “last time we asked them”. For instance, a jumper might be marked as Happy even though its chain has been differing from the dynamo's for hundreds of blocks, if we haven't asked them to jump since then.

Constructors

Happy JumperInitState !(Maybe (JumpInfo blk))

The jumper is happy with the dynamo, and we hold the jump info of the last accepted jump.

LookingForIntersection !(JumpInfo blk) !(JumpInfo blk)

The jumper disagrees with the dynamo and we are searching where exactly that happens. All we know is a point where the jumper agrees with the dynamo and a point where the jumper disagrees with the dynamo, carried by this constructor.

INVARIANT: The tip of the fragment in the good jump info (first argument) is in the fragment of the bad jump info or is an ancestor of it.

FoundIntersection ObjectorInitState !(JumpInfo blk) !(Point (Header blk))

The jumper disagrees with the dynamo and we have determined the latest point where dynamo and jumper agree. We store here the jump info of the latest accepted jump and the point of the earliest rejected jump.

The init state indicates the initialization to use for the objector in case this jumper is promoted.

Instances

Instances details
Generic (ChainSyncJumpingJumperState blk) Source # 
Instance details

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

Associated Types

type Rep (ChainSyncJumpingJumperState blk) ∷ TypeType #

(HasHeader blk, LedgerSupportsProtocol blk, NoThunks (Header blk)) ⇒ NoThunks (ChainSyncJumpingJumperState blk) Source # 
Instance details

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

type Rep (ChainSyncJumpingJumperState blk) Source # 
Instance details

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

data ChainSyncJumpingState m blk Source #

State of a peer with respect to ChainSync jumping.

Constructors

Dynamo

The dynamo, of which there is exactly one unless there are no peers, runs the normal ChainSync protocol and is morally supposed to give us _the_ chain. This might not be true and the dynamo might be not be honest, but the goal of the algorithm is to eventually have an honest, alert peer as dynamo.

Fields

Objector

The objector, of which there is at most one, also runs normal ChainSync. It is a former jumper that disagreed with the dynamo. When that happened, we spun it up to let normal ChainSync and Genesis decide which one to disconnect from.

Fields

  • !ObjectorInitState
     
  • !(JumpInfo blk)

    The youngest point where the objector agrees with the dynamo.

  • !(Point (Header blk))

    The point where the objector dissented with the dynamo when it was a jumper.

Disengaged DisengagedInitState

Headers continue to be downloaded from Disengaged peers. They are not requested to jump, nor elected as dynamos or objectors.

Jumper

The jumpers can be in arbitrary numbers. They are queried regularly to see if they agree with the chain that the dynamo is serving; otherwise, they become candidates to be the objector. See ChainSyncJumpingJumperState for more details.

Fields

Instances

Instances details
Generic (ChainSyncJumpingState m blk) Source # 
Instance details

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

Associated Types

type Rep (ChainSyncJumpingState m blk) ∷ TypeType #

(IOLike m, HasHeader blk, LedgerSupportsProtocol blk, NoThunks (Header blk)) ⇒ NoThunks (ChainSyncJumpingState m blk) Source # 
Instance details

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

type Rep (ChainSyncJumpingState m blk) Source # 
Instance details

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

data ChainSyncState blk Source #

A ChainSync client's state that's used by other components, like the GDD or the jumping governor.

Constructors

ChainSyncState 

Fields

  • csCandidate ∷ !(AnchoredFragment (Header blk))

    The current candidate fragment.

  • csIdling ∷ !Bool

    Whether the last message sent by the peer was MsgAwaitReply.

    This ChainSync client should ensure that its peer sets this flag while and only while both of the following conditions are satisfied: the peer's latest message has been fully processed (especially that its candidate has been updated; previous argument) and its latest message did not claim that it already has headers that extend its candidate.

    It's more important that the flag is unset promptly than it is for the flag to be set promptly, because of how this is used by the GSM to determine that the node is done syncing.

  • csLatestSlot ∷ !(StrictMaybe (WithOrigin SlotNo))

    When the client receives a new header, it updates this field before processing it further, and the latest slot may refer to a header beyond the forecast horizon while the candidate fragment isn't extended yet, to signal to GDD that the density is known up to this slot.

Instances

Instances details
Generic (ChainSyncState blk) Source # 
Instance details

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

Associated Types

type Rep (ChainSyncState blk) ∷ TypeType #

Methods

fromChainSyncState blk → Rep (ChainSyncState blk) x #

toRep (ChainSyncState blk) x → ChainSyncState blk #

(HasHeader blk, NoThunks (Header blk)) ⇒ NoThunks (ChainSyncState blk) Source # 
Instance details

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

type Rep (ChainSyncState blk) Source # 
Instance details

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

type Rep (ChainSyncState blk) = D1 ('MetaData "ChainSyncState" "Ouroboros.Consensus.MiniProtocol.ChainSync.Client.State" "ouroboros-consensus-0.21.0.0-inplace" 'False) (C1 ('MetaCons "ChainSyncState" 'PrefixI 'True) (S1 ('MetaSel ('Just "csCandidate") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (AnchoredFragment (Header blk))) :*: (S1 ('MetaSel ('Just "csIdling") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "csLatestSlot") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictMaybe (WithOrigin SlotNo))))))

data DisengagedInitState Source #

Constructors

Disengaging

The node is being disengaged and for that we need to restart the ChainSync protocol.

DisengagedDone 

Instances

Instances details
Generic DisengagedInitState Source # 
Instance details

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

Associated Types

type Rep DisengagedInitStateTypeType #

Show DisengagedInitState Source # 
Instance details

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

NoThunks DisengagedInitState Source # 
Instance details

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

type Rep DisengagedInitState Source # 
Instance details

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

type Rep DisengagedInitState = D1 ('MetaData "DisengagedInitState" "Ouroboros.Consensus.MiniProtocol.ChainSync.Client.State" "ouroboros-consensus-0.21.0.0-inplace" 'False) (C1 ('MetaCons "Disengaging" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "DisengagedDone" 'PrefixI 'False) (U1TypeType))

data DynamoInitState blk Source #

Constructors

DynamoStarting !(JumpInfo blk)

The dynamo has not yet started jumping and we first need to jump to the given jump info to set the intersection of the ChainSync server.

DynamoStarted 

Instances

Instances details
Generic (DynamoInitState blk) Source # 
Instance details

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

Associated Types

type Rep (DynamoInitState blk) ∷ TypeType #

Methods

fromDynamoInitState blk → Rep (DynamoInitState blk) x #

toRep (DynamoInitState blk) x → DynamoInitState blk #

(HasHeader blk, LedgerSupportsProtocol blk, NoThunks (Header blk)) ⇒ NoThunks (DynamoInitState blk) Source # 
Instance details

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

type Rep (DynamoInitState blk) Source # 
Instance details

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

type Rep (DynamoInitState blk) = D1 ('MetaData "DynamoInitState" "Ouroboros.Consensus.MiniProtocol.ChainSync.Client.State" "ouroboros-consensus-0.21.0.0-inplace" 'False) (C1 ('MetaCons "DynamoStarting" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (JumpInfo blk))) :+: C1 ('MetaCons "DynamoStarted" 'PrefixI 'False) (U1TypeType))

data JumpInfo blk Source #

The ChainSync state required for jumps

The jump info is mostly a snapshot of the KnownIntersectionState of the dynamo, with the difference that jTheirFragment might be a proper prefix of the original candidate fragment.

This can happen if we need to look for an intersection when the jumper rejects a jump.

Instances

Instances details
Generic (JumpInfo blk) Source # 
Instance details

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

Associated Types

type Rep (JumpInfo blk) ∷ TypeType #

Methods

fromJumpInfo blk → Rep (JumpInfo blk) x #

toRep (JumpInfo blk) x → JumpInfo blk #

HasHeader (Header blk) ⇒ Eq (JumpInfo blk) Source # 
Instance details

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

Methods

(==)JumpInfo blk → JumpInfo blk → Bool #

(/=)JumpInfo blk → JumpInfo blk → Bool #

LedgerSupportsProtocol blk ⇒ NoThunks (JumpInfo blk) Source # 
Instance details

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

type Rep (JumpInfo blk) Source # 
Instance details

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

type Rep (JumpInfo blk) = D1 ('MetaData "JumpInfo" "Ouroboros.Consensus.MiniProtocol.ChainSync.Client.State" "ouroboros-consensus-0.21.0.0-inplace" 'False) (C1 ('MetaCons "JumpInfo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "jMostRecentIntersection") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Point blk)) :*: S1 ('MetaSel ('Just "jOurFragment") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (AnchoredFragment (Header blk)))) :*: (S1 ('MetaSel ('Just "jTheirFragment") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (AnchoredFragment (Header blk))) :*: S1 ('MetaSel ('Just "jTheirHeaderStateHistory") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (HeaderStateHistory blk)))))

data JumperInitState Source #

Constructors

FreshJumper

The jumper hasn't been requested to jump yet

StartedJumper 

Instances

Instances details
Generic JumperInitState Source # 
Instance details

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

Associated Types

type Rep JumperInitStateTypeType #

Show JumperInitState Source # 
Instance details

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

NoThunks JumperInitState Source # 
Instance details

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

type Rep JumperInitState Source # 
Instance details

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

type Rep JumperInitState = D1 ('MetaData "JumperInitState" "Ouroboros.Consensus.MiniProtocol.ChainSync.Client.State" "ouroboros-consensus-0.21.0.0-inplace" 'False) (C1 ('MetaCons "FreshJumper" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "StartedJumper" 'PrefixI 'False) (U1TypeType))

data ObjectorInitState Source #

Constructors

Starting

The objector still needs to set the intersection of the ChainSync server before resuming retrieval of headers.

Started 

Instances

Instances details
Generic ObjectorInitState Source # 
Instance details

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

Associated Types

type Rep ObjectorInitStateTypeType #

Show ObjectorInitState Source # 
Instance details

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

NoThunks ObjectorInitState Source # 
Instance details

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

type Rep ObjectorInitState Source # 
Instance details

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

type Rep ObjectorInitState = D1 ('MetaData "ObjectorInitState" "Ouroboros.Consensus.MiniProtocol.ChainSync.Client.State" "ouroboros-consensus-0.21.0.0-inplace" 'False) (C1 ('MetaCons "Starting" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "Started" 'PrefixI 'False) (U1TypeType))