mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-01 10:07:24 +00:00
Remove Parent Hash to Session mapping (#928)
* Adds a SigningContext type * Bump spec versions * Fixes requested changes * Bump ParachainHost api_version and guard signing_context call * Improve error message * If there is no signing_context api use default value Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
This commit is contained in:
@@ -162,7 +162,6 @@ impl NetworkServiceOps for PolkadotNetworkService {
|
||||
trait GossipOps: Clone + Send + crate::legacy::GossipService + 'static {
|
||||
fn new_local_leaf(
|
||||
&self,
|
||||
relay_parent: Hash,
|
||||
validation_data: crate::legacy::gossip::MessageValidationData,
|
||||
) -> crate::legacy::gossip::NewLeafActions;
|
||||
|
||||
@@ -177,10 +176,12 @@ trait GossipOps: Clone + Send + crate::legacy::GossipService + 'static {
|
||||
impl GossipOps for RegisteredMessageValidator {
|
||||
fn new_local_leaf(
|
||||
&self,
|
||||
relay_parent: Hash,
|
||||
validation_data: crate::legacy::gossip::MessageValidationData,
|
||||
) -> crate::legacy::gossip::NewLeafActions {
|
||||
RegisteredMessageValidator::new_local_leaf(self, relay_parent, validation_data)
|
||||
RegisteredMessageValidator::new_local_leaf(
|
||||
self,
|
||||
validation_data,
|
||||
)
|
||||
}
|
||||
|
||||
fn register_availability_store(
|
||||
@@ -804,7 +805,6 @@ impl<Api, Sp, Gossip> Worker<Api, Sp, Gossip> where
|
||||
authorities: Vec<ValidatorId>,
|
||||
) {
|
||||
// glue: let gossip know about our new local leaf.
|
||||
let relay_parent = table.consensus_parent_hash().clone();
|
||||
let (signal, exit) = exit_future::signal();
|
||||
|
||||
let key = table.session_key();
|
||||
@@ -814,19 +814,20 @@ impl<Api, Sp, Gossip> Worker<Api, Sp, Gossip> where
|
||||
}
|
||||
}
|
||||
|
||||
let signing_context = table.signing_context().clone();
|
||||
let relay_parent = signing_context.parent_hash.clone();
|
||||
let new_leaf_actions = self.gossip_handle.new_local_leaf(
|
||||
relay_parent,
|
||||
crate::legacy::gossip::MessageValidationData { authorities },
|
||||
crate::legacy::gossip::MessageValidationData { authorities, signing_context },
|
||||
);
|
||||
|
||||
new_leaf_actions.perform(&self.gossip_handle);
|
||||
|
||||
self.protocol_handler.consensus_instances.insert(
|
||||
relay_parent,
|
||||
relay_parent.clone(),
|
||||
ConsensusNetworkingInstance {
|
||||
statement_table: table.clone(),
|
||||
relay_parent,
|
||||
attestation_topic: crate::legacy::gossip::attestation_topic(relay_parent),
|
||||
relay_parent: relay_parent.clone(),
|
||||
attestation_topic: crate::legacy::gossip::attestation_topic(relay_parent.clone()),
|
||||
_drop_signal: signal,
|
||||
},
|
||||
);
|
||||
@@ -1324,7 +1325,7 @@ impl ParachainNetwork for Service {
|
||||
) -> Self::BuildTableRouter {
|
||||
let authorities = authorities.to_vec();
|
||||
let mut sender = self.sender.clone();
|
||||
let relay_parent = table.consensus_parent_hash().clone();
|
||||
let relay_parent = table.signing_context().parent_hash.clone();
|
||||
|
||||
Box::pin(async move {
|
||||
sender.send(
|
||||
|
||||
@@ -20,7 +20,7 @@ use polkadot_primitives::{Block, Header, BlockId};
|
||||
use polkadot_primitives::parachain::{
|
||||
Id as ParaId, Chain, DutyRoster, ParachainHost, ValidatorId,
|
||||
Retriable, CollatorId, AbridgedCandidateReceipt,
|
||||
GlobalValidationSchedule, LocalValidationData, ErasureChunk,
|
||||
GlobalValidationSchedule, LocalValidationData, ErasureChunk, SigningContext,
|
||||
};
|
||||
use polkadot_validation::SharedTable;
|
||||
|
||||
@@ -114,7 +114,6 @@ impl crate::legacy::GossipService for MockGossip {
|
||||
impl GossipOps for MockGossip {
|
||||
fn new_local_leaf(
|
||||
&self,
|
||||
_relay_parent: Hash,
|
||||
_validation_data: crate::legacy::gossip::MessageValidationData,
|
||||
) -> crate::legacy::gossip::NewLeafActions {
|
||||
crate::legacy::gossip::NewLeafActions::new()
|
||||
@@ -294,6 +293,22 @@ impl ParachainHost<Block> for RuntimeApi {
|
||||
) -> ClientResult<NativeOrEncoded<Option<Vec<AbridgedCandidateReceipt>>>> {
|
||||
Ok(NativeOrEncoded::Native(Some(Vec::new())))
|
||||
}
|
||||
|
||||
fn ParachainHost_signing_context_runtime_api_impl(
|
||||
&self,
|
||||
_at: &BlockId,
|
||||
_: ExecutionContext,
|
||||
_: Option<()>,
|
||||
_: Vec<u8>,
|
||||
) -> ClientResult<NativeOrEncoded<SigningContext>> {
|
||||
Ok(NativeOrEncoded::Native(
|
||||
SigningContext {
|
||||
session_index: Default::default(),
|
||||
parent_hash: Default::default(),
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl super::Service {
|
||||
@@ -389,11 +404,15 @@ fn consensus_instances_cleaned_up() {
|
||||
let relay_parent = [0; 32].into();
|
||||
let authorities = Vec::new();
|
||||
|
||||
let signing_context = SigningContext {
|
||||
session_index: Default::default(),
|
||||
parent_hash: relay_parent,
|
||||
};
|
||||
let table = Arc::new(SharedTable::new(
|
||||
Vec::new(),
|
||||
HashMap::new(),
|
||||
None,
|
||||
relay_parent,
|
||||
signing_context,
|
||||
AvailabilityStore::new_in_memory(service.clone()),
|
||||
None,
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user