Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 61 additions & 56 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ members = [
"ferveo-wasm",
"subproductdomain",
]
resolver = "2"

[workspace.dependencies]
anyhow = "1.0.47"
Expand All @@ -34,20 +35,22 @@ js-sys = "0.3.63"
measure_time = "0.8"
miracl_core = "=2.3.0"
pprof = "0.6"
pyo3 = "0.18.2"
pyo3 = "0.27"
pyo3-build-config = "*"
rand = "0.8"
rand_chacha = "0.3"
rand_core = "0.6.4"
rand_old = { package = "rand", version = "0.7" } # TODO: Used by benchmarks/pairing.rs, update to rand = "0.8" when possible
secrecy = "0.10"
serde = "1.0"
serde_bytes = "0.11.9"
serde-encoded-bytes = "0.2"
serde_with = "2.2.0"
sha2 = "0.10.6"
subproductdomain = { path = "subproductdomain" }
test-case = "3.3.1"
thiserror = "1.0"
wasm-bindgen = "0.2.100"
wasm-bindgen-derive = "0.2.1"
wasm-bindgen-derive = "0.3"
wasm-bindgen-test = "0.3.28"
zeroize = "1.6.0"

Expand Down
1 change: 1 addition & 0 deletions ferveo-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ generic-array = { workspace = true }
rand = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_with = { workspace = true }
serde-encoded-bytes = { workspace = true }

[dev-dependencies]
ark-bls12-381 = { workspace = true }
12 changes: 6 additions & 6 deletions ferveo-common/src/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
use serde::{self, Deserialize, Serialize};
use serde_with::Bytes;
use serde_encoded_bytes::{Hex, SliceLike};

//
// Serialization with serde
Expand All @@ -15,7 +15,7 @@ pub mod ser {
//! Simply use the following attribute on your field:
//! `#[serde(with = "serialization::ser") attribute"]`

use serde_with::{DeserializeAs, SerializeAs};
use serde_encoded_bytes::{Hex, SliceLike};

use super::*;

Expand All @@ -32,7 +32,7 @@ pub mod ser {
val.serialize_compressed(&mut bytes)
.map_err(serde::ser::Error::custom)?;

Bytes::serialize_as(&bytes, serializer)
SliceLike::<Hex>::serialize(&bytes, serializer)
}

/// You can use this to deserialize an arkworks type with serde and the "deserialize_with" attribute.
Expand All @@ -42,7 +42,7 @@ pub mod ser {
T: CanonicalDeserialize,
D: serde::Deserializer<'de>,
{
let bytes: Vec<u8> = Bytes::deserialize_as(deserializer)?;
let bytes: Vec<u8> = SliceLike::<Hex>::deserialize(deserializer)?;
T::deserialize_compressed(&mut &bytes[..])
.map_err(serde::de::Error::custom)
}
Expand Down Expand Up @@ -70,7 +70,7 @@ where
val.serialize_compressed(&mut bytes)
.map_err(serde::ser::Error::custom)?;

Bytes::serialize_as(&bytes, serializer)
SliceLike::<Hex>::serialize(&bytes, serializer)
}
}

Expand All @@ -82,7 +82,7 @@ where
where
D: serde::Deserializer<'de>,
{
let bytes: Vec<u8> = Bytes::deserialize_as(deserializer)?;
let bytes: Vec<u8> = SliceLike::<Hex>::deserialize(deserializer)?;
T::deserialize_compressed(&mut &bytes[..])
.map_err(serde::de::Error::custom)
}
Expand Down
4 changes: 0 additions & 4 deletions ferveo-python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ publish = false
[lib]
crate-type = ["cdylib"]

[features]
extension-module = ["pyo3/extension-module"]
default = ["extension-module"]

[dependencies]
ferveo = { package = "ferveo-nucypher", path = "../ferveo", features = ["bindings-python"] }
pyo3 = { workspace = true }
Expand Down
7 changes: 1 addition & 6 deletions ferveo-python/examples/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
)


def gen_eth_addr(i: int) -> str:
return f"0x{i:040x}" # TODO: Randomize - #207


tau = 1
shares_num = 4
# In precomputed variant, security threshold must be equal to shares_num
security_threshold = shares_num

validator_keypairs = [Keypair.random() for _ in range(0, shares_num)]
validators = [
Validator(gen_eth_addr(i), keypair.public_key(), i)
Validator(keypair.public_key(), i)
for i, keypair in enumerate(validator_keypairs)
]

Expand All @@ -26,5 +22,4 @@ def gen_eth_addr(i: int) -> str:
shares_num=shares_num,
security_threshold=security_threshold,
validators=[],
me=validators[0],
)
Loading
Loading