mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
chain-spec: getting ready for native-runtime-free world (#1256)
This PR prepares chains specs for _native-runtime-free_ world. This PR has following changes: - `substrate`: - adds support for: - JSON based `GenesisConfig` to `ChainSpec` allowing interaction with runtime `GenesisBuilder` API. - interacting with arbitrary runtime wasm blob to[ `chain-spec-builder`](https://github.com/paritytech/substrate/blob/3ef576eaeb3f42610e85daecc464961cf1295570/bin/utils/chain-spec-builder/src/lib.rs#L46) command line util, - removes [`code`](https://github.com/paritytech/substrate/blob/3ef576eaeb3f42610e85daecc464961cf1295570/frame/system/src/lib.rs#L660) from `system_pallet` - adds `code` to the `ChainSpec` - deprecates [`ChainSpec::from_genesis`](https://github.com/paritytech/substrate/blob/3ef576eaeb3f42610e85daecc464961cf1295570/client/chain-spec/src/chain_spec.rs#L263), but also changes the signature of this method extending it with `code` argument. [`ChainSpec::builder()`](https://github.com/paritytech/substrate/blob/20bee680ed098be7239cf7a6b804cd4de267983e/client/chain-spec/src/chain_spec.rs#L507) should be used instead. - `polkadot`: - all references to `RuntimeGenesisConfig` in `node/service` are removed, - all `(kusama|polkadot|versi|rococo|wococo)_(staging|dev)_genesis_config` functions now return the JSON patch for default runtime `GenesisConfig`, - `ChainSpecBuilder` is used, `ChainSpec::from_genesis` is removed, - `cumulus`: - `ChainSpecBuilder` is used, `ChainSpec::from_genesis` is removed, - _JSON_ patch configuration used instead of `RuntimeGenesisConfig struct` in all chain specs. --------- Co-authored-by: command-bot <> Co-authored-by: Javier Viola <javier@parity.io> Co-authored-by: Davide Galassi <davxy@datawok.net> Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com> Co-authored-by: Kevin Krone <kevin@parity.io> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
committed by
GitHub
parent
c46a7dbb61
commit
8ba7a6aba8
@@ -857,3 +857,19 @@ fn should_import_block_with_test_client() {
|
||||
|
||||
futures::executor::block_on(client.import(BlockOrigin::Own, block)).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_config_as_json_works() {
|
||||
let mut t = new_test_ext(compact_code_unwrap());
|
||||
let r = executor_call(&mut t, "GenesisBuilder_create_default_config", &vec![], false)
|
||||
.0
|
||||
.unwrap();
|
||||
let r = Vec::<u8>::decode(&mut &r[..]).unwrap();
|
||||
let json = String::from_utf8(r.into()).expect("returned value is json. qed.");
|
||||
let expected = include_str!("res/default_genesis_config.json").to_string();
|
||||
|
||||
assert_eq!(
|
||||
serde_json::from_str::<serde_json::Value>(&expected).unwrap(),
|
||||
serde_json::from_str::<serde_json::Value>(&json).unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ pub fn executor_call(
|
||||
pub fn new_test_ext(code: &[u8]) -> TestExternalities<BlakeTwo256> {
|
||||
let ext = TestExternalities::new_with_code(
|
||||
code,
|
||||
node_testing::genesis::config(Some(code)).build_storage().unwrap(),
|
||||
node_testing::genesis::config().build_storage().unwrap(),
|
||||
);
|
||||
ext
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
{
|
||||
"system": {},
|
||||
"babe": {
|
||||
"authorities": [],
|
||||
"epochConfig": null
|
||||
},
|
||||
"indices": {
|
||||
"indices": []
|
||||
},
|
||||
"balances": {
|
||||
"balances": []
|
||||
},
|
||||
"transactionPayment": {
|
||||
"multiplier": "1000000000000000000"
|
||||
},
|
||||
"staking": {
|
||||
"validatorCount": 0,
|
||||
"minimumValidatorCount": 0,
|
||||
"invulnerables": [],
|
||||
"forceEra": "NotForcing",
|
||||
"slashRewardFraction": 0,
|
||||
"canceledPayout": 0,
|
||||
"stakers": [],
|
||||
"minNominatorBond": 0,
|
||||
"minValidatorBond": 0,
|
||||
"maxValidatorCount": null,
|
||||
"maxNominatorCount": null
|
||||
},
|
||||
"session": {
|
||||
"keys": []
|
||||
},
|
||||
"democracy": {},
|
||||
"council": {
|
||||
"members": []
|
||||
},
|
||||
"technicalCommittee": {
|
||||
"members": []
|
||||
},
|
||||
"elections": {
|
||||
"members": []
|
||||
},
|
||||
"technicalMembership": {
|
||||
"members": []
|
||||
},
|
||||
"grandpa": {
|
||||
"authorities": []
|
||||
},
|
||||
"treasury": {},
|
||||
"sudo": {
|
||||
"key": null
|
||||
},
|
||||
"imOnline": {
|
||||
"keys": []
|
||||
},
|
||||
"authorityDiscovery": {
|
||||
"keys": []
|
||||
},
|
||||
"society": {
|
||||
"pot": 0
|
||||
},
|
||||
"vesting": {
|
||||
"vesting": []
|
||||
},
|
||||
"glutton": {
|
||||
"compute": "0",
|
||||
"storage": "0",
|
||||
"trashDataCount": 0
|
||||
},
|
||||
"assets": {
|
||||
"assets": [],
|
||||
"metadata": [],
|
||||
"accounts": []
|
||||
},
|
||||
"poolAssets": {
|
||||
"assets": [],
|
||||
"metadata": [],
|
||||
"accounts": []
|
||||
},
|
||||
"transactionStorage": {
|
||||
"byteFee": 10,
|
||||
"entryFee": 1000,
|
||||
"storagePeriod": 100800
|
||||
},
|
||||
"allianceMotion": {
|
||||
"members": []
|
||||
},
|
||||
"alliance": {
|
||||
"fellows": [],
|
||||
"allies": []
|
||||
},
|
||||
"mixnet": {
|
||||
"mixnodes": []
|
||||
},
|
||||
"nominationPools": {
|
||||
"minJoinBond": 0,
|
||||
"minCreateBond": 0,
|
||||
"maxPools": 16,
|
||||
"maxMembersPerPool": 32,
|
||||
"maxMembers": 512,
|
||||
"globalMaxCommission": null
|
||||
},
|
||||
"txPause": {
|
||||
"paused": []
|
||||
},
|
||||
"safeMode": {
|
||||
"enteredUntil": null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user