Skip to content
JAMdotTechPublic

About

PyJAMaz | Python Implementation of JAM Protocol

Topics

Resources

Stars

2 stars

Watchers

2 watching

Forks

Repository files navigation

pyJAMaz

a Python implementation of the JAM protocol.

Install from source

pip install .

Run fuzzer target

pyjamaz fuzzer target --socket-path=/tmp/jam_target.sock

The v1 target skips the historical lookup-anchor check (GP 11.38) only during imports in sessions where the peers did not both advertise ancestry support, as required by the conformance protocol. Lookup age and recent-anchor checks remain active. Ordinary block imports retain strict ancestry validation. Ancestry support remains unadvertised: v1 hash/slot hints alone do not supply the historical state-root commitments required by GP 0.8.0.

traces <folder> and fuzzer traces <folder> accept shortened conformance traces without genesis.bin. Both use the first record's header and posterior state as the initialization checkpoint, then replay the remaining candidates. The fuzzer client opens a fresh session for each independent trace directory and verifies the target's actual parent state after an expected rejection. For local traces replay, the CLI reports the fuzzer ancestry policy when loading the checkpoint; use --strict-ancestry to retain the historical lookup check. Local corpora with genesis.bin always retain strict ancestry validation. For fuzzer traces, the handshake determines the ancestry policy.

Running fuzzer target using Docker

docker run -v /tmp:/tmp
-e JAM_FUZZ=1
-e JAM_FUZZ_SPEC=tiny
-e JAM_FUZZ_DATA_PATH=/tmp/pyjamaz_data/
-e JAM_FUZZ_SOCK_PATH=/tmp/jam_target.sock
-e JAM_FUZZ_LOG_LEVEL=info
jamdottech/pyjamaz:latest

Build and publish multi-arch Docker image

docker buildx create --name multiarch-builder --use
docker buildx inspect --bootstrap
docker buildx build --platform linux/amd64,linux/arm64 -t jamdottech/pyjamaz -t jamdottech/pyjamaz:vX.Y.Z-gpX.Y.Z --push .

The Docker build warms the Numba cache from the interpreter's canonical signatures and stops on compilation errors. After removing Python sources, it runs scripts/check_numba_cache.py in a fresh process with project recompilation blocked by the cache-only guard. The check executes a small PVM program and verifies its registers, gas, program counter, exit status, and interpreter cache hit. Both target architectures must pass this check before an image is published.

JAM prize M1 accounts

  • Polkadot: 146CmUoArEi1E2AogKCU5gkhBSN6BLDzxecFSCDAgVyEshra
  • Kusama: DBPAKp9B2gpBr9YmvqXyewYkR4ZwTn9uJDt64zGcVjZeiGi

Fellowship M1 nominations

License

https://github.com/JAMdotTech/pyjamaz/blob/main/LICENSE

Graypaper 0.8 PVM tests

The default instruction suite uses the updated graypaper-gas-3/pvm/programs fixtures, copied unchanged into test/fixtures/pvm/gas-cost. The upstream gas-tests fixtures are in test/fixtures/pvm/integration-tests and check block costs for Doom, Pinky, and prime-sieve without executing those programs.

Run from the repository root with the project dependencies installed:

python -m pytest test/test_pvm_instructions.py -q
PVM_TEST_VECTORS=fixtures/pvm/integration-tests/ python -m pytest test/test_pvm_instructions.py -q
python -m pytest test/test_graypaper_08.py test/test_pvm_gas_regressions.py test/test_pvm_memory.py test/test_cpython_mmap_memory.py test/test_hostcalls_general.py test/test_hostcalls_accumulate.py -q

Set PVM_INTERPRETER to GRAYPAPER, CPYTHON, NUMBA_JIT, or NUMBA_AOT (the default) to select a backend. Rebuild precompiled Numba caches when deploying this change; NUMBA_CACHE_DIR can select an empty directory for verification.

This PVM uses the 0.8 opcode and hostcall numbering, grow_heap, and the hostcall gas schedule in Appendix I.4.5. Programs built against the earlier ABI must be rebuilt. The interpreter's pc retains the stopping instruction for diagnostics and the supplied vector format; host invocation results and saved inner-VM state return zero for a final halt or panic, as specified by Appendix A.1.

About

PyJAMaz | Python Implementation of JAM Protocol

Topics

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages