Skip to content

Commit

Permalink
Merge pull request #21 from optimism-java/hash
Browse files Browse the repository at this point in the history
fix: merkleize method
  • Loading branch information
GrapeBaBa authored Nov 5, 2024
2 parents 1cd3152 + fd6e8c4 commit 4d5ad70
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 4d5ad70

Please sign in to comment.