-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #286 from zkFold/vlasin-monorepo-refactor
Monorepo refactor
- Loading branch information
Showing
232 changed files
with
508 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,5 @@ cabal.project.local | |
cabal.project.local~ | ||
.HTF/ | ||
.ghc.environment.* | ||
compiled_scripts/* | ||
stack.yaml* | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
# zkFold Base library | ||
This repository contains the base library for the ZkFold project. It includes the zkFold Symbolic compiler and a number of zero knowledge proof protocols. The compiler translates a subset of Haskell into arithmetic circuits, which can be used to generate zero knowledge proofs. | ||
# zkFold Symbolic framework | ||
This repository contains the zkFold Symbolic framework base library as well as additional packages written using the framework. | ||
|
||
# Documentation | ||
The zkFold Symbolic language can be utilized to create zero-knowledge smart contracts and privacy-preserving applications. | ||
The zkFold Symbolic framework can be utilized to create zero-knowledge smart contracts and privacy-preserving applications. | ||
|
||
User documentation can be found at [docs.zkfold.io](https://docs.zkfold.io "zkFold Symbolic User Documentation"). | ||
User documentation can be found at [docs.zkfold.io](https://docs.zkfold.io/symbolic/introduction/ "zkFold Symbolic User Documentation"). | ||
|
||
If you want to contribute to the project or find out how it works "under the hood", check out [package documentation](https://hackage.haskell.org/package/zkfold-base-0.1.0.0/candidate "zkFold Base package") on Hackage. | ||
|
||
# Build | ||
The package compiles with GHC 9.6.3 and Cabal 3.10.2.1. | ||
The package compiles with GHC 9.6.3 and Cabal 3.10.2.1. To build all packages, execute | ||
```bash | ||
cabal build all | ||
``` | ||
|
||
# Tests | ||
To run the tests, execute | ||
```bash | ||
cabal run -- zkfold-base-test | ||
cabal test all | ||
``` | ||
|
||
# Examples | ||
The `examples` folder contains several code examples of arithmetizable pure functions. These examples can be compiled into the arithmetic circuits with the zkFold Symbolic compiler. In order to do it, execute | ||
# Benchmarks | ||
To run the benchmarks, execute | ||
```bash | ||
cabal run -- zkfold-base-examples | ||
``` | ||
The output is placed into the `compiled_scripts` folder. | ||
cabal bench all | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 zkFold SA | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# zkFold Symbolic Base package | ||
This package contains the zkFold Symbolic framework base library. It includes the zkFold Symbolic compiler and a number of zero knowledge proof protocols. The compiler translates code written using the zkFold Symbolic framework into arithmetic circuits. The zero knowledge proof protocols are used to verify statements about the circuits. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cradle: | ||
cabal: | ||
- path: "./src" | ||
component: "lib:symbolic-base" | ||
|
||
- path: "./test" | ||
component: "symbolic-base:test:symbolic-base-test" | ||
|
||
- path: "./bench/BenchPolyMul.hs" | ||
component: "symbolic-base:bench:bench-poly-mul" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
cabal-version: 3.0 | ||
|
||
name: zkfold-base | ||
name: symbolic-base | ||
version: 0.1.0.0 | ||
tested-with: GHC ==9.6.4 | ||
tested-with: GHC == 9.6.3 | ||
synopsis: ZkFold Symbolic compiler and zero-knowledge proof protocols | ||
homepage: https://zkfold.io/ | ||
category: Cryptography, DSL, Math, Symbolic Computation | ||
author: Vladimir Sinyakov, Pavel Sokolov, Murat Kasimov, Vladimir Morozov, Eitan Chatav, Ilya Baryshnikov | ||
author: Vladimir Sinyakov, Pavel Sokolov, Vladimir Morozov, Eitan Chatav, Ilya Baryshnikov, Anna Hovanskaya, Evgenii Samodelov, Murat Kasimov, Maxim Churilov | ||
maintainer: [email protected] | ||
license: MIT | ||
license-file: LICENSE | ||
build-type: Simple | ||
Data-Files: | ||
tests/data/shabittestvectors/*.rsp | ||
test/data/shabittestvectors/*.rsp | ||
|
||
description: | ||
This package contains the base library for the ZkFold project. It includes zkFold Symbolic compiler and a number of zero knowledge proof protocols. | ||
The compiler translates a subset of Haskell into arithmetic circuits, which can be used to generate zero knowledge proofs. | ||
This package contains the zkFold Symbolic framework base library. It includes the zkFold Symbolic compiler and a number of zero knowledge proof protocols. | ||
The compiler translates code written using the zkFold Symbolic framework into arithmetic circuits. The zero knowledge proof protocols are used to verify statements about the circuits. | ||
|
||
Flag Pedantic | ||
Description: Enable pedantic build with -Werror | ||
|
@@ -35,6 +35,7 @@ common options | |
-Wnoncanonical-monad-instances | ||
-Wpartial-fields | ||
-Wredundant-constraints | ||
-Wunused-packages | ||
-O2 | ||
-threaded | ||
if flag(pedantic) | ||
|
@@ -166,24 +167,6 @@ library | |
ZkFold.Symbolic.Algorithms.Hash.MiMC.Constants | ||
ZkFold.Symbolic.Algorithms.Hash.SHA2 | ||
ZkFold.Symbolic.Algorithms.Hash.SHA2.Constants | ||
ZkFold.Symbolic.Cardano.Wrapper | ||
ZkFold.Symbolic.Cardano.Contracts.BatchTransfer | ||
ZkFold.Symbolic.Cardano.Contracts.RandomOracle | ||
ZkFold.Symbolic.Cardano.Types | ||
ZkFold.Symbolic.Cardano.Types.Address | ||
ZkFold.Symbolic.Cardano.Types.Basic | ||
ZkFold.Symbolic.Cardano.Types.Input | ||
ZkFold.Symbolic.Cardano.Types.Output | ||
ZkFold.Symbolic.Cardano.Types.Output.Datum | ||
ZkFold.Symbolic.Cardano.Types.OutputRef | ||
ZkFold.Symbolic.Cardano.Types.Transaction | ||
ZkFold.Symbolic.Cardano.Types.Value | ||
ZkFold.Symbolic.Cardano.UPLC | ||
ZkFold.Symbolic.Cardano.UPLC.Builtins | ||
ZkFold.Symbolic.Cardano.UPLC.Inference | ||
ZkFold.Symbolic.Cardano.UPLC.Inference.Internal | ||
ZkFold.Symbolic.Cardano.UPLC.Term | ||
ZkFold.Symbolic.Cardano.UPLC.Type | ||
ZkFold.Symbolic.Class | ||
ZkFold.Symbolic.Compiler | ||
ZkFold.Symbolic.Compiler.ArithmeticCircuit | ||
|
@@ -208,25 +191,6 @@ library | |
ZkFold.Symbolic.Data.UTCTime | ||
ZkFold.Symbolic.Data.FieldElement | ||
ZkFold.Symbolic.Interpreter | ||
ZkFold.Symbolic.Ledger.Types | ||
ZkFold.Symbolic.Ledger.Types.Address | ||
ZkFold.Symbolic.Ledger.Types.Basic | ||
ZkFold.Symbolic.Ledger.Types.Bridge | ||
ZkFold.Symbolic.Ledger.Types.Contract | ||
ZkFold.Symbolic.Ledger.Types.Hash | ||
ZkFold.Symbolic.Ledger.Types.Input | ||
ZkFold.Symbolic.Ledger.Types.Output | ||
ZkFold.Symbolic.Ledger.Types.OutputRef | ||
ZkFold.Symbolic.Ledger.Types.Transaction | ||
ZkFold.Symbolic.Ledger.Types.Update | ||
ZkFold.Symbolic.Ledger.Types.Value | ||
ZkFold.Symbolic.Ledger.Validation.Bridge | ||
ZkFold.Symbolic.Ledger.Validation.Contract | ||
ZkFold.Symbolic.Ledger.Validation.Common | ||
ZkFold.Symbolic.Ledger.Validation.PrivateInput | ||
ZkFold.Symbolic.Ledger.Validation.PublicInput | ||
ZkFold.Symbolic.Ledger.Validation.Transaction | ||
ZkFold.Symbolic.Ledger.Validation.Update | ||
ZkFold.Symbolic.MonadCircuit | ||
build-depends: | ||
base >= 4.9 && < 5, | ||
|
@@ -244,7 +208,6 @@ library | |
lens , | ||
mtl < 2.4, | ||
optics < 0.5, | ||
parallel < 3.2.3.0, | ||
pretty-simple < 4.2, | ||
QuickCheck < 2.15, | ||
random < 1.3, | ||
|
@@ -254,38 +217,14 @@ library | |
-- TODO: remove `swagger2` after moving the related code to `zkfold-prover` | ||
swagger2 , | ||
text , | ||
tfp < 1.1, | ||
these < 1.3, | ||
type-errors < 0.2.1, | ||
vector < 0.14, | ||
vector-binary-instances < 0.3, | ||
vector-split < 1.1, | ||
hs-source-dirs: src | ||
|
||
library zkfold-symbolic-examples | ||
import: options | ||
exposed-modules: | ||
ZkFold.Symbolic.Examples | ||
other-modules: | ||
Examples.BatchTransfer | ||
Examples.ByteString | ||
Examples.Conditional | ||
Examples.Constant | ||
Examples.Eq | ||
Examples.FFA | ||
Examples.Fibonacci | ||
Examples.LEQ | ||
Examples.MiMCHash | ||
Examples.ReverseList | ||
Examples.UInt | ||
build-depends: | ||
base, | ||
containers, | ||
deepseq, | ||
zkfold-base, | ||
hs-source-dirs: examples | ||
|
||
test-suite zkfold-base-test | ||
test-suite symbolic-base-test | ||
import: options-exe | ||
type: exitcode-stdio-1.0 | ||
ghc-options: | ||
|
@@ -322,20 +261,19 @@ test-suite zkfold-base-test | |
bytestring , | ||
blake2 , | ||
containers , | ||
deepseq , | ||
containers , | ||
directory <= 1.3.8.4, | ||
filepath <= 1.5.2.0, | ||
hspec < 2.12, | ||
QuickCheck , | ||
regex-tdfa <= 1.3.2.2, | ||
split < 0.2.6, | ||
symbolic-base , | ||
vector , | ||
vector-algorithms , | ||
zkfold-base , | ||
hs-source-dirs: tests | ||
hs-source-dirs: test | ||
|
||
benchmark polynomial-multiplication | ||
benchmark bench-poly-mul | ||
import: options-exe | ||
main-is: BenchPolyMul.hs | ||
hs-source-dirs: bench | ||
|
@@ -344,29 +282,8 @@ benchmark polynomial-multiplication | |
-O3 | ||
build-depends: | ||
base, | ||
array, | ||
deepseq, | ||
random, | ||
symbolic-base, | ||
tasty-bench, | ||
vector, | ||
zkfold-base | ||
|
||
benchmark compiler-benchmark | ||
import: options-exe | ||
main-is: BenchCompiler.hs | ||
hs-source-dirs: bench | ||
type: exitcode-stdio-1.0 | ||
ghc-options: | ||
-fprof-auto | ||
-fprof-cafs | ||
-O3 | ||
build-depends: | ||
adjunctions, | ||
base, | ||
bytestring, | ||
containers, | ||
deepseq, | ||
tasty-bench, | ||
tasty-golden, | ||
zkfold-base, | ||
zkfold-symbolic-examples |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 zkFold SA | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# zkFold Symbolic Cardano package | ||
This package contains the library for integration of the zkFold Symbolic framework with the Cardano blockchain. It provides the types and functions for verifying statements about Cardano transactions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cradle: | ||
cabal: | ||
- path: "./src" | ||
component: "lib:symbolic-cardano" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.