mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +00:00
More secure Signed implementation (#2963)
* Remove signature verification in backing. `SignedFullStatement` now signals that the signature has already been checked. * Remove unused check_payload function. * Introduced unchecked signed variants. * Fix inclusion to use unchecked variant. * More unchecked variants. * Use unchecked variants in protocols. * Start fixing statement-distribution. * Fixup statement distribution. * Fix inclusion. * Fix warning. * Fix backing properly. * Fix bitfield distribution. * Make crypto store optional for `RuntimeInfo`. * Factor out utility functions. * get_group_rotation_info * WIP: Collator cleanup + check signatures. * Convenience signature checking functions. * Check signature on collator-side. * Fix warnings. * Fix collator side tests. * Get rid of warnings. * Better Signed/UncheckedSigned implementation. Also get rid of Encode/Decode for Signed! *party* * Get rid of dead code. * Move Signed in its own module. * into_checked -> try_into_checked * Fix merge.
This commit is contained in:
@@ -322,21 +322,6 @@ impl Validator {
|
||||
) -> Result<Option<Signed<Payload, RealPayload>>, KeystoreError> {
|
||||
Signed::sign(&keystore, payload, &self.signing_context, self.index, &self.key).await
|
||||
}
|
||||
|
||||
/// Validate the payload with this validator
|
||||
///
|
||||
/// Validation can only succeed if `signed.validator_index() == self.index()`.
|
||||
/// Normally, this will always be the case for a properly operating program,
|
||||
/// but it's double-checked here anyway.
|
||||
pub fn check_payload<Payload: EncodeAs<RealPayload>, RealPayload: Encode>(
|
||||
&self,
|
||||
signed: Signed<Payload, RealPayload>,
|
||||
) -> Result<(), ()> {
|
||||
if signed.validator_index() != self.index {
|
||||
return Err(());
|
||||
}
|
||||
signed.check_signature(&self.signing_context, &self.id())
|
||||
}
|
||||
}
|
||||
|
||||
struct AbortOnDrop(future::AbortHandle);
|
||||
|
||||
Reference in New Issue
Block a user