Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Introduce TestnetV0 Network Impl #2414

Merged
merged 12 commits into from
Apr 12, 2024
12 changes: 11 additions & 1 deletion circuit/environment/src/helpers/converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::{Circuit, LinearCombination, Variable, R1CS};
use crate::{Circuit, LinearCombination, TestnetCircuit, Variable, R1CS};
use snarkvm_curves::edwards_bls12::Fq;
use snarkvm_fields::PrimeField;

Expand All @@ -34,6 +34,16 @@ impl snarkvm_algorithms::r1cs::ConstraintSynthesizer<Fq> for Circuit {
}
}

impl snarkvm_algorithms::r1cs::ConstraintSynthesizer<Fq> for TestnetCircuit {
/// Synthesizes the constraints from the environment into a `snarkvm_algorithms::r1cs`-compliant constraint system.
fn generate_constraints<CS: snarkvm_algorithms::r1cs::ConstraintSystem<Fq>>(
&self,
cs: &mut CS,
) -> Result<(), snarkvm_algorithms::r1cs::SynthesisError> {
crate::testnet_circuit::TESTNET_CIRCUIT.with(|circuit| circuit.borrow().generate_constraints(cs))
}
}

impl<F: PrimeField> R1CS<F> {
/// Synthesizes the constraints from the environment into a `snarkvm_algorithms::r1cs`-compliant constraint system.
fn generate_constraints<CS: snarkvm_algorithms::r1cs::ConstraintSystem<F>>(
Expand Down
3 changes: 3 additions & 0 deletions circuit/environment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ pub mod macros;
#[allow(unused_imports)]
pub use macros::*;

pub mod testnet_circuit;
pub use testnet_circuit::*;

pub mod traits;
pub use traits::*;

Expand Down
Loading