changeTreeHeight script

This commit is contained in:
Alexey 2021-02-26 12:14:43 +03:00
parent 0cabd318cd
commit bf5581f764
5 changed files with 12 additions and 3 deletions

@ -15,8 +15,9 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: 12
- run: yarn install
- run: cargo install zkutil
- run: yarn install
- run: yarn changeTreeHeight 2
- run: yarn circuit
- run: yarn test
- run: yarn lint

@ -3,7 +3,7 @@
pragma solidity ^0.6.0;
contract Pack {
uint256 public constant CHUNK_TREE_HEIGHT = 7;
uint256 public constant CHUNK_TREE_HEIGHT = 8;
uint256 public constant CHUNK_SIZE = 2**CHUNK_TREE_HEIGHT;
uint256 public constant ITEM_SIZE = 32 + 20 + 4;
uint256 public constant BYTES_SIZE = CHUNK_SIZE * ITEM_SIZE;

@ -16,6 +16,7 @@
"prettier:check": "prettier --check . --config .prettierrc",
"prettier:fix": "prettier --write . --config .prettierrc",
"lint": "yarn eslint && yarn prettier:check",
"changeTreeHeight": "scripts/changeTreeHeight.sh",
"circuit:batchTreeUpdate": "scripts/buildCircuit.sh BatchTreeUpdate",
"circuit:batchTreeUpdateLarge": "scripts/buildCircuit.sh BatchTreeUpdate large",
"circuit:batchTreeUpdateWitness": "scripts/buildWitness.sh BatchTreeUpdate",

7
scripts/changeTreeHeight.sh Executable file

@ -0,0 +1,7 @@
#!/bin/bash
case $(sed --help 2>&1) in
*GNU*) sed_i () { xargs sed -i "$@"; };;
*) sed_i () { xargs sed -i '' "$@"; };;
esac
grep -l --exclude-dir={.git,node_modules,artifacts} -r "CHUNK_TREE_HEIGHT = [0-9]" . | sed_i "s/CHUNK_TREE_HEIGHT = [0-9]/CHUNK_TREE_HEIGHT = ${1}/g"

@ -13,7 +13,7 @@ const hashes = [
'0x57f7b90a3cb4ea6860e6dd5fa44ac4f53ebe6ae3948af577a01ef51738313246',
]
const CHUNK_TREE_HEIGHT = 7
const CHUNK_TREE_HEIGHT = 8
describe.skip('Pack', () => {
it('should work', async () => {
const Pack = await ethers.getContractFactory('Pack')