Skip to content

Add spec references, a mapping of spec to implementation#15592

Merged
prestonvanloon merged 4 commits intoOffchainLabs:developfrom
jtraglia:specrefs
Aug 21, 2025
Merged

Add spec references, a mapping of spec to implementation#15592
prestonvanloon merged 4 commits intoOffchainLabs:developfrom
jtraglia:specrefs

Conversation

@jtraglia
Copy link
Contributor

What type of PR is this?

Documentation

What does this PR do? Why is it needed?

This PR adds a directory with specification references. These are used to map specification items (configs, presets, functions, etc) to client implementations (code in Prysm). 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.

Note, we recently did the same thing for Teku. View that PR for more details.

Other notes for review

If we decide to merge this PR, we can remove the existing spec-checker tool.

Depends on #15590.

Acknowledgements

@jtraglia jtraglia marked this pull request as ready for review August 18, 2025 16:02
@prestonvanloon
Copy link
Member

Thanks for the PR. I am wondering how we maintain this?

Will it be difficult to update in the future? Perhaps you could share a blurb about how you created this PR so we can refer to it in the future when it is time to update it with new spec changes.

@jtraglia
Copy link
Contributor Author

Thanks for the PR. I am wondering how we maintain this?

Will it be difficult to update in the future? Perhaps you could share a blurb about how you created this PR so we can refer to it in the future when it is time to update it with new spec changes.

I don't believe it will be difficult to maintain. Creating this was pretty manual & not a good representation of future efforts.

When adding support for a new specification (eg from v1.6.0-alpha.3 to v1.6.0-alpha.4) developers will:

  • First update the version in specrefs/.ethspecify.yml.
  • Then run ethspecify check --path=specrefs to see if there are new items. For example:
$ ethspecify check --path=specrefs
MISSING: functions.is_data_available#fulu
  • Then add an entry to the relevant file (eg specrefs/functions.yml).
- name: is_data_available#fulu
  sources: []
  spec: |
    <spec fn="is_data_available" fork="fulu" />
  • Then locate where this is in the codebase and update the sources list.
- name: is_data_available#fulu
  sources:
    - file: beacon-chain/blockchain/process_block.go
      search: func (s *Service) isDataAvailable(
    - file: beacon-chain/blockchain/process_block.go
      search: func (s *Service) areDataColumnsAvailable(
  spec: |
    <spec fn="is_data_available" fork="fulu" />
  • Repeat last three steps until the ethspecify check passes.
  • Then run ethspecify process --path=specrefs to update spectag bodies.
- name: is_data_available#fulu
  sources:
    - file: beacon-chain/blockchain/process_block.go
      search: func (s *Service) isDataAvailable(
    - file: beacon-chain/blockchain/process_block.go
      search: func (s *Service) areDataColumnsAvailable(
  spec: |
    <spec fn="is_data_available" fork="fulu" hash="2062e9c6">
    def is_data_available(beacon_block_root: Root) -> bool:
        # `retrieve_column_sidecars` is implementation and context dependent, replacing
        # `retrieve_blobs_and_proofs`. For the given block root, it returns all column
        # sidecars to sample, or raises an exception if they are not available.
        # The p2p network does not guarantee sidecar retrieval outside of
        # `MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS` epochs.
        column_sidecars = retrieve_column_sidecars(beacon_block_root)
        return all(
            verify_data_column_sidecar(column_sidecar)
            and verify_data_column_sidecar_kzg_proofs(column_sidecar)
            for column_sidecar in column_sidecars
        )
    </spec>

@jtraglia
Copy link
Contributor Author

Copy link
Member

@prestonvanloon prestonvanloon left a comment

Choose a reason for hiding this comment

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

Great, thanks for this!

@prestonvanloon prestonvanloon added this pull request to the merge queue Aug 21, 2025
Merged via the queue into OffchainLabs:develop with commit ee03c7c Aug 21, 2025
15 checks passed
@jtraglia jtraglia deleted the specrefs branch August 21, 2025 15:31
Sahil-4555 pushed a commit to Sahil-4555/prysm that referenced this pull request Aug 25, 2025
…s#15592)

* Add spec references, a mapping of spec to implementation

* Add changelog fragment

---------

Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
jihoonsong pushed a commit to jihoonsong/prysm that referenced this pull request Aug 27, 2025
…s#15592)

* Add spec references, a mapping of spec to implementation

* Add changelog fragment

---------

Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
fernantho pushed a commit to fernantho/prysm that referenced this pull request Sep 26, 2025
…s#15592)

* Add spec references, a mapping of spec to implementation

* Add changelog fragment

---------

Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
fernantho pushed a commit to fernantho/prysm that referenced this pull request Sep 26, 2025
…s#15592)

* Add spec references, a mapping of spec to implementation

* Add changelog fragment

---------

Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
ensi321 pushed a commit to ChainSafe/lodestar that referenced this pull request Jan 26, 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.

* Consensys/teku#9731
* OffchainLabs/prysm#15592
* sigp/lighthouse#8549

*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**

- [x] External Contributors: I have read the [contributor
guidelines](https://github.com/ChainSafe/lodestar/blob/unstable/CONTRIBUTING.md#ai-assistance-notice)
and disclosed my usage of AI below.

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

Fixes: #7477

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Nico Flaig <nflaig@protonmail.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.

3 participants

Comments