Documentation ¶
Index ¶
Constants ¶
View Source
const ( Initializing = iota StateSyncing Bootstrapping NormalOp )
Variables ¶
View Source
var ErrUnknownState = errors.New("unknown state")
Functions ¶
This section is empty.
Types ¶
type Acceptor ¶
type Acceptor interface { // Accept must be called before [containerID] is committed to the VM as // accepted. // // If the returned error is non-nil, the chain associated with [ctx] should // shut down and not commit [container] or any other container to its // database as accepted. Accept(ctx *ConsensusContext, containerID ids.ID, container []byte) error }
Acceptor is implemented when a struct is monitoring if a message is accepted
type AcceptorGroup ¶
type AcceptorGroup interface { // Calling Accept() calls all of the registered acceptors for the relevant // chain. Acceptor // RegisterAcceptor causes [acceptor] to be called every time an operation // is accepted on chain [chainID]. // If [dieOnError], chain [chainID] stops if Accept returns a non-nil error. RegisterAcceptor(chainID ids.ID, acceptorName string, acceptor Acceptor, dieOnError bool) error // DeregisterAcceptor removes an acceptor from the group. DeregisterAcceptor(chainID ids.ID, acceptorName string) error }
func NewAcceptorGroup ¶
func NewAcceptorGroup(log logging.Logger) AcceptorGroup
type AcceptorTracker ¶
type AcceptorTracker struct {
// contains filtered or unexported fields
}
AcceptorTracker tracks the dispatched accept events by its ID and counts. Useful for testing.
func NewAcceptorTracker ¶
func NewAcceptorTracker() *AcceptorTracker
func (*AcceptorTracker) Accept ¶
func (a *AcceptorTracker) Accept(_ *ConsensusContext, containerID ids.ID, _ []byte) error
func (*AcceptorTracker) IsAccepted ¶
func (a *AcceptorTracker) IsAccepted(containerID ids.ID) (int, bool)
type ConsensusContext ¶
type ConsensusContext struct { *Context // Registers all common and snowman consensus metrics. Unlike the avalanche // consensus engine metrics, we do not prefix the name with the engine name, // as snowman is used for all chains by default. Registerer Registerer // Only used to register Avalanche consensus metrics. Previously, all // metrics were prefixed with "avalanche_{chainID}_". Now we add avalanche // to the prefix, "avalanche_{chainID}_avalanche_", to differentiate // consensus operations after the DAG linearization. AvalancheRegisterer Registerer // BlockAcceptor is the callback that will be fired whenever a VM is // notified that their block was accepted. BlockAcceptor Acceptor // TxAcceptor is the callback that will be fired whenever a VM is notified // that their transaction was accepted. TxAcceptor Acceptor // VertexAcceptor is the callback that will be fired whenever a vertex was // accepted. VertexAcceptor Acceptor // State indicates the current state of this consensus instance. State utils.Atomic[EngineState] // True iff this chain is executing transactions as part of bootstrapping. Executing utils.Atomic[bool] // True iff this chain is currently state-syncing StateSyncing utils.Atomic[bool] }
func DefaultConsensusContextTest ¶
func DefaultConsensusContextTest() *ConsensusContext
type Context ¶
type Context struct { NetworkID uint32 SubnetID ids.ID ChainID ids.ID NodeID ids.NodeID PublicKey *bls.PublicKey XChainID ids.ID CChainID ids.ID VidarAssetID ids.ID Log logging.Logger Lock sync.RWMutex Keystore keystore.BlockchainKeystore BCLookup ids.AliaserReader Metrics metrics.OptionalGatherer WarpSigner warp.Signer // snowman++ attributes ValidatorState validators.State // interface for P-Chain validators // Chain-specific directory where arbitrary data can be written ChainDataDir string }
Context is information about the current execution. [NetworkID] is the ID of the network this context exists within. [ChainID] is the ID of the chain this context exists within. [NodeID] is the ID of this node
func DefaultContextTest ¶
func DefaultContextTest() *Context
type ContextInitializable ¶
type ContextInitializable interface { // InitCtx initializes an object provided a *Context object InitCtx(ctx *Context) }
ContextInitializable represents an object that can be initialized given a *Context object
type EngineState ¶
type EngineState struct { Type p2p.EngineType State State }
type Registerer ¶
type Registerer interface { prometheus.Registerer prometheus.Gatherer }
Expose gatherer interface for unit testing.
Directories ¶
Path | Synopsis |
---|---|
consensus
|
|
snowman
Package snowman is a generated GoMock package.
|
Package snowman is a generated GoMock package. |
engine
|
|
avalanche/state
Package state manages the meta-data required by consensus for an avalanche dag.
|
Package state manages the meta-data required by consensus for an avalanche dag. |
avalanche/vertex
Package vertex is a generated GoMock package.
|
Package vertex is a generated GoMock package. |
common
Package common is a generated GoMock package.
|
Package common is a generated GoMock package. |
snowman/block/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
networking
|
|
handler
Package handler is a generated GoMock package.
|
Package handler is a generated GoMock package. |
router
Package router is a generated GoMock package.
|
Package router is a generated GoMock package. |
sender
Package sender is a generated GoMock package.
|
Package sender is a generated GoMock package. |
timeout
Package timeout is a generated GoMock package.
|
Package timeout is a generated GoMock package. |
tracker
Package tracker is a generated GoMock package.
|
Package tracker is a generated GoMock package. |
Package uptime is a generated GoMock package.
|
Package uptime is a generated GoMock package. |
Package validators is a generated GoMock package.
|
Package validators is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.