Documentation
¶
Overview ¶
Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.
Index ¶
- Variables
- type BlockFetcher
- type InnerVM
- type SemanticVerifier
- type VM
- func (vm *VM) Clock() *mockable.Clock
- func (vm *VM) CodecRegistry() codec.Registry
- func (vm *VM) Initialize(ctx context.Context, chainCtx *snow.Context, db avalanchedatabase.Database, ...) error
- func (vm *VM) Logger() logging.Logger
- func (vm *VM) SetState(ctx context.Context, state snow.State) error
- func (vm *VM) VerifyTx(tx *atomic.Tx, parentHash common.Hash, baseFee *big.Int, state *state.StateDB, ...) error
- type VerifierBackend
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissingUTXOs = errors.New("missing UTXOs") ErrEmptyBlock = errors.New("empty block") )
var ( ErrAssetIDMismatch = errors.New("asset IDs in the input don't match the utxo") ErrConflictingAtomicInputs = errors.New("invalid block due to conflicting atomic inputs") )
Functions ¶
This section is empty.
Types ¶
type BlockFetcher ¶
type BlockFetcher interface {
// GetExtendedBlock returns the VMBlock for the given ID or an error if the block is not found
GetExtendedBlock(context.Context, ids.ID) (extension.ExtendedBlock, error)
// LastAcceptedExtendedBlock returns the last accepted VM block
LastAcceptedExtendedBlock() extension.ExtendedBlock
}
type InnerVM ¶
type InnerVM interface {
extension.ExtensibleVM
avalanchecommon.VM
block.ChainVM
block.BuildBlockWithContextChainVM
block.StateSyncableVM
// TODO: remove these
AtomicMempool() *txpool.Mempool
}
TODO: remove this InnerVM is the interface that must be implemented by the VM that's being wrapped by the extension
type SemanticVerifier ¶
type SemanticVerifier struct {
Backend *VerifierBackend
Tx *atomic.Tx
Parent extension.ExtendedBlock
BaseFee *big.Int
}
SemanticVerifier is a visitor that checks the semantic validity of atomic transactions.
func (*SemanticVerifier) ExportTx ¶
func (s *SemanticVerifier) ExportTx(utx *atomic.UnsignedExportTx) error
ExportTx verifies this transaction is valid.
func (*SemanticVerifier) ImportTx ¶
func (s *SemanticVerifier) ImportTx(utx *atomic.UnsignedImportTx) error
ImportTx verifies this transaction is valid.
type VM ¶
type VM struct {
InnerVM
// TODO: unexport these fields
SecpCache *secp256k1.RecoverCache
Fx secp256k1fx.Fx
// [atomicTxRepository] maintains two indexes on accepted atomic txs.
// - txID to accepted atomic tx
// - block height to list of atomic txs accepted on block at that height
// TODO: unexport these fields
AtomicTxRepository *atomicstate.AtomicRepository
// [atomicBackend] abstracts verification and processing of atomic transactions
AtomicBackend *atomicstate.AtomicBackend
// contains filtered or unexported fields
}
func (*VM) CodecRegistry ¶
CodecRegistry implements the secp256k1fx interface
func (*VM) Initialize ¶
func (vm *VM) Initialize( ctx context.Context, chainCtx *snow.Context, db avalanchedatabase.Database, genesisBytes []byte, upgradeBytes []byte, configBytes []byte, toEngine chan<- avalanchecommon.Message, fxs []*avalanchecommon.Fx, appSender avalanchecommon.AppSender, ) error
Initialize implements the snowman.ChainVM interface
func (*VM) VerifyTx ¶
func (vm *VM) VerifyTx(tx *atomic.Tx, parentHash common.Hash, baseFee *big.Int, state *state.StateDB, rules extras.Rules) error
VerifyTx verifies that [tx] is valid to be issued into a block with parent block [parentHash] and validated at state using [rules] as the current rule set. Note: VerifyTx may modify state. If state needs to be properly maintained, the caller is responsible for reverting to the correct snapshot after calling this function. If this function is called with a throwaway state, then this is not necessary. TODO: unexport this function
type VerifierBackend ¶
type VerifierBackend struct {
Ctx *snow.Context
Fx fx.Fx
Rules extras.Rules
Bootstrapped bool
BlockFetcher BlockFetcher
SecpCache *secp256k1.RecoverCache
}