Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ curl -s http://localhost:8000 -H 'Content-Type: application/json' \
"to": {"type": "address", "addrType": "contract", "value": "6a20fec1a9081773a5f23ce370f925f236346e510438ddd6d40f6b2711c134e0"},
"function": "foo", "args":[], "depth":1, "storage":[]
},
{"pos": 3, "instr": ["const", "i32", 1048576], "stack": [], "locals": {}},
{"pos": 11, "instr": ["const", "i32", 1048576], "stack": [], "locals": {}},
{"pos": 19, "instr": ["const", "i32", 1048576], "stack": [], "locals": {}},
{"pos": null, "instr": ["block"], "stack": [], "locals": {}},
{"pos": 3, "instr": ["const", "i64", 2], "stack": [], "locals": {}},
{"pos": 3, "instr": ["const", "i32", 1048576], "stack": [], "locals": {}, "mem": null},
{"pos": 11, "instr": ["const", "i32", 1048576], "stack": [], "locals": {}, "mem": null},
{"pos": 19, "instr": ["const", "i32", 1048576], "stack": [], "locals": {}, "mem": null},
{"pos": null, "instr": ["block"], "stack": [], "locals": {}, "mem": null},
{"pos": 3, "instr": ["const", "i64", 2], "stack": [], "locals": {}, "mem": null},
{"pos": null, "instr": ["endWasm"], "success":true, "depth":1, "result": {"type": "void"}}
]
}
Expand All @@ -159,7 +159,7 @@ The example above only has three of these: `callContract`, instruction records,
Here's what each record type carries:

- `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.
- 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.
- 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. `mem` is a snapshot of linear memory as a list of `{addr, bytes}` runs, emitted only when memory changed since the previous record and `null` otherwise (reuse the most recent snapshot).
- `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.
Here's a `hostCall` record for a call to `put_contract_data`, module id `l`, function id `_`:
```jsonc
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ readme = "README.md"
requires-python = "~=3.10"
dependencies = [
"stellar-sdk>=13.2.1",
"komet@git+https://github.com/runtimeverification/komet.git@v0.1.85",
"komet@git+https://github.com/runtimeverification/komet.git@v0.1.86",
"kframework>=7.1.323,<7.1.324",
]

Expand Down
14 changes: 8 additions & 6 deletions src/tests/integration/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,11 +503,11 @@ def test_trace_transaction_returns_full_instruction_trace_for_foo(server: Stella

# The executed WebAssembly instructions, exactly as shown in the README.
assert trace[1:-1] == [
{'pos': 3, 'instr': ['const', 'i32', 1048576], 'stack': [], 'locals': {}},
{'pos': 11, 'instr': ['const', 'i32', 1048576], 'stack': [], 'locals': {}},
{'pos': 19, 'instr': ['const', 'i32', 1048576], 'stack': [], 'locals': {}},
{'pos': None, 'instr': ['block'], 'stack': [], 'locals': {}},
{'pos': 3, 'instr': ['const', 'i64', 2], 'stack': [], 'locals': {}},
{'pos': 3, 'instr': ['const', 'i32', 1048576], 'stack': [], 'locals': {}, 'mem': None},
{'pos': 11, 'instr': ['const', 'i32', 1048576], 'stack': [], 'locals': {}, 'mem': None},
{'pos': 19, 'instr': ['const', 'i32', 1048576], 'stack': [], 'locals': {}, 'mem': None},
{'pos': None, 'instr': ['block'], 'stack': [], 'locals': {}, 'mem': None},
{'pos': 3, 'instr': ['const', 'i64', 2], 'stack': [], 'locals': {}, 'mem': None},
]

# An endWasm exit frame closes the trace: the call succeeded and returned Void.
Expand Down Expand Up @@ -555,8 +555,10 @@ def test_trace_records_have_expected_structure_and_reflect_arguments(server: Ste
instr_records = [record for record in trace if 'locals' in record]
assert instr_records
for record in instr_records:
assert set(record) == {'pos', 'instr', 'stack', 'locals'}
assert set(record) == {'pos', 'instr', 'stack', 'locals', 'mem'}
assert record['pos'] is None or isinstance(record['pos'], int)
# mem is null when linear memory is unchanged since the previous record, else a list of runs.
assert record['mem'] is None or isinstance(record['mem'], list)
assert isinstance(record['instr'], list) and record['instr']
assert isinstance(record['instr'][0], str) # opcode mnemonic
# stack and locals hold [type, value] pairs.
Expand Down
4 changes: 2 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading