From 1fc3060feba2db1c1c857cb3f1dd2032c9a1f18e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= Date: Wed, 18 Dec 2019 13:18:29 +0000 Subject: [PATCH] grandpa: log everything under afg target (#4443) --- .../client/finality-grandpa/src/authorities.rs | 4 ++-- .../client/finality-grandpa/src/environment.rs | 10 +++++----- .../finality-grandpa/src/finality_proof.rs | 10 +++++----- substrate/client/finality-grandpa/src/import.rs | 6 +++--- .../client/finality-grandpa/src/light_import.rs | 16 ++++++++-------- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/substrate/client/finality-grandpa/src/authorities.rs b/substrate/client/finality-grandpa/src/authorities.rs index aa9b850779..2f01ce53b8 100644 --- a/substrate/client/finality-grandpa/src/authorities.rs +++ b/substrate/client/finality-grandpa/src/authorities.rs @@ -258,7 +258,7 @@ where // check if the given best block is in the same branch as the block that signaled the change. if is_descendent_of(&change.canon_hash, &best_hash)? { // apply this change: make the set canonical - info!(target: "finality", "Applying authority set change forced at block #{:?}", + info!(target: "afg", "Applying authority set change forced at block #{:?}", change.canon_height); telemetry!(CONSENSUS_INFO; "afg.applying_forced_authority_set_change"; "block" => ?change.canon_height @@ -324,7 +324,7 @@ where self.pending_forced_changes.clear(); if let Some(change) = change { - info!(target: "finality", "Applying authority set change scheduled at block #{:?}", + info!(target: "afg", "Applying authority set change scheduled at block #{:?}", change.canon_height); telemetry!(CONSENSUS_INFO; "afg.applying_scheduled_authority_set_change"; "block" => ?change.canon_height diff --git a/substrate/client/finality-grandpa/src/environment.rs b/substrate/client/finality-grandpa/src/environment.rs index 77153554c9..efc8052ab8 100644 --- a/substrate/client/finality-grandpa/src/environment.rs +++ b/substrate/client/finality-grandpa/src/environment.rs @@ -1010,8 +1010,8 @@ pub(crate) fn finalize_block, E, RA>( ); if let Err(e) = write_result { - warn!(target: "finality", "Failed to write updated consensus changes to disk. Bailing."); - warn!(target: "finality", "Node is in a potentially inconsistent state."); + warn!(target: "afg", "Failed to write updated consensus changes to disk. Bailing."); + warn!(target: "afg", "Node is in a potentially inconsistent state."); return Err(e.into()); } @@ -1063,7 +1063,7 @@ pub(crate) fn finalize_block, E, RA>( // ideally some handle to a synchronization oracle would be used // to avoid unconditionally notifying. client.apply_finality(import_op, BlockId::Hash(hash), justification, true).map_err(|e| { - warn!(target: "finality", "Error applying finality to block {:?}: {:?}", (hash, number), e); + warn!(target: "afg", "Error applying finality to block {:?}: {:?}", (hash, number), e); e })?; telemetry!(CONSENSUS_INFO; "afg.finalized_blocks_up_to"; @@ -1103,8 +1103,8 @@ pub(crate) fn finalize_block, E, RA>( ); if let Err(e) = write_result { - warn!(target: "finality", "Failed to write updated authority set to disk. Bailing."); - warn!(target: "finality", "Node is in a potentially inconsistent state."); + warn!(target: "afg", "Failed to write updated authority set to disk. Bailing."); + warn!(target: "afg", "Node is in a potentially inconsistent state."); return Err(e.into()); } diff --git a/substrate/client/finality-grandpa/src/finality_proof.rs b/substrate/client/finality-grandpa/src/finality_proof.rs index 1e17845471..69d4c77e5f 100644 --- a/substrate/client/finality-grandpa/src/finality_proof.rs +++ b/substrate/client/finality-grandpa/src/finality_proof.rs @@ -167,7 +167,7 @@ impl sc_network::FinalityProofProvider for FinalityProofProvide ) -> Result>, ClientError> { let request: FinalityProofRequest = Decode::decode(&mut &request[..]) .map_err(|e| { - warn!(target: "finality", "Unable to decode finality proof request: {}", e.what()); + warn!(target: "afg", "Unable to decode finality proof request: {}", e.what()); ClientError::Backend(format!("Invalid finality proof request")) })?; match request { @@ -269,7 +269,7 @@ pub(crate) fn prove_finality, B: BlockchainBackend, B: BlockchainBackend, B: BlockchainBackend, B: BlockchainBackend, RA, SC> BlockImport Some(justification) => { self.import_justification(hash, number, justification, needs_justification).unwrap_or_else(|err| { if needs_justification || enacts_consensus_change { - debug!(target: "finality", "Imported block #{} that enacts authority set change with \ + debug!(target: "afg", "Imported block #{} that enacts authority set change with \ invalid justification: {:?}, requesting justification from peers.", number, err); imported_aux.bad_justification = true; imported_aux.needs_justification = true; @@ -482,7 +482,7 @@ impl, RA, SC> BlockImport None => { if needs_justification { trace!( - target: "finality", + target: "afg", "Imported unjustified block #{} that enacts authority set change, waiting for finality for enactment.", number, ); @@ -573,7 +573,7 @@ where match result { Err(CommandOrError::VoterCommand(command)) => { - info!(target: "finality", "Imported justification for block #{} that triggers \ + info!(target: "afg", "Imported justification for block #{} that triggers \ command {}, signaling voter.", number, command); // send the command to the voter diff --git a/substrate/client/finality-grandpa/src/light_import.rs b/substrate/client/finality-grandpa/src/light_import.rs index 8907ac8226..fe05f6dc46 100644 --- a/substrate/client/finality-grandpa/src/light_import.rs +++ b/substrate/client/finality-grandpa/src/light_import.rs @@ -263,7 +263,7 @@ fn do_import_block, J>( match justification { Some(justification) => { trace!( - target: "finality", + target: "afg", "Imported block {}{}. Importing justification.", if enacts_consensus_change { " which enacts consensus changes" } else { "" }, hash, @@ -273,7 +273,7 @@ fn do_import_block, J>( }, None if enacts_consensus_change => { trace!( - target: "finality", + target: "afg", "Imported block {} which enacts consensus changes. Requesting finality proof.", hash, ); @@ -393,7 +393,7 @@ fn do_import_justification, J>( let justification = match justification { Err(ClientError::BadJustification(_)) => { trace!( - target: "finality", + target: "afg", "Justification for {} is not valid within current authorities set. Requesting finality proof.", hash, ); @@ -404,7 +404,7 @@ fn do_import_justification, J>( }, Err(e) => { trace!( - target: "finality", + target: "afg", "Justification for {} is not valid. Bailing.", hash, ); @@ -413,7 +413,7 @@ fn do_import_justification, J>( }, Ok(justification) => { trace!( - target: "finality", + target: "afg", "Justification for {} is valid. Finalizing the block.", hash, ); @@ -444,7 +444,7 @@ fn do_finalize_block>( { // finalize the block client.finalize_block(BlockId::Hash(hash), Some(justification), true).map_err(|e| { - warn!(target: "finality", "Error applying finality to block {:?}: {:?}", (hash, number), e); + warn!(target: "afg", "Error applying finality to block {:?}: {:?}", (hash, number), e); ConsensusError::ClientImport(e.to_string()) })?; @@ -532,8 +532,8 @@ fn require_insert_aux( /// Display inconsistency warning. fn on_post_finalization_error(error: ClientError, value_type: &str) -> ConsensusError { - warn!(target: "finality", "Failed to write updated {} to disk. Bailing.", value_type); - warn!(target: "finality", "Node is in a potentially inconsistent state."); + warn!(target: "afg", "Failed to write updated {} to disk. Bailing.", value_type); + warn!(target: "afg", "Node is in a potentially inconsistent state."); ConsensusError::ClientImport(error.to_string()) }