Skip to content

Commit 15f4013

Browse files
committed
PR comments
1 parent 6c1638a commit 15f4013

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

beacon_node/execution_layer/src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ const EXECUTION_BLOCKS_LRU_CACHE_SIZE: NonZeroUsize = new_non_zero_usize(128);
8484
const DEFAULT_SUGGESTED_FEE_RECIPIENT: [u8; 20] =
8585
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1];
8686

87-
/// If default boost factor is provided in validator/blocks v3 request, we will skip the calculation
88-
/// to keep the precision.
89-
const DEFAULT_BOOST_FACTOR: u64 = 100;
90-
9187
/// A payload alongside some information about where it came from.
9288
pub enum ProvenancedPayload<P> {
9389
/// A good old fashioned farm-to-table payload from your local EE.
@@ -1115,10 +1111,10 @@ impl<T: EthSpec> ExecutionLayer<T> {
11151111
let relay_value = *relay.data.message.value();
11161112

11171113
let boosted_relay_value = match builder_boost_factor {
1118-
Some(builder_boost_factor) if (builder_boost_factor != DEFAULT_BOOST_FACTOR) => {
1114+
Some(builder_boost_factor) => {
11191115
(relay_value / 100).saturating_mul(builder_boost_factor.into())
11201116
}
1121-
_ => relay_value,
1117+
None => relay_value,
11221118
};
11231119

11241120
let local_value = *local.block_value();

beacon_node/http_api/src/produce_block.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ use warp::{
2020
Reply,
2121
};
2222

23+
/// If default boost factor is provided in validator/blocks v3 request, we will skip the calculation
24+
/// to keep the precision.
25+
const DEFAULT_BOOST_FACTOR: u64 = 100;
26+
2327
pub fn get_randao_verification(
2428
query: &api_types::ValidatorBlocksQuery,
2529
randao_reveal_infinity: bool,
@@ -52,14 +56,19 @@ pub async fn produce_block_v3<T: BeaconChainTypes>(
5256
})?;
5357

5458
let randao_verification = get_randao_verification(&query, randao_reveal.is_infinity())?;
59+
let builder_boost_factor = if query.builder_boost_factor == Some(DEFAULT_BOOST_FACTOR) {
60+
None
61+
} else {
62+
query.builder_boost_factor
63+
};
5564

5665
let block_response_type = chain
5766
.produce_block_with_verification(
5867
randao_reveal,
5968
slot,
6069
query.graffiti,
6170
randao_verification,
62-
query.builder_boost_factor,
71+
builder_boost_factor,
6372
BlockProductionVersion::V3,
6473
)
6574
.await

0 commit comments

Comments
 (0)