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

chore: introduce versioned ExecutionPayload #4400

Merged
merged 12 commits into from
Aug 30, 2023
Merged

Conversation

Rjected
Copy link
Member

@Rjected Rjected commented Aug 29, 2023

This refactors the ExecutionPayloadEnvelope type into version-specific types, which no longer have Options for post-V1 fields. These types should map to the types from the engine spec.

Solves the TODO:

// TODO(rjected): we could improve this by wrapping envelope / payload types by version, so we can
// have explicitly versioned return types for getPayload. Then BuiltPayload could essentially be a
// builder for those types, and it would not be possible to e.g. return cancun fields for a
// pre-cancun endpoint.

Specifically this introduces:

  • ExecutionPayloadV1
  • ExecutionPayloadV2
  • ExecutionPayloadV3
  • ExecutionPayloadEnvelopeV2
  • ExecutionPayloadEnvelopeV3

@Rjected Rjected added A-rpc Related to the RPC implementation A-consensus Related to the consensus engine labels Aug 29, 2023
@codecov
Copy link

codecov bot commented Aug 29, 2023

Codecov Report

Merging #4400 (2ef5cf6) into main (3ffcae3) will decrease coverage by 0.16%.
Report is 1 commits behind head on main.
The diff coverage is 47.27%.

Impacted file tree graph

Files Changed Coverage Δ
crates/payload/builder/src/payload.rs 0.00% <0.00%> (ø)
crates/rpc/rpc-api/src/engine.rs 50.00% <ø> (ø)
crates/rpc/rpc-types/src/eth/engine/payload.rs 60.00% <42.27%> (-21.76%) ⬇️
crates/rpc/rpc-engine-api/src/engine_api.rs 80.93% <54.83%> (-0.44%) ⬇️
crates/rpc/rpc-engine-api/src/payload.rs 75.00% <75.00%> (ø)
crates/consensus/beacon/src/engine/mod.rs 75.42% <100.00%> (+0.16%) ⬆️
crates/consensus/beacon/src/engine/test_utils.rs 77.49% <100.00%> (+0.08%) ⬆️

... and 14 files with indirect coverage changes

Flag Coverage Δ
integration-tests 16.70% <29.59%> (-0.03%) ⬇️
unit-tests 63.76% <40.47%> (-0.14%) ⬇️

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

Components Coverage Δ
reth binary 29.21% <ø> (ø)
blockchain tree 83.52% <ø> (ø)
pipeline 90.25% <ø> (ø)
storage (db) 74.81% <ø> (ø)
trie 94.84% <ø> (-0.04%) ⬇️
txpool 48.29% <ø> (ø)
networking 77.49% <ø> (-0.24%) ⬇️
rpc 57.34% <44.31%> (-0.50%) ⬇️
consensus 63.65% <100.00%> (+0.10%) ⬆️
revm 31.74% <ø> (ø)
payload builder 6.37% <0.00%> (-0.02%) ⬇️
primitives 86.19% <ø> (-0.08%) ⬇️

@Rjected Rjected force-pushed the dan/refactor-fork-payloads branch 4 times, most recently from 60aa9be to 9f4cc30 Compare August 29, 2023 19:01
@Rjected Rjected marked this pull request as ready for review August 30, 2023 01:27
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.

cool!

because we want standalone rpc types, we want the TryFrom conversions separately, I think in the rpc compat crate

Comment on lines 79 to 81
pub async fn send_new_payload_retry_on_syncing<T: Clone + Into<ExecutionPayload>>(
&self,
payload: ExecutionPayloadV1,
payload: T,
Copy link
Collaborator

Choose a reason for hiding this comment

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

the clone is not required if we call into first

@@ -226,6 +286,21 @@ impl From<SealedBlock> for ExecutionPayloadV2 {
}
}

impl TryFrom<ExecutionPayloadV2> for Block {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we want this as functions instead because
we want standalone rpc types eventually

see #4186

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.

lgtm

@Rjected Rjected force-pushed the dan/refactor-fork-payloads branch from 1ae567f to 2ef5cf6 Compare August 30, 2023 02:17
@Rjected Rjected enabled auto-merge August 30, 2023 02:18
@Rjected Rjected added this pull request to the merge queue Aug 30, 2023
Merged via the queue into main with commit e576c00 Aug 30, 2023
@Rjected Rjected deleted the dan/refactor-fork-payloads branch August 30, 2023 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-consensus Related to the consensus engine A-rpc Related to the RPC implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants