txs

package
v1.12.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: BSD-3-Clause Imports: 29 Imported by: 91

Documentation

Index

Constants

View Source
const (
	MaxNameLen    = 128
	MaxGenesisLen = units.MiB
)
View Source
const CodecVersion = 0
View Source
const MaxSubnetAddressLength = 4096

Variables

View Source
var (
	Codec codec.Manager

	// GenesisCodec allows txs of larger than usual size to be parsed.
	// While this gives flexibility in accommodating large genesis txs
	// it must not be used to parse new, unverified txs which instead
	// must be processed by Codec
	GenesisCodec codec.Manager
)
View Source
var (
	ErrConvertPermissionlessSubnet         = errors.New("cannot convert a permissionless subnet")
	ErrAddressTooLong                      = errors.New("address is too long")
	ErrConvertMustIncludeValidators        = errors.New("conversion must include at least one validator")
	ErrConvertValidatorsNotSortedAndUnique = errors.New("conversion validators must be sorted and unique")
	ErrZeroWeight                          = errors.New("validator weight must be non-zero")
)
View Source
var (
	ErrCantValidatePrimaryNetwork = errors.New("new blockchain can't be validated by primary network")
)
View Source
var (
	ErrNilSignedTx = errors.New("nil signed tx is not valid")
)
View Source
var (
	ErrNilTx = errors.New("tx is nil")
)
View Source
var (
	ErrRemovePrimaryNetworkValidator = errors.New("can't remove primary network validator with RemoveSubnetValidatorTx")
)
View Source
var (
	ErrTransferPermissionlessSubnet = errors.New("cannot transfer ownership of a permissionless subnet")
)
View Source
var (
	ErrWeightTooSmall = errors.New("weight of this validator is too low")
)
View Source
var (
	ErrWrongLocktime = errors.New("wrong locktime reported")
)
View Source
var (
	ErrZeroBalance = errors.New("balance must be greater than 0")
)

Functions

func BoundedBy added in v1.10.4

func BoundedBy(stakerStart, stakerEnd, lowerBound, upperBound time.Time) bool

BoundedBy returns true iff staker start and end are a (non-strict) subset of the provided time bound

func RegisterApricotTypes added in v1.11.11

func RegisterApricotTypes(targetCodec linearcodec.Codec) error

RegisterApricotTypes registers the type information for transactions that were valid during the Apricot series of upgrades.

func RegisterBanffTypes added in v1.11.11

func RegisterBanffTypes(targetCodec linearcodec.Codec) error

RegisterBanffTypes registers the type information for transactions that were valid during the Banff series of upgrades.

func RegisterDurangoTypes added in v1.11.11

func RegisterDurangoTypes(targetCodec linearcodec.Codec) error

RegisterDurangoTypes registers the type information for transactions that were valid during the Durango series of upgrades.

func RegisterEtnaTypes added in v1.11.12

func RegisterEtnaTypes(targetCodec linearcodec.Codec) error

RegisterEtnaTypes registers the type information for transactions that were valid during the Etna series of upgrades.

Types

type AddDelegatorTx

type AddDelegatorTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// Describes the delegatee
	Validator `serialize:"true" json:"validator"`
	// Where to send staked tokens when done validating
	StakeOuts []*avax.TransferableOutput `serialize:"true" json:"stake"`
	// Where to send staking rewards when done validating
	DelegationRewardsOwner fx.Owner `serialize:"true" json:"rewardsOwner"`
}

AddDelegatorTx is an unsigned addDelegatorTx

func (*AddDelegatorTx) CurrentPriority added in v1.8.0

func (*AddDelegatorTx) CurrentPriority() Priority

func (*AddDelegatorTx) InitCtx

func (tx *AddDelegatorTx) InitCtx(ctx *snow.Context)

InitCtx sets the FxID fields in the inputs and outputs of this [UnsignedAddDelegatorTx]. Also sets the [ctx] to the given [vm.ctx] so that the addresses can be json marshalled into human readable format

func (*AddDelegatorTx) NodeID added in v1.8.0

func (tx *AddDelegatorTx) NodeID() ids.NodeID

func (*AddDelegatorTx) PendingPriority added in v1.8.0

func (*AddDelegatorTx) PendingPriority() Priority

func (*AddDelegatorTx) PublicKey added in v1.9.2

func (*AddDelegatorTx) PublicKey() (*bls.PublicKey, bool, error)

func (*AddDelegatorTx) RewardsOwner

func (tx *AddDelegatorTx) RewardsOwner() fx.Owner

func (*AddDelegatorTx) Stake

func (tx *AddDelegatorTx) Stake() []*avax.TransferableOutput

func (*AddDelegatorTx) SubnetID added in v1.8.0

func (*AddDelegatorTx) SubnetID() ids.ID

func (*AddDelegatorTx) SyntacticVerify

func (tx *AddDelegatorTx) SyntacticVerify(ctx *snow.Context) error

SyntacticVerify returns nil iff [tx] is valid

func (*AddDelegatorTx) Visit

func (tx *AddDelegatorTx) Visit(visitor Visitor) error

type AddPermissionlessDelegatorTx added in v1.8.0

type AddPermissionlessDelegatorTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// Describes the validator
	Validator `serialize:"true" json:"validator"`
	// ID of the subnet this validator is validating
	Subnet ids.ID `serialize:"true" json:"subnetID"`
	// Where to send staked tokens when done validating
	StakeOuts []*avax.TransferableOutput `serialize:"true" json:"stake"`
	// Where to send staking rewards when done validating
	DelegationRewardsOwner fx.Owner `serialize:"true" json:"rewardsOwner"`
}

AddPermissionlessDelegatorTx is an unsigned addPermissionlessDelegatorTx

func (*AddPermissionlessDelegatorTx) CurrentPriority added in v1.8.0

func (tx *AddPermissionlessDelegatorTx) CurrentPriority() Priority

func (*AddPermissionlessDelegatorTx) InitCtx added in v1.8.0

func (tx *AddPermissionlessDelegatorTx) InitCtx(ctx *snow.Context)

InitCtx sets the FxID fields in the inputs and outputs of this AddPermissionlessDelegatorTx. Also sets the [ctx] to the given [vm.ctx] so that the addresses can be json marshalled into human readable format

func (*AddPermissionlessDelegatorTx) NodeID added in v1.8.0

func (*AddPermissionlessDelegatorTx) PendingPriority added in v1.8.0

func (tx *AddPermissionlessDelegatorTx) PendingPriority() Priority

func (*AddPermissionlessDelegatorTx) PublicKey added in v1.9.2

func (*AddPermissionlessDelegatorTx) RewardsOwner added in v1.8.0

func (tx *AddPermissionlessDelegatorTx) RewardsOwner() fx.Owner

func (*AddPermissionlessDelegatorTx) Stake added in v1.8.0

func (*AddPermissionlessDelegatorTx) SubnetID added in v1.8.0

func (tx *AddPermissionlessDelegatorTx) SubnetID() ids.ID

func (*AddPermissionlessDelegatorTx) SyntacticVerify added in v1.8.0

func (tx *AddPermissionlessDelegatorTx) SyntacticVerify(ctx *snow.Context) error

SyntacticVerify returns nil iff [tx] is valid

func (*AddPermissionlessDelegatorTx) Visit added in v1.8.0

func (tx *AddPermissionlessDelegatorTx) Visit(visitor Visitor) error

type AddPermissionlessValidatorTx added in v1.8.0

type AddPermissionlessValidatorTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// Describes the validator
	Validator `serialize:"true" json:"validator"`
	// ID of the subnet this validator is validating
	Subnet ids.ID `serialize:"true" json:"subnetID"`
	// If the [Subnet] is the primary network, [Signer] is the BLS key for this
	// validator. If the [Subnet] is not the primary network, this value is the
	// empty signer
	// Note: We do not enforce that the BLS key is unique across all validators.
	//       This means that validators can share a key if they so choose.
	//       However, a NodeID does uniquely map to a BLS key
	Signer signer.Signer `serialize:"true" json:"signer"`
	// Where to send staked tokens when done validating
	StakeOuts []*avax.TransferableOutput `serialize:"true" json:"stake"`
	// Where to send validation rewards when done validating
	ValidatorRewardsOwner fx.Owner `serialize:"true" json:"validationRewardsOwner"`
	// Where to send delegation rewards when done validating
	DelegatorRewardsOwner fx.Owner `serialize:"true" json:"delegationRewardsOwner"`
	// Fee this validator charges delegators as a percentage, times 10,000
	// For example, if this validator has DelegationShares=300,000 then they
	// take 30% of rewards from delegators
	DelegationShares uint32 `serialize:"true" json:"shares"`
}

AddPermissionlessValidatorTx is an unsigned addPermissionlessValidatorTx

func (*AddPermissionlessValidatorTx) CurrentPriority added in v1.8.0

func (tx *AddPermissionlessValidatorTx) CurrentPriority() Priority

func (*AddPermissionlessValidatorTx) DelegationRewardsOwner added in v1.8.0

func (tx *AddPermissionlessValidatorTx) DelegationRewardsOwner() fx.Owner

func (*AddPermissionlessValidatorTx) InitCtx added in v1.8.0

func (tx *AddPermissionlessValidatorTx) InitCtx(ctx *snow.Context)

InitCtx sets the FxID fields in the inputs and outputs of this AddPermissionlessValidatorTx. Also sets the [ctx] to the given [vm.ctx] so that the addresses can be json marshalled into human readable format

func (*AddPermissionlessValidatorTx) NodeID added in v1.8.0

func (*AddPermissionlessValidatorTx) PendingPriority added in v1.8.0

func (tx *AddPermissionlessValidatorTx) PendingPriority() Priority

func (*AddPermissionlessValidatorTx) PublicKey added in v1.9.2

func (tx *AddPermissionlessValidatorTx) PublicKey() (*bls.PublicKey, bool, error)

func (*AddPermissionlessValidatorTx) Shares added in v1.8.0

func (tx *AddPermissionlessValidatorTx) Shares() uint32

func (*AddPermissionlessValidatorTx) Stake added in v1.8.0

func (*AddPermissionlessValidatorTx) SubnetID added in v1.8.0

func (tx *AddPermissionlessValidatorTx) SubnetID() ids.ID

func (*AddPermissionlessValidatorTx) SyntacticVerify added in v1.8.0

func (tx *AddPermissionlessValidatorTx) SyntacticVerify(ctx *snow.Context) error

SyntacticVerify returns nil iff [tx] is valid

func (*AddPermissionlessValidatorTx) ValidationRewardsOwner added in v1.8.0

func (tx *AddPermissionlessValidatorTx) ValidationRewardsOwner() fx.Owner

func (*AddPermissionlessValidatorTx) Visit added in v1.8.0

func (tx *AddPermissionlessValidatorTx) Visit(visitor Visitor) error

type AddSubnetValidatorTx

type AddSubnetValidatorTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// The validator
	SubnetValidator `serialize:"true" json:"validator"`
	// Auth that will be allowing this validator into the network
	SubnetAuth verify.Verifiable `serialize:"true" json:"subnetAuthorization"`
}

AddSubnetValidatorTx is an unsigned addSubnetValidatorTx

func (*AddSubnetValidatorTx) CurrentPriority added in v1.8.0

func (*AddSubnetValidatorTx) CurrentPriority() Priority

func (*AddSubnetValidatorTx) NodeID added in v1.8.0

func (tx *AddSubnetValidatorTx) NodeID() ids.NodeID

func (*AddSubnetValidatorTx) PendingPriority added in v1.8.0

func (*AddSubnetValidatorTx) PendingPriority() Priority

func (*AddSubnetValidatorTx) PublicKey added in v1.9.2

func (*AddSubnetValidatorTx) PublicKey() (*bls.PublicKey, bool, error)

func (*AddSubnetValidatorTx) SyntacticVerify

func (tx *AddSubnetValidatorTx) SyntacticVerify(ctx *snow.Context) error

SyntacticVerify returns nil iff [tx] is valid

func (*AddSubnetValidatorTx) Visit

func (tx *AddSubnetValidatorTx) Visit(visitor Visitor) error

type AddValidatorTx

type AddValidatorTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// Describes the delegatee
	Validator `serialize:"true" json:"validator"`
	// Where to send staked tokens when done validating
	StakeOuts []*avax.TransferableOutput `serialize:"true" json:"stake"`
	// Where to send staking rewards when done validating
	RewardsOwner fx.Owner `serialize:"true" json:"rewardsOwner"`
	// Fee this validator charges delegators as a percentage, times 10,000
	// For example, if this validator has DelegationShares=300,000 then they
	// take 30% of rewards from delegators
	DelegationShares uint32 `serialize:"true" json:"shares"`
}

AddValidatorTx is an unsigned addValidatorTx

func (*AddValidatorTx) CurrentPriority added in v1.8.0

func (*AddValidatorTx) CurrentPriority() Priority

func (*AddValidatorTx) DelegationRewardsOwner added in v1.8.0

func (tx *AddValidatorTx) DelegationRewardsOwner() fx.Owner

func (*AddValidatorTx) InitCtx

func (tx *AddValidatorTx) InitCtx(ctx *snow.Context)

InitCtx sets the FxID fields in the inputs and outputs of this AddValidatorTx. Also sets the [ctx] to the given [vm.ctx] so that the addresses can be json marshalled into human readable format

func (*AddValidatorTx) NodeID added in v1.8.0

func (tx *AddValidatorTx) NodeID() ids.NodeID

func (*AddValidatorTx) PendingPriority added in v1.8.0

func (*AddValidatorTx) PendingPriority() Priority

func (*AddValidatorTx) PublicKey added in v1.9.2

func (*AddValidatorTx) PublicKey() (*bls.PublicKey, bool, error)

func (*AddValidatorTx) Shares

func (tx *AddValidatorTx) Shares() uint32

func (*AddValidatorTx) Stake

func (tx *AddValidatorTx) Stake() []*avax.TransferableOutput

func (*AddValidatorTx) SubnetID added in v1.8.0

func (*AddValidatorTx) SubnetID() ids.ID

func (*AddValidatorTx) SyntacticVerify

func (tx *AddValidatorTx) SyntacticVerify(ctx *snow.Context) error

SyntacticVerify returns nil iff [tx] is valid

func (*AddValidatorTx) ValidationRewardsOwner added in v1.8.0

func (tx *AddValidatorTx) ValidationRewardsOwner() fx.Owner

func (*AddValidatorTx) Visit

func (tx *AddValidatorTx) Visit(visitor Visitor) error

type AdvanceTimeTx

type AdvanceTimeTx struct {
	// Unix time this block proposes increasing the timestamp to
	Time uint64 `serialize:"true" json:"time"`
	// contains filtered or unexported fields
}

AdvanceTimeTx is a transaction to increase the chain's timestamp. When the chain's timestamp is updated (a AdvanceTimeTx is accepted and followed by a commit block) the staker set is also updated accordingly. It must be that: - proposed timestamp > [current chain time] - proposed timestamp <= [time for next staker set change]

func (*AdvanceTimeTx) Bytes

func (tx *AdvanceTimeTx) Bytes() []byte

func (*AdvanceTimeTx) InitCtx

func (*AdvanceTimeTx) InitCtx(*snow.Context)

func (*AdvanceTimeTx) InputIDs

func (*AdvanceTimeTx) InputIDs() set.Set[ids.ID]

func (*AdvanceTimeTx) Outputs

func (*AdvanceTimeTx) Outputs() []*avax.TransferableOutput

func (*AdvanceTimeTx) SetBytes added in v1.9.5

func (tx *AdvanceTimeTx) SetBytes(unsignedBytes []byte)

func (*AdvanceTimeTx) SyntacticVerify

func (*AdvanceTimeTx) SyntacticVerify(*snow.Context) error

func (*AdvanceTimeTx) Timestamp

func (tx *AdvanceTimeTx) Timestamp() time.Time

Timestamp returns the time this block is proposing the chain should be set to

func (*AdvanceTimeTx) Visit

func (tx *AdvanceTimeTx) Visit(visitor Visitor) error

type BaseTx

type BaseTx struct {
	avax.BaseTx `serialize:"true"`

	// true iff this transaction has already passed syntactic verification
	SyntacticallyVerified bool `json:"-"`
	// contains filtered or unexported fields
}

BaseTx contains fields common to many transaction types. It should be embedded in transaction implementations.

func (*BaseTx) Bytes

func (tx *BaseTx) Bytes() []byte

func (*BaseTx) InitCtx

func (tx *BaseTx) InitCtx(ctx *snow.Context)

InitCtx sets the FxID fields in the inputs and outputs of this BaseTx. Also sets the [ctx] to the given [vm.ctx] so that the addresses can be json marshalled into human readable format

func (*BaseTx) InputIDs

func (tx *BaseTx) InputIDs() set.Set[ids.ID]

func (*BaseTx) Outputs

func (tx *BaseTx) Outputs() []*avax.TransferableOutput

func (*BaseTx) SetBytes added in v1.9.5

func (tx *BaseTx) SetBytes(unsignedBytes []byte)

func (*BaseTx) SyntacticVerify

func (tx *BaseTx) SyntacticVerify(ctx *snow.Context) error

SyntacticVerify returns nil iff this tx is well formed

func (*BaseTx) Visit added in v1.10.15

func (tx *BaseTx) Visit(visitor Visitor) error

type ConvertSubnetToL1Tx added in v1.11.13

type ConvertSubnetToL1Tx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// ID of the Subnet to transform
	Subnet ids.ID `serialize:"true" json:"subnetID"`
	// Chain where the Subnet manager lives
	ChainID ids.ID `serialize:"true" json:"chainID"`
	// Address of the Subnet manager
	Address types.JSONByteSlice `serialize:"true" json:"address"`
	// Initial pay-as-you-go validators for the Subnet
	Validators []*ConvertSubnetToL1Validator `serialize:"true" json:"validators"`
	// Authorizes this conversion
	SubnetAuth verify.Verifiable `serialize:"true" json:"subnetAuthorization"`
}

func (*ConvertSubnetToL1Tx) SyntacticVerify added in v1.11.13

func (tx *ConvertSubnetToL1Tx) SyntacticVerify(ctx *snow.Context) error

func (*ConvertSubnetToL1Tx) Visit added in v1.11.13

func (tx *ConvertSubnetToL1Tx) Visit(visitor Visitor) error

type ConvertSubnetToL1Validator added in v1.11.13

type ConvertSubnetToL1Validator struct {
	// NodeID of this validator
	NodeID types.JSONByteSlice `serialize:"true" json:"nodeID"`
	// Weight of this validator used when sampling
	Weight uint64 `serialize:"true" json:"weight"`
	// Initial balance for this validator
	Balance uint64 `serialize:"true" json:"balance"`
	// [Signer] is the BLS key for this validator.
	// Note: We do not enforce that the BLS key is unique across all validators.
	//       This means that validators can share a key if they so choose.
	//       However, a NodeID + Subnet does uniquely map to a BLS key
	Signer signer.ProofOfPossession `serialize:"true" json:"signer"`
	// Leftover $AVAX from the [Balance] will be issued to this owner once it is
	// removed from the validator set.
	RemainingBalanceOwner message.PChainOwner `serialize:"true" json:"remainingBalanceOwner"`
	// This owner has the authority to manually deactivate this validator.
	DeactivationOwner message.PChainOwner `serialize:"true" json:"deactivationOwner"`
}

func (*ConvertSubnetToL1Validator) Compare added in v1.11.13

func (*ConvertSubnetToL1Validator) Verify added in v1.11.13

func (v *ConvertSubnetToL1Validator) Verify() error

type CreateChainTx

type CreateChainTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// ID of the Subnet that validates this blockchain
	SubnetID ids.ID `serialize:"true" json:"subnetID"`
	// A human readable name for the chain; need not be unique
	ChainName string `serialize:"true" json:"chainName"`
	// ID of the VM running on the new chain
	VMID ids.ID `serialize:"true" json:"vmID"`
	// IDs of the feature extensions running on the new chain
	FxIDs []ids.ID `serialize:"true" json:"fxIDs"`
	// Byte representation of genesis state of the new chain
	GenesisData []byte `serialize:"true" json:"genesisData"`
	// Authorizes this blockchain to be added to this subnet
	SubnetAuth verify.Verifiable `serialize:"true" json:"subnetAuthorization"`
}

CreateChainTx is an unsigned createChainTx

func (*CreateChainTx) SyntacticVerify

func (tx *CreateChainTx) SyntacticVerify(ctx *snow.Context) error

func (*CreateChainTx) Visit

func (tx *CreateChainTx) Visit(visitor Visitor) error

type CreateSubnetTx

type CreateSubnetTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// Who is authorized to manage this subnet
	Owner fx.Owner `serialize:"true" json:"owner"`
}

CreateSubnetTx is an unsigned proposal to create a new subnet

func (*CreateSubnetTx) InitCtx

func (tx *CreateSubnetTx) InitCtx(ctx *snow.Context)

InitCtx sets the FxID fields in the inputs and outputs of this CreateSubnetTx. Also sets the [ctx] to the given [vm.ctx] so that the addresses can be json marshalled into human readable format

func (*CreateSubnetTx) SyntacticVerify

func (tx *CreateSubnetTx) SyntacticVerify(ctx *snow.Context) error

SyntacticVerify verifies that this transaction is well-formed

func (*CreateSubnetTx) Visit

func (tx *CreateSubnetTx) Visit(visitor Visitor) error

type DelegatorTx added in v1.8.0

type DelegatorTx interface {
	UnsignedTx
	PermissionlessStaker

	RewardsOwner() fx.Owner
}

type DisableL1ValidatorTx added in v1.11.13

type DisableL1ValidatorTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// ID corresponding to the validator
	ValidationID ids.ID `serialize:"true" json:"validationID"`
	// Authorizes this validator to be disabled
	DisableAuth verify.Verifiable `serialize:"true" json:"disableAuthorization"`
}

func (*DisableL1ValidatorTx) SyntacticVerify added in v1.11.13

func (tx *DisableL1ValidatorTx) SyntacticVerify(ctx *snow.Context) error

func (*DisableL1ValidatorTx) Visit added in v1.11.13

func (tx *DisableL1ValidatorTx) Visit(visitor Visitor) error

type ExportTx

type ExportTx struct {
	BaseTx `serialize:"true"`

	// Which chain to send the funds to
	DestinationChain ids.ID `serialize:"true" json:"destinationChain"`

	// Outputs that are exported to the chain
	ExportedOutputs []*avax.TransferableOutput `serialize:"true" json:"exportedOutputs"`
}

ExportTx is an unsigned exportTx

func (*ExportTx) InitCtx

func (tx *ExportTx) InitCtx(ctx *snow.Context)

InitCtx sets the FxID fields in the inputs and outputs of this [UnsignedExportTx]. Also sets the [ctx] to the given [vm.ctx] so that the addresses can be json marshalled into human readable format

func (*ExportTx) SyntacticVerify

func (tx *ExportTx) SyntacticVerify(ctx *snow.Context) error

SyntacticVerify this transaction is well-formed

func (*ExportTx) Visit

func (tx *ExportTx) Visit(visitor Visitor) error

type ImportTx

type ImportTx struct {
	BaseTx `serialize:"true"`

	// Which chain to consume the funds from
	SourceChain ids.ID `serialize:"true" json:"sourceChain"`

	// Inputs that consume UTXOs produced on the chain
	ImportedInputs []*avax.TransferableInput `serialize:"true" json:"importedInputs"`
}

ImportTx is an unsigned importTx

func (*ImportTx) InitCtx

func (tx *ImportTx) InitCtx(ctx *snow.Context)

InitCtx sets the FxID fields in the inputs and outputs of this ImportTx. Also sets the [ctx] to the given [vm.ctx] so that the addresses can be json marshalled into human readable format

func (*ImportTx) InputIDs

func (tx *ImportTx) InputIDs() set.Set[ids.ID]

func (*ImportTx) InputUTXOs

func (tx *ImportTx) InputUTXOs() set.Set[ids.ID]

InputUTXOs returns the UTXOIDs of the imported funds

func (*ImportTx) SyntacticVerify

func (tx *ImportTx) SyntacticVerify(ctx *snow.Context) error

SyntacticVerify this transaction is well-formed

func (*ImportTx) Visit

func (tx *ImportTx) Visit(visitor Visitor) error

type IncreaseL1ValidatorBalanceTx added in v1.11.13

type IncreaseL1ValidatorBalanceTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// ID corresponding to the validator
	ValidationID ids.ID `serialize:"true" json:"validationID"`
	// Balance <= sum($AVAX inputs) - sum($AVAX outputs) - TxFee
	Balance uint64 `serialize:"true" json:"balance"`
}

func (*IncreaseL1ValidatorBalanceTx) SyntacticVerify added in v1.11.13

func (tx *IncreaseL1ValidatorBalanceTx) SyntacticVerify(ctx *snow.Context) error

func (*IncreaseL1ValidatorBalanceTx) Visit added in v1.11.13

func (tx *IncreaseL1ValidatorBalanceTx) Visit(visitor Visitor) error

type PermissionlessStaker added in v1.8.0

type PermissionlessStaker interface {
	Staker

	Outputs() []*avax.TransferableOutput
	Stake() []*avax.TransferableOutput
}

type Priority added in v1.8.0

type Priority byte
const (
	// First primary network apricot delegators are moved from the pending to
	// the current validator set,
	PrimaryNetworkDelegatorApricotPendingPriority Priority = iota + 1
	// then primary network validators,
	PrimaryNetworkValidatorPendingPriority
	// then primary network banff delegators,
	PrimaryNetworkDelegatorBanffPendingPriority
	// then permissionless subnet validators,
	SubnetPermissionlessValidatorPendingPriority
	// then permissionless subnet delegators.
	SubnetPermissionlessDelegatorPendingPriority
	// then permissioned subnet validators,
	SubnetPermissionedValidatorPendingPriority

	// First permissioned subnet validators are removed from the current
	// validator set,
	// Invariant: All permissioned stakers must be removed first because they
	//            are removed by the advancement of time. Permissionless stakers
	//            are removed with a RewardValidatorTx after time has advanced.
	SubnetPermissionedValidatorCurrentPriority
	// then permissionless subnet delegators,
	SubnetPermissionlessDelegatorCurrentPriority
	// then permissionless subnet validators,
	SubnetPermissionlessValidatorCurrentPriority
	// then primary network delegators,
	PrimaryNetworkDelegatorCurrentPriority
	// then primary network validators.
	PrimaryNetworkValidatorCurrentPriority
)

func (Priority) IsCurrent added in v1.10.1

func (p Priority) IsCurrent() bool

func (Priority) IsCurrentDelegator added in v1.10.1

func (p Priority) IsCurrentDelegator() bool

func (Priority) IsCurrentValidator added in v1.10.1

func (p Priority) IsCurrentValidator() bool

func (Priority) IsDelegator added in v1.10.1

func (p Priority) IsDelegator() bool

func (Priority) IsPending added in v1.10.1

func (p Priority) IsPending() bool

func (Priority) IsPendingDelegator added in v1.10.1

func (p Priority) IsPendingDelegator() bool

func (Priority) IsPendingValidator added in v1.10.1

func (p Priority) IsPendingValidator() bool

func (Priority) IsPermissionedValidator added in v1.10.1

func (p Priority) IsPermissionedValidator() bool

func (Priority) IsValidator added in v1.10.1

func (p Priority) IsValidator() bool

type RegisterL1ValidatorTx added in v1.11.13

type RegisterL1ValidatorTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// Balance <= sum($AVAX inputs) - sum($AVAX outputs) - TxFee.
	Balance uint64 `serialize:"true" json:"balance"`
	// ProofOfPossession of the BLS key that is included in the Message.
	ProofOfPossession [bls.SignatureLen]byte `serialize:"true" json:"proofOfPossession"`
	// Message is expected to be a signed Warp message containing an
	// AddressedCall payload with the RegisterL1Validator message.
	Message types.JSONByteSlice `serialize:"true" json:"message"`
}

func (*RegisterL1ValidatorTx) SyntacticVerify added in v1.11.13

func (tx *RegisterL1ValidatorTx) SyntacticVerify(ctx *snow.Context) error

func (*RegisterL1ValidatorTx) Visit added in v1.11.13

func (tx *RegisterL1ValidatorTx) Visit(visitor Visitor) error

type RemoveSubnetValidatorTx added in v1.8.0

type RemoveSubnetValidatorTx struct {
	BaseTx `serialize:"true"`
	// The node to remove from the subnet.
	NodeID ids.NodeID `serialize:"true" json:"nodeID"`
	// The subnet to remove the node from.
	Subnet ids.ID `serialize:"true" json:"subnetID"`
	// Proves that the issuer has the right to remove the node from the subnet.
	SubnetAuth verify.Verifiable `serialize:"true" json:"subnetAuthorization"`
}

Removes a validator from a subnet.

func (*RemoveSubnetValidatorTx) SyntacticVerify added in v1.8.0

func (tx *RemoveSubnetValidatorTx) SyntacticVerify(ctx *snow.Context) error

func (*RemoveSubnetValidatorTx) Visit added in v1.8.0

func (tx *RemoveSubnetValidatorTx) Visit(visitor Visitor) error

type RewardValidatorTx

type RewardValidatorTx struct {
	// ID of the tx that created the delegator/validator being removed/rewarded
	TxID ids.ID `serialize:"true" json:"txID"`
	// contains filtered or unexported fields
}

RewardValidatorTx is a transaction that represents a proposal to remove a validator that is currently validating from the validator set.

If this transaction is accepted and the next block accepted is a Commit block, the validator is removed and the address that the validator specified receives the staked AVAX as well as a validating reward.

If this transaction is accepted and the next block accepted is an Abort block, the validator is removed and the address that the validator specified receives the staked AVAX but no reward.

func (*RewardValidatorTx) Bytes

func (tx *RewardValidatorTx) Bytes() []byte

func (*RewardValidatorTx) InitCtx

func (*RewardValidatorTx) InitCtx(*snow.Context)

func (*RewardValidatorTx) InputIDs

func (*RewardValidatorTx) InputIDs() set.Set[ids.ID]

func (*RewardValidatorTx) Outputs

func (*RewardValidatorTx) SetBytes added in v1.9.5

func (tx *RewardValidatorTx) SetBytes(unsignedBytes []byte)

func (*RewardValidatorTx) SyntacticVerify

func (*RewardValidatorTx) SyntacticVerify(*snow.Context) error

func (*RewardValidatorTx) Visit

func (tx *RewardValidatorTx) Visit(visitor Visitor) error

type ScheduledStaker added in v1.10.18

type ScheduledStaker interface {
	Staker
	StartTime() time.Time
	PendingPriority() Priority
}

type SetL1ValidatorWeightTx added in v1.11.13

type SetL1ValidatorWeightTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// Message is expected to be a signed Warp message containing an
	// AddressedCall payload with the SetL1ValidatorWeight message.
	Message types.JSONByteSlice `serialize:"true" json:"message"`
}

func (*SetL1ValidatorWeightTx) SyntacticVerify added in v1.11.13

func (tx *SetL1ValidatorWeightTx) SyntacticVerify(ctx *snow.Context) error

func (*SetL1ValidatorWeightTx) Visit added in v1.11.13

func (tx *SetL1ValidatorWeightTx) Visit(visitor Visitor) error

type Staker added in v1.8.0

type Staker interface {
	SubnetID() ids.ID
	NodeID() ids.NodeID
	// PublicKey returns the BLS public key registered by this transaction. If
	// there was no key registered by this transaction, it will return false.
	PublicKey() (*bls.PublicKey, bool, error)
	EndTime() time.Time
	Weight() uint64
	CurrentPriority() Priority
}

type StakerTx

type StakerTx interface {
	UnsignedTx
	Staker
}

type SubnetValidator added in v1.9.10

type SubnetValidator struct {
	Validator `serialize:"true"`

	// ID of the subnet this validator is validating
	Subnet ids.ID `serialize:"true" json:"subnetID"`
}

SubnetValidator validates a subnet on the Avalanche network.

func (*SubnetValidator) SubnetID added in v1.9.10

func (v *SubnetValidator) SubnetID() ids.ID

SubnetID is the ID of the subnet this validator is validating

func (*SubnetValidator) Verify added in v1.9.10

func (v *SubnetValidator) Verify() error

Verify this validator is valid

type TransferSubnetOwnershipTx added in v1.10.14

type TransferSubnetOwnershipTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// ID of the subnet this tx is modifying
	Subnet ids.ID `serialize:"true" json:"subnetID"`
	// Proves that the issuer has the right to remove the node from the subnet.
	SubnetAuth verify.Verifiable `serialize:"true" json:"subnetAuthorization"`
	// Who is now authorized to manage this subnet
	Owner fx.Owner `serialize:"true" json:"newOwner"`
}

func (*TransferSubnetOwnershipTx) InitCtx added in v1.10.14

func (tx *TransferSubnetOwnershipTx) InitCtx(ctx *snow.Context)

InitCtx sets the FxID fields in the inputs and outputs of this TransferSubnetOwnershipTx. Also sets the [ctx] to the given [vm.ctx] so that the addresses can be json marshalled into human readable format

func (*TransferSubnetOwnershipTx) SyntacticVerify added in v1.10.14

func (tx *TransferSubnetOwnershipTx) SyntacticVerify(ctx *snow.Context) error

func (*TransferSubnetOwnershipTx) Visit added in v1.10.14

func (tx *TransferSubnetOwnershipTx) Visit(visitor Visitor) error

type TransformSubnetTx added in v1.8.0

type TransformSubnetTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// ID of the Subnet to transform
	// Restrictions:
	// - Must not be the Primary Network ID
	Subnet ids.ID `serialize:"true" json:"subnetID"`
	// Asset to use when staking on the Subnet
	// Restrictions:
	// - Must not be the Empty ID
	// - Must not be the AVAX ID
	AssetID ids.ID `serialize:"true" json:"assetID"`
	// Amount to initially specify as the current supply
	// Restrictions:
	// - Must be > 0
	InitialSupply uint64 `serialize:"true" json:"initialSupply"`
	// Amount to specify as the maximum token supply
	// Restrictions:
	// - Must be >= [InitialSupply]
	MaximumSupply uint64 `serialize:"true" json:"maximumSupply"`
	// MinConsumptionRate is the rate to allocate funds if the validator's stake
	// duration is 0
	MinConsumptionRate uint64 `serialize:"true" json:"minConsumptionRate"`
	// MaxConsumptionRate is the rate to allocate funds if the validator's stake
	// duration is equal to the minting period
	// Restrictions:
	// - Must be >= [MinConsumptionRate]
	// - Must be <= [reward.PercentDenominator]
	MaxConsumptionRate uint64 `serialize:"true" json:"maxConsumptionRate"`
	// MinValidatorStake is the minimum amount of funds required to become a
	// validator.
	// Restrictions:
	// - Must be > 0
	// - Must be <= [InitialSupply]
	MinValidatorStake uint64 `serialize:"true" json:"minValidatorStake"`
	// MaxValidatorStake is the maximum amount of funds a single validator can
	// be allocated, including delegated funds.
	// Restrictions:
	// - Must be >= [MinValidatorStake]
	// - Must be <= [MaximumSupply]
	MaxValidatorStake uint64 `serialize:"true" json:"maxValidatorStake"`
	// MinStakeDuration is the minimum number of seconds a staker can stake for.
	// Restrictions:
	// - Must be > 0
	MinStakeDuration uint32 `serialize:"true" json:"minStakeDuration"`
	// MaxStakeDuration is the maximum number of seconds a staker can stake for.
	// Restrictions:
	// - Must be >= [MinStakeDuration]
	// - Must be <= [GlobalMaxStakeDuration]
	MaxStakeDuration uint32 `serialize:"true" json:"maxStakeDuration"`
	// MinDelegationFee is the minimum percentage a validator must charge a
	// delegator for delegating.
	// Restrictions:
	// - Must be <= [reward.PercentDenominator]
	MinDelegationFee uint32 `serialize:"true" json:"minDelegationFee"`
	// MinDelegatorStake is the minimum amount of funds required to become a
	// delegator.
	// Restrictions:
	// - Must be > 0
	MinDelegatorStake uint64 `serialize:"true" json:"minDelegatorStake"`
	// MaxValidatorWeightFactor is the factor which calculates the maximum
	// amount of delegation a validator can receive.
	// Note: a value of 1 effectively disables delegation.
	// Restrictions:
	// - Must be > 0
	MaxValidatorWeightFactor byte `serialize:"true" json:"maxValidatorWeightFactor"`
	// UptimeRequirement is the minimum percentage a validator must be online
	// and responsive to receive a reward.
	// Restrictions:
	// - Must be <= [reward.PercentDenominator]
	UptimeRequirement uint32 `serialize:"true" json:"uptimeRequirement"`
	// Authorizes this transformation
	SubnetAuth verify.Verifiable `serialize:"true" json:"subnetAuthorization"`
}

TransformSubnetTx is an unsigned transformSubnetTx

func (*TransformSubnetTx) SyntacticVerify added in v1.8.0

func (tx *TransformSubnetTx) SyntacticVerify(ctx *snow.Context) error

func (*TransformSubnetTx) Visit added in v1.8.0

func (tx *TransformSubnetTx) Visit(visitor Visitor) error

type Tx

type Tx struct {
	// The body of this transaction
	Unsigned UnsignedTx `serialize:"true" json:"unsignedTx"`

	// The credentials of this transaction
	Creds []verify.Verifiable `serialize:"true" json:"credentials"`

	TxID ids.ID `json:"id"`
	// contains filtered or unexported fields
}

Tx is a signed transaction

func NewSigned

func NewSigned(
	unsigned UnsignedTx,
	c codec.Manager,
	signers [][]*secp256k1.PrivateKey,
) (*Tx, error)

func Parse

func Parse(c codec.Manager, signedBytes []byte) (*Tx, error)

Parse signed tx starting from its byte representation. Note: We explicitly pass the codec in Parse since we may need to parse P-Chain genesis txs whose length exceed the max length of txs.Codec.

func (*Tx) Bytes

func (tx *Tx) Bytes() []byte

func (*Tx) GossipID added in v1.10.18

func (tx *Tx) GossipID() ids.ID

func (*Tx) ID

func (tx *Tx) ID() ids.ID

func (*Tx) Initialize

func (tx *Tx) Initialize(c codec.Manager) error

func (*Tx) InputIDs added in v1.11.6

func (tx *Tx) InputIDs() set.Set[ids.ID]

InputIDs returns the set of inputs this transaction consumes

func (*Tx) SetBytes added in v1.9.5

func (tx *Tx) SetBytes(unsignedBytes, signedBytes []byte)

func (*Tx) Sign

func (tx *Tx) Sign(c codec.Manager, signers [][]*secp256k1.PrivateKey) error

Sign this transaction with the provided signers Note: We explicitly pass the codec in Sign since we may need to sign P-Chain genesis txs whose length exceed the max length of txs.Codec.

func (*Tx) Size added in v1.10.2

func (tx *Tx) Size() int

func (*Tx) SyntacticVerify

func (tx *Tx) SyntacticVerify(ctx *snow.Context) error

func (*Tx) UTXOs

func (tx *Tx) UTXOs() []*avax.UTXO

UTXOs returns the UTXOs transaction is producing.

type UnsignedTx

type UnsignedTx interface {
	// TODO: Remove this initialization pattern from both the platformvm and the
	// avm.
	snow.ContextInitializable
	secp256k1fx.UnsignedTx
	SetBytes(unsignedBytes []byte)

	// InputIDs returns the set of inputs this transaction consumes
	InputIDs() set.Set[ids.ID]

	Outputs() []*avax.TransferableOutput

	// Attempts to verify this transaction without any provided state.
	SyntacticVerify(ctx *snow.Context) error

	// Visit calls [visitor] with this transaction's concrete type
	Visit(visitor Visitor) error
}

UnsignedTx is an unsigned transaction

type Validator added in v1.8.0

type Validator struct {
	// Node ID of the validator
	NodeID ids.NodeID `serialize:"true" json:"nodeID"`

	// Unix time this validator starts validating
	Start uint64 `serialize:"true" json:"start"`

	// Unix time this validator stops validating
	End uint64 `serialize:"true" json:"end"`

	// Weight of this validator used when sampling
	Wght uint64 `serialize:"true" json:"weight"`
}

Validator is a validator.

func (*Validator) EndTime added in v1.9.10

func (v *Validator) EndTime() time.Time

EndTime is the time that this validator will leave the validator set

func (*Validator) StartTime added in v1.9.10

func (v *Validator) StartTime() time.Time

StartTime is the time that this validator will enter the validator set

func (*Validator) Verify added in v1.9.10

func (v *Validator) Verify() error

Verify validates the ID for this validator

func (*Validator) Weight added in v1.9.10

func (v *Validator) Weight() uint64

Weight is this validator's weight when sampling

type ValidatorTx added in v1.8.0

type ValidatorTx interface {
	UnsignedTx
	PermissionlessStaker

	ValidationRewardsOwner() fx.Owner
	DelegationRewardsOwner() fx.Owner
	Shares() uint32
}

ValidatorTx defines the interface for a validator transaction that supports delegation.

type Visitor

type Visitor interface {
	// Apricot Transactions:
	AddValidatorTx(*AddValidatorTx) error
	AddSubnetValidatorTx(*AddSubnetValidatorTx) error
	AddDelegatorTx(*AddDelegatorTx) error
	CreateChainTx(*CreateChainTx) error
	CreateSubnetTx(*CreateSubnetTx) error
	ImportTx(*ImportTx) error
	ExportTx(*ExportTx) error
	AdvanceTimeTx(*AdvanceTimeTx) error
	RewardValidatorTx(*RewardValidatorTx) error

	// Banff Transactions:
	RemoveSubnetValidatorTx(*RemoveSubnetValidatorTx) error
	TransformSubnetTx(*TransformSubnetTx) error
	AddPermissionlessValidatorTx(*AddPermissionlessValidatorTx) error
	AddPermissionlessDelegatorTx(*AddPermissionlessDelegatorTx) error

	// Durango Transactions:
	TransferSubnetOwnershipTx(*TransferSubnetOwnershipTx) error
	BaseTx(*BaseTx) error

	// Etna Transactions:
	ConvertSubnetToL1Tx(*ConvertSubnetToL1Tx) error
	RegisterL1ValidatorTx(*RegisterL1ValidatorTx) error
	SetL1ValidatorWeightTx(*SetL1ValidatorWeightTx) error
	IncreaseL1ValidatorBalanceTx(*IncreaseL1ValidatorBalanceTx) error
	DisableL1ValidatorTx(*DisableL1ValidatorTx) error
}

Allow vm to execute custom logic against the underlying transaction types.

Directories

Path Synopsis
TODO: Before Etna, address all TODOs in this package and ensure ACP-103 compliance.
TODO: Before Etna, address all TODOs in this package and ensure ACP-103 compliance.
mempoolmock
Package mempoolmock is a generated GoMock package.
Package mempoolmock is a generated GoMock package.

Jump to

Keyboard shortcuts

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