From 72af6fb83ae0e248db584817d4dd5b76e5480c35 Mon Sep 17 00:00:00 2001 From: pahor167 <47992132+pahor167@users.noreply.github.com> Date: Wed, 10 Apr 2024 14:05:13 +0200 Subject: [PATCH] =?UTF-8?q?Skip=20calculation=20of=20boosted=5Frelay=5Fval?= =?UTF-8?q?ue=20when=20builder=5Fboost=5Ffactor=20pro=E2=80=A6=20(#5352)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Skip calculation of boosted_relay_value when builder_boost_factor provided * PR comments --- beacon_node/http_api/src/produce_block.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/beacon_node/http_api/src/produce_block.rs b/beacon_node/http_api/src/produce_block.rs index 0da3bdc7aab..ed30da7362c 100644 --- a/beacon_node/http_api/src/produce_block.rs +++ b/beacon_node/http_api/src/produce_block.rs @@ -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( })?; 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( slot, query.graffiti, randao_verification, - query.builder_boost_factor, + builder_boost_factor, BlockProductionVersion::V3, ) .await