mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
use strong key in parachains module KeyOwnerProofSystem (#951)
This commit is contained in:
committed by
GitHub
parent
4c3ca7bbb9
commit
21bd2f19d3
@@ -140,7 +140,7 @@ impl<Proof: Parameter + GetSessionNumber> DoubleVoteReport<Proof> {
|
|||||||
) -> Result<(), DoubleVoteValidityError> {
|
) -> Result<(), DoubleVoteValidityError> {
|
||||||
let first = self.first.clone();
|
let first = self.first.clone();
|
||||||
let second = self.second.clone();
|
let second = self.second.clone();
|
||||||
let id = self.identity.encode();
|
let id = self.identity.clone();
|
||||||
|
|
||||||
T::KeyOwnerProofSystem::check_proof((PARACHAIN_KEY_TYPE_ID, id), self.proof.clone())
|
T::KeyOwnerProofSystem::check_proof((PARACHAIN_KEY_TYPE_ID, id), self.proof.clone())
|
||||||
.ok_or(DoubleVoteValidityError::InvalidProof)?;
|
.ok_or(DoubleVoteValidityError::InvalidProof)?;
|
||||||
@@ -251,7 +251,7 @@ pub trait Trait: attestations::Trait + session::historical::Trait {
|
|||||||
|
|
||||||
/// Compute and check proofs of historical key owners.
|
/// Compute and check proofs of historical key owners.
|
||||||
type KeyOwnerProofSystem: KeyOwnerProofSystem<
|
type KeyOwnerProofSystem: KeyOwnerProofSystem<
|
||||||
(KeyTypeId, Vec<u8>),
|
(KeyTypeId, ValidatorId),
|
||||||
Proof = Self::Proof,
|
Proof = Self::Proof,
|
||||||
IdentificationTuple = Self::IdentificationTuple,
|
IdentificationTuple = Self::IdentificationTuple,
|
||||||
>;
|
>;
|
||||||
@@ -486,7 +486,7 @@ decl_module! {
|
|||||||
pub fn report_double_vote(
|
pub fn report_double_vote(
|
||||||
origin,
|
origin,
|
||||||
report: DoubleVoteReport<
|
report: DoubleVoteReport<
|
||||||
<T::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, Vec<u8>)>>::Proof,
|
<T::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, ValidatorId)>>::Proof,
|
||||||
>,
|
>,
|
||||||
) -> DispatchResult {
|
) -> DispatchResult {
|
||||||
let reporter = ensure_signed(origin)?;
|
let reporter = ensure_signed(origin)?;
|
||||||
@@ -500,7 +500,7 @@ decl_module! {
|
|||||||
// We have already checked this proof in `SignedExtension`, but we need
|
// We have already checked this proof in `SignedExtension`, but we need
|
||||||
// this here to get the full identification of the offender.
|
// this here to get the full identification of the offender.
|
||||||
let offender = T::KeyOwnerProofSystem::check_proof(
|
let offender = T::KeyOwnerProofSystem::check_proof(
|
||||||
(PARACHAIN_KEY_TYPE_ID, identity.encode()),
|
(PARACHAIN_KEY_TYPE_ID, identity),
|
||||||
proof,
|
proof,
|
||||||
).ok_or("Invalid/outdated key ownership proof.")?;
|
).ok_or("Invalid/outdated key ownership proof.")?;
|
||||||
|
|
||||||
@@ -1468,8 +1468,10 @@ mod tests {
|
|||||||
type Registrar = registrar::Module<Test>;
|
type Registrar = registrar::Module<Test>;
|
||||||
type MaxCodeSize = MaxCodeSize;
|
type MaxCodeSize = MaxCodeSize;
|
||||||
type MaxHeadDataSize = MaxHeadDataSize;
|
type MaxHeadDataSize = MaxHeadDataSize;
|
||||||
type Proof = <Historical as KeyOwnerProofSystem<(KeyTypeId, Vec<u8>)>>::Proof;
|
type Proof =
|
||||||
type IdentificationTuple = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, Vec<u8>)>>::IdentificationTuple;
|
<Historical as KeyOwnerProofSystem<(KeyTypeId, ValidatorId)>>::Proof;
|
||||||
|
type IdentificationTuple =
|
||||||
|
<Historical as KeyOwnerProofSystem<(KeyTypeId, ValidatorId)>>::IdentificationTuple;
|
||||||
type ReportOffence = Offences;
|
type ReportOffence = Offences;
|
||||||
type BlockHashConversion = sp_runtime::traits::Identity;
|
type BlockHashConversion = sp_runtime::traits::Identity;
|
||||||
type KeyOwnerProofSystem = Historical;
|
type KeyOwnerProofSystem = Historical;
|
||||||
|
|||||||
Reference in New Issue
Block a user