Safe Haskell | None |
---|---|
Language | Haskell2010 |
Run the whole Node
Intended for qualified import.
Synopsis
- run :: forall blk p2p. RunNode blk => RunNodeArgs IO RemoteAddress LocalAddress blk p2p -> StdRunNodeArgs IO blk p2p -> IO ()
- runWith :: forall 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 ()
-
data
StdRunNodeArgs
m blk (p2p ::
P2P
) =
StdRunNodeArgs
{
- srnBfcMaxConcurrencyBulkSync :: Maybe Word
- srnBfcMaxConcurrencyDeadline :: Maybe Word
- srnChainDbValidateOverride :: Bool
- srnSnapshotInterval :: SnapshotInterval
- srnDatabasePath :: FilePath
- srnDiffusionArguments :: Arguments 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
- stdBfcSaltIO :: IO Int
- stdChainSyncTimeout :: IO ChainSyncTimeout
- stdKeepAliveRngIO :: IO StdGen
- stdLowLevelRunNodeArgsIO :: forall 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 Socket RemoteAddress LocalSocket LocalAddress -> ExtraArguments p2p IO -> Applications RemoteAddress NodeToNodeVersion NodeToNodeVersionData LocalAddress NodeToClientVersion NodeToClientVersionData IO -> ExtraApplications p2p RemoteAddress IO -> IO ()
- stdVersionDataNTC :: NetworkMagic -> NodeToClientVersionData
- stdVersionDataNTN :: NetworkMagic -> DiffusionMode -> NodeToNodeVersionData
- stdWithCheckedDB :: forall blk a. ( StandardHash blk, Typeable blk) => Proxy 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)
- | TraceLedgerEvent ( TraceEvent blk)
- | TraceLedgerReplayEvent ( TraceReplayEvent blk)
- | TraceImmutableDBEvent ( TraceEvent blk)
- | TraceVolatileDBEvent ( TraceEvent blk)
-
data
ChainDbArgs
f m blk =
ChainDbArgs
{
- cdbHasFSImmutableDB :: SomeHasFS m
- cdbHasFSVolatileDB :: SomeHasFS m
- cdbHasFSLgrDB :: SomeHasFS m
- cdbImmutableDbValidation :: ValidationPolicy
- cdbVolatileDbValidation :: BlockValidationPolicy
- cdbMaxBlocksPerFile :: BlocksPerFile
- cdbDiskPolicy :: DiskPolicy
- cdbTopLevelConfig :: HKD f ( TopLevelConfig blk)
- cdbChunkInfo :: HKD f ChunkInfo
- cdbCheckIntegrity :: HKD f (blk -> Bool )
- cdbGenesis :: HKD f (m ( ExtLedgerState blk))
- cdbCheckInFuture :: HKD f ( CheckInFuture m blk)
- cdbImmutableDbCacheConfig :: CacheConfig
- cdbTracer :: Tracer m ( TraceEvent blk)
- cdbTraceLedger :: Tracer m ( LedgerDB' blk)
- cdbRegistry :: HKD f ( ResourceRegistry m)
- cdbGcDelay :: DiffTime
- cdbGcInterval :: DiffTime
- cdbBlocksToAddSize :: Word
-
data
HardForkBlockchainTimeArgs
m blk =
HardForkBlockchainTimeArgs
{
- hfbtBackoffDelay :: m BackoffDelay
- hfbtGetLedgerState :: STM m ( LedgerState blk)
- hfbtLedgerConfig :: LedgerConfig blk
- hfbtRegistry :: ResourceRegistry m
- hfbtSystemTime :: SystemTime m
- hfbtTracer :: Tracer m ( TraceBlockchainTimeEvent RelativeTime )
- hfbtMaxClockRewind :: NominalDiffTime
- newtype LastShutDownWasClean = LastShutDownWasClean Bool
-
data
LowLevelRunNodeArgs
m addrNTN addrNTC versionDataNTN versionDataNTC blk (p2p ::
P2P
) =
LowLevelRunNodeArgs
{
- llrnWithCheckedDB :: forall a. ( LastShutDownWasClean -> ( ChainDB m blk -> m a -> m a) -> m a) -> m a
- llrnChainDbArgsDefaults :: ChainDbArgs Defaults m blk
- llrnCustomiseChainDbArgs :: ChainDbArgs Identity m blk -> ChainDbArgs Identity m blk
- llrnCustomiseNodeKernelArgs :: NodeKernelArgs m ( ConnectionId addrNTN) ( ConnectionId addrNTC) blk -> NodeKernelArgs m ( ConnectionId addrNTN) ( ConnectionId addrNTC) blk
- llrnBfcSalt :: Int
- llrnKeepAliveRng :: StdGen
- llrnCustomiseHardForkBlockchainTimeArgs :: HardForkBlockchainTimeArgs m blk -> HardForkBlockchainTimeArgs m blk
- llrnChainSyncTimeout :: m ChainSyncTimeout
- llrnRunDataDiffusion :: ResourceRegistry m -> Applications addrNTN NodeToNodeVersion versionDataNTN addrNTC NodeToClientVersion versionDataNTC m -> ExtraApplications p2p addrNTN m -> m ()
- llrnVersionDataNTC :: versionDataNTC
- llrnVersionDataNTN :: versionDataNTN
- llrnNodeToNodeVersions :: Map NodeToNodeVersion ( BlockNodeToNodeVersion blk)
- llrnNodeToClientVersions :: Map NodeToClientVersion ( BlockNodeToClientVersion blk)
- llrnMaxClockSkew :: ClockSkew
- data MempoolCapacityBytesOverride
-
data
NodeKernel
m remotePeer localPeer blk =
NodeKernel
{
- getChainDB :: ChainDB m blk
- getMempool :: Mempool m blk TicketNo
- getTopLevelConfig :: TopLevelConfig blk
- getFetchClientRegistry :: FetchClientRegistry remotePeer ( Header blk) blk m
- getFetchMode :: STM m FetchMode
- getNodeCandidates :: StrictTVar m ( Map remotePeer ( StrictTVar m ( AnchoredFragment ( Header blk))))
- getTracers :: Tracers m remotePeer localPeer blk
-
data
NodeKernelArgs
m remotePeer localPeer blk =
NodeKernelArgs
{
- tracers :: Tracers m remotePeer localPeer blk
- registry :: ResourceRegistry m
- cfg :: TopLevelConfig blk
- btime :: BlockchainTime m
- chainDB :: ChainDB m blk
- initChainDB :: StorageConfig blk -> InitChainDB m blk -> m ()
- blockFetchSize :: Header blk -> SizeInBytes
- blockForging :: [ BlockForging m blk]
- mempoolCapacityOverride :: MempoolCapacityBytesOverride
- miniProtocolParameters :: MiniProtocolParameters
- blockFetchConfiguration :: BlockFetchConfiguration
- keepAliveRng :: StdGen
-
data
ProtocolInfo
m b =
ProtocolInfo
{
- pInfoConfig :: TopLevelConfig b
- pInfoInitLedger :: ExtLedgerState b
- pInfoBlockForging :: m [ BlockForging m b]
- class ( LedgerSupportsProtocol blk, InspectLedger blk, HasHardForkHistory blk, LedgerSupportsMempool blk, HasTxId ( GenTx blk), QueryLedger blk, SupportedNetworkProtocolVersion blk, ConfigSupportsNode blk, ConvertRawHash blk, CommonProtocolParams blk, HasBinaryBlockInfo blk, SerialiseDiskConstraints blk, SerialiseNodeToNodeConstraints blk, SerialiseNodeToClientConstraints blk, LedgerSupportsPeerSelection blk, NodeInitStorage blk, BlockSupportsMetrics 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 m blk
- rnNodeKernelHook :: ResourceRegistry m -> NodeKernel m ( ConnectionId addrNTN) ( ConnectionId addrNTC) blk -> m ()
- rnEnableP2P :: NetworkP2PMode p2p
- 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 ( TraceChainSyncServerEvent blk)
- chainSyncServerBlockTracer :: f ( TraceChainSyncServerEvent blk)
- blockFetchDecisionTracer :: f [ TraceLabelPeer remotePeer ( FetchDecision [ Point ( Header blk)])]
- blockFetchClientTracer :: f ( TraceLabelPeer remotePeer ( TraceFetchClientState ( Header blk)))
- blockFetchServerTracer :: f ( 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)
- mkChainDbArgs :: forall m blk. ( RunNode blk, IOLike m) => ResourceRegistry m -> CheckInFuture m blk -> TopLevelConfig blk -> ExtLedgerState blk -> ChunkInfo -> ChainDbArgs Defaults m blk -> ChainDbArgs Identity m blk
- mkNodeKernelArgs :: forall 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)
- nodeKernelArgsEnforceInvariants :: NodeKernelArgs m ( ConnectionId addrNTN) ( ConnectionId addrNTC) blk -> NodeKernelArgs m ( ConnectionId addrNTN) ( ConnectionId addrNTC) blk
- openChainDB :: forall m blk. ( RunNode blk, IOLike m) => ResourceRegistry m -> CheckInFuture m blk -> TopLevelConfig blk -> ExtLedgerState blk -> ChainDbArgs Defaults m blk -> ( ChainDbArgs Identity m blk -> ChainDbArgs Identity m blk) -> m ( ChainDB m blk)
Documentation
run :: forall blk p2p. RunNode blk => RunNodeArgs IO RemoteAddress LocalAddress blk p2p -> StdRunNodeArgs IO blk p2p -> IO () Source #
Combination of
runWith
and
stdLowLevelRunArgsIO
runWith :: forall 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
.
StdRunNodeArgs | |
|
stdBfcSaltIO :: IO Int Source #
stdLowLevelRunNodeArgsIO :: forall 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 Socket RemoteAddress LocalSocket LocalAddress -> ExtraArguments p2p IO -> Applications RemoteAddress NodeToNodeVersion NodeToNodeVersionData LocalAddress NodeToClientVersion NodeToClientVersionData IO -> ExtraApplications p2p RemoteAddress IO -> IO () Source #
:: forall 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
Eq ( NetworkP2PMode p2p) Source # | |
Defined in Ouroboros.Consensus.Node (==) :: NetworkP2PMode p2p -> NetworkP2PMode p2p -> Bool Source # (/=) :: NetworkP2PMode p2p -> NetworkP2PMode p2p -> Bool Source # |
|
Show ( NetworkP2PMode p2p) Source # | |
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.
TraceAddBlockEvent ( TraceAddBlockEvent blk) | |
TraceFollowerEvent ( TraceFollowerEvent blk) | |
TraceCopyToImmutableDBEvent ( TraceCopyToImmutableDBEvent blk) | |
TraceGCEvent ( TraceGCEvent blk) | |
TraceInitChainSelEvent ( TraceInitChainSelEvent blk) | |
TraceOpenEvent ( TraceOpenEvent blk) | |
TraceIteratorEvent ( TraceIteratorEvent blk) | |
TraceLedgerEvent ( TraceEvent blk) | |
TraceLedgerReplayEvent ( TraceReplayEvent blk) | |
TraceImmutableDBEvent ( TraceEvent blk) | |
TraceVolatileDBEvent ( TraceEvent blk) |
Instances
data ChainDbArgs f m blk Source #
ChainDbArgs | |
|
data HardForkBlockchainTimeArgs m blk Source #
HardForkBlockchainTimeArgs | |
|
newtype LastShutDownWasClean Source #
Did the ChainDB already have existing clean-shutdown marker on disk?
Instances
Eq LastShutDownWasClean Source # | |
Defined in Ouroboros.Consensus.Node.Recovery (==) :: LastShutDownWasClean -> LastShutDownWasClean -> Bool Source # (/=) :: LastShutDownWasClean -> LastShutDownWasClean -> Bool Source # |
|
Show LastShutDownWasClean Source # | |
Defined in Ouroboros.Consensus.Node.Recovery |
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
.
LowLevelRunNodeArgs | |
|
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 ! MempoolCapacityBytes |
Use the following
|
Instances
data NodeKernel m remotePeer localPeer blk Source #
Interface against running relay node
NodeKernel | |
|
data NodeKernelArgs m remotePeer localPeer blk Source #
Arguments required when initializing a node
NodeKernelArgs | |
|
data ProtocolInfo m b Source #
Data required to run the specified protocol.
ProtocolInfo | |
|
Instances
Functor m => Isomorphic ( ProtocolInfo m) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Embed.Unary project :: NoHardForks blk => ProtocolInfo m ( HardForkBlock '[blk]) -> ProtocolInfo m blk Source # inject :: NoHardForks blk => ProtocolInfo m blk -> ProtocolInfo m ( HardForkBlock '[blk]) Source # |
class ( LedgerSupportsProtocol blk, InspectLedger blk, HasHardForkHistory blk, LedgerSupportsMempool blk, HasTxId ( GenTx blk), QueryLedger blk, SupportedNetworkProtocolVersion blk, ConfigSupportsNode blk, ConvertRawHash blk, CommonProtocolParams blk, HasBinaryBlockInfo blk, SerialiseDiskConstraints blk, SerialiseNodeToNodeConstraints blk, SerialiseNodeToClientConstraints blk, LedgerSupportsPeerSelection blk, NodeInitStorage blk, BlockSupportsMetrics 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 #
Instances
( CanHardFork xs, SupportedNetworkProtocolVersion ( HardForkBlock xs), SerialiseHFC xs) => RunNode ( HardForkBlock xs) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Node |
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
( forall 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 Source # sconcat :: NonEmpty ( Tracers' remotePeer localPeer blk f) -> Tracers' remotePeer localPeer blk f Source # stimes :: Integral b => b -> Tracers' remotePeer localPeer blk f -> Tracers' remotePeer localPeer blk f Source # |
Internal helpers
:: forall 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 :: forall 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 #
nodeKernelArgsEnforceInvariants :: NodeKernelArgs 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.
:: forall 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
|
-> m ( ChainDB m blk) |