Skip to content

Commit

Permalink
Chore: generalize the REPL 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 10cf81b
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 138 deletions.
4 changes: 2 additions & 2 deletions src/cli/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ impl std::fmt::Display for Backend {

impl Backend {
fn compatible_fields(&self) -> Vec<LanguageField> {
use LanguageField::{Pallas, Vesta};
use LanguageField::{Pallas, BN256};
match self {
Self::Nova => vec![Pallas, Vesta],
Self::Nova => vec![BN256, Pallas],
}
}

Expand Down
11 changes: 5 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 @@ -353,10 +354,9 @@ impl ReplCli {
validate_non_zero("rc", rc)?;
backend.validate_field(field)?;
match field {
LanguageField::BN256 => repl!(rc, limit, bn256::Fr, backend.clone()),
LanguageField::Pallas => repl!(rc, limit, pallas::Scalar, backend.clone()),
LanguageField::Vesta => todo!(),
LanguageField::BN256 => todo!(),
LanguageField::Grumpkin => todo!(),
LanguageField::Grumpkin | LanguageField::Vesta => unreachable!(),
}
}
}
Expand Down Expand Up @@ -407,10 +407,9 @@ impl LoadCli {
validate_non_zero("rc", rc)?;
backend.validate_field(field)?;
match field {
LanguageField::BN256 => load!(rc, limit, bn256::Fr, backend.clone()),
LanguageField::Pallas => load!(rc, limit, pallas::Scalar, backend.clone()),
LanguageField::Vesta => todo!(),
LanguageField::BN256 => todo!(),
LanguageField::Grumpkin => todo!(),
LanguageField::Grumpkin | LanguageField::Vesta => unreachable!(),
}
}
}
Expand Down
Loading

0 comments on commit 10cf81b

Please sign in to comment.