From 3859c9bca59743123866edf5c48c0293fc657905 Mon Sep 17 00:00:00 2001 From: chonghe <44791194+chong-he@users.noreply.github.com> Date: Thu, 18 Jul 2024 16:54:05 +0800 Subject: [PATCH] Add requires `suggested-fee-recipient` flag when `always-prepare-payload` is set (#6079) * Add requires * Try to fix test * Add suggested fee recipient * Fix * Add execution-endpoint * Add execution-jwt * Revise execution-jwt * Add execution-jwt-secret-key * Define dir in execution-jwt --- beacon_node/src/cli.rs | 1 + book/src/api-bn.md | 2 +- lighthouse/tests/beacon_node.rs | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/beacon_node/src/cli.rs b/beacon_node/src/cli.rs index c32c5e7ec6..ebb6e2c3c6 100644 --- a/beacon_node/src/cli.rs +++ b/beacon_node/src/cli.rs @@ -1338,6 +1338,7 @@ pub fn cli_app() -> Command { .action(ArgAction::SetTrue) .help_heading(FLAG_HEADER) .display_order(0) + .requires("suggested-fee-recipient") ) .arg( Arg::new("fork-choice-before-proposal-timeout") diff --git a/book/src/api-bn.md b/book/src/api-bn.md index e7c900e84d..40251cad28 100644 --- a/book/src/api-bn.md +++ b/book/src/api-bn.md @@ -128,7 +128,7 @@ You can replace `1` in the above command with the validator index that you would ### Events API -The [events API](https://ethereum.github.io/beacon-APIs/#/Events/eventstream) provides information such as the payload attributes that are of interest to block builders and relays. To query the payload attributes, it is necessary to run Lighthouse beacon node with the flag `--always-prepare-payload`. It is also recommended to add the flag `--prepare-payload-lookahead 8000` which configures the payload attributes to be sent at 4s into each slot (or 8s from the start of the next slot). An example of the command is: +The [events API](https://ethereum.github.io/beacon-APIs/#/Events/eventstream) provides information such as the payload attributes that are of interest to block builders and relays. To query the payload attributes, it is necessary to run Lighthouse beacon node with the flag `--always-prepare-payload`. With the flag `--always-prepare-payload`, it is mandatory to also have the flag `--suggested-fee-recipient` set on the beacon node. You could pass a dummy fee recipient and have it override with the intended fee recipient of the proposer during the actual block proposal. It is also recommended to add the flag `--prepare-payload-lookahead 8000` which configures the payload attributes to be sent at 4s into each slot (or 8s from the start of the next slot). An example of the command is: ```bash curl -X 'GET' \ diff --git a/lighthouse/tests/beacon_node.rs b/lighthouse/tests/beacon_node.rs index cd499f2ada..2101a48f14 100644 --- a/lighthouse/tests/beacon_node.rs +++ b/lighthouse/tests/beacon_node.rs @@ -267,8 +267,18 @@ fn always_prepare_payload_default() { #[test] fn always_prepare_payload_override() { + let dir = TempDir::new().expect("Unable to create temporary directory"); CommandLineTest::new() .flag("always-prepare-payload", None) + .flag( + "suggested-fee-recipient", + Some("0x00000000219ab540356cbb839cbe05303d7705fa"), + ) + .flag("execution-endpoint", Some("http://localhost:8551/")) + .flag( + "execution-jwt", + dir.path().join("jwt-file").as_os_str().to_str(), + ) .run_with_zero_port() .with_config(|config| assert!(config.chain.always_prepare_payload)); }