Documentation ¶
Overview ¶
Package txs is a generated GoMock package.
Package txs is a generated GoMock package.
Index ¶
- Constants
- Variables
- func RegisterUnsignedTxsTypes(targetCodec codec.Registry) error
- type AddDelegatorTx
- func (*AddDelegatorTx) CurrentPriority() Priority
- func (tx *AddDelegatorTx) InitCtx(ctx *snow.Context)
- func (tx *AddDelegatorTx) NodeID() ids.NodeID
- func (*AddDelegatorTx) PendingPriority() Priority
- func (*AddDelegatorTx) PublicKey() (*bls.PublicKey, bool, error)
- func (tx *AddDelegatorTx) RewardsOwner() fx.Owner
- func (tx *AddDelegatorTx) Stake() []*avax.TransferableOutput
- func (*AddDelegatorTx) SubnetID() ids.ID
- func (tx *AddDelegatorTx) SyntacticVerify(ctx *snow.Context) error
- func (tx *AddDelegatorTx) Visit(visitor Visitor) error
- type AddPermissionlessDelegatorTx
- func (tx *AddPermissionlessDelegatorTx) CurrentPriority() Priority
- func (tx *AddPermissionlessDelegatorTx) InitCtx(ctx *snow.Context)
- func (tx *AddPermissionlessDelegatorTx) NodeID() ids.NodeID
- func (tx *AddPermissionlessDelegatorTx) PendingPriority() Priority
- func (*AddPermissionlessDelegatorTx) PublicKey() (*bls.PublicKey, bool, error)
- func (tx *AddPermissionlessDelegatorTx) RewardsOwner() fx.Owner
- func (tx *AddPermissionlessDelegatorTx) Stake() []*avax.TransferableOutput
- func (tx *AddPermissionlessDelegatorTx) SubnetID() ids.ID
- func (tx *AddPermissionlessDelegatorTx) SyntacticVerify(ctx *snow.Context) error
- func (tx *AddPermissionlessDelegatorTx) Visit(visitor Visitor) error
- type AddPermissionlessValidatorTx
- func (tx *AddPermissionlessValidatorTx) CurrentPriority() Priority
- func (tx *AddPermissionlessValidatorTx) DelegationRewardsOwner() fx.Owner
- func (tx *AddPermissionlessValidatorTx) InitCtx(ctx *snow.Context)
- func (tx *AddPermissionlessValidatorTx) NodeID() ids.NodeID
- func (tx *AddPermissionlessValidatorTx) PendingPriority() Priority
- func (tx *AddPermissionlessValidatorTx) PublicKey() (*bls.PublicKey, bool, error)
- func (tx *AddPermissionlessValidatorTx) Shares() uint32
- func (tx *AddPermissionlessValidatorTx) Stake() []*avax.TransferableOutput
- func (tx *AddPermissionlessValidatorTx) SubnetID() ids.ID
- func (tx *AddPermissionlessValidatorTx) SyntacticVerify(ctx *snow.Context) error
- func (tx *AddPermissionlessValidatorTx) ValidationRewardsOwner() fx.Owner
- func (tx *AddPermissionlessValidatorTx) Visit(visitor Visitor) error
- type AddSubnetValidatorTx
- func (*AddSubnetValidatorTx) CurrentPriority() Priority
- func (tx *AddSubnetValidatorTx) NodeID() ids.NodeID
- func (*AddSubnetValidatorTx) PendingPriority() Priority
- func (*AddSubnetValidatorTx) PublicKey() (*bls.PublicKey, bool, error)
- func (tx *AddSubnetValidatorTx) SyntacticVerify(ctx *snow.Context) error
- func (tx *AddSubnetValidatorTx) Visit(visitor Visitor) error
- type AddValidatorTx
- func (*AddValidatorTx) CurrentPriority() Priority
- func (tx *AddValidatorTx) DelegationRewardsOwner() fx.Owner
- func (tx *AddValidatorTx) InitCtx(ctx *snow.Context)
- func (tx *AddValidatorTx) NodeID() ids.NodeID
- func (*AddValidatorTx) PendingPriority() Priority
- func (*AddValidatorTx) PublicKey() (*bls.PublicKey, bool, error)
- func (tx *AddValidatorTx) Shares() uint32
- func (tx *AddValidatorTx) Stake() []*avax.TransferableOutput
- func (*AddValidatorTx) SubnetID() ids.ID
- func (tx *AddValidatorTx) SyntacticVerify(ctx *snow.Context) error
- func (tx *AddValidatorTx) ValidationRewardsOwner() fx.Owner
- func (tx *AddValidatorTx) Visit(visitor Visitor) error
- type AdvanceTimeTx
- func (tx *AdvanceTimeTx) Bytes() []byte
- func (*AdvanceTimeTx) InitCtx(*snow.Context)
- func (*AdvanceTimeTx) InputIDs() set.Set[ids.ID]
- func (*AdvanceTimeTx) Outputs() []*avax.TransferableOutput
- func (tx *AdvanceTimeTx) SetBytes(unsignedBytes []byte)
- func (*AdvanceTimeTx) SyntacticVerify(*snow.Context) error
- func (tx *AdvanceTimeTx) Timestamp() time.Time
- func (tx *AdvanceTimeTx) Visit(visitor Visitor) error
- type BaseTx
- type CreateChainTx
- type CreateSubnetTx
- type DelegatorTx
- type ExportTx
- type ImportTx
- type MockStaker
- func (m *MockStaker) CurrentPriority() Priority
- func (m *MockStaker) EXPECT() *MockStakerMockRecorder
- func (m *MockStaker) EndTime() time.Time
- func (m *MockStaker) NodeID() ids.NodeID
- func (m *MockStaker) PendingPriority() Priority
- func (m *MockStaker) PublicKey() (*bls.PublicKey, bool, error)
- func (m *MockStaker) StartTime() time.Time
- func (m *MockStaker) SubnetID() ids.ID
- func (m *MockStaker) Weight() uint64
- type MockStakerMockRecorder
- func (mr *MockStakerMockRecorder) CurrentPriority() *gomock.Call
- func (mr *MockStakerMockRecorder) EndTime() *gomock.Call
- func (mr *MockStakerMockRecorder) NodeID() *gomock.Call
- func (mr *MockStakerMockRecorder) PendingPriority() *gomock.Call
- func (mr *MockStakerMockRecorder) PublicKey() *gomock.Call
- func (mr *MockStakerMockRecorder) StartTime() *gomock.Call
- func (mr *MockStakerMockRecorder) SubnetID() *gomock.Call
- func (mr *MockStakerMockRecorder) Weight() *gomock.Call
- type MockUnsignedTx
- func (m *MockUnsignedTx) Bytes() []byte
- func (m *MockUnsignedTx) EXPECT() *MockUnsignedTxMockRecorder
- func (m *MockUnsignedTx) InitCtx(arg0 *snow.Context)
- func (m *MockUnsignedTx) InputIDs() set.Set[ids.ID]
- func (m *MockUnsignedTx) Outputs() []*avax.TransferableOutput
- func (m *MockUnsignedTx) SetBytes(arg0 []byte)
- func (m *MockUnsignedTx) SyntacticVerify(arg0 *snow.Context) error
- func (m *MockUnsignedTx) Visit(arg0 Visitor) error
- type MockUnsignedTxMockRecorder
- func (mr *MockUnsignedTxMockRecorder) Bytes() *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) InitCtx(arg0 interface{}) *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) InputIDs() *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) Outputs() *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) SetBytes(arg0 interface{}) *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) SyntacticVerify(arg0 interface{}) *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) Visit(arg0 interface{}) *gomock.Call
- type PermissionlessStaker
- type Priority
- func (p Priority) IsCurrent() bool
- func (p Priority) IsCurrentDelegator() bool
- func (p Priority) IsCurrentValidator() bool
- func (p Priority) IsDelegator() bool
- func (p Priority) IsPending() bool
- func (p Priority) IsPendingDelegator() bool
- func (p Priority) IsPendingValidator() bool
- func (p Priority) IsPermissionedValidator() bool
- func (p Priority) IsValidator() bool
- type RemoveSubnetValidatorTx
- type RewardValidatorTx
- func (tx *RewardValidatorTx) Bytes() []byte
- func (*RewardValidatorTx) InitCtx(*snow.Context)
- func (*RewardValidatorTx) InputIDs() set.Set[ids.ID]
- func (*RewardValidatorTx) Outputs() []*avax.TransferableOutput
- func (tx *RewardValidatorTx) SetBytes(unsignedBytes []byte)
- func (*RewardValidatorTx) SyntacticVerify(*snow.Context) error
- func (tx *RewardValidatorTx) Visit(visitor Visitor) error
- type Staker
- type StakerTx
- type SubnetValidator
- type TransformSubnetTx
- type Tx
- func (tx *Tx) Bytes() []byte
- func (tx *Tx) ID() ids.ID
- func (tx *Tx) Initialize(c codec.Manager) error
- func (tx *Tx) SetBytes(unsignedBytes, signedBytes []byte)
- func (tx *Tx) Sign(c codec.Manager, signers [][]*secp256k1.PrivateKey) error
- func (tx *Tx) Size() int
- func (tx *Tx) SyntacticVerify(ctx *snow.Context) error
- func (tx *Tx) UTXOs() []*avax.UTXO
- type UnsignedTx
- type Validator
- type ValidatorTx
- type Visitor
Constants ¶
const ( MaxNameLen = 128 MaxGenesisLen = units.MiB )
const Version = 0
Version is the current default codec version
Variables ¶
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 )
var (
ErrCantValidatePrimaryNetwork = errors.New("new blockchain can't be validated by primary network")
)
var (
ErrNilSignedTx = errors.New("nil signed tx is not valid")
)
var (
ErrNilTx = errors.New("tx is nil")
)
var (
ErrRemovePrimaryNetworkValidator = errors.New("can't remove primary network validator with RemoveSubnetValidatorTx")
)
var (
ErrWeightTooSmall = errors.New("weight of this validator is too low")
)
var (
ErrWrongLocktime = errors.New("wrong locktime reported")
)
var PendingToCurrentPriorities = []Priority{ PrimaryNetworkDelegatorApricotPendingPriority: PrimaryNetworkDelegatorCurrentPriority, PrimaryNetworkValidatorPendingPriority: PrimaryNetworkValidatorCurrentPriority, PrimaryNetworkDelegatorBanffPendingPriority: PrimaryNetworkDelegatorCurrentPriority, SubnetPermissionlessValidatorPendingPriority: SubnetPermissionlessValidatorCurrentPriority, SubnetPermissionlessDelegatorPendingPriority: SubnetPermissionlessDelegatorCurrentPriority, SubnetPermissionedValidatorPendingPriority: SubnetPermissionedValidatorCurrentPriority, }
Functions ¶
func RegisterUnsignedTxsTypes ¶
RegisterUnsignedTxsTypes allows registering relevant type of unsigned package in the right sequence. Following repackaging of platformvm package, a few subpackage-level codecs were introduced, each handling serialization of specific types. RegisterUnsignedTxsTypes is made exportable so to guarantee that other codecs are coherent with components one.
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 ¶
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 ¶
func (tx *AddDelegatorTx) NodeID() ids.NodeID
func (*AddDelegatorTx) PendingPriority ¶
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 ¶
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 ¶
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 ¶
func (tx *AddPermissionlessDelegatorTx) CurrentPriority() Priority
func (*AddPermissionlessDelegatorTx) InitCtx ¶
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 ¶
func (tx *AddPermissionlessDelegatorTx) NodeID() ids.NodeID
func (*AddPermissionlessDelegatorTx) PendingPriority ¶
func (tx *AddPermissionlessDelegatorTx) PendingPriority() Priority
func (*AddPermissionlessDelegatorTx) PublicKey ¶ added in v1.9.2
func (*AddPermissionlessDelegatorTx) PublicKey() (*bls.PublicKey, bool, error)
func (*AddPermissionlessDelegatorTx) RewardsOwner ¶
func (tx *AddPermissionlessDelegatorTx) RewardsOwner() fx.Owner
func (*AddPermissionlessDelegatorTx) Stake ¶
func (tx *AddPermissionlessDelegatorTx) Stake() []*avax.TransferableOutput
func (*AddPermissionlessDelegatorTx) SubnetID ¶
func (tx *AddPermissionlessDelegatorTx) SubnetID() ids.ID
func (*AddPermissionlessDelegatorTx) SyntacticVerify ¶
func (tx *AddPermissionlessDelegatorTx) SyntacticVerify(ctx *snow.Context) 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 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"` // 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 ¶
func (tx *AddPermissionlessValidatorTx) CurrentPriority() Priority
func (*AddPermissionlessValidatorTx) DelegationRewardsOwner ¶
func (tx *AddPermissionlessValidatorTx) DelegationRewardsOwner() fx.Owner
func (*AddPermissionlessValidatorTx) InitCtx ¶
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 ¶
func (tx *AddPermissionlessValidatorTx) NodeID() ids.NodeID
func (*AddPermissionlessValidatorTx) PendingPriority ¶
func (tx *AddPermissionlessValidatorTx) PendingPriority() Priority
func (*AddPermissionlessValidatorTx) PublicKey ¶ added in v1.9.2
func (tx *AddPermissionlessValidatorTx) PublicKey() (*bls.PublicKey, bool, error)
func (*AddPermissionlessValidatorTx) Shares ¶
func (tx *AddPermissionlessValidatorTx) Shares() uint32
func (*AddPermissionlessValidatorTx) Stake ¶
func (tx *AddPermissionlessValidatorTx) Stake() []*avax.TransferableOutput
func (*AddPermissionlessValidatorTx) SubnetID ¶
func (tx *AddPermissionlessValidatorTx) SubnetID() ids.ID
func (*AddPermissionlessValidatorTx) SyntacticVerify ¶
func (tx *AddPermissionlessValidatorTx) SyntacticVerify(ctx *snow.Context) 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 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 ¶
func (*AddSubnetValidatorTx) CurrentPriority() Priority
func (*AddSubnetValidatorTx) NodeID ¶
func (tx *AddSubnetValidatorTx) NodeID() ids.NodeID
func (*AddSubnetValidatorTx) PendingPriority ¶
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"` // 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 ¶
func (*AddValidatorTx) CurrentPriority() Priority
func (*AddValidatorTx) DelegationRewardsOwner ¶
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 ¶
func (tx *AddValidatorTx) NodeID() ids.NodeID
func (*AddValidatorTx) PendingPriority ¶
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 ¶
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 ¶
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) 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) InitCtx ¶
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) Outputs ¶
func (tx *BaseTx) Outputs() []*avax.TransferableOutput
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 ¶
type DelegatorTx interface { UnsignedTx PermissionlessStaker RewardsOwner() fx.Owner }
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 ¶
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 ¶
SyntacticVerify this transaction is well-formed
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 ¶
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) InputUTXOs ¶
InputUTXOs returns the UTXOIDs of the imported funds
func (*ImportTx) SyntacticVerify ¶
SyntacticVerify this transaction is well-formed
type MockStaker ¶
type MockStaker struct {
// contains filtered or unexported fields
}
MockStaker is a mock of Staker interface.
func NewMockStaker ¶
func NewMockStaker(ctrl *gomock.Controller) *MockStaker
NewMockStaker creates a new mock instance.
func (*MockStaker) CurrentPriority ¶
func (m *MockStaker) CurrentPriority() Priority
CurrentPriority mocks base method.
func (*MockStaker) EXPECT ¶
func (m *MockStaker) EXPECT() *MockStakerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockStaker) PendingPriority ¶
func (m *MockStaker) PendingPriority() Priority
PendingPriority mocks base method.
func (*MockStaker) PublicKey ¶ added in v1.9.2
func (m *MockStaker) PublicKey() (*bls.PublicKey, bool, error)
PublicKey mocks base method.
func (*MockStaker) StartTime ¶
func (m *MockStaker) StartTime() time.Time
StartTime mocks base method.
type MockStakerMockRecorder ¶
type MockStakerMockRecorder struct {
// contains filtered or unexported fields
}
MockStakerMockRecorder is the mock recorder for MockStaker.
func (*MockStakerMockRecorder) CurrentPriority ¶
func (mr *MockStakerMockRecorder) CurrentPriority() *gomock.Call
CurrentPriority indicates an expected call of CurrentPriority.
func (*MockStakerMockRecorder) EndTime ¶
func (mr *MockStakerMockRecorder) EndTime() *gomock.Call
EndTime indicates an expected call of EndTime.
func (*MockStakerMockRecorder) NodeID ¶
func (mr *MockStakerMockRecorder) NodeID() *gomock.Call
NodeID indicates an expected call of NodeID.
func (*MockStakerMockRecorder) PendingPriority ¶
func (mr *MockStakerMockRecorder) PendingPriority() *gomock.Call
PendingPriority indicates an expected call of PendingPriority.
func (*MockStakerMockRecorder) PublicKey ¶ added in v1.9.2
func (mr *MockStakerMockRecorder) PublicKey() *gomock.Call
PublicKey indicates an expected call of PublicKey.
func (*MockStakerMockRecorder) StartTime ¶
func (mr *MockStakerMockRecorder) StartTime() *gomock.Call
StartTime indicates an expected call of StartTime.
func (*MockStakerMockRecorder) SubnetID ¶
func (mr *MockStakerMockRecorder) SubnetID() *gomock.Call
SubnetID indicates an expected call of SubnetID.
func (*MockStakerMockRecorder) Weight ¶
func (mr *MockStakerMockRecorder) Weight() *gomock.Call
Weight indicates an expected call of Weight.
type MockUnsignedTx ¶
type MockUnsignedTx struct {
// contains filtered or unexported fields
}
MockUnsignedTx is a mock of UnsignedTx interface.
func NewMockUnsignedTx ¶
func NewMockUnsignedTx(ctrl *gomock.Controller) *MockUnsignedTx
NewMockUnsignedTx creates a new mock instance.
func (*MockUnsignedTx) EXPECT ¶
func (m *MockUnsignedTx) EXPECT() *MockUnsignedTxMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockUnsignedTx) InitCtx ¶
func (m *MockUnsignedTx) InitCtx(arg0 *snow.Context)
InitCtx mocks base method.
func (*MockUnsignedTx) InputIDs ¶
func (m *MockUnsignedTx) InputIDs() set.Set[ids.ID]
InputIDs mocks base method.
func (*MockUnsignedTx) Outputs ¶
func (m *MockUnsignedTx) Outputs() []*avax.TransferableOutput
Outputs mocks base method.
func (*MockUnsignedTx) SetBytes ¶ added in v1.9.5
func (m *MockUnsignedTx) SetBytes(arg0 []byte)
SetBytes mocks base method.
func (*MockUnsignedTx) SyntacticVerify ¶
func (m *MockUnsignedTx) SyntacticVerify(arg0 *snow.Context) error
SyntacticVerify mocks base method.
func (*MockUnsignedTx) Visit ¶
func (m *MockUnsignedTx) Visit(arg0 Visitor) error
Visit mocks base method.
type MockUnsignedTxMockRecorder ¶
type MockUnsignedTxMockRecorder struct {
// contains filtered or unexported fields
}
MockUnsignedTxMockRecorder is the mock recorder for MockUnsignedTx.
func (*MockUnsignedTxMockRecorder) Bytes ¶
func (mr *MockUnsignedTxMockRecorder) Bytes() *gomock.Call
Bytes indicates an expected call of Bytes.
func (*MockUnsignedTxMockRecorder) InitCtx ¶
func (mr *MockUnsignedTxMockRecorder) InitCtx(arg0 interface{}) *gomock.Call
InitCtx indicates an expected call of InitCtx.
func (*MockUnsignedTxMockRecorder) InputIDs ¶
func (mr *MockUnsignedTxMockRecorder) InputIDs() *gomock.Call
InputIDs indicates an expected call of InputIDs.
func (*MockUnsignedTxMockRecorder) Outputs ¶
func (mr *MockUnsignedTxMockRecorder) Outputs() *gomock.Call
Outputs indicates an expected call of Outputs.
func (*MockUnsignedTxMockRecorder) SetBytes ¶ added in v1.9.5
func (mr *MockUnsignedTxMockRecorder) SetBytes(arg0 interface{}) *gomock.Call
SetBytes indicates an expected call of SetBytes.
func (*MockUnsignedTxMockRecorder) SyntacticVerify ¶
func (mr *MockUnsignedTxMockRecorder) SyntacticVerify(arg0 interface{}) *gomock.Call
SyntacticVerify indicates an expected call of SyntacticVerify.
func (*MockUnsignedTxMockRecorder) Visit ¶
func (mr *MockUnsignedTxMockRecorder) Visit(arg0 interface{}) *gomock.Call
Visit indicates an expected call of Visit.
type PermissionlessStaker ¶
type PermissionlessStaker interface { Staker Outputs() []*avax.TransferableOutput Stake() []*avax.TransferableOutput }
type Priority ¶
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) IsCurrentDelegator ¶ added in v1.10.1
func (Priority) IsCurrentValidator ¶ added in v1.10.1
func (Priority) IsDelegator ¶ added in v1.10.1
func (Priority) IsPendingDelegator ¶ added in v1.10.1
func (Priority) IsPendingValidator ¶ added in v1.10.1
func (Priority) IsPermissionedValidator ¶ added in v1.10.1
func (Priority) IsValidator ¶ added in v1.10.1
type RemoveSubnetValidatorTx ¶
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 ¶
func (tx *RemoveSubnetValidatorTx) SyntacticVerify(ctx *snow.Context) error
func (*RemoveSubnetValidatorTx) Visit ¶
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"` // Marks if this validator should be rewarded according to this node. ShouldPreferCommit bool `json:"-"` // 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) Outputs ¶
func (*RewardValidatorTx) Outputs() []*avax.TransferableOutput
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 Staker ¶
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) StartTime() time.Time EndTime() time.Time Weight() uint64 PendingPriority() Priority 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 TransformSubnetTx ¶
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 ¶
func (tx *TransformSubnetTx) SyntacticVerify(ctx *snow.Context) error
func (*TransformSubnetTx) Visit ¶
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 ¶
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.
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 ¶
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) BoundedBy ¶ added in v1.9.10
BoundedBy returns true iff the period that [validator] validates is a (non-strict) subset of the time that [other] validates. Namely, startTime <= v.StartTime() <= v.EndTime() <= endTime
func (*Validator) Duration ¶ added in v1.9.10
Duration is the amount of time that this validator will be in the validator set
func (*Validator) EndTime ¶ added in v1.9.10
EndTime is the time that this validator will leave the validator set
func (*Validator) StartTime ¶ added in v1.9.10
StartTime is the time that this validator will enter the validator set
type ValidatorTx ¶
type ValidatorTx interface { UnsignedTx PermissionlessStaker ValidationRewardsOwner() fx.Owner DelegationRewardsOwner() fx.Owner }
ValidatorTx defines the interface for a validator transaction that supports delegation.
type Visitor ¶
type Visitor interface { 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 RemoveSubnetValidatorTx(*RemoveSubnetValidatorTx) error TransformSubnetTx(*TransformSubnetTx) error AddPermissionlessValidatorTx(*AddPermissionlessValidatorTx) error AddPermissionlessDelegatorTx(*AddPermissionlessDelegatorTx) error }
Allow vm to execute custom logic against the underlying transaction types.
Source Files ¶
- add_delegator_tx.go
- add_permissionless_delegator_tx.go
- add_permissionless_validator_tx.go
- add_subnet_validator_tx.go
- add_validator_tx.go
- advance_time_tx.go
- base_tx.go
- codec.go
- create_chain_tx.go
- create_subnet_tx.go
- export_tx.go
- import_tx.go
- mock_staker.go
- mock_unsigned_tx.go
- priorities.go
- remove_subnet_validator_tx.go
- reward_validator_tx.go
- staker_tx.go
- subnet_validator.go
- transform_subnet_tx.go
- tx.go
- unsigned_tx.go
- validator.go
- visitor.go