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

Implement air_private_input #1552

Merged
merged 36 commits into from
Jan 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
fe145e8
Implement get_air_private_input for RangeCheck;
fmoletta Jan 9, 2024
dff4d39
Implement air_private_input for Bitwise;
fmoletta Jan 10, 2024
c6b85fd
Implement air_private_input for Hash
fmoletta Jan 10, 2024
5ee533a
Update proof_programs symlinks
fmoletta Jan 10, 2024
b32f9dc
Add EcOp priv input variant
fmoletta Jan 10, 2024
aa1d4f1
Implement air_private_input for EcOp
fmoletta Jan 10, 2024
548bbaa
Implement air_private_input for Poseidon & Signature
fmoletta Jan 10, 2024
cca1f55
Implement air_private_input for Keccak
fmoletta Jan 10, 2024
df18495
Add AirPrivateInput serialization
fmoletta Jan 10, 2024
fd26554
Remove unwrap
fmoletta Jan 10, 2024
8efc27b
Add targets to compare private inputs against python vm
fmoletta Jan 10, 2024
b6228c4
Add separate script to compare private inputs
fmoletta Jan 11, 2024
4a32062
Ignore & Clean output files
fmoletta Jan 11, 2024
b2ba10b
Fix target
fmoletta Jan 11, 2024
e91b523
Fix + fmt
fmoletta Jan 11, 2024
93ee579
Fetch absolute paths in cli and remove feature-gate
fmoletta Jan 11, 2024
a0f2eb7
Fix ecdsa private input
fmoletta Jan 11, 2024
c92928f
Add no-std import
fmoletta Jan 11, 2024
9770597
Add Chaneglog entry
fmoletta Jan 11, 2024
f2b19a1
Update README
fmoletta Jan 11, 2024
ff44b02
Add cli tests
fmoletta Jan 11, 2024
912bda9
Add case to cli test
fmoletta Jan 11, 2024
ebc249e
Fix conditional
fmoletta Jan 11, 2024
1c77bd4
Add no-std import
fmoletta Jan 11, 2024
4bcc3e3
fmt
fmoletta Jan 11, 2024
37434aa
fix
fmoletta Jan 11, 2024
b6b18fe
Remove unwraps
fmoletta Jan 11, 2024
783b333
Add tests so coverage doesnt sink
fmoletta Jan 11, 2024
2a5bed1
Fix test
fmoletta Jan 11, 2024
95ec39f
Fix test
fmoletta Jan 11, 2024
614938f
Fix test
fmoletta Jan 11, 2024
fe33a2b
Fix symlink
fmoletta Jan 11, 2024
4a71f3c
Remove broken file
fmoletta Jan 11, 2024
b6bdabb
Merge branch 'update-symlinks' into air_private_input
fmoletta Jan 11, 2024
921b841
Merge branch 'main' into air_private_input
Oppen Jan 15, 2024
b20da7d
Merge branch 'main' into air_private_input
fmoletta Jan 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix ecdsa private input
fmoletta committed Jan 11, 2024
commit a0f2eb7f0dc31afe15ccf206d019878acc05963e
20 changes: 13 additions & 7 deletions vm/src/vm/runners/builtin_runner/signature.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::air_private_input::{PrivateInput, PrivateInputSignature, SignatureInput};
use crate::math_utils::div_mod;
use crate::stdlib::{cell::RefCell, collections::HashMap, prelude::*, rc::Rc};

use crate::types::errors::math_errors::MathError;
@@ -19,16 +20,16 @@ use crate::{
},
};
use lazy_static::lazy_static;
use num_bigint::{BigInt, Sign};
use num_integer::div_ceil;
use num_traits::{Num, One};
use starknet_crypto::{verify, FieldElement, Signature};
use starknet_types_core::felt::NonZeroFelt;

lazy_static! {
static ref EC_ORDER: NonZeroFelt = Felt252::from_dec_str(
"3618502788666131213697322783095070105526743751716087489154079457884512865583"
static ref EC_ORDER: BigInt = BigInt::from_str_radix(
"3618502788666131213697322783095070105526743751716087489154079457884512865583",
10
)
.unwrap()
.try_into()
.unwrap();
}

@@ -256,9 +257,14 @@ impl SignatureBuiltinRunner {
msg: *msg,
signature_input: SignatureInput {
r: Felt252::from_bytes_be(&signature.r.to_bytes_be()),
w: Felt252::from_bytes_be(&signature.r.to_bytes_be())
.mod_inverse(&EC_ORDER)
w: Felt252::from(
&div_mod(
&BigInt::one(),
&BigInt::from_bytes_be(Sign::Plus, &signature.s.to_bytes_be()),
&EC_ORDER,
)
.unwrap_or_default(),
),
},
}))
}