diff --git a/src/spec_tests/ssz_static/root.zig b/src/spec_tests/ssz_static/root.zig index b5f12ce..89ddc61 100644 --- a/src/spec_tests/ssz_static/root.zig +++ b/src/spec_tests/ssz_static/root.zig @@ -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, diff --git a/src/ssz/ssz.zig b/src/ssz/ssz.zig index 12f9187..32fd3b6 100644 --- a/src/ssz/ssz.zig +++ b/src/ssz/ssz.zig @@ -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); }, }