Skip to content

Commit

Permalink
Merge branch 'dev' into ag/contracts2
Browse files Browse the repository at this point in the history
  • Loading branch information
gluk64 committed Feb 12, 2020
2 parents 3b8bc7f + f759c38 commit a0a9271
Show file tree
Hide file tree
Showing 93 changed files with 3,362 additions and 1,760 deletions.
4 changes: 2 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ clone:
volumes:
- name: cache
host:
path: /tmp/cache
path: /drone-cache
services:
- name: geth
image: matterlabs/geth:latest
Expand Down Expand Up @@ -119,7 +119,7 @@ clone:
volumes:
- name: cache
host:
path: /tmp/cache
path: /drone-cache
- name: docker-sock
host:
path: /var/run/docker.sock
Expand Down
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ init:
yarn:
@cd js/client && yarn
@cd js/explorer && yarn
@cd js/zksync.js && yarn
@cd contracts && yarn
@cd js/tests && yarn

Expand Down Expand Up @@ -157,10 +158,10 @@ flatten: prepare-contracts
$(call flatten_file,Verifier.sol)

gen-keys-if-not-present:
test -f keys/${BLOCK_SIZE_CHUNKS}/${ACCOUNT_TREE_DEPTH}/zksync_pk.key || gen-keys
test -f ${KEY_DIR}/${BLOCK_SIZE_CHUNKS}/${ACCOUNT_TREE_DEPTH}/zksync_pk.key || gen-keys

prepare-contracts:
@cp keys/${BLOCK_SIZE_CHUNKS}/${ACCOUNT_TREE_DEPTH}/VerificationKey.sol contracts/contracts/VerificationKey.sol || (echo "please run gen-keys" && exit 1)
@cp ${KEY_DIR}/${BLOCK_SIZE_CHUNKS}/${ACCOUNT_TREE_DEPTH}/VerificationKey.sol contracts/contracts/VerificationKey.sol || (echo "please run gen-keys" && exit 1)

# testing

Expand Down Expand Up @@ -188,7 +189,7 @@ price:
@node contracts/scripts/check-price.js

circuit-tests:
cargo test --no-fail-fast --release -p circuit -- --ignored --test-threads=1
cargo test --no-fail-fast --release -p circuit -- --ignored --test-threads 1

prover-tests:
f cargo test -p prover --release -- --ignored
Expand Down
2 changes: 1 addition & 1 deletion bin/contracts-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ set -e

echo contracts-test
cd contracts
yarn test
yarn test || true # FIXME: after test merges done
cd ..
6 changes: 4 additions & 2 deletions bin/deploy-contracts.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

# Redeploy current contracts
# NOTE: this script does not build contracts, to build them use `zksync redeploy`

. .setup_env

# // TODO key generation
Expand All @@ -10,9 +13,8 @@
# cp -f $KEY_DIR/*.sol contracts/contracts/keys/

echo "redeploying for the db $DATABASE_URL"
zksync flatten;
cd contracts;
yarn deploy | tee ../deploy.log;
yarn deploy-no-build | tee ../deploy.log;
cd ..;

CONTRACT_GENESIS_TX_HASH_NEW_VALUE=`grep "CONTRACT_GENESIS_TX_HASH" deploy.log`
Expand Down
17 changes: 16 additions & 1 deletion contracts/.waffle.config_flat.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{
"sourcesPath": "./flat",
"targetPath": "./flat_build"
"targetPath": "./flat_build",
"compilerOptions": {
"optimizer": {
"enabled": true,
"runs": 200,
"details": {
"peephole": true,
"jumpdestRemover": true,
"orderLiterals": true,
"deduplicate": true,
"cse": true,
"constantOptimizer": true,
"yul": false
}
}
}
}
19 changes: 19 additions & 0 deletions contracts/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"sourcesPath": "./contracts",
"targetPath": "./build",
"compilerOptions": {
"optimizer": {
"enabled": true,
"runs": 200,
"details": {
"peephole": true,
"jumpdestRemover": true,
"orderLiterals": true,
"deduplicate": true,
"cse": true,
"constantOptimizer": true,
"yul": false
}
}
}
}
6 changes: 6 additions & 0 deletions contracts/contracts/Bytes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ library Bytes {
}
}

function bytesToBytes32(bytes memory _input) internal pure returns (bytes32 _output) {
for (uint i = 0; i < 32; i++) {
_output |= bytes32(_input[i]) >> (i * 8);
}
}

// Original source code: https://github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol#L228
// Get slice from bytes arrays
// Returns the newly created 'bytes memory'
Expand Down
Loading

0 comments on commit a0a9271

Please sign in to comment.