mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
pallet-beefy-mmr: better logging on BEEFY key to ETH address conversion (#1520)
# Description Each time the validator set changes, BEEFY validator keys are converted to ETH addresses and merkelised into a `keyset_commitment` to be used by light clients. This commit downgrades `error` to `debug` when individual conversions from BEEFY keys to ETH addresses fail, and adds cumulative check that reports total number of failed conversions, if any, on `error` log-level. Fixes https://github.com/paritytech/polkadot-sdk/issues/1305 Signed-off-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
@@ -79,7 +79,7 @@ impl Convert<sp_consensus_beefy::ecdsa_crypto::AuthorityId, Vec<u8>> for BeefyEc
|
||||
.to_eth_address()
|
||||
.map(|v| v.to_vec())
|
||||
.map_err(|_| {
|
||||
log::error!(target: "runtime::beefy", "Failed to convert BEEFY PublicKey to ETH address!");
|
||||
log::debug!(target: "runtime::beefy", "Failed to convert BEEFY PublicKey to ETH address!");
|
||||
})
|
||||
.unwrap_or_default()
|
||||
}
|
||||
@@ -199,7 +199,20 @@ impl<T: Config> Pallet<T> {
|
||||
.cloned()
|
||||
.map(T::BeefyAuthorityToMerkleLeaf::convert)
|
||||
.collect::<Vec<_>>();
|
||||
let default_eth_addr = [0u8; 20];
|
||||
let len = beefy_addresses.len() as u32;
|
||||
let uninitialized_addresses = beefy_addresses
|
||||
.iter()
|
||||
.filter(|&addr| addr.as_slice().eq(&default_eth_addr))
|
||||
.count();
|
||||
if uninitialized_addresses > 0 {
|
||||
log::error!(
|
||||
target: "runtime::beefy",
|
||||
"Failed to convert {} out of {} BEEFY PublicKeys to ETH addresses!",
|
||||
uninitialized_addresses,
|
||||
len,
|
||||
);
|
||||
}
|
||||
let keyset_commitment = binary_merkle_tree::merkle_root::<
|
||||
<T as pallet_mmr::Config>::Hashing,
|
||||
_,
|
||||
|
||||
Reference in New Issue
Block a user