mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 16:57:58 +00:00
Minimal switch of substrate-node to GRANDPA /Aura (#1128)
* add beginnings of SRML grandpa library * get srml-grandpa compiling * tests for srml-grandpa * add optional session integration to grandpa SRML * start integration into node runtime * Allow extracting pending change from header digest * Make it compile on wasm * make tests compile again * Move Authority Key fetching into service, simplify service factory construction * Generalize Authority Consensus Setup system * Add Authority Setup Docs * Allow CLI params to be extensible - move params to structopts - split parsing and default command execution - add custom config to node - extended parsing of custom config - extending params via structop's flatten * Minor fixes on cli extension params: - added docs - re-add actual app name, rather than node-name - make strategy and subcommand optional * better cli params * synchronize GRANDPA and normal node authorities * Implement grandpa::network for gossip consensus * run_grandpa in Node * Fix missed merge error * Integrate grandpa import queue * more specific type def * link up linkhalf and import block * make grandpa future send * get compiling * Fix new params convention and license header * get it running * rebuild node runtime WASM * change logging level * Update node/cli/src/params.rs Co-Authored-By: rphmeier <rphmeier@gmail.com> * Update node/cli/src/params.rs Co-Authored-By: rphmeier <rphmeier@gmail.com> * Update node/cli/src/lib.rs Co-Authored-By: rphmeier <rphmeier@gmail.com> * Update node/runtime/src/lib.rs Co-Authored-By: rphmeier <rphmeier@gmail.com> * Update node/cli/src/lib.rs Co-Authored-By: rphmeier <rphmeier@gmail.com> * Clean up and Fixme for mutable config * Move GrandpaService Integration into grandpa, feature gated but on per default * Fixing grandpa runtime module test * Update wasm runtime hashes for tests * GRANDPA: use post-header hash when logging scheduled changes * add an extra bit of logging to authorities * fixing missing constrain * remove old code * move `NewAuthorities` to an event in srml-grandpa * fix node-executor tests to use grandpa log * Remove GossipConsensus from tests, use newly provided sync-feature, fixes tests * Update to latest wasm runtimes * address grumbles * address grumbles * only derive deserialize when using std * Clean up use of Deserialize
This commit is contained in:
committed by
GitHub
parent
84da9d4a02
commit
11fe84a742
@@ -36,6 +36,7 @@ extern crate node_runtime;
|
||||
#[cfg(test)] extern crate srml_timestamp as timestamp;
|
||||
#[cfg(test)] extern crate srml_treasury as treasury;
|
||||
#[cfg(test)] extern crate srml_contract as contract;
|
||||
#[cfg(test)] extern crate srml_grandpa as grandpa;
|
||||
#[cfg(test)] extern crate node_primitives;
|
||||
#[cfg(test)] extern crate parity_codec as codec;
|
||||
#[cfg(test)] extern crate sr_io as runtime_io;
|
||||
@@ -66,7 +67,7 @@ mod tests {
|
||||
use system::{EventRecord, Phase};
|
||||
use node_runtime::{Header, Block, UncheckedExtrinsic, CheckedExtrinsic, Call, Runtime, Balances,
|
||||
BuildStorage, GenesisConfig, BalancesConfig, SessionConfig, StakingConfig, System,
|
||||
SystemConfig, Event, Log};
|
||||
SystemConfig, GrandpaConfig, Event, Log};
|
||||
use wabt;
|
||||
|
||||
const BLOATY_CODE: &[u8] = include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.wasm");
|
||||
@@ -262,14 +263,26 @@ mod tests {
|
||||
treasury: Some(Default::default()),
|
||||
contract: Some(Default::default()),
|
||||
upgrade_key: Some(Default::default()),
|
||||
grandpa: Some(GrandpaConfig {
|
||||
authorities: vec![ // set these so no GRANDPA events fire when session changes
|
||||
(Alice.to_raw_public().into(), 1),
|
||||
(Bob.to_raw_public().into(), 1),
|
||||
(Charlie.to_raw_public().into(), 1),
|
||||
],
|
||||
_genesis_phantom_data: Default::default(),
|
||||
}),
|
||||
}.build_storage().unwrap().0)
|
||||
}
|
||||
|
||||
fn changes_trie_log(changes_root: Hash) -> Log {
|
||||
Log::from(system::RawLog::ChangesTrieRoot::<Hash>(changes_root))
|
||||
}
|
||||
|
||||
fn construct_block(
|
||||
number: BlockNumber,
|
||||
parent_hash: Hash,
|
||||
state_root: Hash,
|
||||
changes_root: Option<Hash>,
|
||||
logs: Vec<Log>,
|
||||
extrinsics: Vec<CheckedExtrinsic>
|
||||
) -> (Vec<u8>, Hash) {
|
||||
use trie::ordered_trie_root;
|
||||
@@ -281,8 +294,8 @@ mod tests {
|
||||
.into();
|
||||
|
||||
let mut digest = generic::Digest::<Log>::default();
|
||||
if let Some(changes_root) = changes_root {
|
||||
digest.push(Log::from(system::RawLog::ChangesTrieRoot::<Hash>(changes_root)));
|
||||
for item in logs {
|
||||
digest.push(item);
|
||||
}
|
||||
|
||||
let header = Header {
|
||||
@@ -302,14 +315,16 @@ mod tests {
|
||||
1,
|
||||
GENESIS_HASH.into(),
|
||||
if support_changes_trie {
|
||||
hex!("a998cf2956b526aecc0887903df66457e640bb2debfd7976b5c7696da31cdaef").into()
|
||||
hex!("df90128fe9ee27bd61d90308cc25ad262e518d4ba09e5077558be2389780d8e5").into()
|
||||
} else {
|
||||
hex!("2caffd5fcc42934e6b758613ff0a7e624a8c5b7c67b7c405bf6985a7e3a19701").into()
|
||||
hex!("3cb0654b6c47c6532108695327fc68e22f2e67a4b20029c3c9d05a285f9e80a2").into()
|
||||
},
|
||||
if support_changes_trie {
|
||||
Some(hex!("1f8f44dcae8982350c14dee720d34b147e73279f5a2ce1f9781195a991970978").into())
|
||||
vec![changes_trie_log(
|
||||
hex!("1f8f44dcae8982350c14dee720d34b147e73279f5a2ce1f9781195a991970978").into(),
|
||||
)]
|
||||
} else {
|
||||
None
|
||||
vec![]
|
||||
},
|
||||
vec![
|
||||
CheckedExtrinsic {
|
||||
@@ -328,8 +343,14 @@ mod tests {
|
||||
construct_block(
|
||||
2,
|
||||
block1(false).1,
|
||||
hex!("72b2afc379ce2161aef95ef6f86a2321867f12b046703ea0af5aed158c2a4f30").into(),
|
||||
None,
|
||||
hex!("612d3e3c542b4ce62105f2f1fbc4fef1652d5ba38401795115042bee56a50752").into(),
|
||||
vec![ // session changes here, so we add a grandpa change signal log.
|
||||
Log::from(::grandpa::RawLog::AuthoritiesChangeSignal(0, vec![
|
||||
(Keyring::One.to_raw_public().into(), 1),
|
||||
(Keyring::Two.to_raw_public().into(), 1),
|
||||
([3u8; 32].into(), 1),
|
||||
]))
|
||||
],
|
||||
vec![
|
||||
CheckedExtrinsic {
|
||||
signed: None,
|
||||
@@ -351,8 +372,8 @@ mod tests {
|
||||
construct_block(
|
||||
1,
|
||||
GENESIS_HASH.into(),
|
||||
hex!("5f4461c584ce91dd6862313fd075ffc26dc702fcc1183634ee7b0c5de8b5b4d1").into(),
|
||||
None,
|
||||
hex!("17df8f360a4a1bd8d5dc23f05b044f5b14ece43555f97d2058ded47d5e7fb64d").into(),
|
||||
vec![],
|
||||
vec![
|
||||
CheckedExtrinsic {
|
||||
signed: None,
|
||||
@@ -460,6 +481,14 @@ mod tests {
|
||||
phase: Phase::Finalization,
|
||||
event: Event::staking(staking::RawEvent::Reward(0))
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
event: Event::grandpa(::grandpa::RawEvent::NewAuthorities(vec![
|
||||
(Keyring::One.to_raw_public().into(), 1),
|
||||
(Keyring::Two.to_raw_public().into(), 1),
|
||||
([3u8; 32].into(), 1),
|
||||
])),
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
event: Event::treasury(treasury::RawEvent::Spending(0))
|
||||
@@ -633,8 +662,8 @@ mod tests {
|
||||
let b = construct_block(
|
||||
1,
|
||||
GENESIS_HASH.into(),
|
||||
hex!("9885d4297ce0341ec07957d1de32848460565a17ef2ea400df0e2326634914ae").into(),
|
||||
None,
|
||||
hex!("81f45b36d1c8f667ac948bc48f8fb61d12aae87d841b6303ab0320ca906d01d2").into(),
|
||||
vec![],
|
||||
vec![
|
||||
CheckedExtrinsic {
|
||||
signed: None,
|
||||
|
||||
Reference in New Issue
Block a user