mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 14:01:02 +00:00
Refinements to VRF types (#14036)
* Allow extra signing data * Fix tests after renaming * Rename VrfSecret/VrfVerifier to VrfSecret/VrfPublic * Further encrapsulation of 'transcript' type to the sr25519 implementation * Keystore sr25519 pre-output * Leave additional custom input field hidden in the associated VrfInput type * Fix test * More ergonomic output_bytes * Trigger pipeline * Define a separated type for vrf signature data * Fix docs * Fix doc * Remove annotation * Directly use dleq_proove and dleq_verify in sr25519 * Trigger CI * Remove cruft before merge
This commit is contained in:
@@ -357,12 +357,12 @@ pub mod pallet {
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(vrf_signature) = pre_digest.vrf_signature() {
|
||||
if let Some(signature) = pre_digest.vrf_signature() {
|
||||
let randomness: Option<BabeRandomness> = Authorities::<T>::get()
|
||||
.get(authority_index as usize)
|
||||
.and_then(|(authority, _)| {
|
||||
let public = authority.as_inner_ref();
|
||||
let transcript = sp_consensus_babe::make_transcript(
|
||||
let transcript = sp_consensus_babe::make_vrf_transcript(
|
||||
&Self::randomness(),
|
||||
CurrentSlot::<T>::get(),
|
||||
EpochIndex::<T>::get(),
|
||||
@@ -372,16 +372,12 @@ pub mod pallet {
|
||||
// execution. We don't run the verification again here to avoid slowing
|
||||
// down the runtime.
|
||||
debug_assert!({
|
||||
use sp_core::crypto::VrfVerifier;
|
||||
public.vrf_verify(&transcript, &vrf_signature)
|
||||
use sp_core::crypto::VrfPublic;
|
||||
public.vrf_verify(&transcript.clone().into_sign_data(), &signature)
|
||||
});
|
||||
|
||||
public
|
||||
.make_bytes(
|
||||
RANDOMNESS_VRF_CONTEXT,
|
||||
&transcript,
|
||||
&vrf_signature.output,
|
||||
)
|
||||
.make_bytes(RANDOMNESS_VRF_CONTEXT, &transcript, &signature.output)
|
||||
.ok()
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user