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

beacon/engine: check for empty requests #31010

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

s1na
Copy link
Contributor

@s1na s1na commented Jan 9, 2025

According to https://github.com/ethereum/execution-apis/blob/main/src/engine/prague.md#engine_newpayloadv4:

Elements of the list MUST be ordered by request_type in ascending order. Elements with empty request_data MUST be excluded from the list.

beacon/engine/types.go Outdated Show resolved Hide resolved
s1na and others added 2 commits January 9, 2025 18:07
Co-authored-by: lightclient <14004106 [email protected]>
for _, req := range requests {
// No empty requests.
if len(req) < 2 {
return nil, fmt.Errorf("empty request: %v", req)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do they define an error code for this?

Copy link
Member

Choose a reason for hiding this comment

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

Just the normal invalid params error code: https://github.com/ethereum/execution-apis/pull/622/files

Copy link
Member

@lightclient lightclient left a comment

Choose a reason for hiding this comment

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

One issue with this PR is that it returns a PayloadStatusV1, status INVALID and no error -- note the return api.invalid(err, nil), nil in newPayload(..).

The PR requires clients return the error -32602: Invalid params. Usually we return this in the body of the versioned method e.g.

func (api *ConsensusAPI) NewPayloadV4(params engine.ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash, executionRequests []hexutil.Bytes) (engine.PayloadStatusV1, error) {
  ...
  if executionRequests == nil {
    return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("nil executionRequests post-prague"))
  }
}

So we should either do this requests check there in the versioned method or we need to interpret the error from ExecutableDataToBlock and return invalid params from newPayload.

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.

4 participants