Skip to content
This repository was archived by the owner on Jun 17, 2022. It is now read-only.

Commit 4faa8e0

Browse files
author
Lay Nath
authored
Merge pull request #55 from selendra/development
Development
2 parents f97c23c + 950372c commit 4faa8e0

File tree

17 files changed

+313
-107
lines changed

17 files changed

+313
-107
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/parachain/test-parachains/adder/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ parachain = { package = "selendra-parachain", path = "../../", default-features
1111
parity-scale-codec = { version = "2.3.1", default-features = false, features = ["derive"] }
1212
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.10" }
1313
tiny-keccak = { version = "2.0.2", features = ["keccak"] }
14-
dlmalloc = { version = "0.2.1", features = [ "global" ] }
14+
dlmalloc = { version = "0.2.2", features = [ "global" ] }
1515

1616
# We need to make sure the global allocator is disabled until we have support of full substrate externalities
1717
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, features = [ "disable_allocator" ], branch = "polkadot-v0.9.10" }

modules/parachain/test-parachains/adder/collator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ substrate-test-utils = { git = "https://github.com/paritytech/substrate", branch
4545
sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" }
4646
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" }
4747

48-
tokio = { version = "0.2", features = ["macros"] }
48+
tokio = { version = "1.13.0", features = ["macros"] }

node/core/av-store/src/lib.rs

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ fn query_inner<D: Decode>(
162162
Ok(Some(res))
163163
},
164164
Ok(None) => Ok(None),
165-
Err(e) => {
166-
tracing::warn!(target: LOG_TARGET, err = ?e, "Error reading from the availability store");
167-
Err(e.into())
165+
Err(err) => {
166+
tracing::warn!(target: LOG_TARGET, ?err, "Error reading from the availability store");
167+
Err(err.into())
168168
},
169169
}
170170
}
@@ -365,6 +365,20 @@ pub enum Error {
365365
CustomDatabase,
366366
}
367367

368+
impl Error {
369+
/// Determine if the error is irrecoverable
370+
/// or notifying the user via means of logging
371+
/// is sufficient.
372+
fn is_fatal(&self) -> bool {
373+
match self {
374+
Self::Io(_) => true,
375+
Self::Oneshot(_) => true,
376+
Self::CustomDatabase => true,
377+
_ => false,
378+
}
379+
}
380+
}
381+
368382
impl Error {
369383
fn trace(&self) {
370384
match self {
@@ -524,8 +538,7 @@ where
524538
match res {
525539
Err(e) => {
526540
e.trace();
527-
528-
if let Error::Subsystem(SubsystemError::Context(_)) = e {
541+
if e.is_fatal() {
529542
break
530543
}
531544
},
@@ -840,8 +853,18 @@ where
840853
let (tx, rx) = oneshot::channel();
841854
ctx.send_message(ChainApiMessage::FinalizedBlockHash(batch_num, tx)).await;
842855

843-
match rx.await?? {
844-
None => {
856+
match rx.await? {
857+
Err(err) => {
858+
tracing::warn!(
859+
target: LOG_TARGET,
860+
batch_num,
861+
?err,
862+
"Failed to retrieve finalized block number.",
863+
);
864+
865+
break
866+
},
867+
Ok(None) => {
845868
tracing::warn!(
846869
target: LOG_TARGET,
847870
"Availability store was informed that block #{} is finalized, \
@@ -851,7 +874,7 @@ where
851874

852875
break
853876
},
854-
Some(h) => h,
877+
Ok(Some(h)) => h,
855878
}
856879
};
857880

@@ -1093,7 +1116,7 @@ fn process_message(
10931116
},
10941117
Err(e) => {
10951118
let _ = tx.send(Err(()));
1096-
return Err(e)
1119+
return Err(e.into())
10971120
},
10981121
}
10991122
},

node/core/chain-selection/src/lib.rs

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -348,14 +348,11 @@ async fn run<Context, B>(
348348
B: Backend,
349349
{
350350
loop {
351-
let res = run_iteration(&mut ctx, &mut backend, &stagnant_check_interval, &*clock).await;
351+
let res = run_until_error(&mut ctx, &mut backend, &stagnant_check_interval, &*clock).await;
352352
match res {
353353
Err(e) => {
354354
e.trace();
355-
356-
if let Error::Subsystem(SubsystemError::Context(_)) = e {
357-
break
358-
}
355+
break
359356
},
360357
Ok(()) => {
361358
tracing::info!(target: LOG_TARGET, "received `Conclude` signal, exiting");
@@ -370,7 +367,7 @@ async fn run<Context, B>(
370367
//
371368
// A return value of `Ok` indicates that an exit should be made, while non-fatal errors
372369
// lead to another call to this function.
373-
async fn run_iteration<Context, B>(
370+
async fn run_until_error<Context, B>(
374371
ctx: &mut Context,
375372
backend: &mut B,
376373
stagnant_check_interval: &StagnantCheckInterval,
@@ -440,32 +437,50 @@ async fn fetch_finalized(
440437
ctx: &mut impl SubsystemContext,
441438
) -> Result<Option<(Hash, BlockNumber)>, Error> {
442439
let (number_tx, number_rx) = oneshot::channel();
443-
let (hash_tx, hash_rx) = oneshot::channel();
444440

445441
ctx.send_message(ChainApiMessage::FinalizedBlockNumber(number_tx)).await;
446442

447-
let number = number_rx.await??;
443+
let number = match number_rx.await? {
444+
Ok(number) => number,
445+
Err(err) => {
446+
tracing::warn!(target: LOG_TARGET, ?err, "Fetching finalized number failed");
447+
return Ok(None)
448+
},
449+
};
450+
451+
let (hash_tx, hash_rx) = oneshot::channel();
448452

449453
ctx.send_message(ChainApiMessage::FinalizedBlockHash(number, hash_tx)).await;
450454

451-
match hash_rx.await?? {
452-
None => {
455+
match hash_rx.await? {
456+
Err(err) => {
457+
tracing::warn!(
458+
target: LOG_TARGET,
459+
number,
460+
?err,
461+
"Fetching finalized block number failed"
462+
);
463+
Ok(None)
464+
},
465+
Ok(None) => {
453466
tracing::warn!(target: LOG_TARGET, number, "Missing hash for finalized block number");
454-
455-
return Ok(None)
467+
Ok(None)
456468
},
457-
Some(h) => Ok(Some((h, number))),
469+
Ok(Some(h)) => Ok(Some((h, number))),
458470
}
459471
}
460472

461473
async fn fetch_header(
462474
ctx: &mut impl SubsystemContext,
463475
hash: Hash,
464476
) -> Result<Option<Header>, Error> {
465-
let (h_tx, h_rx) = oneshot::channel();
466-
ctx.send_message(ChainApiMessage::BlockHeader(hash, h_tx)).await;
477+
let (tx, rx) = oneshot::channel();
478+
ctx.send_message(ChainApiMessage::BlockHeader(hash, tx)).await;
467479

468-
h_rx.await?.map_err(Into::into)
480+
Ok(rx.await?.unwrap_or_else(|err| {
481+
tracing::warn!(target: LOG_TARGET, ?hash, ?err, "Missing hash for finalized block number");
482+
None
483+
}))
469484
}
470485

471486
async fn fetch_block_weight(
@@ -475,7 +490,12 @@ async fn fetch_block_weight(
475490
let (tx, rx) = oneshot::channel();
476491
ctx.send_message(ChainApiMessage::BlockWeight(hash, tx)).await;
477492

478-
rx.await?.map_err(Into::into)
493+
let res = rx.await?;
494+
495+
Ok(res.unwrap_or_else(|err| {
496+
tracing::warn!(target: LOG_TARGET, ?hash, ?err, "Missing hash for finalized block number");
497+
None
498+
}))
479499
}
480500

481501
// Handle a new active leaf.
@@ -590,7 +610,7 @@ fn extract_reversion_logs(header: &Header) -> Vec<BlockNumber> {
590610
logs
591611
}
592612

593-
// Handle a finalized block event.
613+
/// Handle a finalized block event.
594614
fn handle_finalized_block(
595615
backend: &mut impl Backend,
596616
finalized_hash: Hash,

node/core/dispute-coordinator/src/real/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ where
419419
tracing::warn!(
420420
target: LOG_TARGET,
421421
session,
422-
"Missing info for session which has an active dispute",
422+
"Recovering lacks info for session which has an active dispute",
423423
);
424424
continue
425425
},
@@ -860,7 +860,7 @@ async fn handle_import_statements(
860860
tracing::warn!(
861861
target: LOG_TARGET,
862862
session,
863-
"Missing info for session which has an active dispute",
863+
"Importing statement lacks info for session which has an active dispute",
864864
);
865865

866866
return Ok(ImportStatementsResult::InvalidImport)
@@ -893,7 +893,7 @@ async fn handle_import_statements(
893893
tracing::warn!(
894894
target: LOG_TARGET,
895895
session,
896-
"Missing info for session which has an active dispute",
896+
"Not seen backing vote for candidate which has an active dispute",
897897
);
898898
return Ok(ImportStatementsResult::InvalidImport)
899899
},

node/core/pvf/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ async-process = "1.1.0"
1414
assert_matches = "1.4.0"
1515
futures = "0.3.17"
1616
futures-timer = "3.0.2"
17-
libc = "0.2.104"
17+
libc = "0.2.106"
1818
slotmap = "1.0"
1919
tracing = "0.1.29"
2020
pin-project = "1.0.8"

0 commit comments

Comments
 (0)