diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 88c0b827..0582a549 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -149,7 +149,9 @@ pub fn genesis_config() -> ChainSpec { parachain_info: ParachainInfoConfig { parachain_id: 2105.into() }, // Monetary stuff. - balances: Default::default(), + balances: BalancesConfig { + balances: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], + }, transaction_payment: Default::default(), assets: AssetsConfig { assets: vec![(AssetIds::CKton as _, ROOT, true, 1)], @@ -167,7 +169,7 @@ pub fn genesis_config() -> ChainSpec { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, collator_count: 3, - collators: Vec::new(), + collators: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], }, session: SessionConfig { keys: vec![( diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 65d80f48..4b19167d 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -149,7 +149,9 @@ pub fn genesis_config() -> ChainSpec { parachain_info: ParachainInfoConfig { parachain_id: 2046.into() }, // Monetary stuff. - balances: Default::default(), + balances: BalancesConfig { + balances: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], + }, transaction_payment: Default::default(), assets: AssetsConfig { assets: vec![(AssetIds::Kton as _, ROOT, true, 1)], @@ -167,7 +169,7 @@ pub fn genesis_config() -> ChainSpec { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, collator_count: 3, - collators: Vec::new(), + collators: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], }, session: SessionConfig { keys: vec![( diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 50164a3a..5241b95c 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -149,7 +149,9 @@ pub fn genesis_config() -> ChainSpec { parachain_info: ParachainInfoConfig { parachain_id: 2105.into() }, // Monetary stuff. - balances: Default::default(), + balances: BalancesConfig { + balances: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], + }, transaction_payment: Default::default(), assets: AssetsConfig { assets: vec![(AssetIds::PKton as _, ROOT, true, 1)], @@ -167,7 +169,7 @@ pub fn genesis_config() -> ChainSpec { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, collator_count: 3, - collators: Vec::new(), + collators: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], }, session: SessionConfig { keys: vec![( diff --git a/tool/state-processor/Cargo.lock b/tool/state-processor/Cargo.lock index 145cc807..3b052ae9 100644 --- a/tool/state-processor/Cargo.lock +++ b/tool/state-processor/Cargo.lock @@ -19,9 +19,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" [[package]] name = "array-bytes" @@ -329,9 +329,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "jobserver" @@ -353,9 +353,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.138" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "log" @@ -389,9 +389,9 @@ checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "once_cell" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "parity-scale-codec" @@ -465,9 +465,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" dependencies = [ "unicode-ident", ] @@ -480,9 +480,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -584,9 +584,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "sct" @@ -600,18 +600,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.150" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.150" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -620,9 +620,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" dependencies = [ "itoa", "ryu", @@ -677,7 +677,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "subhasher" version = "0.9.0-rc20" -source = "git+https://github.com/hack-ink/subalfred#4514b3728e2a8250354ea6dc4a3b12f79f436419" +source = "git+https://github.com/hack-ink/subalfred#f1a80ef1a41111d2cd85dc08db1726d1f6c98bab" dependencies = [ "blake2-rfc", "byteorder", @@ -689,7 +689,7 @@ dependencies = [ [[package]] name = "subspector" version = "0.9.0-rc20" -source = "git+https://github.com/hack-ink/subalfred#4514b3728e2a8250354ea6dc4a3b12f79f436419" +source = "git+https://github.com/hack-ink/subalfred#f1a80ef1a41111d2cd85dc08db1726d1f6c98bab" dependencies = [ "fxhash", "serde", @@ -699,7 +699,7 @@ dependencies = [ [[package]] name = "substorager" version = "0.9.0-rc20" -source = "git+https://github.com/hack-ink/subalfred#4514b3728e2a8250354ea6dc4a3b12f79f436419" +source = "git+https://github.com/hack-ink/subalfred#f1a80ef1a41111d2cd85dc08db1726d1f6c98bab" dependencies = [ "array-bytes", "subhasher", @@ -707,9 +707,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", @@ -744,18 +744,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", @@ -832,9 +832,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index fd9df8d2..e29387ed 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -34,7 +34,7 @@ fn main() -> Result<()> { // >::new()?.process()?; // >::new()?.process()?; - >::new()?.process()?; + >::new()?.test().process()?; Ok(()) } diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs index 07efbcda..208ca8a5 100644 --- a/tool/state-processor/src/processor.rs +++ b/tool/state-processor/src/processor.rs @@ -14,6 +14,7 @@ use fxhash::FxHashMap; use once_cell::sync::Lazy; use parity_scale_codec::{Decode, Encode}; use serde::de::DeserializeOwned; +use serde_json::Value; // hack-ink use subspector::ChainSpec; @@ -26,6 +27,7 @@ pub struct Processor { pub para_state: State<()>, pub shell_state: State<()>, pub shell_chain_spec: ChainSpec, + pub test: bool, } impl Processor where @@ -45,9 +47,16 @@ where _runtime: Default::default(), }, shell_chain_spec, + test: false, }) } + pub fn test(mut self) -> Self { + self.test = true; + + self + } + pub fn process(mut self) -> Result<()> { self.solo_state.get_value(b"System", b"Number", "", &mut *NOW.write().unwrap()); @@ -71,6 +80,10 @@ where mem::swap(&mut self.shell_state.map, &mut self.shell_chain_spec.genesis.raw.top); + if self.test { + self.shell_chain_spec.extensions["relay_chain"] = Value::String("rococo-local".into()); + } + let mut f = File::create(format!("data/{}-processed.json", S::NAME))?; let v = serde_json::to_vec(&self.shell_chain_spec)?; diff --git a/tool/state-processor/src/util.rs b/tool/state-processor/src/util.rs index ec3365fe..d9948920 100644 --- a/tool/state-processor/src/util.rs +++ b/tool/state-processor/src/util.rs @@ -1,6 +1,7 @@ // std use std::{ fs::File, + path::Path, process::{Command, Stdio}, }; // crates.io @@ -68,8 +69,20 @@ pub fn is_evm_address(address: &[u8]) -> bool { } pub fn build_spec(chain: &str) -> Result<()> { - Command::new("../../target/release/darwinia") - .args(["build-spec", "--chain", &format!("{chain}-genesis")]) + let mut path = "../../target/release/darwinia"; + + if !Path::new(path).is_file() { + path = "../../target/x86_64-unknown-linux-gnu/release/darwinia"; + } + + Command::new(path) + .args([ + "build-spec", + "--raw", + "--disable-default-bootnode", + "--chain", + &format!("{chain}-genesis"), + ]) .stdout(Stdio::from(File::create(format!("data/{chain}-shell.json"))?)) .output()?;