mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 01:51:02 +00:00
Collator for the "adder" (formerly basic-add) parachain and various small fixes (#438)
* update basic_add wasm * wasm feature and collator feature * move test parachains around a little * fix wasm build for basic_add * move basic_add to adder, introduce README * minimal basic_add collator * ensure collator messages are sent in the right order * more logging * route consensus statements to all peers * minor bugfixes for parachains * genesis builder accounts for parachain heads * fix parachains tests * targets for txpool * tweak runtime + collator * fix version in adder-collator * consistency for overflowing * adjust comment * fix stable test run * remove dummy registration test * final grumbles
This commit is contained in:
committed by
GitHub
parent
503bcb5686
commit
bd3890da7e
@@ -194,8 +194,8 @@ impl<T: Trait> Executable for Module<T> {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct GenesisConfig<T: Trait> {
|
||||
/// The initial parachains, mapped to code.
|
||||
pub parachains: Vec<(Id, Vec<u8>)>,
|
||||
/// The initial parachains, mapped to code and initial head data
|
||||
pub parachains: Vec<(Id, Vec<u8>, Vec<u8>)>,
|
||||
/// Phantom data.
|
||||
#[serde(skip)]
|
||||
pub phantom: PhantomData<T>,
|
||||
@@ -218,18 +218,21 @@ impl<T: Trait> runtime_primitives::BuildStorage for GenesisConfig<T>
|
||||
use std::collections::HashMap;
|
||||
use codec::Encode;
|
||||
|
||||
self.parachains.sort_unstable_by_key(|&(ref id, _)| id.clone());
|
||||
self.parachains.dedup_by_key(|&mut (ref id, _)| id.clone());
|
||||
self.parachains.sort_unstable_by_key(|&(ref id, _, _)| id.clone());
|
||||
self.parachains.dedup_by_key(|&mut (ref id, _, _)| id.clone());
|
||||
|
||||
let only_ids: Vec<_> = self.parachains.iter().map(|&(ref id, _)| id).cloned().collect();
|
||||
let only_ids: Vec<_> = self.parachains.iter().map(|&(ref id, _, _)| id).cloned().collect();
|
||||
|
||||
let mut map: HashMap<_, _> = map![
|
||||
Self::hash(<Parachains<T>>::key()).to_vec() => only_ids.encode()
|
||||
];
|
||||
|
||||
for (id, code) in self.parachains {
|
||||
let key = Self::hash(&<Code<T>>::key_for(&id)).to_vec();
|
||||
map.insert(key, code.encode());
|
||||
for (id, code, genesis) in self.parachains {
|
||||
let code_key = Self::hash(&<Code<T>>::key_for(&id)).to_vec();
|
||||
let head_key = Self::hash(&<Heads<T>>::key_for(&id)).to_vec();
|
||||
|
||||
map.insert(code_key, code.encode());
|
||||
map.insert(head_key, genesis.encode());
|
||||
}
|
||||
|
||||
Ok(map.into())
|
||||
@@ -280,7 +283,7 @@ mod tests {
|
||||
|
||||
type Parachains = Module<Test>;
|
||||
|
||||
fn new_test_ext(parachains: Vec<(Id, Vec<u8>)>) -> runtime_io::TestExternalities {
|
||||
fn new_test_ext(parachains: Vec<(Id, Vec<u8>, Vec<u8>)>) -> runtime_io::TestExternalities {
|
||||
let mut t = system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
t.extend(consensus::GenesisConfig::<Test>{
|
||||
code: vec![],
|
||||
@@ -301,8 +304,8 @@ mod tests {
|
||||
#[test]
|
||||
fn active_parachains_should_work() {
|
||||
let parachains = vec![
|
||||
(5u32.into(), vec![1,2,3]),
|
||||
(100u32.into(), vec![4,5,6]),
|
||||
(5u32.into(), vec![1,2,3], vec![1]),
|
||||
(100u32.into(), vec![4,5,6], vec![2]),
|
||||
];
|
||||
|
||||
with_externalities(&mut new_test_ext(parachains), || {
|
||||
@@ -315,8 +318,8 @@ mod tests {
|
||||
#[test]
|
||||
fn register_deregister() {
|
||||
let parachains = vec![
|
||||
(5u32.into(), vec![1,2,3]),
|
||||
(100u32.into(), vec![4,5,6]),
|
||||
(5u32.into(), vec![1,2,3], vec![1]),
|
||||
(100u32.into(), vec![4,5,6], vec![2,]),
|
||||
];
|
||||
|
||||
with_externalities(&mut new_test_ext(parachains), || {
|
||||
@@ -340,8 +343,8 @@ mod tests {
|
||||
#[test]
|
||||
fn duty_roster_works() {
|
||||
let parachains = vec![
|
||||
(0u32.into(), vec![]),
|
||||
(1u32.into(), vec![]),
|
||||
(0u32.into(), vec![], vec![]),
|
||||
(1u32.into(), vec![], vec![]),
|
||||
];
|
||||
|
||||
with_externalities(&mut new_test_ext(parachains), || {
|
||||
|
||||
+4
-4
@@ -730,7 +730,7 @@ dependencies = [
|
||||
"substrate-runtime-std 0.1.0",
|
||||
"twox-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uint 0.1.2 (git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm)",
|
||||
"wasmi 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -846,7 +846,7 @@ dependencies = [
|
||||
"substrate-primitives 0.1.0",
|
||||
"substrate-runtime-io 0.1.0",
|
||||
"substrate-runtime-std 0.1.0",
|
||||
"wasmi 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1107,7 +1107,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "wasmi"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1231,7 +1231,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f392d7819dbe58833e26872f5f6f0d68b7bbbe90fc3667e98731c4a15ad9a7ae"
|
||||
"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
|
||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
"checksum wasmi 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b4a6d379e9332b1b1f52c5a87f2481c85c7c931d8ec411963dfb8f26b1ec1e3"
|
||||
"checksum wasmi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "522fe3fdd44a56f25cd5ddcd8ccdb1cf2e982ceb28fcb00f41d8a018ae5245a8"
|
||||
"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user