This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Remove usage of substrate-test-runtime. #969
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
928697f
Switch from using the substrate_test_runtime Extrinsic to the polkado…
expenses 439b60c
Copy genesismap into test-runtime
expenses 299aad9
Add UncheckedExtrinsics
expenses 14548bc
Fix tests :^)
expenses a47e601
Remove unused functions from genesismap
expenses 1df43e9
DRY, clean up
expenses 50cc5c1
Clean up
expenses 6696061
Update service/src/grandpa_support.rs
expenses 76312fc
Merge remote-tracking branch 'parity/master' into ashley-test-runtime…
expenses a2df14e
Fix indentation
expenses 0ed611b
Update runtime/test-runtime/src/genesismap.rs
bkchr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright 2020 Parity Technologies (UK) Ltd. | ||
// This file is part of Substrate. | ||
|
||
// Substrate 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. | ||
|
||
// Substrate 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 Substrate. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! Tool for creating the genesis block. | ||
|
||
use std::collections::BTreeMap; | ||
use super::{AccountId, WASM_BINARY, constants::currency}; | ||
use sp_core::ChangesTrieConfiguration; | ||
use sp_core::storage::Storage; | ||
use sp_runtime::BuildStorage; | ||
|
||
/// Configuration of a general Substrate test genesis block. | ||
pub struct GenesisConfig { | ||
changes_trie_config: Option<ChangesTrieConfiguration>, | ||
balances: Vec<(AccountId, u128)>, | ||
/// Additional storage key pairs that will be added to the genesis map. | ||
extra_storage: Storage, | ||
} | ||
|
||
impl GenesisConfig { | ||
pub fn new( | ||
changes_trie_config: Option<ChangesTrieConfiguration>, | ||
endowed_accounts: Vec<AccountId>, | ||
balance: u128, | ||
extra_storage: Storage, | ||
) -> Self { | ||
GenesisConfig { | ||
changes_trie_config, | ||
balances: endowed_accounts.into_iter().map(|a| (a, balance * currency::DOLLARS)).collect(), | ||
extra_storage, | ||
} | ||
} | ||
|
||
pub fn genesis_map(&self) -> Storage { | ||
// Assimilate the system genesis config. | ||
let mut storage = Storage { top: BTreeMap::new(), children: self.extra_storage.children.clone()}; | ||
let config = crate::GenesisConfig { | ||
system: Some(system::GenesisConfig { | ||
changes_trie_config: self.changes_trie_config.clone(), | ||
code: WASM_BINARY.to_vec(), | ||
}), | ||
babe: None, | ||
indices: None, | ||
balances: Some(balances::GenesisConfig { | ||
balances: self.balances.clone() | ||
}), | ||
staking: None, | ||
session: None, | ||
grandpa: None, | ||
claims: None, | ||
parachains: None, | ||
registrar: None, | ||
vesting: None, | ||
}; | ||
config.assimilate_storage(&mut storage).expect("Adding `system::GensisConfig` to the genesis"); | ||
|
||
storage | ||
} | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you copy all this code? You don't need it.