Skip to content

Avoid validator registration load - #798

Open
canercidam wants to merge 2 commits into
mainfrom
caner/validator-registration-fix
Open

canercidam wants to merge 2 commits into
mainfrom
caner/validator-registration-fix

Conversation

@canercidam

Copy link
Copy Markdown
Member

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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 thread services/api/service.go
Comment on lines +1271 to +1272
for _, reg := range chunk {
numProcessed++
Comment thread services/api/service.go
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")
Comment thread services/api/service.go
for _, signedValidatorRegistration := range regs {
pk := common.NewPubkeyHex(signedValidatorRegistration.Message.Pubkey.String())
if _, seen := seenPubkeys[pk]; seen {
continue

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Will this also skip processing if one of the fields change, i.e. the fee recipient?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ah i see, it only persists for this one request

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