txs

package
v0.0.0-...-de82531 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: BSD-3-Clause Imports: 28 Imported by: 0

Documentation

Overview

Package txs is a generated GoMock package.

Package txs is a generated GoMock package.

Index

Constants

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

Variables

View Source
var (
	Codec codec.Manager

	// GenesisCodec allows txs of larger than usual size to be parsed.
	// While this gives flexibility in accommodating large genesis txs
	// it must not be used to parse new, unverified txs which instead
	// must be processed by Codec
	GenesisCodec codec.Manager
)
View Source
var (
	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 RemoveSupernetValidatorTx")
)
View Source
var (
	ErrTransferPermissionlessSupernet = errors.New("cannot transfer ownership of a permissionless supernet")
)
View Source
var (
	ErrWeightTooSmall = errors.New("weight of this validator is too low")
)
View Source
var (
	ErrWrongLocktime = errors.New("wrong locktime reported")
)

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 RegisterDUnsignedTxsTypes

func RegisterDUnsignedTxsTypes(targetCodec linearcodec.Codec) error

func RegisterUnsignedTxsTypes

func RegisterUnsignedTxsTypes(targetCodec linearcodec.Codec) error

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) ConsumedValue

func (tx *AddDelegatorTx) ConsumedValue(assetID ids.ID) uint64

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

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) SupernetID

func (*AddDelegatorTx) SupernetID() 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 supernet this validator is validating
	Supernet ids.ID `serialize:"true" json:"supernetID"`
	// 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) ConsumedValue

func (tx *AddPermissionlessDelegatorTx) ConsumedValue(assetID ids.ID) uint64

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 (*AddPermissionlessDelegatorTx) PendingPriority

func (tx *AddPermissionlessDelegatorTx) PendingPriority() Priority

func (*AddPermissionlessDelegatorTx) PublicKey

func (*AddPermissionlessDelegatorTx) RewardsOwner

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

func (*AddPermissionlessDelegatorTx) Stake

func (*AddPermissionlessDelegatorTx) SupernetID

func (tx *AddPermissionlessDelegatorTx) SupernetID() 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 supernet this validator is validating
	Supernet ids.ID `serialize:"true" json:"supernetID"`
	// If the [Supernet] is the primary network, [Signer] is the BLS key for this
	// validator. If the [Supernet] is not the primary network, this value is the
	// empty signer
	// Note: We do not enforce that the BLS key is unique across all validators.
	//       This means that validators can share a key if they so choose.
	//       However, a NodeID does uniquely map to a BLS key
	Signer signer.Signer `serialize:"true" json:"signer"`
	// Where to send staked tokens when done validating
	StakeOuts []*avax.TransferableOutput `serialize:"true" json:"stake"`
	// Where to send validation rewards when done validating
	ValidatorRewardsOwner fx.Owner `serialize:"true" json:"validationRewardsOwner"`
	// Where to send delegation rewards when done validating
	DelegatorRewardsOwner fx.Owner `serialize:"true" json:"delegationRewardsOwner"`
	// Fee this validator charges delegators as a percentage, times 10,000
	// For example, if this validator has DelegationShares=300,000 then they
	// take 30% of rewards from delegators
	DelegationShares uint32 `serialize:"true" json:"shares"`
}

AddPermissionlessValidatorTx is an unsigned addPermissionlessValidatorTx

func (*AddPermissionlessValidatorTx) ConsumedValue

func (tx *AddPermissionlessValidatorTx) ConsumedValue(assetID ids.ID) uint64

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 (*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) SupernetID

func (tx *AddPermissionlessValidatorTx) SupernetID() 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 AddSupernetValidatorTx

type AddSupernetValidatorTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// The validator
	SupernetValidator `serialize:"true" json:"validator"`
	// Auth that will be allowing this validator into the network
	SupernetAuth verify.Verifiable `serialize:"true" json:"supernetAuthorization"`
}

AddSupernetValidatorTx is an unsigned addSupernetValidatorTx

func (*AddSupernetValidatorTx) CurrentPriority

func (*AddSupernetValidatorTx) CurrentPriority() Priority

func (*AddSupernetValidatorTx) NodeID

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

func (*AddSupernetValidatorTx) PendingPriority

func (*AddSupernetValidatorTx) PendingPriority() Priority

func (*AddSupernetValidatorTx) PublicKey

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

func (*AddSupernetValidatorTx) SyntacticVerify

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

SyntacticVerify returns nil iff [tx] is valid

func (*AddSupernetValidatorTx) Visit

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

type AddValidatorTx

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

AddValidatorTx is an unsigned addValidatorTx

func (*AddValidatorTx) ConsumedValue

func (tx *AddValidatorTx) ConsumedValue(assetID ids.ID) uint64

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

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) SupernetID

func (*AddValidatorTx) SupernetID() 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) ConsumedValue

func (*AdvanceTimeTx) ConsumedValue(assetID ids.ID) uint64

func (*AdvanceTimeTx) InitCtx

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

func (*AdvanceTimeTx) InputIDs

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

func (*AdvanceTimeTx) Outputs

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

func (*AdvanceTimeTx) SetBytes

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

func (*AdvanceTimeTx) SyntacticVerify

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

func (*AdvanceTimeTx) Timestamp

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

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

func (*AdvanceTimeTx) Visit

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

type BaseTx

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

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

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

func (*BaseTx) Bytes

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

func (*BaseTx) ConsumedValue

func (tx *BaseTx) ConsumedValue(assetID ids.ID) uint64

func (*BaseTx) InitCtx

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

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

func (*BaseTx) InputIDs

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

func (*BaseTx) Outputs

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

func (*BaseTx) SetBytes

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

func (*BaseTx) SyntacticVerify

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

SyntacticVerify returns nil iff this tx is well formed

func (*BaseTx) Visit

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

type CreateChainTx

type CreateChainTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// ID of the Supernet that validates this blockchain
	SupernetID ids.ID `serialize:"true" json:"supernetID"`
	// A human readable name for the chain; need not be unique
	ChainName string `serialize:"true" json:"chainName"`
	// The main asset used by this chain to pay the fees
	ChainAssetID ids.ID `serialize:"true" json:"chainAssetID"`
	// 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 supernet
	SupernetAuth verify.Verifiable `serialize:"true" json:"supernetAuthorization"`
}

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 CreateSupernetTx

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

CreateSupernetTx is an unsigned proposal to create a new supernet

func (*CreateSupernetTx) InitCtx

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

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

func (*CreateSupernetTx) SyntacticVerify

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

SyntacticVerify verifies that this transaction is well-formed

func (*CreateSupernetTx) Visit

func (tx *CreateSupernetTx) 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) ConsumedValue

func (tx *ExportTx) ConsumedValue(assetID ids.ID) uint64

func (*ExportTx) InitCtx

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

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

func (*ExportTx) SyntacticVerify

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

SyntacticVerify this transaction is well-formed

func (*ExportTx) Visit

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

type ImportTx

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

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

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

ImportTx is an unsigned importTx

func (*ImportTx) ConsumedValue

func (tx *ImportTx) ConsumedValue(assetID ids.ID) uint64

func (*ImportTx) InitCtx

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

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

func (*ImportTx) InputIDs

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

func (*ImportTx) InputUTXOs

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

InputUTXOs returns the UTXOIDs of the imported funds

func (*ImportTx) SyntacticVerify

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

SyntacticVerify this transaction is well-formed

func (*ImportTx) Visit

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

type MockScheduledStaker

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

MockScheduledStaker is a mock of ScheduledStaker interface.

func NewMockScheduledStaker

func NewMockScheduledStaker(ctrl *gomock.Controller) *MockScheduledStaker

NewMockScheduledStaker creates a new mock instance.

func (*MockScheduledStaker) CurrentPriority

func (m *MockScheduledStaker) CurrentPriority() Priority

CurrentPriority mocks base method.

func (*MockScheduledStaker) EXPECT

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

func (*MockScheduledStaker) EndTime

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

EndTime mocks base method.

func (*MockScheduledStaker) NodeID

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

NodeID mocks base method.

func (*MockScheduledStaker) PendingPriority

func (m *MockScheduledStaker) PendingPriority() Priority

PendingPriority mocks base method.

func (*MockScheduledStaker) PublicKey

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

PublicKey mocks base method.

func (*MockScheduledStaker) StartTime

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

StartTime mocks base method.

func (*MockScheduledStaker) SupernetID

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

SupernetID mocks base method.

func (*MockScheduledStaker) Weight

func (m *MockScheduledStaker) Weight() uint64

Weight mocks base method.

type MockScheduledStakerMockRecorder

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

MockScheduledStakerMockRecorder is the mock recorder for MockScheduledStaker.

func (*MockScheduledStakerMockRecorder) CurrentPriority

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

CurrentPriority indicates an expected call of CurrentPriority.

func (*MockScheduledStakerMockRecorder) EndTime

EndTime indicates an expected call of EndTime.

func (*MockScheduledStakerMockRecorder) NodeID

NodeID indicates an expected call of NodeID.

func (*MockScheduledStakerMockRecorder) PendingPriority

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

PendingPriority indicates an expected call of PendingPriority.

func (*MockScheduledStakerMockRecorder) PublicKey

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

PublicKey indicates an expected call of PublicKey.

func (*MockScheduledStakerMockRecorder) StartTime

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

StartTime indicates an expected call of StartTime.

func (*MockScheduledStakerMockRecorder) SupernetID

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

SupernetID indicates an expected call of SupernetID.

func (*MockScheduledStakerMockRecorder) Weight

Weight indicates an expected call of Weight.

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) EndTime

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

EndTime mocks base method.

func (*MockStaker) NodeID

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

NodeID mocks base method.

func (*MockStaker) PublicKey

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

PublicKey mocks base method.

func (*MockStaker) SupernetID

func (m *MockStaker) SupernetID() ids.ID

SupernetID mocks base method.

func (*MockStaker) Weight

func (m *MockStaker) Weight() uint64

Weight 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) PublicKey

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

PublicKey indicates an expected call of PublicKey.

func (*MockStakerMockRecorder) SupernetID

func (mr *MockStakerMockRecorder) SupernetID() *gomock.Call

SupernetID indicates an expected call of SupernetID.

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) Bytes

func (m *MockUnsignedTx) Bytes() []byte

Bytes mocks base method.

func (*MockUnsignedTx) ConsumedValue

func (m *MockUnsignedTx) ConsumedValue(assetID ids.ID) uint64

ConsumedValue mocks base method.

func (*MockUnsignedTx) EXPECT

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

func (*MockUnsignedTx) InitCtx

func (m *MockUnsignedTx) InitCtx(ctx *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

func (m *MockUnsignedTx) SetBytes(unsignedBytes []byte)

SetBytes mocks base method.

func (*MockUnsignedTx) SyntacticVerify

func (m *MockUnsignedTx) SyntacticVerify(ctx *snow.Context) error

SyntacticVerify mocks base method.

func (*MockUnsignedTx) Visit

func (m *MockUnsignedTx) Visit(visitor 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) ConsumedValue

func (mr *MockUnsignedTxMockRecorder) ConsumedValue(assetID any) *gomock.Call

ConsumedValue indicates an expected call of ConsumedValue.

func (*MockUnsignedTxMockRecorder) InitCtx

func (mr *MockUnsignedTxMockRecorder) InitCtx(ctx any) *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

func (mr *MockUnsignedTxMockRecorder) SetBytes(unsignedBytes any) *gomock.Call

SetBytes indicates an expected call of SetBytes.

func (*MockUnsignedTxMockRecorder) SyntacticVerify

func (mr *MockUnsignedTxMockRecorder) SyntacticVerify(ctx any) *gomock.Call

SyntacticVerify indicates an expected call of SyntacticVerify.

func (*MockUnsignedTxMockRecorder) Visit

func (mr *MockUnsignedTxMockRecorder) Visit(visitor any) *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 supernet validators,
	SupernetPermissionlessValidatorPendingPriority
	// then permissionless supernet delegators.
	SupernetPermissionlessDelegatorPendingPriority
	// then permissioned supernet validators,
	SupernetPermissionedValidatorPendingPriority

	// First permissioned supernet 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.
	SupernetPermissionedValidatorCurrentPriority
	// then permissionless supernet delegators,
	SupernetPermissionlessDelegatorCurrentPriority
	// then permissionless supernet validators,
	SupernetPermissionlessValidatorCurrentPriority
	// 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 RemoveSupernetValidatorTx

type RemoveSupernetValidatorTx struct {
	BaseTx `serialize:"true"`
	// The node to remove from the supernet.
	NodeID ids.NodeID `serialize:"true" json:"nodeID"`
	// The supernet to remove the node from.
	Supernet ids.ID `serialize:"true" json:"supernetID"`
	// Proves that the issuer has the right to remove the node from the supernet.
	SupernetAuth verify.Verifiable `serialize:"true" json:"supernetAuthorization"`
}

Removes a validator from a supernet.

func (*RemoveSupernetValidatorTx) SyntacticVerify

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

func (*RemoveSupernetValidatorTx) Visit

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

type RewardValidatorTx

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

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

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

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

func (*RewardValidatorTx) Bytes

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

func (*RewardValidatorTx) ConsumedValue

func (*RewardValidatorTx) ConsumedValue(assetID ids.ID) uint64

func (*RewardValidatorTx) InitCtx

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

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(*snow.Context) error

func (*RewardValidatorTx) Visit

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

type ScheduledStaker

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

type Staker

type Staker interface {
	SupernetID() 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 SupernetValidator

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

	// ID of the supernet this validator is validating
	Supernet ids.ID `serialize:"true" json:"supernetID"`
}

SupernetValidator validates a supernet on the Avalanche network.

func (*SupernetValidator) SupernetID

func (v *SupernetValidator) SupernetID() ids.ID

SupernetID is the ID of the supernet this validator is validating

func (*SupernetValidator) Verify

func (v *SupernetValidator) Verify() error

Verify this validator is valid

type TransferSupernetOwnershipTx

type TransferSupernetOwnershipTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// ID of the supernet this tx is modifying
	Supernet ids.ID `serialize:"true" json:"supernetID"`
	// Proves that the issuer has the right to remove the node from the supernet.
	SupernetAuth verify.Verifiable `serialize:"true" json:"supernetAuthorization"`
	// Who is now authorized to manage this supernet
	Owner fx.Owner `serialize:"true" json:"newOwner"`
}

func (*TransferSupernetOwnershipTx) InitCtx

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

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

func (*TransferSupernetOwnershipTx) SyntacticVerify

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

func (*TransferSupernetOwnershipTx) Visit

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

type TransformSupernetTx

type TransformSupernetTx struct {
	// Metadata, inputs and outputs
	BaseTx `serialize:"true"`
	// ID of the Supernet to transform
	// Restrictions:
	// - Must not be the Primary Network ID
	Supernet ids.ID `serialize:"true" json:"supernetID"`
	// Asset to use when staking on the Supernet
	// Restrictions:
	// - Must not be the Empty ID
	// - Must not be the AVAX ID
	AssetID ids.ID `serialize:"true" json:"assetID"`
	// Amount to specify as the amount of rewards that will be initially
	// available in the reward pool of the supernet.
	InitialRewardPoolSupply uint64 `serialize:"true" json:"initialRewardPoolSupply"`
	// StartRewardShare is the starting share of rewards given to validators.
	// Restrictions:
	// - Must be > 0
	// - Must be <= [reward.PercentDenominator]
	StartRewardShare uint64 `serialize:"true" json:"startRewardShare"`
	// StartRewardTime is the starting timestamp that will be used to calculate
	// the remaining percentage of rewards given to validators.
	// Restrictions:
	// - Must be > 0
	// - Must be <= [TargetRewardTime]
	StartRewardTime uint64 `serialize:"true" json:"startRewardTime"`
	// DiminishingRewardShare is the share of rewards given to validators at the start of diminishing year.
	// Restrictions:
	// - Must be > 0
	// - Must be <= [StartRewardShare]
	DiminishingRewardShare uint64 `serialize:"true" json:"diminishingRewardShare"`
	// DiminishingRewardTime is the target timestamp that will be used to calculate
	// the remaining percentage of rewards given to validators.
	// Restrictions:
	// - Must be >= [StartRewardTime]
	DiminishingRewardTime uint64 `serialize:"true" json:"diminishingRewardTime"`
	// TargetRewardShare is the target final share of rewards given to validators.
	// Restrictions:
	// - Must be > 0
	// - Must be <= [DiminishingRewardShare]
	TargetRewardShare uint64 `serialize:"true" json:"targetRewardShare"`
	// TargetRewardTime is the target timestamp that will be used to calculate
	// the remaining percentage of rewards given to validators.
	// Restrictions:
	// - Must be >= [DiminishingRewardTime]
	TargetRewardTime uint64 `serialize:"true" json:"targetRewardTime"`
	// 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"`
	// StakePeriodRewardShare is the maximum period reward given for a
	// stake period equal to MaxStakePeriod.
	// Restrictions:
	// - Must be > 0
	// - Must be <= [reward.PercentDenominator]
	StakePeriodRewardShare uint64 `serialize:"true" json:"stakePeriodRewardShare"`
	// MinDelegationFee is the minimum percentage a validator must charge a
	// delegator for delegating.
	// Restrictions:
	// - Must be <= [MaxDelegationFee]
	MinDelegationFee uint32 `serialize:"true" json:"minDelegationFee"`
	// MaxDelegationFee is the minimum percentage a validator must charge a
	// delegator for delegating.
	// Restrictions:
	// - Must be <= [reward.PercentDenominator]
	MaxDelegationFee uint32 `serialize:"true" json:"maxDelegationFee"`
	// 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
	SupernetAuth verify.Verifiable `serialize:"true" json:"supernetAuthorization"`
}

TransformSupernetTx is an unsigned transformSupernetTx

func (*TransformSupernetTx) SyntacticVerify

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

func (*TransformSupernetTx) Visit

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

type Tx

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

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

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

Tx is a signed transaction

func NewSigned

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

func Parse

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

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

func (*Tx) Bytes

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

func (*Tx) GossipID

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

func (*Tx) ID

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

func (*Tx) Initialize

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

func (*Tx) 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) SyntacticVerify

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

func (*Tx) UTXOs

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

UTXOs returns the UTXOs transaction is producing.

type UnsignedTx

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

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

	// ConsumedValue returns the amount consumed by this transaction to pay the fee.
	ConsumedValue(assetID ids.ID) uint64

	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) 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 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
	AddSupernetValidatorTx(*AddSupernetValidatorTx) error
	AddDelegatorTx(*AddDelegatorTx) error
	CreateChainTx(*CreateChainTx) error
	CreateSupernetTx(*CreateSupernetTx) error
	ImportTx(*ImportTx) error
	ExportTx(*ExportTx) error
	AdvanceTimeTx(*AdvanceTimeTx) error
	RewardValidatorTx(*RewardValidatorTx) error
	RemoveSupernetValidatorTx(*RemoveSupernetValidatorTx) error
	TransformSupernetTx(*TransformSupernetTx) error
	AddPermissionlessValidatorTx(*AddPermissionlessValidatorTx) error
	AddPermissionlessDelegatorTx(*AddPermissionlessDelegatorTx) error
	TransferSupernetOwnershipTx(*TransferSupernetOwnershipTx) error
	BaseTx(*BaseTx) error
}

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

Directories

Path Synopsis
Package mempool is a generated GoMock package.
Package mempool is a generated GoMock package.

Jump to

Keyboard shortcuts

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