From fa87ff23a914eb7dd5026ef2ea0754e11507d309 Mon Sep 17 00:00:00 2001 From: Eitan Seri-Levi Date: Fri, 1 May 2026 10:31:07 +0200 Subject: [PATCH] fix payload v5 --- .../execution_layer/src/engine_api/http.rs | 51 ++++--------------- .../src/per_slot_processing.rs | 5 -- consensus/types/src/state/beacon_state.rs | 15 +++++- 3 files changed, 23 insertions(+), 48 deletions(-) diff --git a/beacon_node/execution_layer/src/engine_api/http.rs b/beacon_node/execution_layer/src/engine_api/http.rs index 379b4d1ca9..9fa4778504 100644 --- a/beacon_node/execution_layer/src/engine_api/http.rs +++ b/beacon_node/execution_layer/src/engine_api/http.rs @@ -927,47 +927,6 @@ impl HttpJsonRpc { Ok(response.into()) } - // TODO(HEZE) fix new payload if needed - pub async fn new_payload_v4_heze( - &self, - new_payload_request_heze: NewPayloadRequestHeze<'_, E>, - ) -> Result { - let il_transactions: Vec = new_payload_request_heze - .il_transactions - .into_iter() - .map(|tx| { - let bytes: Vec = 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( &self, new_payload_request_gloas: NewPayloadRequestGloas<'_, E>, @@ -1001,6 +960,15 @@ impl HttpJsonRpc { &self, new_payload_request_heze: NewPayloadRequestHeze<'_, E>, ) -> Result { + let il_transactions: Vec = new_payload_request_heze + .il_transactions + .iter() + .map(|tx| { + let bytes: Vec = 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 diff --git a/consensus/state_processing/src/per_slot_processing.rs b/consensus/state_processing/src/per_slot_processing.rs index 7933fba9c5..88c8af5d21 100644 --- a/consensus/state_processing/src/per_slot_processing.rs +++ b/consensus/state_processing/src/per_slot_processing.rs @@ -96,15 +96,10 @@ pub fn per_slot_processing( 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)?; diff --git a/consensus/types/src/state/beacon_state.rs b/consensus/types/src/state/beacon_state.rs index c7b97ab787..d31f8ed372 100644 --- a/consensus/types/src/state/beacon_state.rs +++ b/consensus/types/src/state/beacon_state.rs @@ -1021,9 +1021,20 @@ impl BeaconState { } 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 = (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::, BeaconStateError>>()?; Ok(InclusionListCommittee::::from(il_committee.try_into()?)) }