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

Directly include transpiler #311

Closed
wants to merge 101 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
6d72ded
zkLLVM Circuit transpiler initialized.
nkaskov Jan 14, 2023
4114f1d
Redundant dependencies removed.
nkaskov Jan 16, 2023
b9e807a
Gate argument profiling rewrited for a batched version #1
Feb 7, 2023
f737371
Added .sol files templates for code readability #1
Feb 21, 2023
928380f
Merge pull request #2 from NilFoundation/1-batched-evaluation-proofs
nkaskov Mar 27, 2023
43a7842
Include file paths in generated files updated #3
ETatuzova Apr 10, 2023
0392521
Columns rotations for non-witness columns provided. Gates optimizatio…
ETatuzova Apr 12, 2023
d1eb36c
Terms with coeff=1 profiling optimized #3
ETatuzova Apr 14, 2023
0ca7eda
Update readme.md #3
ETatuzova Apr 14, 2023
aec72b3
Update README.md
ETatuzova Apr 14, 2023
a6457cf
Merge branch 'master' of github.com:NilFoundation/zkllvm-transpiler i…
ETatuzova Apr 19, 2023
e560d5b
README.md updated #3
ETatuzova Apr 19, 2023
8acad9e
Merge branch '3-evm-branch-37-compatibility' of github.com:NilFoundat…
ETatuzova Apr 19, 2023
ab70f8a
Merge pull request #5 from NilFoundation/3-evm-branch-37-compatibility
nkaskov May 3, 2023
fda8415
Changes related to Expressions.
martun May 22, 2023
bd132a2
Some fixes.
martun May 23, 2023
fe6abf6
Proofread the readme
NickVolynkin May 31, 2023
d66da57
Merge pull request #8 from NilFoundation/proofread-readme
ETatuzova May 31, 2023
d401567
Change gate argument to be hardhat-compatible #9
ETatuzova Jun 3, 2023
b5fb911
Public input processing added #9
ETatuzova Jun 5, 2023
2403aef
Update README.md
ETatuzova Jun 7, 2023
72247a7
Assignment table deserialization algorithm temporary added to transpi…
nkaskov Jul 26, 2023
3a2d481
Changing plonk_variable template type.
martun Jul 10, 2023
15fac16
Few small changes related to changes in zk.
martun Jul 30, 2023
dd4047f
Pass assiment table as reference
Sep 6, 2023
d853f0b
Allign types: use uint32_t insteat of size_t
Sep 7, 2023
6c5eb50
Minor changes transpiler start built with new crypto3-zk #21
ETatuzova Sep 23, 2023
4bc8ca1
Transpiler tests initialization #21
ETatuzova Sep 23, 2023
6ea0121
New dependencies #21
ETatuzova Sep 23, 2023
171fc24
Tests added. Permutation argument generator completed#21
ETatuzova Sep 24, 2023
9511aaf
Plain gate argument generator for small gates added#21
ETatuzova Sep 24, 2023
09a8d68
Commitment scheme generator #21
ETatuzova Sep 27, 2023
14d0542
Colinear check is done#21
ETatuzova Sep 28, 2023
ba800bb
External gates #21
ETatuzova Sep 28, 2023
3bd5dcf
Correct error output #21
ETatuzova Sep 28, 2023
583385d
Cleaned from console.log#21
ETatuzova Sep 28, 2023
cb26e5a
Minor compatibility changes #21
ETatuzova Sep 28, 2023
3d97686
External lookups #21
ETatuzova Sep 30, 2023
b203e04
Internal commitment scheme#21
ETatuzova Sep 30, 2023
0bd4a24
Remove unuzed files #21
ETatuzova Sep 30, 2023
deefeb0
Proof generating is syncronized with marshalling-zk #21
ETatuzova Oct 1, 2023
e0ef217
Copyrights added #21
ETatuzova Oct 1, 2023
36d5923
Code structure changed #21
ETatuzova Oct 1, 2023
6f72251
Gates files splitted #21
ETatuzova Oct 1, 2023
0f9e96f
Lookups splitted #21
ETatuzova Oct 1, 2023
c5a80b8
Zero-indices in permutation argument updated #21
ETatuzova Oct 2, 2023
8ac9cde
std::couts removed #21
ETatuzova Oct 2, 2023
fe5bbb7
Commented code deleted, lookup_libs_list.json deleted #21
ETatuzova Oct 2, 2023
c17bef5
Direct public input updated#21
ETatuzova Oct 2, 2023
37877c2
Split gate computations in libraries with given threshold #24
vo-nil Oct 4, 2023
64bf1e2
Split gates and lookups into multiple libs #24
vo-nil Oct 5, 2023
325bdde
Inline cheap gate evaluation in contract code #24
vo-nil Oct 9, 2023
0587463
Done with lookups inlining #24
vo-nil Oct 10, 2023
ead87dd
rm comment #24
vo-nil Oct 10, 2023
3742536
Remove non-working CI#29
ETatuzova Oct 11, 2023
bf14ac7
The haviest FRI function optimized #29
ETatuzova Oct 11, 2023
67ff791
Merge pull request #31 from NilFoundation/24-rework-gate-argument-tem…
ETatuzova Oct 11, 2023
24b45f0
Add variable initialization #33
ETatuzova Oct 13, 2023
b8fb56d
Added polynomial detection and Horner's formula #32 (#35)
vo-nil Oct 18, 2023
4fa65a8
Added power optimizations #36 (#37)
vo-nil Oct 23, 2023
aabe646
Multiply gate argument result on mask polynomial value #41
ETatuzova Oct 24, 2023
0f70482
46 check values in etha point (#48)
vo-nil Nov 8, 2023
2348688
Added grinding mask check in EVM code #49 (#50)
vo-nil Nov 8, 2023
a912c3a
38 commitment unchecked (#40)
vo-nil Nov 8, 2023
f126ead
Added events and removed gas estimation from solidity code #45 NilFou…
vo-nil Nov 10, 2023
df7bc3f
Reworked to single event with boolean paramter #45
vo-nil Nov 30, 2023
e32cdd5
46 check values in etha point (#55)
vo-nil Dec 7, 2023
95b5ee7
Revert "46 check values in etha point (#55)" (#56)
ETatuzova Dec 7, 2023
181b827
Changing get_fri_params to get_commitment_params, due to change in zk.
martun Dec 7, 2023
073ac06
Merge pull request #59 from NilFoundation/58-small-fix-after-changes-…
martun Dec 7, 2023
ee8145b
Events, lpc functions update, eta point #60
ETatuzova Dec 8, 2023
11d9934
Remove console.log from colinear check #62
ETatuzova Dec 18, 2023
b8550f3
Add consistent testing
x-mass Dec 27, 2023
f206e94
Add recursive generator, update EVM verifier #39
ETatuzova Feb 2, 2024
491e056
39 branch prepared to merge #39
ETatuzova Feb 2, 2024
c1f503c
LPC batching updated #65
ETatuzova Feb 12, 2024
e4affbe
Removed ifs and dynamic loops #72
ETatuzova Feb 19, 2024
34fbefe
remove trailing spaces
CblPOK-git Feb 28, 2024
020b598
remove ArithmetizationParams
CblPOK-git Feb 28, 2024
2f7c2f3
remove ArithmetizationParams from recursive verifier generator
CblPOK-git Mar 5, 2024
04abab5
remove ArithmetizationParams from test
CblPOK-git Mar 6, 2024
51bb08d
add target for test run
CblPOK-git Mar 6, 2024
bc84d41
small change
CblPOK-git Mar 7, 2024
695180e
Keccak processing in JSON added. Verification key removed from recurs…
ETatuzova Mar 26, 2024
cc7cfa8
Some includes added to recursive_verifier_generator.hpp
ETatuzova Mar 26, 2024
1c60445
JSON generator updated #78
ETatuzova Apr 18, 2024
1d498c2
EVM verifier update #78
ETatuzova Apr 23, 2024
6b4cc82
Placeholder part #78
ETatuzova Apr 26, 2024
ee5e0b5
Commitment scheme part#78
ETatuzova Apr 26, 2024
1e6489d
Wrong test commented#78
ETatuzova Apr 26, 2024
a614c98
Initialize unique points array
May 11, 2024
61c695a
use only crypto3::all target
AndreyMlashkin Jun 20, 2024
2637c38
remove finding boost, as already called in zkLLVM
AndreyMlashkin Jun 21, 2024
fc4afc3
replace _cppui255 with _cppui_modular255
AndreyMlashkin Jul 1, 2024
92332ff
simplify CMakeLists
AndreyMlashkin Jul 1, 2024
2fa0898
use local fork of git modules
AndreyMlashkin Jul 24, 2024
ca0ce7d
Move all files into libs/transpiler directory
AndreyMlashkin Aug 19, 2024
ee18ebd
Merge remote-tracking branch 'transpiler/migration' into directly-inc…
AndreyMlashkin Aug 19, 2024
cd58190
cleanup unused files
AndreyMlashkin Aug 19, 2024
cb4ce60
transpiler cmake adaptations
AndreyMlashkin Aug 19, 2024
840e71d
increase constexpr limit
AndreyMlashkin Aug 20, 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
28 changes: 28 additions & 0 deletions libs/transpiler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
include(CMConfig)
include(CMSetupVersion)

cm_project(transpiler WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES ASM C CXX)

include(CMDeploy)

cm_setup_version(VERSION 0.1.0 PREFIX ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})

add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE)

set_target_properties(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} PROPERTIES
EXPORT_NAME ${CURRENT_PROJECT_NAME})

target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)

target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
${Boost_LIBRARIES}
)

cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
INCLUDE include
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)

include(CMTest)
cm_add_test_subdirectory(test)
56 changes: 56 additions & 0 deletions libs/transpiler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Circuits Traspiler Library for =nil; Foundation's zkLLVM circuit compiler

[![Run tests](https://github.com/NilFoundation/zkllvm-transpiler/actions/workflows/run_tests.yml/badge.svg)](https://github.com/NilFoundation/zkllvm-transpiler/actions/workflows/run_tests.yml)

## Building

This library uses Boost CMake build modules (https://github.com/BoostCMake/cmake_modules.git).
To actually include this library in a project it is required to:

1. Add [CMake Modules](https://github.com/BoostCMake/cmake_modules.git) as submodule to target project repository.
2. Add all the internal dependencies using [CMake Modules](https://github.com/BoostCMake/cmake_modules.git) as submodules to target project repository.
3. Initialize parent project with [CMake Modules](https://github.com/BoostCMake/cmake_modules.git) (Look at [crypto3](https://github.com/nilfoundation/crypto3.git) for the example)

## Run examples
This library is used in the [zkLLVM](https://github.com/NilFoundation/zkllvm) transpiler binary.
It produces gate argument for EVM from zkllvm-assigner which consists of `circuit.crct` and `assignment.tbl` file.
It can also create test proof to check gate argument by [evm-placeholder-verification](https://github.com/NilFoundation/zkllvm)
To build transpiler app follow zkLLVM instructions to prepare evironment and input data. Use this branch [zkLLVM](https://github.com/NilFoundation/zkllvm/tree/64-add-optimize-option-to-transpiler-app).

1. Build transpiler binary file
```bash
make -C ${ZKLLVM_BUILD:-build} transpiler -j$(nproc)
```
2. Let `input_folder` is a folder contains transpiler input (`circuit.crct` and `assignment.tbl` file). Let `output_folder` is a folder for transpiler output. Run to generate gate argument files:
```bash
${ZKLLVM_BUILD:-build}/bin/transpiler/transpiler -m gen-gate-argument -i input_folder -o output_folder
```
Use `--optimize-gates` option to place small sequental gates to one `.sol` file
Let `public_input_file` is a file with public input. Run to generate test proof:
```bash
${ZKLLVM_BUILD:-build}/bin/transpiler/transpiler -m gen-test-proof -i input_folder -o output_folder -p public_input_file
```
3. Copy `output_folder` to `evm-placeholder-verification/contracts/zkllvm`.

4. Run hardhat to verify proof:
```bash
npx hardhat deploy
npx hardhat verify-circuit-proof --test output_folder
```
## Dependencies

### Internal

Crypto3 suite:

* [Crypto3.Algebra](https://github.com/nilfoundation/crypto3-algebra.git).
* [Crypto3.Math](https://github.com/nilfoundation/crypto3-math.git).
* [Crypto3.Multiprecision](https://github.com/nilfoundation/crypto3-multiprecision.git).
* [Crypto3.ZK](https://github.com/nilfoundation/crypto3-zk.git).

zkLLVM compiler ecosystem:

* [zkLLVM Blueprint](https://github.com/NilFoundation/zkllvm-blueprint.git).

### External
* [Boost](https://boost.org) (>= 1.76)
952 changes: 952 additions & 0 deletions libs/transpiler/include/nil/blueprint/transpiler/evm_verifier_gen.hpp

Large diffs are not rendered by default.

Loading
Loading