Conversation
|
There's a toolchain problem it seems. :/ |
demo/consensus/src/evaluation.rs
Outdated
| description("Proposal exceeded the maximum size."), | ||
| display( | ||
| "Proposal exceeded the maximum size of {} by {} bytes.", | ||
| MAX_TRANSACTIONS_SIZE, MAX_TRANSACTIONS_SIZE.saturating_sub(*size) |
There was a problem hiding this comment.
Should be size.saturating_sub(MAX_SIZE), since max size is exceeded.
demo/network/src/lib.rs
Outdated
|
|
||
| //! Substrate Demo-specific network implementation. | ||
| //! | ||
| //! This manages gossip of consensus messages for BFT and for parachain statements, |
There was a problem hiding this comment.
there are no parachains in demo
| use substrate_network::StatusMessage as GenericFullStatus; | ||
|
|
||
| /// Demo protocol id. | ||
| pub const PROTOCOL_ID: ::substrate_network::ProtocolId = *b"dot"; |
There was a problem hiding this comment.
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.
demo/network/src/consensus.rs
Outdated
| }, | ||
| 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), |
There was a problem hiding this comment.
Should we propagate the error here? Otherwise it seems that it should lead to the busy loop
demo/network/src/lib.rs
Outdated
| /// Note new consensus session. | ||
| fn new_consensus(&mut self, hash: Hash) { | ||
| let old_consensus = self.live_consensus.take(); | ||
| self.live_consensus = Some(hash); |
There was a problem hiding this comment.
can we rename hash → parent_hash here?
demo/runtime/wasm/build.sh
Outdated
| set -e | ||
|
|
||
| cargo +nightly build --target=wasm32-unknown-unknown --release | ||
| cargo +nightly-2018-08-27 build --target=wasm32-unknown-unknown --release |
There was a problem hiding this comment.
I think this should have not been committed.
gnunicorn
left a comment
There was a problem hiding this comment.
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" } |
There was a problem hiding this comment.
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?
demo/api/src/lib.rs
Outdated
| @@ -0,0 +1,155 @@ | |||
| // Copyright 2017 Parity Technologies (UK) Ltd. | |||
demo/consensus/src/error.rs
Outdated
| @@ -0,0 +1,55 @@ | |||
| // Copyright 2017 Parity Technologies (UK) Ltd. | |||
demo/consensus/src/evaluation.rs
Outdated
| @@ -0,0 +1,96 @@ | |||
| // Copyright 2017 Parity Technologies (UK) Ltd. | |||
| // This file is part of Polkadot. | |||
demo/consensus/src/lib.rs
Outdated
| @@ -0,0 +1,446 @@ | |||
| // Copyright 2017 Parity Technologies (UK) Ltd. | |||
demo/network/src/lib.rs
Outdated
| @@ -0,0 +1,117 @@ | |||
| // Copyright 2017 Parity Technologies (UK) Ltd. | |||
demo/runtime/src/checked_block.rs
Outdated
| @@ -0,0 +1,94 @@ | |||
| // Copyright 2017 Parity Technologies (UK) Ltd. | |||
demo/service/src/chain_spec.rs
Outdated
| @@ -0,0 +1,196 @@ | |||
| // Copyright 2017 Parity Technologies (UK) Ltd. | |||
demo/service/src/chain_spec.rs
Outdated
| 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(), |
demo/service/src/lib.rs
Outdated
| @@ -0,0 +1,214 @@ | |||
| // Copyright 2017 Parity Technologies (UK) Ltd. | |||
demo/consensus/src/error.rs
Outdated
| } | ||
|
|
||
| errors { | ||
| InvalidDutyRosterLength(expected: usize, got: usize) { |
There was a problem hiding this comment.
don't think this is needed, is it?
demo/consensus/src/lib.rs
Outdated
| .expect("blocks are defined to serialize to substrate blocks correctly; qed"); | ||
|
|
||
| assert!(evaluation::evaluate_initial( | ||
| &substrate_block, |
demo/consensus/src/lib.rs
Outdated
| timestamp, | ||
| &self.parent_hash, | ||
| self.parent_number, | ||
| ).is_ok()); |
| fn start_send(&mut self, message: bft::Communication<Block>) | ||
| -> ::futures::StartSend<bft::Communication<Block>, E> | ||
| { | ||
| let network_message = net::LocalizedBftMessage { |
There was a problem hiding this comment.
would be nice to keep anything bft-specific in the substrate library
demo/service/src/lib.rs
Outdated
|
|
||
| let consensus_net = ConsensusNetwork::new(service.network(), client.clone()); | ||
| Some(consensus::Service::new( | ||
| client.clone(), |
substrate/client/src/client.rs
Outdated
| "initialise_block", | ||
| &header.encode(), | ||
| execution_manager() | ||
| )?; |
There was a problem hiding this comment.
closing paren goes on opening paren's line
substrate/client/src/client.rs
Outdated
| function, | ||
| input, | ||
| execution_manager() | ||
| ))?; |
|
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. |
|
We want something like a |
|
@arkpar needs resolving... |
* 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
Quite a bit of the consensus code is still copy-pasted from polkadot
runtime/checked_block.rsDemo extrinsics still use
Addressinstead ofAccounId.Currently it can sync
krumme-lanke.jsonbut I expect this to change as the network protocol grows to be incompatible. Protocol id should be different at least.