Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Run the whole Node
Intended for qualified import.
Synopsis
- run ∷ ∀ blk p2p. RunNode blk ⇒ RunNodeArgs IO RemoteAddress LocalAddress blk p2p → StdRunNodeArgs IO blk p2p → IO ()
- runWith ∷ ∀ m addrNTN addrNTC versionDataNTN versionDataNTC blk p2p. (RunNode blk, IOLike m, Hashable addrNTN, NetworkIO m, NetworkAddr addrNTN) ⇒ RunNodeArgs m addrNTN addrNTC blk p2p → (NodeToNodeVersion → addrNTN → Encoding) → (NodeToNodeVersion → ∀ s. Decoder s addrNTN) → LowLevelRunNodeArgs m addrNTN addrNTC versionDataNTN versionDataNTC blk p2p → m ()
- data StdRunNodeArgs m blk (p2p ∷ P2P) = StdRunNodeArgs {
- srnBfcMaxConcurrencyBulkSync ∷ Maybe Word
- srnBfcMaxConcurrencyDeadline ∷ Maybe Word
- srnChainDbValidateOverride ∷ Bool
- srnDiskPolicyArgs ∷ DiskPolicyArgs
- srnDatabasePath ∷ NodeDatabasePaths
- srnDiffusionArguments ∷ Arguments IO Socket RemoteAddress LocalSocket LocalAddress
- srnDiffusionArgumentsExtra ∷ ExtraArguments p2p m
- srnDiffusionTracers ∷ Tracers RemoteAddress NodeToNodeVersion LocalAddress NodeToClientVersion IO
- srnDiffusionTracersExtra ∷ ExtraTracers p2p
- srnEnableInDevelopmentVersions ∷ Bool
- srnTraceChainDB ∷ Tracer m (TraceEvent blk)
- srnMaybeMempoolCapacityOverride ∷ Maybe MempoolCapacityBytesOverride
- srnChainSyncTimeout ∷ Maybe (m ChainSyncTimeout)
- stdBfcSaltIO ∷ IO Int
- stdGsmAntiThunderingHerdIO ∷ IO StdGen
- stdKeepAliveRngIO ∷ IO StdGen
- stdLowLevelRunNodeArgsIO ∷ ∀ blk p2p. RunNode blk ⇒ RunNodeArgs IO RemoteAddress LocalAddress blk p2p → StdRunNodeArgs IO blk p2p → IO (LowLevelRunNodeArgs IO RemoteAddress LocalAddress NodeToNodeVersionData NodeToClientVersionData blk p2p)
- stdMkChainDbHasFS ∷ FilePath → RelativeMountPoint → SomeHasFS IO
- stdRunDataDiffusion ∷ Tracers RemoteAddress NodeToNodeVersion LocalAddress NodeToClientVersion IO → ExtraTracers p2p → Arguments IO Socket RemoteAddress LocalSocket LocalAddress → ExtraArguments p2p IO → Applications RemoteAddress NodeToNodeVersion NodeToNodeVersionData LocalAddress NodeToClientVersion NodeToClientVersionData IO NodeToNodeInitiatorResult → ExtraApplications p2p RemoteAddress IO NodeToNodeInitiatorResult → IO ()
- stdVersionDataNTC ∷ NetworkMagic → NodeToClientVersionData
- stdVersionDataNTN ∷ NetworkMagic → DiffusionMode → PeerSharing → NodeToNodeVersionData
- stdWithCheckedDB ∷ ∀ blk a. (StandardHash blk, Typeable blk) ⇒ Proxy blk → Tracer IO (TraceEvent blk) → FilePath → NetworkMagic → (LastShutDownWasClean → (ChainDB IO blk → IO a → IO a) → IO a) → IO a
- data NetworkP2PMode (p2p ∷ P2P) where
- newtype RelativeMountPoint = RelativeMountPoint FilePath
- data TraceEvent blk
- = TraceAddBlockEvent (TraceAddBlockEvent blk)
- | TraceFollowerEvent (TraceFollowerEvent blk)
- | TraceCopyToImmutableDBEvent (TraceCopyToImmutableDBEvent blk)
- | TraceGCEvent (TraceGCEvent blk)
- | TraceInitChainSelEvent (TraceInitChainSelEvent blk)
- | TraceOpenEvent (TraceOpenEvent blk)
- | TraceIteratorEvent (TraceIteratorEvent blk)
- | TraceSnapshotEvent (TraceSnapshotEvent blk)
- | TraceLedgerReplayEvent (TraceReplayEvent blk)
- | TraceImmutableDBEvent (TraceEvent blk)
- | TraceVolatileDBEvent (TraceEvent blk)
- | TraceLastShutdownUnclean
- data ChainDbArgs (f ∷ Type → Type) (m ∷ Type → Type) blk = ChainDbArgs {
- cdbImmDbArgs ∷ ImmutableDbArgs f m blk
- cdbVolDbArgs ∷ VolatileDbArgs f m blk
- cdbLgrDbArgs ∷ LgrDbArgs f m blk
- cdbsArgs ∷ ChainDbSpecificArgs f m blk
- data DiskPolicyArgs = DiskPolicyArgs SnapshotInterval NumOfDiskSnapshots
- data HardForkBlockchainTimeArgs (m ∷ Type → Type) blk = HardForkBlockchainTimeArgs {}
- newtype LastShutDownWasClean = LastShutDownWasClean Bool
- data LowLevelRunNodeArgs m addrNTN addrNTC versionDataNTN versionDataNTC blk (p2p ∷ P2P) = LowLevelRunNodeArgs {
- llrnWithCheckedDB ∷ ∀ a. (LastShutDownWasClean → (ChainDB m blk → m a → m a) → m a) → m a
- llrnChainDbArgsDefaults ∷ Incomplete ChainDbArgs m blk
- llrnMkImmutableHasFS ∷ RelativeMountPoint → SomeHasFS m
- llrnMkVolatileHasFS ∷ RelativeMountPoint → SomeHasFS m
- llrnCustomiseChainDbArgs ∷ Complete ChainDbArgs m blk → Complete ChainDbArgs m blk
- llrnCustomiseNodeKernelArgs ∷ NodeKernelArgs m addrNTN (ConnectionId addrNTC) blk → NodeKernelArgs m addrNTN (ConnectionId addrNTC) blk
- llrnBfcSalt ∷ Int
- llrnGsmAntiThunderingHerd ∷ StdGen
- llrnKeepAliveRng ∷ StdGen
- llrnCustomiseHardForkBlockchainTimeArgs ∷ HardForkBlockchainTimeArgs m blk → HardForkBlockchainTimeArgs m blk
- llrnChainSyncTimeout ∷ m ChainSyncTimeout
- llrnGenesisConfig ∷ GenesisConfig
- llrnRunDataDiffusion ∷ Applications addrNTN NodeToNodeVersion versionDataNTN addrNTC NodeToClientVersion versionDataNTC m NodeToNodeInitiatorResult → ExtraApplications p2p addrNTN m NodeToNodeInitiatorResult → m ()
- llrnVersionDataNTC ∷ versionDataNTC
- llrnVersionDataNTN ∷ versionDataNTN
- llrnNodeToNodeVersions ∷ Map NodeToNodeVersion (BlockNodeToNodeVersion blk)
- llrnNodeToClientVersions ∷ Map NodeToClientVersion (BlockNodeToClientVersion blk)
- llrnMaxCaughtUpAge ∷ NominalDiffTime
- llrnMaxClockSkew ∷ ClockSkew
- llrnPublicPeerSelectionStateVar ∷ StrictTVar m (PublicPeerSelectionState addrNTN)
- data MempoolCapacityBytesOverride
- data NodeDatabasePaths
- data NodeKernel m addrNTN addrNTC blk = NodeKernel {
- getChainDB ∷ ChainDB m blk
- getMempool ∷ Mempool m blk
- getTopLevelConfig ∷ TopLevelConfig blk
- getFetchClientRegistry ∷ FetchClientRegistry (ConnectionId addrNTN) (Header blk) blk m
- getFetchMode ∷ STM m FetchMode
- getGsmState ∷ STM m GsmState
- getChainSyncHandles ∷ StrictTVar m (Map (ConnectionId addrNTN) (ChainSyncClientHandle m blk))
- getPeerSharingRegistry ∷ PeerSharingRegistry addrNTN m
- getTracers ∷ Tracers m (ConnectionId addrNTN) addrNTC blk
- setBlockForging ∷ [BlockForging m blk] → m ()
- getPeerSharingAPI ∷ PeerSharingAPI addrNTN StdGen m
- getOutboundConnectionsState ∷ StrictTVar m OutboundConnectionsState
- getDiffusionPipeliningSupport ∷ DiffusionPipeliningSupport
- data NodeKernelArgs m addrNTN addrNTC blk = NodeKernelArgs {
- tracers ∷ Tracers m (ConnectionId addrNTN) addrNTC blk
- registry ∷ ResourceRegistry m
- cfg ∷ TopLevelConfig blk
- btime ∷ BlockchainTime m
- chainDB ∷ ChainDB m blk
- initChainDB ∷ StorageConfig blk → InitChainDB m blk → m ()
- chainSyncFutureCheck ∷ SomeHeaderInFutureCheck m blk
- chainSyncHistoricityCheck ∷ m GsmState → HistoricityCheck m blk
- blockFetchSize ∷ Header blk → SizeInBytes
- mempoolCapacityOverride ∷ MempoolCapacityBytesOverride
- miniProtocolParameters ∷ MiniProtocolParameters
- blockFetchConfiguration ∷ BlockFetchConfiguration
- keepAliveRng ∷ StdGen
- gsmArgs ∷ GsmNodeKernelArgs m blk
- getUseBootstrapPeers ∷ STM m UseBootstrapPeers
- peerSharingRng ∷ StdGen
- publicPeerSelectionStateVar ∷ StrictTVar m (PublicPeerSelectionState addrNTN)
- genesisArgs ∷ GenesisNodeKernelArgs m blk
- getDiffusionPipeliningSupport ∷ DiffusionPipeliningSupport
- data ProtocolInfo b = ProtocolInfo {}
- class (LedgerSupportsProtocol blk, InspectLedger blk, HasHardForkHistory blk, LedgerSupportsMempool blk, HasTxId (GenTx blk), BlockSupportsLedgerQuery blk, SupportedNetworkProtocolVersion blk, ConfigSupportsNode blk, ConvertRawHash blk, CommonProtocolParams blk, HasBinaryBlockInfo blk, SerialiseDiskConstraints blk, SerialiseNodeToNodeConstraints blk, SerialiseNodeToClientConstraints blk, LedgerSupportsPeerSelection blk, NodeInitStorage blk, BlockSupportsMetrics blk, BlockSupportsDiffusionPipelining blk, BlockSupportsSanityCheck blk, Show (CannotForge blk), Show (ForgeStateInfo blk), Show (ForgeStateUpdateError blk), ShowProxy blk, ShowProxy (ApplyTxErr blk), ShowProxy (GenTx blk), ShowProxy (Header blk), ShowProxy (BlockQuery blk), ShowProxy (TxId (GenTx blk))) ⇒ RunNode blk
- data RunNodeArgs m addrNTN addrNTC blk (p2p ∷ P2P) = RunNodeArgs {
- rnTraceConsensus ∷ Tracers m (ConnectionId addrNTN) (ConnectionId addrNTC) blk
- rnTraceNTN ∷ Tracers m (ConnectionId addrNTN) blk DeserialiseFailure
- rnTraceNTC ∷ Tracers m (ConnectionId addrNTC) blk DeserialiseFailure
- rnProtocolInfo ∷ ProtocolInfo blk
- rnNodeKernelHook ∷ ResourceRegistry m → NodeKernel m addrNTN (ConnectionId addrNTC) blk → m ()
- rnEnableP2P ∷ NetworkP2PMode p2p
- rnPeerSharing ∷ PeerSharing
- rnGetUseBootstrapPeers ∷ STM m UseBootstrapPeers
- rnGenesisConfig ∷ GenesisConfig
- type Tracers m remotePeer localPeer blk = Tracers' remotePeer localPeer blk (Tracer m)
- data Tracers' remotePeer localPeer blk f = Tracers {
- chainSyncClientTracer ∷ f (TraceLabelPeer remotePeer (TraceChainSyncClientEvent blk))
- chainSyncServerHeaderTracer ∷ f (TraceLabelPeer remotePeer (TraceChainSyncServerEvent blk))
- chainSyncServerBlockTracer ∷ f (TraceChainSyncServerEvent blk)
- blockFetchDecisionTracer ∷ f [TraceLabelPeer remotePeer (FetchDecision [Point (Header blk)])]
- blockFetchClientTracer ∷ f (TraceLabelPeer remotePeer (TraceFetchClientState (Header blk)))
- blockFetchServerTracer ∷ f (TraceLabelPeer remotePeer (TraceBlockFetchServerEvent blk))
- txInboundTracer ∷ f (TraceLabelPeer remotePeer (TraceTxSubmissionInbound (GenTxId blk) (GenTx blk)))
- txOutboundTracer ∷ f (TraceLabelPeer remotePeer (TraceTxSubmissionOutbound (GenTxId blk) (GenTx blk)))
- localTxSubmissionServerTracer ∷ f (TraceLocalTxSubmissionServerEvent blk)
- mempoolTracer ∷ f (TraceEventMempool blk)
- forgeTracer ∷ f (TraceLabelCreds (TraceForgeEvent blk))
- blockchainTimeTracer ∷ f (TraceBlockchainTimeEvent UTCTime)
- forgeStateInfoTracer ∷ f (TraceLabelCreds (ForgeStateInfo blk))
- keepAliveClientTracer ∷ f (TraceKeepAliveClient remotePeer)
- consensusSanityCheckTracer ∷ f SanityCheckIssue
- consensusErrorTracer ∷ f SomeException
- gsmTracer ∷ f (TraceGsmEvent (Tip blk))
- gddTracer ∷ f (TraceGDDEvent remotePeer blk)
- mkNodeKernelArgs ∷ ∀ m addrNTN addrNTC blk. (RunNode blk, IOLike m) ⇒ ResourceRegistry m → Int → StdGen → StdGen → TopLevelConfig blk → Tracers m (ConnectionId addrNTN) (ConnectionId addrNTC) blk → BlockchainTime m → SomeHeaderInFutureCheck m blk → (m GsmState → HistoricityCheck m blk) → ChainDB m blk → NominalDiffTime → Maybe (WrapDurationUntilTooOld m blk) → MarkerFileView m → STM m UseBootstrapPeers → StrictTVar m (PublicPeerSelectionState addrNTN) → GenesisNodeKernelArgs m blk → DiffusionPipeliningSupport → m (NodeKernelArgs m addrNTN (ConnectionId addrNTC) blk)
- nodeKernelArgsEnforceInvariants ∷ NodeKernelArgs m addrNTN (ConnectionId addrNTC) blk → NodeKernelArgs m addrNTN (ConnectionId addrNTC) blk
- openChainDB ∷ ∀ m blk. (RunNode blk, IOLike m) ⇒ ResourceRegistry m → TopLevelConfig blk → ExtLedgerState blk → (RelativeMountPoint → SomeHasFS m) → (RelativeMountPoint → SomeHasFS m) → Incomplete ChainDbArgs m blk → (Complete ChainDbArgs m blk → Complete ChainDbArgs m blk) → m (ChainDB m blk, Complete ChainDbArgs m blk)
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, Hashable addrNTN, NetworkIO m, NetworkAddr addrNTN) ⇒ RunNodeArgs m addrNTN addrNTC blk p2p → (NodeToNodeVersion → addrNTN → Encoding) → (NodeToNodeVersion → ∀ s. Decoder s addrNTN) → 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
.
stdBfcSaltIO ∷ IO Int Source #
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.
stdMkChainDbHasFS ∷ FilePath → RelativeMountPoint → SomeHasFS IO Source #
How to locate the ChainDB on disk
stdRunDataDiffusion ∷ Tracers RemoteAddress NodeToNodeVersion LocalAddress NodeToClientVersion IO → ExtraTracers p2p → Arguments IO Socket RemoteAddress LocalSocket LocalAddress → ExtraArguments p2p IO → Applications RemoteAddress NodeToNodeVersion NodeToNodeVersionData LocalAddress NodeToClientVersion NodeToClientVersionData IO NodeToNodeInitiatorResult → ExtraApplications p2p RemoteAddress IO NodeToNodeInitiatorResult → IO () Source #
∷ ∀ blk a. (StandardHash blk, Typeable blk) | |
⇒ Proxy blk | |
→ Tracer IO (TraceEvent 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
Show (NetworkP2PMode p2p) Source # | |
Defined in Ouroboros.Consensus.Node showsPrec ∷ Int → NetworkP2PMode p2p → ShowS # show ∷ NetworkP2PMode p2p → String # showList ∷ [NetworkP2PMode p2p] → ShowS # | |
Eq (NetworkP2PMode p2p) Source # | |
Defined in Ouroboros.Consensus.Node (==) ∷ NetworkP2PMode p2p → NetworkP2PMode p2p → Bool # (/=) ∷ NetworkP2PMode p2p → NetworkP2PMode p2p → Bool # |
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
data ChainDbArgs (f ∷ Type → Type) (m ∷ Type → Type) blk Source #
ChainDbArgs | |
|
data HardForkBlockchainTimeArgs (m ∷ Type → Type) blk Source #
HardForkBlockchainTimeArgs | |
|
newtype LastShutDownWasClean Source #
Did the ChainDB already have existing clean-shutdown marker on disk?
Instances
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
.
data MempoolCapacityBytesOverride Source #
An override for the default MempoolCapacityBytes
which is 2x the
maximum transaction capacity
NoMempoolCapacityBytesOverride | Use 2x the maximum transaction capacity of a block. This will change dynamically with the protocol parameters adopted in the current ledger. |
MempoolCapacityBytesOverride !ByteSize32 | Use the least multiple of the block capacity that is no less than this size. |
data NodeDatabasePaths Source #
OnePathForAllDbs FilePath | Databases will be stored under this path, such that given a
path |
MultipleDbPaths | |
|
data NodeKernel m addrNTN addrNTC blk Source #
Interface against running relay node
NodeKernel | |
|
data NodeKernelArgs m addrNTN addrNTC blk Source #
Arguments required when initializing a node
NodeKernelArgs | |
|
data ProtocolInfo b Source #
Data required to run the specified protocol.
ProtocolInfo | |
|
class (LedgerSupportsProtocol blk, InspectLedger blk, HasHardForkHistory blk, LedgerSupportsMempool blk, HasTxId (GenTx blk), BlockSupportsLedgerQuery blk, SupportedNetworkProtocolVersion blk, ConfigSupportsNode blk, ConvertRawHash blk, CommonProtocolParams blk, HasBinaryBlockInfo blk, SerialiseDiskConstraints blk, SerialiseNodeToNodeConstraints blk, SerialiseNodeToClientConstraints blk, LedgerSupportsPeerSelection blk, NodeInitStorage blk, BlockSupportsMetrics blk, BlockSupportsDiffusionPipelining blk, BlockSupportsSanityCheck blk, Show (CannotForge blk), Show (ForgeStateInfo blk), Show (ForgeStateUpdateError blk), ShowProxy blk, ShowProxy (ApplyTxErr blk), ShowProxy (GenTx blk), ShowProxy (Header blk), ShowProxy (BlockQuery blk), ShowProxy (TxId (GenTx blk))) ⇒ RunNode blk Source #
data RunNodeArgs m addrNTN addrNTC blk (p2p ∷ P2P) Source #
Arguments expected from any invocation of runWith
, whether by deployed
code, tests, etc.
RunNodeArgs | |
|
type Tracers m remotePeer localPeer blk = Tracers' remotePeer localPeer blk (Tracer m) Source #
A record of Tracer
s for the node.
data Tracers' remotePeer localPeer blk f Source #
Instances
(∀ a. Semigroup (f a)) ⇒ Semigroup (Tracers' remotePeer localPeer blk f) Source # | |
Defined in Ouroboros.Consensus.Node.Tracers (<>) ∷ Tracers' remotePeer localPeer blk f → Tracers' remotePeer localPeer blk f → Tracers' remotePeer localPeer blk f # sconcat ∷ NonEmpty (Tracers' remotePeer localPeer blk f) → Tracers' remotePeer localPeer blk f # stimes ∷ Integral b ⇒ b → Tracers' remotePeer localPeer blk f → Tracers' remotePeer localPeer blk f # |
Internal helpers
mkNodeKernelArgs ∷ ∀ m addrNTN addrNTC blk. (RunNode blk, IOLike m) ⇒ ResourceRegistry m → Int → StdGen → StdGen → TopLevelConfig blk → Tracers m (ConnectionId addrNTN) (ConnectionId addrNTC) blk → BlockchainTime m → SomeHeaderInFutureCheck m blk → (m GsmState → HistoricityCheck m blk) → ChainDB m blk → NominalDiffTime → Maybe (WrapDurationUntilTooOld m blk) → MarkerFileView m → STM m UseBootstrapPeers → StrictTVar m (PublicPeerSelectionState addrNTN) → GenesisNodeKernelArgs m blk → DiffusionPipeliningSupport → m (NodeKernelArgs m addrNTN (ConnectionId addrNTC) blk) Source #
nodeKernelArgsEnforceInvariants ∷ NodeKernelArgs m addrNTN (ConnectionId addrNTC) blk → NodeKernelArgs m addrNTN (ConnectionId addrNTC) blk Source #
We allow the user running the node to customise the NodeKernelArgs
through $sel:llrnCustomiseNodeKernelArgs:LowLevelRunNodeArgs
, but there are some limits to some
values. This function makes sure we don't exceed those limits and that the
values are consistent.
∷ ∀ m blk. (RunNode blk, IOLike m) | |
⇒ ResourceRegistry m | |
→ TopLevelConfig blk | |
→ ExtLedgerState blk | Initial ledger |
→ (RelativeMountPoint → SomeHasFS m) | Immutable FS, see |
→ (RelativeMountPoint → SomeHasFS m) | Volatile FS, see |
→ Incomplete ChainDbArgs m blk | A set of default arguments (possibly modified from |
→ (Complete ChainDbArgs m blk → Complete ChainDbArgs m blk) | Customise the |
→ m (ChainDB m blk, Complete ChainDbArgs m blk) |