Skip to content

Commit

Permalink
chore:: Refactor field tests to use pasta_curves instead of blstrs
Browse files Browse the repository at this point in the history
- Follow-up of lurk-lab#774
- Swapped out `blstrs::Scalar` implementation in `src/field.rs` with pasta_curves::pallas::Scalar
- Readjusted tests to now run on the `pasta_curve` as opposed to the `blstrs`
- Updated `Cargo.toml` by removing `blstrs` from both the workspace and dev dependencies
- Removed the association of `blstrs/portable` from the `portable` feature in `Cargo.toml`
  • Loading branch information
huitseeker committed Nov 3, 2023
1 parent 014c4d1 commit 3af471c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ base-x = "0.2.11"
bellpepper = { workspace = true }
bellpepper-core = { workspace = true }
bincode = { workspace = true }
blstrs = { workspace = true }
bytecount = "=0.6.4"
camino = { workspace = true, features = ["serde1"] }
clap = { workspace = true, features = ["derive"] }
Expand Down Expand Up @@ -93,7 +92,7 @@ default = []
opencl = ["neptune/opencl", "nova/opencl"]
cuda = ["neptune/cuda", "nova/cuda"]
# compile without ISA extensions
portable = ["blstrs/portable", "pasta-msm/portable", "nova/portable"]
portable = ["pasta-msm/portable", "nova/portable"]
flamegraph = ["pprof/flamegraph", "pprof/criterion"]

[dev-dependencies]
Expand Down Expand Up @@ -123,7 +122,6 @@ base64 = "0.13.1"
bellpepper = { git = "https://github.com/lurk-lab/bellpepper", branch = "dev" }
bellpepper-core = { git = "https://github.com/lurk-lab/bellpepper", branch = "dev" }
bincode = "1.3.3"
blstrs = { git = "https://github.com/lurk-lab/blstrs", branch = "dev" }
clap = "4.3.17"
ff = "0.13"
metrics = "0.21.1"
Expand Down
8 changes: 2 additions & 6 deletions src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,6 @@ pub trait LurkField: PrimeField + PrimeFieldBits {
}
}

impl LurkField for blstrs::Scalar {
const FIELD: LanguageField = LanguageField::BLS12_381;
}

impl LurkField for pasta_curves::pallas::Scalar {
const FIELD: LanguageField = LanguageField::Pallas;
}
Expand Down Expand Up @@ -348,7 +344,7 @@ impl<'de, F: LurkField> Deserialize<'de> for FWrap<F> {
#[cfg(test)]
pub mod tests {
use crate::z_data::{from_z_data, to_z_data};
use blstrs::Scalar as Fr;
use pasta_curves::pallas::Scalar as Fr;
use pasta_curves::{pallas, vesta};

use super::*;
Expand Down Expand Up @@ -473,7 +469,7 @@ pub mod tests {

#[test]
fn prop_bls_tag_roundtrip(x in any::<u64>()){
let f1 = blstrs::Scalar::from(x);
let f1 = pasta_curves::pallas::Scalar::from(x);
let bytes = f1.to_repr().as_ref().to_vec();
let mut bytes_from_u64 = [0u8; 32];
bytes_from_u64[..8].copy_from_slice(&x.to_le_bytes());
Expand Down

0 comments on commit 3af471c

Please sign in to comment.