forked from matter-labs/zksync
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into lyova-983-refactor-shell-scripts-and-makefile
- Loading branch information
Showing
31 changed files
with
604 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
cd core/lib/storage | ||
|
||
# Check generated sqlx data | ||
if ! cargo sqlx prepare --check | ||
then | ||
# Prepare sqlx bindings | ||
# We're going to do it even on CI, since it seems that this file can be invalidated after several subsequent compilations. | ||
echo "Going to rerun 'sqlx prepare'" | ||
cargo sqlx prepare | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
# Force read env -- this is important, sp that we re-ready the new contract value after redeploy!!! | ||
ZKSYNC_ENV= | ||
. .setup_env | ||
|
||
psql "$DATABASE_URL" -c "INSERT INTO server_config (contract_addr, gov_contract_addr) \ | ||
VALUES ('$CONTRACT_ADDR', '$GOVERNANCE_ADDR') \ | ||
ON CONFLICT (id) DO UPDATE \ | ||
SET (contract_addr, gov_contract_addr) = ('$CONTRACT_ADDR', '$GOVERNANCE_ADDR')" || exit 1 | ||
echo "successfully inserted contract address into the database" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
# Force read env -- this is important, sp that we re-ready the new contract value after redeploy!!! | ||
ZKSYNC_ENV= | ||
. .setup_env | ||
|
||
# Retrieve pending nonce from the node and obtain the value via `jq`. | ||
# NONCE variable will have the value like `"0x123"`. | ||
# Log output is redirected to the `/dev/null` to avoid garbage in the overall command output. | ||
NONCE=`curl \ | ||
-H "Accept: application/json" \ | ||
-H "Content-Type: application/json" \ | ||
-X POST \ | ||
--data '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":['"\"$OPERATOR_COMMIT_ETH_ADDRESS\""',"pending"],"id":1}' \ | ||
$WEB3_URL 2> /dev/null \ | ||
| jq '.result'` | ||
|
||
# Strip quotes around the nonce value. Result will be like `0x123`. | ||
eval NONCE=$NONCE | ||
|
||
# Convert the number from the hexadecimal form to the decimal. The result will be like `291`. | ||
NONCE=`printf "%d\n" $NONCE` | ||
|
||
# Insert data: nonce (obtained above), gas price limit (obtained from env), stats data (defaults to zero) | ||
psql "$DATABASE_URL" -c "INSERT INTO eth_parameters (nonce, gas_price_limit, commit_ops, verify_ops, withdraw_ops) \ | ||
VALUES ('$NONCE', '$ETH_GAS_PRICE_DEFAULT_LIMIT', 0, 0, 0) \ | ||
ON CONFLICT (id) DO UPDATE \ | ||
SET (commit_ops, verify_ops, withdraw_ops) = (0, 0, 0)" || exit 1 | ||
|
||
echo "inserted Ethereum nonce ($NONCE)" | ||
echo "successfully initialized the Ethereum parameters table" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
# db-insert-token.sh id, address, symbol, precision | ||
|
||
# Force read env -- this is important, sp that we re-ready the new contract value after redeploy!!! | ||
ZKSYNC_ENV= | ||
. .setup_env | ||
|
||
psql "$DATABASE_URL" -c "INSERT INTO tokens \ | ||
VALUES ($1, '$2', '$3', $4);" || exit 1 | ||
echo "successfully inserted token into the database" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Force read env | ||
ZKSYNC_ENV= | ||
. .setup_env | ||
cd core/lib/storage | ||
|
||
echo DATABASE_URL=$DATABASE_URL | ||
diesel database setup | ||
diesel migration run | ||
|
||
# We don't need this file for sqlx | ||
rm src/schema.rs.generated | ||
|
||
# Check generated sqlx data | ||
if ! cargo sqlx prepare --check | ||
then | ||
# Prepare sqlx bindings | ||
# We're going to do it even on CI, since it seems that this file can be invalidated after several subsequent compilations. | ||
echo "Going to rerun 'sqlx prepare'" | ||
cargo sqlx prepare | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# Usage: db-update-token-symbol.sh token_address new_token_symbol | ||
|
||
. .setup_env | ||
|
||
set -e | ||
|
||
TOKEN_ADDRESS=$1 | ||
SYMBOL=$2 | ||
|
||
echo Setting token $2 symbol to $1 | ||
psql "$DATABASE_URL" -c "UPDATE tokens \ | ||
SET symbol = '$SYMBOL' \ | ||
WHERE address = '$TOKEN_ADDRESS'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
# Checks if db is up and accepting connections. | ||
|
||
. .setup_env | ||
|
||
echo $DATABASE_URL | ||
for i in $(seq 1 5); | ||
do pg_isready -d "$DATABASE_URL" && s=0 && break || s=$? && sleep 5; | ||
done; | ||
exit $s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
. .setup_env | ||
|
||
set -e | ||
|
||
cargo run --bin zksync_server --release -- --genesis | tee genesis.log | ||
|
||
GENESIS_ROOT_NEW_VALUE=`grep GENESIS_ROOT genesis.log` | ||
|
||
export LABEL=$ZKSYNC_ENV-Genesis_gen-`date +%Y-%m-%d-%H%M%S` | ||
mkdir -p logs/$LABEL/ | ||
cp ./$ENV_FILE logs/$LABEL/$ZKSYNC_ENV.bak | ||
cp genesis.log logs/$LABEL/ | ||
echo $GENESIS_ROOT_NEW_VALUE | ||
python3 bin/replace-env-variable.py ./$ENV_FILE $GENESIS_ROOT_NEW_VALUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.