Kaynağa Gözat

sdk/ecvrf: Derive SerialEncodable and SerialDecodable traits for the proof.

parazyd 3 yıl önce
ebeveyn
işleme
4442b1d2c3
2 değiştirilmiş dosya ile 3 ekleme ve 2 silme
  1. 1 1
      src/sdk/Cargo.toml
  2. 2 1
      src/sdk/src/crypto/ecvrf.rs

+ 1 - 1
src/sdk/Cargo.toml

@@ -16,7 +16,7 @@ doctest = false
 thiserror = "1.0.40"
 
 # Serialization
-darkfi-serial = {version = "0.4.1", path = "../serial", features = ["derive", "pasta_curves"]}
+darkfi-serial = {version = "0.4.1", path = "../serial", features = ["derive", "pasta_curves", "hash"]}
 
 # Encoding
 bs58 = "0.4.0"

+ 2 - 1
src/sdk/src/crypto/ecvrf.rs

@@ -19,6 +19,7 @@
 //! https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-04#section-5
 #![allow(non_snake_case)]
 
+use darkfi_serial::{SerialDecodable, SerialEncodable};
 use halo2_gadgets::ecc::chip::FixedPoint;
 use pasta_curves::{
     arithmetic::CurveExt,
@@ -36,7 +37,7 @@ use super::{constants::NullifierK, util::mod_r_p, PublicKey, SecretKey};
 const VRF_DOMAIN: &str = "DarkFi_ECVRF";
 
 /// VRF Proof
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone, Debug, SerialEncodable, SerialDecodable)]
 pub struct VrfProof {
     gamma: pallas::Point,
     c: blake3::Hash,