vm

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName = "vm"
	RouterKey  = ModuleName
)
View Source
const (
	QueryRender       = "qrender"
	QueryFuncs        = "qfuncs"
	QueryEval         = "qeval"
	QueryEvalJSON     = "qeval_json"
	QueryObjectJSON   = "qobject_json"
	QueryObjectBinary = "qobject_binary"
	QueryFile         = "qfile"
	QueryDoc          = "qdoc"
	QueryPaths        = "qpaths"
	QueryStorage      = "qstorage"
	QueryPkgJSON      = "qpkg_json"
	QueryTypeJSON     = "qtype_json"
	// QueryPackageMetaJSON reports a path's status and submit-time metadata.
	// Distinct from QueryPkgJSON, which dumps a live package's variables and
	// cannot answer for one that is not live yet.
	QueryPackageMetaJSON = "qpkgmeta_json"
	// QueryInertPaths lists what is awaiting approval. Separate from QueryPaths,
	// which ranges the live key space and cannot see it.
	QueryInertPaths = "qinertpaths"
)

query paths

View Source
const (
	// ReasonAwaitingApprover is the ordinary case: nothing is wrong, no
	// approver has enabled it yet.
	ReasonAwaitingApprover = "waiting for a package approver to enable it"
	// ReasonNoApprovers means nothing on this chain can be enabled at all.
	// isApprover is a membership test, so an empty list admits nobody.
	ReasonNoApprovers = "no package approvers are configured on this chain"
	// ReasonPolicyMoved means the chain has left the policy the package was
	// submitted under. Reversible: returning to "inert" makes it enablable
	// again, and nothing evicts the package meanwhile.
	ReasonPolicyMoved = `the chain no longer runs the "inert" code submission policy`
)

Reasons a parked package is not live, reported in PackageMeta.Reason.

Each mirrors a gate in EnablePackage, in the order EnablePackage applies them, so the reason is the one a MsgEnablePackage would actually hit.

View Source
const (
	PackageStatusLive   = "live"   // deployed and callable
	PackageStatusInert  = "inert"  // submitted, stored, awaiting an approver
	PackageStatusAbsent = "absent" // the chain holds nothing at this path
)

Package statuses reported by QueryPackageMeta.

Variables

View Source
var ASCIIDomain = regexp.MustCompile(`^(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\.)+[A-Za-z]{2,}$`)
View Source
var Package = amino.RegisterPackage(amino.NewPackage(
	"github.com/gnolang/gno/gno.land/pkg/sdk/vm",
	"vm",
	amino.GetCallersDirname(),
).WithDependencies(
	std.Package,
	params.Package,
).WithTypes(
	MsgCall{}, "m_call",
	MsgRun{}, "m_run",
	MsgAddPackage{}, "m_addpkg",
	MsgEnablePackage{}, "m_enable_pkg",
	MsgDisablePackage{}, "m_disable_pkg",
	MsgRejectPackage{}, "m_reject_pkg",

	InvalidPkgPathError{}, "InvalidPkgPathError",
	NoRenderDeclError{}, "NoRenderDeclError",
	PkgExistError{}, "PkgExistError",
	InvalidStmtError{}, "InvalidStmtError",
	InvalidExprError{}, "InvalidExprError",
	TypeCheckError{}, "TypeCheckError",
	UnauthorizedUserError{}, "UnauthorizedUserError",
	InvalidPackageError{}, "InvalidPackageError",
	InvalidFileError{}, "InvalidFileError",
	ObjectNotFoundError{}, "ObjectNotFoundError",
	ExportSizeExceededError{}, "ExportSizeExceededError",
	ExportDepthExceededError{}, "ExportDepthExceededError",
	UnobservedSendError{}, "UnobservedSendError",
	UnspendableSendError{}, "UnspendableSendError",
	GenesisState{}, "GenesisState",
	Params{}, "Params",
))

Functions

func ContextWithParamsAccum

func ContextWithParamsAccum(ctx sdk.Context) sdk.Context

ContextWithParamsAccum seeds an empty per-realm accumulator. Call once per message, BEFORE NewSDKParams captures ctx into its struct field — otherwise the SDKParams holds a ctx without the accumulator and recordParamsDelta becomes a silent no-op.

func ErrExportDepthExceeded

func ErrExportDepthExceeded(msg string) error

func ErrExportSizeExceeded

func ErrExportSizeExceeded(msg string) error

func ErrInvalidExpr

func ErrInvalidExpr(msg string) error

func ErrInvalidFile

func ErrInvalidFile(msg string) error

func ErrInvalidPackage

func ErrInvalidPackage(msg string) error

func ErrInvalidPkgPath

func ErrInvalidPkgPath(msg string) error

func ErrInvalidStmt

func ErrInvalidStmt(msg string) error

func ErrObjectNotFound

func ErrObjectNotFound(msg string) error

func ErrPkgAlreadyExists

func ErrPkgAlreadyExists(msg string) error

func ErrTypeCheck

func ErrTypeCheck(err error) error

ErrTypeCheck wraps err's full messages around the empty TypeCheckError sentinel. Only the sentinel reaches the hashed tx result; the messages ride the msg trace into the unhashed Result.Log (see TypeCheckError).

func ErrUnauthorizedUser

func ErrUnauthorizedUser(msg string) error

func ErrUnobservedSend

func ErrUnobservedSend(msg string) error

func ErrUnspendableSend

func ErrUnspendableSend(msg string) error

func FlushParamsRealmAccum

func FlushParamsRealmAccum(ctx sdk.Context, pmk ParamsKeeperI, rlmPath string)

FlushParamsRealmAccum writes the meta-key for one realm if dirty. Called by VMKeeper inside the sorted-realm loop in processStorageDeposit, AFTER the deposit lock/refund has succeeded — keeps bank state and the persistent meta-key consistent on partial failure (a failing lockStorageDeposit aborts the message; the uncommitted meta-key write would otherwise persist in cache.Store only to be discarded with the rest of the message).

func NewHandler

func NewHandler(vm *VMKeeper) vmHandler

NewHandler returns a handler for "vm" type messages.

func PackageContentHash

func PackageContentHash(mpkg *std.MemPackage) string

PackageContentHash identifies the source an approver signed off on.

Approval names a path, and a path's contents can change: the same creator may replace parked bytes at any time, and that replacement is also the legitimate retry after a failed enable. Without naming the bytes, an approver who read GOOD can be made to activate EVIL.

gnomod.toml is excluded deliberately. AddPackage stamps the creator, height and declared deposit into it at submit, so the stored file differs from the one the submitter sent and from the one an approver saw in the transaction -- the two could never agree on a hash that included it. stampGnomod writes that file and touches nothing else, which is what makes excluding it sufficient: every byte an approver reviews is still covered, and the gnomod rules are re-applied from the stored file at enable anyway.

Each field is length-prefixed so that adjacent names and bodies cannot be re-cut to collide -- without it, a file "ab" holding "c" and a file "a" holding "bc" would hash alike.

func ParamsRealmDiffs

func ParamsRealmDiffs(ctx sdk.Context) map[string]int64

ParamsRealmDiffs returns the per-realm byte deltas accumulated this message. Filtered to non-zero entries — consumed by VMKeeper.processStorageDeposit to merge into the per-realm diff map.

func ValidateGenesis

func ValidateGenesis(gs GenesisState) error

ValidateGenesis performs basic validation of genesis data returning an error for any failed validation criteria. XXX refactor to .ValidateBasic() method.

func ValidateRealmParamKey

func ValidateRealmParamKey(key string) error

ValidateRealmParamKey reports whether key is a well-formed realm parameter key, <realm-path>:<name>.

Exported so the genesis loader can apply the same rules and name the offending section, instead of letting a bad key reach InitGenesis and panic the node at boot. It had a copy of the first rule and neither of the others.

XXX values are still not checked against a supported-type list.

Types

type AccountKeeperI

type AccountKeeperI interface {
	GetAccount(ctx sdk.Context, addr crypto.Address) std.Account
	SetSessionAccount(ctx sdk.Context, master crypto.Address, acc std.Account)
}

AccountKeeperI is the limited interface only needed for VM.

type BankKeeperI

type BankKeeperI interface {
	GetCoins(ctx sdk.Context, addr crypto.Address) std.Coins
	GetCoin(ctx sdk.Context, addr crypto.Address, denom string) int64
	SendCoins(ctx sdk.Context, fromAddr crypto.Address, toAddr crypto.Address, amt std.Coins) error
	// Here for the keeper's own storage-deposit charge and refund, which must
	// bypass vesting and the session spend limit. No native reaches it —
	// SDKBanker.SendCoins uses the restricted SendCoins — so a realm cannot spend
	// through it. Keep it that way: it is the one method here that skips checks.
	SendCoinsUnrestricted(ctx sdk.Context, fromAddr crypto.Address, toAddr crypto.Address, amt std.Coins) error
	// Issuance goes through Mint/Burn, which maintain the supply counter. The raw
	// AddCoins/SubtractCoins are deliberately absent: they are supply-blind, so
	// exposing them here would make an unaccounted mint expressible from a realm.
	MintCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) error
	BurnCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) error
	TotalSupply(ctx sdk.Context, denom string) int64
	RestrictedDenoms(ctx sdk.Context) []string
}

BankKeeperI is the limited interface only needed for VM.

type CodeSubmissionPolicy

type CodeSubmissionPolicy string

CodeSubmissionPolicy controls who may submit MsgAddPackage, and how submitted packages are processed. It has no bearing on MsgRun: that is gated by RunSubmitters under every policy value, because no policy value makes running arbitrary source safe. See the RunSubmitters field doc.

const (
	// CodeSubmissionPolicyPermissionless allows any address to submit code (default).
	CodeSubmissionPolicyPermissionless CodeSubmissionPolicy = "permissionless"
	// CodeSubmissionPolicyPermissioned restricts code submission to addresses
	// listed in Params.CodeSubmitters.
	CodeSubmissionPolicyPermissioned CodeSubmissionPolicy = "permissioned"
	// CodeSubmissionPolicyInert accepts packages from any address but stores them
	// without typechecking or execution (inert state). Packages become callable
	// only after an approver sends MsgEnablePackage.
	CodeSubmissionPolicyInert CodeSubmissionPolicy = "inert"
)

type ExportDepthExceededError

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

ExportDepthExceededError is the depth counterpart to ExportSizeExceededError: it is returned when a query result nests deeper than the export walk allows, whatever its size. The VM-level cause is gno.ErrExportDepthExceeded.

func (ExportDepthExceededError) AssertABCIError

func (ExportDepthExceededError) AssertABCIError()

func (ExportDepthExceededError) Error

func (e ExportDepthExceededError) Error() string

func (ExportDepthExceededError) MarshalBinary2

func (goo ExportDepthExceededError) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (ExportDepthExceededError) SizeBinary2

func (goo ExportDepthExceededError) SizeBinary2(cdc *amino.Codec) (int, error)

func (*ExportDepthExceededError) UnmarshalBinary2

func (goo *ExportDepthExceededError) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type ExportSizeExceededError

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

ExportSizeExceededError is returned when a query result's estimated serialized size exceeds maxQueryExportBytes. It exists so clients see a stable ABCI code for "response too large" rather than an untyped internal error; the VM-level cause is gno.ErrExportSizeExceeded.

func (ExportSizeExceededError) AssertABCIError

func (ExportSizeExceededError) AssertABCIError()

func (ExportSizeExceededError) Error

func (e ExportSizeExceededError) Error() string

func (ExportSizeExceededError) MarshalBinary2

func (goo ExportSizeExceededError) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (ExportSizeExceededError) SizeBinary2

func (goo ExportSizeExceededError) SizeBinary2(cdc *amino.Codec) (int, error)

func (*ExportSizeExceededError) UnmarshalBinary2

func (goo *ExportSizeExceededError) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type FunctionSignature

type FunctionSignature struct {
	FuncName string
	Params   []NamedType
	Results  []NamedType
}

Public facing function signatures. See convertArgToGno() for supported types.

type FunctionSignatures

type FunctionSignatures []FunctionSignature

func (FunctionSignatures) JSON

func (fsigs FunctionSignatures) JSON() string

type GenesisState

type GenesisState struct {
	Params      Params         `json:"params" yaml:"params"`
	RealmParams []params.Param `json:"realm_params" yaml:"realm_params"`
}

GenesisState - all state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState - Return a default genesis state

func NewGenesisState

func NewGenesisState(params Params) GenesisState

NewGenesisState - Create a new genesis state

func (GenesisState) MarshalBinary2

func (goo GenesisState) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (GenesisState) SizeBinary2

func (goo GenesisState) SizeBinary2(cdc *amino.Codec) (int, error)

func (*GenesisState) UnmarshalBinary2

func (goo *GenesisState) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type InvalidExprError

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

declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.

func (InvalidExprError) AssertABCIError

func (InvalidExprError) AssertABCIError()

func (InvalidExprError) Error

func (e InvalidExprError) Error() string

func (InvalidExprError) MarshalBinary2

func (goo InvalidExprError) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (InvalidExprError) SizeBinary2

func (goo InvalidExprError) SizeBinary2(cdc *amino.Codec) (int, error)

func (*InvalidExprError) UnmarshalBinary2

func (goo *InvalidExprError) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type InvalidFileError

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

declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.

func (InvalidFileError) AssertABCIError

func (InvalidFileError) AssertABCIError()

func (InvalidFileError) Error

func (e InvalidFileError) Error() string

func (InvalidFileError) MarshalBinary2

func (goo InvalidFileError) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (InvalidFileError) SizeBinary2

func (goo InvalidFileError) SizeBinary2(cdc *amino.Codec) (int, error)

func (*InvalidFileError) UnmarshalBinary2

func (goo *InvalidFileError) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type InvalidPackageError

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

declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.

func (InvalidPackageError) AssertABCIError

func (InvalidPackageError) AssertABCIError()

func (InvalidPackageError) Error

func (e InvalidPackageError) Error() string

func (InvalidPackageError) MarshalBinary2

func (goo InvalidPackageError) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (InvalidPackageError) SizeBinary2

func (goo InvalidPackageError) SizeBinary2(cdc *amino.Codec) (int, error)

func (*InvalidPackageError) UnmarshalBinary2

func (goo *InvalidPackageError) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type InvalidPkgPathError

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

declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.

func (InvalidPkgPathError) AssertABCIError

func (InvalidPkgPathError) AssertABCIError()

func (InvalidPkgPathError) Error

func (e InvalidPkgPathError) Error() string

func (InvalidPkgPathError) MarshalBinary2

func (goo InvalidPkgPathError) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (InvalidPkgPathError) SizeBinary2

func (goo InvalidPkgPathError) SizeBinary2(cdc *amino.Codec) (int, error)

func (*InvalidPkgPathError) UnmarshalBinary2

func (goo *InvalidPkgPathError) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type InvalidStmtError

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

declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.

func (InvalidStmtError) AssertABCIError

func (InvalidStmtError) AssertABCIError()

func (InvalidStmtError) Error

func (e InvalidStmtError) Error() string

func (InvalidStmtError) MarshalBinary2

func (goo InvalidStmtError) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (InvalidStmtError) SizeBinary2

func (goo InvalidStmtError) SizeBinary2(cdc *amino.Codec) (int, error)

func (*InvalidStmtError) UnmarshalBinary2

func (goo *InvalidStmtError) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type MsgAddPackage

type MsgAddPackage struct {
	Creator    crypto.Address  `json:"creator" yaml:"creator"`
	Package    *std.MemPackage `json:"package" yaml:"package"`
	Send       std.Coins       `json:"send" yaml:"send"`
	MaxDeposit std.Coins       `json:"max_deposit" yaml:"max_deposit"`
}

MsgAddPackage - create and initialize new package

func NewMsgAddPackage

func NewMsgAddPackage(creator crypto.Address, pkgPath string, files []*std.MemFile) MsgAddPackage

NewMsgAddPackage - upload a package with files.

func (MsgAddPackage) GetReceived

func (msg MsgAddPackage) GetReceived() std.Coins

Implements ReceiveMsg.

func (MsgAddPackage) GetSignBytes

func (msg MsgAddPackage) GetSignBytes() []byte

Implements Msg.

func (MsgAddPackage) GetSigners

func (msg MsgAddPackage) GetSigners() []crypto.Address

Implements Msg.

func (MsgAddPackage) MarshalBinary2

func (goo MsgAddPackage) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (MsgAddPackage) Route

func (msg MsgAddPackage) Route() string

Implements Msg.

func (MsgAddPackage) SizeBinary2

func (goo MsgAddPackage) SizeBinary2(cdc *amino.Codec) (int, error)

func (MsgAddPackage) SpendForSigner

func (msg MsgAddPackage) SpendForSigner(signer crypto.Address) std.Coins

SpendForSigner implements std.SpendEstimator. Returns Send when signer is the creator, zero otherwise.

func (MsgAddPackage) Type

func (msg MsgAddPackage) Type() string

Implements Msg.

func (*MsgAddPackage) UnmarshalBinary2

func (goo *MsgAddPackage) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

func (MsgAddPackage) ValidateBasic

func (msg MsgAddPackage) ValidateBasic() error

Implements Msg.

type MsgCall

type MsgCall struct {
	Caller     crypto.Address `json:"caller" yaml:"caller"`
	Send       std.Coins      `json:"send" yaml:"send"`
	MaxDeposit std.Coins      `json:"max_deposit" yaml:"max_deposit"`
	PkgPath    string         `json:"pkg_path" yaml:"pkg_path"`
	Func       string         `json:"func" yaml:"func"`
	Args       []string       `json:"args,omitempty" yaml:"args"`
}

MsgCall - executes a Gno statement.

func NewMsgCall

func NewMsgCall(caller crypto.Address, send sdk.Coins, pkgPath, fnc string, args []string) MsgCall

func (MsgCall) GetPkgPath

func (msg MsgCall) GetPkgPath() string

GetPkgPath returns the target package path.

func (MsgCall) GetReceived

func (msg MsgCall) GetReceived() std.Coins

Implements ReceiveMsg.

func (MsgCall) GetSignBytes

func (msg MsgCall) GetSignBytes() []byte

Implements Msg.

func (MsgCall) GetSigners

func (msg MsgCall) GetSigners() []crypto.Address

Implements Msg.

func (MsgCall) MarshalBinary2

func (goo MsgCall) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (MsgCall) Route

func (msg MsgCall) Route() string

Implements Msg.

func (MsgCall) SizeBinary2

func (goo MsgCall) SizeBinary2(cdc *amino.Codec) (int, error)

func (MsgCall) SpendForSigner

func (msg MsgCall) SpendForSigner(signer crypto.Address) std.Coins

SpendForSigner implements std.SpendEstimator. Returns Send when signer is the caller, zero otherwise.

func (MsgCall) Type

func (msg MsgCall) Type() string

Implements Msg.

func (*MsgCall) UnmarshalBinary2

func (goo *MsgCall) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

func (MsgCall) ValidateBasic

func (msg MsgCall) ValidateBasic() error

Implements Msg.

type MsgDisablePackage

type MsgDisablePackage struct {
	Approver crypto.Address `json:"approver" yaml:"approver"`
	PkgPath  string         `json:"pkg_path" yaml:"pkg_path"`
}

func (MsgDisablePackage) GetReceived

func (msg MsgDisablePackage) GetReceived() std.Coins

func (MsgDisablePackage) GetSignBytes

func (msg MsgDisablePackage) GetSignBytes() []byte

func (MsgDisablePackage) GetSigners

func (msg MsgDisablePackage) GetSigners() []crypto.Address

func (MsgDisablePackage) MarshalBinary2

func (goo MsgDisablePackage) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (MsgDisablePackage) Route

func (msg MsgDisablePackage) Route() string

func (MsgDisablePackage) SizeBinary2

func (goo MsgDisablePackage) SizeBinary2(cdc *amino.Codec) (int, error)

func (MsgDisablePackage) SpendForSigner

func (msg MsgDisablePackage) SpendForSigner(_ crypto.Address) std.Coins

func (MsgDisablePackage) Type

func (msg MsgDisablePackage) Type() string

func (*MsgDisablePackage) UnmarshalBinary2

func (goo *MsgDisablePackage) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

func (MsgDisablePackage) ValidateBasic

func (msg MsgDisablePackage) ValidateBasic() error

type MsgEnablePackage

type MsgEnablePackage struct {
	Approver crypto.Address `json:"approver" yaml:"approver"`
	PkgPath  string         `json:"pkg_path" yaml:"pkg_path"`
	// PkgHash names the source being approved, as PackageContentHash computes
	// it. Approval otherwise names only a path, and the creator may replace
	// what is parked there before the enable lands.
	//
	// Appended last: amino field numbers are positional, so inserting it
	// anywhere else would renumber the fields above and change how every
	// existing transaction decodes.
	PkgHash string `json:"pkg_hash" yaml:"pkg_hash"`
}

MsgEnablePackage activates an inert package: runs typecheck and init, then makes the package importable on-chain. Only addresses listed in Params.PkgApprovers may send this message.

func (MsgEnablePackage) GetReceived

func (msg MsgEnablePackage) GetReceived() std.Coins

func (MsgEnablePackage) GetSignBytes

func (msg MsgEnablePackage) GetSignBytes() []byte

func (MsgEnablePackage) GetSigners

func (msg MsgEnablePackage) GetSigners() []crypto.Address

func (MsgEnablePackage) MarshalBinary2

func (goo MsgEnablePackage) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (MsgEnablePackage) Route

func (msg MsgEnablePackage) Route() string

func (MsgEnablePackage) SizeBinary2

func (goo MsgEnablePackage) SizeBinary2(cdc *amino.Codec) (int, error)

func (MsgEnablePackage) SpendForSigner

func (msg MsgEnablePackage) SpendForSigner(_ crypto.Address) std.Coins

func (MsgEnablePackage) Type

func (msg MsgEnablePackage) Type() string

func (*MsgEnablePackage) UnmarshalBinary2

func (goo *MsgEnablePackage) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

func (MsgEnablePackage) ValidateBasic

func (msg MsgEnablePackage) ValidateBasic() error

type MsgRejectPackage

type MsgRejectPackage struct {
	Sender  crypto.Address `json:"sender" yaml:"sender"`
	PkgPath string         `json:"pkg_path" yaml:"pkg_path"`
}

MsgRejectPackage removes a package that is parked awaiting approval.

Two parties may send it, and for different reasons: an approver declining a submission, and the creator withdrawing its own. One message rather than two because the effect is identical -- the parked blob is deleted and nothing else happens.

The submission charge is NOT refunded. It priced the work of parking the bytes, which happened; refunding it would also make rejection a way to recover the charge, and the charge is what makes bulk submission cost something.

func (MsgRejectPackage) GetReceived

func (msg MsgRejectPackage) GetReceived() std.Coins

func (MsgRejectPackage) GetSignBytes

func (msg MsgRejectPackage) GetSignBytes() []byte

func (MsgRejectPackage) GetSigners

func (msg MsgRejectPackage) GetSigners() []crypto.Address

func (MsgRejectPackage) MarshalBinary2

func (goo MsgRejectPackage) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (MsgRejectPackage) Route

func (msg MsgRejectPackage) Route() string

func (MsgRejectPackage) SizeBinary2

func (goo MsgRejectPackage) SizeBinary2(cdc *amino.Codec) (int, error)

func (MsgRejectPackage) SpendForSigner

func (msg MsgRejectPackage) SpendForSigner(_ crypto.Address) std.Coins

func (MsgRejectPackage) Type

func (msg MsgRejectPackage) Type() string

func (*MsgRejectPackage) UnmarshalBinary2

func (goo *MsgRejectPackage) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

func (MsgRejectPackage) ValidateBasic

func (msg MsgRejectPackage) ValidateBasic() error

type MsgRun

type MsgRun struct {
	Caller     crypto.Address  `json:"caller" yaml:"caller"`
	Send       std.Coins       `json:"send" yaml:"send"`
	MaxDeposit std.Coins       `json:"max_deposit" yaml:"max_deposit"`
	Package    *std.MemPackage `json:"package" yaml:"package"`
}

MsgRun - executes arbitrary Gno code.

func NewMsgRun

func NewMsgRun(caller crypto.Address, send std.Coins, files []*std.MemFile) MsgRun

func (MsgRun) GetReceived

func (msg MsgRun) GetReceived() std.Coins

Implements ReceiveMsg.

func (MsgRun) GetSignBytes

func (msg MsgRun) GetSignBytes() []byte

Implements Msg.

func (MsgRun) GetSigners

func (msg MsgRun) GetSigners() []crypto.Address

Implements Msg.

func (MsgRun) MarshalBinary2

func (goo MsgRun) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (MsgRun) Route

func (msg MsgRun) Route() string

Implements Msg.

func (MsgRun) SizeBinary2

func (goo MsgRun) SizeBinary2(cdc *amino.Codec) (int, error)

func (MsgRun) SpendForSigner

func (msg MsgRun) SpendForSigner(signer crypto.Address) std.Coins

SpendForSigner implements std.SpendEstimator. Returns Send when signer is the caller, zero otherwise.

func (MsgRun) Type

func (msg MsgRun) Type() string

Implements Msg.

func (*MsgRun) UnmarshalBinary2

func (goo *MsgRun) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

func (MsgRun) ValidateBasic

func (msg MsgRun) ValidateBasic() error

Implements Msg.

type NamedType

type NamedType struct {
	Name  string
	Type  string
	Value string
}

type NoRenderDeclError

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

declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.

func (NoRenderDeclError) AssertABCIError

func (NoRenderDeclError) AssertABCIError()

func (NoRenderDeclError) Error

func (e NoRenderDeclError) Error() string

func (NoRenderDeclError) MarshalBinary2

func (goo NoRenderDeclError) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (NoRenderDeclError) SizeBinary2

func (goo NoRenderDeclError) SizeBinary2(cdc *amino.Codec) (int, error)

func (*NoRenderDeclError) UnmarshalBinary2

func (goo *NoRenderDeclError) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type ObjectNotFoundError

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

declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.

func (ObjectNotFoundError) AssertABCIError

func (ObjectNotFoundError) AssertABCIError()

func (ObjectNotFoundError) Error

func (e ObjectNotFoundError) Error() string

func (ObjectNotFoundError) MarshalBinary2

func (goo ObjectNotFoundError) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (ObjectNotFoundError) SizeBinary2

func (goo ObjectNotFoundError) SizeBinary2(cdc *amino.Codec) (int, error)

func (*ObjectNotFoundError) UnmarshalBinary2

func (goo *ObjectNotFoundError) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type PackageMeta

type PackageMeta struct {
	Path   string `json:"path"`
	Status string `json:"status"`
	// Creator submitted the package, and pays its storage deposit whichever
	// message activates it.
	Creator string `json:"creator,omitempty"`
	// Height is the block the package was submitted in, not the one that
	// activated it. Under "inert" those differ.
	Height     int    `json:"height,omitempty"`
	MaxDeposit string `json:"max_deposit,omitempty"`
	// Reason says why a parked package is not live yet, in terms its submitter
	// can act on. Empty unless Status is "inert".
	Reason string `json:"reason,omitempty"`
	// Pending reports a parked submission awaiting an approver. It is always
	// true for status "inert", and also true for a live PRIVATE realm with a
	// redeploy parked over it -- AddPackage refuses to park over a live public
	// package but allows it for a private one, so the two can coexist.
	//
	// The fields above describe what is callable. When a live package has a
	// submission pending, they are the live one's, and the parked submission's
	// own creator and height are not reported here.
	Pending bool `json:"pending,omitempty"`
}

PackageMeta is the vm/qpkgmeta_json response.

Fields beyond Path and Status are whatever the chain stamped at submit time, and are omitted when the package is absent.

type Params

type Params struct {
	SysNamesPkgPath      string         `json:"sysnames_pkgpath" yaml:"sysnames_pkgpath"`
	SysCLAPkgPath        string         `json:"syscla_pkgpath" yaml:"syscla_pkgpath"`
	ChainDomain          string         `json:"chain_domain" yaml:"chain_domain"`
	DefaultDeposit       string         `json:"default_deposit" yaml:"default_deposit"`
	StoragePrice         string         `json:"storage_price" yaml:"storage_price"`
	StorageFeeCollector  crypto.Address `json:"storage_fee_collector" yaml:"storage_fee_collector"`
	MinGetReadDepth100   int64          `json:"min_get_read_depth_100" yaml:"min_get_read_depth_100"`
	MinSetReadDepth100   int64          `json:"min_set_read_depth_100" yaml:"min_set_read_depth_100"`
	MinWriteDepth100     int64          `json:"min_write_depth_100" yaml:"min_write_depth_100"`
	FixedGetReadDepth100 int64          `json:"fixed_get_read_depth_100" yaml:"fixed_get_read_depth_100"`
	FixedSetReadDepth100 int64          `json:"fixed_set_read_depth_100" yaml:"fixed_set_read_depth_100"`
	FixedWriteDepth100   int64          `json:"fixed_write_depth_100" yaml:"fixed_write_depth_100"`
	// IterNextCostFlat must be > 0; Validate rejects zero. Asymmetric
	// with the six depth fields above (where 0 legitimately means
	// "no floor / use tree estimate") because zero iter-step cost
	// would effectively disable iteration gas charging.
	IterNextCostFlat int64 `json:"iter_next_cost_flat" yaml:"iter_next_cost_flat"`
	// PreprocessGasPerByte must be > 0; Validate rejects zero (like
	// IterNextCostFlat) because a zero per-byte cost would silently disable
	// the type-check/preprocess gas charge. Charged per .gno source byte at
	// MsgAddPackage and MsgRun; it is NOT part of store.GasConfig (charged
	// directly in the keeper), so it has no ApplyToGasConfig entry.
	//
	// Kept immediately after IterNextCostFlat (amino field 14) so its wire
	// number matches master; the code-submission fields below take 15/16/17.
	PreprocessGasPerByte int64 `json:"preprocess_gas_per_byte" yaml:"preprocess_gas_per_byte"`

	// CodeSubmissionPolicy controls who may submit MsgAddPackage and how
	// packages are processed on arrival. Defaults to "permissionless".
	// Not consulted for MsgRun; see RunSubmitters.
	CodeSubmissionPolicy CodeSubmissionPolicy `json:"code_submission_policy" yaml:"code_submission_policy"`
	// CodeSubmitters is the allowlist used when CodeSubmissionPolicy == "permissioned".
	CodeSubmitters []crypto.Address `json:"code_submitters" yaml:"code_submitters"`
	// PkgApprovers may call MsgEnablePackage / MsgDisablePackage.
	// Required when CodeSubmissionPolicy == "inert".
	PkgApprovers []crypto.Address `json:"pkg_approvers" yaml:"pkg_approvers"`
	// RunSubmitters may send MsgRun. Consulted under EVERY CodeSubmissionPolicy,
	// deliberately unlike CodeSubmitters: MsgRun type-checks and executes
	// arbitrary source immediately, under every policy including "inert", so the
	// policy value has no bearing on the hazard. It is also the only code-bearing
	// message with no other gate — MsgAddPackage clears a namespace check and a
	// CLA check, while MsgRun's path is forced to /e/<caller>/run and so has no
	// namespace to check against.
	//
	// EMPTY MEANS OFF: anyone may send MsgRun, which is the behaviour that
	// predates this field. Listing one address turns the gate on.
	//
	// The asymmetry with CodeSubmitters is deliberate. CodeSubmitters is read
	// only after CodeSubmissionPolicy has been explicitly moved to
	// "permissioned", so its empty state is a half-finished opt-in and refusing
	// is the safe reading. RunSubmitters has no such switch — it is read on
	// every MsgRun from the moment the field exists — so treating empty as
	// "nobody" would disable MsgRun on every chain that upgrades without editing
	// genesis. Because GovDAO proposal creation is MsgRun-only (a
	// ProposalRequest carries a func value, which MsgCall cannot marshal), that
	// would take governance with it and leave no in-band repair.
	//
	// Kept as its own list rather than reusing CodeSubmitters, because reuse
	// would make one list mean different things per policy — and an operator who
	// populated it just to gate MsgRun would silently grant deploy rights the
	// moment governance flipped the policy to "permissioned".
	RunSubmitters []crypto.Address `json:"run_submitters" yaml:"run_submitters"`

	// InertSubmissionCharge is taken from the creator on every MsgAddPackage
	// that parks under the "inert" policy, and paid to InertChargeCollector.
	//
	// Under "inert" the submitter chooses the work and an unattended approval
	// oracle pays for it: MsgEnablePackage runs their init() on ITS transaction
	// and ITS gas meter. Since fees are flat, the oracle's exposure is its fee
	// times the number of approvals it can be induced to make, and it stops
	// approving for everyone once its spend limit is reached. Submitting is
	// close to free today, so that is cheap to provoke. A charge at submit
	// prices it: the attacker pays per approval they induce, and the payer is
	// the party who chose the cost.
	//
	// It is a flat amount and NOT derived from the gas price, deliberately.
	// LastGasPrice is recomputed only in auth.EndBlocker and InitChain runs no
	// EndBlock, so a price-derived amount would collect something different
	// during a fork's replay than the source chain collected, and balances would
	// drift silently. A literal amount replays correctly because params are
	// store-backed: a governance transaction that changed it re-applies at its
	// own point in the replayed history.
	//
	// EMPTY MEANS OFF, and this is what makes replay correct without a carve-out.
	// applyLegacyDefaults must never fill it, and neither must `gnogenesis fork
	// generate` — a chain whose history predates the field then replays
	// charge-free, rather than being charged for submissions that never paid.
	// Governance turns it on going forward. A fork adopting it must do so with a
	// migration tx appended AFTER the history, never in the fork's genesis
	// params, for the same reason CodeSubmissionPolicy must (see AddPackage).
	//
	// Capped by maxInertSubmissionCharge. Without a ceiling, governance could
	// price deploys out of reach entirely, which is the outcome the charge
	// exists to prevent.
	InertSubmissionCharge string `json:"inert_submission_charge" yaml:"inert_submission_charge"`
	// InertChargeCollector receives InertSubmissionCharge. Validate does not look
	// at this field. Two other things keep a zero address away from the charge:
	// applyLegacyDefaults fills a derived placeholder, and the charge site skips
	// a zero collector rather than pay it. Both are load-bearing — neither is a
	// redundant check on the other — and together they make the "charge set,
	// collector unset" combination unrepresentable, rather than a cross-field
	// rule doing it. Cross-field validation on Params was tried and
	// reverted (see the ADR): WillSetParam re-validates the whole struct and
	// PANICS, and r/sys/params sets one key per proposal, so a rule spanning two
	// fields aborts a proposal that already passed its vote.
	//
	// The intended value is an approver treasury, so that submissions fund the
	// approvals they cause. Note that this is a governance convention and not a
	// property of the mechanism: nothing can tell a spendable treasury from a
	// derived address with no private key, and the default IS such an address.
	// Set it before turning the charge on, or the charge is burned.
	InertChargeCollector crypto.Address `json:"inert_charge_collector" yaml:"inert_charge_collector"`
}

Params defines the parameters for the vm module.

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func NewParams

func NewParams(namesPkgPath, claPkgPath, chainDomain, defaultDeposit, storagePrice string, storageFeeCollector crypto.Address, minGetReadDepth100, minSetReadDepth100, minWriteDepth100, iterNextCostFlat, preprocessGasPerByte int64) Params

NewParams creates a new Params object

func (Params) ApplyLegacyDefaults

func (p Params) ApplyLegacyDefaults() Params

applyLegacyDefaults fills fields absent from a params blob written before they existed (GetStruct leaves an absent key zero; a genesis predating the field decodes it as zero too). A zero PreprocessGasPerByte is otherwise unrepresentable — Validate rejects it on every write path — so a zero here can only mean pre-field legacy state. Defaulting it keeps the type-check/ preprocess charge active on legacy chains, keeps WillSetParam's whole-struct re-validation from rejecting an unrelated param update on such state, and lets a relaunch genesis that predates the field still pass ValidateGenesis. ApplyLegacyDefaults is the exported form, for tools that must judge a genesis the way the node will boot it rather than as written.

func (Params) ApplyToGasConfig

func (p Params) ApplyToGasConfig(cfg *store.GasConfig)

ApplyToGasConfig overwrites the governed gas fields of cfg with the values in p. Shared by the anteHandler (tx path) and newGnoTransactionStore (query path) so the two never drift.

Every write is unconditional. For the six depth fields that's safe because store.DefaultGasConfig() initializes them to 0 and zero is a legitimate value ("no floor / use tree estimate"); overwriting 0 with 0 is a no-op. IterNextCostFlat is required to be positive (Validate rejects zero), so a Params that reached this code is guaranteed to have a meaningful value for it.

func (Params) Equals

func (p Params) Equals(p2 Params) bool

Equals returns a boolean determining if two Params types are identical.

func (Params) MarshalBinary2

func (goo Params) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (Params) SizeBinary2

func (goo Params) SizeBinary2(cdc *amino.Codec) (int, error)

func (Params) String

func (p Params) String() string

String implements the stringer interface.

func (*Params) UnmarshalBinary2

func (goo *Params) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

func (Params) Validate

func (p Params) Validate() error

type ParamsKeeperI

type ParamsKeeperI interface {
	params.ParamsKeeperI

	IsRegistered(moduleName string) bool
}

ParamsKeeperI is the limited interface only needed for VM.

type PkgExistError

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

declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.

func (PkgExistError) AssertABCIError

func (PkgExistError) AssertABCIError()

func (PkgExistError) Error

func (e PkgExistError) Error() string

func (PkgExistError) MarshalBinary2

func (goo PkgExistError) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (PkgExistError) SizeBinary2

func (goo PkgExistError) SizeBinary2(cdc *amino.Codec) (int, error)

func (*PkgExistError) UnmarshalBinary2

func (goo *PkgExistError) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type SDKBanker

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

func NewSDKBanker

func NewSDKBanker(vmk *VMKeeper, ctx sdk.Context) *SDKBanker

func (*SDKBanker) GetCoin

func (bnk *SDKBanker) GetCoin(b32addr crypto.Bech32Address, denom string) int64

GetCoin reads one denom without touching any other — the O(1) accessor the balance split exists to provide. GetCoins costs O(denoms held) and an address does not control how many denoms it has been sent.

func (*SDKBanker) GetCoins

func (bnk *SDKBanker) GetCoins(b32addr crypto.Bech32Address) (dst std.Coins)

func (*SDKBanker) IssueCoin

func (bnk *SDKBanker) IssueCoin(b32addr crypto.Bech32Address, denom string, amount int64)

func (*SDKBanker) RemoveCoin

func (bnk *SDKBanker) RemoveCoin(b32addr crypto.Bech32Address, denom string, amount int64)

func (*SDKBanker) SendCoins

func (bnk *SDKBanker) SendCoins(b32from, b32to crypto.Bech32Address, amt std.Coins)

func (*SDKBanker) TotalCoin

func (bnk *SDKBanker) TotalCoin(denom string) int64

type SDKParams

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

func NewSDKParams

func NewSDKParams(pmk ParamsKeeperI, ctx sdk.Context) *SDKParams

func (*SDKParams) GetBool

func (prm *SDKParams) GetBool(key string, ptr *bool) bool

func (*SDKParams) GetBytes

func (prm *SDKParams) GetBytes(key string, ptr *[]byte) bool

func (*SDKParams) GetInt64

func (prm *SDKParams) GetInt64(key string, ptr *int64) bool

func (*SDKParams) GetString

func (prm *SDKParams) GetString(key string, ptr *string) bool

func (*SDKParams) GetStrings

func (prm *SDKParams) GetStrings(key string, ptr *[]string) bool

func (*SDKParams) GetUint64

func (prm *SDKParams) GetUint64(key string, ptr *uint64) bool

func (*SDKParams) SetBool

func (prm *SDKParams) SetBool(key string, value bool)

func (*SDKParams) SetBytes

func (prm *SDKParams) SetBytes(key string, value []byte)

func (*SDKParams) SetInt64

func (prm *SDKParams) SetInt64(key string, value int64)

func (*SDKParams) SetString

func (prm *SDKParams) SetString(key string, value string)

The key has the format <module>:(<realm>:)?<paramname>. Each Set wraps in setWithCheck for module-prefix validation, then captures the byte delta returned by the params keeper and feeds it to recordParamsDelta for per-realm storage-deposit accounting. The keeper's Set methods do their own internal Get-with-nil-gctx to compute the delta — no separate metered read is needed here. See gno.land/pkg/sdk/vm/params_deposit.go.

func (*SDKParams) SetStrings

func (prm *SDKParams) SetStrings(key string, value []string)

func (*SDKParams) SetUint64

func (prm *SDKParams) SetUint64(key string, value uint64)

func (*SDKParams) UpdateStrings

func (prm *SDKParams) UpdateStrings(key string, vals []string, add bool)

type TypeCheckError

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

TypeCheckError deliberately carries no diagnostic strings: it is amino-encoded into ABCIResult.Error, which is merkle-hashed into the block's LastResultsHash, and raw go/types (and go/parser) messages vary in wording, count, and order across Go toolchains — hashing them would let two correctly-rejecting validators commit different result hashes. ErrTypeCheck carries the full messages on the error's msg trace instead, which reaches the user via the unhashed Result.Log.

func (TypeCheckError) AssertABCIError

func (TypeCheckError) AssertABCIError()

func (TypeCheckError) Error

func (e TypeCheckError) Error() string

func (TypeCheckError) MarshalBinary2

func (goo TypeCheckError) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (TypeCheckError) SizeBinary2

func (goo TypeCheckError) SizeBinary2(cdc *amino.Codec) (int, error)

func (*TypeCheckError) UnmarshalBinary2

func (goo *TypeCheckError) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type UnauthorizedUserError

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

declare all script errors. NOTE: these are meant to be used in conjunction with pkgs/errors.

func (UnauthorizedUserError) AssertABCIError

func (UnauthorizedUserError) AssertABCIError()

func (UnauthorizedUserError) Error

func (e UnauthorizedUserError) Error() string

func (UnauthorizedUserError) MarshalBinary2

func (goo UnauthorizedUserError) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (UnauthorizedUserError) SizeBinary2

func (goo UnauthorizedUserError) SizeBinary2(cdc *amino.Codec) (int, error)

func (*UnauthorizedUserError) UnmarshalBinary2

func (goo *UnauthorizedUserError) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type UnobservedSendError

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

UnobservedSendError is returned by MsgCall when a non-empty send-envelope was attached but no executing code ever observed it. Such a call would otherwise strand the coins in the callee's address. See ExecContext.OriginSendObserved.

func (UnobservedSendError) AssertABCIError

func (UnobservedSendError) AssertABCIError()

func (UnobservedSendError) Error

func (e UnobservedSendError) Error() string

func (UnobservedSendError) MarshalBinary2

func (goo UnobservedSendError) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (UnobservedSendError) SizeBinary2

func (goo UnobservedSendError) SizeBinary2(cdc *amino.Codec) (int, error)

func (*UnobservedSendError) UnmarshalBinary2

func (goo *UnobservedSendError) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type UnspendableSendError

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

UnspendableSendError is returned by MsgAddPackage when coins are attached to the deployment of a pure `p/` package. Such a package has no realm identity, so it can never obtain a banker and can never spend from its own address — the coins would be lost for good.

func (UnspendableSendError) AssertABCIError

func (UnspendableSendError) AssertABCIError()

func (UnspendableSendError) Error

func (e UnspendableSendError) Error() string

func (UnspendableSendError) MarshalBinary2

func (goo UnspendableSendError) MarshalBinary2(cdc *amino.Codec, buf []byte, offset int) (int, error)

func (UnspendableSendError) SizeBinary2

func (goo UnspendableSendError) SizeBinary2(cdc *amino.Codec) (int, error)

func (*UnspendableSendError) UnmarshalBinary2

func (goo *UnspendableSendError) UnmarshalBinary2(cdc *amino.Codec, bz []byte, anyDepth int) error

type VMKeeper

type VMKeeper struct {
	// Needs to be explicitly set, like in the case of gnodev.
	Output io.Writer
	// contains filtered or unexported fields
}

VMKeeper holds all package code and store state.

func NewVMKeeper

func NewVMKeeper(
	baseKey store.StoreKey,
	iavlKey store.StoreKey,
	acck AccountKeeperI,
	bank BankKeeperI,
	prmk ParamsKeeperI,
) *VMKeeper

NewVMKeeper returns a new VMKeeper. NOTE: prmk must be the root ParamsKeeper such that ExecContext.Params may set any module's parameter.

func (*VMKeeper) AddPackage

func (vm *VMKeeper) AddPackage(ctx sdk.Context, msg MsgAddPackage) (err error)

AddPackage adds a package with given fileset.

func (*VMKeeper) Call

func (vm *VMKeeper) Call(ctx sdk.Context, msg MsgCall) (res string, err error)

Call calls a public Gno function (for delivertx).

func (*VMKeeper) CommitGnoTransactionStore

func (vm *VMKeeper) CommitGnoTransactionStore(ctx sdk.Context)

func (*VMKeeper) DisablePackage

func (vm *VMKeeper) DisablePackage(ctx sdk.Context, msg MsgDisablePackage) error

func (*VMKeeper) EnablePackage

func (vm *VMKeeper) EnablePackage(ctx sdk.Context, msg MsgEnablePackage) (err error)

EnablePackage activates an inert package: runs the typechecker and initializes the package so it becomes importable and callable on-chain. Only addresses listed in Params.PkgApprovers may call this.

func (*VMKeeper) ExportGenesis

func (vm *VMKeeper) ExportGenesis(ctx sdk.Context) GenesisState

ExportGenesis returns a GenesisState for a given context and keeper

func (*VMKeeper) GetParams

func (vm *VMKeeper) GetParams(ctx sdk.Context) Params

func (*VMKeeper) InitGenesis

func (vm *VMKeeper) InitGenesis(ctx sdk.Context, gs GenesisState)

InitGenesis - Init store state from genesis data

func (*VMKeeper) Initialize

func (vm *VMKeeper) Initialize(
	logger *slog.Logger,
	ms store.MultiStore,
)

func (*VMKeeper) LoadStdlib

func (vm *VMKeeper) LoadStdlib(ctx sdk.Context, stdlibDir string)

LoadStdlib loads the Gno standard library into the given store. It will additionally execute type checking on the mempackages in the standard library.

func (*VMKeeper) LoadStdlibCached

func (vm *VMKeeper) LoadStdlibCached(ctx sdk.Context, stdlibDir string)

LoadStdlibCached loads the Gno standard library into the given store.

This works differently from VMKeeper.LoadStdlib as it performs an initial loading of the stdlib, which is then copied for future use.

LoadStdlibCached is more efficient for programs which have to load a fresh keeper many times (including tests and gnodev). For normal node execution, LoadStdlib should be used instead, for lower memory consumption and faster cold start.

func (*VMKeeper) MakeGnoTransactionStore

func (vm *VMKeeper) MakeGnoTransactionStore(ctx sdk.Context) sdk.Context

func (*VMKeeper) PopulateStdlibCache

func (vm *VMKeeper) PopulateStdlibCache()

PopulateStdlibCache populates the stdlib byte cache on the gno store.

func (*VMKeeper) PopulateStdlibCacheFrom

func (vm *VMKeeper) PopulateStdlibCacheFrom(ms store.MultiStore)

PopulateStdlibCacheFrom populates the stdlib byte cache by reading from the given multistore. Needed at genesis when the persistent gnoStore's baseStore doesn't have stdlib objects yet (they're in the deliver state).

func (*VMKeeper) QueryDoc

func (vm *VMKeeper) QueryDoc(ctx sdk.Context, pkgPath string) (*doc.JSONDocumentation, error)

func (*VMKeeper) QueryEval

func (vm *VMKeeper) QueryEval(ctx sdk.Context, pkgPath string, expr string) (res string, err error)

QueryEval evaluates a gno expression (readonly, for ABCI queries).

func (*VMKeeper) QueryEvalJSON

func (vm *VMKeeper) QueryEvalJSON(ctx sdk.Context, pkgPath string, expr string) (res string, err error)

QueryEvalJSON evaluates a gno expression and returns JSON (Amino-encoded) results.

func (*VMKeeper) QueryEvalString

func (vm *VMKeeper) QueryEvalString(ctx sdk.Context, pkgPath string, expr string) (res string, err error)

QueryEvalString evaluates a gno expression (readonly, for ABCI queries). The result is expected to be a single string (not a tuple).

func (*VMKeeper) QueryFile

func (vm *VMKeeper) QueryFile(ctx sdk.Context, filepath string) (res string, err error)

func (*VMKeeper) QueryFuncs

func (vm *VMKeeper) QueryFuncs(ctx sdk.Context, pkgPath string) (fsigs FunctionSignatures, err error)

QueryFuncs returns public facing function signatures.

func (*VMKeeper) QueryInertPaths

func (vm *VMKeeper) QueryInertPaths(ctx sdk.Context, prefix string, limit int) (paths []string, err error)

QueryPaths returns public facing function signatures. XXX: Implement pagination QueryInertPaths lists packages parked awaiting an approver, under an optional path prefix.

QueryPaths cannot answer this: it ranges the live key space only, so a parked package is missing from every listing. An operator asking "what is waiting on me" had no way to find out, and an oracle restarting had no way to catch up on what it missed while down -- it learns about packages by watching blocks.

Deliberately a plain prefix match, without QueryPaths' @user handling. This answers an operational question about a queue, not a browsing one.

func (*VMKeeper) QueryObjectBinary

func (vm *VMKeeper) QueryObjectBinary(ctx sdk.Context, oidStr string) (res []byte, err error)

QueryObjectBinary retrieves an object by ObjectID and returns its Amino binary representation.

func (*VMKeeper) QueryObjectJSON

func (vm *VMKeeper) QueryObjectJSON(ctx sdk.Context, oidStr string) (res string, err error)

QueryObjectJSON retrieves an object by ObjectID and returns its Amino JSON representation.

func (*VMKeeper) QueryPackageMeta

func (vm *VMKeeper) QueryPackageMeta(ctx sdk.Context, pkgPath string) (res string, err error)

QueryPackageMeta reports what the chain holds at a package path: live, parked awaiting an approver, or nothing at all.

Absent is a successful response carrying Status, not an error. Callers have to tell "this path was never submitted" from "the node could not answer", and an error collapses the two.

It exists because every other query reads the live key space only. Under the "inert" policy a submitted package is stored without being activated, so its creator could see nothing between paying to submit and somebody approving -- vm/qpkg_json and vm/qfile both answer "package not found", the same as for a path nobody ever used.

func (*VMKeeper) QueryPaths

func (vm *VMKeeper) QueryPaths(ctx sdk.Context, target string, limit int) (paths []string, err error)

func (*VMKeeper) QueryPkg

func (vm *VMKeeper) QueryPkg(ctx sdk.Context, pkgPath string) (res string, err error)

QueryPkg returns the named block variables of a package as Amino JSON. This is the entry point for the state explorer: given a package path, return variable names alongside their exported Amino JSON values.

func (*VMKeeper) QueryStorage

func (vm *VMKeeper) QueryStorage(ctx sdk.Context, pkgPath string) (string, error)

QueryStorage returns storage and deposit for a realm.

func (*VMKeeper) QueryType

func (vm *VMKeeper) QueryType(ctx sdk.Context, tidStr string) (res string, err error)

QueryType retrieves a type by TypeID and returns its Amino JSON representation. This resolves RefType references in exported values: given a TypeID like "gno.land/r/demo/boards.Board", return the full type definition with field names.

func (*VMKeeper) RejectPackage

func (vm *VMKeeper) RejectPackage(ctx sdk.Context, msg MsgRejectPackage) error

DisablePackage moves an active package back to inert state. NOTE: full disable requires evicting executed objects from the base store, which is not yet implemented. This stub is provided for interface completeness. RejectPackage deletes a package that is parked awaiting approval.

Nothing else could remove one. DelInertPackage ran only after a successful enable and DisablePackage is unimplemented, so a submission an approver declined occupied the store forever -- and so did one parked under a policy that has since moved off "inert", which no enable can ever activate.

Either the creator or an approver may send it. Both have standing: the bytes are the creator's, and declining them is the approver's job. Anyone else is refused, or a stranger could clear a queue they have no part in.

Not gated on the policy still being "inert". Cleanup is most needed exactly when it is not: those packages are unactivatable and would otherwise be unremovable too.

The submission charge is not refunded. See MsgRejectPackage.

func (*VMKeeper) Run

func (vm *VMKeeper) Run(ctx sdk.Context, msg MsgRun) (res string, err error)

Run executes arbitrary Gno code in the context of the caller's realm.

func (*VMKeeper) SetParams

func (vm *VMKeeper) SetParams(ctx sdk.Context, params Params) error

func (*VMKeeper) WillSetParam

func (vm *VMKeeper) WillSetParam(ctx sdk.Context, key string, value any)

type VMKeeperI

type VMKeeperI interface {
	AddPackage(ctx sdk.Context, msg MsgAddPackage) error
	Call(ctx sdk.Context, msg MsgCall) (res string, err error)
	QueryEval(ctx sdk.Context, pkgPath string, expr string) (res string, err error)
	QueryEvalJSON(ctx sdk.Context, pkgPath string, expr string) (res string, err error)
	QueryObjectJSON(ctx sdk.Context, oidStr string) (res string, err error)
	QueryObjectBinary(ctx sdk.Context, oidStr string) (res []byte, err error)
	Run(ctx sdk.Context, msg MsgRun) (res string, err error)
	LoadStdlib(ctx sdk.Context, stdlibDir string)
	LoadStdlibCached(ctx sdk.Context, stdlibDir string)
	MakeGnoTransactionStore(ctx sdk.Context) sdk.Context
	CommitGnoTransactionStore(ctx sdk.Context)
	PopulateStdlibCache()
	PopulateStdlibCacheFrom(ms store.MultiStore)
	InitGenesis(ctx sdk.Context, data GenesisState)
}

vm.VMKeeperI defines a module interface that supports Gno smart contracts programming (scripting).

Jump to

Keyboard shortcuts

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