add para_id to fetch_pov logging (#6084)

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
This commit is contained in:
Andrei Sandu
2022-09-30 11:56:45 +03:00
committed by GitHub
parent 260f70e39e
commit 372e6a95f3
4 changed files with 28 additions and 6 deletions
+11 -2
View File
@@ -621,6 +621,7 @@ async fn request_pov(
sender: &mut impl overseer::CandidateBackingSenderTrait,
relay_parent: Hash,
from_validator: ValidatorIndex,
para_id: ParaId,
candidate_hash: CandidateHash,
pov_hash: Hash,
) -> Result<Arc<PoV>, Error> {
@@ -629,6 +630,7 @@ async fn request_pov(
.send_message(AvailabilityDistributionMessage::FetchPoV {
relay_parent,
from_validator,
para_id,
candidate_hash,
pov_hash,
tx,
@@ -697,8 +699,15 @@ async fn validate_and_make_available(
PoVData::Ready(pov) => pov,
PoVData::FetchFromValidator { from_validator, candidate_hash, pov_hash } => {
let _span = span.as_ref().map(|s| s.child("request-pov"));
match request_pov(&mut sender, relay_parent, from_validator, candidate_hash, pov_hash)
.await
match request_pov(
&mut sender,
relay_parent,
from_validator,
candidate.descriptor.para_id,
candidate_hash,
pov_hash,
)
.await
{
Err(Error::FetchPoV) => {
tx_command
@@ -150,6 +150,7 @@ impl AvailabilityDistributionSubsystem {
AvailabilityDistributionMessage::FetchPoV {
relay_parent,
from_validator,
para_id,
candidate_hash,
pov_hash,
tx,
@@ -161,6 +162,7 @@ impl AvailabilityDistributionSubsystem {
&mut runtime,
relay_parent,
from_validator,
para_id,
candidate_hash,
pov_hash,
tx,
@@ -30,7 +30,9 @@ use polkadot_node_subsystem::{
overseer,
};
use polkadot_node_subsystem_util::runtime::RuntimeInfo;
use polkadot_primitives::v2::{AuthorityDiscoveryId, CandidateHash, Hash, ValidatorIndex};
use polkadot_primitives::v2::{
AuthorityDiscoveryId, CandidateHash, Hash, Id as ParaId, ValidatorIndex,
};
use crate::{
error::{Error, FatalError, JfyiError, Result},
@@ -45,6 +47,7 @@ pub async fn fetch_pov<Context>(
runtime: &mut RuntimeInfo,
parent: Hash,
from_validator: ValidatorIndex,
para_id: ParaId,
candidate_hash: CandidateHash,
pov_hash: Hash,
tx: oneshot::Sender<PoV>,
@@ -70,10 +73,12 @@ pub async fn fetch_pov<Context>(
let span = jaeger::Span::new(candidate_hash, "fetch-pov")
.with_validator_index(from_validator)
.with_relay_parent(parent);
.with_relay_parent(parent)
.with_para_id(para_id);
ctx.spawn(
"pov-fetcher",
fetch_pov_job(pov_hash, authority_id, pending_response.boxed(), span, tx, metrics).boxed(),
fetch_pov_job(para_id, pov_hash, authority_id, pending_response.boxed(), span, tx, metrics)
.boxed(),
)
.map_err(|e| FatalError::SpawnTask(e))?;
Ok(())
@@ -81,6 +86,7 @@ pub async fn fetch_pov<Context>(
/// Future to be spawned for taking care of handling reception and sending of PoV.
async fn fetch_pov_job(
para_id: ParaId,
pov_hash: Hash,
authority_id: AuthorityDiscoveryId,
pending_response: BoxFuture<'static, std::result::Result<PoVFetchingResponse, RequestError>>,
@@ -89,7 +95,7 @@ async fn fetch_pov_job(
metrics: Metrics,
) {
if let Err(err) = do_fetch_pov(pov_hash, pending_response, span, tx, metrics).await {
gum::warn!(target: LOG_TARGET, ?err, ?pov_hash, ?authority_id, "fetch_pov_job");
gum::warn!(target: LOG_TARGET, ?err, ?para_id, ?pov_hash, ?authority_id, "fetch_pov_job");
}
}
@@ -171,6 +177,7 @@ mod tests {
&mut runtime,
Hash::default(),
ValidatorIndex(0),
ParaId::default(),
CandidateHash::default(),
pov_hash,
tx,
@@ -430,6 +430,10 @@ pub enum AvailabilityDistributionMessage {
relay_parent: Hash,
/// Validator to fetch the PoV from.
from_validator: ValidatorIndex,
/// The id of the parachain that produced this PoV.
/// This field is only used to provide more context when logging errors
/// from the `AvailabilityDistribution` subsystem.
para_id: ParaId,
/// Candidate hash to fetch the PoV for.
candidate_hash: CandidateHash,
/// Expected hash of the PoV, a PoV not matching this hash will be rejected.