mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
Merge branch 'gloas-containers' into gloas-envelope-processing
This commit is contained in:
@@ -5809,7 +5809,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
execution_payload_value,
|
execution_payload_value,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
BeaconState::Gloas(_) => todo!("Gloas block production"),
|
BeaconState::Gloas(_) => return Err(BlockProductionError::GloasNotImplemented),
|
||||||
};
|
};
|
||||||
|
|
||||||
let block = SignedBeaconBlock::from_block(
|
let block = SignedBeaconBlock::from_block(
|
||||||
|
|||||||
@@ -320,6 +320,8 @@ pub enum BlockProductionError {
|
|||||||
FailedToBuildBlobSidecars(String),
|
FailedToBuildBlobSidecars(String),
|
||||||
MissingExecutionRequests,
|
MissingExecutionRequests,
|
||||||
SszTypesError(ssz_types::Error),
|
SszTypesError(ssz_types::Error),
|
||||||
|
// TODO(gloas): Remove this once Gloas is implemented
|
||||||
|
GloasNotImplemented,
|
||||||
}
|
}
|
||||||
|
|
||||||
easy_from_to!(BlockProcessingError, BlockProductionError);
|
easy_from_to!(BlockProcessingError, BlockProductionError);
|
||||||
|
|||||||
@@ -107,8 +107,8 @@ impl<E: EthSpec> LightClientBootstrap<E> {
|
|||||||
ForkName::Deneb => Self::Deneb(LightClientBootstrapDeneb::from_ssz_bytes(bytes)?),
|
ForkName::Deneb => Self::Deneb(LightClientBootstrapDeneb::from_ssz_bytes(bytes)?),
|
||||||
ForkName::Electra => Self::Electra(LightClientBootstrapElectra::from_ssz_bytes(bytes)?),
|
ForkName::Electra => Self::Electra(LightClientBootstrapElectra::from_ssz_bytes(bytes)?),
|
||||||
ForkName::Fulu => Self::Fulu(LightClientBootstrapFulu::from_ssz_bytes(bytes)?),
|
ForkName::Fulu => Self::Fulu(LightClientBootstrapFulu::from_ssz_bytes(bytes)?),
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
// TODO(gloas): implement Gloas light client
|
||||||
ForkName::Base => {
|
ForkName::Base | ForkName::Gloas => {
|
||||||
return Err(ssz::DecodeError::BytesInvalid(format!(
|
return Err(ssz::DecodeError::BytesInvalid(format!(
|
||||||
"LightClientBootstrap decoding for {fork_name} not implemented"
|
"LightClientBootstrap decoding for {fork_name} not implemented"
|
||||||
)));
|
)));
|
||||||
@@ -129,7 +129,8 @@ impl<E: EthSpec> LightClientBootstrap<E> {
|
|||||||
ForkName::Deneb => <LightClientBootstrapDeneb<E> as Encode>::ssz_fixed_len(),
|
ForkName::Deneb => <LightClientBootstrapDeneb<E> as Encode>::ssz_fixed_len(),
|
||||||
ForkName::Electra => <LightClientBootstrapElectra<E> as Encode>::ssz_fixed_len(),
|
ForkName::Electra => <LightClientBootstrapElectra<E> as Encode>::ssz_fixed_len(),
|
||||||
ForkName::Fulu => <LightClientBootstrapFulu<E> as Encode>::ssz_fixed_len(),
|
ForkName::Fulu => <LightClientBootstrapFulu<E> as Encode>::ssz_fixed_len(),
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
// TODO(gloas): implement Gloas light client
|
||||||
|
ForkName::Gloas => <LightClientBootstrapAltair<E> as Encode>::ssz_fixed_len(),
|
||||||
};
|
};
|
||||||
fixed_len + LightClientHeader::<E>::ssz_max_var_len_for_fork(fork_name)
|
fixed_len + LightClientHeader::<E>::ssz_max_var_len_for_fork(fork_name)
|
||||||
}
|
}
|
||||||
@@ -180,7 +181,8 @@ impl<E: EthSpec> LightClientBootstrap<E> {
|
|||||||
.try_into()
|
.try_into()
|
||||||
.map_err(Error::SszTypesError)?,
|
.map_err(Error::SszTypesError)?,
|
||||||
}),
|
}),
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
// TODO(gloas): implement Gloas light client
|
||||||
|
ForkName::Gloas => return Err(Error::GloasNotImplemented),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(light_client_bootstrap)
|
Ok(light_client_bootstrap)
|
||||||
@@ -234,7 +236,8 @@ impl<E: EthSpec> LightClientBootstrap<E> {
|
|||||||
.try_into()
|
.try_into()
|
||||||
.map_err(Error::SszTypesError)?,
|
.map_err(Error::SszTypesError)?,
|
||||||
}),
|
}),
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
// TODO(gloas): implement Gloas light client
|
||||||
|
ForkName::Gloas => return Err(Error::GloasNotImplemented),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(light_client_bootstrap)
|
Ok(light_client_bootstrap)
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ impl<E: EthSpec> LightClientFinalityUpdate<E> {
|
|||||||
sync_aggregate,
|
sync_aggregate,
|
||||||
signature_slot,
|
signature_slot,
|
||||||
}),
|
}),
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
ForkName::Gloas => return Err(Error::GloasNotImplemented),
|
||||||
ForkName::Base => return Err(Error::AltairForkNotActive),
|
ForkName::Base => return Err(Error::AltairForkNotActive),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -214,8 +214,8 @@ impl<E: EthSpec> LightClientFinalityUpdate<E> {
|
|||||||
Self::Electra(LightClientFinalityUpdateElectra::from_ssz_bytes(bytes)?)
|
Self::Electra(LightClientFinalityUpdateElectra::from_ssz_bytes(bytes)?)
|
||||||
}
|
}
|
||||||
ForkName::Fulu => Self::Fulu(LightClientFinalityUpdateFulu::from_ssz_bytes(bytes)?),
|
ForkName::Fulu => Self::Fulu(LightClientFinalityUpdateFulu::from_ssz_bytes(bytes)?),
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
// TODO(gloas): implement Gloas light client
|
||||||
ForkName::Base => {
|
ForkName::Base | ForkName::Gloas => {
|
||||||
return Err(ssz::DecodeError::BytesInvalid(format!(
|
return Err(ssz::DecodeError::BytesInvalid(format!(
|
||||||
"LightClientFinalityUpdate decoding for {fork_name} not implemented"
|
"LightClientFinalityUpdate decoding for {fork_name} not implemented"
|
||||||
)));
|
)));
|
||||||
@@ -236,7 +236,8 @@ impl<E: EthSpec> LightClientFinalityUpdate<E> {
|
|||||||
ForkName::Deneb => <LightClientFinalityUpdateDeneb<E> as Encode>::ssz_fixed_len(),
|
ForkName::Deneb => <LightClientFinalityUpdateDeneb<E> as Encode>::ssz_fixed_len(),
|
||||||
ForkName::Electra => <LightClientFinalityUpdateElectra<E> as Encode>::ssz_fixed_len(),
|
ForkName::Electra => <LightClientFinalityUpdateElectra<E> as Encode>::ssz_fixed_len(),
|
||||||
ForkName::Fulu => <LightClientFinalityUpdateFulu<E> as Encode>::ssz_fixed_len(),
|
ForkName::Fulu => <LightClientFinalityUpdateFulu<E> as Encode>::ssz_fixed_len(),
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
// TODO(gloas): implement Gloas light client
|
||||||
|
ForkName::Gloas => 0,
|
||||||
};
|
};
|
||||||
// `2 *` because there are two headers in the update
|
// `2 *` because there are two headers in the update
|
||||||
fixed_size + 2 * LightClientHeader::<E>::ssz_max_var_len_for_fork(fork_name)
|
fixed_size + 2 * LightClientHeader::<E>::ssz_max_var_len_for_fork(fork_name)
|
||||||
|
|||||||
@@ -104,7 +104,8 @@ impl<E: EthSpec> LightClientHeader<E> {
|
|||||||
ForkName::Fulu => {
|
ForkName::Fulu => {
|
||||||
LightClientHeader::Fulu(LightClientHeaderFulu::block_to_light_client_header(block)?)
|
LightClientHeader::Fulu(LightClientHeaderFulu::block_to_light_client_header(block)?)
|
||||||
}
|
}
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
// TODO(gloas): implement Gloas light client
|
||||||
|
ForkName::Gloas => return Err(Error::GloasNotImplemented),
|
||||||
};
|
};
|
||||||
Ok(header)
|
Ok(header)
|
||||||
}
|
}
|
||||||
@@ -126,8 +127,8 @@ impl<E: EthSpec> LightClientHeader<E> {
|
|||||||
ForkName::Fulu => {
|
ForkName::Fulu => {
|
||||||
LightClientHeader::Fulu(LightClientHeaderFulu::from_ssz_bytes(bytes)?)
|
LightClientHeader::Fulu(LightClientHeaderFulu::from_ssz_bytes(bytes)?)
|
||||||
}
|
}
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
// TODO(gloas): implement Gloas light client
|
||||||
ForkName::Base => {
|
ForkName::Base | ForkName::Gloas => {
|
||||||
return Err(ssz::DecodeError::BytesInvalid(format!(
|
return Err(ssz::DecodeError::BytesInvalid(format!(
|
||||||
"LightClientHeader decoding for {fork_name} not implemented"
|
"LightClientHeader decoding for {fork_name} not implemented"
|
||||||
)));
|
)));
|
||||||
@@ -357,7 +358,8 @@ impl<'de, E: EthSpec> ContextDeserialize<'de, ForkName> for LightClientHeader<E>
|
|||||||
))
|
))
|
||||||
};
|
};
|
||||||
Ok(match context {
|
Ok(match context {
|
||||||
ForkName::Base => {
|
// TODO(gloas): implement Gloas light client
|
||||||
|
ForkName::Base | ForkName::Gloas => {
|
||||||
return Err(serde::de::Error::custom(format!(
|
return Err(serde::de::Error::custom(format!(
|
||||||
"LightClientFinalityUpdate failed to deserialize: unsupported fork '{}'",
|
"LightClientFinalityUpdate failed to deserialize: unsupported fork '{}'",
|
||||||
context
|
context
|
||||||
@@ -378,7 +380,6 @@ impl<'de, E: EthSpec> ContextDeserialize<'de, ForkName> for LightClientHeader<E>
|
|||||||
ForkName::Fulu => {
|
ForkName::Fulu => {
|
||||||
Self::Fulu(Deserialize::deserialize(deserializer).map_err(convert_err)?)
|
Self::Fulu(Deserialize::deserialize(deserializer).map_err(convert_err)?)
|
||||||
}
|
}
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ impl<E: EthSpec> LightClientOptimisticUpdate<E> {
|
|||||||
sync_aggregate,
|
sync_aggregate,
|
||||||
signature_slot,
|
signature_slot,
|
||||||
}),
|
}),
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
ForkName::Gloas => return Err(Error::GloasNotImplemented),
|
||||||
ForkName::Base => return Err(Error::AltairForkNotActive),
|
ForkName::Base => return Err(Error::AltairForkNotActive),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -175,8 +175,8 @@ impl<E: EthSpec> LightClientOptimisticUpdate<E> {
|
|||||||
Self::Electra(LightClientOptimisticUpdateElectra::from_ssz_bytes(bytes)?)
|
Self::Electra(LightClientOptimisticUpdateElectra::from_ssz_bytes(bytes)?)
|
||||||
}
|
}
|
||||||
ForkName::Fulu => Self::Fulu(LightClientOptimisticUpdateFulu::from_ssz_bytes(bytes)?),
|
ForkName::Fulu => Self::Fulu(LightClientOptimisticUpdateFulu::from_ssz_bytes(bytes)?),
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
// TODO(gloas): implement Gloas light client
|
||||||
ForkName::Base => {
|
ForkName::Base | ForkName::Gloas => {
|
||||||
return Err(ssz::DecodeError::BytesInvalid(format!(
|
return Err(ssz::DecodeError::BytesInvalid(format!(
|
||||||
"LightClientOptimisticUpdate decoding for {fork_name} not implemented"
|
"LightClientOptimisticUpdate decoding for {fork_name} not implemented"
|
||||||
)));
|
)));
|
||||||
@@ -197,7 +197,8 @@ impl<E: EthSpec> LightClientOptimisticUpdate<E> {
|
|||||||
ForkName::Deneb => <LightClientOptimisticUpdateDeneb<E> as Encode>::ssz_fixed_len(),
|
ForkName::Deneb => <LightClientOptimisticUpdateDeneb<E> as Encode>::ssz_fixed_len(),
|
||||||
ForkName::Electra => <LightClientOptimisticUpdateElectra<E> as Encode>::ssz_fixed_len(),
|
ForkName::Electra => <LightClientOptimisticUpdateElectra<E> as Encode>::ssz_fixed_len(),
|
||||||
ForkName::Fulu => <LightClientOptimisticUpdateFulu<E> as Encode>::ssz_fixed_len(),
|
ForkName::Fulu => <LightClientOptimisticUpdateFulu<E> as Encode>::ssz_fixed_len(),
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
// TODO(gloas): implement Gloas light client
|
||||||
|
ForkName::Gloas => 0,
|
||||||
};
|
};
|
||||||
fixed_len + LightClientHeader::<E>::ssz_max_var_len_for_fork(fork_name)
|
fixed_len + LightClientHeader::<E>::ssz_max_var_len_for_fork(fork_name)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ pub enum Error {
|
|||||||
InvalidFinalizedBlock,
|
InvalidFinalizedBlock,
|
||||||
BeaconBlockBodyError,
|
BeaconBlockBodyError,
|
||||||
InconsistentFork,
|
InconsistentFork,
|
||||||
|
// TODO(gloas): implement Gloas light client
|
||||||
|
GloasNotImplemented,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ssz_types::Error> for Error {
|
impl From<ssz_types::Error> for Error {
|
||||||
@@ -195,7 +197,8 @@ impl<'de, E: EthSpec> ContextDeserialize<'de, ForkName> for LightClientUpdate<E>
|
|||||||
serde::de::Error::custom(format!("LightClientUpdate failed to deserialize: {:?}", e))
|
serde::de::Error::custom(format!("LightClientUpdate failed to deserialize: {:?}", e))
|
||||||
};
|
};
|
||||||
Ok(match context {
|
Ok(match context {
|
||||||
ForkName::Base => {
|
// TODO(gloas): implement Gloas light client
|
||||||
|
ForkName::Base | ForkName::Gloas => {
|
||||||
return Err(serde::de::Error::custom(format!(
|
return Err(serde::de::Error::custom(format!(
|
||||||
"LightClientUpdate failed to deserialize: unsupported fork '{}'",
|
"LightClientUpdate failed to deserialize: unsupported fork '{}'",
|
||||||
context
|
context
|
||||||
@@ -216,7 +219,6 @@ impl<'de, E: EthSpec> ContextDeserialize<'de, ForkName> for LightClientUpdate<E>
|
|||||||
ForkName::Fulu => {
|
ForkName::Fulu => {
|
||||||
Self::Fulu(Deserialize::deserialize(deserializer).map_err(convert_err)?)
|
Self::Fulu(Deserialize::deserialize(deserializer).map_err(convert_err)?)
|
||||||
}
|
}
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -371,7 +373,8 @@ impl<E: EthSpec> LightClientUpdate<E> {
|
|||||||
// To add a new fork, just append the new fork variant on the latest fork. Forks that
|
// To add a new fork, just append the new fork variant on the latest fork. Forks that
|
||||||
// have a distinct execution header will need a new LightClientUpdate variant only
|
// have a distinct execution header will need a new LightClientUpdate variant only
|
||||||
// if you need to test or support lightclient usages
|
// if you need to test or support lightclient usages
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
// TODO(gloas): implement Gloas light client
|
||||||
|
ForkName::Gloas => return Err(Error::GloasNotImplemented),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(light_client_update)
|
Ok(light_client_update)
|
||||||
@@ -386,9 +389,8 @@ impl<E: EthSpec> LightClientUpdate<E> {
|
|||||||
ForkName::Deneb => Self::Deneb(LightClientUpdateDeneb::from_ssz_bytes(bytes)?),
|
ForkName::Deneb => Self::Deneb(LightClientUpdateDeneb::from_ssz_bytes(bytes)?),
|
||||||
ForkName::Electra => Self::Electra(LightClientUpdateElectra::from_ssz_bytes(bytes)?),
|
ForkName::Electra => Self::Electra(LightClientUpdateElectra::from_ssz_bytes(bytes)?),
|
||||||
ForkName::Fulu => Self::Fulu(LightClientUpdateFulu::from_ssz_bytes(bytes)?),
|
ForkName::Fulu => Self::Fulu(LightClientUpdateFulu::from_ssz_bytes(bytes)?),
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
// TODO(gloas): implement Gloas light client
|
||||||
|
ForkName::Base | ForkName::Gloas => {
|
||||||
ForkName::Base => {
|
|
||||||
return Err(ssz::DecodeError::BytesInvalid(format!(
|
return Err(ssz::DecodeError::BytesInvalid(format!(
|
||||||
"LightClientUpdate decoding for {fork_name} not implemented"
|
"LightClientUpdate decoding for {fork_name} not implemented"
|
||||||
)));
|
)));
|
||||||
@@ -535,7 +537,8 @@ impl<E: EthSpec> LightClientUpdate<E> {
|
|||||||
ForkName::Deneb => <LightClientUpdateDeneb<E> as Encode>::ssz_fixed_len(),
|
ForkName::Deneb => <LightClientUpdateDeneb<E> as Encode>::ssz_fixed_len(),
|
||||||
ForkName::Electra => <LightClientUpdateElectra<E> as Encode>::ssz_fixed_len(),
|
ForkName::Electra => <LightClientUpdateElectra<E> as Encode>::ssz_fixed_len(),
|
||||||
ForkName::Fulu => <LightClientUpdateFulu<E> as Encode>::ssz_fixed_len(),
|
ForkName::Fulu => <LightClientUpdateFulu<E> as Encode>::ssz_fixed_len(),
|
||||||
ForkName::Gloas => todo!("Gloas light client not implemented"),
|
// TODO(gloas): implement Gloas light client
|
||||||
|
ForkName::Gloas => 0,
|
||||||
};
|
};
|
||||||
fixed_len + 2 * LightClientHeader::<E>::ssz_max_var_len_for_fork(fork_name)
|
fixed_len + 2 * LightClientHeader::<E>::ssz_max_var_len_for_fork(fork_name)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user