Skip to content

Commit df0ea81

Browse files
authored
Merge pull request #40 from runtimeverification/update-komet
Update `komet` version
2 parents c9432ab + 346dad0 commit df0ea81

5 files changed

Lines changed: 73 additions & 21 deletions

File tree

README.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,68 @@ curl -s http://localhost:8000 -H 'Content-Type: application/json' \
130130
"jsonrpc": "2.0",
131131
"id": 1,
132132
"result": [
133+
{
134+
"pos": null, "instr": ["callContract"],
135+
"from": {"type": "address", "addrType": "account", "value": "03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8"},
136+
"to": {"type": "address", "addrType": "contract", "value": "6a20fec1a9081773a5f23ce370f925f236346e510438ddd6d40f6b2711c134e0"},
137+
"function": "foo", "args":[], "depth":1, "storage":[]
138+
},
133139
{"pos": 3, "instr": ["const", "i32", 1048576], "stack": [], "locals": {}},
134140
{"pos": 11, "instr": ["const", "i32", 1048576], "stack": [], "locals": {}},
135141
{"pos": 19, "instr": ["const", "i32", 1048576], "stack": [], "locals": {}},
136142
{"pos": null, "instr": ["block"], "stack": [], "locals": {}},
137-
{"pos": 3, "instr": ["const", "i64", 2], "stack": [], "locals": {}}
143+
{"pos": 3, "instr": ["const", "i64", 2], "stack": [], "locals": {}},
144+
{"pos": null, "instr": ["endWasm"], "success":true, "depth":1, "result": {"type": "void"}}
138145
]
139146
}
140147
```
141148

142-
Each trace record captures the VM state at instruction entry: `pos` is the instruction's byte offset in the binary (`null` for synthetic instructions), `instr` is the instruction and its operands, and `stack`/`locals` are the value stack and locals as `[type, value]` pairs. See [docs/interpreter.md](docs/interpreter.md) for the full trace format.
149+
A trace can contain five kinds of records:
150+
151+
- `callContract`
152+
- Wasm instruction records
153+
- `hostCall`
154+
- `contractData`
155+
- `endWasm`
156+
157+
The example above only has three of these: `callContract`, instruction records, and `endWasm`. `foo()` doesn't touch storage or call any host functions, so no `contractData` or `hostCall` records show up.
158+
159+
Here's what each record type carries:
160+
161+
- `callContract`: logged for each contract call in the transaction, including contract-to-contract calls. Records the caller, the callee, the function name, the arguments, the call depth, and the callee's storage before the call runs.
162+
- Instruction records: logged at each WebAssembly instruction's entry. `pos` is the instruction's byte offset in the binary (`null` for synthetic instructions), `instr` is the instruction and its operands, and `stack`/`locals` are the value stack and locals as `[type, value]` pairs.
163+
- `hostCall`: logged when the contract calls a host function. `instr` gives `["hostCall", moduleId, functionId]`, identifying which host function ran. `locals` holds the function's arguments, indexed by position. Host calls don't use the stack, so `stack` is absent.
164+
Here's a `hostCall` record for a call to `put_contract_data`, module id `l`, function id `_`:
165+
```jsonc
166+
{
167+
"pos": null,
168+
"instr": ["hostCall", "l", "_"],
169+
"locals": {"2": ["i64",0], "1": ["i64",530242871224172548], "0": ["i64",45954062]}
170+
}
171+
```
172+
173+
- `contractData`: logged for storage updates. Gives the contract and the storage type (`instance`, `persistent`, or `temporary`). A `put` carries the key and value as its two args; a `del` carries only the key.
174+
Here's a `contractData` record for a `put`, followed by a `del` on the same key:
175+
```jsonc
176+
{
177+
"pos": null,
178+
"instr": ["contractData", "put", "temporary"],
179+
"contract": {"type": "address", "addrType": "contract", "value": "746573742d7363"},
180+
"args": [{"type": "symbol", "value": "foo"}, {"type": "u32", "value": 123456789}]
181+
}
182+
{
183+
"pos": null,
184+
"instr": ["contractData", "del", "temporary"],
185+
"contract": {"type": "address", "addrType": "contract", "value": "746573742d7363"},
186+
"args": [{"type": "symbol", "value": "foo"}]
187+
}
188+
```
189+
190+
- `endWasm`: logged once at the end of a call. Records whether the call succeeded, its depth, and its result.
191+
192+
193+
194+
See [docs/interpreter.md](docs/interpreter.md) for the full trace format.
143195

144196
---
145197

flake.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# `k` package directly (replacing the imperative `kup install k`); its
1010
# nixpkgs is intentionally NOT followed, so the k-framework binary caches
1111
# are hit instead of rebuilding K against our nixpkgs.
12-
k-framework.url = "github:runtimeverification/k/v7.1.319";
12+
k-framework.url = "github:runtimeverification/k/v7.1.323";
1313
# Use the same uv2nix as k-framework so we inherit the pyproject-nix version
1414
# that fixes the missing 'riscv64' attribute in pep600.nix (pep599.manyLinuxTargetMachines
1515
# lookup now uses `or tagArch` as a safe default for unknown architectures).

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ readme = "README.md"
1010
requires-python = "~=3.10"
1111
dependencies = [
1212
"stellar-sdk>=13.2.1",
13-
"komet@git+https://github.com/runtimeverification/komet.git@v0.1.79",
14-
"kframework>=7.1.318,<7.1.321",
13+
"komet@git+https://github.com/runtimeverification/komet.git@v0.1.85",
14+
"kframework>=7.1.323,<7.1.324",
1515
]
1616

1717
[[project.authors]]

uv.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)