Skip to content

Conversation

@MartinOndejka
Copy link
Collaborator

@MartinOndejka MartinOndejka commented Aug 20, 2025

Closes #282

@MartinOndejka MartinOndejka requested a review from L-as as a code owner August 20, 2025 20:35
@MartinOndejka MartinOndejka merged commit 55b2b16 into compatible Aug 28, 2025
in
let input =
let open Random_oracle.Input.Chunked in
append
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is sound because the order in which you insert accounts into the ledger isn't deterministic, so you can first insert an account into index 1, then index 0, which will probably result in the acc set being ordered inversely of the ledger.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I'm not seeing the unsoundness. Acc set ordering is now supposed to be deterministic, and for ledger sequencer is sending diff with indices of accounts and da node is singing on it. Nowhere we require the ledger and accset indices to be same.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are signing the ledger, not its history.

foldl (List.zip_exn path_y empty_path) ~init:Boolean.true_
~f:(fun acc (PathStep.{ hash_other; is_right }, empty_hash) ->
let* is_valid_left =
Field.Checked.equal empty_hash hash_other >>= Boolean.( &&& ) acc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is somewhat inefficient, you can generate a list of bools and then check if any of them is false instead of this

let* is_valid_left =
Field.Checked.equal empty_hash hash_other >>= Boolean.( &&& ) acc
in
if_ is_right ~typ:Boolean.typ ~then_:acc ~else_:is_valid_left )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if is_right is true for all PathStep, then acc is always returned, and it's true, right? Isn't this wrong? Am I missing something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good catch. I need is_valid_right which is supposed to be not equal to the empty hash.

@MartinOndejka MartinOndejka mentioned this pull request Sep 4, 2025
@MartinOndejka
Copy link
Collaborator Author

@L-as fixed the issues in #350

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Indexed Merkle Tree info to the DA layer

3 participants