From fd36b40babb843f52938559cd71f66f04f3d9796 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Thu, 17 Oct 2024 17:14:02 +0200 Subject: [PATCH] Arrabiata/curve: define SPONGE_CONSTANTS for ArrabiataCurve --- arrabbiata/src/curve.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arrabbiata/src/curve.rs b/arrabbiata/src/curve.rs index 5453dd298e..cc1a72b2c7 100644 --- a/arrabbiata/src/curve.rs +++ b/arrabbiata/src/curve.rs @@ -32,6 +32,13 @@ pub trait ArrabbiataCurve: 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; @@ -50,6 +57,10 @@ pub trait ArrabbiataCurve: CommitmentCurve + EndoCurve { impl ArrabbiataCurve for Affine { const NAME: &'static str = "pallas"; + type SpongeConstants = PlonkSpongeConstants; + + const SPONGE_CONSTANTS: Self::SpongeConstants = PlonkSpongeConstants {}; + fn sponge_params() -> &'static ArithmeticSpongeParams { crate::poseidon_3_60_0_5_5_fq::static_params() } @@ -70,6 +81,10 @@ impl ArrabbiataCurve for Affine { impl ArrabbiataCurve for Affine { const NAME: &'static str = "vesta"; + type SpongeConstants = PlonkSpongeConstants; + + const SPONGE_CONSTANTS: Self::SpongeConstants = PlonkSpongeConstants {}; + fn sponge_params() -> &'static ArithmeticSpongeParams { crate::poseidon_3_60_0_5_5_fp::static_params() }