Skip calculation of boosted_relay_value when builder_boost_factor pro… (#5352)

* Skip calculation of boosted_relay_value when builder_boost_factor provided

* PR comments
This commit is contained in:
pahor167
2024-04-10 14:05:13 +02:00
committed by GitHub
parent ced653873e
commit 72af6fb83a

View File

@@ -20,6 +20,10 @@ use warp::{
Reply,
};
/// If default boost factor is provided in validator/blocks v3 request, we will skip the calculation
/// to keep the precision.
const DEFAULT_BOOST_FACTOR: u64 = 100;
pub fn get_randao_verification(
query: &api_types::ValidatorBlocksQuery,
randao_reveal_infinity: bool,
@@ -52,6 +56,11 @@ pub async fn produce_block_v3<T: BeaconChainTypes>(
})?;
let randao_verification = get_randao_verification(&query, randao_reveal.is_infinity())?;
let builder_boost_factor = if query.builder_boost_factor == Some(DEFAULT_BOOST_FACTOR) {
None
} else {
query.builder_boost_factor
};
let block_response_type = chain
.produce_block_with_verification(
@@ -59,7 +68,7 @@ pub async fn produce_block_v3<T: BeaconChainTypes>(
slot,
query.graffiti,
randao_verification,
query.builder_boost_factor,
builder_boost_factor,
BlockProductionVersion::V3,
)
.await