Emit log when fee recipient values are inconsistent (#3202)

## Issue Addressed

#3156

## Proposed Changes

Emit a `WARN` log whenever the value of `fee_recipient` as returned from the EE is different from the value of `suggested_fee_recipient` as set on the BN, for example by the `--suggested-fee-recipient` CLI flag.

## Additional Info

I have set the log level to `WARN` since it is legal behaviour (meaning it isn't really an error but is important to know when it is occurring).

If we feel like this behaviour is almost always undesired (caused by a misconfiguration or malicious EE) then an `ERRO` log would be more appropriate. Happy to change it in that case.
This commit is contained in:
Mac L 2022-06-03 03:22:54 +00:00
parent 8e1305a3d2
commit 55ac423872

View File

@ -17,7 +17,7 @@ use payload_status::process_multiple_payload_statuses;
pub use payload_status::PayloadStatus;
use sensitive_url::SensitiveUrl;
use serde::{Deserialize, Serialize};
use slog::{crit, debug, error, info, trace, Logger};
use slog::{crit, debug, error, info, trace, warn, Logger};
use slot_clock::SlotClock;
use std::collections::HashMap;
use std::convert::TryInto;
@ -531,6 +531,23 @@ impl ExecutionLayer {
if let Some(preparation_data_entry) =
self.proposer_preparation_data().await.get(&proposer_index)
{
if let Some(suggested_fee_recipient) = self.inner.suggested_fee_recipient {
if preparation_data_entry.preparation_data.fee_recipient != suggested_fee_recipient
{
warn!(
self.log(),
"Inconsistent fee recipient";
"msg" => "The fee recipient returned from the Execution Engine differs \
from the suggested_fee_recipient set on the beacon node. This could \
indicate that fees are being diverted to another address. Please \
ensure that the value of suggested_fee_recipient is set correctly and \
that the Execution Engine is trusted.",
"proposer_index" => ?proposer_index,
"fee_recipient" => ?preparation_data_entry.preparation_data.fee_recipient,
"suggested_fee_recipient" => ?suggested_fee_recipient,
)
}
}
// The values provided via the API have first priority.
preparation_data_entry.preparation_data.fee_recipient
} else if let Some(address) = self.inner.suggested_fee_recipient {