Safe Haskell | None |
---|---|
Language | Haskell2010 |
Node IPC protocols
Synopsis
- connectToLocalNode ∷ LocalNodeConnectInfo mode → LocalNodeClientProtocolsInMode mode → IO ()
- connectToLocalNodeWithVersion ∷ LocalNodeConnectInfo mode → (NodeToClientVersion → LocalNodeClientProtocolsInMode mode) → IO ()
- data LocalNodeConnectInfo mode = LocalNodeConnectInfo {}
- localConsensusMode ∷ LocalNodeConnectInfo mode → ConsensusMode mode
- data LocalNodeClientProtocols block point tip tx txerr query m = LocalNodeClientProtocols {
- localChainSyncClient ∷ LocalChainSyncClient block point tip m
- localTxSubmissionClient ∷ Maybe (LocalTxSubmissionClient tx txerr m ())
- localStateQueryClient ∷ Maybe (LocalStateQueryClient block point query m ())
- data LocalChainSyncClient block point tip m
- = NoLocalChainSyncClient
- | LocalChainSyncClientPipelined (ChainSyncClientPipelined block point tip m ())
- | LocalChainSyncClient (ChainSyncClient block point tip m ())
- type LocalNodeClientProtocolsInMode mode = LocalNodeClientProtocols (BlockInMode mode) ChainPoint ChainTip (TxInMode mode) (TxValidationErrorInMode mode) (QueryInMode mode) IO
- data ColeMode
- data SophieMode
- data BccMode
- data ConsensusModeParams mode where
- newtype EpochSlots = EpochSlots {}
- newtype ChainSyncClient header point tip (m ∷ Type → Type) a = ChainSyncClient {
- runChainSyncClient ∷ m (ClientStIdle header point tip m a)
- newtype ChainSyncClientPipelined header point tip (m ∷ Type → Type) a = ChainSyncClientPipelined {
- runChainSyncClientPipelined ∷ m (ClientPipelinedStIdle 'Z header point tip m a)
- data BlockInMode mode where
- BlockInMode ∷ Block era → EraInMode era mode → BlockInMode mode
- newtype LocalTxSubmissionClient tx reject (m ∷ Type → Type) a = LocalTxSubmissionClient {
- runLocalTxSubmissionClient ∷ m (LocalTxClientStIdle tx reject m a)
- data TxInMode mode where
- data TxValidationErrorInMode mode where
- TxValidationErrorInMode ∷ TxValidationError era → EraInMode era mode → TxValidationErrorInMode mode
- TxValidationEraMismatch ∷ EraMismatch → TxValidationErrorInMode mode
- data TxValidationError era
- submitTxToNodeLocal ∷ ∀ mode. LocalNodeConnectInfo mode → TxInMode mode → IO (SubmitResult (TxValidationErrorInMode mode))
- data SubmitResult reason
- = SubmitSuccess
- | SubmitFail reason
- newtype LocalStateQueryClient block point (query ∷ Type → Type) (m ∷ Type → Type) a = LocalStateQueryClient {
- runLocalStateQueryClient ∷ m (ClientStIdle block point query m a)
- data AcquireFailure
- data QueryInMode mode result where
- QueryCurrentEra ∷ ConsensusModeIsMultiEra mode → QueryInMode mode AnyBccEra
- QueryInEra ∷ EraInMode era mode → QueryInEra era result → QueryInMode mode (Either EraMismatch result)
- QueryEraHistory ∷ ConsensusModeIsMultiEra mode → QueryInMode mode (EraHistory mode)
- QuerySystemStart ∷ QueryInMode mode SystemStart
- data QueryInEra era result where
- QueryColeUpdateState ∷ QueryInEra ColeEra ColeUpdateState
- QueryInSophieBasedEra ∷ SophieBasedEra era → QueryInSophieBasedEra era result → QueryInEra era result
- data QueryInSophieBasedEra era result where
- QueryChainPoint ∷ QueryInSophieBasedEra era ChainPoint
- QueryEpoch ∷ QueryInSophieBasedEra era EpochNo
- QueryGenesisParameters ∷ QueryInSophieBasedEra era GenesisParameters
- QueryProtocolParameters ∷ QueryInSophieBasedEra era ProtocolParameters
- QueryProtocolParametersUpdate ∷ QueryInSophieBasedEra era (Map (Hash GenesisKey) ProtocolParametersUpdate)
- QueryStakeDistribution ∷ QueryInSophieBasedEra era (Map (Hash StakePoolKey) Rational)
- QueryUTxO ∷ QueryUTxOFilter → QueryInSophieBasedEra era (UTxO era)
- QueryStakeAddresses ∷ Set StakeCredential → NetworkId → QueryInSophieBasedEra era (Map StakeAddress Entropic, Map StakeAddress PoolId)
- QueryStakePools ∷ QueryInSophieBasedEra era (Set PoolId)
- QueryStakePoolParameters ∷ Set PoolId → QueryInSophieBasedEra era (Map PoolId StakePoolParameters)
- QueryDebugLedgerState ∷ QueryInSophieBasedEra era (SerialisedDebugLedgerState era)
- QueryProtocolState ∷ QueryInSophieBasedEra era (ProtocolState era)
- queryNodeLocalState ∷ ∀ mode result. LocalNodeConnectInfo mode → Maybe ChainPoint → QueryInMode mode result → IO (Either AcquireFailure result)
- data EraHistory mode where
- EraHistory ∷ ConsensusBlockForMode mode ~ HardForkBlock xs ⇒ ConsensusMode mode → Interpreter xs → EraHistory mode
- getProgress ∷ SlotNo → EraHistory mode → Either PastHorizonException (RelativeTime, SlotLength)
- getLocalChainTip ∷ LocalNodeConnectInfo mode → IO ChainTip
- data ConsensusMode mode where
- consensusModeOnly ∷ ConsensusModeParams mode → ConsensusMode mode
- data NodeToClientVersion
Node interaction
Operations that involve talking to a local Bcc node.
connectToLocalNode ∷ LocalNodeConnectInfo mode → LocalNodeClientProtocolsInMode mode → IO () Source #
Establish a connection to a local node and execute the given set of protocol handlers.
connectToLocalNodeWithVersion ∷ LocalNodeConnectInfo mode → (NodeToClientVersion → LocalNodeClientProtocolsInMode mode) → IO () Source #
Establish a connection to a local node and execute the given set of protocol handlers parameterized on the negotiated node-to-client protocol version.
data LocalNodeConnectInfo mode Source #
localConsensusMode ∷ LocalNodeConnectInfo mode → ConsensusMode mode Source #
data LocalNodeClientProtocols block point tip tx txerr query m Source #
The protocols we can use with a local node. Use in conjunction with
connectToLocalNode
.
These protocols use the types from the rest of this API. The conversion
to/from the types used by the underlying wire formats is handled by
connectToLocalNode
.
LocalNodeClientProtocols | |
|
data LocalChainSyncClient block point tip m Source #
NoLocalChainSyncClient | |
LocalChainSyncClientPipelined (ChainSyncClientPipelined block point tip m ()) | |
LocalChainSyncClient (ChainSyncClient block point tip m ()) |
type LocalNodeClientProtocolsInMode mode = LocalNodeClientProtocols (BlockInMode mode) ChainPoint ChainTip (TxInMode mode) (TxValidationErrorInMode mode) (QueryInMode mode) IO Source #
Modes
TODO move to Bcc.Api
The Cole-only consensus mode consists of only the Cole era.
This was used on the mainnet before the deployment of the multi-era
BccMode
. It is now of little practical use, though it illustrates
how a single-era consensus mode works. It may be sensible to remove this
at some stage.
data SophieMode Source #
The Sophie-only consensus mode consists of only the Sophie era.
This was used for the early Sophie testnets prior to the use of the
multi-era BccMode
. It is useful for setting up Sophie test networks
(e.g. for benchmarking) without having to go through the complication of the
hard fork from Cole to Sophie eras. It also shows how a single-era
consensus mode works. It may be replaced by other single-era modes in future.
data ConsensusModeParams mode where Source #
The consensus-mode-specific parameters needed to connect to a local node that is using each consensus mode.
It is in fact only the Cole era that requires extra parameters, but this is
of course inherited by the BccMode
that uses the Cole era. The reason
this parameter is needed stems from unfortunate design decisions from the
legacy Cole era. The slots per epoch are needed to be able to decode
epoch boundary blocks from the Cole era.
It is possible in future that we may be able to eliminate this parameter by discovering it from the node during the initial handshake.
ColeModeParams ∷ EpochSlots → ConsensusModeParams ColeMode | |
SophieModeParams ∷ ConsensusModeParams SophieMode | |
BccModeParams ∷ EpochSlots → ConsensusModeParams BccMode |
Instances
Show (ConsensusModeParams mode) Source # | |
Defined in Bcc.Api.Modes |
newtype EpochSlots #
Instances
Chain sync protocol
newtype ChainSyncClient header point tip (m ∷ Type → Type) a #
ChainSyncClient | |
|
newtype ChainSyncClientPipelined header point tip (m ∷ Type → Type) a #
ChainSyncClientPipelined | |
|
data BlockInMode mode where Source #
A Block
in one of the eras supported by a given protocol mode.
For multi-era modes such as the BccMode
this type is a sum of the
different block types for all the eras. It is used in the ChainSync protocol.
BlockInMode ∷ Block era → EraInMode era mode → BlockInMode mode |
Instances
Show (BlockInMode mode) Source # | |
Defined in Bcc.Api.Block |
Local tx submission
newtype LocalTxSubmissionClient tx reject (m ∷ Type → Type) a #
LocalTxSubmissionClient | |
|
data TxInMode mode where Source #
A Tx
in one of the eras supported by a given protocol mode.
For multi-era modes such as the BccMode
this type is a sum of the
different transaction types for all the eras. It is used in the
LocalTxSubmission protocol.
TxInMode ∷ Tx era → EraInMode era mode → TxInMode mode | Everything we consider a normal transaction. |
TxInColeSpecial ∷ GenTx ColeBlock → EraInMode ColeEra mode → TxInMode mode | Cole has various things we can post to the chain which are not actually transactions. This covers: update proposals, votes and delegation certs. |
data TxValidationErrorInMode mode where Source #
A TxValidationError
in one of the eras supported by a given protocol
mode.
This is used in the LocalStateQuery protocol.
TxValidationErrorInMode ∷ TxValidationError era → EraInMode era mode → TxValidationErrorInMode mode | |
TxValidationEraMismatch ∷ EraMismatch → TxValidationErrorInMode mode |
Instances
Show (TxValidationErrorInMode mode) Source # | |
Defined in Bcc.Api.TxInMode |
data TxValidationError era Source #
The transaction validations errors that can occur from trying to submit a transaction to a local node. The errors are specific to an era.
Instances
Show (TxValidationError era) Source # | |
Defined in Bcc.Api.TxInMode |
submitTxToNodeLocal ∷ ∀ mode. LocalNodeConnectInfo mode → TxInMode mode → IO (SubmitResult (TxValidationErrorInMode mode)) Source #
data SubmitResult reason #
SubmitSuccess | |
SubmitFail reason |
Instances
Functor SubmitResult | |
Defined in Shardagnostic.Network.Protocol.LocalTxSubmission.Type fmap ∷ (a → b) → SubmitResult a → SubmitResult b Source # (<$) ∷ a → SubmitResult b → SubmitResult a Source # | |
Eq reason ⇒ Eq (SubmitResult reason) | |
Defined in Shardagnostic.Network.Protocol.LocalTxSubmission.Type (==) ∷ SubmitResult reason → SubmitResult reason → Bool Source # (/=) ∷ SubmitResult reason → SubmitResult reason → Bool Source # |
Local state query
newtype LocalStateQueryClient block point (query ∷ Type → Type) (m ∷ Type → Type) a #
LocalStateQueryClient | |
|
data AcquireFailure #
Instances
data QueryInMode mode result where Source #
QueryCurrentEra ∷ ConsensusModeIsMultiEra mode → QueryInMode mode AnyBccEra | |
QueryInEra ∷ EraInMode era mode → QueryInEra era result → QueryInMode mode (Either EraMismatch result) | |
QueryEraHistory ∷ ConsensusModeIsMultiEra mode → QueryInMode mode (EraHistory mode) | |
QuerySystemStart ∷ QueryInMode mode SystemStart |
Instances
Show (QueryInMode mode result) Source # | |
Defined in Bcc.Api.Query |
data QueryInEra era result where Source #
QueryColeUpdateState ∷ QueryInEra ColeEra ColeUpdateState | |
QueryInSophieBasedEra ∷ SophieBasedEra era → QueryInSophieBasedEra era result → QueryInEra era result |
Instances
Show (QueryInEra era result) Source # | |
Defined in Bcc.Api.Query |
data QueryInSophieBasedEra era result where Source #
Instances
Show (QueryInSophieBasedEra era result) Source # | |
Defined in Bcc.Api.Query |
queryNodeLocalState ∷ ∀ mode result. LocalNodeConnectInfo mode → Maybe ChainPoint → QueryInMode mode result → IO (Either AcquireFailure result) Source #
Establish a connection to a node and execute a single query using the local state query protocol.
data EraHistory mode where Source #
EraHistory ∷ ConsensusBlockForMode mode ~ HardForkBlock xs ⇒ ConsensusMode mode → Interpreter xs → EraHistory mode |
getProgress ∷ SlotNo → EraHistory mode → Either PastHorizonException (RelativeTime, SlotLength) Source #
Common queries
getLocalChainTip ∷ LocalNodeConnectInfo mode → IO ChainTip Source #
Helpers
data ConsensusMode mode where Source #
This GADT provides a value-level representation of all the consensus modes. This enables pattern matching on the era to allow them to be treated in a non-uniform way.
ColeMode ∷ ConsensusMode ColeMode | |
SophieMode ∷ ConsensusMode SophieMode | |
BccMode ∷ ConsensusMode BccMode |
Instances
Show (ConsensusMode mode) Source # | |
Defined in Bcc.Api.Modes |
consensusModeOnly ∷ ConsensusModeParams mode → ConsensusMode mode Source #
data NodeToClientVersion #
NodeToClientV_1 | |
NodeToClientV_2 | |
NodeToClientV_3 | |
NodeToClientV_4 | |
NodeToClientV_5 | |
NodeToClientV_6 | |
NodeToClientV_7 | |
NodeToClientV_8 | |
NodeToClientV_9 |