Documentation ¶
Overview ¶
This runs single chain will all the committees, mempool, state mgr etc. The main task for this package to run the protocol as in a threaded environment, communicate between ChainMgr, Mempool, StateMgr, NodeConn and ConsensusInstances.
The following threads (goroutines) are running for a chain:
- ChainMgr (the main synchronizing thread)
- Mempool
- StateMgr
- Consensus (a thread for each instance).
This object interacts with:
- NodeConn.
- Administrative functions.
Index ¶
- type AliasOutputHandler
- type AwaitReceipt
- type Chain
- type ChainCore
- type ChainListener
- type ChainNodeConn
- type ChainRequests
- type CommitteeInfo
- type ConsensusPipeMetrics
- type ConsensusWorkflowStatus
- type MilestoneHandler
- type NodeConnection
- type PeerStatus
- type RequestOutputHandler
- type StateTracker
- type StateTrackerStepCB
- type TxPostHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AliasOutputHandler ¶ added in v1.0.3
type AliasOutputHandler = func(outputInfo *isc.OutputInfo)
The Alias Outputs must be passed here in-order. The last alias output in the list is the unspent one (if there is a chain of outputs confirmed in a milestone).
type AwaitReceipt ¶ added in v1.0.3
type AwaitReceipt interface { Await(query *awaitReceiptReq) ConsiderState(state state.State, blocksAdded []state.Block) // Respond to all queries, that have receipts in the state. StatusString() string }
AwaitReceipt implements await for request receipts.
func NewAwaitReceipt ¶ added in v1.0.3
func NewAwaitReceipt(cleanupEvery int) AwaitReceipt
type Chain ¶
type Chain interface { ChainCore ChainRequests // This is invoked when a node owner updates the chain configuration, // possibly to update the per-node accessNode list. ConfigUpdated(accessNodesPerNode []*cryptolib.PublicKey) // Metrics and the current descriptive state. GetConsensusPipeMetrics() ConsensusPipeMetrics // TODO: Review this. GetNodeConnectionMetrics() nodeconnmetrics.NodeConnectionMetrics GetConsensusWorkflowStatus() ConsensusWorkflowStatus }
func New ¶
func New( ctx context.Context, chainID isc.ChainID, chainStore state.Store, nodeConn NodeConnection, nodeIdentity *cryptolib.KeyPair, processorConfig *processors.Config, dkShareRegistryProvider registry.DKShareRegistryProvider, consensusStateRegistry cmtLog.ConsensusStateRegistry, blockWAL smGPAUtils.BlockWAL, listener ChainListener, accessNodesForNode []*cryptolib.PublicKey, net peering.NetworkProvider, log *logger.Logger, ) (Chain, error)
type ChainCore ¶ added in v0.2.0
type ChainCore interface { ID() isc.ChainID // Returns the current latest confirmed alias output and the active one. // The active AO can be ahead of the confirmed one by several blocks. // Both values can be nil, if the node haven't received an output from // L1 yet (after a restart or a chain activation). LatestAliasOutput() (confirmed, active *isc.AliasOutputWithID) GetCommitteeInfo() *CommitteeInfo // TODO: Review, maybe we can reorganize the CommitteeInfo structure. GetStateReader() state.Store // TODO: Rename to GetStore. Processors() *processors.Cache GetChainNodes() []peering.PeerStatusProvider // CommitteeNodes + AccessNodes GetCandidateNodes() []*governance.AccessNodeInfo // All the current candidates. Log() *logger.Logger }
type ChainListener ¶ added in v1.0.3
type ChainListener interface { mempool.ChainListener }
Implementation of this interface will receive events in the chain. Initial intention was to provide info to the published/WebSocket endpoint. All the function MUST NOT BLOCK.
func NewEmptyChainListener ¶ added in v1.0.3
func NewEmptyChainListener() ChainListener
type ChainNodeConn ¶ added in v1.0.3
type ChainNodeConn interface { // Publishing can be canceled via the context. // The result must be returned via the callback, unless ctx is canceled first. // PublishTX handles promoting and reattachments until the tx is confirmed or the context is canceled. PublishTX( ctx context.Context, chainID isc.ChainID, tx *iotago.Transaction, callback TxPostHandler, ) error // Alias outputs are expected to be returned in order. Considering the Hornet node, the rules are: // - Upon Attach -- existing unspent alias output is returned FIRST. // - Upon receiving a spent/unspent AO from L1 they are returned in // the same order, as the milestones are issued. // - If a single milestone has several alias outputs, they have to be ordered // according to the chain of TXes. // // NOTE: Any out-of-order AO will be considered as a rollback or AO by the chain impl. AttachChain( ctx context.Context, chainID isc.ChainID, recvRequestCB RequestOutputHandler, recvAliasOutput AliasOutputHandler, recvMilestone MilestoneHandler, ) }
type ChainRequests ¶ added in v0.2.0
type CommitteeInfo ¶ added in v0.2.0
type ConsensusPipeMetrics ¶ added in v0.2.5
type ConsensusWorkflowStatus ¶ added in v0.2.4
type ConsensusWorkflowStatus interface { IsStateReceived() bool IsBatchProposalSent() bool IsConsensusBatchKnown() bool IsVMStarted() bool IsVMResultSigned() bool IsTransactionFinalized() bool IsTransactionPosted() bool IsTransactionSeen() bool IsInProgress() bool GetBatchProposalSentTime() time.Time GetConsensusBatchKnownTime() time.Time GetVMStartedTime() time.Time GetVMResultSignedTime() time.Time GetTransactionFinalizedTime() time.Time GetTransactionPostedTime() time.Time GetTransactionSeenTime() time.Time GetCompletedTime() time.Time GetCurrentStateIndex() uint32 }
type MilestoneHandler ¶ added in v1.0.3
type NodeConnection ¶ added in v0.2.0
type NodeConnection interface { ChainNodeConn GetMetrics() nodeconnmetrics.NodeConnectionMetrics Run(ctx context.Context) }
type PeerStatus ¶
type RequestOutputHandler ¶ added in v1.0.3
type RequestOutputHandler = func(outputInfo *isc.OutputInfo)
type StateTracker ¶ added in v1.0.3
type StateTracker interface { // // The main functions provided by this component. TrackAliasOutput(ao *isc.AliasOutputWithID) AwaitRequestReceipt(query *awaitReceiptReq) // // The following 2 functions are only to move the channel receive loop to the main ChainNode thread. ChainNodeAwaitStateMgrCh() <-chan *smInputs.MempoolStateRequestResults ChainNodeStateMgrResponse(*smInputs.MempoolStateRequestResults) }
Tracks a single chain of state transitions. We will have 2 instances of it:
- one for tracking the active state. It is needed for mempool to clear the requests.
- one for the committed state to await for committed request receipts.
func NewStateTracker ¶ added in v1.0.3
func NewStateTracker( ctx context.Context, stateMgr statemanager.StateMgr, haveLatestCB StateTrackerStepCB, ) StateTracker
type StateTrackerStepCB ¶ added in v1.0.3
type TxPostHandler ¶ added in v1.0.3
type TxPostHandler = func(tx *iotago.Transaction, confirmed bool)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
This package implements a protocol for running a chain in a node.
|
This package implements a protocol for running a chain in a node. |
package cmtLog is responsible for producing a log of chain's block decisions for a particular committee.
|
package cmtLog is responsible for producing a log of chain's block decisions for a particular committee. |
Consensus.
|
Consensus. |
gr
The purpose of this package is to run the consensus protocol as a goroutine and communicate with all the related components.
|
The purpose of this package is to run the consensus protocol as a goroutine and communicate with all the related components. |
Run a NonceDKG and sign the supplied hash.
|
Run a NonceDKG and sign the supplied hash. |
A mempool basically does these functions:
|
A mempool basically does these functions: |
smGPA
TODO remove this nolint after the statemgr tests are fixed
|
TODO remove this nolint after the statemgr tests are fixed |