-
Notifications
You must be signed in to change notification settings - Fork 32
update to use SSZ hasher agnostic hashTreeRoot API #474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| pub fn hashTreeRoot( | ||
| comptime T: type, | ||
| value: T, | ||
| out: *[Sha256.digest_length]u8, | ||
| allocator: Allocator, | ||
| ) !void { | ||
| try ssz.hashTreeRoot(Sha256, T, value, out, allocator); | ||
| } |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
* 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>
Description: