Fix block v3 reward encodings (#5049)

* Fix block v3 reward encodings

* Use crates.io version
This commit is contained in:
Michael Sproul
2024-01-10 10:44:07 +11:00
committed by GitHub
parent 4a65d28b3b
commit 7e948eec9d
5 changed files with 13 additions and 8 deletions

View File

@@ -511,13 +511,17 @@ impl<E: EthSpec> BeaconBlockResponseWrapper<E> {
}
}
pub fn consensus_block_value(&self) -> u64 {
pub fn consensus_block_value_gwei(&self) -> u64 {
match self {
BeaconBlockResponseWrapper::Full(resp) => resp.consensus_block_value,
BeaconBlockResponseWrapper::Blinded(resp) => resp.consensus_block_value,
}
}
pub fn consensus_block_value_wei(&self) -> Uint256 {
Uint256::from(self.consensus_block_value_gwei()) * 1_000_000_000
}
pub fn is_blinded(&self) -> bool {
matches!(self, BeaconBlockResponseWrapper::Blinded(_))
}

View File

@@ -80,7 +80,7 @@ pub fn build_response_v3<T: BeaconChainTypes>(
.fork_name(&chain.spec)
.map_err(inconsistent_fork_rejection)?;
let execution_payload_value = block_response.execution_payload_value();
let consensus_block_value = block_response.consensus_block_value();
let consensus_block_value = block_response.consensus_block_value_wei();
let execution_payload_blinded = block_response.is_blinded();
let metadata = ProduceBlockV3Metadata {

View File

@@ -93,7 +93,7 @@ pub fn add_execution_payload_value_header<T: Reply>(
/// Add the `Eth-Consensus-Block-Value` header to a response.
pub fn add_consensus_block_value_header<T: Reply>(
reply: T,
consensus_payload_value: u64,
consensus_payload_value: Uint256,
) -> Response {
reply::with_header(
reply,