Add configuration for L1 beacon endpoint and funding amounts for Optimism accounts (#4)
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8) Co-authored-by: Adw8 <adwaitgharpure@gmail.com> Reviewed-on: cerc-io/fixturenet-optimism-stack#4 Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
		
							parent
							
								
									9ca108e877
								
							
						
					
					
						commit
						c5f97dda13
					
				| @ -17,6 +17,8 @@ services: | ||||
|       CERC_L1_ACCOUNTS_CSV_URL: ${CERC_L1_ACCOUNTS_CSV_URL} | ||||
|       CERC_L1_ADDRESS: ${CERC_L1_ADDRESS} | ||||
|       CERC_L1_PRIV_KEY: ${CERC_L1_PRIV_KEY} | ||||
|       CERC_PROPOSER_AMOUNT: ${CERC_PROPOSER_AMOUNT} | ||||
|       CERC_BATCHER_AMOUNT: ${CERC_BATCHER_AMOUNT} | ||||
|     volumes: | ||||
|       - ../config/network/wait-for-it.sh:/app/packages/contracts-bedrock/wait-for-it.sh | ||||
|       - ../config/fixturenet-optimism/optimism-contracts/deploy-contracts.sh:/app/packages/contracts-bedrock/deploy-contracts.sh | ||||
| @ -89,6 +91,7 @@ services: | ||||
|     environment: | ||||
|       CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} | ||||
|       CERC_L1_RPC: ${CERC_L1_RPC} | ||||
|       CERC_L1_BEACON: ${CERC_L1_BEACON} | ||||
|     volumes: | ||||
|       - ../config/fixturenet-optimism/run-op-node.sh:/run-op-node.sh | ||||
|       - l1_deployment:/l1-deployment:ro | ||||
|  | ||||
| @ -10,3 +10,6 @@ DEFAULT_CERC_L1_PORT=8545 | ||||
| # that are used to send balance to Optimism Proxy contract | ||||
| # (enables them to do transactions on L2) | ||||
| DEFAULT_CERC_L1_ACCOUNTS_CSV_URL="http://fixturenet-eth-bootnode-geth:9898/accounts.csv" | ||||
| DEFAULT_CERC_PROPOSER_AMOUNT="0.2ether" | ||||
| DEFAULT_CERC_BATCHER_AMOUNT="0.1ether" | ||||
| DEFAULT_CERC_L1_BEACON=http://fixturenet-eth-lighthouse-1:8001 | ||||
| @ -9,6 +9,9 @@ CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}" | ||||
| 
 | ||||
| CERC_L1_ACCOUNTS_CSV_URL="${CERC_L1_ACCOUNTS_CSV_URL:-${DEFAULT_CERC_L1_ACCOUNTS_CSV_URL}}" | ||||
| 
 | ||||
| CERC_PROPOSER_AMOUNT="${CERC_PROPOSER_AMOUNT:-${DEFAULT_CERC_PROPOSER_AMOUNT}}" | ||||
| CERC_BATCHER_AMOUNT="${CERC_BATCHER_AMOUNT:-${DEFAULT_CERC_BATCHER_AMOUNT}}" | ||||
| 
 | ||||
| export DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID" | ||||
| # Optional create2 salt for deterministic deployment of contract implementations | ||||
| export IMPL_SALT=$(openssl rand -hex 32) | ||||
| @ -16,7 +19,7 @@ export IMPL_SALT=$(openssl rand -hex 32) | ||||
| echo "Using L1 RPC endpoint ${CERC_L1_RPC}" | ||||
| 
 | ||||
| # Exit if a deployment already exists (on restarts) | ||||
| if [ -d "/l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json" ]; then | ||||
| if [ -f "/l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json" ]; then | ||||
|   echo "Deployment directory /l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json, checking OptimismPortal deployment" | ||||
| 
 | ||||
|   OPTIMISM_PORTAL_ADDRESS=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json | jq -r .OptimismPortal) | ||||
| @ -68,9 +71,8 @@ if [ -n "$CERC_L1_ADDRESS" ] && [ -n "$CERC_L1_PRIV_KEY" ]; then | ||||
| 
 | ||||
|   echo "Funding accounts." | ||||
|   wait_for_block 1 300 | ||||
|   cast send --from $ADMIN --rpc-url $CERC_L1_RPC --value 5ether $PROPOSER --private-key $ADMIN_KEY | ||||
|   cast send --from $ADMIN --rpc-url $CERC_L1_RPC --value 10ether $BATCHER --private-key $ADMIN_KEY | ||||
|   cast send --from $ADMIN --rpc-url $CERC_L1_RPC --value 2ether $SEQ --private-key $ADMIN_KEY | ||||
|   cast send --from $ADMIN --rpc-url $CERC_L1_RPC --value $CERC_PROPOSER_AMOUNT $PROPOSER --private-key $ADMIN_KEY | ||||
|   cast send --from $ADMIN --rpc-url $CERC_L1_RPC --value $CERC_BATCHER_AMOUNT $BATCHER --private-key $ADMIN_KEY | ||||
| else | ||||
|   curl -o accounts.csv $CERC_L1_ACCOUNTS_CSV_URL | ||||
|   # Admin | ||||
|  | ||||
| @ -7,6 +7,7 @@ fi | ||||
| CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}" | ||||
| CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}" | ||||
| DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID" | ||||
| CERC_L1_BEACON="${CERC_L1_BEACON:-${DEFAULT_CERC_L1_BEACON}}" | ||||
| 
 | ||||
| deploy_config_file="/l2-config/$DEPLOYMENT_CONTEXT.json" | ||||
| l1_deployment_file="/l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json" | ||||
| @ -34,4 +35,4 @@ op-node \ | ||||
|   --p2p.sequencer.key="${SEQ_KEY#0x}" \ | ||||
|   --l1=$CERC_L1_RPC \ | ||||
|   --l1.rpckind=$RPC_KIND \ | ||||
|   --l1.beacon=http://fixturenet-eth-lighthouse-1:8001 | ||||
|   --l1.beacon=$CERC_L1_BEACON | ||||
|  | ||||
| @ -112,6 +112,15 @@ Inside the `fixturenet-eth-deployment` deployment directory, open `config.env` f | ||||
| CERC_ALLOW_UNPROTECTED_TXS=true | ||||
| ``` | ||||
| 
 | ||||
| Inside the `fixturenet-optimism-deployment` deployment directory, open `config.env` file and set following env variables: | ||||
| 
 | ||||
| ```bash | ||||
| # Optional | ||||
| # Funding amounts for proposer and batcher accounts on L1 | ||||
| CERC_PROPOSER_AMOUNT=  # Default 0.2ether | ||||
| CERC_BATCHER_AMOUNT=   # Default 0.1ether | ||||
| ``` | ||||
| 
 | ||||
| ## Start the stack | ||||
| 
 | ||||
| Start the deployment: | ||||
|  | ||||
| @ -64,6 +64,9 @@ Inside the deployment directory, open the file `config.env` and add the followin | ||||
|   CERC_L1_HOST= | ||||
|   CERC_L1_PORT= | ||||
| 
 | ||||
|   # External L1 Beacon node endpoint | ||||
|   CERC_L1_BEACON= | ||||
| 
 | ||||
|   # URL to get CSV with credentials for accounts on L1 | ||||
|   # that are used to send balance to Optimism Proxy contract | ||||
|   # (enables them to do transactions on L2) | ||||
| @ -74,6 +77,13 @@ Inside the deployment directory, open the file `config.env` and add the followin | ||||
|   # Other generated accounts will be funded from this account, so it should contain ~20 Eth | ||||
|   CERC_L1_ADDRESS= | ||||
|   CERC_L1_PRIV_KEY= | ||||
| 
 | ||||
|   # Optional | ||||
| 
 | ||||
|   # Funding amounts for proposer and batcher accounts on L1 | ||||
|   # (Accounts funded using the Admin account) | ||||
|   CERC_PROPOSER_AMOUNT= | ||||
|   CERC_BATCHER_AMOUNT= | ||||
|   ``` | ||||
| 
 | ||||
| * NOTE: If L1 is running on the host machine, use `host.docker.internal` as the hostname to access the host port, or use the `ip a` command to find the IP address of the `docker0` interface (this will usually be something like `172.17.0.1` or `172.18.0.1`) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user