Skip to content

Commit

Permalink
fix: merkleize method
Browse files Browse the repository at this point in the history
  • Loading branch information
fearlessfe committed Nov 5, 2024
1 parent 1cd3152 commit fd6e8c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/spec_tests/ssz_static/root.zig
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const CommonUnion = union {
// BeaconBlock: types.BeaconBlock,
BeaconBlockHeader: types.BeaconBlockHeader,
Checkpoint: types.Checkpoint,
// Deposit: types.Deposit,
Deposit: types.Deposit,
DepositData: types.DepositData,
DepositMessage: types.DepositMessage,
Eth1Block: types.Eth1Block,
Expand Down
5 changes: 4 additions & 1 deletion src/ssz/ssz.zig
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,10 @@ pub fn merkleize(chunks: []chunk, limit: ?usize, out: *[32]u8) anyerror!void {
if (size / 2 < chunks.len) {
try merkleize(chunks[size / 2 ..], size / 2, &buf);
hasher.update(buf[0..]);
} else hasher.update(hashes_of_zero[size / 2 - 1][0..]);
} else {
const power = std.math.log2(size);
hasher.update(hashes_of_zero[power - 1][0..]);
}
hasher.final(out);
},
}
Expand Down

0 comments on commit fd6e8c4

Please sign in to comment.