Install dependencies with uv:
uv syncInitialize git submodules (required for test_cross_contract and other tests that use external contracts):
git submodule update --initSome tests require stellar CLI. The project pins to v23.1.3 — stellar contract bindings json was removed in v26. Download the pre-built binary:
curl -fsSL https://github.com/stellar/stellar-cli/releases/download/v23.1.3/stellar-cli-23.1.3-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/.cargo/bin/Verify with:
stellar --version # should show 23.1.3
stellar contract bindings json --helpThe K semantics must be compiled before running any tests. This is required on first setup and whenever .md files under src/komet/kdist/ are changed:
make kdist-buildThis compiles all targets (llvm, llvm-tracing, llvm-library, haskell). It will take several minutes.
To rebuild a single target (e.g. after changing tracing semantics):
uv run kdist -v build soroban-semantics.llvm-tracingRun the full test suite:
make test-allOr by category:
make test-unit # unit tests only (no compiled semantics required)
make test-integration # integration tests (requires compiled semantics)
make test-lemmas # lemma testsTo run a specific test or filter by name:
uv run pytest src/tests/integration -k "tracing" --verboseKomet can produce an execution trace while running a test. Pass --trace-file to write one JSON record per instruction to a file.
komet run --trace-file trace.txt src/tests/integration/data/errors.wast > out.txtkomet test -C src/tests/integration/data/soroban/contracts/test_adder/ \
--id test_add --trace-file trace.txt --max-examples 1Each line is a JSON record:
| Field | Description |
|---|---|
pos |
Byte offset of the instruction in the binary, or null for instructions inserted by the semantics |
instr |
The instruction and its operands |
stack |
Value stack at the time of execution |
locals |
Local variable bindings at the time of execution |
Example:
{"pos":599,"instr":["local.get",0],"stack":[],"locals":{"0":["i64",4]}}
{"pos":601,"instr":["const","i64",255],"stack":[["i64",4]],"locals":{"0":["i64",4]}}Before opening a PR, make sure formatting and type checks pass:
make checkTo auto-fix formatting:
make format- Semantics rebuilt if any
.mdfiles undersrc/komet/kdist/were changed -
make test-allpasses -
make checkpasses