Skip to content

Commit

Permalink
linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ciaranmcveigh5 committed Jul 28, 2022
1 parent 827d675 commit 498fd1d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions core/signeddata.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,33 @@ type versionedRawValidatorRegistrationJSON struct {
Registration json.RawMessage `json:"registration"`
}

// NewVersionedSignedValidatorRegistration is a convenience function that returns a new signed validator (builder) registration.
func NewVersionedSignedValidatorRegistration(registration *eth2api.VersionedSignedValidatorRegistration) (VersionedSignedValidatorRegistration, error) {
switch registration.Version {
case spec.BuilderVersionV1:
if registration.V1 == nil {
return VersionedSignedValidatorRegistration{}, errors.New("no V1 registration")
}
default:
return VersionedSignedValidatorRegistration{}, errors.New("unknown version")
}

return VersionedSignedValidatorRegistration{VersionedSignedValidatorRegistration: *registration}, nil
}

// NewPartialVersionedSignedValidatorRegistration is a convenience function that returns a new partially signed validator (builder) registration.
func NewPartialVersionedSignedValidatorRegistration(registration *eth2api.VersionedSignedValidatorRegistration, shareIdx int) (ParSignedData, error) {
wrap, err := NewVersionedSignedValidatorRegistration(registration)
if err != nil {
return ParSignedData{}, err
}

return ParSignedData{
SignedData: wrap,
ShareIdx: shareIdx,
}, nil
}

func (r VersionedSignedValidatorRegistration) Clone() (SignedData, error) {
return r.clone()
}
Expand Down

0 comments on commit 498fd1d

Please sign in to comment.