Avoid validator registration load - #798
Open
canercidam wants to merge 2 commits into
Open
canercidam wants to merge 2 commits into
canercidam wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Deduplication can discard valid updates, and cancellation does not promptly stop chunk verification.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds bounded, chunked validator-signature verification to reduce registration load.
Changes:
- Introduces a global verification semaphore and chunking.
- Collapses duplicate validator registrations.
- Adds duplicate-registration coverage.
File summaries
| File | Description |
|---|---|
services/api/service.go |
Implements throttled verification and deduplication. |
services/api/service_test.go |
Tests duplicate collapsing and semaphore release. |
Review details
Suppressed comments (1)
services/api/service.go:3323
- The SSZ path also deduplicates solely by pubkey before validation, so a later, distinct update for the same validator is silently discarded. This bypasses the newer-timestamp behavior implemented below; deduplicate identical entries, reject conflicts, or select the newest registration explicitly.
pk := common.NewPubkeyHex(signedValidatorRegistration.Message.Pubkey.String())
if _, seen := seenPubkeys[pk]; seen {
continue
}
seenPubkeys[pk] = struct{}{}
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1271
to
+1272
| for _, reg := range chunk { | ||
| numProcessed++ |
Comment on lines
+3251
to
+3255
| pubkeyHex := common.NewPubkeyHex(reg.Pubkey.String()) | ||
| if _, seen := seenPubkeys[pubkeyHex]; seen { | ||
| continue | ||
| } | ||
| seenPubkeys[pubkeyHex] = struct{}{} |
| } | ||
| } | ||
| require.Equal(t, 1, numReceived) | ||
| require.Empty(t, backend.relay.regValVerifySem, "verification slots must be released") |
metachris
reviewed
Sep 3, 2026
| for _, signedValidatorRegistration := range regs { | ||
| pk := common.NewPubkeyHex(signedValidatorRegistration.Message.Pubkey.String()) | ||
| if _, seen := seenPubkeys[pk]; seen { | ||
| continue |
Collaborator
There was a problem hiding this comment.
Will this also skip processing if one of the fields change, i.e. the fee recipient?
Collaborator
There was a problem hiding this comment.
ah i see, it only persists for this one request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
Chunks validation registration and limits concurrency across all requests.
⛱ Motivation and Context
This helps avoid the load from the excessive registrations in the requests.