Improve SS58 related errors (#10541)

* Improve SS58 related errors

This improves the SS58 error, especially when it comes to parsing public keys with unknown SS58
address formats.

* Make CI happy

* More fixes

* More

* 🤦

* fml...
This commit is contained in:
Bastian Köcher
2021-12-25 08:19:46 +01:00
committed by GitHub
parent 4c651637f2
commit 849cf6ce5c
4 changed files with 52 additions and 125 deletions
+2 -16
View File
@@ -211,7 +211,8 @@ impl<'de> Deserialize<'de> for Public {
/// An Schnorrkel/Ristretto x25519 ("sr25519") signature.
///
/// Instead of importing it for the local module, alias it to be available as a public type
#[derive(Encode, Decode, PassByInner, TypeInfo)]
#[cfg_attr(feature = "full_crypto", derive(Hash))]
#[derive(Encode, Decode, PassByInner, TypeInfo, PartialEq, Eq)]
pub struct Signature(pub [u8; 64]);
impl sp_std::convert::TryFrom<&[u8]> for Signature {
@@ -259,14 +260,6 @@ impl Clone for Signature {
}
}
impl PartialEq for Signature {
fn eq(&self, b: &Self) -> bool {
self.0[..] == b.0[..]
}
}
impl Eq for Signature {}
impl From<Signature> for [u8; 64] {
fn from(v: Signature) -> [u8; 64] {
v.0
@@ -316,13 +309,6 @@ impl sp_std::fmt::Debug for Signature {
}
}
#[cfg(feature = "full_crypto")]
impl sp_std::hash::Hash for Signature {
fn hash<H: sp_std::hash::Hasher>(&self, state: &mut H) {
sp_std::hash::Hash::hash(&self.0[..], state);
}
}
/// A localized signature also contains sender information.
/// NOTE: Encode and Decode traits are supported in ed25519 but not possible for now here.
#[cfg(feature = "std")]