Documentation
¶
Overview ¶
Package api defines the committee scheduler API.
Index ¶
Constants ¶
const ( // RoleInvalid is an invalid role (should never appear on the wire). RoleInvalid Role = 0 // RoleWorker indicates the node is a worker. RoleWorker Role = 1 // RoleBackupWorker indicates the node is a backup worker. RoleBackupWorker Role = 2 RoleInvalidName = "invalid" RoleWorkerName = "worker" RoleBackupWorkerName = "backup-worker" )
const ( // KindInvalid is an invalid committee. KindInvalid CommitteeKind = 0 // KindComputeExecutor is an executor committee. KindComputeExecutor CommitteeKind = 1 // MaxCommitteeKind is a dummy value used for iterating all committee kinds. MaxCommitteeKind = 2 KindInvalidName = "invalid" KindComputeExecutorName = "executor" )
const ModuleName = "scheduler"
ModuleName is a unique module name for the scheduler module.
Variables ¶
var BaseUnitsPerVotingPower quantity.Quantity
BaseUnitsPerVotingPower is the ratio of base units staked to validator power.
Functions ¶
This section is empty.
Types ¶
type Committee ¶
type Committee struct {
// Kind is the functionality a committee exists to provide.
Kind CommitteeKind `json:"kind"`
// Members is the committee members.
Members []*CommitteeNode `json:"members"`
// RuntimeID is the runtime ID that this committee is for.
RuntimeID common.Namespace `json:"runtime_id"`
// ValidFor is the epoch for which the committee is valid.
ValidFor beacon.EpochTime `json:"valid_for"`
}
Committee is a per-runtime (instance) committee.
type CommitteeKind ¶
type CommitteeKind uint8
CommitteeKind is the functionality a committee exists to provide.
func (CommitteeKind) MarshalText ¶
func (k CommitteeKind) MarshalText() ([]byte, error)
MarshalText encodes a CommitteeKind into text form.
func (CommitteeKind) String ¶
func (k CommitteeKind) String() string
String returns a string representation of a CommitteeKind.
func (*CommitteeKind) UnmarshalText ¶
func (k *CommitteeKind) UnmarshalText(text []byte) error
UnmarshalText decodes a text slice into a CommitteeKind.
type CommitteeNode ¶
type CommitteeNode struct {
// Role is the node's role in a committee.
Role Role `json:"role"`
// PublicKey is the node's public key.
PublicKey signature.PublicKey `json:"public_key"`
}
CommitteeNode is a node participating in a committee.
type ConsensusParameterChanges ¶
type ConsensusParameterChanges struct {
// MinValidators is the new minimum number of validators.
MinValidators *int `json:"min_validators"`
// MaxValidators is the new maximum number of validators.
MaxValidators *int `json:"max_validators"`
}
ConsensusParameterChanges are allowed scheduler consensus parameter changes.
type ConsensusParameters ¶
type ConsensusParameters struct {
// MinValidators is the minimum number of validators that MUST be
// present in elected validator sets.
MinValidators int `json:"min_validators"`
// MaxValidators is the maximum number of validators that MAY be
// present in elected validator sets.
MaxValidators int `json:"max_validators"`
// MaxValidatorsPerEntity is the maximum number of validators that
// may be elected per entity in a single validator set.
MaxValidatorsPerEntity int `json:"max_validators_per_entity"`
// DebugBypassStake is true iff the scheduler should bypass all of
// the staking related checks and operations.
DebugBypassStake bool `json:"debug_bypass_stake,omitempty"`
// RewardFactorEpochElectionAny is the factor for a reward
// distributed per epoch to entities that have any node considered
// in any election.
RewardFactorEpochElectionAny quantity.Quantity `json:"reward_factor_epoch_election_any"`
// DebugForceElect is the map of nodes that will always be elected
// to a given role for a runtime.
DebugForceElect map[common.Namespace]map[signature.PublicKey]*ForceElectCommitteeRole `json:"debug_force_elect,omitempty"`
// DebugAllowWeakAlpha allows VRF based elections based on proofs
// generated by an alpha value considered weak.
DebugAllowWeakAlpha bool `json:"debug_allow_weak_alpha,omitempty"`
}
ConsensusParameters are the scheduler consensus parameters.
type ElectedEvent ¶
type ElectedEvent struct {
// Kinds are the elected committee kinds.
Kinds []CommitteeKind `json:"kinds,omitempty"`
}
ElectedEvent is the elected committee kind event.
type ForceElectCommitteeRole ¶
type ForceElectCommitteeRole struct {
// Kind is the kind of committee to force-elect the node into.
Kind CommitteeKind `json:"kind"`
// Roles are the roles that the given node is force elected as.
Roles []Role `json:"roles"`
// IsScheduler is true iff the node should be set as the scheduler.
IsScheduler bool `json:"is_scheduler,omitempty"`
}
ForceElectCommitteeRole is the committee kind/role that a force-elected node is elected as.
type Genesis ¶
type Genesis struct {
// Parameters are the scheduler consensus parameters.
Parameters ConsensusParameters `json:"params"`
}
Genesis is the committee scheduler genesis state.
type GetCommitteesRequest ¶
type GetCommitteesRequest struct {
Height int64 `json:"height"`
RuntimeID common.Namespace `json:"runtime_id"`
}
GetCommitteesRequest is a GetCommittees request.
type Role ¶
type Role uint8
Role is the role a given node plays in a committee.
func (Role) MarshalText ¶
MarshalText encodes a Role into text form.
func (*Role) UnmarshalText ¶
UnmarshalText decodes a text slice into a Role.