Skip to content

Commit

Permalink
fixup! 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 f5bb6a3 commit 71858fc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sys-utils/libcmt/src/merkle.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <strings.h>

// clang-format off
static const uint8_t pristine_hash[CMT_MERKLE_TREE_HEIGHT+1][CMT_KECCAK_LENGTH] = {
static const uint8_t pristine_hash[][CMT_KECCAK_LENGTH] = {
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0xad,0x32,0x28,0xb6,0x76,0xf7,0xd3,0xcd,0x42,0x84,0xa5,0x44,0x3f,0x17,0xf1,0x96,0x2b,0x36,0xe4,0x91,0xb3,0x0a,0x40,0xb2,0x40,0x58,0x49,0xe5,0x97,0xba,0x5f,0xb5},
{0xb4,0xc1,0x19,0x51,0x95,0x7c,0x6f,0x8f,0x64,0x2c,0x4a,0xf6,0x1c,0xd6,0xb2,0x46,0x40,0xfe,0xc6,0xdc,0x7f,0xc6,0x07,0xee,0x82,0x06,0xa9,0x9e,0x92,0x41,0x0d,0x30},
Expand Down Expand Up @@ -164,8 +164,8 @@ 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]) {
const uint64_t max_count = (CMT_MERKLE_TREE_HEIGHT < 8*sizeof(uint64_t))?
(UINT64_C(1) << CMT_MERKLE_TREE_HEIGHT): 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;
}
Expand Down

0 comments on commit 71858fc

Please sign in to comment.