From c5785887a97e5f61d83f2bbe1f5ff8886dad4adb Mon Sep 17 00:00:00 2001 From: Pawan Dhananjay Date: Tue, 30 Aug 2022 05:47:32 +0000 Subject: [PATCH] Log fee recipients in VC (#3526) ## Issue Addressed Resolves #3524 ## Proposed Changes Log fee recipient in the `Validator exists in beacon chain` log. Logging in the BN already happens here https://github.com/sigp/lighthouse/blob/18c61a5e8be3e54226a86a69b96f8f4f7fd790e4/beacon_node/beacon_chain/src/beacon_chain.rs#L3858-L3865 I also think it's good practice to encourage users to set the fee recipient in the VC rather than the BN because of issues mentioned here https://github.com/sigp/lighthouse/issues/3432 Some example logs from prater: ``` Aug 30 03:47:09.922 INFO Validator exists in beacon chain fee_recipient: 0xab97_ad88, validator_index: 213615, pubkey: 0xb542b69ba14ddbaf717ca1762ece63a4804c08d38a1aadf156ae718d1545942e86763a1604f5065d4faa550b7259d651, service: duties Aug 30 03:48:05.505 INFO Validator exists in beacon chain fee_recipient: Fee recipient for validator not set in validator_definitions.yml or provided with the `--suggested-fee-recipient flag`, validator_index: 210710, pubkey: 0xad5d67cc7f990590c7b3fa41d593c4cf12d9ead894be2311fbb3e5c733d8c1b909e9d47af60ea3480fb6b37946c35390, service: duties ``` Co-authored-by: Paul Hauner --- validator_client/src/duties_service.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/validator_client/src/duties_service.rs b/validator_client/src/duties_service.rs index 3e15b39ab6..60b617e6c8 100644 --- a/validator_client/src/duties_service.rs +++ b/validator_client/src/duties_service.rs @@ -400,13 +400,23 @@ async fn poll_validator_indices( ) .await; + let fee_recipient = duties_service + .validator_store + .get_fee_recipient(&pubkey) + .map(|fr| fr.to_string()) + .unwrap_or_else(|| { + "Fee recipient for validator not set in validator_definitions.yml \ + or provided with the `--suggested-fee-recipient` flag" + .to_string() + }); match download_result { Ok(Some(response)) => { info!( log, "Validator exists in beacon chain"; "pubkey" => ?pubkey, - "validator_index" => response.data.index + "validator_index" => response.data.index, + "fee_recipient" => fee_recipient ); duties_service .validator_store @@ -420,7 +430,8 @@ async fn poll_validator_indices( debug!( log, "Validator without index"; - "pubkey" => ?pubkey + "pubkey" => ?pubkey, + "fee_recipient" => fee_recipient ) } // Don't exit early on an error, keep attempting to resolve other indices. @@ -430,6 +441,7 @@ async fn poll_validator_indices( "Failed to resolve pubkey to index"; "error" => %e, "pubkey" => ?pubkey, + "fee_recipient" => fee_recipient ) } }