Skip to content

docs(testing): add near-mock as in-process alternative to sandbox - #3101

Open
Kampouse wants to merge 1 commit into
near:masterfrom
Kampouse:docs/testing-near-mock
Open

Kampouse wants to merge 1 commit into
near:masterfrom
Kampouse:docs/testing-near-mock

Conversation

@Kampouse

Copy link
Copy Markdown

What

Adds a short section to the Integration Testing guide presenting near-mock — an open-source (MIT) in-process NEAR runtime — as a complement to near-sandbox for cases where a full node is overkill.

Why

  • Fast iteration & hermetic CI: executes unmodified contract wasm via wasmtime in milliseconds — no node, Docker, RPC, or fees. Deterministic replay by pinning seed / block timestamp / epoch / validators via env vars.
  • Chain parity: implements the production host surface (~140 host fns: storage, registers, promise batch actions, validators, epochs) with protocol-accurate gas metering (V155 fee table, fuel-metered by wasmtime) and real crypto precompiles (ecrecover low-s, p256_verify, alt_bn128, keccak512, BLS12-381) using the same crates as nearcore — so contracts behave the same as on-chain.
  • Mainnet forensics: near-mock snapshot <account> <state.bin> pulls a pinned-block state snapshot from any RPC and lets you call it offline — useful for debugging live contracts, diffing behavior across upgrades, and post-mortems.

Where

Inserted right after the sandbox intro note in smart-contracts/testing/integration-test.mdx, before Create Accounts — positioned explicitly as complementary (the Tip keeps near-sandbox as the recommendation for full-node-stack needs).

Happy to adjust placement, tone, or trim if maintainers prefer a different location (e.g. its own page under testing/ or a mention in the tools section).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: NEW❗

Development

Successfully merging this pull request may close these issues.

1 participant