mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 04:37:13 +00:00
fix payload v5
This commit is contained in:
@@ -927,47 +927,6 @@ impl HttpJsonRpc {
|
|||||||
Ok(response.into())
|
Ok(response.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(HEZE) fix new payload if needed
|
|
||||||
pub async fn new_payload_v4_heze<E: EthSpec>(
|
|
||||||
&self,
|
|
||||||
new_payload_request_heze: NewPayloadRequestHeze<'_, E>,
|
|
||||||
) -> Result<PayloadStatusV1, Error> {
|
|
||||||
let il_transactions: Vec<String> = new_payload_request_heze
|
|
||||||
.il_transactions
|
|
||||||
.into_iter()
|
|
||||||
.map(|tx| {
|
|
||||||
let bytes: Vec<u8> = tx.into();
|
|
||||||
format!("0x{}", hex::encode(bytes))
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
let params = json!([
|
|
||||||
JsonExecutionPayload::Heze(
|
|
||||||
new_payload_request_heze
|
|
||||||
.execution_payload
|
|
||||||
.clone()
|
|
||||||
.try_into()?
|
|
||||||
),
|
|
||||||
new_payload_request_heze.versioned_hashes,
|
|
||||||
new_payload_request_heze.parent_beacon_block_root,
|
|
||||||
new_payload_request_heze
|
|
||||||
.execution_requests
|
|
||||||
.get_execution_requests_list(),
|
|
||||||
il_transactions
|
|
||||||
]);
|
|
||||||
|
|
||||||
// TODO(heze) should be v5 i think
|
|
||||||
let response: JsonPayloadStatusV1 = self
|
|
||||||
.rpc_request(
|
|
||||||
ENGINE_NEW_PAYLOAD_V4,
|
|
||||||
params,
|
|
||||||
ENGINE_NEW_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
Ok(response.into())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn new_payload_v5_gloas<E: EthSpec>(
|
pub async fn new_payload_v5_gloas<E: EthSpec>(
|
||||||
&self,
|
&self,
|
||||||
new_payload_request_gloas: NewPayloadRequestGloas<'_, E>,
|
new_payload_request_gloas: NewPayloadRequestGloas<'_, E>,
|
||||||
@@ -1001,6 +960,15 @@ impl HttpJsonRpc {
|
|||||||
&self,
|
&self,
|
||||||
new_payload_request_heze: NewPayloadRequestHeze<'_, E>,
|
new_payload_request_heze: NewPayloadRequestHeze<'_, E>,
|
||||||
) -> Result<PayloadStatusV1, Error> {
|
) -> Result<PayloadStatusV1, Error> {
|
||||||
|
let il_transactions: Vec<String> = new_payload_request_heze
|
||||||
|
.il_transactions
|
||||||
|
.iter()
|
||||||
|
.map(|tx| {
|
||||||
|
let bytes: Vec<u8> = tx.clone().into();
|
||||||
|
format!("0x{}", hex::encode(bytes))
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
let params = json!([
|
let params = json!([
|
||||||
JsonExecutionPayload::Heze(
|
JsonExecutionPayload::Heze(
|
||||||
new_payload_request_heze
|
new_payload_request_heze
|
||||||
@@ -1013,6 +981,7 @@ impl HttpJsonRpc {
|
|||||||
new_payload_request_heze
|
new_payload_request_heze
|
||||||
.execution_requests
|
.execution_requests
|
||||||
.get_execution_requests_list(),
|
.get_execution_requests_list(),
|
||||||
|
il_transactions
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let response: JsonPayloadStatusV1 = self
|
let response: JsonPayloadStatusV1 = self
|
||||||
|
|||||||
@@ -96,15 +96,10 @@ pub fn per_slot_processing<E: EthSpec>(
|
|||||||
if spec.fulu_fork_epoch == Some(state.current_epoch()) {
|
if spec.fulu_fork_epoch == Some(state.current_epoch()) {
|
||||||
upgrade_to_fulu(state, spec)?;
|
upgrade_to_fulu(state, spec)?;
|
||||||
}
|
}
|
||||||
// Heze.
|
|
||||||
if spec.heze_fork_epoch == Some(state.current_epoch()) {
|
|
||||||
upgrade_to_heze(state, spec)?;
|
|
||||||
}
|
|
||||||
// Gloas.
|
// Gloas.
|
||||||
if spec.gloas_fork_epoch == Some(state.current_epoch()) {
|
if spec.gloas_fork_epoch == Some(state.current_epoch()) {
|
||||||
upgrade_to_gloas(state, spec)?;
|
upgrade_to_gloas(state, spec)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Heze.
|
// Heze.
|
||||||
if spec.heze_fork_epoch == Some(state.current_epoch()) {
|
if spec.heze_fork_epoch == Some(state.current_epoch()) {
|
||||||
upgrade_to_heze(state, spec)?;
|
upgrade_to_heze(state, spec)?;
|
||||||
|
|||||||
@@ -1021,9 +1021,20 @@ impl<E: EthSpec> BeaconState<E> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let committee_size = E::InclusionListCommitteeSize::to_usize();
|
let committee_size = E::InclusionListCommitteeSize::to_usize();
|
||||||
|
let num_indices = indices.len();
|
||||||
|
// num_indices > 0 is guaranteed by the is_empty() check above
|
||||||
let il_committee: Vec<u64> = (0..committee_size)
|
let il_committee: Vec<u64> = (0..committee_size)
|
||||||
.map(|i| indices[i % indices.len()] as u64)
|
.map(|i| {
|
||||||
.collect();
|
let idx = i
|
||||||
|
.safe_rem(num_indices)
|
||||||
|
.map_err(|_| BeaconStateError::InsufficientValidators)?;
|
||||||
|
indices
|
||||||
|
.get(idx)
|
||||||
|
.copied()
|
||||||
|
.map(|v| v as u64)
|
||||||
|
.ok_or(BeaconStateError::InsufficientValidators)
|
||||||
|
})
|
||||||
|
.collect::<Result<Vec<u64>, BeaconStateError>>()?;
|
||||||
|
|
||||||
Ok(InclusionListCommittee::<E>::from(il_committee.try_into()?))
|
Ok(InclusionListCommittee::<E>::from(il_committee.try_into()?))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user