Skip to content

Commit

Permalink
fix some compilation hints/warnings (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
tersec authored Oct 10, 2024
1 parent 6688301 commit 893e809
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ssz_serialization/merkleization.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1413,13 +1413,13 @@ func hash_tree_root*(
when indices.len == 1 and indices[0] == 1.GeneralizedIndex:
ResultType.ok([hash_tree_root(x)])
else:
var roots {.noinit.}: array[indices.len, Digest]
const
loopOrder = merkleizationLoopOrder(indices)
v = validateIndices(indices, loopOrder)
when v.isErr:
ResultType.err(v.error)
else:
var roots {.noinit.}: array[indices.len, Digest]
const slice = 0 ..< loopOrder.len
let w = hash_tree_root_multi(x, indices, roots, loopOrder, slice)
if w.isErr:
Expand Down
10 changes: 6 additions & 4 deletions tests/test_merkleization_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
{.used.}

import
std/[sequtils, tables],
std/tables,
results,
unittest2,
stew/[endians2, results],
stew/endians2,
../ssz_serialization/merkleization

from std/sequtils import mapIt

func d(x: openArray[byte]): Digest =
result.data[0 ..< x.len] = x

Expand Down Expand Up @@ -97,8 +100,7 @@ let
u: E(x: false, y: true),
v: (a: false, b: true),
w: (a: E(x: false, y: true), b: E(x: true, y: false), c: true),
x: HashArray[2, E](data: array[2, E](
[E(x: false, y: true), E(x: true, y: false)])),
x: HashArray[2, E](data: [E(x: false, y: true), E(x: true, y: false)]),
y: HashList[E, 2].init(
@[E(x: false, y: true), E(x: true, y: false)]),
z: HashList[E, 2].init(@[]))
Expand Down

0 comments on commit 893e809

Please sign in to comment.