txs

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: BSD-3-Clause Imports: 34 Imported by: 6

Documentation

Overview

Package txs is a generated GoMock package.

Index

Constants

View Source
const (
	// CodecVersionV0 is the v1.23.x ("Apricot/Banff") wire layout. It is
	// retained as a READ-ONLY decoder so that pre-codec-v1 blocks and txs
	// on disk (mainnet, testnet) continue to deserialize. All write paths
	// MUST use CodecVersionV1.
	CodecVersionV0 uint16 = 0

	// CodecVersionV1 is the current canonical wire layout used for every
	// new tx and every new block. It is the only version produced by the
	// build/sign paths.
	CodecVersionV1 uint16 = 1

	// CodecVersion is the canonical write version. All Marshal call sites
	// in this package use CodecVersion so that any future bump of the
	// write target updates exactly one symbol.
	CodecVersion = CodecVersionV1

	// Version is retained as a deprecated alias for code that referenced
	// the pre-multi-version constant.
	Version = CodecVersion
)
View Source
const (
	MaxNameLen    = 128
	MaxGenesisLen = constants.MiB
)
View Source
const (
	NetPermissionlessValidatorPendingPriority = ChainPermissionlessValidatorPendingPriority
	NetPermissionlessDelegatorPendingPriority = ChainPermissionlessDelegatorPendingPriority
	NetPermissionedValidatorPendingPriority   = ChainPermissionedValidatorPendingPriority
	NetPermissionedValidatorCurrentPriority   = ChainPermissionedValidatorCurrentPriority
	NetPermissionlessDelegatorCurrentPriority = ChainPermissionlessDelegatorCurrentPriority
	NetPermissionlessValidatorCurrentPriority = ChainPermissionlessValidatorCurrentPriority
)

Deprecated: Use Chain* priority constants instead

View Source
const MaxChainAddressLength = 4096
View Source
const (
	// MaxSovereignL1Chains caps the per-tx chain count to keep tx size
	// bounded. Most L1s ship 1–5 chains at genesis (EVM/DEX/FHE/etc.).
	MaxSovereignL1Chains = 16
)

Variables

View Source
var (
	// Codec is the standard-size multi-version codec used for normal txs.
	Codec codec.Manager

	// GenesisCodec allows txs of larger than usual size to be parsed.
	// It registers the same versioned slot layouts as Codec but with an
	// unbounded maximum size. New, unverified txs MUST be processed by
	// Codec; GenesisCodec is reserved for genesis decode + state read
	// fallback paths.
	GenesisCodec codec.Manager
)
View Source
var (
	ErrConvertPermissionlessChain          = errors.New("cannot convert a permissionless chain")
	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 (
	ErrNilCreateAssetTx       = errors.New("create asset tx is nil")
	ErrNameTooShort           = fmt.Errorf("asset name is too short, minimum size is %d", minNameLen)
	ErrNameTooLong            = fmt.Errorf("asset name is too long, maximum size is %d", maxNameLen)
	ErrSymbolTooShort         = fmt.Errorf("asset symbol is too short, minimum size is %d", minSymbolLen)
	ErrSymbolTooLong          = fmt.Errorf("asset symbol is too long, maximum size is %d", maxSymbolLen)
	ErrNoInitialStates        = errors.New("asset must declare at least one initial state output")
	ErrIllegalNameChar        = errors.New("asset name must be made up of only letters, numbers and spaces")
	ErrIllegalSymbolChar      = errors.New("asset symbol must be all upper-case letters")
	ErrUnexpectedWhitespace   = errors.New("unexpected whitespace in asset name")
	ErrDenominationTooLarge   = errors.New("denomination is too large")
	ErrInitialStatesNotSorted = errors.New("initial states are not sorted and unique")
)
View Source
var (
	ErrSovereignMustIncludeValidators = errors.New("sovereign L1 must include at least one validator")
	ErrSovereignMustIncludeChains     = errors.New("sovereign L1 must include at least one chain")
	ErrSovereignTooManyChains         = errors.New("sovereign L1 exceeds MaxSovereignL1Chains")
	ErrSovereignManagerIdxOutOfRange  = errors.New("managerChainIdx is out of range for chains[]")
	ErrSovereignChainNameTooLong      = errors.New("sovereign L1 chain name exceeds MaxNameLen")
	ErrSovereignChainNameIllegal      = errors.New("sovereign L1 chain name contains illegal characters")
	ErrSovereignVMIDEmpty             = errors.New("sovereign L1 chain VMID must not be empty")
	ErrSovereignFxIDsNotSorted        = errors.New("sovereign L1 chain FxIDs must be sorted and unique")
	ErrSovereignGenesisTooLong        = errors.New("sovereign L1 chain genesis exceeds MaxGenesisLen")
)
View Source
var (
	ErrNilInitialState     = errors.New("nil initial state is not valid")
	ErrNilInitialStateOut  = errors.New("nil initial state output is not valid")
	ErrInitialStateNonZero = errors.New("initial state fx index must be zero on P-Chain (single secp256k1fx)")
	ErrInitialStateOutsBad = errors.New("initial state outputs are not sorted")
)
View Source
var (
	ErrNilOperation              = errors.New("nil operation is not valid")
	ErrNilFxOperation            = errors.New("nil fx operation is not valid")
	ErrNotSortedAndUniqueUTXOIDs = errors.New("utxo ids on operation are not sorted and unique")
	// ErrUnsupportedOpType pins [Op] to the single Fx PlatformVM ships
	// (secp256k1fx). Anything else — propertyfx, nftfx, a future Fx an
	// attacker tries to slip in — is rejected at syntactic verification
	// time before any state-modifying executor sees it.
	ErrUnsupportedOpType = errors.New("operation op type is not supported on PlatformVM (secp256k1fx only)")
)
View Source
var (
	ErrNilOperationTx            = errors.New("operation tx is nil")
	ErrNoOperations              = errors.New("operation tx must have at least one operation")
	ErrOperationsNotSortedUnique = errors.New("operations are not sorted and unique")
	ErrOperationDoubleSpend      = errors.New("operations attempt to double spend an input")
	// ErrWrongNumberOfCredentials catches malformed wire payloads where the
	// peer sent fewer (or more) credentials than [NumCredentials] requires.
	// Without this check the semantic executor would slice past the end of
	// [tx.Creds] and panic on op credentials.
	ErrWrongNumberOfCredentials = errors.New("wrong number of credentials")
)
View Source
var (
	ErrWeightTooSmall = errors.New("weight of this validator is too low")

	// Deprecated: use errBadChainID instead
	ErrBadChainID = errBadChainID
)
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 RemoveChainValidatorTx")
)
View Source
var (
	ErrTransferPermissionlessChain = errors.New("cannot transfer ownership of a permissionless chain")
)
View Source
var (
	ErrWrongLocktime = errors.New("wrong locktime reported")
)
View Source
var (
	ErrZeroBalance = errors.New("balance must be greater than 0")
)

Functions

func BoundedBy

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 IsSortedAndUniqueOperations added in v1.26.25

func IsSortedAndUniqueOperations(ops []*Operation, c codec.Manager) bool

IsSortedAndUniqueOperations reports whether [ops] is sorted by codec bytes and contains no duplicates.

func RegisterTypes added in v1.26.35

func RegisterTypes(targetCodec linearcodec.Codec) error

RegisterTypes registers the v1 tx-codec types (the only version a new build path uses) on the given linearcodec. Existing call sites outside this package continue to compose with RegisterTypes; the v0 decoder is gated to the txs.Codec / txs.GenesisCodec entries.

func SortOperations added in v1.26.25

func SortOperations(ops []*Operation, c codec.Manager)

func SortOperationsWithSigners added in v1.26.25

func SortOperationsWithSigners(ops []*Operation, signers [][]*secp256k1.PrivateKey, c codec.Manager)

Types

type AddChainValidatorTx added in v1.22.22

type AddChainValidatorTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// The validator
	ChainValidator `serialize:"true" json:"validator"`
	// Auth that will be allowing this validator into the network
	ChainAuth verify.Verifiable `serialize:"true" json:"chainAuthorization"`
}

AddChainValidatorTx is an unsigned addChainValidatorTx

func (*AddChainValidatorTx) CurrentPriority added in v1.22.22

func (*AddChainValidatorTx) CurrentPriority() Priority

func (*AddChainValidatorTx) Initialize added in v1.22.87

func (tx *AddChainValidatorTx) Initialize(ctx context.Context) error

InitializeWithRuntime initializes the transaction with Runtime

func (*AddChainValidatorTx) NodeID added in v1.22.22

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

func (*AddChainValidatorTx) PendingPriority added in v1.22.22

func (*AddChainValidatorTx) PendingPriority() Priority

func (*AddChainValidatorTx) PublicKey added in v1.22.22

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

func (*AddChainValidatorTx) SyntacticVerify added in v1.22.22

func (tx *AddChainValidatorTx) SyntacticVerify(rt *runtime.Runtime) error

SyntacticVerify returns nil iff [tx] is valid

func (*AddChainValidatorTx) Visit added in v1.22.22

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

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 []*lux.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) ChainID added in v1.22.22

func (*AddDelegatorTx) ChainID() ids.ID

func (*AddDelegatorTx) CurrentPriority

func (*AddDelegatorTx) CurrentPriority() Priority

func (*AddDelegatorTx) InitRuntime added in v1.22.87

func (tx *AddDelegatorTx) InitRuntime(rt *runtime.Runtime)

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

func (*AddDelegatorTx) Initialize added in v1.14.2

func (tx *AddDelegatorTx) Initialize(ctx context.Context) error

InitializeWithRuntime initializes the transaction with Runtime

func (*AddDelegatorTx) NodeID

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

func (*AddDelegatorTx) PendingPriority

func (*AddDelegatorTx) PendingPriority() Priority

func (*AddDelegatorTx) PublicKey

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

func (*AddDelegatorTx) RewardsOwner

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

func (*AddDelegatorTx) Stake

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

func (*AddDelegatorTx) SyntacticVerify

func (tx *AddDelegatorTx) SyntacticVerify(rt *runtime.Runtime) error

SyntacticVerify returns nil iff [tx] is valid

func (*AddDelegatorTx) Visit

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

type AddPermissionlessDelegatorTx

type AddPermissionlessDelegatorTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// Describes the validator
	Validator `serialize:"true" json:"validator"`
	// ID of the chain this validator is validating
	Chain ids.ID `serialize:"true" json:"chainID"`
	// Where to send staked tokens when done validating
	StakeOuts []*lux.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) ChainID added in v1.22.22

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

func (*AddPermissionlessDelegatorTx) CurrentPriority

func (tx *AddPermissionlessDelegatorTx) CurrentPriority() Priority

func (*AddPermissionlessDelegatorTx) InitRuntime added in v1.22.87

func (tx *AddPermissionlessDelegatorTx) InitRuntime(rt *runtime.Runtime)

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

func (*AddPermissionlessDelegatorTx) Initialize added in v1.14.2

func (tx *AddPermissionlessDelegatorTx) Initialize(ctx context.Context) error

InitializeWithRuntime initializes the transaction with Runtime

func (*AddPermissionlessDelegatorTx) NodeID

func (*AddPermissionlessDelegatorTx) PendingPriority

func (tx *AddPermissionlessDelegatorTx) PendingPriority() Priority

func (*AddPermissionlessDelegatorTx) PublicKey

func (*AddPermissionlessDelegatorTx) RewardsOwner

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

func (*AddPermissionlessDelegatorTx) Stake

func (*AddPermissionlessDelegatorTx) SyntacticVerify

func (tx *AddPermissionlessDelegatorTx) SyntacticVerify(rt *runtime.Runtime) error

SyntacticVerify returns nil iff [tx] is valid

func (*AddPermissionlessDelegatorTx) Visit

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

type AddPermissionlessValidatorTx

type AddPermissionlessValidatorTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// Describes the validator
	Validator `serialize:"true" json:"validator"`
	// ID of the chain this validator is validating
	Chain ids.ID `serialize:"true" json:"chainID"`
	// If the [Chain] is the primary network, [Signer] is the BLS key for this
	// validator. If the [Chain] 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 []*lux.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) ChainID added in v1.22.22

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

func (*AddPermissionlessValidatorTx) CurrentPriority

func (tx *AddPermissionlessValidatorTx) CurrentPriority() Priority

func (*AddPermissionlessValidatorTx) DelegationRewardsOwner

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

func (*AddPermissionlessValidatorTx) InitRuntime added in v1.22.87

func (tx *AddPermissionlessValidatorTx) InitRuntime(rt *runtime.Runtime)

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

func (*AddPermissionlessValidatorTx) Initialize added in v1.14.2

func (tx *AddPermissionlessValidatorTx) Initialize(ctx context.Context) error

InitializeWithRuntime initializes the transaction with Runtime

func (*AddPermissionlessValidatorTx) NodeID

func (*AddPermissionlessValidatorTx) PendingPriority

func (tx *AddPermissionlessValidatorTx) PendingPriority() Priority

func (*AddPermissionlessValidatorTx) PublicKey

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

func (*AddPermissionlessValidatorTx) Shares

func (tx *AddPermissionlessValidatorTx) Shares() uint32

func (*AddPermissionlessValidatorTx) Stake

func (*AddPermissionlessValidatorTx) SyntacticVerify

func (tx *AddPermissionlessValidatorTx) SyntacticVerify(rt *runtime.Runtime) error

SyntacticVerify returns nil iff [tx] is valid

func (*AddPermissionlessValidatorTx) ValidationRewardsOwner

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

func (*AddPermissionlessValidatorTx) Visit

func (tx *AddPermissionlessValidatorTx) 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 []*lux.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) ChainID added in v1.22.22

func (*AddValidatorTx) ChainID() ids.ID

func (*AddValidatorTx) CurrentPriority

func (*AddValidatorTx) CurrentPriority() Priority

func (*AddValidatorTx) DelegationRewardsOwner

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

func (*AddValidatorTx) InitRuntime added in v1.22.87

func (tx *AddValidatorTx) InitRuntime(rt *runtime.Runtime)

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

func (*AddValidatorTx) Initialize added in v1.14.2

func (tx *AddValidatorTx) Initialize(ctx context.Context) error

InitializeWithRuntime initializes the transaction with Runtime

func (*AddValidatorTx) NodeID

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

func (*AddValidatorTx) PendingPriority

func (*AddValidatorTx) PendingPriority() Priority

func (*AddValidatorTx) PublicKey

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

func (*AddValidatorTx) Shares

func (tx *AddValidatorTx) Shares() uint32

func (*AddValidatorTx) Stake

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

func (*AddValidatorTx) SyntacticVerify

func (tx *AddValidatorTx) SyntacticVerify(rt *runtime.Runtime) error

SyntacticVerify returns nil iff [tx] is valid

func (*AddValidatorTx) ValidationRewardsOwner

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) InitRuntime added in v1.22.87

func (*AdvanceTimeTx) InitRuntime(*runtime.Runtime)

func (*AdvanceTimeTx) Initialize added in v1.14.2

func (tx *AdvanceTimeTx) Initialize(ctx context.Context) error

InitializeWithRuntime initializes the transaction with Runtime

func (*AdvanceTimeTx) InputIDs

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

func (*AdvanceTimeTx) Outputs

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

func (*AdvanceTimeTx) SetBytes

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

func (*AdvanceTimeTx) SyntacticVerify

func (*AdvanceTimeTx) SyntacticVerify(*runtime.Runtime) 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 {
	lux.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) InitRuntime added in v1.22.87

func (tx *BaseTx) InitRuntime(rt *runtime.Runtime)

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

func (*BaseTx) Initialize added in v1.14.2

func (tx *BaseTx) Initialize(ctx context.Context) error

InitializeRuntime is a no-op. Runtime is passed explicitly.

func (*BaseTx) InputIDs

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

func (*BaseTx) Outputs

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

func (*BaseTx) SetBytes

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

func (*BaseTx) SyntacticVerify

func (tx *BaseTx) SyntacticVerify(rt *runtime.Runtime) error

SyntacticVerify returns nil iff this tx is well formed

func (*BaseTx) Visit

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

type ChainValidator added in v1.22.22

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

	// ID of the chain this validator is validating
	Chain ids.ID `serialize:"true" json:"chainID"`
}

ChainValidator validates a chain on the Lux network.

func (*ChainValidator) ChainID added in v1.22.22

func (v *ChainValidator) ChainID() ids.ID

ChainID is the ID of the chain this validator is validating

func (*ChainValidator) Verify added in v1.22.22

func (v *ChainValidator) Verify() error

Verify this validator is valid

type ConvertNetworkToL1Tx added in v1.24.27

type ConvertNetworkToL1Tx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// ID of the Chain to transform
	Chain ids.ID `serialize:"true" json:"chainID"`
	// Blockchain where the Chain manager lives
	ManagerChainID ids.ID `serialize:"true" json:"managerChainID"`
	// Address of the Chain manager
	Address types.JSONByteSlice `serialize:"true" json:"address"`
	// Initial pay-as-you-go validators for the Chain
	Validators []*ConvertNetworkToL1Validator `serialize:"true" json:"validators"`
	// Authorizes this conversion
	ChainAuth verify.Verifiable `serialize:"true" json:"chainAuthorization"`
}

func (*ConvertNetworkToL1Tx) SyntacticVerify added in v1.24.27

func (tx *ConvertNetworkToL1Tx) SyntacticVerify(rt *runtime.Runtime) error

func (*ConvertNetworkToL1Tx) Visit added in v1.24.27

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

type ConvertNetworkToL1Validator added in v1.24.27

type ConvertNetworkToL1Validator 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 + Chain does uniquely map to a BLS key
	Signer signer.ProofOfPossession `serialize:"true" json:"signer"`
	// Leftover $LUX 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 (*ConvertNetworkToL1Validator) Compare added in v1.24.27

func (*ConvertNetworkToL1Validator) Verify added in v1.24.27

func (v *ConvertNetworkToL1Validator) Verify() error

type CreateAssetTx added in v1.26.25

type CreateAssetTx struct {
	BaseTx       `serialize:"true"`
	Name         string          `serialize:"true" json:"name"`
	Symbol       string          `serialize:"true" json:"symbol"`
	Denomination byte            `serialize:"true" json:"denomination"`
	States       []*InitialState `serialize:"true" json:"initialStates"`
}

CreateAssetTx mints a brand new UTXO asset on the P-Chain. The minted asset is owned by the outputs declared in [States]; the fee for asset creation is paid out of [BaseTx.Ins] / [BaseTx.Outs].

func (*CreateAssetTx) InitRuntime added in v1.26.25

func (tx *CreateAssetTx) InitRuntime(rt *runtime.Runtime)

InitRuntime initialises the embedded BaseTx and every InitialState output.

func (*CreateAssetTx) InitialStates added in v1.26.25

func (tx *CreateAssetTx) InitialStates() []*InitialState

InitialStates returns the slice of initial states for this asset. The returned slice MUST NOT be mutated.

func (*CreateAssetTx) SyntacticVerify added in v1.26.25

func (tx *CreateAssetTx) SyntacticVerify(rt *runtime.Runtime) error

SyntacticVerify returns nil iff this tx is well formed.

func (*CreateAssetTx) Visit added in v1.26.25

func (tx *CreateAssetTx) Visit(v Visitor) error

type CreateChainTx

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

CreateChainTx is an unsigned createChainTx

func (*CreateChainTx) Initialize added in v1.14.2

func (tx *CreateChainTx) Initialize(ctx context.Context) error

InitializeWithRuntime initializes the transaction with Runtime

func (*CreateChainTx) SyntacticVerify

func (tx *CreateChainTx) SyntacticVerify(rt *runtime.Runtime) error

func (*CreateChainTx) Visit

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

type CreateNetworkTx added in v1.22.84

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

CreateNetworkTx is an unsigned proposal to create a new chain

func (*CreateNetworkTx) InitRuntime added in v1.22.87

func (tx *CreateNetworkTx) InitRuntime(rt *runtime.Runtime)

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

func (*CreateNetworkTx) Initialize added in v1.22.87

func (tx *CreateNetworkTx) Initialize(ctx context.Context) error

InitializeWithRuntime initializes the transaction with Runtime

func (*CreateNetworkTx) SyntacticVerify added in v1.22.84

func (tx *CreateNetworkTx) SyntacticVerify(rt *runtime.Runtime) error

SyntacticVerify verifies that this transaction is well-formed

func (*CreateNetworkTx) Visit added in v1.22.84

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

type CreateSovereignL1Tx added in v1.27.22

type CreateSovereignL1Tx struct {
	// Metadata, inputs and outputs (fee payment, etc.).
	BaseTx `serialize:"true"`

	// Owner of the network registration record. Equivalent to
	// CreateNetworkTx.Owner. Authorises future admin txs against the
	// network record on P-chain (delisting, owner rotation).
	Owner fx.Owner `serialize:"true" json:"owner"`

	// Genesis validator set. These NodeIDs are seeded into the
	// validator-manager contract at L1 genesis; no separate
	// AddPermissionlessValidator calls required. Same shape as
	// ConvertNetworkToL1Validator so the verify/sort plumbing is
	// shared.
	Validators []*ConvertNetworkToL1Validator `serialize:"true" json:"validators"`

	// Chains to register at L1 genesis. Each entry is one chain on
	// the new L1 (e.g. EVM, DEX, FHE). The new L1's network ID is
	// derived from this tx's hash; chains inherit it implicitly.
	Chains []*SovereignL1Chain `serialize:"true" json:"chains"`

	// Index into Chains[] of the chain that hosts the validator
	// manager contract. The L1's validator-set authority lives at
	// (Chains[ManagerChainIdx], ManagerAddress). After this tx
	// commits, all validator changes go through that contract via
	// warp; the primary P-chain no longer participates in the L1's
	// validator set.
	ManagerChainIdx uint32 `serialize:"true" json:"managerChainIdx"`

	// Address of the validator-manager contract on the manager chain.
	// Bounded by MaxChainAddressLength (shared with ConvertNetworkToL1Tx).
	ManagerAddress types.JSONByteSlice `serialize:"true" json:"managerAddress"`
}

CreateSovereignL1Tx atomically registers a new sovereign L1 on the primary network's P-chain. Combines what is today four sequential transactions —

CreateNetworkTx + AddChainValidatorTx (×N) + CreateChainTx (×K) + ConvertNetworkToL1Tx

into a single tx that commits or reverts atomically. After this tx finalises, the primary network has a permanent record of:

  • the L1's network ID (derived from the tx hash, like CreateNetworkTx)
  • the L1's genesis validator set (NodeIDs + BLS PoPs + weights)
  • the L1's chain manifest (VM ID + genesis blob per chain, e.g. EVM + DEX + FHE in one L1)
  • the on-chain validator-manager contract address (the L1's authority for future validator changes)

The primary network does NOT track-chains or validate the L1's blocks. The L1's own validators run their own consensus independently from genesis. Subsequent validator-set changes flow through the on-chain manager via warp messages, not through AddChainValidatorTx.

This is the canonical "fresh sovereign L1 from day 1" pattern. L2/L3/L4 share security with their parent L1 via the same flow — each child L1 references its parent in Owner.

Replaces the 4-step flow for tenants who want sovereign L1 from genesis. The 4-step flow remains supported for existing chains that began as P-chain-managed and later converted.

func (*CreateSovereignL1Tx) InitRuntime added in v1.27.22

func (tx *CreateSovereignL1Tx) InitRuntime(rt *runtime.Runtime)

InitRuntime sets the runtime context on the inputs and outputs so addresses can be JSON-marshalled into human-readable form.

func (*CreateSovereignL1Tx) SyntacticVerify added in v1.27.22

func (tx *CreateSovereignL1Tx) SyntacticVerify(rt *runtime.Runtime) error

SyntacticVerify checks shape-only invariants. State-dependent checks (input UTXOs spendable, owner sigs valid, balance funds the genesis validators' initial Balance, etc.) live in the StandardTx executor.

func (*CreateSovereignL1Tx) Visit added in v1.27.22

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

Visit dispatches to the per-tx-type Visitor (StandardTx executor, mempool verifier, etc.). The matching visitor.go change adds the CreateSovereignL1Tx method to the interface.

type DelegatorTx

type DelegatorTx interface {
	UnsignedTx
	PermissionlessStaker

	RewardsOwner() fx.Owner
}

type DisableL1ValidatorTx

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

func (tx *DisableL1ValidatorTx) SyntacticVerify(rt *runtime.Runtime) error

func (*DisableL1ValidatorTx) Visit

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

type EvidenceType added in v1.24.10

type EvidenceType uint8

EvidenceType classifies the equivocation.

const (
	DoubleVoteEvidence EvidenceType = iota + 1
	DoubleSignEvidence
)

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 []*lux.TransferableOutput `serialize:"true" json:"exportedOutputs"`
}

ExportTx is an unsigned exportTx

func (*ExportTx) InitRuntime added in v1.22.87

func (tx *ExportTx) InitRuntime(rt *runtime.Runtime)

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

func (*ExportTx) Initialize added in v1.22.87

func (tx *ExportTx) Initialize(ctx context.Context) error

InitializeWithRuntime initializes the transaction with Runtime

func (*ExportTx) SyntacticVerify

func (tx *ExportTx) SyntacticVerify(rt *runtime.Runtime) 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 []*lux.TransferableInput `serialize:"true" json:"importedInputs"`
}

ImportTx is an unsigned importTx

func (*ImportTx) InitRuntime added in v1.22.87

func (tx *ImportTx) InitRuntime(rt *runtime.Runtime)

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

func (*ImportTx) Initialize added in v1.22.87

func (tx *ImportTx) Initialize(ctx context.Context) error

InitializeWithRuntime initializes the transaction with Runtime

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(rt *runtime.Runtime) error

SyntacticVerify this transaction is well-formed

func (*ImportTx) Visit

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

type IncreaseL1ValidatorBalanceTx

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

func (*IncreaseL1ValidatorBalanceTx) SyntacticVerify

func (tx *IncreaseL1ValidatorBalanceTx) SyntacticVerify(rt *runtime.Runtime) error

func (*IncreaseL1ValidatorBalanceTx) Visit

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

type InitialState added in v1.26.25

type InitialState struct {
	FxIndex uint32         `serialize:"true"  json:"fxIndex"`
	Outs    []verify.State `serialize:"true"  json:"outputs"`
}

InitialState is the initial state of a single Fx for a new asset. On PlatformVM there is exactly one Fx (secp256k1fx, index 0) so [FxIndex] is required to be zero.

func (*InitialState) Compare added in v1.26.25

func (is *InitialState) Compare(other *InitialState) int

Compare provides a deterministic ordering by FxIndex.

func (*InitialState) InitRuntime added in v1.26.25

func (is *InitialState) InitRuntime(_ *runtime.Runtime)

InitRuntime is a no-op; verify.State outputs do not require runtime context.

func (*InitialState) Sort added in v1.26.25

func (is *InitialState) Sort(c codec.Manager)

Sort orders the outputs of this InitialState by their byte representation.

func (*InitialState) Verify added in v1.26.25

func (is *InitialState) Verify(c codec.Manager) error

Verify returns nil iff this InitialState is well formed.

type MockScheduledStaker added in v1.1.11

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

MockScheduledStaker is a mock of ScheduledStaker interface.

func NewMockScheduledStaker added in v1.1.11

func NewMockScheduledStaker(ctrl *gomock.Controller) *MockScheduledStaker

NewMockScheduledStaker creates a new mock instance.

func (*MockScheduledStaker) ChainID added in v1.22.22

func (m *MockScheduledStaker) ChainID() ids.ID

ChainID mocks base method.

func (*MockScheduledStaker) CurrentPriority added in v1.1.11

func (m *MockScheduledStaker) CurrentPriority() Priority

CurrentPriority mocks base method.

func (*MockScheduledStaker) EXPECT added in v1.1.11

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockScheduledStaker) EndTime added in v1.1.11

func (m *MockScheduledStaker) EndTime() time.Time

EndTime mocks base method.

func (*MockScheduledStaker) NodeID added in v1.1.11

func (m *MockScheduledStaker) NodeID() ids.NodeID

NodeID mocks base method.

func (*MockScheduledStaker) PendingPriority added in v1.1.11

func (m *MockScheduledStaker) PendingPriority() Priority

PendingPriority mocks base method.

func (*MockScheduledStaker) PublicKey added in v1.1.11

func (m *MockScheduledStaker) PublicKey() (*bls.PublicKey, bool, error)

PublicKey mocks base method.

func (*MockScheduledStaker) StartTime added in v1.1.11

func (m *MockScheduledStaker) StartTime() time.Time

StartTime mocks base method.

func (*MockScheduledStaker) Weight added in v1.1.11

func (m *MockScheduledStaker) Weight() uint64

Weight mocks base method.

type MockScheduledStakerMockRecorder added in v1.1.11

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

MockScheduledStakerMockRecorder is the mock recorder for MockScheduledStaker.

func (*MockScheduledStakerMockRecorder) ChainID added in v1.22.22

ChainID indicates an expected call of ChainID.

func (*MockScheduledStakerMockRecorder) CurrentPriority added in v1.1.11

func (mr *MockScheduledStakerMockRecorder) CurrentPriority() *gomock.Call

CurrentPriority indicates an expected call of CurrentPriority.

func (*MockScheduledStakerMockRecorder) EndTime added in v1.1.11

EndTime indicates an expected call of EndTime.

func (*MockScheduledStakerMockRecorder) NodeID added in v1.1.11

NodeID indicates an expected call of NodeID.

func (*MockScheduledStakerMockRecorder) PendingPriority added in v1.1.11

func (mr *MockScheduledStakerMockRecorder) PendingPriority() *gomock.Call

PendingPriority indicates an expected call of PendingPriority.

func (*MockScheduledStakerMockRecorder) PublicKey added in v1.1.11

func (mr *MockScheduledStakerMockRecorder) PublicKey() *gomock.Call

PublicKey indicates an expected call of PublicKey.

func (*MockScheduledStakerMockRecorder) StartTime added in v1.1.11

func (mr *MockScheduledStakerMockRecorder) StartTime() *gomock.Call

StartTime indicates an expected call of StartTime.

func (*MockScheduledStakerMockRecorder) Weight added in v1.1.11

Weight indicates an expected call of Weight.

type NFTStaker added in v1.16.56

type NFTStaker interface {
	Staker
	GetValidatorNFT() *ValidatorNFTInfo
}

NFTStaker is an interface for stakers that use NFTs for validation

type Operation added in v1.26.25

type Operation struct {
	lux.Asset `serialize:"true"`

	// UTXOIDs of UTXOs this operation consumes.
	UTXOIDs []*lux.UTXOID `serialize:"true" json:"inputIDs"`

	// Op is the action to perform. On P-Chain this is always a
	// secp256k1fx-flavoured operation; the codec keeps the door open for
	// additional Fx flavours by storing a verify.Verifiable.
	Op verify.Verifiable `serialize:"true" json:"operation"`
}

Operation expresses an action against a previously-minted asset's UTXOs (transfer, mint, burn, NFT-style state op). PlatformVM exposes only the secp256k1fx Fx so [Op] is a secp256k1fx-compatible verifiable input.

func (*Operation) Verify added in v1.26.25

func (op *Operation) Verify() error

Verify returns nil iff this Operation is well formed.

type OperationTx added in v1.26.25

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

	Ops []*Operation `serialize:"true" json:"operations"`
}

OperationTx applies one or more [Operation]s against previously minted assets. Like BaseTx it consumes inputs and produces outputs for fees; the authoritative side-effect is the operations.

func (*OperationTx) InitRuntime added in v1.26.25

func (tx *OperationTx) InitRuntime(rt *runtime.Runtime)

func (*OperationTx) InputIDs added in v1.26.25

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

InputIDs returns the set of UTXOIDs spent across BaseTx and every Operation.

func (*OperationTx) NumCredentials added in v1.26.25

func (tx *OperationTx) NumCredentials() int

NumCredentials returns the number of credentials expected when this tx is signed (one per BaseTx input plus one per Operation).

func (*OperationTx) OperationInputs added in v1.26.25

func (tx *OperationTx) OperationInputs() []*lux.UTXOID

OperationInputs returns the UTXOIDs consumed by the operations only (BaseTx inputs are returned by BaseTx.InputIDs).

func (*OperationTx) Operations added in v1.26.25

func (tx *OperationTx) Operations() []*Operation

Operations returns the slice of operations carried by this tx. The returned slice MUST NOT be mutated.

func (*OperationTx) SyntacticVerify added in v1.26.25

func (tx *OperationTx) SyntacticVerify(rt *runtime.Runtime) error

SyntacticVerify returns nil iff this tx is well-formed.

func (*OperationTx) Visit added in v1.26.25

func (tx *OperationTx) Visit(v Visitor) error

type PermissionlessStaker

type PermissionlessStaker interface {
	Staker

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

type Priority

type Priority byte
const (
	// Legacy AddDelegatorTx delegators move from pending to current first,
	PrimaryNetworkDelegatorLegacyPendingPriority Priority = iota + 1
	// then primary network validators,
	PrimaryNetworkValidatorPendingPriority
	// then AddPermissionlessDelegatorTx delegators,
	PrimaryNetworkDelegatorPermissionlessPendingPriority
	// then permissionless chain validators,
	ChainPermissionlessValidatorPendingPriority
	// then permissionless chain delegators.
	ChainPermissionlessDelegatorPendingPriority
	// then permissioned chain validators,
	ChainPermissionedValidatorPendingPriority

	// First permissioned chain 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.
	ChainPermissionedValidatorCurrentPriority
	// then permissionless chain delegators,
	ChainPermissionlessDelegatorCurrentPriority
	// then permissionless chain validators,
	ChainPermissionlessValidatorCurrentPriority
	// then primary network delegators,
	PrimaryNetworkDelegatorCurrentPriority
	// then primary network validators.
	PrimaryNetworkValidatorCurrentPriority
)

func (Priority) IsCurrent

func (p Priority) IsCurrent() bool

func (Priority) IsCurrentDelegator

func (p Priority) IsCurrentDelegator() bool

func (Priority) IsCurrentValidator

func (p Priority) IsCurrentValidator() bool

func (Priority) IsDelegator

func (p Priority) IsDelegator() bool

func (Priority) IsPending

func (p Priority) IsPending() bool

func (Priority) IsPendingDelegator

func (p Priority) IsPendingDelegator() bool

func (Priority) IsPendingValidator

func (p Priority) IsPendingValidator() bool

func (Priority) IsPermissionedValidator

func (p Priority) IsPermissionedValidator() bool

func (Priority) IsValidator

func (p Priority) IsValidator() bool

type RegisterL1ValidatorTx

type RegisterL1ValidatorTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// Balance <= sum($LUX inputs) - sum($LUX 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

func (tx *RegisterL1ValidatorTx) SyntacticVerify(rt *runtime.Runtime) error

func (*RegisterL1ValidatorTx) Visit

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

type RemoveChainValidatorTx added in v1.22.22

type RemoveChainValidatorTx struct {
	BaseTx `serialize:"true"`
	// The node to remove from the chain.
	NodeID ids.NodeID `serialize:"true" json:"nodeID"`
	// The chain to remove the node from.
	Chain ids.ID `serialize:"true" json:"chainID"`
	// Proves that the issuer has the right to remove the node from the chain.
	ChainAuth verify.Verifiable `serialize:"true" json:"chainAuthorization"`
}

RemoveChainValidatorTx removes a validator from a chain.

func (*RemoveChainValidatorTx) Initialize added in v1.22.87

func (tx *RemoveChainValidatorTx) Initialize(ctx context.Context) error

InitializeWithRuntime initializes the transaction with Runtime

func (*RemoveChainValidatorTx) SyntacticVerify added in v1.22.22

func (tx *RemoveChainValidatorTx) SyntacticVerify(rt *runtime.Runtime) error

func (*RemoveChainValidatorTx) Visit added in v1.22.22

func (tx *RemoveChainValidatorTx) 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 LUX 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 LUX but no reward.

func (*RewardValidatorTx) Bytes

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

func (*RewardValidatorTx) InitRuntime added in v1.22.87

func (*RewardValidatorTx) InitRuntime(*runtime.Runtime)

func (*RewardValidatorTx) Initialize added in v1.14.2

func (tx *RewardValidatorTx) Initialize(ctx context.Context) error

InitializeWithRuntime initializes the transaction with Runtime

func (*RewardValidatorTx) InputIDs

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

func (*RewardValidatorTx) Outputs

func (*RewardValidatorTx) SetBytes

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

func (*RewardValidatorTx) SyntacticVerify

func (*RewardValidatorTx) SyntacticVerify(*runtime.Runtime) error

func (*RewardValidatorTx) Visit

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

type RuntimeInitializable added in v1.22.87

type RuntimeInitializable interface {
	InitRuntime(rt *runtime.Runtime)
}

RuntimeInitializable defines the interface for initializing context

type ScheduledStaker

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

type SetL1ValidatorWeightTx

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

func (tx *SetL1ValidatorWeightTx) SyntacticVerify(rt *runtime.Runtime) error

func (*SetL1ValidatorWeightTx) Visit

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

type SlashEvidence added in v1.24.10

type SlashEvidence struct {
	// Height at which the equivocation occurred
	Height uint64 `serialize:"true" json:"height"`
	// Type of equivocation
	Type EvidenceType `serialize:"true" json:"type"`
	// First signed message (vote or block hash)
	MessageA []byte `serialize:"true" json:"messageA"`
	// BLS signature over MessageA
	SignatureA []byte `serialize:"true" json:"signatureA"`
	// Second conflicting signed message at the same height
	MessageB []byte `serialize:"true" json:"messageB"`
	// BLS signature over MessageB
	SignatureB []byte `serialize:"true" json:"signatureB"`
}

SlashEvidence contains two conflicting signed messages from the same validator at the same consensus height. Both signatures must verify against the validator's registered BLS public key.

func (*SlashEvidence) Verify added in v1.24.10

func (e *SlashEvidence) Verify() error

Verify checks that the evidence is structurally valid. It does NOT verify BLS signatures (that requires the validator's public key from state and is done in the executor).

type SlashValidatorTx added in v1.24.10

type SlashValidatorTx struct {
	BaseTx `serialize:"true"`
	// NodeID of the validator to slash
	NodeID ids.NodeID `serialize:"true" json:"nodeID"`
	// Cryptographic proof of equivocation
	Evidence SlashEvidence `serialize:"true" json:"evidence"`
	// Percentage of stake to slash, in units of reward.PercentDenominator
	// (e.g., 100_000 = 10%). Set by the submitter but capped/verified by
	// the executor against chain parameters.
	SlashPercentage uint32 `serialize:"true" json:"slashPercentage"`
}

SlashValidatorTx removes a percentage of a validator's stake as punishment for provable equivocation (double-vote or double-sign). The slashed amount is burned. Anyone can submit this transaction with valid evidence.

func (*SlashValidatorTx) InitRuntime added in v1.24.10

func (tx *SlashValidatorTx) InitRuntime(rt *runtime.Runtime)

func (*SlashValidatorTx) Initialize added in v1.24.10

func (tx *SlashValidatorTx) Initialize(ctx context.Context) error

func (*SlashValidatorTx) InputIDs added in v1.24.10

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

func (*SlashValidatorTx) Outputs added in v1.24.10

func (*SlashValidatorTx) Outputs() []*lux.TransferableOutput

func (*SlashValidatorTx) SyntacticVerify added in v1.24.10

func (tx *SlashValidatorTx) SyntacticVerify(rt *runtime.Runtime) error

func (*SlashValidatorTx) Visit added in v1.24.10

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

type SovereignL1Chain added in v1.27.22

type SovereignL1Chain struct {
	// Human-readable name; need not be unique. Subject to the same
	// charset rules as CreateChainTx.BlockchainName.
	BlockchainName string `serialize:"true" json:"blockchainName"`

	// VM ID running on this chain (e.g. EVM, DEX, FHE precompile set).
	VMID ids.ID `serialize:"true" json:"vmID"`

	// Feature-extension IDs running on this chain. Must be sorted+unique.
	FxIDs []ids.ID `serialize:"true" json:"fxIDs"`

	// Genesis state blob for this chain. Bounded by MaxGenesisLen.
	GenesisData []byte `serialize:"true" json:"genesisData"`
}

SovereignL1Chain describes one chain on a newly-minted sovereign L1. Mirrors the per-chain fields of CreateChainTx; the parent CreateSovereignL1Tx supplies the network ID implicitly (derived from the tx hash, like CreateNetworkTx).

func (*SovereignL1Chain) Verify added in v1.27.22

func (ch *SovereignL1Chain) Verify() error

Verify validates a single SovereignL1Chain entry.

type Staker

type Staker interface {
	ChainID() 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 TransferChainOwnershipTx added in v1.22.22

type TransferChainOwnershipTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// ID of the chain this tx is modifying
	Chain ids.ID `serialize:"true" json:"chainID"`
	// Proves that the issuer has the right to modify the chain.
	ChainAuth verify.Verifiable `serialize:"true" json:"chainAuthorization"`
	// Who is now authorized to manage this chain
	Owner fx.Owner `serialize:"true" json:"newOwner"`
}

func (*TransferChainOwnershipTx) InitRuntime added in v1.22.87

func (tx *TransferChainOwnershipTx) InitRuntime(rt *runtime.Runtime)

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

func (*TransferChainOwnershipTx) Initialize added in v1.22.87

func (tx *TransferChainOwnershipTx) Initialize(ctx context.Context) error

InitializeWithRuntime initializes the transaction with Runtime

func (*TransferChainOwnershipTx) SyntacticVerify added in v1.22.22

func (tx *TransferChainOwnershipTx) SyntacticVerify(rt *runtime.Runtime) error

func (*TransferChainOwnershipTx) Visit added in v1.22.22

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

type TransformChainTx added in v1.22.22

type TransformChainTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// ID of the Chain to transform
	// Restrictions:
	// - Must not be the Primary Network ID
	Chain ids.ID `serialize:"true" json:"chainID"`
	// Asset to use when staking on the Net
	// Restrictions:
	// - Must not be the Empty ID
	// - Must not be the LUX 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
	ChainAuth verify.Verifiable `serialize:"true" json:"chainAuthorization"`
}

TransformChainTx is an unsigned transformChainTx

func (*TransformChainTx) Initialize added in v1.22.87

func (tx *TransformChainTx) Initialize(ctx context.Context) error

InitializeWithRuntime initializes the transaction with Runtime

func (*TransformChainTx) SyntacticVerify added in v1.22.22

func (tx *TransformChainTx) SyntacticVerify(rt *runtime.Runtime) error

func (*TransformChainTx) Visit added in v1.22.22

func (tx *TransformChainTx) 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. The wire version is taken from the 2-byte prefix that c.Unmarshal reads; c.Size(...) is then called under THAT version so the split point between unsignedBytes and the credentials suffix is correct for either v0 or v1 layouts.

Parse never re-marshals: TxID = hash(signedBytes) verbatim. This is the byte-preserving path that all from-disk and from-wire reads must go through to keep TxIDs stable across the v0→v1 migration.

We explicitly pass the codec in Parse since some call sites (genesis, state fallback) must use GenesisCodec to admit txs larger than the max length of Codec.

func (*Tx) Bytes

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

func (*Tx) GossipID

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

Initialize marshals tx with the canonical write codec (v1) and derives TxID = hash(signedBytes). This is appropriate ONLY for txs built fresh in this process (e.g. by the wallet or by the block builder). For txs loaded from disk or received from the wire, use InitializeFromBytes — Initialize would re-encode at v1, changing the TxID of any tx that was originally serialized at v0.

func (*Tx) InitializeFromBytes added in v1.28.0

func (tx *Tx) InitializeFromBytes(c codec.Manager, version uint16, signedBytes []byte) error

InitializeFromBytes binds the tx to the EXACT signedBytes it was decoded from, deriving TxID = hash(signedBytes) under the codec version the bytes were originally written at. It never re-marshals, so a tx whose bytes were written at v0 keeps its v0-derived TxID forever — the chain commitment is therefore stable across the v0->v1 codec migration.

version is the codec version the bytes were decoded under (returned by codec.Manager.Unmarshal). It selects the c.Size(...) call used to split signedBytes into unsignedBytes (the prefix the signature covers) and the credentials suffix.

func (*Tx) InitializeFromBytesAtVersion added in v1.28.0

func (tx *Tx) InitializeFromBytesAtVersion(c codec.Manager, version uint16) error

InitializeFromBytesAtVersion is the byte-preserving init used after a struct-level Unmarshal where the outer container (a genesis blob, a stored block) decoded the tx field directly — in that case we only have the struct value and the codec version it was decoded under, not the raw signed bytes (which were never sliced out of the outer stream by the codec).

We re-derive signedBytes by Marshal'ing the just-decoded tx at the SAME version, then bind via SetBytes. The wire format is deterministic and the codec is closed at v0, so the re-marshal produces the exact bytes the original v0 producer emitted; therefore TxID = hash(re-marshaled v0 bytes) = TxID the chain committed.

This single bounded re-marshal is the ONLY place we allow c.Marshal(v0, ...) inside the read path. It is justified because:

  1. Linearcodec marshal is a pure function of the struct fields under a fixed slot map, so the output is byte-equal to the original v0 producer's output.
  2. The struct fields were just populated by c.Unmarshal at the same version, so no information has been lost or rotated.
  3. The c.Size(v0, ...) inverse used by InitializeFromBytes is the same path, just in the opposite direction — the size of an Unsigned in v0 layout is a fixed function of its fields.

Once every genesis blob and every stored block on disk has been re-encoded at v1 (a future migration), this method becomes dead code and the v0 codec entry can be removed.

func (*Tx) InputIDs

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

InputIDs returns the set of inputs this transaction consumes

func (*Tx) SetBytes

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

func (tx *Tx) Size() int

func (*Tx) SyntacticVerify

func (tx *Tx) SyntacticVerify(rt *runtime.Runtime) error

func (*Tx) UTXOs

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

UTXOs returns the UTXOs transaction is producing.

type UnsignedTx

type UnsignedTx interface {
	// RuntimeInitializable is required for both platformvm and exchangevm
	// transaction types to share initialization logic.
	RuntimeInitializable
	secp256k1fx.UnsignedTx
	SetBytes(unsignedBytes []byte)

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

	Outputs() []*lux.TransferableOutput

	// Attempts to verify this transaction without any provided state.
	SyntacticVerify(rt *runtime.Runtime) error

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

UnsignedTx is an unsigned transaction

type Validator

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

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

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

func (*Validator) StartTime

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

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

func (*Validator) Verify

func (v *Validator) Verify() error

Verify validates the ID for this validator

func (*Validator) Weight

func (v *Validator) Weight() uint64

Weight is this validator's weight when sampling

type ValidatorNFTInfo added in v1.16.56

type ValidatorNFTInfo struct {
	ContractAddress string `json:"contractAddress"`
	TokenID         uint64 `json:"tokenId"`
	CollectionName  string `json:"collectionName"`
}

ValidatorNFTInfo contains NFT information for validator staking

type ValidatorTx

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 {
	AddValidatorTx(*AddValidatorTx) error
	AddChainValidatorTx(*AddChainValidatorTx) error
	AddDelegatorTx(*AddDelegatorTx) error
	CreateNetworkTx(*CreateNetworkTx) error
	CreateChainTx(*CreateChainTx) error
	ImportTx(*ImportTx) error
	ExportTx(*ExportTx) error
	AdvanceTimeTx(*AdvanceTimeTx) error
	RewardValidatorTx(*RewardValidatorTx) error

	RemoveChainValidatorTx(*RemoveChainValidatorTx) error
	TransformChainTx(*TransformChainTx) error
	AddPermissionlessValidatorTx(*AddPermissionlessValidatorTx) error
	AddPermissionlessDelegatorTx(*AddPermissionlessDelegatorTx) error

	TransferChainOwnershipTx(*TransferChainOwnershipTx) error
	BaseTx(*BaseTx) error

	ConvertNetworkToL1Tx(*ConvertNetworkToL1Tx) error
	// CreateSovereignL1Tx atomically registers a new sovereign L1
	// (network + genesis validators + chain manifest + manager-contract
	// handoff) in one tx. The single-step alternative to the legacy
	// CreateNetworkTx + AddChainValidatorTx ×N + CreateChainTx ×K +
	// ConvertNetworkToL1Tx flow. After commit, the primary network
	// neither track-chains nor validates the L1's blocks — the L1's
	// own validators run their own consensus from genesis.
	CreateSovereignL1Tx(*CreateSovereignL1Tx) error
	RegisterL1ValidatorTx(*RegisterL1ValidatorTx) error
	SetL1ValidatorWeightTx(*SetL1ValidatorWeightTx) error
	IncreaseL1ValidatorBalanceTx(*IncreaseL1ValidatorBalanceTx) error
	DisableL1ValidatorTx(*DisableL1ValidatorTx) error

	SlashValidatorTx(*SlashValidatorTx) error

	// P-only primary network — historically X-Chain
	// (kept on PlatformVM, opt-in for X-Chain when present):
	CreateAssetTx(*CreateAssetTx) error
	OperationTx(*OperationTx) error
}

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

Directories

Path Synopsis
Package builder is a generated GoMock package.
Package builder is a generated GoMock package.
Package fee implements gas complexity calculations for platform transactions.
Package fee implements gas complexity calculations for platform transactions.
Package mempool is a generated GoMock package.
Package mempool is a generated GoMock package.
mempoolmock
Package mempoolmock is a generated GoMock package.
Package mempoolmock is a generated GoMock package.
Package txsmock is a generated GoMock package.
Package txsmock is a generated GoMock package.

Jump to

Keyboard shortcuts

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