Introducing a new way to review your PRs.

Read the announcement

near / nearcore

Reference client for NEAR Protocol

View on GitHub

20 documents · Updated Nov 23, 2026

docs / virtual-machine-execution

Virtual machine execution

Virtual machine execution runs untrusted WebAssembly contract code inside a bounded and deterministic host boundary. The runner supplies call context, chain services, execution limits, and gas accounting. It returns a result that the runtime uses for transaction, cross-contract, external, or view execution. This page complements runtime execution and transaction and contract execution.

Execution boundary

The VM runner separates guest contract code from node state. It loads a contract method with a VMContext, protocol configuration, gas rules, and an External host interface. It then produces a VMOutcome or a defined runner error.

The contract can access only the host functions allowed by the active protocol and execution mode. It cannot read node state directly. The host turns guest requests into state reads, receipt actions, logs, return data, and resource charges.

This diagram shows the main boundary from contract bytes to a runtime-visible result.

flowchart LR
    A[Contract Wasm and method] --> B[VM preparation and loading]
    B --> C[Guest execution]
    D[VMContext and protocol rules] --> C
    E[HostCtx and External state] <--> C
    C --> F[VMOutcome or execution error]

Execution modes

ExecutionMode defines how a call is funded and which host data it may use. The same runner therefore supports normal receipt execution without giving view or external calls the authority of an internal call.

ModePurposeMain contract rule
InternalRuns a transaction action, cross-contract call, or callback receiptUses attached prepaid gas and normal signer and predecessor context
ViewAnswers a read-only queryUses a per-call gas budget and rejects state-changing or restricted operations
ExternalRuns a contract-authorized call paid for by the current contractHas no attached deposit or caller prepaid gas and uses fixed external-call limits

The context also carries account identities, input, promise results, block data, balances, storage use, contract identity, randomness, and output receivers. These values give guest code the chain view for one call without exposing broader host state.

Mode restrictions are part of the host contract. External calls use the current account as the signer and refund target. They allow used-gas inspection but reject access to the original signer key, predecessor, prepaid gas, and random seed. View calls keep read-only context such as attached deposit but reject caller identity, refund, and prepaid-gas access.

References: runtime/…/context.rs• L11-66 runtime/…/context.rs• L93-154 runtime/…/host.rs• L689-844 runtime/…/context.rs• L105-206 runtime/…/external_call_deposit.rs• L18-87

Contract loading

Contract loading prepares code for safe execution and charges the call for loading it. The runner keeps preparation, compilation, module loading, and method execution as separate stages. Prepared modules can be reused through the contract caches, while loading failures still produce the protocol-defined outcome.

The compilation cache is a performance boundary, not a correctness boundary. Its key combines the contract hash with the VM configuration and backend identity, so a configuration or VM change does not reuse an incompatible compiled artifact. A persistent cache is bounded by disk size and evicts least-recently-used entries. A separate weighted memory cache bounds loaded artifacts. A miss, malformed entry, or eviction leads back to compilation instead of changing contract behavior.

The loading contract includes these checks:

  • The method name must be valid.
  • The code must fit the active VM and protocol limits.
  • The loading base and byte charges must be payable before execution proceeds.
  • Invalid modules, imports, method shapes, and resource sizes must fail without crashing the node.
  • A loading failure must preserve the gas and error behavior selected by the protocol.
  • The cache weight must cover the memory retained by a loaded module, not only the serialized artifact.
  • Cache eviction must remove an artifact from the tracked store when it exceeds the configured disk bound.

The Wasmtime boundary also limits concurrent instances, memories, tables, and table elements. Protocol limits must reject a contract before backend resource limits create an unexpected result. Historical protocol settings can retain an older backend limit when the protocol requires it.

References: runtime/…/gas_counter.rs• L221-265 runtime/…/gas_counter.rs• L421-482 runtime/…/mod.rs• L748-861 runtime/…/load.rs• L9-109 runtime/…/cache.rs• L25-71 runtime/…/cache.rs• L119-151 runtime/…/cache.rs• L268-388 runtime/…/cache.rs• L456-547 runtime/…/cache.rs• L691-759 runtime/…/test_instance_limits.rs• L1-85 runtime/…/test_loaded_module_weight.rs• L1-6 runtime/…/compile_errors.rs• L6-29 runtime/…/runtime_errors.rs• L25-96

Host integration

Host integration gives guest code a stable chain API while keeping runtime-specific details outside the contract logic. HostCtx joins External, VMContext, fees, registers, promise state, stack state, storage-proof tracking, and the current result state.

Each host request follows the same broad pattern: read guest memory or a register, validate the input, charge the operation, apply the chain rule, and write a result or record an action. This keeps invalid pointers, oversized data, prohibited operations, and unaffordable work inside the VM boundary.

Host function surface

The guest-visible imports group the main capabilities that a contract can request from the host. The import declaration is also the shared contract for names, argument shapes, and protocol or feature gates.

CapabilityResult for the contract or chain
Context and economicsReads account identity, call data, block data, balances, deposits, and gas
Registers and memoryMoves data between guest memory, host registers, and returned values
StorageReads, writes, removes, and iterates over contract state
Promises and actionsBuilds dependent calls and records later receipt work
Results and logsReturns bytes and emits bounded log messages
CryptographyProvides deterministic hashes, signature checks, curve operations, and key derivation
Validator and contract dataReads validator stake and contract identity information
InstrumentationCharges guest operations and checks guest stack use

Protocol and feature gates control when newer imports become visible. An import that is not active for the call must not become available only because the backend can implement it.

References: runtime/…/imports.rs• L1-49 runtime/…/imports.rs• L64-94 runtime/…/imports.rs• L112-178 runtime/…/imports.rs• L181-372 runtime/…/host.rs• L38-120 runtime/…/mod.rs• L1191-1219

State and receipt effects

The host keeps call-local state until it can form the execution result. Storage reads and writes affect the current account's state view. Promise calls build a dependency graph that becomes outgoing receipts and actions for later runtime processing.

The call tracks logs, return data, promise results, storage use, account balance, and subsidized deposits. A successful or failed outcome carries the values needed by the runtime to merge the call into receipt processing.

Promise tests treat receipt shape as a contract. They check receiver identity, dependency order, action order, deposits, gas, key actions, global and deterministic state initialization, and yield-related validation. State initialization charges its payload before the host decodes or counts it. An underfunded call therefore cannot cause unpaid host work or record a partial action.

Global contract actions extend this receipt model beyond code stored on one account. A contract can deploy shared code by code hash or account identity, use shared code by either identifier, and create deterministic state initialization for a later receipt. The host validates the identifier or code size, charges the action, and records the action through External. The runtime later applies it.

Yield actions add a data dependency to a callback receipt. The caller can use a runtime-created resumption token or a 32-byte user yield ID. The host rejects malformed IDs and view-mode use. It charges register-backed payloads by their actual size when the charging fix is active. It also applies the callback amount to the current balance or the permitted one-yocto subsidy.

References: runtime/…/host.rs• L616-630 runtime/…/host.rs• L4300-4634 runtime/…/logic.rs• L14-40 runtime/…/logic.rs• L73-143 runtime/…/promises.rs• L20-47 runtime/…/promises.rs• L464-641 runtime/…/yield_resume.rs• L45-190 runtime/…/yield_resume.rs• L192-326

Gas and resource accounting

Gas accounting bounds both guest work and host work. The counter separates burnt gas from gas reserved for promises. It then limits total use by the mode-specific burnt and prepaid budgets.

Guest instrumentation reports Wasm work through internal imports. Host functions charge memory access, storage, cryptography, receipt actions, contract loading, and other chain work. The remaining budget also bounds guest-only loops. A contract cannot avoid the cap by making no host calls.

The accounting contract includes the following relationships:

  • Internal calls use the call's prepaid gas.
  • View calls use the configured view cap for both guest and host work.
  • External calls use fixed burnt and total-prepaid limits. The runtime charges their gas against the contract after the call.
  • Promise gas reduces the remaining amount that the current call may burn.
  • An outcome reports burnt gas, used gas, compute use, and the profile needed by downstream runtime accounting.

ProfileDataV3 separates action gas, host-operation gas, and Wasm gas. The runner uses these groups with send-action compute use to report compute use without changing the gas result.

Gas tests preserve charge order and the result at the point where either the burnt-gas or total-used-gas limit is crossed. Real Wasm tests also verify that view and external caps stop loops that never call the host.

References: runtime/…/context.rs• L125-153 runtime/…/gas_counter.rs• L33-49 runtime/…/gas_counter.rs• L72-123 runtime/…/gas_counter.rs• L125-218 runtime/…/gas_counter.rs• L368-400 runtime/…/host.rs• L279-388 runtime/…/profile.rs• L8-17 runtime/…/profile.rs• L90-175 runtime/…/mod.rs• L1105-1135 runtime/…/gas_counter.rs• L16-196 runtime/…/view_call_gas_limit.rs• L30-104 runtime/…/external_call_gas_limit.rs• L20-95

External calls

An external call is a contract-authorized call that the current contract funds. The VM accepts no attached deposit, does not expose the original transaction's signer or predecessor context, and keeps gas charging to the runtime after the call.

The external burnt budget is reduced by any fee gas already spent before the method runs. Promise gas can use the separate total-prepaid limit, but the VM still prevents guest work from exceeding the external burnt cap. The VM does not deduct this gas from the contract balance. It only limits deposits by that balance, then leaves the runtime to charge gas after the call. Real Wasm tests verify both the zero-deposit rule and the cap with a loop that has no host imports.

References: runtime/…/context.rs• L93-143 runtime/…/host.rs• L689-844 runtime/…/context.rs• L136-181 runtime/…/gas_counter.rs• L132-289 runtime/…/external_call_deposit.rs• L1-87 runtime/…/external_call_gas_limit.rs• L20-95

External host-function contract

External calls use the same import surface as ordinary calls, but each host function has an explicit policy. A function can fail because the value is not safe to expose, return a value that reflects the contract-funded call, or behave as it does in an ordinary call.

The runtime test keeps this policy aligned with the import list. Every real host function must have a decision before it ships. This prevents a new import from silently exposing signer data, predecessor data, random data, prepaid gas, or other internal-call authority to an external call.

References: runtime/…/external_call_host_functions.rs• L3-16 runtime/…/external_call_host_functions.rs• L18-119 runtime/…/external_call_host_functions.rs• L122-150 runtime/…/host.rs• L689-844 runtime/…/tests.rs• L4-10

Execution outcomes

The runner turns call-local state into a VMOutcome. The outcome contains return data, logs, balance, storage use, gas, compute use, profiling data, and an optional contract-level abort.

The runner must distinguish a defined contract failure from an unsafe VM failure. A contract failure can be represented in the outcome and processed by the runtime. A runner failure means the node could not produce a safe deterministic contract result.

Contract errors

Contract errors describe a call that reached a defined execution boundary. Examples include a missing method, a rejected host request, a trap classified by the runner, invalid input, or exhausted gas. The outcome keeps the gas and other call effects that the runtime needs even when the call aborts.

Protocol settings can preserve older error and loading behavior. For example, older behavior can leave a preparation failure as a zero-gas runner error, while newer behavior returns a gas-bearing loading abort. This matters when the same malformed or unloadable code must produce a historical result under an older protocol and a charged abort under a newer one.

Host input errors remain contract-level failures when the guest supplies invalid data. This includes malformed BLS12-381, P-256, or ML-DSA encodings and malformed yield tokens. Errors from the External interface or inconsistent runtime state remain runner errors because the VM cannot safely turn them into a contract result.

Compilation messages are bounded before they cross the compilation boundary. This keeps in-process and daemon compilation on the same error contract and prevents an oversized compiler message from becoming unbounded stored state.

References: runtime/…/errors.rs• L9-68 runtime/…/errors.rs• L127-172 runtime/…/errors.rs• L245-406 runtime/…/errors.rs• L446-463 runtime/…/mod.rs• L425-478 runtime/…/logic.rs• L115-143 runtime/…/logic.rs• L219-281 runtime/…/compile_errors.rs• L6-29 runtime/…/runtime_errors.rs• L14-96

Return data and promise results

runtime/…/types.rs defines the values that connect one call to later runtime work. ReturnData is either a byte value from the current method, a receipt reference whose result will become the method result, or no value. Callback code reads each prior promise as successful data, failure, or not-ready state through the host.

The host preserves these meanings in the outcome and callback interface. promise_return selects a receipt result for the current function, while value_return stores bytes directly. promise_result copies successful callback data into a register and reports a status for the other cases.

References: runtime/…/types.rs• L5-41 runtime/…/host.rs• L4604-4712 runtime/…/host.rs• L4719-4781 runtime/…/logic.rs• L14-40 runtime/…/logic.rs• L219-249

Result state

ExecutionResultState is the call-local record that connects host effects to the final outcome. It starts with the account balance plus attached deposit. It then updates balance, storage use, logs, return data, gas, and subsidy information as the contract runs.

Promise and action operations reduce the available balance for attached amounts. External-call gas is kept separate because the runtime charges it after the VM returns. This lets the final outcome describe both what the contract changed and what the runtime must charge or schedule next.

References: runtime/…/logic.rs• L14-64 runtime/…/logic.rs• L67-113 runtime/…/logic.rs• L115-143

Runtime test contracts

The runtime tests use small Wasm modules, direct host calls, compiled guest contracts, generated modules, and cache-boundary checks as repeatable contracts for the VM boundary. They vary context, mode, fees, gas, memory, imports, backend limits, and host state. They then assert the result or the host action record.

Direct host tests

The direct host tests use VMLogicBuilder to create a fixed context with a mocked External, test configuration, and test fees. The builder also creates view, external, and free-gas variants so the same host rule can be checked under different execution contracts.

These tests isolate host behavior without requiring a complete guest module. They cover gas limits, action charge order, memory and register movement, promise validation, balance deductions, cryptographic input handling, and yield argument, balance, payload charging, and mode checks. Context tests also pin which identity and gas functions are allowed in view and external modes.

References: runtime/…/vm_logic_builder.rs• L1-69 runtime/…/vm_logic_builder.rs• L71-93 runtime/…/context.rs• L126-235 runtime/…/gas_counter.rs• L403-510 runtime/…/p256_verify.rs• L36-83 runtime/…/promises.rs• L88-115 runtime/…/yield_resume.rs• L5-522

Host-surface coverage

The external-call coverage test treats the host import list as a policy surface. It compares the declared imports with a decision table and fails when an import has no external-call behavior or when the table names an import that no longer exists.

This test protects the default behavior for newly added host functions. It makes an external-call policy change visible during review instead of allowing a new function to inherit access without an explicit decision.

References: runtime/…/external_call_host_functions.rs• L14-16 runtime/…/external_call_host_functions.rs• L122-150 runtime/…/tests.rs• L4-10

Real VM tests

Real VM tests compile or construct Wasm modules and run them through the actual import and execution boundary. They verify that guest-visible signatures, enabled imports, memory direction, guest-only gas limits, and execution-mode rules match the direct host behavior.

The external-call tests are a focused example. One contract reads the attached deposit and returns it. Another is an infinite guest loop with no imports. Together they prove both the economic rule and the fact that the VM stops guest work at the external cap. The view-call test applies the same protection to a read-only query.

The test builder also runs a contract across selected runtime configurations and compares the visible outcome. It can hide unstable backend text while still checking the result shape and requiring available VM variants to agree.

References: runtime/…/test_builder.rs• L13-52 runtime/…/test_builder.rs• L156-257 runtime/…/external_call_deposit.rs• L18-87 runtime/…/external_call_gas_limit.rs• L20-95 runtime/…/view_call_gas_limit.rs• L30-104 runtime/…/imports.rs• L64-94

Generated module tests

Generated module tests exercise the safety envelope with Wasm shapes that are hard to maintain as hand-written contracts. Fuzz tests feed arbitrary modules through preparation and execution and require the runner to return a result or a controlled error without crashing.

Wasmtime limit tests use modules near protocol limits for functions, globals, tables, types, and memory. They check that protocol limits remain stricter than backend metadata limits. Loaded-module tests use varied module shapes and contract samples to check that the cache weight covers retained memory. Cache tests also check that disk bounds evict old files, that hot entries survive a later write, and that missing or oversized files become safe cache misses rather than persistent artifacts. These tests protect node memory and disk use when compiled modules are reused.

References: runtime/…/fuzzers.rs• L13-42 runtime/…/fuzzers.rs• L69-139 runtime/…/test_instance_limits.rs• L1-85 runtime/…/test_loaded_module_weight.rs• L1-6 runtime/…/test_loaded_module_weight.rs• L230-272 runtime/…/cache.rs• L1045-1265

Cryptography tests

Cryptography tests treat deterministic host math as part of the contract boundary. The P-256 tests cover valid verification, invalid signatures and keys, altered messages, input length rules, register-backed inputs, and gas that scales with the message and input reads. They also pin the rule that the caller supplies a prehash and that a prehash shorter than 16 bytes returns failure.

These checks protect both the returned result and the cost contract. They also make clear that the host verifies the caller-supplied prehash rather than hashing the message as a separate step. The integration tests then check that the same result and input errors cross the real Wasm boundary.

References: runtime/…/host.rs• L2098-2226 runtime/…/p256_verify.rs• L20-33 runtime/…/p256_verify.rs• L85-181 runtime/…/p256_verify.rs• L184-269 runtime/…/p256_verify.rs• L328-425 runtime/…/p256_verify.rs• L452-534 runtime/…/p256_verify_integration.rs• L180-239

BLS12-381 tests

BLS12-381 tests protect the curve-operation contract exposed to guest code. They cover point sums, multi-exponentiation, decompression, field-to-curve mapping, and pairing checks for both curve groups. Malformed encodings and subgroup membership are treated as defined host results.

The tests compare host results with an independent curve model and standard test vectors. They also run memory and register inputs, verify per-element gas charging, and exercise the protocol-gated handling of the (0, ±2) points. The gate changes sum and decompression behavior without weakening the explicit subgroup checks used by pairing and multi-exponentiation.

References: runtime/…/bls12381.rs• L17-24 runtime/…/bls12381.rs• L55-223 runtime/…/bls12381.rs• L283-337 runtime/…/host.rs• L122-179 runtime/…/host.rs• L1196-1517 runtime/…/bls12381.rs• L30-98 runtime/…/bls12381.rs• L1295-1477 runtime/…/bls12381.rs• L1798-2265

Change checklist

When these files or sections are changed, remember to consider these:

  • A host import change must stay aligned across its declaration, feature or protocol gate, backend binding, HostCtx behavior, and direct and real-VM tests.
  • A new host import must also receive an explicit external-call decision. The import list and the decision table must remain in sync.
  • A change to ExecutionMode or VMContext must preserve the host restrictions, deposit rule, gas source, and balance result for internal, view, and external calls.
  • A gas change must bound both host calls and guest-only Wasm work. It must preserve the difference between burnt gas and promise gas.
  • A promise or action change must preserve receipt receiver, dependency order, action order, attached balance, gas reservation, and later runtime validation.
  • A global contract or deterministic state action change must preserve identifier form, code and state size limits, view restrictions, action fees, and the action recorded for the later receipt.
  • A change to loading charges, cache keys, cache eviction, cache weights, backend limits, or VMOutcome must preserve protocol-specific abort behavior, stale-artifact isolation, node memory and disk bounds, and all fields needed for runtime receipt processing.
  • A return or promise-result type change must preserve the link between direct values, receipt results, and callback status codes.
  • A cryptographic import change must preserve valid results, invalid-input behavior, register-backed inputs, curve subgroup checks, protocol-gated BLS behavior, and input-based gas charges across direct and real-VM tests.
  • A yield change must keep malformed runtime and user IDs, register-input charging, balance deductions, one-yocto subsidy rules, and prohibited view operations aligned with the full runtime behavior.
  • A change to compiler or Wasmtime versions must preserve artifact compatibility, compilation error bounds, instance-limit assumptions, and the loaded-module cache weight estimate.
  • A profile change must preserve the split between action gas, host gas, Wasm gas, send-action compute use, and the stable serialized profile shape.

Important failure modes

TriggerConsequenceGuard
A guest imports a function disabled for the active protocolThe module fails at preparation or linkingKeep import declarations and gates aligned with host support
A new host function has no external-call decisionThe import can ship with an unreviewed external-call policyRequire every real import to appear in the external-call decision table
A view or external call runs a guest-only loop without a bounded guest budgetThe call can remain busy without reaching a host gas checkSeed guest accounting from the mode-specific remaining budget
An external call carries a non-zero depositThe call aborts before it can produce a valid resultReject deposits at the external execution boundary
Promise gas or action fees exceed the available budgetThe call returns a defined gas error with bounded burnt and used gasPreserve charge order and test both burnt and total-used limits
A host function reads or writes outside guest memoryThe call returns a memory error or could use invalid dataValidate ranges and require writable buffers for host output
State-init work is decoded before its payload charge succeedsThe host can perform unpaid work or record no valid actionCharge size terms before decoding and action creation
A global contract identifier has the wrong form or lengthThe action is rejected instead of creating a usable shared-code referenceValidate code hashes and account IDs at the host boundary
A state-changing global contract action runs in view modeThe read-only call is rejectedKeep deployment, use, and state-init actions prohibited in view mode
A malformed yield or cryptographic input reaches the host without validationThe call returns inconsistent errors or invalid resultsKeep identifier, length, curve, prehash, and register input checks in the host boundary
A BLS protocol gate changes sum or decompression behavior without matching subgroup rulesHistorical calls and new calls disagree, or invalid points pass a changed pathKeep the versioned parse rule separate from explicit pairing and multi-exponentiation subgroup checks
A register-backed BLS or yield payload is charged from the sentinel length instead of the loaded dataThe call can overflow gas before reading valid register inputCharge per-item or per-byte work after resolving register input under the fixed protocol behavior
A yield callback amount exceeds the balance, or a non-zero amount is assumed subsidizedThe receipt is rejected or the result state records the wrong balanceDeduct the amount and allow only the configured one-yocto zero-balance exception
A preparation failure is handled as an uncharged runner error after the loading-cost protocol changeContract loading work is not charged and runtime behavior changesPreserve protocol-gated loading errors and gas-bearing aborts
A cache key omits a VM or configuration inputAn incompatible compiled artifact can be reusedDerive the key from the contract hash, non-crypto VM configuration, VM kind, and backend identity
A disk cache entry is evicted without removing its file, or a replacement exceeds the boundDisk use can exceed its configured limit or stale data can remain visibleTrack the serialized entry size and unlink evicted or oversized files
A cache hit does not refresh recencyA hot compiled artifact is evicted by later writesTouch successful reads and test hot and cold eviction order
A malformed or externally removed cache file is treated as a fatal VM errorA cache corruption or operator action can disrupt node startup or executionTreat invalid files as misses and allow compilation to rebuild them
A loaded-module weight counts only serialized bytesThe in-memory cache can exceed its memory boundInclude retained Wasmtime metadata and data memory in the weight estimate
A backend upgrade exceeds the protocol's instance metadata envelopeA contract that should be valid no longer loads, or backend failure replaces a protocol errorKeep protocol-limit and loaded-module boundary tests near the backend upgrade

Key files

FileWhy to read it
runtime/…/runner.rsDefines the public runner boundary and the preparation and execution contract.
runtime/…/cache.rsDefines compiled-artifact cache identity, persistent and memory cache bounds, precompilation, and cache recovery behavior.
runtime/…/mod.rsShows how the active VM compiles, caches, loads, links imports, runs Wasm, bounds resources, and returns an outcome.
runtime/…/load.rsDefines the loaded-module boundary and the memory weight used by the in-memory contract cache.
runtime/…/context.rsDefines call context and internal, view, and external execution modes.
runtime/…/imports.rsDefines guest-visible host imports and their gates.
runtime/…/host.rsConnects guest memory and registers to chain state, actions, resource charges, global contract actions, yield resumption, and cryptographic verification.
runtime/…/bls12381.rsDefines deterministic BLS12-381 parsing, curve operations, pairing checks, and protocol-version behavior.
runtime/…/types.rsDefines return data, callback result states, and global contract identifiers used across the host boundary.
runtime/…/gas_counter.rsDefines mode budgets, promise gas, loading charges, and gas-limit behavior.
runtime/…/profile.rsDefines the gas profile and its compute-use calculation and serialized form.
runtime/…/logic.rsDefines call-local result state and the VM outcome.
runtime/…/errors.rsDefines the boundary between contract-call errors and runner failures, including bounded compiler messages and cryptographic and yield input errors.
runtime/…/vm_logic_builder.rsBuilds focused host tests for normal, view, external, and free-gas calls.
runtime/…/context.rsProtects context values and mode-specific host restrictions.
runtime/…/gas_counter.rsProtects gas limits, charge order, external-call payment rules, and guest accounting.
runtime/…/promises.rsProtects promise dependencies, receipt actions, global and deterministic state initialization, and balance effects.
runtime/…/yield_resume.rsProtects yield ID validation, register payload charging, view restrictions, callback balance rules, and action recording.
runtime/…/bls12381.rsProtects BLS12-381 results, encodings, subgroup behavior, protocol gates, memory limits, register inputs, and gas charges.
runtime/…/p256_verify.rsDefines the direct cryptographic result and gas contract for P-256 verification.
runtime/…/p256_verify_integration.rsExercises P-256 import wiring, Wasm memory transfer, VM-variant agreement, and error propagation.
runtime/…/external_call_host_functions.rsKeeps every guest-visible host import tied to an explicit external-call policy.
runtime/…/external_call_deposit.rsExercises the external-call deposit rule through real Wasm.
runtime/…/external_call_gas_limit.rsProves that a pure Wasm external call stops at its gas cap.
runtime/…/view_call_gas_limit.rsProves that a pure Wasm view call stops at its per-call gas cap.
runtime/…/fuzzers.rsExercises arbitrary Wasm modules and checks that preparation and execution return controlled results.
runtime/…/test_builder.rsRuns contract outcomes across runtime configurations and checks stable result contracts.
runtime/…/test_instance_limits.rsProtects the relation between protocol resource limits and Wasmtime instance metadata limits.
runtime/…/test_loaded_module_weight.rsProtects the cache weight estimate against retained Wasmtime module memory.
runtime/…/compile_errors.rsShows preparation failures for malformed modules and oversized contract structure.
runtime/…/runtime_errors.rsShows runtime traps, gas limits, import failures, and protocol changes to loading errors.