|
3 | 3 |
|
4 | 4 | local cartesi = require("cartesi") |
5 | 5 |
|
6 | | -local checkpoint_address = 0xfe0 |
7 | | - |
8 | 6 | local function usage(message) |
9 | 7 | if message then io.stderr:write(message, "\n") end |
10 | 8 | io.stderr:write( |
@@ -74,17 +72,16 @@ local function ensure_manual_yield(machine) |
74 | 72 | end |
75 | 73 |
|
76 | 74 | local function advance_one(machine, input_path, input_number) |
77 | | - local checkpoint = machine:get_root_hash() |
78 | | - machine:write_memory(checkpoint_address, checkpoint) |
79 | | - machine:send_cmio_response(cartesi.CMIO_YIELD_REASON_ADVANCE_STATE, read_all(input_path)) |
| 75 | + local revert_root_hash = machine:get_root_hash() |
| 76 | + machine:send_cmio_response(revert_root_hash, cartesi.HTIF_YIELD_REASON_ADVANCE_STATE, read_all(input_path)) |
80 | 77 | run_until_manual_yield(machine) |
81 | 78 |
|
82 | 79 | local _, reason, data = machine:receive_cmio_request() |
83 | | - if reason == cartesi.CMIO_YIELD_MANUAL_REASON_RX_REJECTED then |
| 80 | + if reason == cartesi.HTIF_YIELD_MANUAL_REASON_RX_REJECTED then |
84 | 81 | error(string.format("Dave replay input %d was rejected", input_number)) |
85 | | - elseif reason == cartesi.CMIO_YIELD_MANUAL_REASON_TX_EXCEPTION then |
| 82 | + elseif reason == cartesi.HTIF_YIELD_MANUAL_REASON_TX_EXCEPTION then |
86 | 83 | error(string.format("Dave replay input %d raised an exception", input_number)) |
87 | | - elseif reason ~= cartesi.CMIO_YIELD_MANUAL_REASON_RX_ACCEPTED then |
| 84 | + elseif reason ~= cartesi.HTIF_YIELD_MANUAL_REASON_RX_ACCEPTED then |
88 | 85 | error(string.format("Dave replay input %d ended with unexpected yield reason %s", input_number, tostring(reason))) |
89 | 86 | end |
90 | 87 | if #data ~= 32 then |
|
0 commit comments