Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/new_rollup_dev' into circuit_pro…
Browse files Browse the repository at this point in the history
…totype

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	core/circuit/Cargo.toml
#	core/circuit/src/cheque/bitwindow.rs
#	core/circuit/src/cheque/mod.rs
#	core/circuit/src/deposit/circuit.rs
#	core/circuit/src/deposit/deposit_request.rs
#	core/circuit/src/deposit/mod.rs
#	core/circuit/src/encoder.rs
#	core/circuit/src/exit/circuit.rs
#	core/circuit/src/exit/exit_request.rs
#	core/circuit/src/exit/mod.rs
#	core/circuit/src/leaf.rs
#	core/circuit/src/lib.rs
#	core/circuit/src/plasma_constants.rs
#	core/circuit/src/transfer/circuit.rs
#	core/circuit/src/transfer/mod.rs
#	core/circuit/src/transfer/transaction.rs
#	core/key_generator/src/depositor_key.rs
#	core/key_generator/src/exitor_key.rs
#	core/key_generator/src/main.rs
#	core/key_generator/src/read_write_keys.rs
#	core/key_generator/src/transactor_key.rs
#	core/key_generator/src/vk_contract_generator.rs
#	core/models/src/abi.rs
#	core/models/src/plasma/account.rs
#	core/models/src/plasma/block.rs
#	core/models/src/plasma/mod.rs
#	core/models/src/plasma/params.rs
#	core/models/src/plasma/tx.rs
#	core/plasma/src/state.rs
#	core/prover/src/main.rs
#	core/sandbox/Cargo.toml
#	core/sandbox/src/main.rs
#	core/sandbox/src/nonce_futures.rs
#	core/server/src/api_server.rs
#	core/server/src/eth_sender.rs
#	core/server/src/eth_watch.rs
#	core/server/src/nonce_futures.rs
#	core/server/src/state_keeper.rs
#	core/storage/src/lib.rs
  • Loading branch information
TymurKhr committed Aug 6, 2019
2 parents 2f9e493 + ee00116 commit 7b4ac9e
Show file tree
Hide file tree
Showing 188 changed files with 14,420 additions and 11,327 deletions.
43 changes: 43 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
stages:
- build
- tests

.rust-template: &rust-template
before_script:
- rustup --version
- rustc --version
- cargo --version
tags:
- franklin

compile:
image: 'registry.mattr.network/devops/images/rust_night'
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- target/
<<: *rust-template
stage: build
script:
- cargo fmt --all -- --check
- cargo build --verbose
only:
- master
- merge_requests

tests:
image: 'registry.mattr.network/devops/images/rust_night'
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- target/
policy: pull
<<: *rust-template
stage: tests
when: manual
script:
- cargo clippy --tests --benches -- -D warnings
- cargo test --verbose
only:
- master
- merge_requests
668 changes: 303 additions & 365 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ members = [
"core/models",
"core/plasma",
"core/prover",
"core/sandbox",
"core/server",
"core/storage",
"core/circuit",
"core/franklincircuit",
"core/franklinmodels",
]
42 changes: 24 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ db-setup:
@bin/db-setup

db-insert-contract:
@bin/db-insert-contract
@bin/db-insert-contract.sh

db-reset: confirm_action db-drop db-setup db-insert-contract
@echo database is ready

db-migrate: confirm_action
@cd src/storage && diesel migration run
@cd core/storage && diesel migration run

db-drop: confirm_action
@# this is used to clear the produciton db; cannot do `diesel database reset` because we don't own the db
Expand Down Expand Up @@ -128,21 +128,27 @@ push-image-rust: image-rust
# Contracts

deploy-contracts: confirm_action
@bin/deploy-contracts

flattener = @docker run --rm -v $(shell pwd)/contracts:/home/contracts -it "${FLATTENER_DOCKER_IMAGE}"
define flatten_file
@echo flattening $(1)
$(flattener) -c 'solidity_flattener --output /home/contracts/flat/$(1) /home/contracts/contracts/$(1)'
endef

# Flatten contract source
flatten:
@mkdir -p contracts/flat
$(call flatten_file,FranklinProxy.sol)
$(call flatten_file,Depositor.sol)
$(call flatten_file,Exitor.sol)
$(call flatten_file,Transactor.sol)
@bin/deploy-contracts.sh

test-contracts: confirm_action
@cd contracts && yarn test

# deploy-contracts: confirm_action
# @bin/deploy-contracts

# flattener = @docker run --rm -v $(shell pwd)/contracts:/home/contracts -it "${FLATTENER_DOCKER_IMAGE}"
# define flatten_file
# @echo flattening $(1)
# $(flattener) -c 'solidity_flattener --output /home/contracts/flat/$(1) /home/contracts/contracts/$(1)'
# endef

# # Flatten contract source
# flatten:
# @mkdir -p contracts/flat
# $(call flatten_file,FranklinProxy.sol)
# $(call flatten_file,Depositor.sol)
# $(call flatten_file,Exitor.sol)
# $(call flatten_file,Transactor.sol)

# Publish source to etherscan.io
source: #flatten
Expand Down Expand Up @@ -299,4 +305,4 @@ tesseracts-up:
@docker-compose up -d tesseracts

tesseracts-down:
@docker-compose stop tesseracts
@docker-compose stop tesseracts
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ Client UI will be available at http://localhost:8080

## Database migrations

- ```cd src/storage```
- ```cd core/storage```
- Add diesel migration
- Rename `src/storage/schema.rs.generated` to `schema.rs`
- Rename `core/storage/schema.rs.generated` to `schema.rs`
- Run tests: ```franklin db-tests```

## Generating keys
Expand Down Expand Up @@ -129,4 +129,4 @@ So you need to rebuild the code on every change (to be automated).

```
franklin flatten source
```
```
File renamed without changes.
2 changes: 1 addition & 1 deletion bin/.setup_env
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ then

export ENV_FILE=./etc/env/$FRANKLIN_ENV.env

if [ "dev" == "$FRANKLIN_ENV" ] && [ ! -f etc/env/dev.env ]
if [ "dev" = "$FRANKLIN_ENV" ] && [ ! -f etc/env/dev.env ]
then
cp etc/env/dev.env.example etc/env/dev.env
fi
Expand Down
4 changes: 3 additions & 1 deletion bin/db-insert-contract → bin/db-insert-contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
FRANKLIN_ENV=
. .setup_env

psql "$DATABASE_URL" -c "INSERT INTO server_config (contract_addr) VALUES ('$CONTRACT_ADDR')" || exit 1
psql "$DATABASE_URL" -c "INSERT INTO server_config (contract_addr) \
VALUES ('$CONTRACT_ADDR') \
ON CONFLICT (id) DO UPDATE SET contract_addr = '$CONTRACT_ADDR'" || exit 1
echo "successfully inserted contract address into the database"
2 changes: 1 addition & 1 deletion bin/db-setup
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Force read env
FRANKLIN_ENV=
. .setup_env
cd src/storage
cd core/storage

echo DATABASE_URL=$DATABASE_URL
diesel database setup || exit 1
Expand Down
2 changes: 1 addition & 1 deletion bin/db-test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

. .setup_env
cd src/storage
cd core/storage

export DATABASE_URL=postgres://postgres@localhost/plasma_test

Expand Down
40 changes: 0 additions & 40 deletions bin/deploy-contracts

This file was deleted.

40 changes: 40 additions & 0 deletions bin/deploy-contracts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

. .setup_env

# // TODO key generation
# KEY_FILES=$CONTRACT_KEY_FILES
# .load_keys
#
# mkdir -p contracts/contracts/keys/
# cp -f $KEY_DIR/*.sol contracts/contracts/keys/

echo redeploying for the db $DATABASE_URL
cd contracts
yarn deploy | tee ../deploy.log
cd ..

export LABEL=$FRANKLIN_ENV-`date +%Y-%m-%d-%H%M%S`

export NEW_CONTRACT=`cat deploy.log | grep "Franklin address" | grep -oE '0x(.+)' | sed -n "s/0x//p"`


if [[ ! -z "$NEW_CONTRACT" ]]
then
echo New contract at $NEW_CONTRACT

OLD_CONTRACT=`grep "^CONTRACT_ADDR" ./$ENV_FILE | grep -oE '=(.+)' | sed -n "s/=//p"`
echo Old contract at $OLD_CONTRACT

mkdir -p logs/$LABEL/
cp deploy.log logs/$LABEL/deploy.log
cp ./$ENV_FILE logs/$LABEL/$FRANKLIN_ENV.bak

sed -i".bak" "s/^CONTRACT_ADDR=$OLD_CONTRACT/CONTRACT_ADDR=$NEW_CONTRACT/g" ./$ENV_FILE

echo successfully deployed contracts

else
echo "Contract deployment failed"
exit 1
fi
File renamed without changes.
2 changes: 1 addition & 1 deletion contracts/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/build
/contracts/keys
# /contracts/keys
/flat
8 changes: 8 additions & 0 deletions contracts/.solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "solhint:default",
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error",
"no-inline-assembly": false
}
}
Loading

0 comments on commit 7b4ac9e

Please sign in to comment.