Skip to content

Add signed validator registrations type - #38

Merged
Bez625 merged 4 commits into
attestantio:masterfrom
jtraglia:signed-val-reg-list
Feb 14, 2025
Merged

Add signed validator registrations type#38
Bez625 merged 4 commits into
attestantio:masterfrom
jtraglia:signed-val-reg-list

Conversation

@jtraglia

@jtraglia jtraglia commented Feb 4, 2025

Copy link
Copy Markdown
Contributor

To allow SSZ support in mev-boost, I believe we need a new SignedValidatorRegistrations type.

The max size is VALIDATOR_REGISTRY_LIMIT:

https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#state-list-lengths

@jtraglia
jtraglia marked this pull request as ready for review February 12, 2025 12:25
@jtraglia

Copy link
Copy Markdown
Contributor Author

And for reference, this PR allows SSZ support for the validator registration endpoint:

Without this new type, there's no easy way to SSZ encode/decode these registrations.

@Bez625

Bez625 commented Feb 13, 2025

Copy link
Copy Markdown
Contributor

Hi @jtraglia, thanks for raising this.

I took a look and think maybe it would be better to follow the pattern that BlobSidecars has, where there is an array type defined for multiple.

I think this would require requesting changes to the PR you mentioned to create the new array type, e.g. SignedValidatorRegistrations, and make that the return type (rather than List[SignedValidatorRegistrationV1, VALIDATOR_REGISTRY_LIMIT]).

Question: is there a better field name than "Items"?

Looking at the BlobSidecars implementation I think it makes sense to use a more descriptive name, like Registrations.

Please let me know your thoughts, I'll add some comments to the code too.

)

// SignedValidatorRegistrationList represents a list of SignedValidatorRegistration.
type SignedValidatorRegistrationList struct {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should rename this to SignedValidatorRegistrations to be consistent with other naming.

Comment thread api/v1/generate.go Outdated

// Need to `go install github.com/ferranbt/fastssz/sszgen@latest` for this to work.
//go:generate rm -f signedvalidatorregistration_encoding.go validatorregistration_encoding.go
//go:generate rm -f signedvalidatorregistrationlist_encoding.go signedvalidatorregistration_encoding.go validatorregistration_encoding.go

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should rename the file to signedvalidatorregistrations and similar for the other files to be consistent with other naming conventions.

@jtraglia

Copy link
Copy Markdown
Contributor Author

Hey @Bez625, thanks for the review. I agree with the feedback. Will make these changes soon!

@jtraglia jtraglia changed the title Add signed validator registration list type Add signed validator registrations type Feb 13, 2025
@jtraglia

Copy link
Copy Markdown
Contributor Author

Alright @Bez625, should be ready now. Thanks again!

@Bez625

Bez625 commented Feb 14, 2025

Copy link
Copy Markdown
Contributor

Thanks @jtraglia. Have you started a discussion about adding the array return type to builder-specs? I'm just thinking we might want to hold off merging until this matches the api specs (i.e. ethereum/builder-specs#110 is merged).

Also I noticed this PR is to merge in to the electra branch - that branch has been merged in to master now so I think you might need to change this PR to go in to master. Apologies I should have picked up on that sooner.

@jtraglia
jtraglia changed the base branch from electra to master February 14, 2025 09:07
@jtraglia

Copy link
Copy Markdown
Contributor Author

Thanks @jtraglia. Have you started a discussion about adding the array return type to builder-specs? I'm just thinking we might want to hold off merging until this matches the api specs (i.e. ethereum/builder-specs#110 is merged).

Sort of. The PR introduces a new List[SignedValidatorRegistrationV1, VALIDATOR_REGISTRY_LIMIT] type, but doesn't give it an explicit name. That's a good idea. For some implementations, it's not necessary for it to be a type though.

And it's up to you. I would like to preempt that PR so that support can be included in the upcoming mev-boost release. I will note that we've recently started forwarding validator registrations without decoding them which works with SSZ. So it's not an urgent need, but it would allow us to add proper tests.

Also I noticed this PR is to merge in to the electra branch - that branch has been merged in to master now so I think you might need to change this PR to go in to master. Apologies I should have picked up on that sooner.

Oops, I didn't realize that electra had been merged into master. No problem, fixed.

@Bez625
Bez625 merged commit 11f3321 into attestantio:master Feb 14, 2025
@jtraglia
jtraglia deleted the signed-val-reg-list branch February 14, 2025 09:58
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.

2 participants