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

fix: enforce unsupported fork rules on get_payload_v3 #4562

Merged
merged 3 commits into from
Sep 12, 2023

Conversation

Rjected
Copy link
Member

@Rjected Rjected commented Sep 12, 2023

We did not enforce the following rule for returned payloads in engine_getPayloadV3:

Refer to the specification for engine_getPayloadV2 with addition of the following:

  1. Client software MUST return -38005: Unsupported fork error if the timestamp of the built payload does not fall within the time frame of the Cancun fork.

This adds an additional check, causing the GetPayloadV3 To Request Shanghai Payload cancun hive test to pass.

@Rjected Rjected added C-bug An unexpected or incorrect behavior A-rpc Related to the RPC implementation A-consensus Related to the consensus engine A-block-building Related to block building E-cancun Related to the Cancun network upgrade labels Sep 12, 2023
@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

Merging #4562 (e520145) into main (25558b3) will decrease coverage by 0.10%.
Report is 1 commits behind head on main.
The diff coverage is 0.00%.

Impacted file tree graph

Files Changed Coverage Δ
crates/payload/basic/src/lib.rs 0.00% <0.00%> (ø)
crates/payload/builder/src/service.rs 28.75% <0.00%> (-5.89%) ⬇️
crates/payload/builder/src/test_utils.rs 29.41% <0.00%> (-2.85%) ⬇️
crates/payload/builder/src/traits.rs 0.00% <ø> (ø)
crates/rpc/rpc-engine-api/src/engine_api.rs 78.59% <0.00%> (-1.68%) ⬇️

... and 12 files with indirect coverage changes

Flag Coverage Δ
integration-tests 16.60% <0.00%> (-0.04%) ⬇️
unit-tests 63.90% <0.00%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 30.83% <ø> (ø)
blockchain tree 83.58% <ø> (ø)
pipeline 90.53% <ø> (ø)
storage (db) 75.32% <ø> (ø)
trie 94.88% <ø> (ø)
txpool 47.26% <ø> (-0.54%) ⬇️
networking 77.16% <ø> (-0.12%) ⬇️
rpc 57.29% <0.00%> (-0.07%) ⬇️
consensus 63.40% <ø> (ø)
revm 31.56% <ø> (ø)
payload builder 6.12% <0.00%> (-0.23%) ⬇️
primitives 86.53% <ø> (-0.01%) ⬇️

Comment on lines 212 to 214
// were to resolve the payload here, and it is before cancun, then it's possible a
// subsequent call to `get_payload_v3` would return `UnknownPayload` because the payload
// may no longer exist in the payload store.
Copy link
Collaborator

@mattsse mattsse Sep 12, 2023

Choose a reason for hiding this comment

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

I don't understand this,
The timestamp is fixed, why would we expect a subsequent call to get payload?

it's a bit weird that we're effectively calling a getter twice.

we could add a new function to the payloadstore that returns the payloadattributes that would be cleaner than returning the block twice

Copy link
Member Author

Choose a reason for hiding this comment

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

We typically wouldn't expect another call, but this is how one of the hive tests works unfortunately

Copy link
Member Author

Choose a reason for hiding this comment

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

Just added another method to the payloadstore that returns the payloadattributes

crates/rpc/rpc-engine-api/src/engine_api.rs Outdated Show resolved Hide resolved
return Err(EngineApiError::UnsupportedFork)
}

// Now resolve the payload
Copy link
Collaborator

Choose a reason for hiding this comment

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

tbh I would consider this a CL bug

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

I like this
lgtm

@Rjected somethings needs to be updated in docs

@Rjected Rjected added this pull request to the merge queue Sep 12, 2023
Merged via the queue into main with commit c495614 Sep 12, 2023
24 checks passed
@Rjected Rjected deleted the dan/enforce-get-payload-v3-unsupported-fork-rules branch September 12, 2023 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-block-building Related to block building A-consensus Related to the consensus engine A-rpc Related to the RPC implementation C-bug An unexpected or incorrect behavior E-cancun Related to the Cancun network upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants