Override geth startup script to allow unsafe txs

This commit is contained in:
Prathamesh Musale 2024-02-21 12:41:12 +05:30
parent 777f4524de
commit d0d0602e88
3 changed files with 43 additions and 13 deletions

View File

@ -14,7 +14,7 @@ services:
- ../config/postgresql/multiple-postgressql-databases.sh:/docker-entrypoint-initdb.d/multiple-postgressql-databases.sh
- mobymask_watcher_db_data:/var/lib/postgresql/data
ports:
- "127.0.0.1:15432:5432"
- "5432"
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "5432"]
interval: 20s

View File

@ -4,20 +4,27 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
echo "*************************************"
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}"
CERC_L1_ACCOUNTS_CSV_URL="${CERC_L1_ACCOUNTS_CSV_URL:-${DEFAULT_CERC_L1_ACCOUNTS_CSV_URL}}"
# Fixture accounts
WATCHER_1_ACCOUNT=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
WATCHER_1_ACCOUNT=0x70997970C51812dc3A010C7d01b50e0d17dc79C8
WATCHER_1_ACCOUNT=0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65
WATCHER_2_ACCOUNT=0x70997970C51812dc3A010C7d01b50e0d17dc79C8
WATCHER_3_ACCOUNT=0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65
NITRO_APP_ACCOUNT=0xbDA5747bFD65F08deb54cb465eB87D40e51B197E
WATCHER_1_ACCOUNT_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
WATCHER_2_ACCOUNT_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
WATCHER_3_ACCOUNT_KEY=0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a
NITRO_APP_ACCOUNT_KEY=0x689af8efa8c651a91ad287602527f3af2fe9f6501a7ac4b061667b5a93e037fd
# Check if watcher 1 account already funded
L2_RPC="http://op-geth:8545"
WATCHER_1_ACCOUNT_BALANCE=$(cast balance ${WATCHER_1_ACCOUNT} --rpc-url $L2_RPC)
if [ $WATCHER_1_ACCOUNT_BALANCE -gt 0 ]; then
WATCHER_1_ACCOUNT_BALANCE=$(cast balance ${WATCHER_1_ACCOUNT} --rpc-url $CERC_L1_RPC)
echo "WATCHER_1_ACCOUNT_BALANCE ${WATCHER_1_ACCOUNT_BALANCE}"
if [ "$WATCHER_1_ACCOUNT_BALANCE" != "0" ]; then
echo "Watcher account already funded, exiting."
exit 0
fi
@ -39,15 +46,24 @@ DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
BRIDGE=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT/L1StandardBridgeProxy.json | jq -r .address)
# Send balance to bridge contract on L1
cast send --from $ACCOUNT_1 --rpc-url $CERC_L1_RPC --value 10000ether $BRIDGE --private-key $ACCOUNT_1_KEY
cast send --from $ACCOUNT_2 --rpc-url $CERC_L1_RPC --value 10000ether $BRIDGE --private-key $ACCOUNT_2_KEY
cast send --rpc-url $CERC_L1_RPC --value 10000ether $BRIDGE --private-key $ACCOUNT_1_KEY
cast send --rpc-url $CERC_L1_RPC --value 10000ether $BRIDGE --private-key $ACCOUNT_2_KEY
echo "Following accounts have been funded; use them for transactions on L2:"
echo "${ACCOUNT_1}"
echo "${ACCOUNT_2}"
echo "*************************************"
echo "Funding the watcher and app Nitro accounts on L2"
cast send --rpc-url $L2_RPC --value 100ether WATCHER_1_ACCOUNT --private-key $ACCOUNT_1_KEY
cast send --rpc-url $L2_RPC --value 100ether WATCHER_2_ACCOUNT --private-key $ACCOUNT_1_KEY
cast send --rpc-url $L2_RPC --value 100ether WATCHER_3_ACCOUNT --private-key $ACCOUNT_1_KEY
cast send --rpc-url $L2_RPC --value 100ether NITRO_APP_ACCOUNT --private-key $ACCOUNT_1_KEY
cast send --rpc-url $CERC_L1_RPC --value 200ether $WATCHER_1_ACCOUNT --private-key $ACCOUNT_1_KEY
cast send --rpc-url $CERC_L1_RPC --value 200ether $WATCHER_2_ACCOUNT --private-key $ACCOUNT_1_KEY
cast send --rpc-url $CERC_L1_RPC --value 200ether $WATCHER_3_ACCOUNT --private-key $ACCOUNT_1_KEY
cast send --rpc-url $CERC_L1_RPC --value 200ether $NITRO_APP_ACCOUNT --private-key $ACCOUNT_1_KEY
cast send --rpc-url $CERC_L1_RPC --value 100ether $BRIDGE --private-key $WATCHER_1_ACCOUNT_KEY
cast send --rpc-url $CERC_L1_RPC --value 100ether $BRIDGE --private-key $WATCHER_2_ACCOUNT_KEY
cast send --rpc-url $CERC_L1_RPC --value 100ether $BRIDGE --private-key $WATCHER_3_ACCOUNT_KEY
cast send --rpc-url $CERC_L1_RPC --value 100ether $BRIDGE --private-key $NITRO_APP_ACCOUNT_KEY
echo "Done, exiting."

View File

@ -17,6 +17,20 @@ from stack_orchestrator.deploy.deployment_context import DeploymentContext
from ruamel.yaml import YAML
def create(context: DeploymentContext, extra_args):
fixturenet_eth_compose_file = context.deployment_dir.joinpath('compose', 'docker-compose-fixturenet-eth.yml')
with open(fixturenet_eth_compose_file, 'r') as yaml_file:
yaml = YAML()
yaml_data = yaml.load(yaml_file)
new_script = '../config/fixturenet-optimism/run-geth.sh:/opt/testnet/run.sh'
if new_script not in yaml_data['services']['fixturenet-eth-geth-1']['volumes']:
yaml_data['services']['fixturenet-eth-geth-1']['volumes'].append(new_script)
with open(fixturenet_eth_compose_file, 'w') as yaml_file:
yaml = YAML()
yaml.dump(yaml_data, yaml_file)
# load fixturenet-optimism compose file
fixturenet_optimism_compose_file = context.deployment_dir.joinpath('compose', 'docker-compose-fixturenet-optimism.yml')
@ -29,7 +43,7 @@ def create(context: DeploymentContext, extra_args):
yaml_data['services']['fixturenet-optimism-contracts']['volumes'].append(fund_accounts_script)
# update command to run the script
yaml_data['services']['fixturenet-optimism-contracts']['command'] = "./wait-for-it.sh -h ${CERC_L1_HOST:-$${DEFAULT_CERC_L1_HOST}} -p ${CERC_L1_PORT:-$${DEFAULT_CERC_L1_PORT}} -s -t 60 -- ./deploy-contracts.sh && ./fund-accounts-on-l2.sh"
yaml_data['services']['fixturenet-optimism-contracts']['command'] = '"./wait-for-it.sh -h ${CERC_L1_HOST:-$${DEFAULT_CERC_L1_HOST}} -p ${CERC_L1_PORT:-$${DEFAULT_CERC_L1_PORT}} -s -t 60 -- ./deploy-contracts.sh && ./fund-accounts-on-l2.sh"'
with open(fixturenet_optimism_compose_file, 'w') as yaml_file:
yaml = YAML()