tari icon indicating copy to clipboard operation
tari copied to clipboard

Merkle proofs include `usize` fields

Open AaronFeickert opened this issue 1 year ago • 1 comments

The codebase uses three different Merkle proof structures: Merkle mountain range (MMR) proofs, and merged and unmerged balanced binary Merkle tree (BBMT) proofs. In each case, the proof includes one or more usize fields. This could lead to issues between 32-bit and 64-bit targets.

For MMR proofs:

  • the tree size is encoded as usize via serde derived traits

For BBMT unmerged proofs:

  • the witness node index is usize, but no encoding is yet specified

For BBMT merged proofs:

  • the witness node indexes are Vec<usize>, but no encoding is yet specified
  • the path heights are Vec<usize>, but no encoding is yet specified

In each of these cases, usize should be replaced by either u32 or u64 as appropriate for the required use cases.

AaronFeickert avatar Mar 07 '23 16:03 AaronFeickert