Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a0f2d28
Diagnostic to banana lite
hecmas May 31, 2024
98540bf
Diagnostic working
hecmas May 31, 2024
97a9e32
WIP 2**24, 2**25 with pil differences
zkronos73 Jun 5, 2024
47099b8
change to allow 2^24 / 2^25 bits
zkronos73 Jun 10, 2024
bcc0ce7
add option --mode to buildsetup
zkronos73 Jun 11, 2024
33b1332
add mode_tag to specify starkstruct variant
zkronos73 Jun 11, 2024
22e9367
updating first starkstruct for 24/25
zkronos73 Jun 11, 2024
f93c5f2
Modifying the memory limit test to be consistent with the check
hecmas Jun 13, 2024
9916246
Working on the connection checker
hecmas Jun 14, 2024
269e490
Adding the connection checker tool
hecmas Jun 15, 2024
280f8a8
Merge pull request #349 from 0xPolygonHermez/develop-banana-lite
hecmas Jul 2, 2024
a638ae4
Adding parser + fflonk_setup
RogerTaule May 21, 2024
b2514f7
Adding setup for testing 2 power 25
RogerTaule May 22, 2024
c14f3e0
Updating setup to not store consttree file
RogerTaule May 28, 2024
87f6265
Integrating intermediate polinomials calls
RogerTaule May 31, 2024
6dcb631
Minor adjustments
RogerTaule Jun 11, 2024
1a4e4d6
Modifying 2_25 starkstruct and minor fix exec
RogerTaule Jun 11, 2024
b492564
Removing copy files
RogerTaule Jun 13, 2024
1a0d63b
Minor fixes
RogerTaule Jun 13, 2024
2c96cc5
Fixing package.json
rickb80 Jun 14, 2024
1595776
Writing properly rom commit
RogerTaule Jun 17, 2024
57a6e57
Adding 2^23 option
RogerTaule Jun 21, 2024
568ae44
Updating package.json
RogerTaule Jun 21, 2024
c00312c
Adding instructions file to generate setup and compile
RogerTaule Jun 21, 2024
81212ca
Removing 2^23 option
RogerTaule Jul 2, 2024
aa5ef2f
Updating package-lock.json
RogerTaule Jul 2, 2024
cd74363
Merge pull request #353 from 0xPolygonHermez/test_2_25
zkronos73 Jul 3, 2024
ea4650b
Modifying package.json pil-stark
RogerTaule Jul 4, 2024
d7397cf
Update commonjs
Jul 4, 2024
d458fba
Override vulnerable ws version
Jul 4, 2024
260f848
Merge branch 'feature/2_24_25' of https://github.com/0xPolygonHermez/…
Jul 4, 2024
4fcc603
update package.json
zkronos73 Jul 4, 2024
38402e8
Merge pull request #354 from 0xPolygonHermez/2_25_fix
zkronos73 Aug 1, 2024
c8591a6
Merge pull request #351 from 0xPolygonHermez/feature/connect-checker
zkronos73 Aug 1, 2024
3051938
Merge pull request #350 from 0xPolygonHermez/feature/2_24_25
zkronos73 Aug 1, 2024
d7ba37b
update pil-stark version on package.json
zkronos73 Aug 1, 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
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,16 @@ npm run buildsetup --step=c12setup
```sh
npm run buildsetup --steps
```
**pil**: syntax is --pil=\<main.pil\> where main.pil was name of pil to compile. For debugging could use basic_main.pil. See --starkstruct option
**rom**: syntax is --rom=\<rom_dir\> where rom_dir is path where found rom project (default: node_modules/@0xpolygonhermez/zkevm-rom).
```sh
npm run buildsetup --rom=node_modules/@0xpolygonhermez/zkevm-rom-25
```
**mode**: syntax is --mode=\<24\> where 24 define version of buildsetup, 2^24 or 2^25 (default: 24). Using 25, the default rom_dir is node_modules/@0xpolygonhermez/zkevm-rom-25 and the default pil is pil/main_2_25.pil
```sh
npm run buildsetup --mode=25
```

**pil**: syntax is --pil=\<main.pil\> where main.pil is name of pil to compile. For debugging could use basic_main.pil. See --starkstruct option
```sh
npm run buildsetup --pil=pil/basic_main.pil --starkstruct=debug
```
Expand Down
173 changes: 173 additions & 0 deletions SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# Generating zkevm-prover setup

Lets start by launching an instance.

## Basic OS preparation

```bash
sudo apt update
sudo apt install -y tmux git curl jq
```

## Tweaking the OS to accept high amount of memory.

```bash
echo "vm.max_map_count=655300" | sudo tee -a /etc/sysctl.conf
sudo sysctl -w vm.max_map_count=655300
export NODE_OPTIONS="--max-old-space-size=230000"
```

## Install version of node and npm

```bash
curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install -y nodejs
node -v
```

The version of node should be: 18 (e.g. 18.19.0 )

## Download and prepare circom

To compile circuits, we need circom installed.

```bash
cd ~
git clone https://github.com/iden3/circom.git
cd circom
git checkout v2.1.8
git log --pretty=format:'%H' -n 1
```

The hash of the commit should be: f0deda416abe91e5dd906c55507c737cd9986ab5

Install and compile circom (RUST)

```bash
cd ~
sudo apt install -y cargo
cd circom
cargo build --release
cargo install --path circom
export PATH=$PATH:~/.cargo/bin
echo 'PATH=$PATH:~/.cargo/bin' >> ~/.profile
circom --version
```

The version of circom should be: 2.1.8

## Install SNARKjs

```bash
npm install -g snarkjs
```

## Prepare fast build constant tree tool

```bash
cd ~
git clone https://github.com/0xPolygonHermez/zkevm-prover.git
cd zkevm-prover
git checkout develop
make clean
git submodule init
git submodule update
sudo apt install -y build-essential libomp-dev libgmp-dev nlohmann-json3-dev libpqxx-dev nasm libgrpc++-dev libprotobuf-dev grpc-proto libsodium-dev uuid-dev libsecp256k1-dev
make -j bctree
make -j fflonk_setup
```

## Prepare and launch setup (zkevm-proverjs)

```bash
cd ~
git clone https://github.com/0xPolygonHermez/zkevm-proverjs.git
cd zkevm-proverjs
git checkout test_2_25
npm install
```

To generate setup for N=2^24
```bash
tmux -c "npm run buildsetup --build=build/setup_24 --bctree=../zkevm-prover/build/bctree --fflonksetup=../zkevm-prover/build/fflonkSetup"
```

To generate setup for N=2^25
```bash
tmux -c "npm run buildsetup --build=build/setup_25 --bctree=../zkevm-prover/build/bctree --fflonksetup=../zkevm-prover/build/fflonkSetup --mode=25"
```

Notice that the first time the process will also need to download powersOfTau28_hez_final.ptau will inside `build` folder, which is a 288GB file. This will happen only once and takes two hours.

## Copying files to zkevm-prover

To generate proofs for N=24 or N=25, the only that needs to be done is to create a virtual link to the config files. This are inside the build directory specified when building the setup. For example, for N=24 would be:

```bash
cd ~
cd zkevm-prover
rm -rf config
ln -s ../zkevm-proverjs/build/setup_24/config config
```

For N=24, only `WORKING_DIR` version needs to be modified by specifying the directory in which the setup has been built.
```bash
WORKING_DIR=../zkevm-proverjs/build/setup_24/
```

For N=25, in addition to modify the `WORKING_DIR`, the `VERSION` needs to be modified so that instead of `fork.10`, it points to `fork.11`

```bash
VERSION=v7.0.0-rc.1-fork.10 ----> VERSION=v7.0.0-rc.1-fork.11
```

For N=25, the `PROVER_FORK_ID` will also need to be modified inside `src/config/definitions.hpp`
```bash
PROVER_FORK_ID 10 ----> PROVER_FORK_ID 11
```

Once all of this, the files are copied by executing the script

```bash
cd ~
cd zkevm-prover
./tools/copy_generate_files.sh
```

## Compiling zkevm-prover

As mentioned above, if N = 25, the `PROVER_FORK_ID` needs to be modified inside `src/config/definitions.hpp` if not already done
```bash
PROVER_FORK_ID 10 ----> PROVER_FORK_ID 11
```

Inside `src/config/definitions.hpp`, you can decide if you prefer to use the memory reduced version or not by modifying `REDUCE_ZKEVM_MEMORY` parameter.

Also, to improve compilation time, the following two lines can be commented.

```bash
#define MAIN_SM_EXECUTOR_GENERATED_CODE
#define MAIN_SM_PROVER_GENERATED_CODE
```

You may first need to recompile the protobufs:
```sh
cd src/grpc
make
cd ../..
```

Finally, to compile the CPU prover

```bash
make -j generate
make -j cpu
```

Instead, if you want to compile the GPU prover

```bash
make -j generate
make -j gpu
```
Loading