Skip to main content

xian-vm-core

xian-vm-core is the Rust-side consumer of the frozen xian_vm_v1 compiler IR emitted by xian-contracting.

flowchart LR
  Source["Contract source"] --> Compiler["xian-contracting compiler"]
  Compiler --> IR["xian_vm_v1 IR"]
  IR --> Validator["Rust IR validator"]
  Validator --> VM["Native VM execution slice"]
  VM --> Host["Host storage and syscall bridge"]
  Host --> State["Deterministic state and events"]
  Fixtures["Python parity fixtures"] --> Validator
  Fixtures --> VM

Supported scope:

  • deserialize the structural JSON IR
  • validate its top-level invariants and recursive node shapes
  • instantiate validated modules and execute a direct-IR interpreter slice
  • provide one Rust-owned contract for the Python frontend to target
  • expose a minimal Python-facing native capability surface for xian-abci probing via xian_vm_core._native

Execution coverage is intentionally narrow but real:

  • local function calls and builtin calls such as len, range, str, and isinstance
  • aggregate/container helpers such as sorted, sum, min, max, all, any, reversed, and zip
  • explicit storage ops for Variable and Hash
  • foreign storage reads for ForeignVariable and ForeignHash, including function-local references with dynamic contract/variable targets
  • arbitrary-precision integer values instead of i64-only VM integers
  • fixed-precision decimal(...) construction and arithmetic
  • native datetime.datetime / datetime.timedelta values, including datetime.datetime.strptime(...), arithmetic, comparison, and common field access
  • bigint-oriented builtins needed by the shielded contracts, including int(..., base), pow(base, exp, mod), and format(value, "064x")
  • hashlib.sha3(...) and hashlib.sha256(...)
  • crypto.verify(...) and crypto.key_is_valid(...)
  • LogEvent emission
  • static-import and dynamic-import contract export calls
  • native container method calls used by contracts today, including dict.keys(), dict.values(), dict.items(), dict.get(), and the common mutable list helpers append, extend, insert, remove, and pop
  • native string helpers used by the shielded contracts, including lower(), isalnum(), startswith(...), and join(...)
  • Python-style subscript slicing for list, tuple, and str, including the value[2:] helper pattern used in the shielded contracts
  • sequence repetition for list, tuple, and str
  • host-delegated zk.* syscalls, which remain explicit runtime boundary calls instead of Rust-local protocol logic

It is a bounded execution slice, not the full executor.

The crate includes curated conformance fixtures generated from the current local harness. Those fixtures are checked from Rust so the VM can match actual contract behavior on a controlled contract subset alongside hand-written executor tests.

Metering covers both host-side data costs and VM execution:

  • storage reads, writes, transaction bytes, and return-value bytes are charged directly in the VM host path
  • execution cost is driven by an explicit xian_vm_v1 gas schedule over VM statements, expressions, calls, and loop iterations
  • module initialization is metered, so first-load authored contracts do not get free global-declaration and module-body execution
  • contract.exists(...), contract.has_export(...), contract.info(...), and related contract metadata syscalls resolve directly against the driver/IR in the native host bridge
  • authored contract storage persists __xian_ir_v1__, and the native host requires that validator-derived artifact for xian_vm_v1 execution; stored __source__ remains available for dashboards, BDS, and other inspection tooling
  • native deployment accepts cleartext source only, rejects submitted deployment_artifacts, and derives vm_ir_json through the pinned compiler before staging writes
  • native deployment requires explicit deterministic now context from the caller; the host does not fall back to local wall-clock time for submission metadata
  • the native deployment path validates the compiler-produced IR before staging writes or executing constructors
  • the Python deployment path and offline tooling keep canonical source-to-runtime recompilation in the Python artifact validator; the native path is Rust-native for bundle validation, not a Rust recompiler
  • the five-node make localnet-parallel-e2e native-authority soak passes end to end, including shielded token flows and parallel prefix-scan access patterns

That parity corpus covers:

  • storage/event flows
  • range/list/dict control-flow helpers
  • foreign storage reads
  • fixed-precision decimal semantics
  • datetime/timedelta behavior
  • bigint parsing, modular arithmetic, hex formatting, and shielded-style helper flows
  • hashing and ed25519 verification helpers
  • static-import and dynamic-import nested contract calls
  • real authored shielded contract sources for shielded-note-token and shielded-commands, including constructor-seeded state snapshots and hash-helper exports
  • real authored token, registry, game, and oracle flows across repos, including: currency.transfer(...), stable_token.burn(...), reflection_token.transfer(...), profile_registry.create_channel(...), turn_based_games.join_match(...), and oracle.price_info(...)

The intent is to keep the Xian VM implementation Rust-first for performance, while still freezing semantics in the Python compiler frontend before runtime execution work starts.

The crate ships a small PyO3/maturin surface for integration work:

  • runtime_info() / runtime_info_json()
  • supports_execution_policy(...)
  • validate_module_ir(...) / validate_module_ir_json(...)

That surface is intentionally narrow. It is there so node-side code can probe the VM runtime honestly before transaction execution is wired through the Rust engine.

The largest remaining runtime work is metering drift on the heaviest authored flows and the host-operation split between delegated calls and Rust-owned implementations. Integer width, basic authored shielded execution, and pre-call setup flows are covered by the authored parity corpus and fixture generator.

Releases

Push a vm-core-vX.Y.Z tag with matching versions in pyproject.toml and Cargo.toml after ../../scripts/validate-release.sh passes. The release workflow builds native wheels for Linux, macOS Intel/ARM and Windows, and a source distribution. PyPI Trusted Publishing uses project xian-tech-vm-core, owner xian-technology, repository xian-contracting, workflow release.yml and environment pypi-xian-vm-core.

Runtime semantics are consensus-sensitive. Validators must use the same accepted VM version; existing histories containing previously failed dynamic foreign-storage calls need an explicit upgrade boundary.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xian_tech_vm_core-0.1.1.tar.gz (774.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

xian_tech_vm_core-0.1.1-cp314-abi3-win_amd64.whl (798.1 kB view details)

Uploaded CPython 3.14+Windows x86-64

xian_tech_vm_core-0.1.1-cp314-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (961.1 kB view details)

Uploaded CPython 3.14+manylinux: glibc 2.17+ x86-64

xian_tech_vm_core-0.1.1-cp314-abi3-macosx_11_0_arm64.whl (846.3 kB view details)

Uploaded CPython 3.14+macOS 11.0+ ARM64

xian_tech_vm_core-0.1.1-cp314-abi3-macosx_10_12_x86_64.whl (894.8 kB view details)

Uploaded CPython 3.14+macOS 10.12+ x86-64

File details

Details for the file xian_tech_vm_core-0.1.1.tar.gz.

File metadata

  • Download URL: xian_tech_vm_core-0.1.1.tar.gz
  • Upload date:
  • Size: 774.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for xian_tech_vm_core-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8cefe1982fc30eaa0246dabb2048f46a6d07254e6042fd277eced33021ef7940
MD5 82646f6ad5aee0e1033eccda3736f45e
BLAKE2b-256 40a3844d4b25c1809a284b0e5a69d0142d1d2396ad496aa2cdecf9f17a986a29

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_vm_core-0.1.1.tar.gz:

Publisher: release.yml on xian-technology/xian-contracting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xian_tech_vm_core-0.1.1-cp314-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for xian_tech_vm_core-0.1.1-cp314-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 af6bb96199a7f7e8d157e8480d46a8935636728c77109cd66b51fd84903fec80
MD5 a26e93b8520a3a6b0029ca5303a3f2db
BLAKE2b-256 69d0d84b867b5a668bc5a69d3a1d83df356539ffcf327cf75d5b7847930e2e09

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_vm_core-0.1.1-cp314-abi3-win_amd64.whl:

Publisher: release.yml on xian-technology/xian-contracting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xian_tech_vm_core-0.1.1-cp314-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xian_tech_vm_core-0.1.1-cp314-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b254527d5b96cf2e0cc5a1cee59fcc588fbc8a4d8e8b27fbf1ca737846c03311
MD5 fbec44753b369793f96758fd15e2dceb
BLAKE2b-256 68f6c0995de0e6497fb843a074ab38263a2154deca2ba52982a575d13341c3fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_vm_core-0.1.1-cp314-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on xian-technology/xian-contracting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xian_tech_vm_core-0.1.1-cp314-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xian_tech_vm_core-0.1.1-cp314-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1c4a20d3f9daa86f3f7cf8bc39b2886248cd9db73f5a4369e3acf6151582f446
MD5 9a938ab2b8ac4bab660129365cecc91b
BLAKE2b-256 3823825df780513a63a927c90033854e669f8f6c65aa505f52356678e96c4bf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_vm_core-0.1.1-cp314-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on xian-technology/xian-contracting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xian_tech_vm_core-0.1.1-cp314-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for xian_tech_vm_core-0.1.1-cp314-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 cc2aa0a0b0399fb5830e3a419d90a4fc17d1b16c74d0f42edb258475b1b541bc
MD5 3a6bc443ecc45c96bdcfe511464e76f1
BLAKE2b-256 fb51307313b548707ff0ef0d76011af61b71d94777f62230ee96242665e3a448

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_vm_core-0.1.1-cp314-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on xian-technology/xian-contracting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.2

5 files

This release

0.1.1 This release

5 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page