Skip to content

Commit

Permalink
feat: output unification v2
Browse files Browse the repository at this point in the history
Outputs root hash merkle tree is the same for all inputs, we stop
resetting it for each input (v1). With that the tree will grow
indefinetely and thus we also increased its depth to 2^63 leafs.
  • Loading branch information
mpolitzer committed Jul 29, 2024
1 parent f411c51 commit e4d5ee6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cartesi-machine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2053,7 +2053,7 @@ end
local function check_outputs_root_hash(root_hash, hashes)
local z = string.rep("\0", 32)
if #hashes == 0 then hashes = { z } end
for _ = 1, 16 do
for _ = 1, 63 do
local parent_output_hashes = {}
local child = 1
local parent = 1
Expand Down
6 changes: 3 additions & 3 deletions tests/lua/cmio-test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ end
local function check_outputs_root_hash(root_hash, output_hashes)
local z = string.rep("\0", 32)
if #output_hashes == 0 then output_hashes = { z } end
for _ = 1, 16 do
for _ = 1, 63 do
local parent_output_hashes = {}
local child = 1
local parent = 1
Expand Down Expand Up @@ -271,11 +271,11 @@ for _, dapp in pairs({ "ioctl", "http" }) do
local suffix = "-" .. dapp
local desc = " (" .. machine_type .. "," .. dapp .. ")"
do_test(
"merkle tree state must match and reset for each advance" .. desc,
"merkle tree state must match and not reset for each advance" .. desc,
"advance-state-machine" .. suffix,
function(machine)
local hashes = {}
for _ = 1, 2 do
local hashes = {}
setup_advance(machine, test_data.valid_advance)

-- 2 vouchers
Expand Down

0 comments on commit e4d5ee6

Please sign in to comment.