Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] add builder spec validator registration structs to the v1 package #19

Merged
merged 12 commits into from
Jul 25, 2022

Conversation

ciaranmcveigh5
Copy link
Contributor

@ciaranmcveigh5 ciaranmcveigh5 commented Jul 18, 2022

Resolves Issues

#18

Description

Adding builder api validator registration to the go-eth2-client

@ciaranmcveigh5 ciaranmcveigh5 changed the title add builder spec validator registration structs to the v1 package [WIP] add builder spec validator registration structs to the v1 package Jul 18, 2022
Copy link
Contributor

@mcdee mcdee left a comment

Choose a reason for hiding this comment

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

Thank you for your submission. A few items that need tweaking, but nothing major.

type ValidatorRegistration struct {
FeeRecipient bellatrix.ExecutionAddress
GasLimit uint64
Timestamp uint64
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a time.Time (as used in genesis.go).

Comment on lines 27 to 28
Version spec.DataVersion
Bellatrix *apiv1.SignedValidatorRegistration
Copy link
Contributor

Choose a reason for hiding this comment

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

This object isn't under the consensus specs versioning (this is stated explicitly in https://github.com/ethereum/builder-specs/blob/main/specs/builder.md#independently-versioned) so should use its own versioning (perhaps spec.BuilderVersion)

},
{
name: "TimestampInvalid",
input: []byte(`{"fee_recipient":"0x000102030405060708090a0b0c0d0e0f10111213","gas_limit":"100","timestamp":"invalid","pubkey":"0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f"}`),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

time.unix() is of type int64 not sure how you want to test for invalid data - for now i've just used "invalid"

@ciaranmcveigh5
Copy link
Contributor Author

Thanks for reviewing have made the requested updates, tests are passing - let me know if the builderVersion implementation isn't in line with what you were thinking

@@ -24,7 +25,7 @@ import (

// VersionedValidatorRegistration contains a versioned ValidatorRegistrationV1.
type VersionedValidatorRegistration struct {
Version spec.DataVersion
Version spec.BuilderVersion
Bellatrix *apiv1.ValidatorRegistration
Copy link
Contributor

Choose a reason for hiding this comment

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

This field should map to the builder version, so be called V1 rather than Bellatrix.


// MarshalJSON implements json.Marshaler.
func (d *BuilderVersion) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf("%q", responseVersionStrings[*d])), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be responseBuilderVersionStrings


// String returns a string representation of the
func (d BuilderVersion) String() string {
if int(d) >= len(responseVersionStrings) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be responseBuilderVersionStrings

if int(d) >= len(responseVersionStrings) {
return "unknown"
}
return responseVersionStrings[d]
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be responseBuilderVersionStrings

@moshe-blox
Copy link
Contributor

I have made some changes and successfully tested against Teku on Sepolia, please take a look at ciaranmcveigh5#1 if you can.

Hopefully this can get merged to this repo eventually.

(builder-specs) Encoding, bulk submission & tests
@mcdee
Copy link
Contributor

mcdee commented Jul 25, 2022

Need to address the above items where responseVersionStrings should be responseBuilderVersionStrings, apart from that looking good.

@ciaranmcveigh5
Copy link
Contributor Author

ciaranmcveigh5 commented Jul 25, 2022

hey @mcdee I believe the above items where responseVersionStrings should be responseBuilderVersionStrings have been addressed in @moshe-blox commits

currently builderversion.go has responseBuilderVersionStrings

and dataversion.go has responseVersionStrings

see file changes on spec/builderversion.go in this commit 0b866da#diff-c592b40af9139e1bbd99a5df3376d54b5a83bd0bc6b29525bfadacb5ea96a8cd

Thanks for the reviews

@mcdee mcdee merged commit 773278c into attestantio:master Jul 25, 2022
obol-bulldozer bot pushed a commit to ObolNetwork/charon that referenced this pull request Jul 26, 2022
Jim has merged in the builder registration PR attestantio/go-eth2-client#19 so we are unblocked on that flow now

- Add DutyBuilderRegistration
- Update tests to include the registration duty 

category: feature
ticket: #849
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.

None yet

3 participants