Skip to content

Commit

Permalink
fixup! fix: align output merkle tree depth with solidity
Browse files Browse the repository at this point in the history
  • Loading branch information
diegonehab committed Apr 12, 2024
1 parent 2f9c3d6 commit f5bb6a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sys-utils/libcmt/src/merkle.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ uint64_t cmt_merkle_get_leaf_count(cmt_merkle_t *me) {
}

int cmt_merkle_push_back(cmt_merkle_t *me, const uint8_t hash[CMT_KECCAK_LENGTH]) {
if (me->leaf_count == UINT64_MAX) {
const uint64_t max_count = (CMT_MERKLE_TREE_HEIGHT < 8*sizeof(uint64_t))?
(UINT64_C(1) << CMT_MERKLE_TREE_HEIGHT): UINT64_MAX;
if (me->leaf_count == max_count) {
return -ENOBUFS;
}
uint8_t right[CMT_KECCAK_LENGTH];
Expand Down

0 comments on commit f5bb6a3

Please sign in to comment.