Skip to content

Commit

Permalink
Use immutable state in contracts.
Browse files Browse the repository at this point in the history
  • Loading branch information
feltroidprime committed Nov 3, 2024
1 parent 1c67117 commit c338170
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions hydra/garaga/starknet/groth16_contract_generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def gen_groth16_verifier(
#[starknet::interface]
trait IGroth16Verifier{curve_id.name}<TContractState> {{
fn verify_groth16_proof_{curve_id.name.lower()}(
ref self: TContractState,
self: @TContractState,
full_proof_with_hints: Span<felt252>,
) -> Option<Span<u256>>;
}}
Expand All @@ -87,7 +87,7 @@ def gen_groth16_verifier(
#[abi(embed_v0)]
impl IGroth16Verifier{curve_id.name} of super::IGroth16Verifier{curve_id.name}<ContractState> {{
fn verify_groth16_proof_{curve_id.name.lower()}(
ref self: ContractState,
self: @ContractState,
full_proof_with_hints: Span<felt252>,
) -> Option<Span<u256>> {{
// DO NOT EDIT THIS FUNCTION UNLESS YOU KNOW WHAT YOU ARE DOING.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def gen_risc0_groth16_verifier(
#[starknet::interface]
trait IRisc0Groth16Verifier{curve_id.name}<TContractState> {{
fn verify_groth16_proof_{curve_id.name.lower()}(
ref self: TContractState,
self: @TContractState,
full_proof_with_hints: Span<felt252>,
) -> Option<Span<u8>>;
}}
Expand All @@ -84,7 +84,7 @@ def gen_risc0_groth16_verifier(
#[abi(embed_v0)]
impl IRisc0Groth16Verifier{curve_id.name} of super::IRisc0Groth16Verifier{curve_id.name}<ContractState> {{
fn verify_groth16_proof_{curve_id.name.lower()}(
ref self: ContractState,
self: @ContractState,
full_proof_with_hints: Span<felt252>,
) -> Option<Span<u8>> {{
// DO NOT EDIT THIS FUNCTION UNLESS YOU KNOW WHAT YOU ARE DOING.
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/drand_quicknet/src/drand_verifier.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use super::drand_verifier_constants::{G2_GEN, precomputed_lines};
#[starknet::interface]
trait IDrandQuicknet<TContractState> {
fn verify_round_and_get_randomness(
ref self: TContractState, full_proof_with_hints: Span<felt252>,
self: @TContractState, full_proof_with_hints: Span<felt252>,
) -> Option<felt252>;
}

Expand Down Expand Up @@ -35,7 +35,7 @@ mod DrandQuicknet {
#[abi(embed_v0)]
impl IDrandQuicknet of super::IDrandQuicknet<ContractState> {
fn verify_round_and_get_randomness(
ref self: ContractState, mut full_proof_with_hints: Span<felt252>,
self: @ContractState, mut full_proof_with_hints: Span<felt252>,
) -> Option<felt252> {
let drand_hint: DrandHint = Serde::deserialize(ref full_proof_with_hints).unwrap();
let message = round_to_curve_bls12_381(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use super::groth16_verifier_constants::{N_PUBLIC_INPUTS, vk, ic, precomputed_lin
#[starknet::interface]
trait IGroth16VerifierBLS12_381<TContractState> {
fn verify_groth16_proof_bls12_381(
ref self: TContractState, full_proof_with_hints: Span<felt252>,
self: @TContractState, full_proof_with_hints: Span<felt252>,
) -> Option<Span<u256>>;
}

Expand All @@ -27,7 +27,7 @@ mod Groth16VerifierBLS12_381 {
#[abi(embed_v0)]
impl IGroth16VerifierBLS12_381 of super::IGroth16VerifierBLS12_381<ContractState> {
fn verify_groth16_proof_bls12_381(
ref self: ContractState, full_proof_with_hints: Span<felt252>,
self: @ContractState, full_proof_with_hints: Span<felt252>,
) -> Option<Span<u256>> {
// DO NOT EDIT THIS FUNCTION UNLESS YOU KNOW WHAT YOU ARE DOING.
// This function returns an Option for the public inputs if the proof is valid.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use super::groth16_verifier_constants::{N_PUBLIC_INPUTS, vk, ic, precomputed_lin
#[starknet::interface]
trait IGroth16VerifierBN254<TContractState> {
fn verify_groth16_proof_bn254(
ref self: TContractState, full_proof_with_hints: Span<felt252>,
self: @TContractState, full_proof_with_hints: Span<felt252>,
) -> Option<Span<u256>>;
}

Expand All @@ -27,7 +27,7 @@ mod Groth16VerifierBN254 {
#[abi(embed_v0)]
impl IGroth16VerifierBN254 of super::IGroth16VerifierBN254<ContractState> {
fn verify_groth16_proof_bn254(
ref self: ContractState, full_proof_with_hints: Span<felt252>,
self: @ContractState, full_proof_with_hints: Span<felt252>,
) -> Option<Span<u256>> {
// DO NOT EDIT THIS FUNCTION UNLESS YOU KNOW WHAT YOU ARE DOING.
// This function returns an Option for the public inputs if the proof is valid.
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/risc0_verifier_bn254/src/groth16_verifier.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use super::groth16_verifier_constants::{N_FREE_PUBLIC_INPUTS, vk, ic, precompute
#[starknet::interface]
trait IRisc0Groth16VerifierBN254<TContractState> {
fn verify_groth16_proof_bn254(
ref self: TContractState, full_proof_with_hints: Span<felt252>,
self: @TContractState, full_proof_with_hints: Span<felt252>,
) -> Option<Span<u8>>;
}

Expand All @@ -27,7 +27,7 @@ mod Risc0Groth16VerifierBN254 {
#[abi(embed_v0)]
impl IRisc0Groth16VerifierBN254 of super::IRisc0Groth16VerifierBN254<ContractState> {
fn verify_groth16_proof_bn254(
ref self: ContractState, full_proof_with_hints: Span<felt252>,
self: @ContractState, full_proof_with_hints: Span<felt252>,
) -> Option<Span<u8>> {
// DO NOT EDIT THIS FUNCTION UNLESS YOU KNOW WHAT YOU ARE DOING.
// This function returns an Option for the public inputs if the proof is valid.
Expand Down

0 comments on commit c338170

Please sign in to comment.