Skip to content

Commit

Permalink
Upgrade zebra dep
Browse files Browse the repository at this point in the history
  • Loading branch information
markopoloparadox committed Aug 29, 2024
1 parent fdbd3a9 commit 8c80da2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 31 deletions.
37 changes: 11 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion substrate/primitives/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ itertools = { version = "0.10.3", optional = true }

# full crypto
array-bytes = { version = "6.1", optional = true }
ed25519-zebra = { version = "3.1.0", default-features = false, optional = true }
ed25519-zebra = { version = "4.0.3", default-features = false, optional = true }
blake2 = { version = "0.10.4", default-features = false, optional = true }
libsecp256k1 = { version = "0.7", default-features = false, features = ["static-context"], optional = true }
schnorrkel = { version = "0.11.4", features = ["preaudit_deprecated"], default-features = false }
Expand Down
8 changes: 5 additions & 3 deletions substrate/primitives/core/src/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl TryFrom<&[u8]> for Public {

fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
if data.len() != Self::LEN {
return Err(())
return Err(());
}
let mut r = [0u8; Self::LEN];
r.copy_from_slice(data);
Expand Down Expand Up @@ -322,7 +322,7 @@ impl Signature {
/// you are certain that the array actually is a signature. GIGO!
pub fn from_slice(data: &[u8]) -> Option<Self> {
if data.len() != 64 {
return None
return None;
}
let mut r = [0u8; 64];
r.copy_from_slice(data);
Expand Down Expand Up @@ -423,7 +423,9 @@ impl TraitPair for Pair {
/// Returns true if the signature is good.
fn verify<M: AsRef<[u8]>>(sig: &Signature, message: M, public: &Public) -> bool {
let Ok(public) = VerificationKey::try_from(public.as_slice()) else { return false };
let Ok(signature) = ed25519_zebra::Signature::try_from(sig.as_ref()) else { return false };
let Ok(signature) = ed25519_zebra::Signature::try_from(sig.0.as_slice()) else {
return false;
};
public.verify(&signature, message.as_ref()).is_ok()
}

Expand Down
2 changes: 1 addition & 1 deletion substrate/primitives/statement-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ thiserror = { version = "1.0", optional = true }
# ECIES dependencies
ed25519-dalek = { version = "2.1", optional = true }
x25519-dalek = { version = "2.0", optional = true, features = ["static_secrets"] }
curve25519-dalek = { version = "4.1.1", optional = true }
curve25519-dalek = { version = "4.1.3", optional = true }
aes-gcm = { version = "0.10", optional = true }
hkdf = { version = "0.12.0", optional = true }
sha2 = { version = "0.10.7", optional = true }
Expand Down

0 comments on commit 8c80da2

Please sign in to comment.