Unverified Commit 710f4cae authored by Fedor Sakharov's avatar Fedor Sakharov Committed by GitHub
Browse files

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: asynchronous rob's avatarRobert Habermeier <rphmeier@gmail.com>
parent 5f37995e
Pipeline #84829 failed with stages
in 6 minutes and 7 seconds
......@@ -3956,6 +3956,7 @@ dependencies = [
"sp-inherents 2.0.0-alpha.5 (git+https://github.com/paritytech/substrate)",
"sp-runtime 2.0.0-alpha.5 (git+https://github.com/paritytech/substrate)",
"sp-serializer 2.0.0-alpha.5 (git+https://github.com/paritytech/substrate)",
"sp-staking 2.0.0-alpha.5 (git+https://github.com/paritytech/substrate)",
"sp-std 2.0.0-alpha.5 (git+https://github.com/paritytech/substrate)",
"sp-trie 2.0.0-alpha.5 (git+https://github.com/paritytech/substrate)",
"sp-version 2.0.0-alpha.5 (git+https://github.com/paritytech/substrate)",
......
......@@ -131,9 +131,13 @@ impl View {
///
/// This will be pruned later on a call to `prune_old_leaves`, when this leaf
/// is not a leaf anymore.
pub(super) fn new_local_leaf(&mut self, relay_chain_leaf: Hash, validation_data: MessageValidationData) {
pub(super) fn new_local_leaf(
&mut self,
validation_data: MessageValidationData,
) {
let relay_chain_leaf = validation_data.signing_context.parent_hash.clone();
self.leaf_work.push((
relay_chain_leaf,
validation_data.signing_context.parent_hash.clone(),
LeafView {
validation_data,
knowledge: Default::default(),
......@@ -207,7 +211,6 @@ impl View {
// validate signature.
let res = view.validation_data.check_statement(
&message.relay_chain_leaf,
&message.signed_statement,
);
......
......@@ -60,7 +60,7 @@ use sc_network_gossip::{
use polkadot_validation::{SignedStatement};
use polkadot_primitives::{Block, Hash};
use polkadot_primitives::parachain::{
ParachainHost, ValidatorId, ErasureChunk as PrimitiveChunk
ParachainHost, ValidatorId, ErasureChunk as PrimitiveChunk, SigningContext,
};
use polkadot_erasure_coding::{self as erasure};
use codec::{Decode, Encode};
......@@ -377,13 +377,12 @@ impl RegisteredMessageValidator {
/// relevant to this leaf.
pub(crate) fn new_local_leaf(
&self,
relay_chain_leaf: Hash,
validation: MessageValidationData,
) -> NewLeafActions {
// add an entry in attestation_view
// prune any entries from attestation_view which are no longer leaves
let mut inner = self.inner.inner.write();
inner.attestation_view.new_local_leaf(relay_chain_leaf, validation);
inner.attestation_view.new_local_leaf(validation);
let mut actions = Vec::new();
......@@ -460,11 +459,13 @@ impl GossipService for RegisteredMessageValidator {
pub(crate) struct MessageValidationData {
/// The authorities' parachain validation keys at a block.
pub(crate) authorities: Vec<ValidatorId>,
/// The signing context.
pub(crate) signing_context: SigningContext,
}
impl MessageValidationData {
// check a statement's signature.
fn check_statement(&self, relay_chain_leaf: &Hash, statement: &SignedStatement) -> Result<(), ()> {
fn check_statement(&self, statement: &SignedStatement) -> Result<(), ()> {
let sender = match self.authorities.get(statement.sender as usize) {
Some(val) => val,
None => return Err(()),
......@@ -475,7 +476,7 @@ impl MessageValidationData {
&statement.statement,
&statement.signature,
sender.clone(),
relay_chain_leaf,
&self.signing_context,
);
if good {
......@@ -826,7 +827,9 @@ mod tests {
let topic_c = attestation_topic(hash_c);
// topic_a is in all 3 views -> succeed
validator.inner.write().attestation_view.new_local_leaf(hash_a, MessageValidationData::default());
let mut validation_data = MessageValidationData::default();
validation_data.signing_context.parent_hash = hash_a;
validator.inner.write().attestation_view.new_local_leaf(validation_data);
// topic_b is in the neighbor's view but not ours -> fail
// topic_c is not in either -> fail
......@@ -937,7 +940,9 @@ mod tests {
}
});
let encoded = statement.encode();
validator.inner.write().attestation_view.new_local_leaf(hash_a, MessageValidationData::default());
let mut validation_data = MessageValidationData::default();
validation_data.signing_context.parent_hash = hash_a;
validator.inner.write().attestation_view.new_local_leaf(validation_data);
{
let mut message_allowed = validator.message_allowed();
......
......@@ -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,
));
......
......@@ -13,6 +13,7 @@ application-crypto = { package = "sp-application-crypto", git = "https://github.
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
runtime_primitives = { package = "sp-runtime", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
polkadot-parachain = { path = "../parachain", default-features = false }
trie = { package = "sp-trie", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
......@@ -33,6 +34,7 @@ std = [
"sp-api/std",
"sp-std/std",
"sp-version/std",
"sp-staking/std",
"runtime_primitives/std",
"serde",
"polkadot-parachain/std",
......
......@@ -608,6 +608,15 @@ pub enum ValidityAttestation {
Explicit(ValidatorSignature),
}
/// A type returned by runtime with current session index and a parent hash.
#[derive(Clone, Eq, PartialEq, Default, Decode, Encode, RuntimeDebug)]
pub struct SigningContext {
/// Current session index.
pub session_index: sp_staking::SessionIndex,
/// Hash of the parent.
pub parent_hash: Hash,
}
/// An attested candidate. This is submitted to the relay chain by a block author.
#[derive(Clone, PartialEq, Decode, Encode, RuntimeDebug)]
pub struct AttestedCandidate {
......@@ -655,7 +664,7 @@ impl FeeSchedule {
sp_api::decl_runtime_apis! {
/// The API for querying the state of parachains on-chain.
#[api_version(2)]
#[api_version(3)]
pub trait ParachainHost {
/// Get the current validators.
fn validators() -> Vec<ValidatorId>;
......@@ -673,6 +682,8 @@ sp_api::decl_runtime_apis! {
/// Extract the abridged head that was set in the extrinsics.
fn get_heads(extrinsics: Vec<<Block as BlockT>::Extrinsic>)
-> Option<Vec<AbridgedCandidateReceipt>>;
/// Get a `SigningContext` with current `SessionIndex` and parent hash.
fn signing_context() -> SigningContext;
}
}
......
......@@ -44,7 +44,7 @@ use primitives::{
UpwardMessage, ValidatorId, ActiveParas, CollatorId, Retriable, OmittedValidationData,
CandidateReceipt, GlobalValidationSchedule, AbridgedCandidateReceipt,
LocalValidationData, ValidityAttestation, NEW_HEADS_IDENTIFIER, PARACHAIN_KEY_TYPE_ID,
ValidatorSignature,
ValidatorSignature, SigningContext,
},
};
use frame_support::{
......@@ -121,7 +121,7 @@ pub struct ValidatorIdentities<T>(sp_std::marker::PhantomData<T>);
/// `Hash` - a type of a hash used in the runtime.
#[derive(RuntimeDebug, Encode, Decode)]
#[derive(Clone, Eq, PartialEq)]
pub struct DoubleVoteReport<Proof, Hash> {
pub struct DoubleVoteReport<Proof> {
/// Identity of the double-voter.
pub identity: ValidatorId,
/// First vote of the double-vote.
......@@ -130,11 +130,11 @@ pub struct DoubleVoteReport<Proof, Hash> {
pub second: (Statement, ValidatorSignature),
/// Proof that the validator with `identity` id was actually a validator at `parent_hash`.
pub proof: Proof,
/// Parent hash of the block this offence was commited.
pub parent_hash: Hash,
/// A `SigningContext` with a session and a parent hash of the moment this offence was commited.
pub signing_context: SigningContext,
}
impl<Proof: Parameter + GetSessionNumber, Hash: AsRef<[u8]>> DoubleVoteReport<Proof, Hash> {
impl<Proof: Parameter + GetSessionNumber> DoubleVoteReport<Proof> {
fn verify<T: Trait<Proof = Proof>>(
&self,
) -> Result<(), DoubleVoteValidityError> {
......@@ -145,9 +145,21 @@ impl<Proof: Parameter + GetSessionNumber, Hash: AsRef<[u8]>> DoubleVoteReport<Pr
T::KeyOwnerProofSystem::check_proof((PARACHAIN_KEY_TYPE_ID, id), self.proof.clone())
.ok_or(DoubleVoteValidityError::InvalidProof)?;
if self.proof.session() != self.signing_context.session_index {
return Err(DoubleVoteValidityError::InvalidReport);
}
// Check signatures.
Self::verify_vote(&first, &self.parent_hash, &self.identity)?;
Self::verify_vote(&second, &self.parent_hash, &self.identity)?;
Self::verify_vote(
&first,
&self.signing_context,
&self.identity,
)?;
Self::verify_vote(
&second,
&self.signing_context,
&self.identity,
)?;
match (&first.0, &second.0) {
// If issuing a `Candidate` message on a parachain block, neither a `Valid` or
......@@ -173,10 +185,10 @@ impl<Proof: Parameter + GetSessionNumber, Hash: AsRef<[u8]>> DoubleVoteReport<Pr
fn verify_vote(
vote: &(Statement, ValidatorSignature),
parent_hash: &Hash,
signing_context: &SigningContext,
authority: &ValidatorId,
) -> Result<(), DoubleVoteValidityError> {
let payload = localized_payload(vote.0.clone(), parent_hash);
let payload = localized_payload(vote.0.clone(), signing_context);
if !vote.1.verify(&payload[..], authority) {
return Err(DoubleVoteValidityError::InvalidSignature);
......@@ -203,7 +215,7 @@ impl GetSessionNumber for session::historical::Proof {
}
}
pub trait Trait: attestations::Trait + session::historical::Trait + staking::Trait {
pub trait Trait: attestations::Trait + session::historical::Trait {
/// The outer origin type.
type Origin: From<Origin> + From<system::RawOrigin<Self::AccountId>>;
......@@ -253,6 +265,9 @@ pub trait Trait: attestations::Trait + session::historical::Trait + staking::Tra
Self::IdentificationTuple,
DoubleVoteOffence<Self::IdentificationTuple>
>;
/// A type that converts the opaque hash type to exact one.
type BlockHashConversion: Convert<Self::Hash, primitives::Hash>;
}
/// Origin for the parachains module.
......@@ -332,18 +347,6 @@ decl_storage! {
///
/// `None` if not yet updated.
pub DidUpdate: Option<Vec<ParaId>>;
/// The mapping from parent block hashes to session indexes.
///
/// Used for double vote report validation.
pub ParentToSessionIndex get(fn session_at_block):
map hasher(twox_64_concat) T::Hash => SessionIndex;
/// The era that is active currently.
///
/// Changes with the `ActiveEra` from `staking`. Upon these changes `ParentToSessionIndex`
/// is pruned.
ActiveEra get(fn active_era): Option<staking::EraIndex>;
}
add_extra_genesis {
config(authorities): Vec<ValidatorId>;
......@@ -484,7 +487,6 @@ decl_module! {
origin,
report: DoubleVoteReport<
<T::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, Vec<u8>)>>::Proof,
T::Hash,
>,
) -> DispatchResult {
let reporter = ensure_signed(origin)?;
......@@ -519,26 +521,6 @@ decl_module! {
fn on_initialize() -> Weight {
<Self as Store>::DidUpdate::kill();
let current_session = <session::Module<T>>::current_index();
let parent_hash = <system::Module<T>>::parent_hash();
match Self::active_era() {
Some(era) => {
if let Some(active_era) = <staking::Module<T>>::current_era() {
if era != active_era {
<Self as Store>::ActiveEra::put(active_era);
<ParentToSessionIndex<T>>::remove_all();
}
}
}
None => {
if let Some(active_era) = <staking::Module<T>>::current_era() {
<Self as Store>::ActiveEra::set(Some(active_era));
}
}
}
<ParentToSessionIndex<T>>::insert(parent_hash, current_session);
SimpleDispatchInfo::default().weigh_data(())
}
......@@ -552,9 +534,12 @@ fn majority_of(list_len: usize) -> usize {
list_len / 2 + list_len % 2
}
fn localized_payload<H: AsRef<[u8]>>(statement: Statement, parent_hash: H) -> Vec<u8> {
fn localized_payload(
statement: Statement,
signing_context: &SigningContext,
) -> Vec<u8> {
let mut encoded = statement.encode();
encoded.extend(parent_hash.as_ref());
signing_context.using_encoded(|s| encoded.extend(s));
encoded
}
......@@ -576,6 +561,17 @@ impl<T: Trait> Module<T> {
<Heads>::remove(id);
}
/// Get a `SigningContext` with a current `SessionIndex` and parent hash.
pub fn signing_context() -> SigningContext {
let session_index = <session::Module<T>>::current_index();
let parent_hash = <system::Module<T>>::parent_hash();
SigningContext {
session_index,
parent_hash: T::BlockHashConversion::convert(parent_hash),
}
}
/// Dispatch some messages from a parachain.
fn dispatch_message(
id: ParaId,
......@@ -912,7 +908,8 @@ impl<T: Trait> Module<T> {
let sorted_validators = make_sorted_duties(&duty_roster.validator_duty);
let parent_hash = <system::Module<T>>::parent_hash();
let localized_payload = |statement: Statement| localized_payload(statement, parent_hash);
let signing_context = Self::signing_context();
let localized_payload = |statement: Statement| localized_payload(statement, &signing_context);
let mut validator_groups = GroupedDutyIter::new(&sorted_validators[..]);
......@@ -1160,9 +1157,8 @@ impl<T: Trait + Send + Sync> SignedExtension for ValidateDoubleVoteReports<T> wh
if let Some(local_call) = call.is_sub_type() {
if let Call::report_double_vote(report) = local_call {
let validators = <session::Module<T>>::validators();
let parent_hash = report.parent_hash;
let expected_session = Module::<T>::session_at_block(parent_hash);
let expected_session = report.signing_context.session_index;
let session = report.proof.session();
if session != expected_session {
......@@ -1467,6 +1463,7 @@ mod tests {
type Proof = <Historical as KeyOwnerProofSystem<(KeyTypeId, Vec<u8>)>>::Proof;
type IdentificationTuple = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, Vec<u8>)>>::IdentificationTuple;
type ReportOffence = Offences;
type BlockHashConversion = sp_runtime::traits::Identity;
type KeyOwnerProofSystem = Historical;
}
......@@ -1559,7 +1556,7 @@ mod tests {
}
fn report_double_vote(
report: DoubleVoteReport<session::historical::Proof, <Test as system::Trait>::Hash>,
report: DoubleVoteReport<session::historical::Proof>,
) -> Result<ParachainsCall<Test>, TransactionValidityError> {
let inner = ParachainsCall::report_double_vote(report);
let call = Call::Parachains(inner.clone());
......@@ -1604,7 +1601,6 @@ mod tests {
fn make_attestations(candidate: &mut AttestedCandidate) {
let mut vote_implicit = false;
let parent_hash = <system::Module<Test>>::parent_hash();
let (duty_roster, _) = Parachains::calculate_duty_roster();
let candidate_hash = candidate.candidate.hash();
......@@ -1632,7 +1628,8 @@ mod tests {
Statement::Valid(candidate_hash.clone())
};
let payload = localized_payload(statement, parent_hash);
let signing_context = Parachains::signing_context();
let payload = localized_payload(statement, &signing_context);
let signature = key.sign(&payload[..]).into();
candidate.validity_votes.push(if vote_implicit {
......@@ -2209,10 +2206,10 @@ mod tests {
let statement_candidate = Statement::Candidate(candidate_hash.clone());
let statement_valid = Statement::Valid(candidate_hash.clone());
let parent_hash = System::parent_hash();
let payload_1 = localized_payload(statement_candidate.clone(), parent_hash);
let payload_2 = localized_payload(statement_valid.clone(), parent_hash);
let signing_context = Parachains::signing_context();
let payload_1 = localized_payload(statement_candidate.clone(), &signing_context);
let payload_2 = localized_payload(statement_valid.clone(), &signing_context);
let signature_1 = key.sign(&payload_1[..]).into();
let signature_2 = key.sign(&payload_2[..]).into();
......@@ -2240,7 +2237,7 @@ mod tests {
first: (statement_candidate, signature_1),
second: (statement_valid, signature_2),
proof,
parent_hash,
signing_context,
};
let inner = report_double_vote(report).unwrap();
......@@ -2304,10 +2301,10 @@ mod tests {
let statement_candidate = Statement::Candidate(candidate_hash);
let statement_invalid = Statement::Invalid(candidate_hash.clone());
let parent_hash = System::parent_hash();
let payload_1 = localized_payload(statement_candidate.clone(), parent_hash);
let payload_2 = localized_payload(statement_invalid.clone(), parent_hash);
let signing_context = Parachains::signing_context();
let payload_1 = localized_payload(statement_candidate.clone(), &signing_context);
let payload_2 = localized_payload(statement_invalid.clone(), &signing_context);
let signature_1 = key.sign(&payload_1[..]).into();
let signature_2 = key.sign(&payload_2[..]).into();
......@@ -2335,7 +2332,7 @@ mod tests {
first: (statement_candidate, signature_1),
second: (statement_invalid, signature_2),
proof,
parent_hash,
signing_context,
};
assert_ok!(Parachains::dispatch(
......@@ -2401,10 +2398,10 @@ mod tests {
let statement_invalid = Statement::Invalid(candidate_hash.clone());
let statement_valid = Statement::Valid(candidate_hash.clone());
let parent_hash = System::parent_hash();
let payload_1 = localized_payload(statement_invalid.clone(), parent_hash);
let payload_2 = localized_payload(statement_valid.clone(), parent_hash);
let signing_context = Parachains::signing_context();
let payload_1 = localized_payload(statement_invalid.clone(), &signing_context);
let payload_2 = localized_payload(statement_valid.clone(), &signing_context);
let signature_1 = key.sign(&payload_1[..]).into();
let signature_2 = key.sign(&payload_2[..]).into();
......@@ -2432,7 +2429,7 @@ mod tests {
first: (statement_invalid, signature_1),
second: (statement_valid, signature_2),
proof,
parent_hash,
signing_context,
};
assert_ok!(Parachains::dispatch(
......@@ -2501,10 +2498,10 @@ mod tests {
let statement_candidate = Statement::Candidate(candidate_hash.clone());
let statement_valid = Statement::Valid(candidate_hash.clone());
let parent_hash = System::parent_hash();
let payload_1 = localized_payload(statement_candidate.clone(), parent_hash);
let payload_2 = localized_payload(statement_valid.clone(), parent_hash);
let signing_context = Parachains::signing_context();
let payload_1 = localized_payload(statement_candidate.clone(), &signing_context);
let payload_2 = localized_payload(statement_valid.clone(), &signing_context);
let signature_1 = key.sign(&payload_1[..]).into();
let signature_2 = key.sign(&payload_2[..]).into();
......@@ -2532,7 +2529,7 @@ mod tests {
first: (statement_candidate, signature_1),
second: (statement_valid, signature_2),
proof,
parent_hash,
signing_context,
};
assert_ok!(Parachains::dispatch(
......@@ -2609,10 +2606,10 @@ mod tests {
let statement_candidate = Statement::Candidate(candidate_hash.clone());
let statement_valid = Statement::Valid(candidate_hash.clone());
let parent_hash = System::parent_hash();
let payload_1 = localized_payload(statement_candidate.clone(), parent_hash);
let payload_2 = localized_payload(statement_valid.clone(), parent_hash);
let signing_context = Parachains::signing_context();
let payload_1 = localized_payload(statement_candidate.clone(), &signing_context);
let payload_2 = localized_payload(statement_valid.clone(), &signing_context);
let signature_1 = key_1.sign(&payload_1[..]).into();
let signature_2 = key_2.sign(&payload_2[..]).into();
......@@ -2625,7 +2622,7 @@ mod tests {
first: (statement_candidate, signature_1),
second: (statement_valid, signature_2),
proof,
parent_hash,
signing_context,
};
assert_eq!(
......@@ -2669,8 +2666,12 @@ mod tests {