feat: integrate gossip validation spec tests - #8965
Conversation
Summary of ChangesHello, 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 significantly enhances the robustness of the beacon node's gossip validation by integrating official Ethereum consensus specification tests. It introduces a dedicated testing framework to rigorously verify the handling of various gossip messages, such as blocks, attestations, and slashings, against the expected spec behavior. This ensures greater compliance with the protocol and improves the network's resilience against invalid or malicious messages. Highlights
🧠 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. Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request integrates gossip validation spec tests by introducing a new test runner and helper utilities. It also includes a couple of logic fixes in attesterSlashing and block validation to align with spec requirements. The new test infrastructure is comprehensive, setting up a full BeaconChain instance to run validation against. The changes look good overall. I've found one potential issue in the new test helper where its validation logic for block parents seems to diverge from the production implementation, which could lead to incorrect test failures. My detailed comment addresses this.
Performance Report✔️ no performance regression detected Full benchmark results
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d1e782f2a
ℹ️ 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".
d72f6ee to
ab22b6c
Compare
This reverts commit ab22b6c.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request integrates the Ethereum consensus gossip validation spec tests. A new test runner and supporting infrastructure have been added to execute these tests. The changes also include fixes to the gossip validation logic for attestations, attester slashings, and blocks to align with the consensus specs, which were likely identified while implementing the new tests. The changes are correct and improve spec compliance. The new test infrastructure is well-structured.
…8967) Fixes all gossip validation spec test failures on `nflaig/gossip-validation-tests`. **Root cause:** Lodestar's custom YAML int parser (`loadYaml` via `int.ts`) returns ALL integers as BigInt. The test harness was passing these BigInts directly to arithmetic operations expecting Number, causing `Cannot mix BigInt and other types` TypeErrors. Additionally, `mapErrorToResult` didn't catch plain `Error` thrown by `pubkeyCache.getOrThrow`, and `subnet_id` was passed as BigInt to attestation validation. **Fixes:** - `Number()` conversions for BigInt YAML values: `genesisTime`, `current_time_ms`, `offset_ms`, `epoch`, `subnet_id` - `mapErrorToResult` catches all `Error` types (not just `TypeError | RangeError`) - Null guard for `finalized_checkpoint.epoch` **Results:** 138/138 passing (74 gossip validation + 64 networking utility) --------- Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
I've built the spec tests manually and we are passing 74/74 of the gossip validation tests, that said right now this is a no-op until the next spec release there is no harm in already merging this, if spec test layout changes we need to adapt our test runner but that shouldn't be too much effort |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #8965 +/- ##
============================================
- Coverage 52.26% 52.26% -0.01%
============================================
Files 848 848
Lines 62928 62926 -2
Branches 4639 4639
============================================
- Hits 32891 32889 -2
Misses 29970 29970
Partials 67 67 🚀 New features to boost your workflow:
|
|
🎉 This PR is included in v1.41.0 🎉 |
see ethereum/consensus-specs#4902