-
Notifications
You must be signed in to change notification settings - Fork 933
Closed
Labels
bugSomething isn't workingSomething isn't workingbuilder APIelectraRequired for the Electra/Prague forkRequired for the Electra/Prague forkv7.0.0New release c. Q1 2025New release c. Q1 2025
Description
I think our implementation of ForkVersionDeserialize is wrong:
lighthouse/common/eth2/src/types.rs
Lines 2014 to 2033 in 091e292
| impl<E: EthSpec> ForkVersionDeserialize for FullPayloadContents<E> { | |
| fn deserialize_by_fork<'de, D: Deserializer<'de>>( | |
| value: Value, | |
| fork_name: ForkName, | |
| ) -> Result<Self, D::Error> { | |
| if fork_name.deneb_enabled() { | |
| serde_json::from_value(value) | |
| .map(Self::PayloadAndBlobs) | |
| .map_err(serde::de::Error::custom) | |
| } else if fork_name.bellatrix_enabled() { | |
| serde_json::from_value(value) | |
| .map(Self::Payload) | |
| .map_err(serde::de::Error::custom) | |
| } else { | |
| Err(serde::de::Error::custom(format!( | |
| "FullPayloadContents deserialization for {fork_name} not implemented" | |
| ))) | |
| } | |
| } | |
| } |
We are relying on serde_json::from_value(value) to produce a ExecutionPayloadAndBlobs<E> without any fork hinting, so it is liable to deserialize the wrong variant (e.g. Deneb instead of Electra).
I think we should remove the Deserialize impl for ExecutionPayloadAndBlobs<E>, implement ForkVersionDeserialize instead, and use that fork-aware deserialization here.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingbuilder APIelectraRequired for the Electra/Prague forkRequired for the Electra/Prague forkv7.0.0New release c. Q1 2025New release c. Q1 2025