Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Minimal parachain framework part 1 #113

Merged
merged 75 commits into from
May 25, 2018
Merged

Minimal parachain framework part 1 #113

merged 75 commits into from
May 25, 2018

Conversation

rphmeier
Copy link
Contributor

@rphmeier rphmeier commented Apr 5, 2018

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:

  • Improve networking so validators broadcast around statements better and to enable collators
  • misbehavior reporting when bad parachain candidates occur (will require access to past random seeds)
  • Collator-node implementation and RPC API for external collation services
  • Runtime improvements for registering and deregistering parachains dynamically.

@rphmeier rphmeier added the A3-in_progress Pull request is in progress. No review needed at this stage. label Apr 5, 2018
@gavofyork gavofyork added A9-buythatmanabeer and removed A0-please_review Pull request needs code review. A9-buythatmanabeer labels May 23, 2018
@rphmeier rphmeier mentioned this pull request May 23, 2018
7 tasks
@rphmeier rphmeier added A0-please_review Pull request needs code review. and removed A5-grumble labels May 23, 2018
bail!(ErrorKind::ParachainOutOfOrder);
}

if iter.position(|x| x == &head.parachain_index).is_none() {
Copy link
Member

@arkpar arkpar May 24, 2018

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?

Copy link
Contributor Author

@rphmeier rphmeier May 24, 2018

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.

}

if iter.position(|x| x == &head.parachain_index).is_none() {
// must be unknown since active parachains are always sorted.
Copy link
Member

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.

Copy link
Contributor Author

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.

@@ -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()
Copy link
Member

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(_) => {}
Copy link
Member

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?

Copy link
Contributor Author

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) {
Copy link
Contributor Author

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

@rphmeier rphmeier merged commit 800c138 into master May 25, 2018
@rphmeier rphmeier deleted the rh-minimal-parachain branch May 25, 2018 14:16
lamafab pushed a commit to lamafab/substrate that referenced this pull request Jun 16, 2020
JoshOrndorff pushed a commit to moonbeam-foundation/substrate that referenced this pull request Apr 21, 2021
* Automate the test specs generation

* Restore original test template

* Adds documentation for test generation
liuchengxu pushed a commit to chainx-org/substrate that referenced this pull request Aug 23, 2021
* support channel_relationship
liuchengxu pushed a commit to chainx-org/substrate that referenced this pull request Aug 23, 2021
liuchengxu added a commit to autonomys/substrate that referenced this pull request Jun 3, 2022
helin6 pushed a commit to boolnetwork/substrate that referenced this pull request Jul 25, 2023
* Refactor api.

* Try fix ci.

* Fix test.

* Address review comments.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants