-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Simple template compiles * Simple template cleanup * Simple template chainspec * Complete build green * fmt * Fix deps * Tests builds * impl GenesisBuilder * Updated polkadot-sdk commit * Missing deps * Unit tests ok! * bring serde regardless of std feature * api-augment * Fix container chain chain spec using set_storage * Merge branch 'master' into fg/polkadot-v1.6.0 * Fix frontier node and identity tests * Fix xcm tests for message queue * use build_storage from emulated_integration_tests * fmt * Update moonkit ref * try-runtime builds * Ts lint * toml maid * merge * fix runtime-benchmarks compilation * try-runtime to pallet-balances * XcmpQueue migrations * Migrations * try-runtime * zepter * toml-maid * Review * try runtime subcommand * MessageQueueServiceWeight to 25% * Unused import * Fix clippy * increase sleep time for first block in parathread * be a bit more mindful about times in parachains * increment even more timeout * Formatting and API augment * Update forks refs * Increase grcov version in coverage * Remove ignores from coverage * Remove ignores from coverage * Revert coverage changes --------- Co-authored-by: girazoki <[email protected]> Co-authored-by: Tomasz Polaczyk <[email protected]>
- Loading branch information
1 parent
3627c47
commit c427348
Showing
108 changed files
with
5,758 additions
and
4,820 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (C) Moondance Labs Ltd. | ||
// This file is part of Tanssi. | ||
|
||
// Tanssi is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Tanssi is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Tanssi. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
use parity_scale_codec::Encode; | ||
use sc_chain_spec::ChainSpec; | ||
use sp_runtime::{ | ||
traits::{Block as BlockT, Hash as HashT, Header as HeaderT, Zero}, | ||
StateVersion, | ||
}; | ||
|
||
/// Generate the genesis block from a given ChainSpec. | ||
pub fn generate_genesis_block<Block: BlockT>( | ||
chain_spec: &dyn ChainSpec, | ||
genesis_state_version: StateVersion, | ||
) -> Result<Block, String> { | ||
let storage = chain_spec.build_storage()?; | ||
|
||
let child_roots = storage.children_default.iter().map(|(sk, child_content)| { | ||
let state_root = <<<Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root( | ||
child_content.data.clone().into_iter().collect(), | ||
genesis_state_version, | ||
); | ||
(sk.clone(), state_root.encode()) | ||
}); | ||
let state_root = <<<Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root( | ||
storage.top.clone().into_iter().chain(child_roots).collect(), | ||
genesis_state_version, | ||
); | ||
|
||
let extrinsics_root = <<<Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root( | ||
Vec::new(), | ||
genesis_state_version, | ||
); | ||
|
||
Ok(Block::new( | ||
<<Block as BlockT>::Header as HeaderT>::new( | ||
Zero::zero(), | ||
extrinsics_root, | ||
state_root, | ||
Default::default(), | ||
Default::default(), | ||
), | ||
Default::default(), | ||
)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,5 @@ | |
// along with Tanssi. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
pub mod service; | ||
|
||
pub mod command; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.