Update Substrate & Polkadot (#359)

* Update Substrate & Polkadot

* Remove unused code
This commit is contained in:
Bastian Köcher
2021-03-09 15:11:43 +01:00
committed by GitHub
parent 1eecfe1acb
commit 20e5dfd37a
4 changed files with 277 additions and 244 deletions
+258 -200
View File
File diff suppressed because it is too large Load Diff
+8 -33
View File
@@ -44,7 +44,7 @@ use codec::{Decode, Encode};
use futures::{
channel::oneshot,
future::{ready, FutureExt},
pin_mut, select, Future,
Future,
};
use std::{convert::TryFrom, fmt, marker::PhantomData, pin::Pin, sync::Arc};
@@ -474,7 +474,6 @@ where
pub struct WaitToAnnounce<Block: BlockT> {
spawner: Arc<dyn SpawnNamed + Send + Sync>,
announce_block: Arc<dyn Fn(Block::Hash, Vec<u8>) + Send + Sync>,
current_trigger: oneshot::Sender<()>,
}
impl<Block: BlockT> WaitToAnnounce<Block> {
@@ -483,12 +482,9 @@ impl<Block: BlockT> WaitToAnnounce<Block> {
spawner: Arc<dyn SpawnNamed + Send + Sync>,
announce_block: Arc<dyn Fn(Block::Hash, Vec<u8>) + Send + Sync>,
) -> WaitToAnnounce<Block> {
let (tx, _rx) = oneshot::channel();
WaitToAnnounce {
spawner,
announce_block,
current_trigger: tx,
}
}
@@ -500,44 +496,23 @@ impl<Block: BlockT> WaitToAnnounce<Block> {
pov_hash: PHash,
signed_stmt_recv: oneshot::Receiver<SignedFullStatement>,
) {
let (tx, rx) = oneshot::channel();
let announce_block = self.announce_block.clone();
self.current_trigger = tx;
self.spawner.spawn(
"cumulus-wait-to-announce",
async move {
let t1 = wait_to_announce::<Block>(
block_hash,
pov_hash,
announce_block,
signed_stmt_recv,
)
.fuse();
let t2 = rx.fuse();
pin_mut!(t1, t2);
tracing::trace!(
target: "cumulus-network",
"waiting for announce block in a background task...",
);
select! {
_ = t1 => {
tracing::trace!(
target: "cumulus-network",
"block announcement finished",
);
},
_ = t2 => {
tracing::trace!(
target: "cumulus-network",
"previous task that waits for announce block has been canceled",
);
}
}
wait_to_announce::<Block>(block_hash, pov_hash, announce_block, signed_stmt_recv)
.await;
tracing::trace!(
target: "cumulus-network",
"block announcement finished",
);
}
.boxed(),
);
+6 -6
View File
@@ -127,20 +127,20 @@ fn testnet_genesis(
id: ParaId,
) -> parachain_runtime::GenesisConfig {
parachain_runtime::GenesisConfig {
frame_system: Some(parachain_runtime::SystemConfig {
frame_system: parachain_runtime::SystemConfig {
code: parachain_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
changes_trie_config: Default::default(),
}),
pallet_balances: Some(parachain_runtime::BalancesConfig {
},
pallet_balances: parachain_runtime::BalancesConfig {
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, 1 << 60))
.collect(),
}),
pallet_sudo: Some(parachain_runtime::SudoConfig { key: root_key }),
parachain_info: Some(parachain_runtime::ParachainInfoConfig { parachain_id: id }),
},
pallet_sudo: parachain_runtime::SudoConfig { key: root_key },
parachain_info: parachain_runtime::ParachainInfoConfig { parachain_id: id },
}
}
+5 -5
View File
@@ -105,19 +105,19 @@ fn testnet_genesis(
endowed_accounts: Vec<AccountId>,
) -> cumulus_test_runtime::GenesisConfig {
cumulus_test_runtime::GenesisConfig {
frame_system: Some(cumulus_test_runtime::SystemConfig {
frame_system: cumulus_test_runtime::SystemConfig {
code: cumulus_test_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
}),
pallet_balances: Some(cumulus_test_runtime::BalancesConfig {
},
pallet_balances: cumulus_test_runtime::BalancesConfig {
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, 1 << 60))
.collect(),
}),
pallet_sudo: Some(cumulus_test_runtime::SudoConfig { key: root_key }),
},
pallet_sudo: cumulus_test_runtime::SudoConfig { key: root_key },
}
}