-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(api,rpc): improve engine API abstraction #6871
feat(api,rpc): improve engine API abstraction #6871
Conversation
438f144
to
e3182bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this.
we have a few more complications with the OP V3 type
crates/node-optimism/src/engine.rs
Outdated
@@ -15,6 +18,9 @@ impl EngineTypes for OptimismEngineTypes { | |||
type PayloadAttributes = OptimismPayloadAttributes; | |||
type PayloadBuilderAttributes = OptimismPayloadBuilderAttributes; | |||
type BuiltPayload = EthBuiltPayload; | |||
type ExecutionPayloadV1 = ExecutionPayloadV1; | |||
type ExecutionPayloadV2 = ExecutionPayloadEnvelopeV2; | |||
type ExecutionPayloadV3 = ExecutionPayloadEnvelopeV3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
once merged we can add a dedicated OP V3 payload type in alloy because this is now diverged from ethereum
and I think we also want to change the BuiltPayload
type to a new OptimismBuiltPayload
that then should include the ChainSpec so we no longer need the additional check parent_beacon_block_root
check
.map(|payload| payload.into_v1_payload())?) | ||
.map_err(|_| EngineApiError::UnknownPayload)? | ||
.try_into() | ||
.map_err(|_| EngineApiError::UnknownPayload) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to log a warn!(err) here
e3182bb
to
c703308
Compare
717f8de
to
87b8880
Compare
87b8880
to
2216fb6
Compare
1d4ea00
to
99f1fb0
Compare
c668de6
to
fbfc2bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great!
last nits
crates/payload/optimism/src/lib.rs
Outdated
#[derive(Debug, Clone, PartialEq, Eq, Default)] | ||
#[non_exhaustive] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can remove the default+ non_exhaustive now to prevent default chainspec and instead require at least the Chainspec in a new function because we want to prevent misuse of Chainspec::default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, done
attributes.parent_beacon_block_root().unwrap_or_else(FixedBytes::<32>::default) | ||
} else { | ||
FixedBytes::<32>::default() | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should now return an error because it is required for v3
if chain_spec.is_cancun_active_at_timestamp(attributes.timestamp()) { | ||
attributes.parent_beacon_block_root().unwrap_or_else(FixedBytes::<32>::default) | ||
} else { | ||
panic!("V3 is only possible after cancun"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we also need to set the zero hash here (pre cancun):
Starting at Ecotone, the parentBeaconBlockRoot must be set to the L1 origin parentBeaconBlockRoot, or a zero bytes32 if the Dencun functionality with parentBeaconBlockRoot is not active on L1.
but perhaps we should treat this as an error and use TryFrom impl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, for now I have set the zero hash for the pre cancun case. If we want to impl TryFrom, what should be the error type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, need to think about this
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
29ea33d
to
c8bd102
Compare
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Closes #6734