Skip to content

Commit

Permalink
Chore: generalize REPL the field and enable BN256
Browse files Browse the repository at this point in the history
* Remove the hardcoded Pallas field from the REPL
* Enable the use of BN256/Grumpkin cycle
  • Loading branch information
arthurpaulino committed Jan 4, 2024
1 parent 71db5fb commit 5c14852
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 138 deletions.
6 changes: 4 additions & 2 deletions src/cli/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ impl std::fmt::Display for Backend {

impl Backend {
fn compatible_fields(&self) -> Vec<LanguageField> {
use LanguageField::{Pallas, Vesta};
// TODO: does this compatibility check still make sense now that we have
// CurveCycleEquiped?
use LanguageField::{Grumpkin, Pallas, Vesta, BN256};
match self {
Self::Nova => vec![Pallas, Vesta],
Self::Nova => vec![Pallas, Vesta, BN256, Grumpkin],
}
}

Expand Down
13 changes: 7 additions & 6 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod zstore;
use anyhow::{bail, Context, Result};
use camino::Utf8PathBuf;
use clap::{Args, Parser, Subcommand};
use halo2curves::bn256;
use pasta_curves::pallas;

use std::{
Expand Down Expand Up @@ -354,9 +355,9 @@ impl ReplCli {
backend.validate_field(field)?;
match field {
LanguageField::Pallas => repl!(rc, limit, pallas::Scalar, backend.clone()),
LanguageField::Vesta => todo!(),
LanguageField::BN256 => todo!(),
LanguageField::Grumpkin => todo!(),
LanguageField::Vesta => unimplemented!("Vesta field is not CurveCycleEquipped"),
LanguageField::BN256 => repl!(rc, limit, bn256::Fr, backend.clone()),
LanguageField::Grumpkin => unimplemented!("Grumpkin field is not CurveCycleEquipped"),
}
}
}
Expand Down Expand Up @@ -408,9 +409,9 @@ impl LoadCli {
backend.validate_field(field)?;
match field {
LanguageField::Pallas => load!(rc, limit, pallas::Scalar, backend.clone()),
LanguageField::Vesta => todo!(),
LanguageField::BN256 => todo!(),
LanguageField::Grumpkin => todo!(),
LanguageField::Vesta => unimplemented!("Vesta field is not CurveCycleEquipped"),
LanguageField::BN256 => load!(rc, limit, bn256::Fr, backend.clone()),
LanguageField::Grumpkin => unimplemented!("Grumpkin field is not CurveCycleEquipped"),
}
}
}
Expand Down
Loading

0 comments on commit 5c14852

Please sign in to comment.