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

Merged
merged 6 commits into from
Jan 15, 2025

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 <[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

rjl493456442
rjl493456442 previously approved these changes Jan 10, 2025
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.

@lightclient lightclient merged commit 9b68875 into ethereum:master Jan 15, 2025
3 checks passed
@lightclient lightclient added this to the 1.14.13 milestone Jan 15, 2025
Copy link

@krud491 krud491 left a comment

Choose a reason for hiding this comment

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

Keep up the good work

@fjl fjl modified the milestones: 1.14.13, 1.15.0 Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants