committee

package
v0.2202.5 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2023 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TagForCommittee added in v0.2012.0

func TagForCommittee(kind scheduler.CommitteeKind) string

TagForCommittee returns node lookup tag for scheduler committee kind.

Types

type AccessPolicy

type AccessPolicy struct {
	Actions []accessctl.Action
}

AccessPolicy defines a list of actions that are allowed by the policy.

func (AccessPolicy) AddPublicKeyPolicy

func (ap AccessPolicy) AddPublicKeyPolicy(policy *accessctl.Policy, pubKey signature.PublicKey)

AddPublicKeyPolicy augments the given policy by allowing actions in the current AccessPolicy to given TLS public key.

func (AccessPolicy) AddRulesForNodeRoles

func (ap AccessPolicy) AddRulesForNodeRoles(
	policy *accessctl.Policy,
	nodes []*node.Node,
	roles node.RolesMask,
)

AddRulesForNodeRoles augments the given policy by allowing actions in the current AccessPolicy for the nodes that have the given roles mask.

func (AccessPolicy) AddRulesForNodes added in v0.2200.0

func (ap AccessPolicy) AddRulesForNodes(policy *accessctl.Policy, nodes []*node.Node)

AddRulesForNodes augments the given policy by allowing actions in the current AccessPolicy for the specified list of nodes.

type CommitteeInfo

type CommitteeInfo struct {
	Indices    []int
	Roles      []scheduler.Role
	Committee  *scheduler.Committee
	PublicKeys map[signature.PublicKey]bool
	Peers      map[signature.PublicKey]bool
}

CommitteeInfo contains information about a committee of nodes.

func (*CommitteeInfo) HasRole added in v0.2100.0

func (ci *CommitteeInfo) HasRole(role scheduler.Role) bool

HasRole checks whether the node has the given role.

type EpochSnapshot

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

EpochSnapshot is an immutable snapshot of epoch state.

func (*EpochSnapshot) GetEpochHeight added in v0.2200.0

func (e *EpochSnapshot) GetEpochHeight() int64

GetEpochHeight returns the consensus height corresponding to the epoch transition.

func (*EpochSnapshot) GetEpochNumber

func (e *EpochSnapshot) GetEpochNumber() beacon.EpochTime

GetEpochNumber returns the sequential number of the epoch.

func (*EpochSnapshot) GetExecutorCommittee added in v0.2010.0

func (e *EpochSnapshot) GetExecutorCommittee() *CommitteeInfo

GetExecutorCommittee returns the current executor committee.

func (*EpochSnapshot) GetRuntime

func (e *EpochSnapshot) GetRuntime() *registry.Runtime

GetRuntime returns the current runtime descriptor.

func (*EpochSnapshot) IsExecutorBackupWorker

func (e *EpochSnapshot) IsExecutorBackupWorker() bool

IsExecutorBackupWorker checks if the current node is a backup worker of the executor committee in the current epoch.

func (*EpochSnapshot) IsExecutorMember

func (e *EpochSnapshot) IsExecutorMember() bool

IsExecutorMember checks if the current node is a member of the executor committee in the current epoch.

func (*EpochSnapshot) IsExecutorWorker

func (e *EpochSnapshot) IsExecutorWorker() bool

IsExecutorWorker checks if the current node is a worker of the executor committee in the current epoch.

func (*EpochSnapshot) IsTransactionScheduler added in v0.2010.0

func (e *EpochSnapshot) IsTransactionScheduler(round uint64) bool

IsTransactionScheduler checks if the current node is a a transaction scheduler at the specific runtime round.

func (*EpochSnapshot) IsValid added in v0.2200.0

func (e *EpochSnapshot) IsValid() bool

IsValid checks whether the given epoch snapshot is valid (represents an actual epoch).

func (*EpochSnapshot) Node

Node looks up a node descriptor.

Implements commitment.NodeLookup.

func (*EpochSnapshot) Nodes

Nodes returns a node descriptor lookup interface.

func (*EpochSnapshot) VerifyTxnSchedulerSigner added in v0.2100.0

func (e *EpochSnapshot) VerifyTxnSchedulerSigner(id signature.PublicKey, round uint64) error

VerifyTxnSchedulerSigner verifies that the given signature comes from the transaction scheduler at provided round.

type Group

type Group struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Group encapsulates communication with a group of nodes in the runtime committees.

func NewGroup

func NewGroup(
	ctx context.Context,
	identity *identity.Identity,
	runtime runtimeRegistry.Runtime,
	consensus consensus.Backend,
) (*Group, error)

NewGroup creates a new group.

func (*Group) EpochTransition

func (g *Group) EpochTransition(ctx context.Context, height int64) error

EpochTransition processes an epoch transition that just happened.

func (*Group) GetEpochSnapshot

func (g *Group) GetEpochSnapshot() *EpochSnapshot

GetEpochSnapshot returns a snapshot of the currently active epoch.

func (*Group) RoundTransition

func (g *Group) RoundTransition()

RoundTransition processes a round transition that just happened.

func (*Group) Start added in v0.2102.4

func (g *Group) Start() error

Start starts the group services.

func (*Group) Suspend

func (g *Group) Suspend(ctx context.Context)

Suspend processes a runtime suspension that just happened.

Resumption will be processed as a regular epoch transition.

type KeyManagerClientWrapper added in v0.2201.5

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

KeyManagerClientWrapper is a wrapper for the key manager P2P client that handles deferred initialization after the key manager runtime ID is known.

It also handles peer feedback propagation from EnclaveRPC in the runtime.

func NewKeyManagerClientWrapper added in v0.2201.7

func NewKeyManagerClientWrapper(p2p p2p.Service, consensus consensus.Backend, logger *logging.Logger) *KeyManagerClientWrapper

NewKeyManagerClientWrapper creates a new key manager client wrapper.

func (*KeyManagerClientWrapper) CallEnclave added in v0.2201.5

func (km *KeyManagerClientWrapper) CallEnclave(
	ctx context.Context,
	data []byte,
	pf *enclaverpc.PeerFeedback,
) ([]byte, error)

CallEnclave implements runtimeKeymanager.Client.

func (*KeyManagerClientWrapper) Initialized added in v0.2201.5

func (km *KeyManagerClientWrapper) Initialized() <-chan struct{}

Initialized returns a channel that gets closed when the client is initialized.

func (*KeyManagerClientWrapper) SetKeyManagerID added in v0.2201.7

func (km *KeyManagerClientWrapper) SetKeyManagerID(id *common.Namespace)

SetKeyManagerID configures the key manager runtime ID to use.

type Node

type Node struct {
	*runtimeRegistry.RuntimeHostNode

	Runtime runtimeRegistry.Runtime

	HostNode control.ControlledNode

	Identity         *identity.Identity
	KeyManager       keymanager.Backend
	KeyManagerClient *KeyManagerClientWrapper
	Consensus        consensus.Backend
	Group            *Group
	P2P              p2pAPI.Service
	TxPool           txpool.TransactionPool

	// Mutable and shared between nodes' workers.
	// Guarded by .CrossNode.
	CrossNode             sync.Mutex
	CurrentBlock          *block.Block
	CurrentBlockHeight    int64
	CurrentConsensusBlock *consensus.LightBlock
	CurrentDescriptor     *registry.Runtime
	CurrentEpoch          beacon.EpochTime
	Height                int64
	// contains filtered or unexported fields
}

Node is a committee node.

func NewNode

func NewNode(
	hostNode control.ControlledNode,
	runtime runtimeRegistry.Runtime,
	identity *identity.Identity,
	keymanager keymanager.Backend,
	consensus consensus.Backend,
	p2pHost p2pAPI.Service,
	txPoolCfg *txpool.Config,
) (*Node, error)

func (*Node) AddHooks

func (n *Node) AddHooks(hooks NodeHooks)

AddHooks adds a NodeHooks to be called. There is no going back.

func (*Node) Cleanup

func (n *Node) Cleanup()

Cleanup performs the service specific post-termination cleanup.

func (*Node) GetMinRepublishInterval added in v0.2200.0

func (n *Node) GetMinRepublishInterval() time.Duration

GetMinRepublishInterval returns the minimum republish interval that needs to be respected by the caller when publishing the same message. If Publish is called for the same message more quickly, the message may be dropped and not published.

func (*Node) GetRuntime

func (n *Node) GetRuntime() runtimeRegistry.Runtime

GetRuntime implements RuntimeHostHandlerFactory.

func (*Node) GetStatus added in v0.2010.0

func (n *Node) GetStatus(ctx context.Context) (*api.Status, error)

GetStatus returns the common committee node status.

func (*Node) Initialized

func (n *Node) Initialized() <-chan struct{}

Initialized returns a channel that will be closed when the node is initialized and ready to service requests.

func (*Node) Name

func (n *Node) Name() string

Name returns the service name.

func (*Node) NewRuntimeHostHandler

func (n *Node) NewRuntimeHostHandler() protocol.Handler

NewRuntimeHostHandler implements RuntimeHostHandlerFactory.

func (*Node) NewRuntimeHostNotifier added in v0.2103.0

func (n *Node) NewRuntimeHostNotifier(ctx context.Context, host host.Runtime) protocol.Notifier

NewRuntimeHostNotifier implements RuntimeHostHandlerFactory.

func (*Node) PublishTx added in v0.2200.0

func (n *Node) PublishTx(ctx context.Context, tx []byte) error

PublishTx publishes a transaction via P2P gossipsub.

func (*Node) Quit

func (n *Node) Quit() <-chan struct{}

Quit returns a channel that will be closed when the service terminates.

func (*Node) Start

func (n *Node) Start() error

Start starts the service.

func (*Node) Stop

func (n *Node) Stop()

Stop halts the service.

type NodeHooks

type NodeHooks interface {
	// HandlePeerTx handles a transaction received from a (non-local) peer.
	HandlePeerTx(ctx context.Context, tx []byte) error

	// Guarded by CrossNode.
	HandleEpochTransitionLocked(*EpochSnapshot)
	// Guarded by CrossNode.
	HandleNewBlockEarlyLocked(*block.Block)
	// Guarded by CrossNode.
	HandleNewBlockLocked(*block.Block)
	// Guarded by CrossNode.
	HandleNewEventLocked(*roothash.Event)
	// Guarded by CrossNode.
	HandleRuntimeHostEventLocked(*host.Event)

	// Initialized returns a channel that will be closed when the worker is initialized and ready
	// to service requests.
	Initialized() <-chan struct{}
}

NodeHooks defines a worker's duties at common events. These are called from the runtime's common node's worker.

Jump to

Keyboard shortcuts

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