Documentation ¶
Overview ¶
Package txs is a generated GoMock package.
Index ¶
- Constants
- Variables
- func RegisterUnsignedTxsTypes(targetCodec codec.Registry) error
- type AddDelegatorTx
- func (tx *AddDelegatorTx) EndTime() time.Time
- func (tx *AddDelegatorTx) InitCtx(ctx *snow.Context)
- func (tx *AddDelegatorTx) StartTime() time.Time
- func (tx *AddDelegatorTx) SyntacticVerify(ctx *snow.Context) error
- func (tx *AddDelegatorTx) Visit(visitor Visitor) error
- func (tx *AddDelegatorTx) Weight() uint64
- type AddSubnetValidatorTx
- type AddValidatorTx
- func (tx *AddValidatorTx) EndTime() time.Time
- func (tx *AddValidatorTx) InitCtx(ctx *snow.Context)
- func (tx *AddValidatorTx) StartTime() time.Time
- func (tx *AddValidatorTx) SyntacticVerify(ctx *snow.Context) error
- func (tx *AddValidatorTx) Visit(visitor Visitor) error
- func (tx *AddValidatorTx) Weight() uint64
- type AdvanceTimeTx
- func (tx *AdvanceTimeTx) Bytes() []byte
- func (tx *AdvanceTimeTx) InitCtx(*snow.Context)
- func (tx *AdvanceTimeTx) Initialize(unsignedBytes []byte)
- func (tx *AdvanceTimeTx) InputIDs() ids.Set
- func (tx *AdvanceTimeTx) Outputs() []*avax.TransferableOutput
- func (tx *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 ExportTx
- type ImportTx
- type MockUnsignedTx
- func (m *MockUnsignedTx) Bytes() []byte
- func (m *MockUnsignedTx) EXPECT() *MockUnsignedTxMockRecorder
- func (m *MockUnsignedTx) InitCtx(arg0 *snow.Context)
- func (m *MockUnsignedTx) Initialize(arg0 []byte)
- func (m *MockUnsignedTx) InputIDs() ids.Set
- func (m *MockUnsignedTx) Outputs() []*avax.TransferableOutput
- 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) Initialize(arg0 interface{}) *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) InputIDs() *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) Outputs() *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) SyntacticVerify(arg0 interface{}) *gomock.Call
- func (mr *MockUnsignedTxMockRecorder) Visit(arg0 interface{}) *gomock.Call
- type RewardValidatorTx
- func (tx *RewardValidatorTx) Bytes() []byte
- func (tx *RewardValidatorTx) InitCtx(*snow.Context)
- func (tx *RewardValidatorTx) Initialize(unsignedBytes []byte)
- func (tx *RewardValidatorTx) InputIDs() ids.Set
- func (tx *RewardValidatorTx) Outputs() []*avax.TransferableOutput
- func (tx *RewardValidatorTx) SyntacticVerify(*snow.Context) error
- func (tx *RewardValidatorTx) Visit(visitor Visitor) error
- type StakerTx
- type Tx
- type UnsignedTx
- type Visitor
Constants ¶
const ( MaxNameLen = 128 MaxGenesisLen = units.MiB )
const Version = 0
Version is the current default codec version
Variables ¶
var Codec codec.Manager
Codec does serialization and deserialization
var (
ErrCantValidatePrimaryNetwork = errors.New("new blockchain can't be validated by primary network")
)
var (
ErrNilTx = errors.New("tx is nil")
)
var (
ErrWrongLocktime = errors.New("wrong locktime reported")
)
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 validator.Validator `serialize:"true" json:"validator"` // Where to send staked tokens when done validating Stake []*avax.TransferableOutput `serialize:"true" json:"stake"` // Where to send staking rewards when done validating RewardsOwner fx.Owner `serialize:"true" json:"rewardsOwner"` }
AddDelegatorTx is an unsigned addDelegatorTx
func (*AddDelegatorTx) EndTime ¶
func (tx *AddDelegatorTx) EndTime() time.Time
EndTime of this validator
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) StartTime ¶
func (tx *AddDelegatorTx) StartTime() time.Time
StartTime of this validator
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 AddSubnetValidatorTx ¶
type AddSubnetValidatorTx struct { // Metadata, inputs and outputs BaseTx `serialize:"true"` // The validator Validator 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) EndTime ¶
func (tx *AddSubnetValidatorTx) EndTime() time.Time
EndTime of this validator
func (*AddSubnetValidatorTx) StartTime ¶
func (tx *AddSubnetValidatorTx) StartTime() time.Time
StartTime of this validator
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
func (*AddSubnetValidatorTx) Weight ¶
func (tx *AddSubnetValidatorTx) Weight() uint64
Weight of this validator
type AddValidatorTx ¶
type AddValidatorTx struct { // Metadata, inputs and outputs BaseTx `serialize:"true"` // Describes the delegatee Validator validator.Validator `serialize:"true" json:"validator"` // Where to send staked tokens when done validating Stake []*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 Shares=300,000 then they take 30% of rewards from delegators Shares uint32 `serialize:"true" json:"shares"` }
AddValidatorTx is an unsigned addValidatorTx
func (*AddValidatorTx) EndTime ¶
func (tx *AddValidatorTx) EndTime() time.Time
EndTime of this validator
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) StartTime ¶
func (tx *AddValidatorTx) StartTime() time.Time
StartTime of this validator
func (*AddValidatorTx) SyntacticVerify ¶
func (tx *AddValidatorTx) SyntacticVerify(ctx *snow.Context) error
SyntacticVerify returns nil iff [tx] is valid
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 (tx *AdvanceTimeTx) InitCtx(*snow.Context)
func (*AdvanceTimeTx) Initialize ¶
func (tx *AdvanceTimeTx) Initialize(unsignedBytes []byte)
func (*AdvanceTimeTx) InputIDs ¶
func (tx *AdvanceTimeTx) InputIDs() ids.Set
func (*AdvanceTimeTx) Outputs ¶
func (tx *AdvanceTimeTx) Outputs() []*avax.TransferableOutput
func (*AdvanceTimeTx) SyntacticVerify ¶
func (tx *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 // 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) Initialize ¶
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 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 MockUnsignedTx ¶ added in v1.7.17
type MockUnsignedTx struct {
// contains filtered or unexported fields
}
MockUnsignedTx is a mock of UnsignedTx interface
func NewMockUnsignedTx ¶ added in v1.7.17
func NewMockUnsignedTx(ctrl *gomock.Controller) *MockUnsignedTx
NewMockUnsignedTx creates a new mock instance
func (*MockUnsignedTx) Bytes ¶ added in v1.7.17
func (m *MockUnsignedTx) Bytes() []byte
Bytes mocks base method
func (*MockUnsignedTx) EXPECT ¶ added in v1.7.17
func (m *MockUnsignedTx) EXPECT() *MockUnsignedTxMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockUnsignedTx) InitCtx ¶ added in v1.7.17
func (m *MockUnsignedTx) InitCtx(arg0 *snow.Context)
InitCtx mocks base method
func (*MockUnsignedTx) Initialize ¶ added in v1.7.17
func (m *MockUnsignedTx) Initialize(arg0 []byte)
Initialize mocks base method
func (*MockUnsignedTx) InputIDs ¶ added in v1.7.17
func (m *MockUnsignedTx) InputIDs() ids.Set
InputIDs mocks base method
func (*MockUnsignedTx) Outputs ¶ added in v1.7.17
func (m *MockUnsignedTx) Outputs() []*avax.TransferableOutput
Outputs mocks base method
func (*MockUnsignedTx) SyntacticVerify ¶ added in v1.7.17
func (m *MockUnsignedTx) SyntacticVerify(arg0 *snow.Context) error
SyntacticVerify mocks base method
func (*MockUnsignedTx) Visit ¶ added in v1.7.17
func (m *MockUnsignedTx) Visit(arg0 Visitor) error
Visit mocks base method
type MockUnsignedTxMockRecorder ¶ added in v1.7.17
type MockUnsignedTxMockRecorder struct {
// contains filtered or unexported fields
}
MockUnsignedTxMockRecorder is the mock recorder for MockUnsignedTx
func (*MockUnsignedTxMockRecorder) Bytes ¶ added in v1.7.17
func (mr *MockUnsignedTxMockRecorder) Bytes() *gomock.Call
Bytes indicates an expected call of Bytes
func (*MockUnsignedTxMockRecorder) InitCtx ¶ added in v1.7.17
func (mr *MockUnsignedTxMockRecorder) InitCtx(arg0 interface{}) *gomock.Call
InitCtx indicates an expected call of InitCtx
func (*MockUnsignedTxMockRecorder) Initialize ¶ added in v1.7.17
func (mr *MockUnsignedTxMockRecorder) Initialize(arg0 interface{}) *gomock.Call
Initialize indicates an expected call of Initialize
func (*MockUnsignedTxMockRecorder) InputIDs ¶ added in v1.7.17
func (mr *MockUnsignedTxMockRecorder) InputIDs() *gomock.Call
InputIDs indicates an expected call of InputIDs
func (*MockUnsignedTxMockRecorder) Outputs ¶ added in v1.7.17
func (mr *MockUnsignedTxMockRecorder) Outputs() *gomock.Call
Outputs indicates an expected call of Outputs
func (*MockUnsignedTxMockRecorder) SyntacticVerify ¶ added in v1.7.17
func (mr *MockUnsignedTxMockRecorder) SyntacticVerify(arg0 interface{}) *gomock.Call
SyntacticVerify indicates an expected call of SyntacticVerify
func (*MockUnsignedTxMockRecorder) Visit ¶ added in v1.7.17
func (mr *MockUnsignedTxMockRecorder) Visit(arg0 interface{}) *gomock.Call
Visit indicates an expected call of Visit
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 // 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 (tx *RewardValidatorTx) InitCtx(*snow.Context)
func (*RewardValidatorTx) Initialize ¶
func (tx *RewardValidatorTx) Initialize(unsignedBytes []byte)
func (*RewardValidatorTx) InputIDs ¶
func (tx *RewardValidatorTx) InputIDs() ids.Set
func (*RewardValidatorTx) Outputs ¶
func (tx *RewardValidatorTx) Outputs() []*avax.TransferableOutput
func (*RewardValidatorTx) SyntacticVerify ¶
func (tx *RewardValidatorTx) SyntacticVerify(*snow.Context) error
func (*RewardValidatorTx) Visit ¶
func (tx *RewardValidatorTx) 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"` // contains filtered or unexported fields }
Tx is a signed transaction
func NewSigned ¶
func NewSigned( unsigned UnsignedTx, c codec.Manager, signers [][]*crypto.PrivateKeySECP256K1R, ) (*Tx, error)
func (*Tx) Initialize ¶
type UnsignedTx ¶
type UnsignedTx interface { // TODO: Remove this initialization pattern from both the platformvm and the // avm. snow.ContextInitializable Initialize(unsignedBytes []byte) Bytes() []byte // InputIDs returns the set of inputs this transaction consumes InputIDs() ids.Set 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 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 }
Allow vm to execute custom logic against the underlying transaction types.