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

feat: fflonk protocol implementation #11

Merged
merged 29 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
451fd86
fflonk implementation
saitima Aug 16, 2024
d65a6dc
recompute quotients
saitima Aug 24, 2024
48d74f3
Bump version and add RELEASE.md
popzxc Aug 16, 2024
9c73d36
ci: Set cancel in progress and concurency limit
alexandrst88 Aug 19, 2024
eeea9ff
improvement of parameters
olesHolem Aug 20, 2024
22008a3
update deps
saitima Sep 10, 2024
e58c9a3
fix(bellman): Bump crossbeam to 0.8
popzxc Aug 27, 2024
a2626c1
ci: Introduce workflow for conventional commits
popzxc Aug 27, 2024
635bb34
Updating TruffleHog
zksync-admin-bot2 Aug 28, 2024
ff53307
ci: Only run main CI if code changed (#16)
popzxc Aug 28, 2024
632dd16
Updating TruffleHog
zksync-admin-bot2 Aug 28, 2024
382da09
Updating TruffleHog
zksync-admin-bot2 Aug 28, 2024
cd73138
chore(ci): Add truflehog CI (#17)
artmakh Aug 28, 2024
faab562
fix: Fix hard static analysis errors (#18)
popzxc Aug 30, 2024
7e32fbb
feat(ci): Introduce release-please and automatic publishing (#19)
popzxc Sep 4, 2024
8637114
chore(main): release 0.29.0 (#20)
zksync-era-bot Sep 4, 2024
7b74e75
feat!: Rename crypto crates and properly set metadata (#21)
popzxc Sep 5, 2024
72de909
chore(main): release 0.30.0 (#23)
zksync-era-bot Sep 5, 2024
36920af
fix(snark-wrapper): Revert "improvement of parameters" (#24)
popzxc Sep 5, 2024
7e94cc2
chore(main): release 0.30.1 (#25)
zksync-era-bot Sep 5, 2024
5af6002
chore(fflonk): small updates for compression
saitima Sep 25, 2024
6da5ae5
chore(fflonk): fflonk vk constructor
saitima Oct 3, 2024
a6a02b0
feat(fflonk): Assembly with allocator
saitima Oct 11, 2024
edaeb81
chore(fflonk): formatting
saitima Oct 24, 2024
1d8cb82
chore(fflonk): cleanup
saitima Oct 24, 2024
71bce38
chore(fflonk): fmt
saitima Oct 24, 2024
d258514
chore(snark-wrapper): cleanup
saitima Oct 24, 2024
f9d912d
chore: resolve conflicts
saitima Oct 29, 2024
427e203
chore(fflonk): cleanup
saitima Oct 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
2 changes: 1 addition & 1 deletion crates/bellman/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ lazy_static = { version = "1", optional = true }
hex = "0.4"

[features]
default = ["multicore", "plonk"]
default = ["multicore", "plonk", "allocator"]
multicore = ["crossbeam", "futures/thread-pool"]
sonic = ["tiny-keccak", "blake2-rfc"]
gm17 = []
Expand Down
11 changes: 11 additions & 0 deletions crates/bellman/src/kate_commitment/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ impl<E: Engine, T: CrsType> PartialEq for Crs<E, T> {
impl<E: Engine, T: CrsType> Eq for Crs<E, T> {}

impl<E: Engine, T: CrsType> Crs<E, T> {
pub fn new(g1_bases: Vec<E::G1Affine>, g2_monomial_bases: Vec<E::G2Affine>) -> Self {
Self {
g1_bases: Arc::new(g1_bases),
g2_monomial_bases: Arc::new(g2_monomial_bases),
_marker: std::marker::PhantomData,
}
}

pub fn write<W: Write>(&self, mut writer: W) -> std::io::Result<()> {
writer.write_u64::<BigEndian>(self.g1_bases.len() as u64)?;
for g in &self.g1_bases[..] {
Expand Down Expand Up @@ -106,7 +114,10 @@ impl<E: Engine> Crs<E, CrsForMonomialForm> {
pub fn crs_42(size: usize, worker: &Worker) -> Self {
// kind of how ceremony would work
assert!(size.is_power_of_two());
Self::non_power_of_two_crs_42(size, worker)
}

pub fn non_power_of_two_crs_42(size: usize, worker: &Worker) -> Self {
let mut g2 = vec![E::G2Affine::one(); 2];

use crate::domain::EvaluationDomain;
Expand Down
25 changes: 25 additions & 0 deletions crates/fflonk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "fflonk"
edition = "2021"
saitima marked this conversation as resolved.
Show resolved Hide resolved
version.workspace = true
authors.workspace = true
homepage.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
categories.workspace = true

[dependencies]
franklin-crypto.workspace = true
num-bigint = { version = "0.4", features = ["serde"] }
num-traits = "0.2"
rand = "0.4"
serde = { version = "1", features = ["derive", "rc"] }
serde_json = "1"
serde_derive = "1"
bincode = "1.3"
byteorder = "1"

[features]
default = ["sanity"]
sanity = []

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"fixed_parameters":{"parameters":{"num_columns_under_copy_permutation":52,"num_witness_columns":78,"num_constant_columns":4,"max_allowed_constraint_degree":8},"lookup_parameters":"NoLookup","domain_size":65536,"total_tables_len":0,"public_inputs_locations":[[0,43116],[1,43116],[2,43116],[3,43116]],"extra_constant_polys_for_selectors":4,"table_ids_column_idxes":[],"quotient_degree":8,"selectors_placement":{"Fork":{"left":{"GateOnly":{"gate_idx":1,"num_constants":0,"degree":7,"needs_selector":true,"is_lookup":false}},"right":{"Fork":{"left":{"Fork":{"left":{"Fork":{"left":{"GateOnly":{"gate_idx":4,"num_constants":4,"degree":3,"needs_selector":true,"is_lookup":false}},"right":{"Fork":{"left":{"Fork":{"left":{"GateOnly":{"gate_idx":2,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":6,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}}}},"right":{"Fork":{"left":{"GateOnly":{"gate_idx":5,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":7,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}}}}}}}},"right":{"Fork":{"left":{"GateOnly":{"gate_idx":9,"num_constants":4,"degree":2,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":0,"num_constants":4,"degree":1,"needs_selector":true,"is_lookup":false}}}}}},"right":{"Fork":{"left":{"GateOnly":{"gate_idx":3,"num_constants":2,"degree":3,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":8,"num_constants":0,"degree":0,"needs_selector":true,"is_lookup":false}}}}}}}},"fri_lde_factor":32,"cap_size":16},"setup_merkle_tree_cap":[[3028482665743782685,4013626514272104307,3452712590746163945,4912199291739380038],[13367838539427916774,12404298820704836825,2033557497865074503,10773714302578067064],[6626133711217130150,832308908322340473,15438304393106056371,2666286053578737706],[8481471713633132065,3309133276563744940,7918049965167111458,8031874943194604818],[5263223393137830953,10930745761839351105,5478654960678829285,16546008998121538254],[11517924705975364603,12492352876657167419,13100479669152088129,2688105380794281749],[13450606005739207930,4309197174004057707,15096097529059494043,3313968628193047404],[2107336175425308275,9681217331404905587,15605533297141074963,13560809298355816900],[15138631997628104659,658734033145504002,3149667820797953919,11382673453815841679],[9718929198768097191,13257822135266668054,11426716361463757106,16221666232651584833],[14942071378703968919,6605816560639450121,3044064806867577175,2464825231511115760],[6473632652194900532,6385447331677139071,694927241206195269,11880524209245868327],[12577598516309120066,3733967226309375831,3974589490790210467,9018542241738106124],[10034922335813086261,8669325737652962101,14457932225168264352,13009521393118340887],[14987376697067705545,15731999951892350110,6056057541217106546,17889421602707651216],[4222248943326048649,14063997483873496005,13888994317272086325,13953910739617791087]]}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"fixed_parameters":{"parameters":{"num_columns_under_copy_permutation":56,"num_witness_columns":74,"num_constant_columns":4,"max_allowed_constraint_degree":8},"lookup_parameters":"NoLookup","domain_size":8192,"total_tables_len":0,"public_inputs_locations":[[0,6733],[1,6733],[2,6733],[3,6733]],"extra_constant_polys_for_selectors":4,"table_ids_column_idxes":[],"quotient_degree":8,"selectors_placement":{"Fork":{"left":{"GateOnly":{"gate_idx":2,"num_constants":0,"degree":7,"needs_selector":true,"is_lookup":false}},"right":{"Fork":{"left":{"Fork":{"left":{"Fork":{"left":{"GateOnly":{"gate_idx":5,"num_constants":4,"degree":3,"needs_selector":true,"is_lookup":false}},"right":{"Fork":{"left":{"Fork":{"left":{"GateOnly":{"gate_idx":1,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":6,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}}}},"right":{"Fork":{"left":{"GateOnly":{"gate_idx":3,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":7,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}}}}}}}},"right":{"Fork":{"left":{"GateOnly":{"gate_idx":10,"num_constants":4,"degree":2,"needs_selector":true,"is_lookup":false}},"right":{"Fork":{"left":{"GateOnly":{"gate_idx":8,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":9,"num_constants":0,"degree":0,"needs_selector":true,"is_lookup":false}}}}}}}},"right":{"Fork":{"left":{"GateOnly":{"gate_idx":4,"num_constants":2,"degree":3,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":0,"num_constants":4,"degree":1,"needs_selector":true,"is_lookup":false}}}}}}}},"fri_lde_factor":512,"cap_size":16},"setup_merkle_tree_cap":[[9400114821788111997,10174379440924306667,12099785726708360652,9995400590381780863],[2334378296910867976,14006318746156115451,16966411770863229696,2899374804263086329],[13822297067659526350,14667208503042377032,3901634748477769399,5237329451203241158],[2586121173484242473,11697284038356613029,933626477645488623,4599736293977604254],[2099670334582336055,3867195468067995229,1115393177006802932,17639487306608701688],[12497937328284772458,13045474460076936702,11906095630145949253,12475772063205231450],[10690784528608045399,13410967387714879575,7726413202767880516,9288245855805206575],[3539994800961587790,6358856348854604088,15934964182027145108,17612693035095380814],[15320048271571873010,7318515779740656203,16551198107996515404,6635393580670140790],[16738837543350324276,16049813959567686449,11823231679317452251,1275441427763795787],[5580643534274018706,9000840914232989267,12531761183229264149,4026853604008981495],[500330480493177138,12068418998446814996,7613708346169355437,14920496053936789366],[3015803821525017736,5151067154241752995,1324640746013551862,10307241715122259745],[10021469121326611699,17467435142856295548,1039423927477390376,632745729880326265],[11776136768439302726,4279926929655131504,3811308792013066876,16279215791269006257],[15579697034529609667,15382304918960613875,10214350428255480911,5169960457284274758]]}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"fixed_parameters":{"parameters":{"num_columns_under_copy_permutation":68,"num_witness_columns":62,"num_constant_columns":4,"max_allowed_constraint_degree":8},"lookup_parameters":"NoLookup","domain_size":4096,"total_tables_len":0,"public_inputs_locations":[[0,3921],[1,3921],[2,3921],[3,3921]],"extra_constant_polys_for_selectors":4,"table_ids_column_idxes":[],"quotient_degree":8,"selectors_placement":{"Fork":{"left":{"GateOnly":{"gate_idx":2,"num_constants":0,"degree":7,"needs_selector":true,"is_lookup":false}},"right":{"Fork":{"left":{"Fork":{"left":{"Fork":{"left":{"GateOnly":{"gate_idx":5,"num_constants":4,"degree":3,"needs_selector":true,"is_lookup":false}},"right":{"Fork":{"left":{"Fork":{"left":{"GateOnly":{"gate_idx":1,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":6,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}}}},"right":{"Fork":{"left":{"GateOnly":{"gate_idx":3,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":7,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}}}}}}}},"right":{"Fork":{"left":{"GateOnly":{"gate_idx":10,"num_constants":4,"degree":2,"needs_selector":true,"is_lookup":false}},"right":{"Fork":{"left":{"GateOnly":{"gate_idx":8,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":9,"num_constants":0,"degree":0,"needs_selector":true,"is_lookup":false}}}}}}}},"right":{"Fork":{"left":{"GateOnly":{"gate_idx":4,"num_constants":2,"degree":3,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":0,"num_constants":4,"degree":1,"needs_selector":true,"is_lookup":false}}}}}}}},"fri_lde_factor":1024,"cap_size":16},"setup_merkle_tree_cap":[[5048537361604679182,12779832903488768359,277693126278561130,13788136543319198147],[5568879198026113787,8143846474260576357,12134698790416648772,17098498816223833482],[11777049327057312860,16605462458597297320,224010380632684851,13703106578899709777],[10581021728519764210,18299710903428264187,15451317418574924424,17914586335933460907],[14372088892151378043,17226104217789084053,13515874478730554766,1674126940803487971],[8818217104999667938,11327283143545590132,11656247300711132808,6791219959704871273],[10906160667601527175,11169398558345148234,16873134240518424291,12196952779542573179],[13996606613560413789,4672648140553242372,294109128977028922,11996685605041293972],[827924603638119710,6125710976444811838,6600009108444309464,4845111723070821797],[88268863970177600,5117127481595406104,1255128294951031871,1617321764874747001],[10919037245220162930,6547862231191257133,13817803910140259094,6600140638205478260],[10362675928820082773,2022644209850215392,15394569569280237306,1426406080860756289],[5657646168784987558,2657619935761910220,4020772523102775144,8613387869656365923],[5330825081205599482,9074998882444713405,7546233779472242171,5819471804945302146],[6274859064737702472,2925247391134293379,11988865621216142996,15600798462253951568],[9023741653883137616,9727471022537789085,10910873244536679349,7670587559431305485]]}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"fixed_parameters":{"parameters":{"num_columns_under_copy_permutation":28,"num_witness_columns":0,"num_constant_columns":4,"max_allowed_constraint_degree":4},"lookup_parameters":"NoLookup","domain_size":131072,"total_tables_len":0,"public_inputs_locations":[[0,105230],[1,105230],[2,105230],[3,105230]],"extra_constant_polys_for_selectors":4,"table_ids_column_idxes":[],"quotient_degree":8,"selectors_placement":{"Fork":{"left":{"GateOnly":{"gate_idx":4,"num_constants":1,"degree":7,"needs_selector":true,"is_lookup":false}},"right":{"Fork":{"left":{"Fork":{"left":{"Fork":{"left":{"GateOnly":{"gate_idx":7,"num_constants":4,"degree":3,"needs_selector":true,"is_lookup":false}},"right":{"Fork":{"left":{"Fork":{"left":{"GateOnly":{"gate_idx":1,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":8,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}}}},"right":{"Fork":{"left":{"GateOnly":{"gate_idx":5,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":9,"num_constants":0,"degree":2,"needs_selector":true,"is_lookup":false}}}}}}}},"right":{"Fork":{"left":{"GateOnly":{"gate_idx":11,"num_constants":4,"degree":2,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":0,"num_constants":4,"degree":1,"needs_selector":true,"is_lookup":false}}}}}},"right":{"Fork":{"left":{"Fork":{"left":{"Fork":{"left":{"GateOnly":{"gate_idx":6,"num_constants":2,"degree":3,"needs_selector":true,"is_lookup":false}},"right":{"GateOnly":{"gate_idx":10,"num_constants":0,"degree":0,"needs_selector":true,"is_lookup":false}}}},"right":{"GateOnly":{"gate_idx":3,"num_constants":0,"degree":1,"needs_selector":true,"is_lookup":false}}}},"right":{"GateOnly":{"gate_idx":2,"num_constants":0,"degree":1,"needs_selector":true,"is_lookup":false}}}}}}}},"fri_lde_factor":4096,"cap_size":8},"setup_merkle_tree_cap":[[4525875515770115160,9408868337594528142,14932892545790926850,2311335952453171836],[17844154421918865763,16396614085880122548,6292046292088014592,516798742015947720],[2393586786249636419,1760242350191173950,6903420143550582655,907752138199388308],[11096185673069362255,14760640347214763931,1444125632269263256,2934559923319099228],[1574906587941623499,6251146587840752402,9873775360095595649,2955822349636057500],[9803968936176983049,10743080498788283672,15680918141653434163,1579841629871625237],[17218081528451559920,11483720227440783570,17901762034722705728,1709957790862441541],[3751314915845589177,5207999417878085570,3453881315493074780,2997527698353530104]]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"n": 8388607, "inputs":[[12780880112887581273,15375039037892293169,14243622463978670810,832973724]],"commitments":[{"x":[7686601728129096967,7227130109972751606,9146696139751048355,2425812583124586647],"y":[11378415783274076468,6115062078511813780,890190634641354247,1911470820691425878],"infinity":false},{"x":[8054909130760765704,10451168505970887451,10367722395898331555,1503102535455087635],"y":[8710961085408697112,12427443534005060985,1032551775395910549,2086276262017277239],"infinity":false},{"x":[12069312602351467619,12192864672423185465,3879015529910868217,2724922899523506585],"y":[475894281835851297,9373725281876662840,7515338836722074641,1103390934157001756],"infinity":false},{"x":[5128931244105615202,11867626281419714714,1209119191410425112,3066077306903392144],"y":[14598930257319657098,6432186045601564879,613554633253043826,1642855076936137196],"infinity":false}],"evaluations":[[13729700471816104886,11188824223319412764,8066040394205311430,2184400922711112220],[6249581532968862391,9001987585089861122,11407043970385352098,1825361415189299926],[4464945894621658974,17522053632116324185,17970632891076166356,261509037732774601],[7477149050715570433,11171316542093998283,13971151008483262134,489754713165203859],[2434426559022578584,4970469306444023984,4874403605190419346,2629749884465915705],[1605442790946172720,14066282752534379246,8613156177590954813,997648050187219302],[9739315398258359304,9334382092013558549,16451740191748021193,415098364635729113],[9923332506758925353,8972613672329103570,6029061578447781893,560963789005302165],[8743211020740214182,15824193004725597763,15944880861925752870,2706333488965517942],[356134380387042265,12272992537112845388,1326852091230841187,742404217541611635],[8030272624296071466,3613653225334463028,5954994466209331732,1953942894701047155],[1625605217788611162,15765142484275373223,3854724376935460477,2882191910778501699],[13172243785130343694,5104126542941081896,2085126052380633204,3349793356212897350],[2048144180869552901,14706951322284988498,6848092749748084666,1047579333297462320],[15127074392230109827,9851385976295954754,3266935471115596056,180076989033798445]],"lagrange_basis_inverses":[[1359258482553421315,12957890032930002626,16406149479630644921,3131095915644093895],[17452735014177237716,17845738450744415159,10566989514722186116,3080213048195065858],[9875397967407890590,17630457108837859966,10802867560962294629,1058536673047709746],[8187476753496303340,7332407408577474793,9163210446381714166,1241886254284541383],[816768360718573169,7218951249023154872,4784846556297747691,1431688504910524703],[13009890697514837979,4626716114500020309,8433632149193468276,2299722309768362419],[12932344643796416975,7210777639698538558,16494688039936985619,2075344713435986462],[2321776149820842125,17578455164401967439,17775814248735249921,648947920034862492],[9516516006336945757,6545936319640938495,7405689928482339110,158579190335980822],[15916628983288393266,18070461586604829401,8752109148110903614,2266743357000677825],[7621391830249170406,6503179968343696779,13332420284313776555,403655115706840652],[6460691428087276646,13645818165874321877,14999762457448745949,3471146837732830310],[16736341784012902481,16112689304065826331,13288141742179371901,2912396993609677282],[11750486271900477391,9921871186699912605,6986534594176614715,2317062284338040762],[1507565806685772858,6932017193098777707,6760367323496124592,158010415978041715],[17907341117753868777,14361176690227188462,9997368280356096141,2605446525506627433],[16652510976542379108,812342839903352024,15717696352847049127,2740131001729808097],[17432416849729198421,15437837640856179924,187144288214264278,2237527436947285411]],"_c":null}
Loading
Loading