vm

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: GPL-3.0, LGPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingUTXOs = errors.New("missing UTXOs")
	ErrEmptyBlock   = errors.New("empty block")
)
View Source
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
	AtomicBackend() *state.AtomicBackend
	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
	// contains filtered or unexported fields
}

func WrapVM

func WrapVM(vm InnerVM) *VM

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

type VerifierBackend

type VerifierBackend struct {
	Ctx          *snow.Context
	Fx           fx.Fx
	Rules        extras.Rules
	Bootstrapped bool
	BlockFetcher BlockFetcher
	SecpCache    *secp256k1.RecoverCache
}

Jump to

Keyboard shortcuts

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