chain

package
v0.3.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2022 License: Apache-2.0, BSD-2-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestProcessingStatusUnknown = RequestProcessingStatus(iota)
	RequestProcessingStatusBacklog
	RequestProcessingStatusCompleted
)
View Source
const (
	PeerMsgTypeMissingRequestIDs = iota
	PeerMsgTypeMissingRequest
	PeerMsgTypeOffLedgerRequest
)
View Source
const (
	// TimerTickPeriod time tick for consensus and state manager objects
	TimerTickPeriod = 100 * time.Millisecond
)

Variables

This section is empty.

Functions

func LogGovernanceTransition added in v0.2.0

func LogGovernanceTransition(blockIndex uint32, outputID string, rootCommitment trie.VCommitment, log *logger.Logger)

LogGovernanceTransition

func LogStateTransition added in v0.2.0

func LogStateTransition(blockIndex uint32, outputID string, rootCommitment trie.VCommitment, reqids []isc.RequestID, log *logger.Logger)

LogStateTransition also used in testing

func PublishGovernanceTransition added in v0.2.0

func PublishGovernanceTransition(stateOutput *isc.AliasOutputWithID)

func PublishRequestsSettled added in v0.2.0

func PublishRequestsSettled(chainID *isc.ChainID, stateIndex uint32, reqids []isc.RequestID)

func PublishStateTransition added in v0.2.0

func PublishStateTransition(chainID *isc.ChainID, stateOutput *isc.AliasOutputWithID, reqIDsLength int)

Types

type AsynchronousCommonSubsetRunner added in v0.2.0

type AsynchronousCommonSubsetRunner interface {
	RunACSConsensus(value []byte, sessionID uint64, stateIndex uint32, callback func(sessionID uint64, acs [][]byte))
	Close()
}

type ChainCore added in v0.2.0

type ChainCore interface {
	ID() *isc.ChainID
	GetCommitteeInfo() *CommitteeInfo
	StateCandidateToStateManager(state.VirtualStateAccess, *iotago.UTXOInput)
	TriggerChainTransition(*ChainTransitionEventData)
	Processors() *processors.Cache
	GlobalStateSync() coreutil.ChainStateSync
	GetStateReader() state.OptimisticStateReader
	GetChainNodes() []peering.PeerStatusProvider     // CommitteeNodes + AccessNodes
	GetCandidateNodes() []*governance.AccessNodeInfo // All the current candidates.
	Log() *logger.Logger
	EnqueueDismissChain(reason string)
	EnqueueAliasOutput(*isc.AliasOutputWithID)
}

type ChainEntry added in v0.2.0

type ChainEntry interface {
	Dismiss(reason string)
	IsDismissed() bool
}

ChainEntry interface to access chain from the chain registry side

type ChainMetrics added in v0.2.3

type ChainMetrics interface {
	GetNodeConnectionMetrics() nodeconnmetrics.NodeConnectionMessagesMetrics
	GetConsensusWorkflowStatus() ConsensusWorkflowStatus
	GetConsensusPipeMetrics() ConsensusPipeMetrics
}

type ChainRequests added in v0.2.0

type ChainRequests interface {
	GetRequestReceipt(id isc.RequestID) (*blocklog.RequestReceipt, error)
	ResolveError(e *isc.UnresolvedVMError) (*isc.VMError, error)
	AttachToRequestProcessed(func(isc.RequestID)) (attachID *events.Closure)
	DetachFromRequestProcessed(attachID *events.Closure)
	EnqueueOffLedgerRequestMsg(msg *messages.OffLedgerRequestMsgIn)
}

ChainRequests is an interface to query status of the request

type ChainRunner added in v0.3.0

type ChainRunner interface {
	GetAnchorOutput() *isc.AliasOutputWithID
	GetTimeData() time.Time
	GetVirtualState() (state.VirtualStateAccess, bool, error)
}

type ChainTransitionEventData added in v0.2.0

type ChainTransitionEventData struct {
	IsGovernance    bool
	VirtualState    state.VirtualStateAccess
	ChainOutput     *isc.AliasOutputWithID
	OutputTimestamp time.Time
}

type Committee added in v0.2.0

type Committee interface {
	Address() iotago.Address
	Size() uint16
	Quorum() uint16
	OwnPeerIndex() uint16
	DKShare() tcrypto.DKShare
	IsAlivePeer(peerIndex uint16) bool
	QuorumIsAlive(quorum ...uint16) bool
	PeerStatus() []*PeerStatus
	IsReady() bool
	Close()
	RunACSConsensus(value []byte, sessionID uint64, stateIndex uint32, callback func(sessionID uint64, acs [][]byte))
	GetRandomValidators(upToN int) []*cryptolib.PublicKey // TODO: Remove after OffLedgerRequest dissemination is changed.
}

Committee is ordered (indexed 0..size-1) list of peers which run the consensus

type CommitteeInfo added in v0.2.0

type CommitteeInfo struct {
	Address       iotago.Address
	Size          uint16
	Quorum        uint16
	QuorumIsAlive bool
	PeerStatus    []*PeerStatus
}

type Consensus added in v0.2.0

type Consensus interface {
	EnqueueStateTransitionMsg(bool, state.VirtualStateAccess, *isc.AliasOutputWithID, time.Time)
	EnqueueDssIndexProposalMsg(msg *messages.DssIndexProposalMsg)
	EnqueueDssSignatureMsg(msg *messages.DssSignatureMsg)
	EnqueueAsynchronousCommonSubsetMsg(msg *messages.AsynchronousCommonSubsetMsg)
	EnqueueVMResultMsg(msg *messages.VMResultMsg)
	EnqueueTimerMsg(messages.TimerTick)
	IsReady() bool
	Close()
	GetStatusSnapshot() *ConsensusInfo
	GetWorkflowStatus() ConsensusWorkflowStatus
	ShouldReceiveMissingRequest(req isc.Request) bool
	GetPipeMetrics() ConsensusPipeMetrics
	SetTimeData(time.Time)
}

type ConsensusInfo added in v0.2.0

type ConsensusInfo struct {
	StateIndex uint32
	Mempool    mempool.MempoolInfo
	TimerTick  int
	TimeData   time.Time
}

type ConsensusPipeMetrics added in v0.2.5

type ConsensusPipeMetrics interface {
	GetEventStateTransitionMsgPipeSize() int
	GetEventPeerLogIndexMsgPipeSize() int
	GetEventACSMsgPipeSize() int
	GetEventVMResultMsgPipeSize() int
	GetEventTimerMsgPipeSize() int
}

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 NodeConnection added in v0.2.0

type NodeConnection interface {
	RegisterChain(
		chainID *isc.ChainID,
		stateOutputHandler,
		outputHandler func(iotago.OutputID, iotago.Output),
		milestoneHandler func(*nodebridge.Milestone),
	)
	UnregisterChain(chainID *isc.ChainID)

	PublishTransaction(chainID *isc.ChainID, tx *iotago.Transaction) error
	PullLatestOutput(chainID *isc.ChainID)
	PullStateOutputByID(chainID *isc.ChainID, id *iotago.UTXOInput)

	AttachMilestones(handler func(*nodebridge.Milestone)) *events.Closure
	DetachMilestones(attachID *events.Closure)

	SetMetrics(metrics nodeconnmetrics.NodeConnectionMetrics)
	GetMetrics() nodeconnmetrics.NodeConnectionMetrics
}

type PeerStatus

type PeerStatus struct {
	Index     int
	PubKey    *cryptolib.PublicKey
	NetID     string
	Connected bool
}

func (*PeerStatus) String

func (p *PeerStatus) String() string

type ReadyListRecord added in v0.2.0

type ReadyListRecord struct {
	Request isc.Calldata
	Seen    map[uint16]bool
}

type RequestProcessingStatus

type RequestProcessingStatus int

type StateManager

type StateManager interface {
	Ready() *ready.Ready
	EnqueueGetBlockMsg(msg *messages.GetBlockMsgIn)
	EnqueueBlockMsg(msg *messages.BlockMsgIn)
	EnqueueAliasOutput(*isc.AliasOutputWithID)
	EnqueueStateCandidateMsg(state.VirtualStateAccess, *iotago.UTXOInput)
	EnqueueTimerMsg(msg messages.TimerTick)
	GetStatusSnapshot() *SyncInfo
	SetChainPeers(peers []*cryptolib.PublicKey)
	Close()
}

type SyncInfo added in v0.2.0

type SyncInfo struct {
	Synced                bool
	SyncedBlockIndex      uint32
	SyncedStateCommitment trie.VCommitment
	SyncedStateTimestamp  time.Time
	StateOutput           *isc.AliasOutputWithID
	StateOutputCommitment trie.VCommitment
	StateOutputTimestamp  time.Time
}

type WAL added in v0.2.4

type WAL interface {
	Write(bytes []byte) error
	Contains(i uint32) bool
	Read(i uint32) ([]byte, error)
}

Directories

Path Synopsis
Provides implementations for chain.ChainCore methods except the Enqueue*, which are provided in eventproc.go
Provides implementations for chain.ChainCore methods except the Enqueue*, which are provided in eventproc.go
commoncoin
Package commoncoin implements a common coin abstraction needed by the HoneyBadgerBFT for synchronization and randomness.
Package commoncoin implements a common coin abstraction needed by the HoneyBadgerBFT for synchronization and randomness.
dss
Run a NonceDKG and sign the supplied hash.
Run a NonceDKG and sign the supplied hash.
node
package node is a front-end to the Distributed Schnorr Signature subsystem.
package node is a front-end to the Distributed Schnorr Signature subsystem.
mempool implements a buffer of requests sent to the ISC chain, essentially a backlog of requests It contains both on-ledger and off-ledger requests.
mempool implements a buffer of requests sent to the ISC chain, essentially a backlog of requests It contains both on-ledger and off-ledger requests.
statemgr package implements object which is responsible for the smart contract ledger state to be synchronized and validated
statemgr package implements object which is responsible for the smart contract ledger state to be synchronized and validated

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL