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
33 commits
Select commit Hold shift + click to select a range
9375040
Introduce bandersnatch-vrfs (temporary)
davxy Apr 11, 2023
3016fd8
Merge branch 'master' into davxy-bandersnatch-vrf
davxy Apr 19, 2023
74e1aca
Align to last bandersnatch-vrf crate iteration
davxy Apr 19, 2023
9273581
Implementation of sign/verify methods
davxy Apr 20, 2023
09d2d41
Bandersnatch keystore integration
davxy Apr 21, 2023
fbd3e7a
Application crypto
davxy Apr 21, 2023
b038d9e
Global const signing context
davxy Apr 21, 2023
7b31bcd
make_bytes skeleton
davxy Apr 21, 2023
e258c1c
Remove cruft
davxy Apr 21, 2023
89e35e4
Merge branch 'master' into davxy-bandersnatch-vrf
davxy Apr 22, 2023
95c0358
Fix after master merge
davxy Apr 22, 2023
7d8c71a
Manage multiple VRF inputs
davxy Apr 25, 2023
1b2da2c
Disable std feature
davxy Apr 27, 2023
b88cba8
Merge branch 'master' into davxy-bandersnatch-vrf
davxy May 4, 2023
5ef6ed9
Fix after master merge
davxy May 4, 2023
80c9f0a
Patch no-std compatible w3f crates
davxy May 4, 2023
078b8cd
Merge branch 'master' into davxy-bandersnatch-vrf
davxy May 11, 2023
dc324db
put bandersnatch under experimental flag
davxy May 11, 2023
b02fc4b
point to patched repo
davxy May 11, 2023
216d7fc
Merge branch 'master' into davxy-bandersnatch-vrf
davxy May 11, 2023
59798e0
Bump sassafras version crates to v0.3.2-dev
davxy May 12, 2023
1a3dc5d
Integrate bandersnatch vrf
davxy May 12, 2023
030c7f9
Integration for pallet and primitives
davxy May 13, 2023
fc5a735
Use next epoch params for ticket check
davxy May 15, 2023
0fc66cc
Merge branch 'master' into sassafras-protocol-v32
davxy May 15, 2023
7ef968c
Fix frame tests after vrf upgrade
davxy May 15, 2023
8332ff8
Merge branch 'davxy-sassafras-protocol' into sassafras-protocol-v32
davxy May 15, 2023
4f0c37d
Bandersnatch tests keyring
davxy May 16, 2023
fd95365
Test for genesis config storage
davxy May 16, 2023
15b5ada
Fix authorities creation for bandersnatch keys
davxy May 16, 2023
29b8b2b
Introduce ed25519 erased signature
davxy May 16, 2023
ad29487
Proper data for erased signature
davxy May 18, 2023
819bc42
Fix tests
davxy May 18, 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
put bandersnatch under experimental flag
  • Loading branch information
davxy committed May 11, 2023
commit dc324db228d89c4e05af59f0aca4356aa7797bf7
11 changes: 8 additions & 3 deletions client/keystore/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@

use parking_lot::RwLock;
use sp_application_crypto::{AppCrypto, AppPair, IsWrappedBy};
#[cfg(feature = "bandersnatch-experimental")]
use sp_core::bandersnatch;
#[cfg(feature = "bls-experimental")]
use sp_core::{bls377, bls381};
use sp_core::{
bandersnatch,
crypto::{ByteArray, ExposeSecret, KeyTypeId, Pair as CorePair, SecretString, VrfSecret},
ecdsa, ed25519, sr25519,
};
#[cfg(feature = "bls-experimental")]
use sp_core::{bls377, bls381};
use sp_keystore::{Error as TraitError, Keystore, KeystorePtr};
use std::{
collections::HashMap,
Expand Down Expand Up @@ -235,10 +236,12 @@ impl Keystore for LocalKeystore {
Ok(sig)
}

#[cfg(feature = "bandersnatch-experimental")]
fn bandersnatch_public_keys(&self, key_type: KeyTypeId) -> Vec<bandersnatch::Public> {
self.public_keys::<bandersnatch::Pair>(key_type)
}

#[cfg(feature = "bandersnatch-experimental")]
fn bandersnatch_generate_new(
&self,
key_type: KeyTypeId,
Expand All @@ -247,6 +250,7 @@ impl Keystore for LocalKeystore {
self.generate_new::<bandersnatch::Pair>(key_type, seed)
}

#[cfg(feature = "bandersnatch-experimental")]
fn bandersnatch_sign(
&self,
key_type: KeyTypeId,
Expand All @@ -259,6 +263,7 @@ impl Keystore for LocalKeystore {
// TODO DAVXY
// Maybe we can expose just this bandersnatch sign (the above one reduces to this with
// input len = 0)
#[cfg(feature = "bandersnatch-experimental")]
fn bandersnatch_vrf_sign(
&self,
key_type: KeyTypeId,
Expand Down
1 change: 1 addition & 0 deletions primitives/application-crypto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub use traits::*;

mod traits;

#[cfg(feature = "bandersnatch-experimental")]
pub mod bandersnatch;
#[cfg(feature = "bls-experimental")]
pub mod bls377;
Expand Down
1 change: 1 addition & 0 deletions primitives/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pub mod crypto;
pub mod hexdisplay;
pub use paste;

#[cfg(feature = "bandersnatch-experimental")]
pub mod bandersnatch;
#[cfg(feature = "bls-experimental")]
pub mod bls;
Expand Down
12 changes: 9 additions & 3 deletions primitives/keystore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@

pub mod testing;

#[cfg(feature = "bandersnatch-experimental")]
use sp_core::bandersnatch;
#[cfg(feature = "bls-experimental")]
use sp_core::{bls377, bls381};
use sp_core::{
bandersnatch,
crypto::{ByteArray, CryptoTypeId, KeyTypeId},
ecdsa, ed25519, sr25519,
};
#[cfg(feature = "bls-experimental")]
use sp_core::{bls377, bls381};

use std::sync::Arc;

Expand Down Expand Up @@ -175,16 +176,19 @@ pub trait Keystore: Send + Sync {
msg: &[u8; 32],
) -> Result<Option<ecdsa::Signature>, Error>;

#[cfg(feature = "bandersnatch-experimental")]
/// DAVXY TODO
fn bandersnatch_public_keys(&self, key_type: KeyTypeId) -> Vec<bandersnatch::Public>;

#[cfg(feature = "bandersnatch-experimental")]
/// DAVXY TODO
fn bandersnatch_generate_new(
&self,
key_type: KeyTypeId,
seed: Option<&str>,
) -> Result<bandersnatch::Public, Error>;

#[cfg(feature = "bandersnatch-experimental")]
/// DAVXY TODO
fn bandersnatch_sign(
&self,
Expand All @@ -193,6 +197,7 @@ pub trait Keystore: Send + Sync {
msg: &[u8],
) -> Result<Option<bandersnatch::Signature>, Error>;

#[cfg(feature = "bandersnatch-experimental")]
/// DAVXY TODO
fn bandersnatch_vrf_sign(
&self,
Expand Down Expand Up @@ -319,6 +324,7 @@ pub trait Keystore: Send + Sync {

self.ecdsa_sign(id, &public, msg)?.map(|s| s.encode())
},
#[cfg(feature = "bandersnatch-experimental")]
bandersnatch::CRYPTO_ID => {
let public = bandersnatch::Public::from_slice(public)
.map_err(|_| Error::ValidationError("Invalid public key format".into()))?;
Expand Down
11 changes: 8 additions & 3 deletions primitives/keystore/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@

use crate::{Error, Keystore, KeystorePtr};

#[cfg(feature = "bandersnatch-experimental")]
use sp_core::bandersnatch;
#[cfg(feature = "bls-experimental")]
use sp_core::{bls377, bls381};
use sp_core::{
bandersnatch,
crypto::{ByteArray, KeyTypeId, Pair, VrfSecret},
ecdsa, ed25519, sr25519,
};
#[cfg(feature = "bls-experimental")]
use sp_core::{bls377, bls381};

use parking_lot::RwLock;
use std::{collections::HashMap, sync::Arc};
Expand Down Expand Up @@ -215,10 +216,12 @@ impl Keystore for MemoryKeystore {
Ok(sig)
}

#[cfg(feature = "bandersnatch-experimental")]
fn bandersnatch_public_keys(&self, key_type: KeyTypeId) -> Vec<bandersnatch::Public> {
self.public_keys::<bandersnatch::Pair>(key_type)
}

#[cfg(feature = "bandersnatch-experimental")]
fn bandersnatch_generate_new(
&self,
key_type: KeyTypeId,
Expand All @@ -227,6 +230,7 @@ impl Keystore for MemoryKeystore {
self.generate_new::<bandersnatch::Pair>(key_type, seed)
}

#[cfg(feature = "bandersnatch-experimental")]
fn bandersnatch_sign(
&self,
key_type: KeyTypeId,
Expand All @@ -236,6 +240,7 @@ impl Keystore for MemoryKeystore {
self.sign::<bandersnatch::Pair>(key_type, public, msg)
}

#[cfg(feature = "bandersnatch-experimental")]
fn bandersnatch_vrf_sign(
&self,
key_type: KeyTypeId,
Expand Down