mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +00:00
Only support ECDSA compressed public keys (#4667)
Some fixes after: https://github.com/paritytech/substrate/pull/4502 This removes the unwanted `expect`s from `MultiSigner`. Instead we convert from full to compressed in `TryFrom` and can return an error on invalid input.
This commit is contained in:
committed by
Gavin Wood
parent
164dec95e5
commit
1f18964f01
@@ -238,9 +238,7 @@ impl traits::IdentifyAccount for MultiSigner {
|
||||
match self {
|
||||
MultiSigner::Ed25519(who) => <[u8; 32]>::from(who).into(),
|
||||
MultiSigner::Sr25519(who) => <[u8; 32]>::from(who).into(),
|
||||
MultiSigner::Ecdsa(who) => sp_io::hashing::blake2_256(
|
||||
&who.as_compressed().expect("`who` is a valid `ECDSA` public key; qed")[..],
|
||||
).into(),
|
||||
MultiSigner::Ecdsa(who) => sp_io::hashing::blake2_256(&who.as_ref()[..]).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -724,7 +722,7 @@ mod tests {
|
||||
let multi_signer = MultiSigner::from(pair.public());
|
||||
assert!(multi_sig.verify(msg, &multi_signer.into_account()));
|
||||
|
||||
let multi_signer = MultiSigner::from(pair.public().into_compressed().unwrap());
|
||||
let multi_signer = MultiSigner::from(pair.public());
|
||||
assert!(multi_sig.verify(msg, &multi_signer.into_account()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user