Babe VRF Signing in keystore (#6225)

* Introduce trait

* Implement VRFSigner in keystore

* Use vrf_sign from keystore

* Convert output to VRFInOut

* Simplify conversion

* vrf_sign secondary slot using keystore

* Fix RPC call to claim_slot

* Use Public instead of Pair

* Check primary threshold in signer

* Fix interface to return error

* Move vrf_sign to BareCryptoStore

* Fix authorship_works test

* Fix BABE logic leaks

* Acquire a read lock once

* Also fix RPC acquiring the read lock once

* Implement a generic way to construct VRF Transcript

* Use make_transcript_data to call sr25519_vrf_sign

* Make sure VRFTranscriptData is serializable

* Cleanup

* Move VRF to it's own module

* Implement & test VRF signing in testing module

* Remove leftover

* Fix feature requirements

* Revert removing vec macro

* Drop keystore pointer to prevent deadlock

* Nitpicks

* Add test to make sure make_transcript works

* Fix mismatch in VRF transcript

* Add a test to verify transcripts match in babe

* Return VRFOutput and VRFProof from keystore
This commit is contained in:
Rakan Alhneiti
2020-06-18 20:37:49 +02:00
committed by GitHub
parent 4b5a0680e3
commit d25f460b63
15 changed files with 394 additions and 94 deletions
+4
View File
@@ -6092,6 +6092,7 @@ dependencies = [
"parking_lot 0.10.2",
"pdqselect",
"rand 0.7.3",
"rand_chacha 0.2.2",
"sc-block-builder",
"sc-client-api",
"sc-consensus-epochs",
@@ -6425,6 +6426,7 @@ version = "2.0.0-rc3"
dependencies = [
"derive_more",
"hex",
"merlin",
"parking_lot 0.10.2",
"rand 0.7.3",
"serde_json",
@@ -7456,6 +7458,7 @@ dependencies = [
"sp-application-crypto",
"sp-consensus",
"sp-consensus-vrf",
"sp-core",
"sp-inherents",
"sp-runtime",
"sp-std",
@@ -7511,6 +7514,7 @@ dependencies = [
"pretty_assertions",
"primitive-types",
"rand 0.7.3",
"rand_chacha 0.2.2",
"regex",
"schnorrkel",
"serde",