From d5cb547a001b7119bb1af103934220e748b99426 Mon Sep 17 00:00:00 2001 From: Eitan Seri-Levi Date: Wed, 6 Sep 2023 08:53:19 +0300 Subject: [PATCH] block value fix --- beacon_node/beacon_chain/src/beacon_chain.rs | 11 ++++++----- beacon_node/http_api/src/validator.rs | 2 +- beacon_node/http_api/src/version.rs | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index c7c84b976bc..499e9dd1331 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -435,7 +435,8 @@ pub enum BeaconBlockAndStateResponse { Blinded(BeaconBlockAndStateAndValue>), } -pub type BeaconBlockAndStateAndValue = (BeaconBlock, BeaconState, u32); +pub type BeaconBlockAndStateAndValue = + (BeaconBlock, BeaconState, Uint256); impl FinalizationAndCanonicity { pub fn is_finalized(self) -> bool { @@ -4623,7 +4624,7 @@ impl BeaconChain { _phantom: PhantomData, }, }), - 0, + Uint256::zero(), ), BeaconState::Altair(_) => ( BeaconBlock::Altair(BeaconBlockAltair { @@ -4645,12 +4646,12 @@ impl BeaconChain { _phantom: PhantomData, }, }), - 0, + Uint256::zero(), ), BeaconState::Merge(_) => { let block_proposal_contents = block_contents.ok_or(BlockProductionError::MissingExecutionPayload)?; - let block_value = block_proposal_contents.block_value().as_u32(); + let block_value = block_proposal_contents.block_value().to_owned(); ( BeaconBlock::Merge(BeaconBlockMerge { @@ -4681,7 +4682,7 @@ impl BeaconChain { BeaconState::Capella(_) => { let block_proposal_contents = block_contents.ok_or(BlockProductionError::MissingExecutionPayload)?; - let block_value = block_proposal_contents.block_value().as_u32(); + let block_value = block_proposal_contents.block_value().to_owned(); ( BeaconBlock::Capella(BeaconBlockCapella { diff --git a/beacon_node/http_api/src/validator.rs b/beacon_node/http_api/src/validator.rs index e0a0623f885..dfa759d08a0 100644 --- a/beacon_node/http_api/src/validator.rs +++ b/beacon_node/http_api/src/validator.rs @@ -269,7 +269,7 @@ pub fn generate_json_response_v3< chain: Arc>, block: BeaconBlock, endpoint_version: EndpointVersion, - block_value: u32, + block_value: Uint256, blinded_payload_flag: bool, ) -> Result, warp::Rejection> { let fork_name = block diff --git a/beacon_node/http_api/src/version.rs b/beacon_node/http_api/src/version.rs index da83a2c14ef..f72bf8af31e 100644 --- a/beacon_node/http_api/src/version.rs +++ b/beacon_node/http_api/src/version.rs @@ -4,7 +4,7 @@ use eth2::{ CONSENSUS_VERSION_HEADER, EXECUTION_PAYLOAD_BLINDED_HEADER, EXECUTION_PAYLOAD_VALUE_HEADER, }; use serde::Serialize; -use types::{ForkName, ForkVersionedResponse, InconsistentFork}; +use types::{ForkName, ForkVersionedResponse, InconsistentFork, Uint256}; use warp::reply::{self, Reply, Response}; pub const V1: EndpointVersion = EndpointVersion(1); @@ -72,7 +72,7 @@ pub fn add_execution_payload_blinded_header( /// Add the `Eth-Execution-Payload-Value` header to a response. pub fn add_execution_payload_value_header( reply: T, - execution_payload_value: u32, + execution_payload_value: Uint256, ) -> Response { reply::with_header( reply,