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

Try to use plonky2 and starky for proving and verifying (WIP) #1609

Draft
wants to merge 44 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7c557d3
Use workspace dependencies
matthiasgoergens Apr 22, 2024
e140e28
No more looked tables
matthiasgoergens Apr 22, 2024
defbda8
Fix extraction
matthiasgoergens Apr 22, 2024
8e00e78
More extraction
matthiasgoergens Apr 22, 2024
79d587d
Ignore rangecheck, too
matthiasgoergens Apr 22, 2024
3495e6c
Fix warning
matthiasgoergens Apr 22, 2024
8f5642b
Merge branch 'matthias/use-workspace-deps' into matthias/ctl/use-upst…
matthiasgoergens Apr 22, 2024
b8e88ba
Use my hacked up prototype plonky2
matthiasgoergens Apr 22, 2024
642d3b9
Radical surgery to remove public sub table mechanism (temporarily)
matthiasgoergens Apr 22, 2024
a00b344
Update example's Cargo.lock for some reason
matthiasgoergens Apr 22, 2024
fae398f
Clean up
matthiasgoergens Apr 22, 2024
383e914
Use upstream, pre
matthiasgoergens Apr 22, 2024
dd6f0fd
Merge remote-tracking branch 'origin/main' into matthias/ctl/use-upst…
matthiasgoergens Apr 23, 2024
ba4240f
Update
matthiasgoergens Apr 23, 2024
3f35bc0
Match starky
matthiasgoergens Apr 23, 2024
cfeeb43
Use upstream
matthiasgoergens Apr 23, 2024
7dae23c
base verifier compiles, tackling recursion
matthiasgoergens Apr 24, 2024
9a3d6d1
Merge remote-tracking branch 'origin/main' into matthias/ctl/use-upst…
matthiasgoergens Apr 24, 2024
d65aaa9
Try to make basic proving and verification work
matthiasgoergens Apr 24, 2024
1c8b93c
Use my branch
matthiasgoergens Apr 24, 2024
0dc5c0b
Update
matthiasgoergens Apr 24, 2024
b51474a
Simpler
matthiasgoergens Apr 24, 2024
f2e65de
Serialising
matthiasgoergens Apr 24, 2024
11297df
Nicer
matthiasgoergens Apr 24, 2024
98364e3
All the things
matthiasgoergens Apr 24, 2024
ed4d1cd
Clippy fix
matthiasgoergens Apr 24, 2024
9db9a4b
Clippy
matthiasgoergens Apr 24, 2024
d7b5a6f
Standalone proving
matthiasgoergens Apr 24, 2024
49d789c
Rescue tests
matthiasgoergens Apr 24, 2024
60bd2e2
Fix forgotten ones
matthiasgoergens Apr 24, 2024
28adc1c
Verify
matthiasgoergens Apr 24, 2024
801cdc0
Simpler
matthiasgoergens Apr 24, 2024
9da3be1
Update
matthiasgoergens Apr 24, 2024
8bdee5e
Merge remote-tracking branch 'origin/main' into matthias/ctl/use-upst…
matthiasgoergens Apr 24, 2024
27cebe8
Fix more
matthiasgoergens Apr 24, 2024
ca7f5b5
Restore
matthiasgoergens Apr 24, 2024
f0da0ac
Cargo update
matthiasgoergens Apr 24, 2024
84bac18
Fix from_u32
matthiasgoergens Apr 24, 2024
545575f
Progress
matthiasgoergens Apr 24, 2024
eee3932
More progress
matthiasgoergens Apr 24, 2024
ca33a6f
Merge remote-tracking branch 'origin/main' into matthias/ctl/use-upst…
matthiasgoergens Apr 24, 2024
2c22f52
Merge remote-tracking branch 'origin/main' into matthias/ctl/use-upst…
matthiasgoergens Apr 24, 2024
c7d7af8
Merge remote-tracking branch 'origin/main' into matthias/ctl/use-upst…
matthiasgoergens Apr 25, 2024
b10948a
Merge remote-tracking branch 'origin/main' into matthias/ctl/use-upst…
matthiasgoergens Apr 30, 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
11 changes: 6 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ starky = { version = "0", default-features = false }
plonky2_crypto = { git = "https://github.com/0xmozak/plonky2-crypto.git" }

[patch.crates-io]
plonky2 = { git = "https://github.com/0xmozak/plonky2.git" }
plonky2_maybe_rayon = { git = "https://github.com/0xmozak/plonky2.git" }
starky = { git = "https://github.com/0xmozak/plonky2.git" }
# plonky2 = { path = "../plonky2/plonky2" }
# plonky2_maybe_rayon = { path = "../plonky2/maybe_rayon" }
# starky = { path = "../plonky2/starky" }
plonky2 = { git = "https://github.com/0xmozak/plonky2.git", branch = "matthias/looked-tables" }
plonky2_maybe_rayon = { git = "https://github.com/0xmozak/plonky2.git", branch = "matthias/looked-tables" }
starky = { git = "https://github.com/0xmozak/plonky2.git", branch = "matthias/looked-tables" }
13 changes: 11 additions & 2 deletions circuits/src/bitshift/stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use crate::unstark::NoColumns;
#[allow(clippy::module_name_repetitions)]
pub struct BitshiftStark<F, const D: usize> {
pub _f: PhantomData<F>,
pub standalone_proving: bool,
}

impl<F, const D: usize> HasNamedColumns for BitshiftStark<F, D> {
Expand Down Expand Up @@ -80,6 +81,8 @@ impl<F: RichField + Extendable<D>, const D: usize> Stark<F, D> for BitshiftStark
type EvaluationFrameTarget =
StarkFrame<ExtensionTarget<D>, ExtensionTarget<D>, COLUMNS, PUBLIC_INPUTS>;

fn requires_ctls(&self) -> bool { !self.standalone_proving }

fn eval_packed_generic<FE, P, const D2: usize>(
&self,
vars: &Self::EvaluationFrame<FE, P, D2>,
Expand Down Expand Up @@ -127,7 +130,10 @@ mod tests {

#[test]
fn test_degree() -> Result<()> {
let stark = S::default();
let stark = S {
standalone_proving: true,
..S::default()
};
test_stark_low_degree(stark)
}

Expand Down Expand Up @@ -206,7 +212,10 @@ mod tests {

#[test]
fn test_circuit() -> anyhow::Result<()> {
let stark = S::default();
let stark = S {
standalone_proving: true,
..S::default()
};
test_stark_circuit_constraints::<F, C, S, D>(stark)?;

Ok(())
Expand Down
5 changes: 4 additions & 1 deletion circuits/src/cpu/mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ mod tests {
"trace to poly",
trace_rows_to_poly_values(cpu_trace)
);
let stark = S::default();
let stark = S {
standalone_proving: true,
..S::default()
};
let public_inputs = PublicInputs {
entry_point: from_u32(program.entry_point),
};
Expand Down
13 changes: 11 additions & 2 deletions circuits/src/cpu/stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use crate::stark::mozak_stark::PublicInputs;
#[allow(clippy::module_name_repetitions)]
pub struct CpuStark<F, const D: usize> {
pub _f: PhantomData<F>,
pub standalone_proving: bool,
}

impl<F, const D: usize> HasNamedColumns for CpuStark<F, D> {
Expand Down Expand Up @@ -151,6 +152,8 @@ impl<F: RichField + Extendable<D>, const D: usize> Stark<F, D> for CpuStark<F, D
type EvaluationFrameTarget =
StarkFrame<ExtensionTarget<D>, ExtensionTarget<D>, COLUMNS, PUBLIC_INPUTS>;

fn requires_ctls(&self) -> bool { !self.standalone_proving }

fn eval_packed_generic<FE, P, const D2: usize>(
&self,
vars: &Self::EvaluationFrame<FE, P, D2>,
Expand Down Expand Up @@ -194,7 +197,10 @@ mod tests {
type F = <C as GenericConfig<D>>::F;
type S = CpuStark<F, D>;

let stark = S::default();
let stark = S {
standalone_proving: true,
..S::default()
};
test_stark_low_degree(stark)
}

Expand All @@ -205,7 +211,10 @@ mod tests {
type F = <C as GenericConfig<D>>::F;
type S = CpuStark<F, D>;

let stark = S::default();
let stark = S {
standalone_proving: true,
..S::default()
};
test_stark_circuit_constraints::<F, C, S, D>(stark)?;

Ok(())
Expand Down
Loading
Loading