grandpa: remove deprecated afg log target (#13064)

* grandpa: remove deprecated afg log target

* grandpa: define log targets in primitives
This commit is contained in:
André Silva
2023-01-05 12:33:08 +00:00
committed by GitHub
parent f2dcd9520c
commit 44768ae56a
5 changed files with 17 additions and 16 deletions
@@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
grandpa = { package = "finality-grandpa", version = "0.16.0", default-features = false, features = ["derive-codec"] }
log = { version = "0.4.17", optional = true }
log = { version = "0.4.17", default-features = false }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
serde = { version = "1.0.136", features = ["derive"], optional = true }
sp-api = { version = "4.0.0-dev", default-features = false, path = "../api" }
@@ -31,7 +31,7 @@ default = ["std"]
std = [
"codec/std",
"grandpa/std",
"log",
"log/std",
"scale-info/std",
"serde",
"sp-api/std",
@@ -35,8 +35,10 @@ use sp_runtime::{
};
use sp_std::{borrow::Cow, vec::Vec};
#[cfg(feature = "std")]
use log::debug;
/// The log target to be used by client code.
pub const CLIENT_LOG_TARGET: &str = "grandpa";
/// The log target to be used by runtime code.
pub const RUNTIME_LOG_TARGET: &str = "runtime::grandpa";
/// Key type for GRANDPA module.
pub const KEY_TYPE: sp_core::crypto::KeyTypeId = sp_application_crypto::key_types::GRANDPA;
@@ -428,8 +430,9 @@ where
let valid = id.verify(&buf, signature);
if !valid {
#[cfg(feature = "std")]
debug!(target: "afg", "Bad signature on message from {:?}", id);
let log_target = if cfg!(feature = "std") { CLIENT_LOG_TARGET } else { RUNTIME_LOG_TARGET };
log::debug!(target: log_target, "Bad signature on message from {:?}", id);
}
valid