Skip to content

Conversation

@twoeths
Copy link
Contributor

@twoeths twoeths commented Dec 29, 2025

Motivation

  • we use the whole CachedBeaconStateAllForks to get all block signatures, turn out we only need the validator indices of the current SyncCommittee

Description

given this getConfig api:

getDomain(domainSlot: Slot, domainType: DomainType, messageSlot?: Slot): Uint8Array

we currently pass state.slot as the 1st param. However it's the same to block.slot in state-transition and the same epoch when we verify blocks in batch in beacon-node

  • so we can just use block.slot instead of passing the whole CachedBeaconStateAllForks in getBlockSignatureSets() api
  • still have to pass in currentSyncCommitteeIndexed instead

part of #8650

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @twoeths, 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 several signature verification APIs by narrowing their input parameters. Previously, many functions required the comprehensive CachedBeaconStateAllForks object, even when only a small subset of its data was necessary for their operation. The changes introduce more focused parameters, such as the block slot or the current sync committee's indexed validators, directly to the functions that need them. This refactoring aims to improve code efficiency and maintainability by ensuring that functions only access the data strictly relevant to their task.

Highlights

  • API Simplification: Refactored getBlockSignatureSets and numerous related signature verification functions to reduce their dependency on the large CachedBeaconStateAllForks object, promoting cleaner function signatures.
  • Targeted Data Passing: Functions now directly receive only the specific data they require, such as block.slot (or state.slot where contextually equivalent) or currentSyncCommitteeIndexed, instead of the entire state object.
  • Improved Modularity: Enhances the modularity and clarity of the codebase by making function parameters more precise and reducing unnecessary data propagation, aligning with the principle of least privilege for data access.

🧠 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
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 simplifies the getBlockSignatureSets API and its dependencies by removing the need to pass the entire CachedBeaconStateAllForks object. Instead, only the necessary data, such as currentSyncCommitteeIndexed or the block's slot, is passed down. This is a great refactoring that improves decoupling and makes the function signatures more explicit about their requirements.

The changes are applied consistently across the codebase, and the reasoning for using block.slot instead of state.slot is well-documented in comments. My review includes a few minor suggestions to improve the consistency of these comments.

@twoeths twoeths marked this pull request as ready for review December 30, 2025 02:32
@twoeths twoeths requested a review from a team as a code owner December 30, 2025 02:32
@wemeetagain wemeetagain merged commit b6bba4c into unstable Dec 31, 2025
18 of 19 checks passed
@wemeetagain wemeetagain deleted the te/simplify_get_blocks_signature_sets branch December 31, 2025 15:08
@codecov
Copy link

codecov bot commented Dec 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.07%. Comparing base (dbd9478) to head (14991a0).
⚠️ Report is 17 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #8720      +/-   ##
============================================
+ Coverage     52.04%   52.07%   +0.02%     
============================================
  Files           848      848              
  Lines         65734    64733    -1001     
  Branches       4807     4771      -36     
============================================
- Hits          34214    33707     -507     
+ Misses        31451    30957     -494     
  Partials         69       69              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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