Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8c39821
Introduce bandersnatch vrf
davxy Jun 18, 2023
a9446fd
Some documentation
davxy Jun 18, 2023
bb3e022
Fix tests
davxy Jun 18, 2023
bdd3df4
Fix docs refs
davxy Jun 18, 2023
e0e493a
Some more docs
davxy Jun 19, 2023
b665397
Comments about key derivation
davxy Jun 19, 2023
1faf0e2
Make clippy happy
davxy Jun 21, 2023
2a55c7d
Merge branch 'master' into bandersnatch-vrf
davxy Jun 21, 2023
7812da8
Fix ring context enc/dec test
davxy Jun 21, 2023
dd53abc
Fix docs
davxy Jun 21, 2023
03ca535
Switch to upstream ring-vrf
davxy Jun 22, 2023
afb84c5
Use sub-domains to construct VrfInput
davxy Jun 26, 2023
b4e0279
Bandersnatch VRF experimental feature
davxy Jun 26, 2023
584e07e
Restore upstream dep
davxy Jun 29, 2023
7791d66
Fix feature flags
davxy Jun 29, 2023
13ad9ad
Merge branch 'master' into bandersnatch-vrf
davxy Jun 29, 2023
acaab76
Apply typo fix
davxy Jul 18, 2023
f22354d
Bump bandersnatch-vrfs
davxy Jul 18, 2023
62d2ed4
Weiestrass form has been selected
davxy Jul 18, 2023
759406e
Rename bandersnatch testing app crypto id
davxy Jul 18, 2023
935b87b
Merge branch 'master' into bandersnatch-vrf
davxy Jul 18, 2023
3ccdd86
Support for seed recovery
davxy Jul 22, 2023
e8a40ab
Clarified domain size <-> key size relationship
davxy Jul 25, 2023
b770f0d
Merge branch 'master' into bandersnatch-vrf
davxy Jul 25, 2023
84ad4ae
cargo fmt
davxy Jul 25, 2023
63aef58
Merge branch 'master' into bandersnatch-vrf
davxy Jul 25, 2023
ca11f8d
Trigger CI
davxy Jul 26, 2023
9d279fa
Merge branch 'master' into bandersnatch-vrf
davxy Jul 27, 2023
b27c61f
Some required tweaks to crypto types
davxy Jul 28, 2023
a5e4cd4
Remove leftovers from Cargo.toml
davxy Jul 28, 2023
7bf3c70
Remove some TODO notes
davxy Jul 28, 2023
efd39bd
Simplification of structs construction
davxy Jul 28, 2023
ad76f57
Merge branch 'master' into bandersnatch-vrf
davxy Aug 1, 2023
062b13e
Merge branch 'master' into bandersnatch-vrf
davxy Aug 2, 2023
c562181
Trigger CI
davxy Aug 2, 2023
b1f6c58
Apply review suggestion
davxy Aug 9, 2023
9342856
Docs typo
davxy Aug 9, 2023
64ec625
Merge branch 'master' into bandersnatch-vrf
davxy Aug 9, 2023
ece4016
Fix keystore tests
davxy Aug 9, 2023
3b553b6
Consistence
davxy Aug 9, 2023
c2b00b5
Add ref to git rependency
davxy Aug 9, 2023
b339b3a
Static check of MAX_VRF_IOS value
davxy Aug 9, 2023
2b2676b
Clarify behavior for out of ring keys signatures
davxy Aug 9, 2023
0739e0f
Add test for ring-vrf to the keystore
davxy Aug 9, 2023
a457359
Fix docs
davxy Aug 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Consistence
  • Loading branch information
davxy committed Aug 9, 2023
commit 3b553b67e55f1cadbb1e52b91a68af874cc25ac1
6 changes: 3 additions & 3 deletions primitives/core/src/bandersnatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ const RING_PROOF_SERIALIZED_LEN: usize = 592;

// Max size of serialized ring-vrf context params.
//
// This size is dependent on the ring size.
// This size is dependent on the ring domain size and the actual value
// is equal to the SCALE encoded size of the `KZG` backend.
//
// Some values:
// ring_size → ~serialized_size
Expand Down Expand Up @@ -288,7 +289,7 @@ impl TraitPair for Pair {
/// Verify a signature on a message.
///
/// Returns `true` if the signature is good.
fn verify<M: AsRef<[u8]>>(signature: &Self::Signature, data: M, public: &Self::Public) -> bool {
fn verify<M: AsRef<[u8]>>(signature: &Signature, data: M, public: &Public) -> bool {
let data = vrf::VrfSignData::new_unchecked(SIGNING_CTX, &[data.as_ref()], None);
let signature =
vrf::VrfSignature { signature: *signature, vrf_outputs: vrf::VrfIosVec::default() };
Expand Down Expand Up @@ -1005,7 +1006,6 @@ mod tests {
let ctx1 = RingContext::new_testing();
let enc1 = ctx1.encode();

println!("SIZE: {}", enc1.len());
assert_eq!(enc1.len(), RingContext::max_encoded_len());

let ctx2 = RingContext::decode(&mut enc1.as_slice()).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion primitives/core/src/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ impl TraitPair for Pair {
}

/// Verify a signature on a message. Returns true if the signature is good.
fn verify<M: AsRef<[u8]>>(sig: &Self::Signature, message: M, public: &Self::Public) -> bool {
fn verify<M: AsRef<[u8]>>(sig: &Signature, message: M, public: &Public) -> bool {
sig.recover(message).map(|actual| actual == *public).unwrap_or_default()
}

Expand Down
2 changes: 1 addition & 1 deletion primitives/core/src/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ impl TraitPair for Pair {
/// Verify a signature on a message.
///
/// Returns true if the signature is good.
fn verify<M: AsRef<[u8]>>(sig: &Self::Signature, message: M, public: &Self::Public) -> bool {
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 };
public.verify(&signature, message.as_ref()).is_ok()
Expand Down
2 changes: 1 addition & 1 deletion primitives/core/src/sr25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ impl TraitPair for Pair {
self.0.sign(context.bytes(message)).into()
}

fn verify<M: AsRef<[u8]>>(sig: &Self::Signature, message: M, pubkey: &Self::Public) -> bool {
fn verify<M: AsRef<[u8]>>(sig: &Signature, message: M, pubkey: &Public) -> bool {
let Ok(signature) = schnorrkel::Signature::from_bytes(sig.as_ref()) else { return false };
let Ok(public) = PublicKey::from_bytes(pubkey.as_ref()) else { return false };
public.verify_simple(SIGNING_CTX, message.as_ref(), &signature).is_ok()
Expand Down