-
Notifications
You must be signed in to change notification settings - Fork 4
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
compress user data #39
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the branch can't generate the verifier.sol.
:/mnt/data/gavin/test/gnark-plonky2-verifier$ rm -rf testdata/mips/*
ubuntu@ip-172-31-0-75:/mnt/data/gavin/test/gnark-plonky2-verifier$ cp ../zkm/verifier/data/test_circuit/* testdata/mips/
ubuntu@ip-172-31-0-75:/mnt/data/gavin/test/gnark-plonky2-verifier$ ./benchmark
Running benchmark for mips circuit with proof system groth16
Profiling: true, DummySetup: false, SaveArtifacts: true
14:18:49 INF compiling circuit
14:18:49 INF parsed circuit inputs nbPublic=1 nbSecret=11182
14:19:20 INF building constraint builder nbConstraints=5815132
Generating witness 2024-10-25 14:26:12.555851202 +0000 UTC m=+443.537001694
frontend.NewWitness cost time: 10 ms
Creating proof 2024-10-25 14:26:12.589686871 +0000 UTC m=+443.570837362
14:26:17 DBG constraint system solver done nbConstraints=5815132 took=4546.506367
14:26:24 DBG prover done acceleration=none backend=groth16 curve=bn254 nbConstraints=5815132 took=7396.150282
groth16.Prove cost time: 11942 ms
Verifying proof 2024-10-25 14:26:24.532685295 +0000 UTC m=+455.513835786
14:26:24 DBG verifier done backend=groth16 curve=bn254 took=1.327799
groth16.Verify cost time: 1 ms
before len of publicWitness:1
after len of publicWitness:2
14:26:24 DBG verifier done backend=groth16 curve=bn254 took=1.265958
a[0] is 15444624327630651080473725184401557173722146311199458711796009797942703658437
a[1] is 18675928102599272406512795965588958659421331540914909278010204924877522570825
b[0][0] is 18704854268613695203066174026080021096987276997425033418788897997851429536374
b[0][1] is 444298658177062955046328052698116431034191469880300265432229108631878729961
b[1][0] is 15359858316459687230223675710113184827299876854929893625947452877664785358221
b[1][1] is 13746277396119556967350197284203543941984661723309155633661285745480474084681
c[0] is 12932986643885285743634007406042655703074075315333261329598748853750561994857
c[1] is 12192105101731918300354876820096768831072732315707886200808372169544575526884
Generating witness 2024-10-25 14:26:24.54352461 +0000 UTC m=+455.524675111
frontend.NewWitness cost time: 10 ms
Creating proof 2024-10-25 14:26:25.684091106 +0000 UTC m=+456.665241616
14:26:30 DBG constraint system solver done nbConstraints=5815132 took=4454.346886
14:26:36 DBG prover done acceleration=none backend=groth16 curve=bn254 nbConstraints=5815132 took=6774.445654
groth16.Prove cost time: 11229 ms
Verifying proof 2024-10-25 14:26:36.996968758 +0000 UTC m=+467.978119279
14:26:36 DBG verifier done backend=groth16 curve=bn254 took=1.636443
groth16.Verify cost time: 1 ms
before len of publicWitness:1
after len of publicWitness:2
14:26:37 DBG verifier done backend=groth16 curve=bn254 took=1.289609
a[0] is 2064905601030691686439372819234360915148270800692611079064857775311623436100
a[1] is 184598289861320096224784371098887915862165389732134343914223435731537115616
b[0][0] is 10721979517810196752095713031766869854905445335822448641115460840088980149805
b[0][1] is 14337202197878142388258962965454878446085448176021873523856303733224115019464
b[1][0] is 16546567226202323383749841712041088223189553292995074592634990899947809154997
b[1][1] is 7784781678462562619515313998907561320462459032054799858768787925321580839719
c[0] is 8038209637171070437956843388143849880939382680675008760187177580181984264986
c[1] is 4360607249525914272554130631109907582566022936854340499752270850336093353883
Generating witness 2024-10-25 14:26:37.126335627 +0000 UTC m=+468.107486118
frontend.NewWitness cost time: 9 ms
Creating proof 2024-10-25 14:26:37.230014179 +0000 UTC m=+468.211164700
14:26:41 DBG constraint system solver done nbConstraints=5815132 took=4171.641686
14:26:48 DBG prover done acceleration=none backend=groth16 curve=bn254 nbConstraints=5815132 took=7036.375667
groth16.Prove cost time: 11208 ms
Verifying proof 2024-10-25 14:26:48.46383145 +0000 UTC m=+479.444981971
14:26:48 DBG verifier done backend=groth16 curve=bn254 took=1.951578
groth16.Verify cost time: 2 ms
before len of publicWitness:1
after len of publicWitness:2
14:26:48 DBG verifier done backend=groth16 curve=bn254 took=1.219398
a[0] is 14210928394186423895358896078269348525157238093229895175104096650536796818658
a[1] is 16506448765998483941172164333989005595659552160863391580564423031271283177250
b[0][0] is 12368662337729190536898503719380087905778764311214133012743163001158768761652
b[0][1] is 6213295329242725401827535735623155127667326892989367153516955253037278664122
b[1][0] is 1881261030646095443674354562270877222602575560084801275854494476166825993360
b[1][1] is 11078645501506754299704649679502174221801137905674600003626584687174844192565
c[0] is 655296492049107940961978163798486875776558872637844996267140260709949445602
c[1] is 20797435551814408952755895258547482240219549783570664329661629282059500081450
Generating witness 2024-10-25 14:26:48.562249648 +0000 UTC m=+479.543400139
frontend.NewWitness cost time: 10 ms
Creating proof 2024-10-25 14:26:49.017085493 +0000 UTC m=+479.998236004
14:26:53 DBG constraint system solver done nbConstraints=5815132 took=4191.922736
14:27:00 DBG prover done acceleration=none backend=groth16 curve=bn254 nbConstraints=5815132 took=6839.834756
groth16.Prove cost time: 11032 ms
Verifying proof 2024-10-25 14:27:00.049290022 +0000 UTC m=+491.030440513
14:27:00 DBG verifier done backend=groth16 curve=bn254 took=1.852767
groth16.Verify cost time: 1 ms
before len of publicWitness:1
after len of publicWitness:2
14:27:00 DBG verifier done backend=groth16 curve=bn254 took=1.282729
a[0] is 4933306343775397455311610945225255771150308676237098285503326780234015143364
a[1] is 14429401030764877297889691387138657595201959305336305936264169425694449910144
b[0][0] is 20931938145776456436932026031352417383230111214361032135377066591324037836828
b[0][1] is 21171704874141812240707140873722671583386215425283123059170115809263229435939
b[1][0] is 12802625666604790084311711730705072535669232111113881517613648654692195509946
b[1][1] is 4080568408841721652723007801471185494698740655334849475314958426413802904237
c[0] is 12414548432039216482250189635600109092936806072215586387209915667606563942457
c[1] is 14872870290961945199879493232569206447921841688933075454398669414538513601970
Generating witness 2024-10-25 14:27:00.060717906 +0000 UTC m=+491.041868417
frontend.NewWitness cost time: 9 ms
Creating proof 2024-10-25 14:27:00.095773497 +0000 UTC m=+491.076923978
14:27:04 DBG constraint system solver done nbConstraints=5815132 took=4193.77425
14:27:11 DBG prover done acceleration=none backend=groth16 curve=bn254 nbConstraints=5815132 took=7072.642229
groth16.Prove cost time: 11266 ms
Verifying proof 2024-10-25 14:27:11.362577952 +0000 UTC m=+502.343728443
14:27:11 DBG verifier done backend=groth16 curve=bn254 took=1.293449
groth16.Verify cost time: 1 ms
before len of publicWitness:1
after len of publicWitness:2
14:27:11 DBG verifier done backend=groth16 curve=bn254 took=1.168486
a[0] is 7376995988239283368629789409925766755389308839175276545072335213473636491067
a[1] is 19188731098806046447854707526951323626899532720667184315467124412078735247445
b[0][0] is 12597475746658142416091765347453926161884598585158711493213962122943331791444
b[0][1] is 2518563399770992198855601585722429571971797515269972505560937433532067334492
b[1][0] is 437167792701675071639003192383666644712593701642799235040502003910927526220
b[1][1] is 18398413584119352198576743230165052524074193924734955410699762792332846716889
c[0] is 14804165899281675404962781386892442623242788192712166566776659932882117023832
c[1] is 14563794287132457924778192763776911823898166748714886039111285393813978165852
Generating witness 2024-10-25 14:27:11.373472707 +0000 UTC m=+502.354623218
frontend.NewWitness cost time: 10 ms
Creating proof 2024-10-25 14:27:11.409010553 +0000 UTC m=+502.390161054
14:27:15 DBG constraint system solver done nbConstraints=5815132 took=4300.154749
14:27:22 DBG prover done acceleration=none backend=groth16 curve=bn254 nbConstraints=5815132 took=6882.45462
groth16.Prove cost time: 11182 ms
Verifying proof 2024-10-25 14:27:22.592244452 +0000 UTC m=+513.573394973
14:27:22 DBG verifier done backend=groth16 curve=bn254 took=1.445115
groth16.Verify cost time: 1 ms
before len of publicWitness:1
after len of publicWitness:2
14:27:22 DBG verifier done backend=groth16 curve=bn254 took=1.464886
a[0] is 19646972392899304036975011021002166413387134826303814403930612343729444147794
a[1] is 17826420241337292447779754647280589072059596983682288832268282565081145639335
b[0][0] is 20759004817718417818078000982507249166953285057565626040323785814735678338300
b[0][1] is 17689474016397847004308711868111832675558428847338920071085129120371091721757
b[1][0] is 8083380882514392922488721455602852345934894304201144520975270085360682372599
b[1][1] is 15563399705753186307774603572859580937940236788456152312340659687519430601508
c[0] is 6585887753874917527397058685256622989913074448379606827409919608811379902563
c[1] is 1711872581909422156673001758686124838075396675653537901178310368570459271366
Generating witness 2024-10-25 14:27:22.602769584 +0000 UTC m=+513.583920085
frontend.NewWitness cost time: 9 ms
Creating proof 2024-10-25 14:27:22.637406884 +0000 UTC m=+513.618557375
14:27:26 DBG constraint system solver done nbConstraints=5815132 took=3869.783751
14:27:33 DBG prover done acceleration=none backend=groth16 curve=bn254 nbConstraints=5815132 took=6928.61856
groth16.Prove cost time: 10798 ms
Verifying proof 2024-10-25 14:27:33.43618034 +0000 UTC m=+524.417330832
14:27:33 DBG verifier done backend=groth16 curve=bn254 took=1.278208
groth16.Verify cost time: 1 ms
before len of publicWitness:1
after len of publicWitness:2
14:27:33 DBG verifier done backend=groth16 curve=bn254 took=1.569532
a[0] is 13598528551400057278651789653308745779371447976137013384287946767064140005276
a[1] is 3564829603495854174764027518029947130091463141687348485737450020369664808468
b[0][0] is 6966261179849276203655307493601650423797655177577761869810916035313713358305
b[0][1] is 12950829016845877070090645970810399677036008857595606533495309318384126650518
b[1][0] is 6979588812917413486715013160621102900151698103555594626225569256082833277203
b[1][1] is 21112549678980518946198212568688324619166188653394202306615134024614599960861
c[0] is 12634771970866071870694853809078902024786058898063952486487183020315075969779
c[1] is 20343750726956321155657526441493794382630962532355136668488769601909770945146
Generating witness 2024-10-25 14:27:33.448499656 +0000 UTC m=+524.429650167
frontend.NewWitness cost time: 10 ms
Creating proof 2024-10-25 14:27:33.484156663 +0000 UTC m=+524.465307154
14:27:37 DBG constraint system solver done nbConstraints=5815132 took=3995.188811
14:27:44 DBG prover done acceleration=none backend=groth16 curve=bn254 nbConstraints=5815132 took=6772.282319
groth16.Prove cost time: 10767 ms
Verifying proof 2024-10-25 14:27:44.252035588 +0000 UTC m=+535.233186079
14:27:44 DBG verifier done backend=groth16 curve=bn254 took=1.293649
groth16.Verify cost time: 1 ms
before len of publicWitness:1
after len of publicWitness:2
14:27:44 DBG verifier done backend=groth16 curve=bn254 took=1.297128
a[0] is 3295720185675880250715227086748735035621708313041944231328719276900183650237
a[1] is 11879412765916294692056464954501771230140296165315084143953116319412465548823
b[0][0] is 19231321783632663097508190417723427402762804055386008255582284680785228305994
b[0][1] is 20160957515287216665799275356300657292812699536898834265634087606674601539025
b[1][0] is 5335835095092040166435001924625790060790059333002944656425645344645240018187
b[1][1] is 11955755962040486921268739533221104160109704582650734250172580843121359703041
c[0] is 18131638429349358071152681500137022004371528539586221102122012333079860560268
c[1] is 19646473994881258135417712522384365457326009767024291678412259652176398803032
Generating witness 2024-10-25 14:27:44.263029864 +0000 UTC m=+535.244180375
frontend.NewWitness cost time: 10 ms
Creating proof 2024-10-25 14:27:44.298768253 +0000 UTC m=+535.279918744
14:27:47 DBG constraint system solver done nbConstraints=5815132 took=3608.138341
14:27:54 DBG prover done acceleration=none backend=groth16 curve=bn254 nbConstraints=5815132 took=6999.225057
groth16.Prove cost time: 10607 ms
Verifying proof 2024-10-25 14:27:54.906513607 +0000 UTC m=+545.887664098
14:27:54 DBG verifier done backend=groth16 curve=bn254 took=1.41155
groth16.Verify cost time: 1 ms
before len of publicWitness:1
after len of publicWitness:2
14:27:54 DBG verifier done backend=groth16 curve=bn254 took=1.535502
a[0] is 6687053256284991699335307886160439745872338075796534554581638070392496224146
a[1] is 14323292833638704498136719029355799226503606938781712987600798510441105712965
b[0][0] is 3512775865235277159130817012427163718694048618203854324253567100960884035064
b[0][1] is 11304338104811970826920414793790685127825064398929943875006927395455533973066
b[1][0] is 9993385381946615094177311275287782285989960832851726666773632823744009553716
b[1][1] is 8369854617221664971411912302783407160516727283434100737083950362097394608485
c[0] is 820846727727246555247264463027319354093886881154505523985167857877931261825
c[1] is 11562750687358089416787207391370422509442383471442167361240910492461407514325
Generating witness 2024-10-25 14:27:54.917133808 +0000 UTC m=+545.898284309
frontend.NewWitness cost time: 9 ms
Creating proof 2024-10-25 14:27:54.952052054 +0000 UTC m=+545.933202535
14:27:58 DBG constraint system solver done nbConstraints=5815132 took=3926.538303
14:28:05 DBG prover done acceleration=none backend=groth16 curve=bn254 nbConstraints=5815132 took=6777.325886
groth16.Prove cost time: 10704 ms
Verifying proof 2024-10-25 14:28:05.662012209 +0000 UTC m=+556.643162760
14:28:05 DBG verifier done backend=groth16 curve=bn254 took=1.662153
groth16.Verify cost time: 1 ms
before len of publicWitness:1
after len of publicWitness:2
14:28:05 DBG verifier done backend=groth16 curve=bn254 took=1.888846
a[0] is 3879865395094348339870637496239172871380441509319547322503417871915739157310
a[1] is 461299343744694807695768781520573648713785546194899231188397225785762870571
b[0][0] is 14846822289693261256048492973909979346846201018660953420554792038024370118822
b[0][1] is 19693408294931164616842736599491446870910317274240465887710559954232006003479
b[1][0] is 6147168547749047507741911146790294443938288394492643324286229466921066181997
b[1][1] is 11687142248252514513389926789173172400563514338918091848517675097384466966712
c[0] is 18149314887539908493755950363435071353853186834716310266701473683594378140036
c[1] is 15335280531530365741571328873147377712980291525034914738528431836538033987566
ubuntu@ip-172-31-0-75:/mnt/data/gavin/test/gnark-plonky2-verifier$ ls testdata/mips/
block_public_inputs.json proof_with_public_inputs.json verifier_only_circuit_data.json
common_circuit_data.json proving.key verifying.key
proof.proof snark_proof_with_public_inputs.json witness
ubuntu@ip-172-31-0-75:/mnt/data/gavin/test/gnark-plonky2-verifier$
ubuntu@ip-172-31-0-75:/mnt/data/gavin/test/gnark-plonky2-verifier$ ls testdata/mips/ -l
total 1369080
ubuntu@ip-172-31-0-75:/mnt/data/gavin/test/gnark-plonky2-verifier$
-rw-rw-r-- 1 ubuntu ubuntu 3348 Oct 25 14:18 common_circuit_data.json
-rw-rw-r-- 1 ubuntu ubuntu 196 Oct 25 14:28 proof.proof
-rw-rw-r-- 1 ubuntu ubuntu 329510 Oct 25 14:18 proof_with_public_inputs.json
-rw-rw-r-- 1 ubuntu ubuntu 1401215002 Oct 25 14:26 proving.key
-rw-rw-r-- 1 ubuntu ubuntu 1264 Oct 25 14:28 snark_proof_with_public_inputs.json
-rw-rw-r-- 1 ubuntu ubuntu 1395 Oct 25 14:18 verifier_only_circuit_data.json
-rw-rw-r-- 1 ubuntu ubuntu 524 Oct 25 14:26 verifying.key
-rw-rw-r-- 1 ubuntu ubuntu 357868 Oct 25 14:27 witness
ubuntu@ip-172-31-0-75:/mnt/data/gavin/test/gnark-plonky2-verifier$
2. use typescript in hardhat 3. use bincoder lib to encode userData
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
add log in Verify.js
// bincode user data
const rawUserData = new String('12345678');
const encoded = rawUserData.pack();
const userData = new Uint8Array(encoded);console.log("the userData:%s", userData); /////
-
npx hardhat test, the log is the following:
//...
the userData:8,0,0,0,0,0,0,0,49,50,51,52,53,54,55,56 -
the bincod begining should be : 32, 0, 0, 0, 0, 0, 0, 0,xxxxxxx
-
so , the test : it('Verify user data', async function () in the Verify.ts has some issue ?
No description provided.