-
Notifications
You must be signed in to change notification settings - Fork 2.6k
BLS Core Crypto attempt #2 #13618
BLS Core Crypto attempt #2 #13618
Changes from 27 commits
b845210
081ced0
f411d74
ee61ddb
a1e0f13
7023c14
d92186d
409b2f4
7177bb1
9b320cd
58d4122
1e331c0
a630ead
8a34867
5c47d33
fe65fce
b278ba7
3d50a72
994a805
d728537
fbb2f47
bc52143
eb8a7ab
0acdf5c
26d9ce2
9de1515
267538f
e3c2af8
2a0a0ca
de48262
7d709da
a2b7308
478da9b
426c5ae
da36af4
856881a
0c7a5f7
9218d9c
58c2d94
6041fec
f9b0da0
758a169
b11659d
3a9c5ed
0bfbcfd
5a1a9cc
2e48a99
270b32e
35b9167
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// This file is part of Substrate. | ||
|
||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//! BLS12-381 crypto applications. | ||
|
||
pub use sp_core::bls::bls381::*; | ||
|
||
mod app { | ||
crate::app_crypto!(super, sp_core::testing::BLS381); | ||
} | ||
|
||
#[cfg(feature = "full_crypto")] | ||
pub use app::Pair as AppPair; | ||
pub use app::{Public as AppPublic, Signature as AppSignature}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,8 @@ array-bytes = { version = "4.1", optional = true } | |
ed25519-zebra = { version = "3.1.0", default-features = false, optional = true } | ||
blake2 = { version = "0.10.4", default-features = false, optional = true } | ||
schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false, optional = true } | ||
bls-like = {git = "https://github.com/w3f/bls", default-features = false} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Imho, we should not depend upon the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bls crypto type within substrate has been defined to be generic. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not imho use the bls-like crate in production. I started it as an experiment, and much has been added, but it was never cleaned up, so much of what is there no longer serves any purpose, and is generally a confusing poorly structured mess. https://github.com/w3f/ring-vrf/tree/master/nugget_bls was written to do exactly what beefy requires. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made this repo https://github.com/w3f/BCLS-BLS I'll start isolating the bls logic from nugget and bls-like to here and eventually relpace the backend. Nonetheless I don't want this to become a blocker on this pull requset as, given that the output of the BLS-like matches the reference in the paper, BEEFY's integration is blocked on this, production ready BLS BEEFY is also blocked on apk proof adoption of BW6 on BLS12-381 and we are exposing no host functio. Therefore, I don't think blocking the pull request due to some opinion about an abstraction in the backend is justified. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or just use nugget_bls after changing whatever needs changing? At minimum it helps consolidate our code which should be hardened for non-constant-time elliptic curves. I've found an unrelated annoyance with merlin, so I'll do some ark_transcript crate based on shake128 btw. |
||
hex = { version = "0.4", default-features = false, optional = true} | ||
libsecp256k1 = { version = "0.7", default-features = false, features = ["static-context"], optional = true } | ||
merlin = { version = "2.0", default-features = false, optional = true } | ||
secp256k1 = { version = "0.24.0", default-features = false, features = ["recovery", "alloc"], optional = true } | ||
|
@@ -58,6 +60,7 @@ rand = "0.8.5" | |
criterion = "0.4.0" | ||
serde_json = "1.0" | ||
sp-core-hashing-proc-macro = { version = "5.0.0", path = "./hashing/proc-macro" } | ||
hex-literal = "0.3.4" | ||
|
||
[[bench]] | ||
name = "bench" | ||
|
@@ -110,6 +113,7 @@ std = [ | |
"futures/thread-pool", | ||
"libsecp256k1/std", | ||
"dyn-clonable", | ||
"hex", | ||
] | ||
|
||
# This feature enables all crypto primitives for `no_std` builds like microcontrollers | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at some point, we were discussing adding bls(381), but hiding it behind a feature flag (not
full_crypto
, but a dedicated one to avoid production use). I may have missed some decisions/discussions in-between - you're now intentionally achieving the same by not implementingRuntimePublic
?