Skip to content

chore: use era files for ssz benchmarks#180

Merged
wemeetagain merged 3 commits intomainfrom
cayman/era-ssz-bench
Feb 2, 2026
Merged

chore: use era files for ssz benchmarks#180
wemeetagain merged 3 commits intomainfrom
cayman/era-ssz-bench

Conversation

@wemeetagain
Copy link
Copy Markdown
Member

Use project-managed era files for ssz state, block, and attestation benchmarks.
This makes it easier to run benchmarks and ensure that benchmarks are consistently run on the same data.

@wemeetagain wemeetagain requested a review from a team as a code owner January 19, 2026 21:49
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @wemeetagain, 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 streamlines the SSZ benchmarking process by migrating the data source for attestation, block, and state benchmarks to project-managed era files. This transition enhances the consistency and reproducibility of benchmark results, as all tests will now operate on a unified and controlled dataset, ultimately simplifying benchmark execution and maintenance.

Highlights

  • Standardized Benchmark Data: Switched SSZ benchmarks for attestation, block, and state from using individual .ssz files to project-managed era files.
  • Improved Consistency: This change ensures that benchmarks are consistently run on the same, controlled data, making results more reliable.
  • Simplified Execution: Utilizing era files simplifies the process of running these benchmarks.
  • Updated Dependencies: Added new module imports (config, download_era_options, era) to the benchmark modules in build.zig and zbuild.zon.
  • Fork-Agnostic TODOs: Introduced TODO comments to address making consensus type imports fork-agnostic in the future.

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

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

Copy link
Copy Markdown
Contributor

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

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 refactors the SSZ benchmarks for attestations, blocks, and states to use project-managed era files instead of local .ssz files. This is a great improvement for ensuring benchmark consistency and making them easier to run. The code changes look good overall. I've added a few comments:

  • A suggestion to add an assertion in attestation.zig to prevent a potential panic if the test data doesn't contain any attestations. This improves the robustness of the benchmark.
  • A few suggestions to sort module imports alphabetically in the benchmark files for better readability and consistency with other parts of the codebase, in line with the repository's style guide.

Comment thread bench/ssz/attestation.zig
var block = SignedBeaconBlock.default_value;
try SignedBeaconBlock.deserializeFromBytes(allocator, block_bytes, &block);

const attestation = &block.message.body.attestations.items[0];
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.

high

Accessing items[0] will cause a panic if the attestations list is empty. It's safer to assert that the list is not empty before accessing an element, especially since the test data is now being loaded from an external era file which might not guarantee the presence of attestations in the selected block.

This aligns with the style guide's emphasis on safety and assertions: "A function must not operate blindly on data it has not checked." (line 52) and "Assert all function arguments and return values, pre/postconditions and invariants." (line 51).

    std.debug.assert(block.message.body.attestations.items.len > 0);
    const attestation = &block.message.body.attestations.items[0];
References
  1. A function must not operate blindly on data it has not checked. Assertions should be used to validate pre/postconditions and invariants. (link)

Comment thread bench/ssz/attestation.zig
Comment thread bench/ssz/block.zig
Comment thread bench/ssz/state.zig
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 39736def68

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bench/ssz/attestation.zig
Comment thread bench/ssz/attestation.zig
wemeetagain and others added 2 commits January 29, 2026 11:06
@wemeetagain wemeetagain merged commit d6b75f3 into main Feb 2, 2026
9 checks passed
twoeths pushed a commit that referenced this pull request Mar 3, 2026
Use project-managed era files for ssz state, block, and attestation
benchmarks.
This makes it easier to run benchmarks and ensure that benchmarks are
consistently run on the same data.

---------

Co-authored-by: Chen Kai <281165273grape@gmail.com>
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