cons_gr

package
v1.0.2-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

The purpose of this package is to run the consensus protocol as a goroutine and communicate with all the related components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsGr

type ConsGr struct {
	// contains filtered or unexported fields
}

func New

func New(
	ctx context.Context,
	chainID isc.ChainID,
	chainStore state.Store,
	dkShare tcrypto.DKShare,
	logIndex *cmt_log.LogIndex,
	myNodeIdentity *cryptolib.KeyPair,
	procCache *processors.Cache,
	mempool Mempool,
	stateMgr StateMgr,
	net peering.NetworkProvider,
	validatorAgentID isc.AgentID,
	recoveryTimeout time.Duration,
	redeliveryPeriod time.Duration,
	printStatusPeriod time.Duration,
	chainMetrics *metrics.ChainConsensusMetrics,
	pipeMetrics *metrics.ChainPipeMetrics,
	log *logger.Logger,
) *ConsGr

func (*ConsGr) Input

func (cgr *ConsGr) Input(baseAliasOutput *isc.AliasOutputWithID, outputCB func(*Output), recoverCB func())

func (*ConsGr) Time

func (cgr *ConsGr) Time(t time.Time)

type ConsensusID

type ConsensusID [iotago.Ed25519AddressBytesLength + 4]byte

func NewConsensusID

func NewConsensusID(cmtAddr *iotago.Ed25519Address, logIndex *cmt_log.LogIndex) ConsensusID

type Mempool

type Mempool interface {
	ConsensusProposalAsync(ctx context.Context, aliasOutput *isc.AliasOutputWithID, consensusID ConsensusID) <-chan []*isc.RequestRef
	ConsensusRequestsAsync(ctx context.Context, requestRefs []*isc.RequestRef) <-chan []isc.Request
}

type Output

type Output struct {
	Status cons.OutputStatus // Can only be Completed | Skipped.
	Result *cons.Result      // Result of the consensus.
}

func (*Output) String

func (o *Output) String() string

type StateMgr

type StateMgr interface {
	// State manager has to return a signal via the return channel when it
	// ensures all the needed blocks for the specified AliasOutput is present
	// in the database. Context is used to cancel a request.
	ConsensusStateProposal(
		ctx context.Context,
		aliasOutput *isc.AliasOutputWithID,
	) <-chan interface{}
	// State manager has to ensure all the data needed for the specified alias
	// output (presented as aliasOutputID+stateCommitment) is present in the DB.
	ConsensusDecidedState(
		ctx context.Context,
		aliasOutput *isc.AliasOutputWithID,
	) <-chan state.State
	// State manager has to persistently store the block and respond only after
	// the block was flushed to the disk. A WAL can be used for that as well.
	ConsensusProducedBlock(
		ctx context.Context,
		block state.StateDraft,
	) <-chan state.Block
}

State manager has to implement this interface.

type VM

type VM interface {
	ConsensusRunTask(ctx context.Context, task *vm.VMTask) <-chan *vm.VMTaskResult
}

func NewVMAsync

func NewVMAsync(metrics *metrics.ChainConsensusMetrics, log *logger.Logger) VM

Jump to

Keyboard shortcuts

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