-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from NethermindEth/feature/13-fq-field-u384
Feature/13 fq field u384
- Loading branch information
Showing
53 changed files
with
3,119 additions
and
2,169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
starkli_cmd.md | ||
/target |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Code generated by scarb DO NOT EDIT. | ||
version = 1 | ||
|
||
[[package]] | ||
name = "plonk_verifier" | ||
version = "0.1.0" | ||
dependencies = [ | ||
"snforge_std", | ||
] | ||
|
||
[[package]] | ||
name = "plonk_verifier_contract" | ||
version = "0.1.0" | ||
dependencies = [ | ||
"plonk_verifier", | ||
"snforge_std", | ||
] | ||
|
||
[[package]] | ||
name = "snforge_scarb_plugin" | ||
version = "0.31.0" | ||
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.31.0#72ea785ca354e9e506de3e5d687da9fb2c1b3c67" | ||
|
||
[[package]] | ||
name = "snforge_std" | ||
version = "0.31.0" | ||
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.31.0#72ea785ca354e9e506de3e5d687da9fb2c1b3c67" | ||
dependencies = [ | ||
"snforge_scarb_plugin", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[package] | ||
name = "plonk_verifier_contract" | ||
version = "0.1.0" | ||
|
||
# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html | ||
|
||
[[target.starknet-contract]] | ||
casm = true | ||
sierra = true | ||
|
||
[dependencies] | ||
starknet = "2.8.2" | ||
plonk_verifier = { path = "../plonk-verifier" } | ||
|
||
[dev-dependencies] | ||
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.31.0" } | ||
assert_macros = "2.8.2" | ||
|
||
[cairo] | ||
sierra-replace-ids = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
pub use plonk_verifier::plonk::types::{PlonkVerificationKey, PlonkProof}; | ||
pub use plonk_verifier::plonk::verify; | ||
use core::array::ArrayTrait; | ||
|
||
#[starknet::interface] | ||
trait IVerifier<T> { | ||
// fn verify( | ||
// ref self: T, | ||
// verification_key: PlonkVerificationKey, proof: PlonkProof, publicSignals: Array<u256> | ||
// ); | ||
fn verify(ref self: T); | ||
} | ||
|
||
#[starknet::contract] | ||
mod PLONK_Verifier{ | ||
|
||
use core::array::ArrayTrait; | ||
|
||
use plonk_verifier::plonk::verify; | ||
use plonk_verifier::plonk::types::{PlonkVerificationKey, PlonkProof}; | ||
use plonk_verifier::plonk::constants; | ||
|
||
#[storage] | ||
struct Storage {} | ||
|
||
#[constructor] | ||
fn constructor(ref self: ContractState) {} | ||
|
||
#[abi(embed_v0)] | ||
impl PLONK_verifier of super::IVerifier<ContractState> { | ||
|
||
// fn verify(ref self: ContractState, verification_key: PlonkVerificationKey, proof: PlonkProof, publicSignals: Array<u256>) { | ||
fn verify(ref self: ContractState) { | ||
let (n, power, k1, k2, nPublic, nLagrange, Qm, Ql, Qr, Qo, Qc, S1, S2, S3, X_2, w) = | ||
constants::verification_key(); | ||
let verification_key:PlonkVerificationKey = PlonkVerificationKey { | ||
n, power, k1, k2, nPublic, nLagrange, Qm, Ql, Qr, Qo, Qc, S1, S2, S3, X_2, w | ||
}; | ||
|
||
// proof | ||
let (A, B, C, Z, T1, T2, T3, Wxi, Wxiw, eval_a, eval_b, eval_c, eval_s1, eval_s2, | ||
eval_zw) = | ||
constants::proof(); | ||
let proof: PlonkProof = PlonkProof { | ||
A, B, C, Z, T1, T2, T3, Wxi, Wxiw, eval_a, eval_b, eval_c, eval_s1, eval_s2, eval_zw | ||
}; | ||
|
||
//public_signals | ||
let public_signals = constants::public_inputs(); | ||
let verified: bool = plonk_verifier::plonk::verify::PlonkVerifier::verify(verification_key, proof, public_signals); | ||
assert(verified, 'plonk verification failed'); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.