sigp / lighthouse

Ethereum consensus client in Rust
https://lighthouse.sigmaprime.io/
Apache License 2.0
2.88k stars 724 forks source link

--prefer-builder-proposals seems not working in local env #6418

Open cwhcheng opened 2 hours ago

cwhcheng commented 2 hours ago

Description

As mentioned in the doc, using --prefer-builder-proposals flag should force validator client to always prefer blinded blocks, regardless of the payload value. I am using https://github.com/flashbots/builder-playground to create a local env and I add --prefer-builder-proposals flag below line 408 of https://github.com/flashbots/builder-playground/blob/main/main.go

A rbuilder is also running with a private mempool to build blocks. I try to put transactions with 0 priority fee in the private mempool. The validator always chooses its local block instead of the rbuilder block but it should always choose rbuilder block with --prefer-builder-proposals flag

Thanks in advance!

Version

v5.2.1

alisonsmy commented 2 hours ago

Hi, I saw code comment said

If `prefer_builder_proposals` is true, set boost factor to `u64::MAX` to indicate a preference for builder payloads.

This would enhance the builder_boost_factor and ensure it consistently opts for the relay payload over the local one. However, the team set the builder_boost_factor to None before calling determine_and_fetch_payload when the block production version is BlindedV2. (beacon_node/execution_layer/src/lib.rs:840)

BlockProductionVersion::BlindedV2 => {
    let _timer = metrics::start_timer_vec(
        &metrics::EXECUTION_LAYER_REQUEST_TIMES,
        &[metrics::GET_BLINDED_PAYLOAD],
    );
    self.determine_and_fetch_payload(
        parent_hash,
        payload_attributes,
        forkchoice_update_params,
        builder_params,
        current_fork,
        None, // this is builder_boost_factor
        spec,
    )
    .await?
}
michaelsproul commented 1 hour ago

You need to use the blockv3 API in order for the builder flags to work. Lighthouse v5.3.0 uses v3 by default.

michaelsproul commented 1 hour ago

In prior versions you need --produce-block-v3 as a flag on the VC.