Skip to content

update to use SSZ hasher agnostic hashTreeRoot API#474

Merged
g11tech merged 6 commits intoblockblaz:mainfrom
chetanyb:ssz-hasher
Jan 25, 2026
Merged

update to use SSZ hasher agnostic hashTreeRoot API#474
g11tech merged 6 commits intoblockblaz:mainfrom
chetanyb:ssz-hasher

Conversation

@chetanyb
Copy link
Copy Markdown
Contributor

@chetanyb chetanyb commented Jan 9, 2026

Description:

  • Aligns all ssz.hashTreeRoot call sites with the new hasher‑parameter signature.
  • Keeps SHA256 as the hasher everywhere; no behavioral change to hash outputs.
  • Unblocks adoption of the generic SSZ API.

@chetanyb chetanyb marked this pull request as ready for review January 23, 2026 10:56
@chetanyb chetanyb requested review from anshalshukla and g11tech and removed request for anshalshukla January 23, 2026 11:20
Comment on lines +7 to +14
pub fn hashTreeRoot(
comptime T: type,
value: T,
out: *[Sha256.digest_length]u8,
allocator: Allocator,
) !void {
try ssz.hashTreeRoot(Sha256, T, value, out, allocator);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can add a build flag and make it something like

pub const Hasher = if (build_options.use_poseidon) Poseidon else Sha256;

pub fn hashTreeRoot(
    comptime T: type,
    value: T,
    out: *[Hasher.digest_length]u8,
    allocator: std.mem.Allocator,
) !void {
    try ssz.hashTreeRoot(Hasher, T, value, out, allocator);
}

.url = "git+https://github.com/blockblaz/ssz.zig#5ce7322fc45cab4f215021cae2579d1343e05d55",
.hash = "ssz-0.0.9-Lfwd61PEAgAUPJfUQiK4R5gRX_lTWOd_qYwNT-KAhRLA",
.url = "https://github.com/blockblaz/ssz.zig/archive/0ce92a8f093a321b0d0815eec6c90bd4e745d8e1.tar.gz",
.hash = "ssz-0.0.9-Lfwd6wvKAgA3JZjtfbeXeQG6zle1K_K2j6HPmQJJF4an",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we get a new release for ssz?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging this PR for now, lets do it in followup

@g11tech g11tech changed the title Update SSZ hashTreeRoot calls for new API update to use SSZ hasher agnostic hashTreeRoot API Jan 25, 2026
@g11tech g11tech merged commit 567ed03 into blockblaz:main Jan 25, 2026
12 checks passed
GrapeBaBa pushed a commit that referenced this pull request Jan 25, 2026
* chore: point to latest ssz commit

* feat: add Sha256 ssz hashTreeRoot wrapper

* refactor: use the updated hashTreeRoot wrapper

---------

Co-authored-by: g11tech <gajinder@zeam.in>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants