-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
polkadot/consensus/src/evaluation.rs
Outdated
bail!(ErrorKind::ParachainOutOfOrder); | ||
} | ||
|
||
if iter.position(|x| x == &head.parachain_index).is_none() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iter.any()
could be used here,
or maybe even binary search?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will replace with iter.any()
. binary_search
might be too heavy since there aren't likely to be that many parachains.
polkadot/consensus/src/evaluation.rs
Outdated
} | ||
|
||
if iter.position(|x| x == &head.parachain_index).is_none() { | ||
// must be unknown since active parachains are always sorted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment is a bit confusing. The code does not care if active_parachains
is sorted or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this check would be broken if active_parachains
was not sorted. note that the iterator is reused (and not re-generated) between calls.
polkadot/consensus/src/service.rs
Outdated
@@ -232,12 +246,19 @@ impl Service { | |||
let (signal, exit) = ::exit_future::signal(); | |||
let thread = thread::spawn(move || { | |||
let mut core = reactor::Core::new().expect("tokio::Core could not be created"); | |||
let timer = ::tokio_timer::wheel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tokio-core
implements a timer in the IO poll and supports a timer future
https://docs.rs/tokio-core/0.1.17/tokio_core/reactor/struct.Timeout.html
Can't we use that not to introduce yet another thread?
use std::collections::hash_map::Entry; | ||
|
||
match self.tracking.entry(candidate) { | ||
Entry::Vacant(_) => {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should that trigger an assertion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, since the shared_table
calls it for all listeners unconditionally. then it would have to check if the hash is actually tracked in an IncludabilitySender
before calling. We'd end up doing twice the hash-map lookups.
"Proposal exceeded the maximum size of {} by {} bytes.", | ||
::MAX_TRANSACTIONS_SIZE, ::MAX_TRANSACTIONS_SIZE.saturating_sub(*size) | ||
), | ||
Timer(e: String) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has to be a string because we need to construct this if the shared delay fails. io::Error is not Clone
* Automate the test specs generation * Restore original test template * Adds documentation for test generation
* support channel_relationship
…n-farmer Eliminate common.rs in farmer
* Refactor api. * Try fix ci. * Fix test. * Address review comments.
This PR extends the runtime and consensus modules to support minimal parachains without message passing. When assigned to validity duty on a parachain, a validator will collate, verify, and broadcast around a parachain candidate. Availability of necessary data is also guaranteed.
Remaining work for follow-up PRs: