Add Electra fork boilerplate (#5122)

* Add Electra fork boilerplate

* Remove electra from spec tests

* Fix tests

* Remove sneaky log file

* Fix more tests

* Fix even more tests and add suggestions

* Remove unrelated lcli addition

* Update more tests

* Merge branch 'unstable' into electra

* Add comment for test-suite lcli override

* Merge branch 'unstable' into electra

* Cleanup

* Merge branch 'unstable' into electra

* Apply suggestions

* Merge branch 'unstable' into electra

* Merge sigp/unstable into electra

* Merge branch 'unstable' into electra
This commit is contained in:
Mac L
2024-04-02 23:35:02 +11:00
committed by GitHub
parent 3058b96f25
commit f8fdb71f50
105 changed files with 2079 additions and 405 deletions

View File

@@ -1032,6 +1032,9 @@ impl ForkVersionDeserialize for SsePayloadAttributes {
ForkName::Deneb => serde_json::from_value(value)
.map(Self::V3)
.map_err(serde::de::Error::custom),
ForkName::Electra => serde_json::from_value(value)
.map(Self::V3)
.map_err(serde::de::Error::custom),
ForkName::Base | ForkName::Altair => Err(serde::de::Error::custom(format!(
"SsePayloadAttributes deserialization for {fork_name} not implemented"
))),
@@ -1599,7 +1602,7 @@ impl<T: EthSpec> FullBlockContents<T> {
BeaconBlock::from_ssz_bytes_for_fork(bytes, fork_name)
.map(|block| FullBlockContents::Block(block))
}
ForkName::Deneb => {
ForkName::Deneb | ForkName::Electra => {
let mut builder = ssz::SszDecoderBuilder::new(bytes);
builder.register_anonymous_variable_length_item()?;
@@ -1660,7 +1663,7 @@ impl<T: EthSpec> ForkVersionDeserialize for FullBlockContents<T> {
BeaconBlock::deserialize_by_fork::<'de, D>(value, fork_name)?,
))
}
ForkName::Deneb => Ok(FullBlockContents::BlockContents(
ForkName::Deneb | ForkName::Electra => Ok(FullBlockContents::BlockContents(
BlockContents::deserialize_by_fork::<'de, D>(value, fork_name)?,
)),
}
@@ -1759,7 +1762,7 @@ impl<T: EthSpec> PublishBlockRequest<T> {
SignedBeaconBlock::from_ssz_bytes_for_fork(bytes, fork_name)
.map(|block| PublishBlockRequest::Block(Arc::new(block)))
}
ForkName::Deneb => {
ForkName::Deneb | ForkName::Electra => {
let mut builder = ssz::SszDecoderBuilder::new(bytes);
builder.register_anonymous_variable_length_item()?;
builder.register_type::<KzgProofs<T>>()?;
@@ -1843,9 +1846,9 @@ impl<T: EthSpec> TryFrom<Arc<SignedBeaconBlock<T>>> for PublishBlockRequest<T> {
| SignedBeaconBlock::Altair(_)
| SignedBeaconBlock::Merge(_)
| SignedBeaconBlock::Capella(_) => Ok(PublishBlockRequest::Block(block)),
SignedBeaconBlock::Deneb(_) => {
Err("deneb block contents cannot be fully constructed from just the signed block")
}
SignedBeaconBlock::Deneb(_) | SignedBeaconBlock::Electra(_) => Err(
"post-Deneb block contents cannot be fully constructed from just the signed block",
),
}
}
}
@@ -1953,7 +1956,7 @@ impl<E: EthSpec> ForkVersionDeserialize for FullPayloadContents<E> {
ForkName::Merge | ForkName::Capella => serde_json::from_value(value)
.map(Self::Payload)
.map_err(serde::de::Error::custom),
ForkName::Deneb => serde_json::from_value(value)
ForkName::Deneb | ForkName::Electra => serde_json::from_value(value)
.map(Self::PayloadAndBlobs)
.map_err(serde::de::Error::custom),
ForkName::Base | ForkName::Altair => Err(serde::de::Error::custom(format!(