Skip to content

chore(bls): expose bls sizes - #328

Merged
spiral-ladder merged 1 commit into
mainfrom
bing/bls-sizes
Apr 29, 2026
Merged

chore(bls): expose bls sizes#328
spiral-ladder merged 1 commit into
mainfrom
bing/bls-sizes

Conversation

@spiral-ladder

Copy link
Copy Markdown
Member

exposes bls pk/sig sizes for use in lodestar

see: ChainSafe/lodestar#8900 (comment)

@spiral-ladder spiral-ladder self-assigned this Apr 28, 2026
@spiral-ladder
spiral-ladder requested a review from a team as a code owner April 28, 2026 07:37
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Exposed BLS constants: Added COMPRESS_SIZE and SERIALIZE_SIZE constants to the PublicKey and Signature classes in the N-API bindings.
  • Updated TypeScript definitions: Updated the TypeScript declaration file to include the new static constants for better type safety and documentation.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread bindings/napi/blst.zig
Comment on lines +993 to +994
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)));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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)),
    );
References
  1. Hard limit all line lengths to at most 100 columns. (link)
  2. Hard limit of 70 lines per function. (link)
  3. The assertion density of the code must average a minimum of two assertions per function. (link)

Comment thread bindings/napi/blst.zig
Comment on lines +1012 to +1013
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)));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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
  1. Hard limit all line lengths to at most 100 columns. (link)

@spiral-ladder
spiral-ladder merged commit 60cca79 into main Apr 29, 2026
30 checks passed
spiral-ladder added a commit to ChainSafe/zapi that referenced this pull request May 18, 2026
Unblocks ChainSafe/lodestar#8900

Support was previously added in ChainSafe/lodestar-z#328

but the DSL update removed it
nazarhussain pushed a commit to ChainSafe/zapi that referenced this pull request May 19, 2026
* 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.
spiral-ladder added a commit that referenced this pull request May 19, 2026
spiral-ladder added a commit that referenced this pull request May 19, 2026
spiral-ladder added a commit that referenced this pull request May 19, 2026
markolazic01 pushed a commit to markolazic01/lodestar-z that referenced this pull request Jun 17, 2026
@wemeetagain
wemeetagain deleted the bing/bls-sizes branch August 17, 2026 19:40
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.

2 participants