Skip to content

Conversation

@jtraglia
Copy link
Contributor

@jtraglia jtraglia commented Jul 31, 2025

PR Description

This PR adds a directory with specification references. These are used to map specification items (configs, presets, functions, etc) to client implementations (code in Teku). This is much less invasive than my original idea of adding spec tags all across the codebase. 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.

If there's a change (eg a file is moved or a function is renamed) the included CI check will alert developers that something needs to be fixed; fixing issues should be relatively infrequent and easy, probably just updating a filepath or search string. When updating the codebase to be compliant with the next spec version, developers will:

  • Bump the version in specrefs/.ethspecify.yml.
  • Run ethspecify process --path=specrefs.
    • This will update the code sections in the spec tags.
  • Run git diff to see what changes were made.
    • Developers can then make the appropriate changes.
  • Run ethspecify check --path=specrefs to check for new spec items.
    • For example, a new function is added and is missing from the spec references.
    • The developer will add it to the appropriate spec reference file.

This PR is marked as a draft because I have not completely mapped out all of the functions. This is taking longer than I expected. Opening this now so that I can collect feedback from the team.

PS: I got the idea for this from Lodestar!

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

@github-actions
Copy link

github-actions bot commented Jul 31, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@jtraglia
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Jul 31, 2025
@rolfyone
Copy link
Contributor

rolfyone commented Aug 1, 2025

I like the idea, are there any examples of when this finds diffs that we could peek at?

@jtraglia
Copy link
Contributor Author

jtraglia commented Aug 1, 2025

I like the idea, are there any examples of when this finds diffs that we could peek at?

Sure, I can provide some examples. To be clear, the "diff spec <> implementation <> other implementations" part of this plan has not been developed yet. We need a consistent way to identify these functions first.

When the version in build.gradle changes but we forgot to update specrefs:

image

When there's a missing entry (eg there's a new spec item):

image

When a search condition fails (eg the function was renamed):

image

When there's an ambiguous search (eg an overloaded function was added):

image

When there's a missing file (eg the file was renamed):

image

@jtraglia jtraglia marked this pull request as ready for review August 1, 2025 19:52
@rolfyone
Copy link
Contributor

rolfyone commented Aug 4, 2025

nice, thats kinda cool...

Copy link
Contributor

@rolfyone rolfyone left a comment

Choose a reason for hiding this comment

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

LGTM lets give this a go.

@rolfyone rolfyone merged commit 169c4b7 into Consensys:master Aug 5, 2025
19 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 5, 2025
@jtraglia jtraglia deleted the spec-references branch August 5, 2025 12:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants