Bandersnatch VRF (#14412)

* Introduce bandersnatch vrf

* Some documentation

* Fix tests

* Fix docs refs

* Some more docs

* Comments about key derivation

* Make clippy happy

* Fix ring context enc/dec test

* Fix docs

* Switch to upstream ring-vrf

* Use sub-domains to construct VrfInput

* Bandersnatch VRF experimental feature

* Restore upstream dep

* Fix feature flags

* Apply typo fix

Co-authored-by: Anton <anton.kalyaev@gmail.com>

* Bump bandersnatch-vrfs

* Weiestrass form has been selected

* Rename bandersnatch testing app crypto id

* Support for seed recovery

* Clarified domain size <-> key size relationship

* cargo fmt

* Trigger CI

* Some required tweaks to crypto types

* Remove leftovers from Cargo.toml

* Remove some TODO notes

* Simplification of structs construction

* Trigger CI

* Apply review suggestion

Co-authored-by: Koute <koute@users.noreply.github.com>

* Docs typo

* Fix keystore tests

* Consistence

* Add ref to git rependency

* Static check of MAX_VRF_IOS value

* Clarify behavior for out of ring keys signatures

* Add test for ring-vrf to the keystore

* Fix docs

---------

Co-authored-by: Anton <anton.kalyaev@gmail.com>
Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
Davide Galassi
2023-08-09 17:09:47 +02:00
committed by GitHub
parent 8321cee4f5
commit 314109d87b
23 changed files with 1900 additions and 59 deletions
+129 -8
View File
@@ -445,6 +445,21 @@ dependencies = [
"parity-scale-codec",
]
[[package]]
name = "ark-secret-scalar"
version = "0.0.2"
source = "git+https://github.com/w3f/ring-vrf?rev=c86ebd4#c86ebd4114d3165d05f9ce28c1d9e8d7a9a4e801"
dependencies = [
"ark-ec",
"ark-ff",
"ark-serialize",
"ark-std",
"ark-transcript",
"digest 0.10.7",
"rand_core 0.6.4",
"zeroize",
]
[[package]]
name = "ark-serialize"
version = "0.4.2"
@@ -478,6 +493,19 @@ dependencies = [
"rand 0.8.5",
]
[[package]]
name = "ark-transcript"
version = "0.0.2"
source = "git+https://github.com/w3f/ring-vrf?rev=c86ebd4#c86ebd4114d3165d05f9ce28c1d9e8d7a9a4e801"
dependencies = [
"ark-ff",
"ark-serialize",
"ark-std",
"digest 0.10.7",
"rand_core 0.6.4",
"sha3",
]
[[package]]
name = "array-bytes"
version = "6.1.0"
@@ -652,6 +680,27 @@ dependencies = [
"rustc-demangle",
]
[[package]]
name = "bandersnatch_vrfs"
version = "0.0.1"
source = "git+https://github.com/w3f/ring-vrf?rev=c86ebd4#c86ebd4114d3165d05f9ce28c1d9e8d7a9a4e801"
dependencies = [
"ark-bls12-381",
"ark-ec",
"ark-ed-on-bls12-381-bandersnatch",
"ark-ff",
"ark-serialize",
"ark-std",
"dleq_vrf",
"fflonk",
"merlin 3.0.0",
"rand_chacha 0.3.1",
"rand_core 0.6.4",
"ring 0.1.0",
"sha2 0.10.7",
"zeroize",
]
[[package]]
name = "base-x"
version = "0.2.11"
@@ -1248,6 +1297,20 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "common"
version = "0.1.0"
source = "git+https://github.com/w3f/ring-proof#0e948f3c28cbacecdd3020403c4841c0eb339213"
dependencies = [
"ark-ec",
"ark-ff",
"ark-poly",
"ark-serialize",
"ark-std",
"fflonk",
"merlin 3.0.0",
]
[[package]]
name = "common-path"
version = "1.0.0"
@@ -1866,6 +1929,22 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "210ec60ae7d710bed8683e333e9d2855a8a56a3e9892b38bad3bb0d4d29b0d5e"
[[package]]
name = "dleq_vrf"
version = "0.0.2"
source = "git+https://github.com/w3f/ring-vrf?rev=c86ebd4#c86ebd4114d3165d05f9ce28c1d9e8d7a9a4e801"
dependencies = [
"ark-ec",
"ark-ff",
"ark-secret-scalar",
"ark-serialize",
"ark-std",
"ark-transcript",
"arrayvec 0.7.4",
"rand_core 0.6.4",
"zeroize",
]
[[package]]
name = "doc-comment"
version = "0.3.3"
@@ -2179,6 +2258,19 @@ dependencies = [
"subtle",
]
[[package]]
name = "fflonk"
version = "0.1.0"
source = "git+https://github.com/w3f/fflonk#26a5045b24e169cffc1f9328ca83d71061145c40"
dependencies = [
"ark-ec",
"ark-ff",
"ark-poly",
"ark-serialize",
"ark-std",
"merlin 3.0.0",
]
[[package]]
name = "fiat-crypto"
version = "0.1.20"
@@ -4630,6 +4722,18 @@ dependencies = [
"zeroize",
]
[[package]]
name = "merlin"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d"
dependencies = [
"byteorder",
"keccak",
"rand_core 0.6.4",
"zeroize",
]
[[package]]
name = "minimal-lexical"
version = "0.2.1"
@@ -8201,6 +8305,21 @@ dependencies = [
"subtle",
]
[[package]]
name = "ring"
version = "0.1.0"
source = "git+https://github.com/w3f/ring-proof#0e948f3c28cbacecdd3020403c4841c0eb339213"
dependencies = [
"ark-ec",
"ark-ff",
"ark-poly",
"ark-serialize",
"ark-std",
"common",
"fflonk",
"merlin 3.0.0",
]
[[package]]
name = "ring"
version = "0.16.20"
@@ -8342,7 +8461,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f"
dependencies = [
"log",
"ring",
"ring 0.16.20",
"sct",
"webpki",
]
@@ -8354,7 +8473,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c911ba11bc8433e811ce56fde130ccf32f5127cab0e0194e9c68c5a5b671791e"
dependencies = [
"log",
"ring",
"ring 0.16.20",
"rustls-webpki",
"sct",
]
@@ -8386,7 +8505,7 @@ version = "0.100.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b"
dependencies = [
"ring",
"ring 0.16.20",
"untrusted",
]
@@ -9896,7 +10015,7 @@ dependencies = [
"arrayvec 0.5.2",
"curve25519-dalek 2.1.3",
"getrandom 0.1.16",
"merlin",
"merlin 2.0.1",
"rand 0.7.3",
"rand_core 0.5.1",
"sha2 0.8.2",
@@ -9922,7 +10041,7 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4"
dependencies = [
"ring",
"ring 0.16.20",
"untrusted",
]
@@ -10236,7 +10355,7 @@ dependencies = [
"chacha20poly1305",
"curve25519-dalek 4.0.0-rc.1",
"rand_core 0.6.4",
"ring",
"ring 0.16.20",
"rustc_version 0.4.0",
"sha2 0.10.7",
"subtle",
@@ -10633,6 +10752,8 @@ name = "sp-core"
version = "21.0.0"
dependencies = [
"array-bytes",
"arrayvec 0.7.4",
"bandersnatch_vrfs",
"bitflags",
"blake2",
"bounded-collections",
@@ -10647,7 +10768,7 @@ dependencies = [
"lazy_static",
"libsecp256k1",
"log",
"merlin",
"merlin 2.0.1",
"parity-scale-codec",
"parking_lot 0.12.1",
"paste",
@@ -13028,7 +13149,7 @@ version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd"
dependencies = [
"ring",
"ring 0.16.20",
"untrusted",
]