Skip to content

Conversation

@jtraglia
Copy link

@jtraglia jtraglia commented Jan 23, 2026

Motivation

This PR adds a directory with specification references. These are used to map specification items (configs, presets, functions, etc) to client implementations (code in Lodestar). These specification references are meant to (1) help developers keep track of specification changes and (2) make it easier for third-parties (eg EF Protocol Security) to verify clients adhere to the specifications.

Our team is working to do this for all clients.

Note: The function mappings are the only weak-spot. It's quite difficult to map some of these because of implementation differences & the fact that not everything is implemented (eg Gloas functions). The specref functions will most likely require some additional work, but this PR does identify most functions.

AI Assistance Disclosure

Yes, I used Claude Code to identify/map most of these.

Fixes: #7477

@jtraglia jtraglia requested a review from a team as a code owner January 23, 2026 04:15
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jtraglia, 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 introduces a robust system for tracking and verifying the client's adherence to Ethereum specifications. By creating a dedicated 'specrefs' directory and leveraging the 'ethspecify' tool, the project aims to improve development efficiency in managing specification changes and enhance the auditability of client implementations against the official Ethereum protocols.

Highlights

  • Introduction of Specification References: A new 'specrefs' directory has been added to systematically map Ethereum specification items (configs, constants, containers, dataclasses, functions, presets, and types) to their corresponding client implementations.
  • ethspecify Tool Integration: This PR integrates the 'ethspecify' tool, which helps developers track specification changes and enables third-parties to verify client adherence to the Ethereum specifications.
  • Comprehensive Mapping: The new system provides detailed mappings for various components across multiple Ethereum forks (Phase0, Altair, Bellatrix, Capella, Deneb, Electra, Fulu, Gloas), including explicit exceptions for un-implemented items.

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

Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/check-specrefs.yml
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.

@jtraglia jtraglia changed the title Add spec references, a mapping of spec to implementation feat: add spec references, a mapping of spec to implementation Jan 23, 2026
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 introduces a new specrefs directory to map specification items to their implementations in the codebase, using the ethspecify tool. This is a great initiative for improving spec compliance and maintainability. The new configuration files are well-structured, and the process is documented in a new README. I've found a small typo in the README and suggested an improvement to make the search patterns in the configuration more robust. Overall, this is a valuable addition to the repository.

- name: AGGREGATE_DUE_BPS
sources:
- file: packages/config/src/chainConfig/configs/mainnet.ts
search: "AGGREGATE_DUE_BPS:"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The search pattern "AGGREGATE_DUE_BPS:" is a bit weak and could potentially match unintended lines, such as in comments. For better robustness, I suggest using a more specific regex that anchors the search to the start of the line and accounts for leading whitespace. This improvement should be applied to other similar simple string searches in this file for consistency and maintainability.

      search: '^\s+AGGREGATE_DUE_BPS:'
      regex: true

Copy link
Author

Choose a reason for hiding this comment

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

Nah, if it also matches a comment, ethspecify will throw an ambiguous search error:

For example:

image

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Copy link
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

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

generally looks good to me, thanks @jtraglia

jtraglia and others added 2 commits January 23, 2026 07:15
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
Copy link
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

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

LGTM - waiting for @ensi321 to give this a final pass

@nflaig
Copy link
Member

nflaig commented Jan 23, 2026

this should be closing #7477 once merged

Copy link
Contributor

@ensi321 ensi321 left a comment

Choose a reason for hiding this comment

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

I think this is great. Minor maintenance effort from our side. And we can be monitor the exception list to see if Lodestar is missing something from the spec.

sources: []
spec: |
<spec fn="_fft_field" fork="fulu" hash="d9de8aaf">
def _fft_field(
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm, I don't see the point of having content of each function here. It could be a good reference but generally something like link should be enough? Same with containers and data classes.

@@ -0,0 +1,11986 @@
- name: _fft_field
sources: []
Copy link
Contributor

Choose a reason for hiding this comment

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

For those that are under exceptions, is it possible to not generate them here?

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.

Explore ethspecify integration

3 participants