28 Commits

Author SHA1 Message Date
Arya Tabaie
fdd84f24e5 refactor: Use new GKR API (#1064)
* use new gkr API

* fix Table pointers

* refactor: remove removed test engine option

* chore: don't initialize struct for interface assertion

* refactor: plonk-in-wizard hardcoded over U64 for now

* refactor: use new gnark-crypto stateless RSis API

* test: disable incompatible tests

* chore: go mod update to PR tip

* chore: dependency against gnark master

* chore: cherry-pick 43141fc13d

* test: cherry pick test from 407d2e25ecfc32f5ed702ab42e5b829d7cabd483

* chore: remove magic values

* chore: update go version in Docker builder to match go.mod

---------

Co-authored-by: Ivo Kubjas <ivo.kubjas@consensys.net>
2025-06-09 14:17:34 +02:00
AlexandreBelling
3bf08c9f18 Prover: richer exit code to better detect completeness issues (#978)
* feat(exit): make sure that keccak uses 77 when overflowing and not a panic message

* feat(exit): makes PadAssign return a 77 when vector builder overflows

* feat(exit): adds a toggle mechanism for the exiting strategy

* feat(unsatisfied): adds exiting when encountering an unsatisfied constraint

* adds the toggle for the exit when finding unsatisfied constraints

* feat(77): uses the 77 exit code to tell when we have too many merkle proofs

* fix log for modexp
2025-05-13 20:46:05 +00:00
AlexandreBelling
7334693931 Prover(perf): faster global constraints compilation (#704)
* bench(global): adds a benchmark for the global constraint compiler

* perf(merging): accumulates the factors before creating the expression

* perf(product): computes the ESH without using a smart-vector

* perf(factor): preallocations in the factorization algorithm

* perf(removeZeroes): implements a lazy allocation mechanism in removeZeroCoeffs

* perfs(alloc): counts the ret elements before returning in expandTerms to minimze the number of allocations.

* perf(factor): use an integer map instead of a field.Element map when possible

* fixup(expands): fix the skip condition for term expansion

* perf(constructor): improves the immutable constructors to reduce the number of calls to NewProduct and NewLinComb

* feat(repr): adds a json repr function to help debugging

* test(constructor): cleans the test of the constructors

* perf(factor): address maps using the first limb of a field.Element instead of the full field.Element

* fixup(commit): adds missing file in previous commit

* perf(factor): reduce the number of calls to rankChildren

* perf(rmpolyeval): creates the equivalent expression more directly to save on unnecessary optims

* perf(factors): use a counter in getCommonProdParentOfCs

* perf(factor): remove map copy from findGdChildrenGroup and replace getCommonProdParent by a simpler function

* clean(factor): remove unneeded function and imports

* feat(utils): adds a generic sort interface implementation

* perf(rankChildren): lazy allocation of the map to save on allocations

* perf(factorize): reduces the loop-bound for factorizeExpression

* (chore): fix a missing argument and format gofmt

* feat: readd test

---------

Signed-off-by: AlexandreBelling <alexandrebelling8@gmail.com>
Co-authored-by: gusiri <dreamerty@postech.ac.kr>
2025-03-21 20:55:54 +09:00
Lakshminarayanan Nandakumar
8ddd4c1d3d Prover/wizard performance monitor (#768)
* wizard runtime perf monitor

* ring-sis before revert

* sanity check successful

* rm test config file
2025-03-12 08:43:31 +00:00
Gautam Botrel
43141fc13d refactor, perf: prover/crypto/sis improvements (#554)
* fix: revert gnark go mod change

* refactor: checkpoint mvp working

* feat: added case for smartvector.Constant rows block

* refactor: checkpoint

* refactor: checkpoint

* refactor: checkpoint

* style: code cleaning

* style: more comments

* refactor: use gnark-crypto sis and refactor ringsis.TransversalHash

* test: restore bench size

* perf: better parallelization

* chore: update gnark crypto

* fix: restored gnark dep as in main

* test: restored separate tests in transversal hash test

* build: update to gnark crypto master with latest sis

* build: fix linter
2025-02-24 15:10:50 +00:00
AlexandreBelling
7325f38c88 Prover: beta v1.2 integration changes (#692)
* bump go-corset

* fix compile errors

* constraints: bump to v0.1.0-rc1 for beta-v1.2

* bump to latest go-corset

* constraints: bump to beta-v1.2 / v0.1.0-rc2

* bump go-corset

* bump zkevm bin

* use next power of two value for non-power of two size columns (e.g., MMIO)

* remove a check for the power of two size

* bump corset to 9.7.18

* bump zkevm.bin

* bump corset to v9.7.18

* update zkevm.bin

* added interleaved to the compilediop columns

* adjusted size for corset columns

* Prover/Codehash Non Power of Two Column Size (#618)

* Revert "adjusted size for corset columns"

This reverts commit b1a7319fa586319a04ba57f421f10b55492124ff.

* fixed bug and added panic message for a non power of two size column

* removing panic

* reinsteaded the panic

---------

Co-authored-by: gusiri <dreamerty@postech.ac.kr>

* adjusted size for corset columns

* constraints: bump to beta v1.2/v0.1.0-rc3

* update constraints version to rc3

* bump to latest go-corset

* apply hotfix for BLOCKDATA

* move NextPowerOfTwo unit test to utils

* add logs for adjusted columns with non-power of two size

* turn off trace version check

* fix golangcli-lint

* Prover/fix public input timestamps from new blockdata (#644)

* updated timestamp fetcher and arithmetization mock data for unit testing.

* fix(codehash): uses 0x0 for the codehash of non-existing accounts instead of the default EOA codehash

* fix(mimccodehash): unimport the rom codehash for initialization code

* fixup(execDataHash): revert the exec-data hash check

* timestamp byte change

* fix(execdatahash): adds the real blockhash in the execdata hash instead of 0x0

* fixup previous commit

* fixup(build): removes imports

* Revert "fixup(execDataHash): revert the exec-data hash check"

This reverts commit eb8d984e13fab627a853dc98b2c94980a7eed0b3.

* fix(consistency): adds a smaller size to the consistency module

* feat(mimc): alex -- mimc simplification -- start

* optimize factorExpression

* feat(exec): uses the ProveCheck in the execution proof

* Revert "feat(mimc): alex -- mimc simplification -- start"

This reverts commit 184771b92746070dedb5ca356ed81f989a3daea5.

* fix (public-input): changed the hashing method to match compression

* perf(mem): adds a detector for constant regular column.

* fixup(mem): support the edge-case for smartvectors of size 1

* fix(codehash): support the case where the ROM is empty

* feat(csv): adds a feature to rename columns when using fmtcsv

* fixup(codehash): supports the case where no codehash are available

* test(codehash): adds test for empty rom or statesummary

* fix(ss-connect): skip the integration connector test

---------

Co-authored-by: gusiri <dreamerty@postech.ac.kr>
Co-authored-by: Soleimani193 <azam.soleimanian@ens.fr>
Co-authored-by: Arijit Dutta <37040536+arijitdutta67@users.noreply.github.com>
Co-authored-by: Bogdan Ursu <bogdanursuoffice@gmail.com>
2025-02-17 12:46:07 +01:00
Arya Tabaie
543aedd23f Feat/multi dict prover (#553)
* refactor: disallow explicit dictionaries for anything other than v0 decompression setup

* refactor: pass around dictionary stores instead of individual dictionaries

* feat: add new dictionary

---------

Co-authored-by: Arya Tabaie <15056835+Tabaie@users.noreply.github.com>
2025-01-21 09:38:45 -06:00
AlexandreBelling
aeb86855ae Prover: connect the codehash and the statesummary module (#463)
* clean(prover): more hilo into zkevm/prover/common

* feat(codehash): implements the module connecting the codehash and the statesummary

* clean(ss): apply the changes for the statesummary

* feat(rand): moves everything to use rand/v2

* feat(csv): adds WriteExplicit

* feat(codehash): implements the consistency module

* fix(rng): Int31n -> Int32N

* fix(lint): pass the use of test-rng

* clean: clean one of the comment to remove debugging data

* fix(test): fix conversion test and also simplify the use of rng

* feat(codehash): enable the codehash consistency module

* reconnect the execution data hasher with the public input

* revert the rand/v2 for the testcase-gen of the contracts
2025-01-16 22:31:15 +01:00
Ivo Kubjas
05d3ee2875 fix(ecpair): ensure last non-trivial input pair goes to ML+finalexp circuit (#524)
* fix: set inputresult only once

* fix: copy only actual inputs going to pairing (no trivial pairs)

* fix: non-exclusive G2 membership or pairing check

* fix: enable index consistency check when interleaved G2 membership

We may interleave in the same rows the G2 membership and pairing check
inputs. Currently when we have interleaved then we disable the index
consisitency check.

* fix: do not project pair IDs and total pairings

* fix: add constraint to check totalpairs correctness

* test: add IS_RESULT column to test cases and uniform reformat

* feat: allow outputting CSV in hex

* feat: add utility method to write the module

* test: check also IS_RESULT in test cases

* test: add test case modules

* test: add regression test case

* feat: add testdata generator for ecpair

* feat: add tests for manual generation of EC edge cases

* fix: accumulator consistency assignment in case of one valid point

* docs: describe assignment

* fix: indexing when non-sequential valid points

* test: run tests on generated data

* feat: generate all cases for 1-5 input pairs

* test: skip long tests

* fix: test imports

* enable ecpair

* perf: parallelize testcase testing

---------

Co-authored-by: gusiri <dreamerty@postech.ac.kr>
2025-01-16 13:24:04 +01:00
Arya Tabaie
c4c3bfd739 Feat Setup checks equality between KZG Vk from circuit Vk and from SRS (#325)
* feat test vk consistency
* test write-read setup
* feat readfromfile-writetofile

---------

Co-authored-by: Arya Tabaie <15056835+Tabaie@users.noreply.github.com>
2024-12-02 14:45:15 +01:00
Arya Tabaie
02d13d1947 Fix PI Initial Rolling Hash Update (#360)
* fix rolling hash updates in collectFields

* fix initial rolling hash in piq

* fix assignment rolling hash logic

* docs give names to all checks

* docs point out checks in circuit

* refac check for chain id etc first

---------

Co-authored-by: Arya Tabaie <15056835+Tabaie@users.noreply.github.com>
Co-authored-by: AlexandreBelling <alexandrebelling8@gmail.com>
2024-11-30 10:26:19 -06:00
AlexandreBelling
35700222f8 Feature/optimization distributedlab rebased (#356)
* fft optimization: used parallel approach from gnark-crypto

* following OmegaTymbJIep: Use atomic uint instead of the chan of uints in parallel task tracking

* Adding bitreverse from gnark-crypto

* Use atomic counter instead of uint chan to avoid locks

* Add test for AtomicCounter

* fixed build issues due to changes in keccak

* increase butterflyThreshold (because we now use kerDITNP_256 instead of kerDITNP_8)

* rollback butterflyThreshold

* adding check for nBTasks in parallel.execute

* using GOMAXPROCS instead of NumCPU

* adding execution pool

* fixed initializing thread pool

* adding ExecutePoolChunkyWithCache

* returning back from ExecutePoolChunkyWithCache to ExecutePoolChunky, adding ExecutePoolChunky to multi_to_single_point.go

* adding ExecutePoolChunkyWithAllocated

* replacing ExecutePoolChunky with ExecuteChunky in InitOpeningWithLC

* returning back  ExecutePoolChunky in InitOpeningWithLC, adding additional ExecutePoolChunky into quotient

* replacing ExecutePoolChunky with Execute into quotient

* fix: removing redundant mainWg in multi_to_single_point.go

* fix multi_to_single_point.go councurency waitning, retry quotient with ExecutePoolChunky

* ExecutePoolChunky in opening_prover.go, rolling back quotient.go

* ExecutePoolChunky in multi_to_single_point.go

* removing mutexes from quotient

* Avoid redundant bigint allocations

* fixed pool - removing redundant

* fixed - removing redundant comments

* removing keccak optimization

---------

Co-authored-by: olegfomenko <oleg.fomenko2002@gmail.com>
Co-authored-by: Anton Levochko <hykakdela@gmail.com>
2024-11-28 23:17:41 +01:00
Håvard Anda Estensen
9713fef2a6 perf(prover): preallocate slices (#119)
* chore(prover): add prealloc linter
* perf(prover): preallocate slices
2024-11-19 10:19:50 +01:00
Arya Tabaie
c847eb2441 Match PI assignment and circuit with aggregation backend (#274)
* fix: initialBlockNum -> lastFinalizedBlockNum

* fix more execution pi logic

* feat readHashSnark

* fix block num comparisons

* feat pretty print hashes

* feat some more range checks

* fix exec.lastFinalizedTS -> initialTS

* feat skip wizard subproof

* feat always zero pad unused PI proofs
2024-11-05 10:32:32 -06:00
Arya Tabaie
0de0897044 Fix/prover/aggregation/tree padding (#262)
* feat hash wrappers for testing

* feat not so strict hasher

* fix integrate flexible hashes into PI circuit

---------

Co-authored-by: Arya Tabaie <15056835+Tabaie@users.noreply.github.com>
2024-10-30 12:48:10 -05:00
Arya Tabaie
ce964fc0cb Decompressor Library (#229)
* chore bring over changes from other branch

* chore: blocks as byte arrays not lists; tx.S <- 1

* build: update compressor lib release script by jpnovais

* docs and go generate

---------

Co-authored-by: Arya Tabaie <15056835+Tabaie@users.noreply.github.com>
2024-10-22 14:32:14 -05:00
Arya Tabaie
333bc7718b Fix: test PI Interconnection with Sepolia data (#208)
* feat better pi assignment error finding
* fix append to allL2MessageHashes
* feat relax rolling hash verification in circuit
* PR feedback: remove unit test

---------

Co-authored-by: Arya Tabaie <15056835+Tabaie@users.noreply.github.com>
Co-authored-by: AlexandreBelling <alexandrebelling8@gmail.com>
2024-10-21 19:48:40 +02:00
AlexandreBelling
bba9677418 Prover: all the fixes for beta-v1.a (#90)
* feat(limits): unhardcode the keccak limits
* limits(shomei): double the state limits
* fix(rlpaddr): uses the right stamp column for rlpaddr
* fix(ecpair): fix 1 invalid constraints and a bug in the assignment
* log(plonk): logs which circuit is failing in plonk-in-wizard
* log(projection): print a more informative message when a projection query fails
* feat(csv): adds more options to FmtCSV
* fix(mimc): removes a non-necessary constraint for mimc padding
* fix(mimc): address the edge-case where the mimc data size is a multiple of 31
* fix(sha2): uses the correct selectors to extract the sha2 hashes
* chores(makefile): dont recreate the zkevm.bin when linting or running the checker
* chore(make): adds the bin/checker in the .PHONY
* chores(cs): bump the constraints to rc7
* fix(arithmetization): fix invalid casting into a variable
2024-09-25 12:15:08 +08:00
AlexandreBelling
e63c730d6d Prover: switch the go import path to linea-monorepo (#20)
* switch the go import path to linea-monorepo
* address every occurence to zkevm-monorepo
2024-09-13 15:10:04 +02:00
AlexandreBelling
d079e98549 Prover: optimize memory allocations in symbolic expression (#3910)
* feat(pool): implements a multi-level caching system for the pool
* fix(sym): make sure that all the nodes are freed
* feat(pool): implements a DebugPool to debug leakage to gc
* feat(parallel): implements a channel based parallelization template
* test(pool): ensure that symbolic evaluation does not leak to gc
* fixup(par): adds a wg to the workload worker
* create an prover-checker that can be used for checking
* feat(check-only): adds a check-only mode in the config
* test(smartvectors): update the tests
* chores(makefile): rm corset flags from the unneeding commands
* remove the change on config-benchmark
* perf(pool): Use the pool for regular massive FFT workload
2024-09-10 20:58:55 +02:00
Arya Tabaie
daba463d77 Fix/aggregation integration test (#3909)
* refac moving some utils around
* perf remove profiling
* test change nCircuits to 10
* chore remove unnecessary func
* fix bw6 public input fed into bn254 proof

---------

Co-authored-by: Arya Tabaie <15056835+Tabaie@users.noreply.github.com>
2024-09-09 21:53:10 +02:00
Arya Tabaie
eb9564edae Fix/simplify pi integration (#3837)
* fix simplified public input embedding

* update integration test

* build bump go-ethereum version

* fix pi setup in integration test

* feat dummy pi circuit

* refactor move ToVariableSlice to utils

* test small "integration test" for aggr

* fix max = 0 edge case for NewRange

* truncate cvks (unnecessary)

* build update gnark dep

* refactor simplify aggregation backend logic
2024-09-05 08:36:54 -05:00
AlexandreBelling
914b2f7630 Fix: Prover keccak/base-conversion wrong loop boundary check in lookups.go (#3838)
* Fix: Prover keccak/base-conversion wrong loop boundary check in lookups.go
* fix nextPowerOfTwo panic msg

---------

Signed-off-by: AlexandreBelling <alexandrebelling8@gmail.com>
Co-authored-by: Arya Tabaie <15056835+Tabaie@users.noreply.github.com>
2024-08-23 21:15:35 +02:00
Arya Tabaie
7629c25e09 Fix G115 staticcheck fails on main (#3820)
* fix nosec g115
* fix gofmt
* fix all staticcheck errors
* delegate more range checking to util funcs

---------

Co-authored-by: Arya Tabaie <15056835+Tabaie@users.noreply.github.com>
2024-08-22 14:05:48 +02:00
AlexandreBelling
d261807d61 Prover/beta v1 integration (#3813)
* disconnect the hub from the actual arithmetization
* adds the missing columns from the arithmetization
* fix invalid bound constraint for ecdsa
* adds the settings for all the modules
* deduplicating the columns names between sha2.packing and keccak.packing
* adjust the number of inputs for ecadd and ecmul
* sanity-checks against creating giant columns and giant range-checks
* more informative message about failing to split a global constraint
* fixing a mistake in the multi-limb cmp
* splitter: adding support for periodic sample with larger period
* ecpair: adjust the number of G2 check per circuit
* fix: generate missing twiddles for specific sis instances
* optime the FromAccessor verifier col to make it lighter
* fix: make all fields of ConstCol public
* serialization: add checks to panic when entering a private field
* factorization: remove false edge-case
* added logs for the artefact writing
* lookup: fix ensuring that the zCatalog are processed in deterministic order
* corset.go: remove deadcode
* artefacts: fix the file existence check in wizard.Artefact
* codehash: fix state-manager assignment code hash
* adds sha2 circuit
* ecdsa: fix a few bugs in the assignment part
* implements the tx-signature getter
* config: fix maximal value for the log level
* remove-me: making debugging simpler
* fixup + add some more informations
* batch-interpolate: fix the batch interpolation algorithm
* add more logs in the vortex prover
* fixup: remove the test acceleration
* vector builder: more friendly-message repush last on top of an empty builder
* public input: set the name in the settings automatically
* sha2: address the case where sha2 is never called
* keccak: remove trailing printf
* fix: sha2 failing test

* lookup: fix error message on lookup prover

* const-col: simplify the return of GetColAssignmentAt

* lane: address case where sha2 is never called

* mimccodehash: address the case where the codehash is empty

* multi-limbs: fix incorrect range query

* storage-peek: adjust the storage key decomposition to use less limbs

* fixup: remove trailing printf

* fixup: (from accessors) fix invalid getterAt

* more informative message for the projection queries

* log (dummy verifier): add a log when a query fails

* fix(nbZeroes): address the case where the number of inputs is zero

* fix(sha2): address the case where sha2 is not called

* fix(state-summary): address the fact that read|readzero follow a different pattern of account traces

* fix(state-summary): change the ordering in the state-summary

* fix(mimcCodeHash): reverse the direction of the lookup

* chores(inclusion): make the error more comprehensive by listing all the missing rows

* feat(state-manager): adds constraints for ensuring writes happen after reads

* feat(compressor): revert to the old way of hashing

* fix: comment out the checks that are pertaining to assessed issues in the arithmetization

* chores(projection): sends more insightful logs in the projection query

* style(ecdsa): remove nbTxs from assignTxSignature

* fix(vortex): adds a missing column ignoral

* adding new SIS parameters to the test

* feat(vortex): change the default SIS parameters

* chores(fs): skip the fiat-shamir update when running in dummy.Compile

* fix(vortex): bug when handling shadow columns

* fix(gnark-interpolation): better handling of constant terms

* fix(public-input): fix wrong query addressing

* fix(execution): change the structure of the circuit builder

* fixup

* feat(setup): change the ordering of the circuit generation

* fix(execution): allocate explicitly the L2 message hashes

* fixup

* fixup: remove debugging line

* fix(s3): change the line in the makefile to use include/exclude

* fix(circuit): fix incorrect assignment function

* fix(execution): correct the FinalBlockNumber assignment

* fix(execution): adjust the hashing of the L2 message hashes

* fix the assignment of modexp

* rm gitignore
2024-08-20 22:07:36 +02:00
AlexandreBelling
819734563a Prover: integrate the public inputs (#3793)
* feat: Add the wizard to the zkevm instantiation
* make the l2BridgeAddress part of the witness
* add L2Message in the extractor
* update the backend so that it works with the new zkevm api
* compute the functional inputs
* update rand
* solves a cyclic dependency issue by moving some code of blob decompression into utils
* arrange the way the func inputs are computed from the crafting
* integrate the changes with the aggregation package
* fix invalid go:generate statement
* fixup: invalid import
* update golangci.yml to relax the linting rules (were breaking the CI)
2024-08-14 15:55:13 +02:00
Arya Tabaie
c0568080a1 Prover: implements the aggregation circuit for beta v1 (#3780)
---------

Signed-off-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
Co-authored-by: Arya Tabaie <15056835+Tabaie@users.noreply.github.com>
Co-authored-by: AlexandreBelling <alexandrebelling8@gmail.com>
2024-08-14 14:24:08 +02:00
Julien Marchand
a001342170 chore: Initial commit
Co-authored-by: Franklin Delehelle <franklin.delehelle@odena.eu>
Co-authored-by: Alexandre Belling <alexandrebelling8@gmail.com>
Co-authored-by: Pedro Novais <jpvnovais@gmail.com>
Co-authored-by: Roman Vaseev <4833306+Filter94@users.noreply.github.com>
Co-authored-by: Bradley Bown <bradbown@googlemail.com>
Co-authored-by: Victorien Gauch <85494462+VGau@users.noreply.github.com>
Co-authored-by: Nikolai Golub <nikolai.golub@consensys.net>
Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com>
Co-authored-by: jonesho <81145364+jonesho@users.noreply.github.com>
Co-authored-by: Gaurav Ahuja <gauravahuja9@gmail.com>
Co-authored-by: Azam Soleimanian <49027816+Soleimani193@users.noreply.github.com>
Co-authored-by: Andrei A <andrei.alexandru@consensys.net>
Co-authored-by: Arijit Dutta <37040536+arijitdutta67@users.noreply.github.com>
Co-authored-by: Gautam Botrel <gautam.botrel@gmail.com>
Co-authored-by: Ivo Kubjas <ivo.kubjas@consensys.net>
Co-authored-by: gusiri <dreamerty@postech.ac.kr>
Co-authored-by: FlorianHuc <florian.huc@gmail.com>
Co-authored-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
Co-authored-by: Julink <julien.fontanel@consensys.net>
Co-authored-by: Bogdan Ursu <bogdanursuoffice@gmail.com>
Co-authored-by: Jakub Trąd <jakubtrad@gmail.com>
Co-authored-by: Alessandro Sforzin <alessandro.sforzin@consensys.net>
Co-authored-by: Olivier Bégassat <olivier.begassat.cours@gmail.com>
Co-authored-by: Steve Huang <97596526+stevehuangc7s@users.noreply.github.com>
Co-authored-by: bkolad <blazejkolad@gmail.com>
Co-authored-by: fadyabuhatoum1 <139905934+fadyabuhatoum1@users.noreply.github.com>
Co-authored-by: Blas Rodriguez Irizar <rodrigblas@gmail.com>
Co-authored-by: Eduardo Andrade <eduardofandrade@gmail.com>
Co-authored-by: Ivo Kubjas <tsimmm@gmail.com>
Co-authored-by: Ludcour <ludovic.courcelas@consensys.net>
Co-authored-by: m4sterbunny <harrie.bickle@consensys.net>
Co-authored-by: Alex Panayi <145478258+alexandrospanayi@users.noreply.github.com>
Co-authored-by: Diana Borbe - ConsenSys <diana.borbe@consensys.net>
Co-authored-by: ThomasPiellard <thomas.piellard@gmail.com>
2024-07-31 18:17:20 +02:00