Skip to content

Commit

Permalink
fix: fix --cmio-advance-state in context of output unification v2
Browse files Browse the repository at this point in the history
  • Loading branch information
edubart committed Oct 18, 2024
1 parent 688702a commit 197b7db
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/cartesi-machine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2045,15 +2045,14 @@ while math.ult(machine:read_mcycle(), max_mcycle) do
if cmio_advance.next_input_index > cmio_advance.input_index_begin then
assert(#data == 32, "expected root hash in tx buffer")
save_cmio_output_hashes_root_hash(cmio_advance, data)
check_outputs_root_hash(data, output_hashes)
if cmio_advance.input_index_begin == 0 then check_outputs_root_hash(data, output_hashes) end
end
-- previous reason was a reject
elseif reason == cartesi.CMIO_YIELD_MANUAL_REASON_RX_REJECTED then
do_rollback(machine)
else
error("unexpected manual yield reason")
end
output_hashes = {}
stderr("\nBefore input %d\n", cmio_advance.next_input_index)
if cmio_advance.hashes then print_root_hash(machine) end
do_snapshot(machine)
Expand All @@ -2068,8 +2067,7 @@ while math.ult(machine:read_mcycle(), max_mcycle) do
if reason == cartesi.CMIO_YIELD_MANUAL_REASON_RX_ACCEPTED then
assert(#data == 32, "expected root hash in tx buffer")
save_cmio_output_hashes_root_hash(cmio_advance, data)
check_outputs_root_hash(data, output_hashes)
output_hashes = {}
if cmio_advance.input_index_begin == 0 then check_outputs_root_hash(data, output_hashes) end
do_commit(machine)
elseif reason == cartesi.CMIO_YIELD_MANUAL_REASON_RX_REJECTED then
do_rollback(machine)
Expand Down

0 comments on commit 197b7db

Please sign in to comment.