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

Conversation

@arkpar
Copy link
Member

@arkpar arkpar commented Sep 4, 2018

Quite a bit of the consensus code is still copy-pasted from polkadot

  • Offline validator detection should be moved to substrate
  • Some shared code in runtime/checked_block.rs

Demo extrinsics still use Address instead of AccounId.

Currently it can sync krumme-lanke.json but I expect this to change as the network protocol grows to be incompatible. Protocol id should be different at least.

@arkpar arkpar added the A0-please_review Pull request needs code review. label Sep 4, 2018
@dvdplm
Copy link
Contributor

dvdplm commented Sep 4, 2018

There's a toolchain problem it seems. :/

description("Proposal exceeded the maximum size."),
display(
"Proposal exceeded the maximum size of {} by {} bytes.",
MAX_TRANSACTIONS_SIZE, MAX_TRANSACTIONS_SIZE.saturating_sub(*size)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be size.saturating_sub(MAX_SIZE), since max size is exceeded.


//! Substrate Demo-specific network implementation.
//!
//! This manages gossip of consensus messages for BFT and for parachain statements,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are no parachains in demo

use substrate_network::StatusMessage as GenericFullStatus;

/// Demo protocol id.
pub const PROTOCOL_ID: ::substrate_network::ProtocolId = *b"dot";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left it as is for now so that substrate-demo could sync to the Krumme Lanke network. I'll make it configurable through the spec file in the following PR.

},
Ok(Async::Ready(None)) => return Ok(Async::Ready(())),
Ok(Async::NotReady) => return Ok(Async::NotReady),
Err(e) => debug!(target: "demo-network", "Error getting consensus message: {:?}", e),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we propagate the error here? Otherwise it seems that it should lead to the busy loop

/// Note new consensus session.
fn new_consensus(&mut self, hash: Hash) {
let old_consensus = self.live_consensus.take();
self.live_consensus = Some(hash);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename hashparent_hash here?

set -e

cargo +nightly build --target=wasm32-unknown-unknown --release
cargo +nightly-2018-08-27 build --target=wasm32-unknown-unknown --release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should have not been committed.

@arkpar arkpar added A3-in_progress Pull request is in progress. No review needed at this stage. and removed A0-please_review Pull request needs code review. labels Sep 4, 2018
@arkpar arkpar added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Sep 5, 2018
Copy link
Contributor

@gnunicorn gnunicorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really have enough knowledge about what the code is supposed to do, so its mostly style, dependency and comment comments

demo/Cargo.toml Outdated
error-chain = "0.12"
demo-cli = { path = "cli" }
futures = "0.1"
ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we use the official crate rather than a two year old fork? Especially considering the only change added in the fork (SIGINT and SIGTERM support) is supported in the official crate for a while by now?

@@ -0,0 +1,155 @@
// Copyright 2017 Parity Technologies (UK) Ltd.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2018

@@ -0,0 +1,55 @@
// Copyright 2017 Parity Technologies (UK) Ltd.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2018

@@ -0,0 +1,96 @@
// Copyright 2017 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Polkadot+Substrate Demo

@@ -0,0 +1,446 @@
// Copyright 2017 Parity Technologies (UK) Ltd.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2018

@@ -0,0 +1,117 @@
// Copyright 2017 Parity Technologies (UK) Ltd.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2018

@@ -0,0 +1,94 @@
// Copyright 2017 Parity Technologies (UK) Ltd.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2018

@@ -0,0 +1,196 @@
// Copyright 2017 Parity Technologies (UK) Ltd.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2018

minimum_deposit: 10,
}),
council: Some(CouncilConfig {
active_council: endowed_accounts.iter().filter(|a| initial_authorities.iter().find(|&b| a.0 == b.0).is_none()).map(|a| (a.clone(), 1000000)).collect(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please wrap.

@@ -0,0 +1,214 @@
// Copyright 2017 Parity Technologies (UK) Ltd.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2018

}

errors {
InvalidDutyRosterLength(expected: usize, got: usize) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think this is needed, is it?

.expect("blocks are defined to serialize to substrate blocks correctly; qed");

assert!(evaluation::evaluate_initial(
&substrate_block,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra tab

timestamp,
&self.parent_hash,
self.parent_number,
).is_ok());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two extra tabs

fn start_send(&mut self, message: bft::Communication<Block>)
-> ::futures::StartSend<bft::Communication<Block>, E>
{
let network_message = net::LocalizedBftMessage {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to keep anything bft-specific in the substrate library


let consensus_net = ConsensusNetwork::new(service.network(), client.clone());
Some(consensus::Service::new(
client.clone(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double indent unneeded

"initialise_block",
&header.encode(),
execution_manager()
)?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closing paren goes on opening paren's line

function,
input,
execution_manager()
))?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@gavofyork
Copy link
Member

yey for the direction :)

would really like to shift all networking logic into substrate libraries with just an extension API that can be used should protocol additions be required like for polkadot.

i guess this can be done in subsequent PRs though.

@rphmeier
Copy link
Contributor

rphmeier commented Sep 7, 2018

We want something like a substrate-network-rhododendron crate for dealing with rhododendron networking messages etc. We will want other consensus protocols which have their own messages so it's best not to make the existing ones too first-class in substrate. consensus networking crates will need to be extensible enough to also support things like enabling polkadot sub-agreement messages to be sent via the same channels.

@gavofyork gavofyork added A8-looksgood and removed A0-please_review Pull request needs code review. labels Sep 10, 2018
@gavofyork
Copy link
Member

@arkpar needs resolving...

@gavofyork gavofyork merged commit 68137ae into master Sep 10, 2018
@gavofyork gavofyork deleted the a-demo branch September 10, 2018 15:54
liuchengxu added a commit to chainx-org/substrate that referenced this pull request Aug 23, 2021
* Add optional block number in RPC

Higher fee for registering node (paritytech#655)

Support optional number for more RPC

A few more

Complete support for optional number in RPC

Nits

.

Remove useless best_number()

* Use BlockHash instead of BlockNumber in PRC

* Nit
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.

8 participants