|
| 1 | +# Soroban Debugger — example workspace |
| 2 | + |
| 3 | +This folder is a **self-contained example workspace** for the Soroban Debugger |
| 4 | +(komet) extension. Pressing **F5** ("Run Extension") in the extension repo opens |
| 5 | +this folder in an Extension Development Host with the extension already loaded, |
| 6 | +so you have a real Soroban project to debug immediately. |
| 7 | + |
| 8 | +## Contents |
| 9 | + |
| 10 | +- `greeter/` — a contract whose entry point `store(value)` returns **nothing** |
| 11 | + (unit / `Void`). Uses instance storage. |
| 12 | +- `adder/` — the simplest possible contract (`add(a, b) -> u32`, pure arithmetic). |
| 13 | +- `increment/` — a stateful counter (`increment(by) -> u32`, uses instance storage). |
| 14 | +- `traces/add.trace.jsonl` — a captured `komet-node` execution trace for `add`, |
| 15 | + so the debugger works with **no toolchain and no komet-node**. |
| 16 | + |
| 17 | +Each contract is an independent crate (its own `Cargo.toml`/`Cargo.lock`/ |
| 18 | +`target/`), which is what the extension's `contract` launch attribute expects. |
| 19 | + |
| 20 | +## Try it |
| 21 | + |
| 22 | +Open the Run and Debug view and pick a config from `.vscode/launch.json`: |
| 23 | + |
| 24 | +1. **Soroban: Replay add(4, 3) trace** — zero dependencies. Replays the bundled |
| 25 | + trace so you can step forward/backward, set breakpoints, and inspect the |
| 26 | + stack/locals. Start here. |
| 27 | +2. **Soroban: Debug store(42) / add(1, 2) / increment(5)** — the full turnkey |
| 28 | + pipeline: builds the crate, spawns komet-node, deploys, invokes, and replays |
| 29 | + the resulting trace. Requires the toolchain (Rust + wasm target, Stellar CLI, |
| 30 | + komet-node), all present in the devcontainer. |
| 31 | + |
| 32 | +## komet-node version note |
| 33 | + |
| 34 | +Earlier versions of komet-node reported a `FAILED` transaction for any contract |
| 35 | +call that **returns a value** (its `callTx` handling asserted a `Void` result, so |
| 36 | +functions like `add`/`increment` got stuck; only no-return functions like |
| 37 | +`greeter::store` completed). This is fixed in komet-node — `callTx` now uses |
| 38 | +`uncheckedCallTx`, which does not assert the return value. |
| 39 | + |
| 40 | +The fix isn't on the nix binary cache yet, so the `komet-node` on `$PATH` in this |
| 41 | +devcontainer is still the older build. `.vscode/settings.json` therefore points |
| 42 | +the extension at the rebuilt node via: |
| 43 | + |
| 44 | +```json |
| 45 | +{ "soroban.kometNode.path": "/home/node/.komet-node/bin/komet-node" } |
| 46 | +``` |
| 47 | + |
| 48 | +Once the nix cache ships the fix, delete that setting and the extension will use |
| 49 | +`komet-node` from `$PATH`. (The `soroban.stellar.path` setting works the same way |
| 50 | +for the Stellar CLI.) |
| 51 | + |
| 52 | +## Adding your own contract |
| 53 | + |
| 54 | +Drop a new crate directory here (with a `Cargo.toml` exposing a `#[contract]`), |
| 55 | +then add a launch config pointing `contract` at it and naming the `function`. |
0 commit comments