fix payload v5

This commit is contained in:
Eitan Seri-Levi
2026-05-01 10:31:07 +02:00
parent 313e2d946c
commit fa87ff23a9
3 changed files with 23 additions and 48 deletions

View File

@@ -927,47 +927,6 @@ impl HttpJsonRpc {
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>(
&self,
new_payload_request_gloas: NewPayloadRequestGloas<'_, E>,
@@ -1001,6 +960,15 @@ impl HttpJsonRpc {
&self,
new_payload_request_heze: NewPayloadRequestHeze<'_, E>,
) -> 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!([
JsonExecutionPayload::Heze(
new_payload_request_heze
@@ -1013,6 +981,7 @@ impl HttpJsonRpc {
new_payload_request_heze
.execution_requests
.get_execution_requests_list(),
il_transactions
]);
let response: JsonPayloadStatusV1 = self

View File

@@ -96,15 +96,10 @@ pub fn per_slot_processing<E: EthSpec>(
if spec.fulu_fork_epoch == Some(state.current_epoch()) {
upgrade_to_fulu(state, spec)?;
}
// Heze.
if spec.heze_fork_epoch == Some(state.current_epoch()) {
upgrade_to_heze(state, spec)?;
}
// Gloas.
if spec.gloas_fork_epoch == Some(state.current_epoch()) {
upgrade_to_gloas(state, spec)?;
}
// Heze.
if spec.heze_fork_epoch == Some(state.current_epoch()) {
upgrade_to_heze(state, spec)?;

View File

@@ -1021,9 +1021,20 @@ impl<E: EthSpec> BeaconState<E> {
}
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)
.map(|i| indices[i % indices.len()] as u64)
.collect();
.map(|i| {
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()?))
}