Skip to content

Commit 7adc3ec

Browse files
committed
Add README.md
1 parent c3f0581 commit 7adc3ec

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

scripts/trace-translator/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Trace translator
2+
3+
The trace translator translates traces generated by the Praos node into traces in the format expected by the Leios trace verifier.
4+
5+
## Example usage
6+
7+
The trace translator uses the standard input and the standard output to perform translations:
8+
9+
```bash
10+
trace-translator.py < praos-node.json > leios-node.json
11+
```
12+
13+
Assuming that the input file `praos-node.json` contains the following traces:
14+
15+
```json
16+
{"at":"2025-10-27T16:24:31.972897Z","ns":"Forge.Loop.StartLeadershipCheck","data":{"kind":"TraceStartLeadershipCheck","slot":0},"sev":"Info","thread":"45","host":"node-0"}
17+
{"at":"2025-10-27T16:24:31.972919Z","ns":"Forge.Loop.ForgedBlock","data":{"block":"e2a10cab9cda1227ae6d78811c730c88c66047927cba9a4a6bf41559efc38d67","blockNo":4,"blockPrev":"9bea965ee016f724368911fa77abfb95ee0145a27ed6dbc096695dbd19311ab7","kind":"TraceForgedBlock","slot":92},"sev":"Info","thread":"45","host":"node-0"}
18+
{"at":"2025-10-27T16:24:32.061155Z","ns":"BlockFetch.Client.CompletedBlockFetch","data":{"block":"e996590b50ee39d640975de80b1c4ebfaa923866437d36b2d2ab08dacda2a09d","delay":8.924e-3,"kind":"CompletedBlockFetch","peer":{"connectionId":"127.0.0.1:30001 127.0.0.1:30000"},"size":2472},"sev":"Info","thread":"74","host":"node-0"}
19+
{"at":"2025-10-27T16:24:33.061305Z","ns":"Forge.Loop.AdoptedBlock","data":{"blockHash":"26ab7db1ca55e69885665f625262118ef7db99172be6d3591ad2a8e9bfeabffa","blockSize":864,"kind":"TraceAdoptedBlock","slot":0},"sev":"Info","thread":"34","host":"node-0"}
20+
{"at":"2025-10-27T16:24:33.063728Z","ns":"Forge.Loop.StartLeadershipCheck","data":{"kind":"TraceStartLeadershipCheck","slot":1},"sev":"Info","thread":"45","host":"node-0"}
21+
{"at":"2025-10-27T16:24:33.066668Z","ns":"BlockFetch.Client.CompletedBlockFetch","data":{"block":"ffff590b50ee39d640975de80b1c4ebfaa923866437d36b2d2ab08dacda2a09d","delay":123,"kind":"CompletedBlockFetch","peer":{"connectionId":"127.0.0.1:30001 127.0.0.1:30000"},"size":2472},"sev":"Info","thread":"74","host":"node-0"}
22+
{"at":"2025-10-27T16:24:33.074447Z","ns":"Forge.Loop.StartLeadershipCheck","data":{"kind":"TraceStartLeadershipCheck","slot":2},"sev":"Info","thread":"45","host":"node-0"}
23+
{"at":"2025-10-27T16:24:33.080000Z","ns":"BlockFetch.Client.CompletedBlockFetch","data":{"block":"eeee590b50ee39d640975de80b1c4ebfaa923866437d36b2d2ab08dacda2a09d","delay":123,"kind":"CompletedBlockFetch","peer":{"connectionId":"127.0.0.1:30001 127.0.0.1:30000"},"size":2472},"sev":"Info","thread":"74","host":"node-0"}
24+
{"at":"2025-10-27T16:24:33.080001Z","ns":"Forge.Loop.StartLeadershipCheck","data":{"kind":"TraceStartLeadershipCheck","slot":3},"sev":"Info","thread":"45","host":"node-0"}
25+
```
26+
27+
Then the output file `leios-node.json` will contain the following resulting traces:
28+
29+
```json
30+
{"message": {"type": "RBReceived", "recipient": "node-0", "id": "e996590b50ee39d640975de80b1c4ebfaa923866437d36b2d2ab08dacda2a09d"}, "time_s": 0.088236}
31+
{"message": {"type": "RBGenerated", "producer": "node-0", "slot": 0, "id": "26ab7db1ca55e69885665f625262118ef7db99172be6d3591ad2a8e9bfeabffa", "endorsement": null, "parent": null, "size": 864, "tx_payload_bytes": null}, "time_s": 1.00015}
32+
{"message": {"type": "Slot", "node": "node-0", "slot": 0}, "time_s": 0.002423}
33+
{"message": {"type": "RBReceived", "recipient": "node-0", "id": "ffff590b50ee39d640975de80b1c4ebfaa923866437d36b2d2ab08dacda2a09d"}, "time_s": 0.00294}
34+
{"message": {"type": "Slot", "node": "node-0", "slot": 1}, "time_s": 0.007779}
35+
{"message": {"type": "RBReceived", "recipient": "node-0", "id": "eeee590b50ee39d640975de80b1c4ebfaa923866437d36b2d2ab08dacda2a09d"}, "time_s": 0.005553}
36+
{"message": {"type": "Slot", "node": "node-0", "slot": 2}, "time_s": 1e-06}
37+
```
38+
39+
## Limitations
40+
41+
Currently, the `parent` and `tx_payload_bytes` fields in the output traces of type `RBGenerated` are not available since these are not present in the input traces of type `Forge.Loop.AdoptedBlock`. A possible solution to the absense of the `parent` field may imply the use of the corresponding input trace of type `Forge.Loop.ForgedBlock`.

0 commit comments

Comments
 (0)