Documentation ¶
Index ¶
Constants ¶
const CodecVersion = 0
Variables ¶
var ( ErrInvalidSubnetID = errors.New("invalid subnet ID") ErrInvalidWeight = errors.New("invalid weight") ErrInvalidNodeID = errors.New("invalid node ID") ErrInvalidOwner = errors.New("invalid owner") )
var Codec codec.Manager
var ErrNonceReservedForRemoval = errors.New("maxUint64 nonce is reserved for removal")
var ErrWrongType = errors.New("wrong payload type")
Functions ¶
func SubnetConversionID ¶
func SubnetConversionID(data SubnetConversionData) (ids.ID, error)
SubnetConversionID creates a subnet conversion ID from the provided subnet conversion data.
Types ¶
type PChainOwner ¶
type PChainOwner struct { // The threshold number of `Addresses` that must provide a signature in // order for the `PChainOwner` to be considered valid. Threshold uint32 `serialize:"true" json:"threshold"` // The addresses that are allowed to sign to authenticate a `PChainOwner`. Addresses []ids.ShortID `serialize:"true" json:"addresses"` }
type Payload ¶
type Payload interface { // Bytes returns the binary representation of this payload. // // If the payload is not initialized, this method will return nil. Bytes() []byte // contains filtered or unexported methods }
Payload provides a common interface for all payloads implemented by this package.
type RegisterSubnetValidator ¶
type RegisterSubnetValidator struct { SubnetID ids.ID `serialize:"true" json:"subnetID"` NodeID types.JSONByteSlice `serialize:"true" json:"nodeID"` BLSPublicKey [bls.PublicKeyLen]byte `serialize:"true" json:"blsPublicKey"` Expiry uint64 `serialize:"true" json:"expiry"` RemainingBalanceOwner PChainOwner `serialize:"true" json:"remainingBalanceOwner"` DisableOwner PChainOwner `serialize:"true" json:"disableOwner"` Weight uint64 `serialize:"true" json:"weight"` // contains filtered or unexported fields }
RegisterSubnetValidator adds a validator to the subnet.
func NewRegisterSubnetValidator ¶
func NewRegisterSubnetValidator( subnetID ids.ID, nodeID ids.NodeID, blsPublicKey [bls.PublicKeyLen]byte, expiry uint64, remainingBalanceOwner PChainOwner, disableOwner PChainOwner, weight uint64, ) (*RegisterSubnetValidator, error)
NewRegisterSubnetValidator creates a new initialized RegisterSubnetValidator.
func ParseRegisterSubnetValidator ¶
func ParseRegisterSubnetValidator(b []byte) (*RegisterSubnetValidator, error)
ParseRegisterSubnetValidator parses bytes into an initialized RegisterSubnetValidator.
func (*RegisterSubnetValidator) ValidationID ¶
func (r *RegisterSubnetValidator) ValidationID() ids.ID
func (*RegisterSubnetValidator) Verify ¶
func (r *RegisterSubnetValidator) Verify() error
type SubnetConversion ¶
type SubnetConversion struct { // ID of the subnet conversion. It is typically generated by calling // SubnetConversionID. ID ids.ID `serialize:"true" json:"id"` // contains filtered or unexported fields }
SubnetConversion reports the summary of the subnet conversation that occurred on the P-chain.
func NewSubnetConversion ¶
func NewSubnetConversion(id ids.ID) (*SubnetConversion, error)
NewSubnetConversion creates a new initialized SubnetConversion.
func ParseSubnetConversion ¶
func ParseSubnetConversion(b []byte) (*SubnetConversion, error)
ParseSubnetConversion parses bytes into an initialized SubnetConversion.
type SubnetConversionData ¶
type SubnetConversionData struct { SubnetID ids.ID `serialize:"true" json:"subnetID"` ManagerChainID ids.ID `serialize:"true" json:"managerChainID"` ManagerAddress types.JSONByteSlice `serialize:"true" json:"managerAddress"` Validators []SubnetConversionValidatorData `serialize:"true" json:"validators"` }
type SubnetConversionValidatorData ¶
type SubnetConversionValidatorData struct { NodeID types.JSONByteSlice `serialize:"true" json:"nodeID"` BLSPublicKey [bls.PublicKeyLen]byte `serialize:"true" json:"blsPublicKey"` Weight uint64 `serialize:"true" json:"weight"` }
type SubnetValidatorRegistration ¶
type SubnetValidatorRegistration struct { ValidationID ids.ID `serialize:"true" json:"validationID"` // Registered being true means that validationID is currently a validator on // the P-chain. // // Registered being false means that validationID is not and can never // become a validator on the P-chain. It is possible that validationID was // previously a validator on the P-chain. Registered bool `serialize:"true" json:"registered"` // contains filtered or unexported fields }
SubnetValidatorRegistration reports if a validator is registered on the P-chain.
func NewSubnetValidatorRegistration ¶
func NewSubnetValidatorRegistration( validationID ids.ID, registered bool, ) (*SubnetValidatorRegistration, error)
NewSubnetValidatorRegistration creates a new initialized SubnetValidatorRegistration.
func ParseSubnetValidatorRegistration ¶
func ParseSubnetValidatorRegistration(b []byte) (*SubnetValidatorRegistration, error)
ParseSubnetValidatorRegistration parses bytes into an initialized SubnetValidatorRegistration.
type SubnetValidatorWeight ¶
type SubnetValidatorWeight struct { ValidationID ids.ID `serialize:"true" json:"validationID"` Nonce uint64 `serialize:"true" json:"nonce"` Weight uint64 `serialize:"true" json:"weight"` // contains filtered or unexported fields }
SubnetValidatorWeight is both received and sent by the P-chain.
If the P-chain is receiving this message, it is treated as a command to update the weight of the validator.
If the P-chain is sending this message, it is reporting the current nonce and weight of the validator.
func NewSubnetValidatorWeight ¶
func NewSubnetValidatorWeight( validationID ids.ID, nonce uint64, weight uint64, ) (*SubnetValidatorWeight, error)
NewSubnetValidatorWeight creates a new initialized SubnetValidatorWeight.
func ParseSubnetValidatorWeight ¶
func ParseSubnetValidatorWeight(b []byte) (*SubnetValidatorWeight, error)
ParseSubnetValidatorWeight parses bytes into an initialized SubnetValidatorWeight.
func (*SubnetValidatorWeight) Verify ¶
func (s *SubnetValidatorWeight) Verify() error