ouroboros-consensus-0.1.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Node

Description

Run the whole Node

Intended for qualified import.

Synopsis

Documentation

run ∷ ∀ blk p2p. RunNode blk ⇒ RunNodeArgs IO RemoteAddress LocalAddress blk p2p → StdRunNodeArgs IO blk p2p → IO () Source #

Combination of runWith and stdLowLevelRunArgsIO

runWith ∷ ∀ m addrNTN addrNTC versionDataNTN versionDataNTC blk p2p. (RunNode blk, IOLike m, MonadTime m, MonadTimer m, Hashable addrNTN, Ord addrNTN, Typeable addrNTN) ⇒ RunNodeArgs m addrNTN addrNTC blk p2p → LowLevelRunNodeArgs m addrNTN addrNTC versionDataNTN versionDataNTC blk p2p → m () Source #

Start a node.

This opens the ChainDB, sets up the NodeKernel and initialises the network layer.

This function runs forever unless an exception is thrown.

Standard arguments

data StdRunNodeArgs m blk (p2p ∷ P2P) Source #

Higher-level arguments that can determine the LowLevelRunNodeArgs under some usual assumptions for realistic use cases such as in cardano-node.

See stdLowLevelRunNodeArgsIO.

Constructors

StdRunNodeArgs 

Fields

stdLowLevelRunNodeArgsIO ∷ ∀ blk p2p. RunNode blk ⇒ RunNodeArgs IO RemoteAddress LocalAddress blk p2p → StdRunNodeArgs IO blk p2p → IO (LowLevelRunNodeArgs IO RemoteAddress LocalAddress NodeToNodeVersionData NodeToClientVersionData blk p2p) Source #

Conveniently packaged LowLevelRunNodeArgs arguments from a standard non-testing invocation.

stdMkChainDbHasFSFilePathRelativeMountPointSomeHasFS IO Source #

How to locate the ChainDB on disk

stdWithCheckedDB Source #

Arguments

∷ ∀ blk a. (StandardHash blk, Typeable blk) 
Proxy blk 
FilePath 
NetworkMagic 
→ (LastShutDownWasClean → (ChainDB IO blk → IO a → IO a) → IO a)

Body action with last shutdown was clean.

IO a 

Check the DB marker, lock the DB and look for the clean shutdown marker.

Run the body action with the DB locked.

P2P Switch

data NetworkP2PMode (p2p ∷ P2P) where Source #

P2P Switch

Instances

Instances details
Eq (NetworkP2PMode p2p) Source # 
Instance details

Defined in Ouroboros.Consensus.Node

Show (NetworkP2PMode p2p) Source # 
Instance details

Defined in Ouroboros.Consensus.Node

Exposed by run et al

newtype RelativeMountPoint Source #

A relative path for a MountPoint

The root is determined by context.

data TraceEvent blk Source #

Trace type for the various events of the ChainDB.

Instances

Instances details
(HasHeader blk, Eq (Header blk), LedgerSupportsProtocol blk, InspectLedger blk) ⇒ Eq (TraceEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Methods

(==)TraceEvent blk → TraceEvent blk → Bool Source #

(/=)TraceEvent blk → TraceEvent blk → Bool Source #

(HasHeader blk, Show (Header blk), LedgerSupportsProtocol blk, InspectLedger blk) ⇒ Show (TraceEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Methods

showsPrecIntTraceEvent blk → ShowS Source #

showTraceEvent blk → String Source #

showList ∷ [TraceEvent blk] → ShowS Source #

Generic (TraceEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

Associated Types

type Rep (TraceEvent blk) ∷ TypeType Source #

Methods

fromTraceEvent blk → Rep (TraceEvent blk) x Source #

toRep (TraceEvent blk) x → TraceEvent blk Source #

type Rep (TraceEvent blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.Impl.Types

type Rep (TraceEvent blk) = D1 ('MetaData "TraceEvent" "Ouroboros.Consensus.Storage.ChainDB.Impl.Types" "ouroboros-consensus-0.1.0.0-inplace" 'False) (((C1 ('MetaCons "TraceAddBlockEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceAddBlockEvent blk))) :+: C1 ('MetaCons "TraceFollowerEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceFollowerEvent blk)))) :+: (C1 ('MetaCons "TraceCopyToImmutableDBEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceCopyToImmutableDBEvent blk))) :+: (C1 ('MetaCons "TraceGCEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceGCEvent blk))) :+: C1 ('MetaCons "TraceInitChainSelEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceInitChainSelEvent blk)))))) :+: ((C1 ('MetaCons "TraceOpenEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceOpenEvent blk))) :+: (C1 ('MetaCons "TraceIteratorEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceIteratorEvent blk))) :+: C1 ('MetaCons "TraceLedgerEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceEvent blk))))) :+: (C1 ('MetaCons "TraceLedgerReplayEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceReplayEvent blk))) :+: (C1 ('MetaCons "TraceImmutableDBEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceEvent blk))) :+: C1 ('MetaCons "TraceVolatileDBEvent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TraceEvent blk)))))))

data ChainDbArgs f m blk Source #

Constructors

ChainDbArgs 

Fields

data HardForkBlockchainTimeArgs m blk Source #

Constructors

HardForkBlockchainTimeArgs 

Fields

newtype LastShutDownWasClean Source #

Did the ChainDB already have existing clean-shutdown marker on disk?

data LowLevelRunNodeArgs m addrNTN addrNTC versionDataNTN versionDataNTC blk (p2p ∷ P2P) Source #

Arguments that usually only tests directly specify.

A non-testing invocation probably wouldn't explicitly provide these values to runWith. The cardano-node, for example, instead calls the run abbreviation, which uses stdLowLevelRunNodeArgsIO to indirectly specify these low-level values from the higher-level StdRunNodeArgs.

Constructors

LowLevelRunNodeArgs 

Fields

data MempoolCapacityBytesOverride Source #

An override for the default MempoolCapacityBytes which is 2x the maximum transaction capacity

Constructors

NoMempoolCapacityBytesOverride

Use 2x the maximum transaction capacity of a block. This will change dynamically with the protocol parameters adopted in the current ledger.

MempoolCapacityBytesOverride !MempoolCapacityBytes

Use the following MempoolCapacityBytes.

data NodeKernel m remotePeer localPeer blk Source #

Interface against running relay node

Constructors

NodeKernel 

Fields

data NodeKernelArgs m remotePeer localPeer blk Source #

Arguments required when initializing a node

data ProtocolInfo m b Source #

Data required to run the specified protocol.

Instances

Instances details
Functor m ⇒ Isomorphic (ProtocolInfo m) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Embed.Unary

Methods

projectNoHardForks blk ⇒ ProtocolInfo m (HardForkBlock '[blk]) → ProtocolInfo m blk Source #

injectNoHardForks blk ⇒ ProtocolInfo m blk → ProtocolInfo m (HardForkBlock '[blk]) Source #

data RunNodeArgs m addrNTN addrNTC blk (p2p ∷ P2P) Source #

Arguments expected from any invocation of runWith, whether by deployed code, tests, etc.

Constructors

RunNodeArgs 

Fields

type Tracers m remotePeer localPeer blk = Tracers' remotePeer localPeer blk (Tracer m) Source #

A record of Tracers for the node.

data Tracers' remotePeer localPeer blk f Source #

Instances

Instances details
(∀ a. Semigroup (f a)) ⇒ Semigroup (Tracers' remotePeer localPeer blk f) Source # 
Instance details

Defined in Ouroboros.Consensus.Node.Tracers

Methods

(<>)Tracers' remotePeer localPeer blk f → Tracers' remotePeer localPeer blk f → Tracers' remotePeer localPeer blk f Source #

sconcatNonEmpty (Tracers' remotePeer localPeer blk f) → Tracers' remotePeer localPeer blk f Source #

stimesIntegral b ⇒ b → Tracers' remotePeer localPeer blk f → Tracers' remotePeer localPeer blk f Source #

Internal helpers

mkChainDbArgs Source #

Arguments

∷ ∀ m blk. (RunNode blk, IOLike m) 
ResourceRegistry m 
CheckInFuture m blk 
TopLevelConfig blk 
ExtLedgerState blk

Initial ledger

ChunkInfo 
ChainDbArgs Defaults m blk 
ChainDbArgs Identity m blk 

mkNodeKernelArgs ∷ ∀ m addrNTN addrNTC blk. (RunNode blk, IOLike m) ⇒ ResourceRegistry m → Int → StdGen → TopLevelConfig blk → m [BlockForging m blk] → Tracers m (ConnectionId addrNTN) (ConnectionId addrNTC) blk → BlockchainTime m → ChainDB m blk → m (NodeKernelArgs m (ConnectionId addrNTN) (ConnectionId addrNTC) blk) Source #

nodeKernelArgsEnforceInvariantsNodeKernelArgs m (ConnectionId addrNTN) (ConnectionId addrNTC) blk → NodeKernelArgs m (ConnectionId addrNTN) (ConnectionId addrNTC) blk Source #

We allow the user running the node to customise the NodeKernelArgs through llrnCustomiseNodeKernelArgs, but there are some limits to some values. This function makes sure we don't exceed those limits and that the values are consistent.

openChainDB Source #

Arguments

∷ ∀ m blk. (RunNode blk, IOLike m) 
ResourceRegistry m 
CheckInFuture m blk 
TopLevelConfig blk 
ExtLedgerState blk

Initial ledger

ChainDbArgs Defaults m blk 
→ (ChainDbArgs Identity m blk → ChainDbArgs Identity m blk)

Customise the ChainDbArgs

→ m (ChainDB m blk)