Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feat/goerli
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsing committed Dec 23, 2021
2 parents 94db465 + 085d6a6 commit d51acd1
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.bak

sftp-config.json
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ EXCHANGE_DB="postgres://exchange:[email protected]:5432/exchange"
# db related
prover_status:
psql $(PROVER_DB) -c "select status, count(*) from task group by status UNION ALL SELECT null status, COUNT(status) from task"
block_status:
psql $(PROVER_DB) -c "select status, count(*) from l2block group by status UNION ALL SELECT null status, COUNT(status) from l2block"
new_trades:
psql $(EXCHANGE_DB) -c 'select * from market_trade order by time desc limit 10;'
new_blocks:
Expand Down
2 changes: 1 addition & 1 deletion rollup-state-manager
36 changes: 30 additions & 6 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function prepare_circuit() {
mkdir -p $TARGET_CIRCUIT_DIR
CIRCUITS_DIR=$CIRCUITS_DIR $ENVSUB > $TARGET_CIRCUIT_DIR/circuit.circom << EOF
include "${CIRCUITS_DIR}/src/block.circom";
component main = Block(${NTXS}, ${BALANCELEVELS}, ${ORDERLEVELS}, ${ACCOUNTLEVELS});
component main { public [oldRoot, newRoot, txDataHashHi, txDataHashLo]}= Block(${NTXS}, ${BALANCELEVELS}, ${ORDERLEVELS}, ${ACCOUNTLEVELS});
EOF
echo 'circuit source:'
cat $TARGET_CIRCUIT_DIR/circuit.circom
Expand Down Expand Up @@ -99,12 +99,13 @@ function start_docker_compose() {
cd -
}

function run_docker_compose() {
function run_core_docker_compose() {
start_docker_compose $ORCHESTRA_DIR orchestra
start_docker_compose $REGNBUE_DIR faucet
start_docker_compose $REGNBUE_DIR regnbue-faucet
if [ $DX_NETWORK == 'geth' ]; then
start_docker_compose $BLOCKSCOUT_DIR blockscout # geth node & blockscout stuff
fi
start_docker_compose $FAUCET_DIR faucet
sleep 10
}

Expand Down Expand Up @@ -154,9 +155,28 @@ function run_prove_workers() {
fi
}

function boostrap_contract() {
function run_eth_node() {
# a mainnet like 50 Gwei gas price
# base on 21,000 units limit from mainnet (21,000 units * 50 Gwei)
cd $CONTRACTS_DIR
yarn install
GANACHE_CLI_ARG="--host 0.0.0.0 \
--networkId 53371 \
--chainId 53371 \
--blockTime 15 \
--db $CONTRACTS_DIR/ganache \
--gasPrice 50000000000 \
--gasLimit 1050000000000000 \
--allowUnlimitedContractSize \
--accounts 20 \
--defaultBalanceEther 1000 \
--deterministic \
--mnemonic=$MNEMONIC"
if [ $VERBOSE_GANACHE == 'TRUE' ]; then
GANACHE_CLI_ARG=$GANACHE_CLI_ARG" --verbose"
fi
nohup npx ganache-cli $GANACHE_CLI_ARG >> $CONTRACTS_DIR/ganache.$CURRENTDATE.log 2>&1 &
sleep 1
}

function deploy_tokens() {
Expand Down Expand Up @@ -214,7 +234,10 @@ function run_bin() {
run_rollup

sleep 10
boostrap_contract

if [ $DX_NETWORK == 'geth' ]; then
run_eth_node
fi
if [ $DX_CLEAN == 'TRUE' ]; then
deploy_contracts
sleep 30
Expand All @@ -236,9 +259,10 @@ function setup() {

function run_all() {
config_prover_cluster
run_docker_compose
run_core_docker_compose
run_bin
run_ticker
start_docker_compose $BLOCKSCOUT_DIR blockscout # blockscout depends on eth_node, so we run it later
}

if [[ -z ${AS_RESOURCE+x} ]]; then
Expand Down
1 change: 1 addition & 0 deletions stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function stop_docker_composes() {

function clean_data() {
rm -rf rollup-state-manager/circuits/testdata/persist/
rm -rf contracts/ganache
}

kill_tasks
Expand Down

0 comments on commit d51acd1

Please sign in to comment.