chore(bls): expose bls sizes - #328
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request exposes BLS public key and signature size constants through the N-API bindings. This change allows external consumers, such as Lodestar, to access these values directly from the bindings rather than hardcoding them, improving maintainability and consistency across the project. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds COMPRESS_SIZE and SERIALIZE_SIZE constants to the PublicKey and Signature classes in both the Zig N-API bindings and the TypeScript definition file. The review feedback identifies several style guide violations in bindings/napi/blst.zig: multiple lines exceed the 100-column limit, the register function now exceeds the 70-line maximum length, and the function lacks the required minimum of two assertions. You should refactor the register function into smaller helper functions and wrap the long property assignment calls as suggested.
| try pk_ctor.setNamedProperty("COMPRESS_SIZE", try env.createUint32(@intCast(PublicKey.COMPRESS_SIZE))); | ||
| try pk_ctor.setNamedProperty("SERIALIZE_SIZE", try env.createUint32(@intCast(PublicKey.SERIALIZE_SIZE))); |
There was a problem hiding this comment.
These lines exceed the 100-column limit (line 400). Furthermore, the register function (lines 957-1033) now exceeds 80 lines, violating the 70-line hard limit (line 108), and lacks the required minimum of two assertions (line 54). Please wrap these calls and refactor the register function by moving the registration logic for each class into separate helper functions to adhere to the style guide.
try pk_ctor.setNamedProperty(
"COMPRESS_SIZE",
try env.createUint32(@intCast(PublicKey.COMPRESS_SIZE)),
);
try pk_ctor.setNamedProperty(
"SERIALIZE_SIZE",
try env.createUint32(@intCast(PublicKey.SERIALIZE_SIZE)),
);
| try sig_ctor.setNamedProperty("COMPRESS_SIZE", try env.createUint32(@intCast(Signature.COMPRESS_SIZE))); | ||
| try sig_ctor.setNamedProperty("SERIALIZE_SIZE", try env.createUint32(@intCast(Signature.SERIALIZE_SIZE))); |
There was a problem hiding this comment.
These lines also exceed the 100-column limit (line 400). Please wrap them for consistency and readability.
try sig_ctor.setNamedProperty(
"COMPRESS_SIZE",
try env.createUint32(@intCast(Signature.COMPRESS_SIZE)),
);
try sig_ctor.setNamedProperty(
"SERIALIZE_SIZE",
try env.createUint32(@intCast(Signature.SERIALIZE_SIZE)),
);
References
- Hard limit all line lengths to at most 100 columns. (link)
Unblocks ChainSafe/lodestar#8900 Support was previously added in ChainSafe/lodestar-z#328 but the DSL update removed it
* feat(dsl): support static value fields on classes Unblocks ChainSafe/lodestar#8900 Support was previously added in ChainSafe/lodestar-z#328 but the DSL update removed it * refactor(dsl): drop `.static` block in favor of auto-discovered `pub const` decls Walking `@typeInfo(T).@"struct".decls` at comptime and exposing each int/float/bool/string-typed decl removes the need for a separate `.static = .{...}` block.
exposes bls pk/sig sizes for use in lodestar
see: ChainSafe/lodestar#8900 (comment)