Skip to content

Commit

Permalink
Arrabiata/curve: define SPONGE_CONSTANTS for ArrabiataCurve
Browse files Browse the repository at this point in the history
  • Loading branch information
dannywillems committed Oct 28, 2024
1 parent 46f0e4e commit 9a56f7a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions arrabiata/src/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ pub trait ArrabiataCurve: CommitmentCurve + EndoCurve {
/// A human readable name.
const NAME: &'static str;

// FIXME: use this in the codebase.
// We might want to use different sponge constants for different curves.
// For now, it does use the same constants for both curves.
type SpongeConstants: SpongeConstants;

const SPONGE_CONSTANTS: Self::SpongeConstants;

/// Provides the sponge params to be used with this curve.
fn sponge_params() -> &'static ArithmeticSpongeParams<Self::ScalarField>;

Expand All @@ -50,6 +57,10 @@ pub trait ArrabiataCurve: CommitmentCurve + EndoCurve {
impl ArrabiataCurve for Affine<PallasParameters> {
const NAME: &'static str = "pallas";

type SpongeConstants = PlonkSpongeConstants;

const SPONGE_CONSTANTS: Self::SpongeConstants = PlonkSpongeConstants {};

fn sponge_params() -> &'static ArithmeticSpongeParams<Self::ScalarField> {
crate::poseidon_3_60_0_5_5_fq::static_params()
}
Expand All @@ -70,6 +81,10 @@ impl ArrabiataCurve for Affine<PallasParameters> {
impl ArrabiataCurve for Affine<VestaParameters> {
const NAME: &'static str = "vesta";

type SpongeConstants = PlonkSpongeConstants;

const SPONGE_CONSTANTS: Self::SpongeConstants = PlonkSpongeConstants {};

fn sponge_params() -> &'static ArithmeticSpongeParams<Self::ScalarField> {
crate::poseidon_3_60_0_5_5_fp::static_params()
}
Expand Down

0 comments on commit 9a56f7a

Please sign in to comment.