mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Add Gloas boilerplate (#7728)
Adds the required boilerplate code for the Gloas (Glamsterdam) hard fork. This allows PRs testing Gloas-candidate features to test fork transition. This also includes de-duplication of post-Bellatrix readiness notifiers from #6797 (credit to @dapplion)
This commit is contained in:
@@ -2,7 +2,7 @@ use crate::{DBColumn, Error, StoreItem};
|
||||
use ssz::{Decode, Encode};
|
||||
use types::{
|
||||
EthSpec, ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella,
|
||||
ExecutionPayloadDeneb, ExecutionPayloadElectra, ExecutionPayloadFulu,
|
||||
ExecutionPayloadDeneb, ExecutionPayloadElectra, ExecutionPayloadFulu, ExecutionPayloadGloas,
|
||||
};
|
||||
|
||||
macro_rules! impl_store_item {
|
||||
@@ -27,6 +27,7 @@ impl_store_item!(ExecutionPayloadCapella);
|
||||
impl_store_item!(ExecutionPayloadDeneb);
|
||||
impl_store_item!(ExecutionPayloadElectra);
|
||||
impl_store_item!(ExecutionPayloadFulu);
|
||||
impl_store_item!(ExecutionPayloadGloas);
|
||||
|
||||
/// This fork-agnostic implementation should be only used for writing.
|
||||
///
|
||||
@@ -42,24 +43,28 @@ impl<E: EthSpec> StoreItem for ExecutionPayload<E> {
|
||||
}
|
||||
|
||||
fn from_store_bytes(bytes: &[u8]) -> Result<Self, Error> {
|
||||
ExecutionPayloadFulu::from_ssz_bytes(bytes)
|
||||
.map(Self::Fulu)
|
||||
.or_else(|_| {
|
||||
ExecutionPayloadElectra::from_ssz_bytes(bytes)
|
||||
.map(Self::Electra)
|
||||
.or_else(|_| {
|
||||
ExecutionPayloadDeneb::from_ssz_bytes(bytes)
|
||||
.map(Self::Deneb)
|
||||
.or_else(|_| {
|
||||
ExecutionPayloadCapella::from_ssz_bytes(bytes)
|
||||
.map(Self::Capella)
|
||||
.or_else(|_| {
|
||||
ExecutionPayloadBellatrix::from_ssz_bytes(bytes)
|
||||
.map(Self::Bellatrix)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
if let Ok(payload) = ExecutionPayloadGloas::from_ssz_bytes(bytes) {
|
||||
return Ok(Self::Gloas(payload));
|
||||
}
|
||||
|
||||
if let Ok(payload) = ExecutionPayloadFulu::from_ssz_bytes(bytes) {
|
||||
return Ok(Self::Fulu(payload));
|
||||
}
|
||||
|
||||
if let Ok(payload) = ExecutionPayloadElectra::from_ssz_bytes(bytes) {
|
||||
return Ok(Self::Electra(payload));
|
||||
}
|
||||
|
||||
if let Ok(payload) = ExecutionPayloadDeneb::from_ssz_bytes(bytes) {
|
||||
return Ok(Self::Deneb(payload));
|
||||
}
|
||||
|
||||
if let Ok(payload) = ExecutionPayloadCapella::from_ssz_bytes(bytes) {
|
||||
return Ok(Self::Capella(payload));
|
||||
}
|
||||
|
||||
ExecutionPayloadBellatrix::from_ssz_bytes(bytes)
|
||||
.map(Self::Bellatrix)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user