Skip to content

Commit

Permalink
block value fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eserilev committed Sep 6, 2023
1 parent a59a966 commit d5cb547
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ pub enum BeaconBlockAndStateResponse<T: EthSpec> {
Blinded(BeaconBlockAndStateAndValue<T, BlindedPayload<T>>),
}

pub type BeaconBlockAndStateAndValue<T, Payload> = (BeaconBlock<T, Payload>, BeaconState<T>, u32);
pub type BeaconBlockAndStateAndValue<T, Payload> =
(BeaconBlock<T, Payload>, BeaconState<T>, Uint256);

impl FinalizationAndCanonicity {
pub fn is_finalized(self) -> bool {
Expand Down Expand Up @@ -4623,7 +4624,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
_phantom: PhantomData,
},
}),
0,
Uint256::zero(),
),
BeaconState::Altair(_) => (
BeaconBlock::Altair(BeaconBlockAltair {
Expand All @@ -4645,12 +4646,12 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
_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 {
Expand Down Expand Up @@ -4681,7 +4682,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
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 {
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/http_api/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ pub fn generate_json_response_v3<
chain: Arc<BeaconChain<T>>,
block: BeaconBlock<E, Payload>,
endpoint_version: EndpointVersion,
block_value: u32,
block_value: Uint256,
blinded_payload_flag: bool,
) -> Result<Response<Body>, warp::Rejection> {
let fork_name = block
Expand Down
4 changes: 2 additions & 2 deletions beacon_node/http_api/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -72,7 +72,7 @@ pub fn add_execution_payload_blinded_header<T: Reply>(
/// Add the `Eth-Execution-Payload-Value` header to a response.
pub fn add_execution_payload_value_header<T: Reply>(
reply: T,
execution_payload_value: u32,
execution_payload_value: Uint256,
) -> Response {
reply::with_header(
reply,
Expand Down

0 comments on commit d5cb547

Please sign in to comment.