Skip to content

Commit

Permalink
Use the serde_as crate to serialize potentially big arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
elichai committed Nov 17, 2021
1 parent d55c5e6 commit 29d389b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ rand_core = "0.6.3"
curv-kzen = { git = "https://github.com/ZenGo-X/curv", branch = "ffts" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
criterion = "0.3"
serde_with = "1.11.0"

[dev-dependencies]
quickcheck = "0.9"
quickcheck_macros = "0.9"
criterion = "0.3"


[[bench]]
name = "dpf_bench"
Expand Down
6 changes: 6 additions & 0 deletions src/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,24 @@ use curv::cryptographic_primitives::secret_sharing::{
use curv::elliptic::curves::{Point, Scalar, Secp256k1};
use curv::BigInt;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
use std::convert::TryInto;
use std::ops::{Add, Neg};
use std::ptr;
use std::{fs, mem};

#[serde_as]
#[derive(Debug, Serialize, Deserialize)]
pub struct LongTermKey {
pub alpha_i: Scalar<Secp256k1>,
pub sk_i: Scalar<Secp256k1>,
#[serde_as(as = "[[_; t]; c]")]
pub w_i: [[BigInt; t]; c],
#[serde_as(as = "[[_; t]; c]")]
pub eta_i: [[BigInt; t]; c],
#[serde_as(as = "[[_; t]; c]")]
pub beta_i: [[Scalar<Secp256k1>; t]; c],
#[serde_as(as = "[[_; t]; c]")]
pub gamma_i: [[Scalar<Secp256k1>; t]; c],
pub u_i_0: [[DSPF; (n - 1)]; c],
pub u_i_1: [[DSPF; (n - 1)]; c],
Expand Down

0 comments on commit 29d389b

Please sign in to comment.