Skip to content

Commit

Permalink
Remove proposal checks for graffiti.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Apr 25, 2024
1 parent eb48c85 commit be2c8f5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.21.3:
- relax requirement for proposals to use the graffiti we request

0.21.2:
- fuzz testing fixes

0.21.1:
- fix potential crash when unmarshaling Gwei values
- add `WithReducedMemoryUsage()` option for http service
Expand Down
12 changes: 3 additions & 9 deletions http/blindedproposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import (
)

// BlindedProposal fetches a proposal for signing.
//
// Deprecated: use `Proposal` instead.
func (s *Service) BlindedProposal(ctx context.Context,
opts *api.BlindedProposalOpts,
) (
Expand Down Expand Up @@ -85,7 +87,7 @@ func (s *Service) BlindedProposal(ctx context.Context,
return nil, errors.Join(fmt.Errorf("blinded beacon block proposal for slot %d; expected %d", blockSlot, opts.Slot), client.ErrInconsistentResult)
}

// Only check the RANDAO reveal and graffiti if we are not connected to DVT middleware,
// Only check the RANDAO reveal if we are not connected to DVT middleware,
// as the returned values will be decided by the middleware.
if !s.connectedToDVTMiddleware {
blockRandaoReveal, err := response.Data.RandaoReveal()
Expand All @@ -95,14 +97,6 @@ func (s *Service) BlindedProposal(ctx context.Context,
if !bytes.Equal(blockRandaoReveal[:], opts.RandaoReveal[:]) {
return nil, errors.Join(fmt.Errorf("blinded beacon block proposal has RANDAO reveal %#x; expected %#x", blockRandaoReveal[:], opts.RandaoReveal[:]), client.ErrInconsistentResult)
}

blockGraffiti, err := response.Data.Graffiti()
if err != nil {
return nil, err
}
if !bytes.Equal(blockGraffiti[:], opts.Graffiti[:]) {
return nil, errors.Join(fmt.Errorf("blinded beacon block proposal has graffiti %#x; expected %#x", blockGraffiti[:], opts.Graffiti[:]), client.ErrInconsistentResult)
}
}

return response, nil
Expand Down
2 changes: 1 addition & 1 deletion http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
)

// defaultUserAgent is sent with requests if no other user agent has been supplied.
const defaultUserAgent = "go-eth2-client/0.21.2"
const defaultUserAgent = "go-eth2-client/0.21.3"

// post sends an HTTP post request and returns the body.
func (s *Service) post(ctx context.Context, endpoint string, body io.Reader) (io.Reader, error) {
Expand Down
10 changes: 1 addition & 9 deletions http/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (s *Service) Proposal(ctx context.Context,
return nil, errors.Join(fmt.Errorf("beacon block proposal for slot %d; expected %d", blockSlot, opts.Slot), client.ErrInconsistentResult)
}

// Only check the RANDAO reveal and graffiti if we are not connected to DVT middleware,
// Only check the RANDAO reveal if we are not connected to DVT middleware,
// as the returned values will be decided by the middleware.
if !s.connectedToDVTMiddleware {
blockRandaoReveal, err := response.Data.RandaoReveal()
Expand All @@ -107,14 +107,6 @@ func (s *Service) Proposal(ctx context.Context,
if !bytes.Equal(blockRandaoReveal[:], opts.RandaoReveal[:]) {
return nil, errors.Join(fmt.Errorf("beacon block proposal has RANDAO reveal %#x; expected %#x", blockRandaoReveal[:], opts.RandaoReveal[:]), client.ErrInconsistentResult)
}

blockGraffiti, err := response.Data.Graffiti()
if err != nil {
return nil, err
}
if !bytes.Equal(blockGraffiti[:], opts.Graffiti[:]) {
return nil, errors.Join(fmt.Errorf("beacon block proposal has graffiti %#x; expected %#x", blockGraffiti[:], opts.Graffiti[:]), client.ErrInconsistentResult)
}
}

return response, nil
Expand Down

0 comments on commit be2c8f5

Please sign in to comment.