Skip to content

Commit adba1d5

Browse files
bkchrrphmeier
authored andcommitted
Update to latest substrate-master and polkadot v0.3 (paritytech#195)
* Rebuild runtime * Remove invalid value from chainspec (paritytech#68) * service: use grandpa block import for locally sealed aura blocks (paritytech#85) * bump version to v0.3.1 * Update lock file. * limit number of transactions when building blocks (paritytech#91) * Update to latest Substrate * Bump to 0.3.2 * Actually bump. * v0.3.2 (paritytech#98) * bump substrate version * fix polkadot-collator * point to alexander-backports of substrate * bump version * cli: fix node shutdown (paritytech#100) * update to latest substrate, change to v0.3.4 * update to latest substrate, bump version to 0.3.5 * v0.3.6 * try to build on every v0.3 commit and update alexander-backports * bump to v0.3.7 * bump to 0.3.8 * Bump to 0.3.9: network and pruning improvements * Bump to 0.3.10: reduce network bandwidth usage * Use libp2p-kad 0.3.2 (paritytech#122) * Bump libp2p-identify to 0.3.1 (paritytech#123) * Bump to 0.3.12 (paritytech#127) * Update Substrate again (paritytech#128) * update substrate and bump version to v0.3.13 * bump version to v0.3.14: fix --reserved-nodes * add a manually curated grandpa module (paritytech#136) * updating v0.3 to use substrate v0.10 (paritytech#146) * updating to latest substrate v0.10 * better handling of outer poll * nit * fix tests * remove comment * reduce indentation * use self.poll * bring oneshot into scope * spaces * wrap * remove match * wrap * Update primitives/Cargo.toml Co-Authored-By: gterzian <[email protected]> * Update runtime/wasm/Cargo.toml Co-Authored-By: gterzian <[email protected]> * Update runtime/wasm/Cargo.toml Co-Authored-By: gterzian <[email protected]> * Update test-parachains/adder/collator/src/main.rs Co-Authored-By: gterzian <[email protected]> * indent * add paranthese * config: fix wrong ip for alexander bootnode (paritytech#161) * fix curated-grandpa and rebuild wasm (paritytech#162) * [v0.3] Integrates new gossip system into Polkadot (paritytech#166) * new gossip validation in network * integrate new gossip into service * network: guard validation network future under exit signal (paritytech#168) * bump version to v0.3.15: substrate v0.10 * [v0.3] update to substrate master (paritytech#175) * update to substrate master * fix test * service: fix telemetry endpoints on alexander chainspec (paritytech#169) (paritytech#178) * Update v0.3 to latest Substrate master (paritytech#177) * update substrate v0.3 to latest master * bump spec version * update to latest master: remove fees module * update runtime blobs * bump version to 0.3.16 * replace sr25519 accountid with anysigner * bump version to v0.3.17 * Some PoC-3 GRANDPA tweaks (paritytech#181) * call on_finalise after triggering curated_grandpa change * make grandpa rounds shorter for faster finalization * use authorities when calculating duty roster (paritytech#185) * [v0.3] Update to substrate master (paritytech#183) * update to latest substrate master * bump version to 0.3.18 * update to latest substrate master * bump spec version * update runtime wasm blobs * remove current_offline_slash from chain spec * update to substrate master: bump version to v0.3.19 (paritytech#188) * update to substrate master: bump version to v0.3.19 libp2p network improvements * network: replace NodeIndex with PeerId * network: fix tests * polkadot v0.3.20 (paritytech#190) * update to substrate master: bump version to 0.3.20 * runtime: add offchain worker trait * runtime: rebuild wasm blobs * bump spec version (paritytech#191) * Fix compilation * Update version to 0.4.0 * Switch to use `polkadot-master` branch from substrate * Remove unused struct * Remove `grandpa::SyncedAuthorities` from `OnSessionChange`
1 parent 6696c8e commit adba1d5

File tree

37 files changed

+2755
-1763
lines changed

37 files changed

+2755
-1763
lines changed

.gitlab-ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ publish-s3-release:
235235
- kubectl get nodes -l node=polkadot
236236
-o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{range @.status.addresses[?(@.type=="ExternalIP")]}{.address}{"\n"}{end}'
237237
- echo "# polkadots' nodes"
238-
- kubectl -n polkadot get pods
238+
- kubectl -n polkadot get pods
239239
-o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.nodeName}{"\n"}{end}'
240240

241241

Cargo.lock

+1,222-1,178
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ path = "src/main.rs"
44

55
[package]
66
name = "polkadot"
7-
version = "0.3.0"
7+
version = "0.4.0"
88
authors = ["Parity Technologies <[email protected]>"]
99
build = "build.rs"
1010

availability-store/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ polkadot-primitives = { path = "../primitives" }
99
parking_lot = "0.7.1"
1010
log = "0.4.6"
1111
parity-codec = "3.0"
12-
substrate-primitives = { git = "https://github.com/paritytech/substrate" }
12+
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
1313
kvdb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" }
1414
kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" }
1515
kvdb-memorydb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" }

cli/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "polkadot-cli"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
authors = ["Parity Technologies <[email protected]>"]
55
description = "Polkadot node implementation in Rust."
66

@@ -9,5 +9,5 @@ log = "0.4.6"
99
tokio = "0.1.7"
1010
futures = "0.1.17"
1111
exit-future = "0.1"
12-
substrate-cli = { git = "https://github.com/paritytech/substrate" }
12+
substrate-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
1313
polkadot-service = { path = "../service" }

cli/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,13 @@ use chain_spec::ChainSpec;
3636
use futures::Future;
3737
use tokio::runtime::Runtime;
3838
use service::Service as BareService;
39-
use cli::NoCustom;
4039

4140
pub use service::{
4241
Components as ServiceComponents, PolkadotService, CustomConfiguration, ServiceFactory, Factory,
4342
ProvideRuntimeApi, CoreApi, ParachainHost,
4443
};
4544

46-
pub use cli::{VersionInfo, IntoExit};
45+
pub use cli::{VersionInfo, IntoExit, NoCustom};
4746
pub use cli::error;
4847
pub use tokio::runtime::TaskExecutor;
4948

collator/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ description = "Collator node implementation"
66

77
[dependencies]
88
futures = "0.1.17"
9-
substrate-client = { git = "https://github.com/paritytech/substrate" }
9+
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
1010
parity-codec = "3.0"
11-
substrate-primitives = { git = "https://github.com/paritytech/substrate" }
11+
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
1212
polkadot-runtime = { path = "../runtime", version = "0.1" }
1313
polkadot-primitives = { path = "../primitives", version = "0.1" }
1414
polkadot-cli = { path = "../cli" }
@@ -18,4 +18,4 @@ log = "0.4"
1818
tokio = "0.1.7"
1919

2020
[dev-dependencies]
21-
substrate-keyring = { git = "https://github.com/paritytech/substrate" }
21+
substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }

collator/src/lib.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,15 @@ impl<P, E> Worker for CollationNode<P, E> where
259259
match known_oracle.block_status(&BlockId::hash(*block_hash)) {
260260
Err(_) | Ok(BlockStatus::Unknown) | Ok(BlockStatus::Queued) => None,
261261
Ok(BlockStatus::KnownBad) => Some(Known::Bad),
262-
Ok(BlockStatus::InChain) => match known_oracle.leaves() {
263-
Err(_) => None,
264-
Ok(leaves) => if leaves.contains(block_hash) {
265-
Some(Known::Leaf)
266-
} else {
267-
Some(Known::Old)
268-
},
269-
}
262+
Ok(BlockStatus::InChainWithState) | Ok(BlockStatus::InChainPruned) =>
263+
match known_oracle.leaves() {
264+
Err(_) => None,
265+
Ok(leaves) => if leaves.contains(block_hash) {
266+
Some(Known::Leaf)
267+
} else {
268+
Some(Known::Old)
269+
},
270+
}
270271
}
271272
},
272273
);
@@ -481,3 +482,4 @@ mod tests {
481482
assert_eq!(collation.receipt.egress_queue_roots, vec![(a, root_a), (b, root_b)]);
482483
}
483484
}
485+

erasure-coding/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ edition = "2018"
88
polkadot-primitives = { path = "../primitives" }
99
reed-solomon-erasure = { git = "https://github.com/paritytech/reed-solomon-erasure" }
1010
parity-codec = "3.0"
11-
substrate-primitives = { git = "https://github.com/paritytech/substrate" }
12-
substrate-trie = { git = "https://github.com/paritytech/substrate" }
11+
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
12+
substrate-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }

executor/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ authors = ["Parity Technologies <[email protected]>"]
55
description = "Polkadot node implementation in Rust."
66

77
[dependencies]
8-
substrate-executor = { git = "https://github.com/paritytech/substrate" }
9-
substrate-primitives = { git = "https://github.com/paritytech/substrate" }
8+
substrate-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
9+
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
1010
polkadot-runtime = { path = "../runtime" }

network/Cargo.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ polkadot-validation = { path = "../validation" }
1212
polkadot-primitives = { path = "../primitives" }
1313
parity-codec = "3.0"
1414
parity-codec-derive = "3.0"
15-
substrate-network = { git = "https://github.com/paritytech/substrate" }
16-
substrate-primitives = { git = "https://github.com/paritytech/substrate" }
17-
sr-primitives = { git = "https://github.com/paritytech/substrate" }
15+
substrate-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
16+
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
17+
sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
1818
futures = "0.1"
1919
tokio = "0.1.7"
2020
log = "0.4"
2121
slice-group-by = "0.2.2"
2222
exit-future = "0.1.4"
2323

2424
[dev-dependencies]
25-
substrate-client = { git = "https://github.com/paritytech/substrate" }
26-
substrate-keyring = { git = "https://github.com/paritytech/substrate" }
25+
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
26+
substrate-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }

network/src/collator_pool.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
//! Bridge between the network and consensus service for getting collations to it.
1818
19-
use polkadot_primitives::{parachain::CollatorId, Hash};
20-
use polkadot_primitives::parachain::{Id as ParaId, Collation};
19+
use polkadot_primitives::Hash;
20+
use polkadot_primitives::parachain::{CollatorId, Id as ParaId, Collation};
2121
use futures::sync::oneshot;
2222

2323
use std::collections::hash_map::{HashMap, Entry};

network/src/lib.rs

+28-28
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ pub mod gossip;
5555

5656
use codec::{Decode, Encode};
5757
use futures::sync::oneshot;
58-
use polkadot_primitives::{Block, SessionKey, Hash, Header, parachain::CollatorId};
59-
use polkadot_primitives::parachain::{Id as ParaId, BlockData, CandidateReceipt, Collation};
60-
use substrate_network::{NodeIndex, RequestId, Context, Severity};
58+
use polkadot_primitives::{Block, SessionKey, Hash, Header};
59+
use polkadot_primitives::parachain::{Id as ParaId, CollatorId, BlockData, CandidateReceipt, Collation};
60+
use substrate_network::{PeerId, RequestId, Context, Severity};
6161
use substrate_network::{message, generic_message};
6262
use substrate_network::specialization::NetworkSpecialization as Specialization;
6363
use substrate_network::StatusMessage as GenericFullStatus;
@@ -156,21 +156,21 @@ pub enum Message {
156156
Collation(Hash, Collation),
157157
}
158158

159-
fn send_polkadot_message(ctx: &mut Context<Block>, to: NodeIndex, message: Message) {
159+
fn send_polkadot_message(ctx: &mut Context<Block>, to: PeerId, message: Message) {
160160
trace!(target: "p_net", "Sending polkadot message to {}: {:?}", to, message);
161161
let encoded = message.encode();
162162
ctx.send_message(to, generic_message::Message::ChainSpecific(encoded))
163163
}
164164

165165
/// Polkadot protocol attachment for substrate.
166166
pub struct PolkadotProtocol {
167-
peers: HashMap<NodeIndex, PeerInfo>,
167+
peers: HashMap<PeerId, PeerInfo>,
168168
collating_for: Option<(CollatorId, ParaId)>,
169169
collators: CollatorPool,
170-
validators: HashMap<SessionKey, NodeIndex>,
170+
validators: HashMap<SessionKey, PeerId>,
171171
local_collations: LocalCollations<Collation>,
172172
live_validation_sessions: LiveValidationSessions,
173-
in_flight: HashMap<(RequestId, NodeIndex), BlockDataRequest>,
173+
in_flight: HashMap<(RequestId, PeerId), BlockDataRequest>,
174174
pending: Vec<BlockDataRequest>,
175175
extrinsic_store: Option<::av_store::Store>,
176176
next_req_id: u64,
@@ -225,7 +225,7 @@ impl PolkadotProtocol {
225225
{
226226
peer_data.collator_state.send_key(new_local.clone(), |msg| send_polkadot_message(
227227
ctx,
228-
*id,
228+
id.clone(),
229229
msg
230230
));
231231
}
@@ -257,7 +257,7 @@ impl PolkadotProtocol {
257257
}
258258
Err(Some(known_keys)) => {
259259
let next_peer = known_keys.iter()
260-
.filter_map(|x| validator_keys.get(x).map(|id| (x.clone(), *id)))
260+
.filter_map(|x| validator_keys.get(x).map(|id| (x.clone(), id.clone())))
261261
.find(|&(ref key, _)| pending.attempted_peers.insert(key.clone()))
262262
.map(|(_, id)| id);
263263

@@ -268,7 +268,7 @@ impl PolkadotProtocol {
268268

269269
send_polkadot_message(
270270
ctx,
271-
who,
271+
who.clone(),
272272
Message::RequestBlockData(req_id, parent, c_hash),
273273
);
274274

@@ -290,7 +290,7 @@ impl PolkadotProtocol {
290290
self.pending = new_pending;
291291
}
292292

293-
fn on_polkadot_message(&mut self, ctx: &mut Context<Block>, who: NodeIndex, msg: Message) {
293+
fn on_polkadot_message(&mut self, ctx: &mut Context<Block>, who: PeerId, msg: Message) {
294294
trace!(target: "p_net", "Polkadot message from {}: {:?}", who, msg);
295295
match msg {
296296
Message::SessionKey(key) => self.on_session_key(ctx, who, key),
@@ -313,7 +313,7 @@ impl PolkadotProtocol {
313313
}
314314
}
315315

316-
fn on_session_key(&mut self, ctx: &mut Context<Block>, who: NodeIndex, key: SessionKey) {
316+
fn on_session_key(&mut self, ctx: &mut Context<Block>, who: PeerId, key: SessionKey) {
317317
{
318318
let info = match self.peers.get_mut(&who) {
319319
Some(peer) => peer,
@@ -343,7 +343,7 @@ impl PolkadotProtocol {
343343
for (relay_parent, collation) in new_collations {
344344
send_polkadot_message(
345345
ctx,
346-
who,
346+
who.clone(),
347347
Message::Collation(relay_parent, collation),
348348
)
349349
}
@@ -354,8 +354,8 @@ impl PolkadotProtocol {
354354
self.dispatch_pending_requests(ctx);
355355
}
356356

357-
fn on_block_data(&mut self, ctx: &mut Context<Block>, who: NodeIndex, req_id: RequestId, data: Option<BlockData>) {
358-
match self.in_flight.remove(&(req_id, who)) {
357+
fn on_block_data(&mut self, ctx: &mut Context<Block>, who: PeerId, req_id: RequestId, data: Option<BlockData>) {
358+
match self.in_flight.remove(&(req_id, who.clone())) {
359359
Some(req) => {
360360
if let Some(data) = data {
361361
if data.hash() == req.block_data_hash {
@@ -372,7 +372,7 @@ impl PolkadotProtocol {
372372
}
373373

374374
// when a validator sends us (a collator) a new role.
375-
fn on_new_role(&mut self, ctx: &mut Context<Block>, who: NodeIndex, role: Role) {
375+
fn on_new_role(&mut self, ctx: &mut Context<Block>, who: PeerId, role: Role) {
376376
let info = match self.peers.get_mut(&who) {
377377
Some(peer) => peer,
378378
None => {
@@ -400,7 +400,7 @@ impl PolkadotProtocol {
400400
debug!(target: "p_net", "Broadcasting collation on relay parent {:?}", relay_parent);
401401
send_polkadot_message(
402402
ctx,
403-
who,
403+
who.clone(),
404404
Message::Collation(relay_parent, collation),
405405
)
406406
}
@@ -413,7 +413,7 @@ impl Specialization<Block> for PolkadotProtocol {
413413
Status { collating_for: self.collating_for.clone() }.encode()
414414
}
415415

416-
fn on_connect(&mut self, ctx: &mut Context<Block>, who: NodeIndex, status: FullStatus) {
416+
fn on_connect(&mut self, ctx: &mut Context<Block>, who: PeerId, status: FullStatus) {
417417
let local_status = match Status::decode(&mut &status.chain_status[..]) {
418418
Some(status) => status,
419419
None => {
@@ -440,7 +440,7 @@ impl Specialization<Block> for PolkadotProtocol {
440440

441441
peer_info.collator_state.set_role(collator_role, |msg| send_polkadot_message(
442442
ctx,
443-
who,
443+
who.clone(),
444444
msg,
445445
));
446446
}
@@ -450,7 +450,7 @@ impl Specialization<Block> for PolkadotProtocol {
450450
for local_session_key in self.live_validation_sessions.recent_keys() {
451451
peer_info.collator_state.send_key(local_session_key.clone(), |msg| send_polkadot_message(
452452
ctx,
453-
who,
453+
who.clone(),
454454
msg,
455455
));
456456
}
@@ -460,7 +460,7 @@ impl Specialization<Block> for PolkadotProtocol {
460460
self.dispatch_pending_requests(ctx);
461461
}
462462

463-
fn on_disconnect(&mut self, ctx: &mut Context<Block>, who: NodeIndex) {
463+
fn on_disconnect(&mut self, ctx: &mut Context<Block>, who: PeerId) {
464464
if let Some(info) = self.peers.remove(&who) {
465465
if let Some((acc_id, _)) = info.collating_for {
466466
let new_primary = self.collators.on_disconnect(acc_id)
@@ -469,7 +469,7 @@ impl Specialization<Block> for PolkadotProtocol {
469469
if let Some((new_primary, primary_info)) = new_primary {
470470
primary_info.collator_state.set_role(Role::Primary, |msg| send_polkadot_message(
471471
ctx,
472-
new_primary,
472+
new_primary.clone(),
473473
msg,
474474
));
475475
}
@@ -502,7 +502,7 @@ impl Specialization<Block> for PolkadotProtocol {
502502
}
503503
}
504504

505-
fn on_message(&mut self, ctx: &mut Context<Block>, who: NodeIndex, message: &mut Option<message::Message<Block>>) {
505+
fn on_message(&mut self, ctx: &mut Context<Block>, who: PeerId, message: &mut Option<message::Message<Block>>) {
506506
match message.take() {
507507
Some(generic_message::Message::ChainSpecific(raw)) => {
508508
match Message::decode(&mut raw.as_slice()) {
@@ -532,7 +532,7 @@ impl Specialization<Block> for PolkadotProtocol {
532532
Action::NewRole(account_id, role) => if let Some((collator, info)) = self.collator_peer(account_id) {
533533
info.collator_state.set_role(role, |msg| send_polkadot_message(
534534
ctx,
535-
collator,
535+
collator.clone(),
536536
msg,
537537
))
538538
},
@@ -548,7 +548,7 @@ impl Specialization<Block> for PolkadotProtocol {
548548

549549
impl PolkadotProtocol {
550550
// we received a collation from a peer
551-
fn on_collation(&mut self, ctx: &mut Context<Block>, from: NodeIndex, relay_parent: Hash, collation: Collation) {
551+
fn on_collation(&mut self, ctx: &mut Context<Block>, from: PeerId, relay_parent: Hash, collation: Collation) {
552552
let collation_para = collation.receipt.parachain_index;
553553
let collated_acc = collation.receipt.collator.clone();
554554

@@ -577,7 +577,7 @@ impl PolkadotProtocol {
577577
}
578578

579579
// get connected peer with given account ID for collation.
580-
fn collator_peer(&mut self, collator_id: CollatorId) -> Option<(NodeIndex, &mut PeerInfo)> {
580+
fn collator_peer(&mut self, collator_id: CollatorId) -> Option<(PeerId, &mut PeerInfo)> {
581581
let check_info = |info: &PeerInfo| info
582582
.collating_for
583583
.as_ref()
@@ -586,7 +586,7 @@ impl PolkadotProtocol {
586586
self.peers
587587
.iter_mut()
588588
.filter(|&(_, ref info)| check_info(&**info))
589-
.map(|(who, info)| (*who, info))
589+
.map(|(who, info)| (who.clone(), info))
590590
.next()
591591
}
592592

@@ -616,7 +616,7 @@ impl PolkadotProtocol {
616616
debug!(target: "p_net", "Sending local collation to {:?}", primary);
617617
send_polkadot_message(
618618
ctx,
619-
*who,
619+
who.clone(),
620620
Message::Collation(relay_parent, cloned_collation),
621621
)
622622
},

0 commit comments

Comments
 (0)