verifier

package
v1.5.53 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: GPL-3.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const AddressLen = 32
View Source
const EGLDTokenIdentifier = "EGLD-000000"
View Source
const TransferValueOnlyString = "transferValueOnly"

Variables

View Source
var (
	// ErrNilVMOutput signals that the VM output is nil
	ErrNilVMOutput = errors.New("vm output is nil")

	// ErrNilVerificationInput signals that the verification input is nil
	ErrNilVerificationInput = errors.New("verification input is nil")

	// ReturnCode state isolation errors
	ErrStorageUpdateOnFailedExecution  = errors.New("storage update found on failed execution")
	ErrBalanceDeltaOnFailedExecution   = errors.New("balance delta found on failed execution")
	ErrCodeDeploymentOnFailedExecution = errors.New("code deployment found on failed execution")
	ErrOutputTransferOnFailedExecution = errors.New("output transfer found on failed execution")
	ErrDeletedAccountOnFailedExecution = errors.New("deleted account found on failed execution")
	ErrGasRefundOnFailedExecution      = errors.New("gas refund found on failed execution")
	ErrTokenTransferOnFailedExecution  = errors.New("token transfer or mint/burn log found on failed execution")

	// Identity and address integrity errors (UF-208)
	ErrInvalidAccountAddress          = errors.New("invalid account address: must be exactly 32 bytes")
	ErrAddressKeyMismatch             = errors.New("output account address does not match map key")
	ErrDeletedAccountInOutputAccounts = errors.New("deleted account exists in output accounts")
	ErrDuplicateDeletedAccount        = errors.New("duplicate address in deleted accounts")

	// Native EGLD conservation errors
	ErrNativeTokenConservationViolated   = errors.New("native token conservation violated: balance deltas net sum does not match deposit")
	ErrNegativeDeposit                   = errors.New("negative call value deposit")
	ErrNegativeOutputTransferValue       = errors.New("negative output transfer value")
	ErrOutputTransferExceedsBalanceDelta = errors.New("output transfer value exceeds balance delta")

	// Account balance errors
	ErrAccountOverdrawn        = errors.New("account balance overdrawn below zero")
	ErrNegativeBalanceInOutput = errors.New("account balance is negative in output")

	// ESDT token conservation errors
	ErrTokenConservationViolated        = errors.New("ESDT token conservation violated: outflow plus burn exceeds inflow plus net mint")
	ErrNegativeTokenAmount              = errors.New("negative ESDT token amount")
	ErrInvalidTokenNonce                = errors.New("invalid token nonce: exceeds 8 bytes")
	ErrMalformedOutputTransferData      = errors.New("malformed ESDT transfer data in output transfer")
	ErrOutputTransferWithoutTransferLog = errors.New("output transfer has no matching transfer log")
	ErrTransferLogWithoutOutputTransfer = errors.New("transfer log has no matching output transfer")

	// Gas bounds errors
	ErrGasRemainingExceedsProvided = errors.New("gas remaining exceeds gas provided")
	ErrGasRefundNegative           = errors.New("gas refund is negative")
	ErrGasRefundExceedsCap         = errors.New("gas refund exceeds 50% cap of spent gas")

	// Read-only purity errors
	ErrReadOnlyStateChange = errors.New("read-only execution violation: attempted state mutation")
)

Invariant violation errors returned by VMOutputVerifier

Functions

func NewVMOutputVerifier

func NewVMOutputVerifier() *vmOutputVerifier

NewVMOutputVerifier creates a new exit-boundary verifier for VMOutput

Types

type OutputVerifier

type OutputVerifier interface {
	Verify(input *VerificationInput, output *vmcommon.VMOutput) error
	IsInterfaceNil() bool
}

OutputVerifier defines the exit-boundary verification contract for VMOutput

type TokenKey

type TokenKey struct {
	Identifier string
	Nonce      uint64
}

TokenKey uniquely identifies a token (fungible or NFT/SFT)

type VerificationInput

type VerificationInput struct {
	CallerAddr               []byte
	RecipientAddr            []byte
	CallValue                *big.Int
	ESDTTransfers            []*vmcommon.ESDTTransfer
	GasProvided              uint64
	GasLocked                uint64
	IsReadOnly               bool
	AllowCustomAddressLength bool
	DisjointDeletedAccounts  bool
}

VerificationInput provides the transaction-level context needed to verify a VMOutput

func NewVerificationInputFromCall

func NewVerificationInputFromCall(
	input *vmcommon.ContractCallInput,
	isReadOnly bool,
) *VerificationInput

Helper constructor to build VerificationInput from ContractCallInput

func NewVerificationInputFromCreate

func NewVerificationInputFromCreate(
	input *vmcommon.ContractCreateInput,
) *VerificationInput

Helper constructor to build VerificationInput from ContractCreateInput

Jump to

Keyboard shortcuts

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