mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 23:31:07 +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
@@ -58,31 +58,23 @@ impl ExecuteInContext<Block> for DummyContextExecutor {
|
||||
}
|
||||
|
||||
/// The test specialization.
|
||||
pub struct DummySpecialization {
|
||||
/// Consensus gossip handle.
|
||||
pub gossip: ConsensusGossip<Block>,
|
||||
}
|
||||
pub struct DummySpecialization { }
|
||||
|
||||
impl NetworkSpecialization<Block> for DummySpecialization {
|
||||
fn status(&self) -> Vec<u8> { vec![] }
|
||||
|
||||
fn on_connect(&mut self, ctx: &mut Context<Block>, peer_id: NodeIndex, status: ::message::Status<Block>) {
|
||||
self.gossip.new_peer(ctx, peer_id, status.roles);
|
||||
fn on_connect(&mut self, _ctx: &mut Context<Block>, _peer_id: NodeIndex, _status: ::message::Status<Block>) {
|
||||
}
|
||||
|
||||
fn on_disconnect(&mut self, ctx: &mut Context<Block>, peer_id: NodeIndex) {
|
||||
self.gossip.peer_disconnected(ctx, peer_id);
|
||||
fn on_disconnect(&mut self, _ctx: &mut Context<Block>, _peer_id: NodeIndex) {
|
||||
}
|
||||
|
||||
fn on_message(
|
||||
&mut self,
|
||||
ctx: &mut Context<Block>,
|
||||
peer_id: NodeIndex,
|
||||
message: &mut Option<::message::Message<Block>>
|
||||
_ctx: &mut Context<Block>,
|
||||
_peer_id: NodeIndex,
|
||||
_message: &mut Option<::message::Message<Block>>
|
||||
) {
|
||||
if let Some(::message::generic::Message::Consensus(topic, data)) = message.take() {
|
||||
self.gossip.on_incoming(ctx, peer_id, topic, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,6 +171,10 @@ impl<V: 'static + Verifier<Block>, D> Peer<V, D> {
|
||||
self.sync.on_peer_connected(&mut TestIo::new(&self.queue, Some(other)), other);
|
||||
}
|
||||
|
||||
pub fn consensus_gossip(&self) -> &RwLock<ConsensusGossip<Block>> {
|
||||
self.sync.consensus_gossip()
|
||||
}
|
||||
|
||||
/// Called on disconnect from other indicated peer.
|
||||
fn on_disconnect(&self, other: NodeIndex) {
|
||||
let mut io = TestIo::new(&self.queue, Some(other));
|
||||
@@ -233,9 +229,10 @@ impl<V: 'static + Verifier<Block>, D> Peer<V, D> {
|
||||
/// Push a message into the gossip network and relay to peers.
|
||||
/// `TestNet::sync_step` needs to be called to ensure it's propagated.
|
||||
pub fn gossip_message(&self, topic: Hash, data: Vec<u8>) {
|
||||
self.sync.with_spec(&mut TestIo::new(&self.queue, None), |spec, ctx| {
|
||||
spec.gossip.multicast(ctx, topic, data);
|
||||
})
|
||||
let gossip = self.sync.consensus_gossip();
|
||||
self.sync.with_spec(&mut TestIo::new(&self.queue, None), move |_s, context|{
|
||||
gossip.write().multicast(context, topic, data);
|
||||
});
|
||||
}
|
||||
|
||||
/// Add blocks to the peer -- edit the block before adding
|
||||
@@ -363,9 +360,7 @@ pub trait TestNetFactory: Sized {
|
||||
let (block_import, data) = self.make_block_import(client.clone());
|
||||
|
||||
let import_queue = Arc::new(SyncImportQueue::new(verifier, block_import));
|
||||
let specialization = DummySpecialization {
|
||||
gossip: ConsensusGossip::new(),
|
||||
};
|
||||
let specialization = DummySpecialization { };
|
||||
let sync = Protocol::new(
|
||||
config.clone(),
|
||||
client.clone(),
|
||||
|
||||
Reference in New Issue
Block a user