mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +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:
@@ -21,7 +21,7 @@ use types::{
|
||||
LightClientOptimisticUpdate, LightClientUpdate, RuntimeVariableList, SignedBeaconBlock,
|
||||
SignedBeaconBlockAltair, SignedBeaconBlockBase, SignedBeaconBlockBellatrix,
|
||||
SignedBeaconBlockCapella, SignedBeaconBlockDeneb, SignedBeaconBlockElectra,
|
||||
SignedBeaconBlockFulu,
|
||||
SignedBeaconBlockFulu, SignedBeaconBlockGloas,
|
||||
};
|
||||
use unsigned_varint::codec::Uvi;
|
||||
|
||||
@@ -830,6 +830,9 @@ fn handle_rpc_response<E: EthSpec>(
|
||||
Some(ForkName::Fulu) => Ok(Some(RpcSuccessResponse::BlocksByRange(Arc::new(
|
||||
SignedBeaconBlock::Fulu(SignedBeaconBlockFulu::from_ssz_bytes(decoded_buffer)?),
|
||||
)))),
|
||||
Some(ForkName::Gloas) => Ok(Some(RpcSuccessResponse::BlocksByRange(Arc::new(
|
||||
SignedBeaconBlock::Gloas(SignedBeaconBlockGloas::from_ssz_bytes(decoded_buffer)?),
|
||||
)))),
|
||||
None => Err(RPCError::ErrorResponse(
|
||||
RpcErrorResponse::InvalidRequest,
|
||||
format!(
|
||||
@@ -866,6 +869,9 @@ fn handle_rpc_response<E: EthSpec>(
|
||||
Some(ForkName::Fulu) => Ok(Some(RpcSuccessResponse::BlocksByRoot(Arc::new(
|
||||
SignedBeaconBlock::Fulu(SignedBeaconBlockFulu::from_ssz_bytes(decoded_buffer)?),
|
||||
)))),
|
||||
Some(ForkName::Gloas) => Ok(Some(RpcSuccessResponse::BlocksByRoot(Arc::new(
|
||||
SignedBeaconBlock::Gloas(SignedBeaconBlockGloas::from_ssz_bytes(decoded_buffer)?),
|
||||
)))),
|
||||
None => Err(RPCError::ErrorResponse(
|
||||
RpcErrorResponse::InvalidRequest,
|
||||
format!(
|
||||
@@ -919,6 +925,7 @@ mod tests {
|
||||
chain_spec.deneb_fork_epoch = Some(Epoch::new(4));
|
||||
chain_spec.electra_fork_epoch = Some(Epoch::new(5));
|
||||
chain_spec.fulu_fork_epoch = Some(Epoch::new(6));
|
||||
chain_spec.gloas_fork_epoch = Some(Epoch::new(7));
|
||||
|
||||
// check that we have all forks covered
|
||||
assert!(chain_spec.fork_epoch(ForkName::latest()).is_some());
|
||||
@@ -934,6 +941,7 @@ mod tests {
|
||||
ForkName::Deneb => spec.deneb_fork_epoch,
|
||||
ForkName::Electra => spec.electra_fork_epoch,
|
||||
ForkName::Fulu => spec.fulu_fork_epoch,
|
||||
ForkName::Gloas => spec.gloas_fork_epoch,
|
||||
};
|
||||
let current_slot = current_epoch.unwrap().start_slot(Spec::slots_per_epoch());
|
||||
ForkContext::new::<Spec>(current_slot, Hash256::zero(), spec)
|
||||
@@ -1294,7 +1302,7 @@ mod tests {
|
||||
encode_then_decode_response(
|
||||
SupportedProtocol::StatusV1,
|
||||
RpcResponse::Success(RpcSuccessResponse::Status(status_message_v2())),
|
||||
ForkName::Fulu,
|
||||
ForkName::Gloas,
|
||||
&chain_spec,
|
||||
),
|
||||
Ok(Some(RpcSuccessResponse::Status(status_message_v1())))
|
||||
|
||||
@@ -158,7 +158,7 @@ fn rpc_light_client_updates_by_range_limits_by_fork(current_fork: ForkName) -> R
|
||||
ForkName::Deneb => {
|
||||
RpcLimits::new(altair_fixed_len, *LIGHT_CLIENT_UPDATES_BY_RANGE_DENEB_MAX)
|
||||
}
|
||||
ForkName::Electra | ForkName::Fulu => {
|
||||
ForkName::Electra | ForkName::Fulu | ForkName::Gloas => {
|
||||
RpcLimits::new(altair_fixed_len, *LIGHT_CLIENT_UPDATES_BY_RANGE_ELECTRA_MAX)
|
||||
}
|
||||
}
|
||||
@@ -178,7 +178,7 @@ fn rpc_light_client_finality_update_limits_by_fork(current_fork: ForkName) -> Rp
|
||||
ForkName::Deneb => {
|
||||
RpcLimits::new(altair_fixed_len, *LIGHT_CLIENT_FINALITY_UPDATE_DENEB_MAX)
|
||||
}
|
||||
ForkName::Electra | ForkName::Fulu => {
|
||||
ForkName::Electra | ForkName::Fulu | ForkName::Gloas => {
|
||||
RpcLimits::new(altair_fixed_len, *LIGHT_CLIENT_FINALITY_UPDATE_ELECTRA_MAX)
|
||||
}
|
||||
}
|
||||
@@ -199,7 +199,7 @@ fn rpc_light_client_optimistic_update_limits_by_fork(current_fork: ForkName) ->
|
||||
ForkName::Deneb => {
|
||||
RpcLimits::new(altair_fixed_len, *LIGHT_CLIENT_OPTIMISTIC_UPDATE_DENEB_MAX)
|
||||
}
|
||||
ForkName::Electra | ForkName::Fulu => RpcLimits::new(
|
||||
ForkName::Electra | ForkName::Fulu | ForkName::Gloas => RpcLimits::new(
|
||||
altair_fixed_len,
|
||||
*LIGHT_CLIENT_OPTIMISTIC_UPDATE_ELECTRA_MAX,
|
||||
),
|
||||
@@ -216,7 +216,7 @@ fn rpc_light_client_bootstrap_limits_by_fork(current_fork: ForkName) -> RpcLimit
|
||||
}
|
||||
ForkName::Capella => RpcLimits::new(altair_fixed_len, *LIGHT_CLIENT_BOOTSTRAP_CAPELLA_MAX),
|
||||
ForkName::Deneb => RpcLimits::new(altair_fixed_len, *LIGHT_CLIENT_BOOTSTRAP_DENEB_MAX),
|
||||
ForkName::Electra | ForkName::Fulu => {
|
||||
ForkName::Electra | ForkName::Fulu | ForkName::Gloas => {
|
||||
RpcLimits::new(altair_fixed_len, *LIGHT_CLIENT_BOOTSTRAP_ELECTRA_MAX)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,9 @@ use types::{
|
||||
SignedAggregateAndProof, SignedAggregateAndProofBase, SignedAggregateAndProofElectra,
|
||||
SignedBeaconBlock, SignedBeaconBlockAltair, SignedBeaconBlockBase, SignedBeaconBlockBellatrix,
|
||||
SignedBeaconBlockCapella, SignedBeaconBlockDeneb, SignedBeaconBlockElectra,
|
||||
SignedBeaconBlockFulu, SignedBlsToExecutionChange, SignedContributionAndProof,
|
||||
SignedVoluntaryExit, SingleAttestation, SubnetId, SyncCommitteeMessage, SyncSubnetId,
|
||||
SignedBeaconBlockFulu, SignedBeaconBlockGloas, SignedBlsToExecutionChange,
|
||||
SignedContributionAndProof, SignedVoluntaryExit, SingleAttestation, SubnetId,
|
||||
SyncCommitteeMessage, SyncSubnetId,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
@@ -238,6 +239,10 @@ impl<E: EthSpec> PubsubMessage<E> {
|
||||
SignedBeaconBlockFulu::from_ssz_bytes(data)
|
||||
.map_err(|e| format!("{:?}", e))?,
|
||||
),
|
||||
Some(ForkName::Gloas) => SignedBeaconBlock::<E>::Gloas(
|
||||
SignedBeaconBlockGloas::from_ssz_bytes(data)
|
||||
.map_err(|e| format!("{:?}", e))?,
|
||||
),
|
||||
None => {
|
||||
return Err(format!(
|
||||
"Unknown gossipsub fork digest: {:?}",
|
||||
|
||||
Reference in New Issue
Block a user