diff --git a/.github/scripts/monitor-verified-batches.sh b/.github/scripts/monitor-cdk-chain.sh similarity index 100% rename from .github/scripts/monitor-verified-batches.sh rename to .github/scripts/monitor-cdk-chain.sh index 29c315857..094e6f062 100755 --- a/.github/scripts/monitor-verified-batches.sh +++ b/.github/scripts/monitor-cdk-chain.sh @@ -68,9 +68,9 @@ echo # Calculate the end time based on the current time and the specified timeout. start_time=$(date +%s) end_time=$((start_time + timeout)) -gas_price_factor=1 # Main loop to monitor batch verification. +gas_price_factor=1 while true; do # Check if there are any stopped services. stopped_services="$(kurtosis enclave inspect "$enclave" | grep STOPPED)" diff --git a/.github/scripts/monitor-op-rollup.sh b/.github/scripts/monitor-op-rollup.sh new file mode 100755 index 000000000..7cd5b348a --- /dev/null +++ b/.github/scripts/monitor-op-rollup.sh @@ -0,0 +1,113 @@ +#!/bin/bash + +# This script monitors the finality of OP rollup blocks. +# TODO: Once we migrate the OP rollup into a type 1 zkEVM rollup, we'll be able to monitor the +# verification of those blocks. + +# Function to display usage information. +usage() { + echo "Usage: $0 --enclave --rpc-url --target --timeout " + echo " --enclave: The name of the Kurtosis enclave." + echo " --cl-rpc-url: The consensus layer RPC URL to query." + echo " --target: The target number of finalized blocks." + echo " --timeout: The script timeout in seconds." + exit 1 +} + +# Initialize variables. +enclave="" +cl_rpc_url="" +target="50" +timeout="900" # 15 minutes. + +# Parse command line arguments +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + --enclave) + enclave="$2" + shift 2 + ;; + --cl-rpc-url) + cl_rpc_url="$2" + shift 2 + ;; + --target) + target="$2" + shift 2 + ;; + --timeout) + timeout="$2" + shift 2 + ;; + *) + echo "Error: unknown argument: $key" + usage + ;; + esac +done + +# Check if the required argument is provided. +if [ -z "$enclave" ]; then + echo "Error: enclave name is required." + usage +fi + +if [ -z "$cl_rpc_url" ]; then + echo "Error: cl rpc url is required." + usage +fi + +# Print script parameters for debug purposes. +echo "Running script with values:" +echo "- Enclave: $enclave" +echo "- CL RPC URL: $cl_rpc_url" +echo "- Target: $target" +echo "- Timeout: $timeout" +echo + +# Calculate the end time based on the current time and the specified timeout. +start_time=$(date +%s) +end_time=$((start_time + timeout)) + +# Main loop to monitor block finalization. +while true; do + # Check if there are any stopped services. + stopped_services="$(kurtosis enclave inspect "$enclave" | grep STOPPED)" + if [[ -n "$stopped_services" ]]; then + echo "It looks like there is at least one stopped service in the enclave... Something must have halted..." + echo "$stopped_services" + echo + + kurtosis enclave inspect "$enclave" --full-uuids | grep STOPPED | awk '{print $2 "--" $1}' | + while read -r container; do + echo "Printing logs for $container" + docker logs --tail 50 "$container" + done + exit 1 + fi + + # Query the number of finalized blocks from the CL RPC URL. + op_rollup_sync_status="$(cast rpc --rpc-url "$cl_rpc_url" optimism_syncStatus)" + unsafe_l2_block_number="$(jq '.unsafe_l2.number' <<<"$op_rollup_sync_status")" + safe_l2_block_number="$(jq '.safe_l2.number' <<<"$op_rollup_sync_status")" + finalized_l2_block_number="$(jq '.finalized_l2.number' <<<"$op_rollup_sync_status")" + echo "[$(date '+%Y-%m-%d %H:%M:%S')] Unsafe: $unsafe_l2_block_number, Safe: $safe_l2_block_number, Finalized: $finalized_l2_block_number" + + # Check if the finalized block target has been reached. + if ((finalized_l2_block_number > target)); then + echo "[$(date '+%Y-%m-%d %H:%M:%S')] ✅ Exiting... More than $target L2 blocks were finalized!" + exit 0 + fi + + # Check if the timeout has been reached. + current_time=$(date +%s) + if ((current_time > end_time)); then + echo "[$(date '+%Y-%m-%d %H:%M:%S')] ❌ Exiting... Timeout reached!" + exit 1 + fi + + echo "Waiting a few seconds before the next iteration..." + echo + sleep 10 +done diff --git a/.github/tests/op-rollup/custom.yml b/.github/tests/op-rollup/custom.yml new file mode 100644 index 000000000..9b56a7d01 --- /dev/null +++ b/.github/tests/op-rollup/custom.yml @@ -0,0 +1,14 @@ +deployment_stages: + deploy_optimism_rollup: true + +optimism_package: + chains: + - participants: + - el_type: op-geth + cl_type: op-node + - el_type: op-reth + - el_type: op-erigon + - el_type: op-nethermind + +args: + verbosity: debug diff --git a/.github/tests/op-rollup/default.yml b/.github/tests/op-rollup/default.yml new file mode 100644 index 000000000..9b80b1543 --- /dev/null +++ b/.github/tests/op-rollup/default.yml @@ -0,0 +1,5 @@ +deployment_stages: + deploy_optimism_rollup: true + +args: + verbosity: debug diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 826688d8c..a62934cb6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -48,10 +48,10 @@ jobs: postgres_port=$(kurtosis port print ${{ env.ENCLAVE_NAME }} postgres-001 postgres | cut -d':' -f3) PGPASSWORD=master_password psql --host 127.0.0.1 --port "$postgres_port" --username master_user --dbname master --list - - name: Monitor verified batches (CDK Erigon Permissionless RPC) + - name: Monitor CDK chain verified batches (CDK Erigon Permissionless RPC) working-directory: .github/scripts run: | - ./monitor-verified-batches.sh \ + ./monitor-cdk-chain.sh \ --enclave ${{ env.ENCLAVE_NAME }} \ --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-rpc-001 rpc) @@ -86,6 +86,7 @@ jobs: ./.github/tests/gas-token/auto.yml \ ./.github/tests/static-ports/custom-static-ports.yml \ ./.github/tests/static-ports/default-static-ports.yml \ + ./.github/tests/op-rollup/*.yml \ | grep -v 'additional-services.yml') matrix=$(echo "$files" | jq -R -s -c 'split("\n")[:-1]') echo "matrix=$matrix" >> $GITHUB_OUTPUT @@ -125,7 +126,7 @@ jobs: - name: Inspect enclave run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }} - + - name: Verify static ports run: | if [[ ${{ matrix.file_name }} == "./.github/tests/static-ports/default-static-ports.yml" ]]; then @@ -141,10 +142,10 @@ jobs: exit 1 fi else - echo "Skipping." + echo "Skipping." fi - - name: Monitor verified batches (Central RPC) + - name: Monitor CDK chain verified batches (Central RPC) run: | sequencer_type=$(yq --raw-output '.args.sequencer_type' ${{ matrix.file_name }}) rpc_name="" @@ -159,21 +160,32 @@ jobs: exit 1 fi echo "RPC name: $rpc_name" - ./.github/scripts/monitor-verified-batches.sh \ + ./.github/scripts/monitor-cdk-chain.sh \ --enclave ${{ env.ENCLAVE_NAME }} \ --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} $rpc_name rpc) - - name: Monitor verified batches (zkEVM Permissionless RPC) + - name: Monitor CDK chain verified batches (zkEVM Permissionless RPC) run: | result=$(yq --raw-output '.args.additional_services // [] | contains(["pless_zkevm_node"])' ${{ matrix.file_name }}) if [[ "$result" == "true" ]]; then - ./.github/scripts/monitor-verified-batches.sh \ + ./.github/scripts/monitor-cdk-chain.sh \ --enclave ${{ env.ENCLAVE_NAME }} \ --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-001 rpc) else echo "Skipping batch verification as there is no zkevm permissionless RPC in the environment" fi + - name: Monitor OP rollup finalized blocks (OP CL RPC) + run: | + result=$(yq --raw-output '.deployment_stages.deploy_optimism_rollup' ${{ matrix.file_name }}) + if [[ "$result" == "true" ]]; then + ./.github/scripts/monitor-op-rollup.sh \ + --enclave ${{ env.ENCLAVE_NAME }} \ + --cl-rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} op-cl-1-op-node-op-geth-op-kurtosis http) + else + echo "Skipping block verification as there is no OP rollup in the environment" + fi + - name: Dump enclave if: ${{ !cancelled() }} run: kurtosis enclave dump ${{ env.ENCLAVE_NAME }} ./dump @@ -216,7 +228,7 @@ jobs: - name: Deploy L1 chain run: kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --args-file=./.github/tests/external-l1/deploy-local-l1.yml . - + - name: Deploy gas token on L1 run: | zkevm_contracts_version="v8.0.0-rc.4-fork.12" @@ -254,10 +266,10 @@ jobs: - name: Inspect enclave run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }} - - name: Monitor verified batches + - name: Monitor CDK chain verified batches (CDK Erigon Permissionless RPC) working-directory: .github/scripts run: | - ./monitor-verified-batches.sh \ + ./monitor-cdk-chain.sh \ --enclave ${{ env.ENCLAVE_NAME }} \ --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-rpc-001 rpc)" @@ -299,10 +311,10 @@ jobs: - name: Inspect enclave run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }} - - name: Monitor verified batches (CDK Erigon Permissionless RPC) + - name: Monitor CDK chain verified batches (CDK Erigon Permissionless RPC) working-directory: .github/scripts run: | - ./monitor-verified-batches.sh \ + ./monitor-cdk-chain.sh \ --enclave ${{ env.ENCLAVE_NAME }} \ --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-rpc-001 rpc) @@ -419,17 +431,17 @@ jobs: - name: Inspect enclave run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }} - - name: Monitor verified batches of the first L2 chain (CDK Erigon Permissionless RPC) + - name: Monitor CDK chain 1 verified batches (CDK Erigon Permissionless RPC) working-directory: .github/scripts run: | - ./monitor-verified-batches.sh \ + ./monitor-cdk-chain.sh \ --enclave ${{ env.ENCLAVE_NAME }} \ --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-rpc-001 rpc)" - - name: Monitor verified batches of the second L2 chain (CDK Erigon Permissionless RPC) + - name: Monitor CDK chain 2 verified batches (CDK Erigon Permissionless RPC) working-directory: .github/scripts run: | - ./monitor-verified-batches.sh \ + ./monitor-cdk-chain.sh \ --enclave ${{ env.ENCLAVE_NAME }} \ --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-rpc-002 rpc)" @@ -475,10 +487,10 @@ jobs: - name: Inspect enclave run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }} - - name: Monitor verified batches + - name: Monitor CDK chain verified batches (CDK Erigon Permissionless RPC) working-directory: .github/scripts run: | - ./monitor-verified-batches.sh \ + ./monitor-cdk-chain.sh \ --enclave ${{ env.ENCLAVE_NAME }} \ --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-rpc-001 rpc)" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b5bf5e211..4b47b2cfc 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -49,10 +49,10 @@ jobs: - name: Inspect enclave run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }} - - name: Monitor verified batches (zkEVM Node Permissionless RPC) + - name: Monitor CDK chain verified batches (zkEVM Node Permissionless RPC) working-directory: .github/scripts run: | - ./monitor-verified-batches.sh \ + ./monitor-cdk-chain.sh \ --enclave ${{ env.ENCLAVE_NAME }} \ --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-001 rpc)" @@ -104,7 +104,7 @@ jobs: # - name: Monitor verified batches (CDK Erigon Permissionless RPC) # working-directory: .github/scripts - # run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-rpc-001 rpc)" + # run: ./monitor-cdk-chain.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-rpc-001 rpc)" # Deploy the CDK environment incrementally, stage by stage. # TODO: Fix this job. @@ -194,4 +194,4 @@ jobs: # - name: Monitor verified batches (CDK Erigon Permissionless RPC) # working-directory: .github/scripts - # run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-rpc-001 rpc)" + # run: ./monitor-cdk-chain.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-rpc-001 rpc)" diff --git a/input_parser.star b/input_parser.star index eb61a93cf..317e84847 100644 --- a/input_parser.star +++ b/input_parser.star @@ -26,6 +26,8 @@ DEFAULT_DEPLOYMENT_STAGES = { # Deploy cdk-erigon node. # TODO: Remove this parameter to incorporate cdk-erigon inside the central environment. "deploy_cdk_erigon_node": True, + # Deploy Optimism rollup. + "deploy_optimism_rollup": False, # Deploy contracts on L2 (as well as fund accounts). "deploy_l2_contracts": False, } @@ -156,6 +158,8 @@ DEFAULT_L1_ARGS = { "l1_rpc_url": "http://el-1-geth-lighthouse:8545", # The L1 WS RPC endpoint. "l1_ws_url": "ws://el-1-geth-lighthouse:8546", + # The L1 concensus layer RPC endpoint. + "l1_beacon_url": "http://cl-1-lighthouse-geth:4000", # The additional services to spin up. # Default: [] # Options: @@ -195,10 +199,6 @@ DEFAULT_L1_ARGS = { "l1_funding_amount": "1000000ether", # Default: 2 "l1_participants_count": 1, - # Whether to deploy https://github.com/Arachnid/deterministic-deployment-proxy. - # Not deploying this will may cause errors or short circuit other contract - # deployments. - "l1_deploy_deterministic_deployment_proxy": True, # Whether to deploy https://github.com/AggLayer/lxly-bridge-and-call "l1_deploy_lxly_bridge_and_call": True, # Set this to true if the L1 contracts for the rollup are already @@ -268,6 +268,38 @@ DEFAULT_ROLLUP_ARGS = { "zkevm_path_rw_data": "/tmp/", } +# https://github.com/ethpandaops/optimism-package +DEFAULT_OP_STACK_ARGS = { + "chains": [ + { + "participants": [ + { + "el_type": "op-geth", + # https://github.com/ethereum-optimism/op-geth/releases/tag/v1.101411.3 + "el_image": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101411.3", + "cl_type": "op-node", + # https://github.com/ethereum-optimism/optimism/releases/tag/v1.9.5 + "cl_image": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:v1.9.5", + "count": 2, # one is a sequencer node and the other an rpc + }, + ], + "batcher_params": { + "image": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-batcher:v1.9.5", + }, + # The OP package does not run the op-proposer for now. + # https://github.com/ethpandaops/optimism-package/blob/0d60a9d3997f83ecee6f7f6695027f819d776309/src/participant_network.star#L87 + # "proposer_params": { + # "image": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-proposer:v1.9.5", + # }, + }, + ], + "op_contract_deployer_params": { + "image": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-deployer:v0.0.7", + "l1_artifacts_locator": "https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-9af7366a7102f51e8dbe451dcfa22971131d89e218915c91f420a164cc48be65.tar.gz", + "l2_artifacts_locator": "https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-9af7366a7102f51e8dbe451dcfa22971131d89e218915c91f420a164cc48be65.tar.gz", + }, +} + DEFAULT_PLESS_ZKEVM_NODE_ARGS = { "trusted_sequencer_node_uri": "zkevm-node-sequencer-001:6900", "zkevm_aggregator_host": "zkevm-node-aggregator-001", @@ -327,6 +359,7 @@ SUPPORTED_FORK_IDS = [9, 11, 12, 13] def parse_args(plan, args): # Merge the provided args with defaults. deployment_stages = DEFAULT_DEPLOYMENT_STAGES | args.get("deployment_stages", {}) + op_stack_args = args.get("optimism_package", {}) args = DEFAULT_ARGS | args.get("args", {}) # Validation step. @@ -364,10 +397,8 @@ def parse_args(plan, args): plan.print("Using static ports.") args = DEFAULT_STATIC_PORTS | args - # Remove deployment stages from the args struct. - # This prevents updating already deployed services when updating the deployment stages. - if "deployment_stages" in args: - args.pop("deployment_stages") + # Determine OP stack args. + op_stack_args = get_op_stack_args(plan, args, op_stack_args) # When using assertoor to test L1 scenarios, l1_preset should be mainnet for deposits and withdrawls to work. if "assertoor" in args["l1_additional_services"]: @@ -377,6 +408,11 @@ def parse_args(plan, args): args["l1_preset"] = "mainnet" args["l1_participant_count"] = 2 + # Remove deployment stages from the args struct. + # This prevents updating already deployed services when updating the deployment stages. + if "deployment_stages" in args: + args.pop("deployment_stages") + args = args | { "l2_rpc_name": l2_rpc_name, "sequencer_name": sequencer_name, @@ -390,7 +426,8 @@ def parse_args(plan, args): # Sort dictionaries for debug purposes. sorted_deployment_stages = dict.sort_dict_by_values(deployment_stages) sorted_args = dict.sort_dict_by_values(args) - return (sorted_deployment_stages, sorted_args) + sorted_op_stack_args = dict.sort_dict_by_values(op_stack_args) + return (sorted_deployment_stages, sorted_args, sorted_op_stack_args) def validate_log_level(name, log_level): @@ -472,3 +509,35 @@ def get_l2_rpc_name(deploy_cdk_erigon_node): return "cdk-erigon-rpc" else: return "zkevm-node-rpc" + + +def get_op_stack_args(plan, args, op_stack_args): + if not op_stack_args: + op_stack_args = DEFAULT_OP_STACK_ARGS + + l1_chain_id = str(args.get("l1_chain_id", "")) + l1_rpc_url = args.get("l1_rpc_url", "") + l1_ws_url = args.get("l1_ws_url", "") + l1_beacon_url = args.get("l1_beacon_url", "") + + l1_preallocated_mnemonic = args.get("l1_preallocated_mnemonic", "") + private_key_result = plan.run_sh( + description="Derive private key from mnemonic", + run="cast wallet private-key --mnemonic \"{}\" | tr -d '\n'".format( + l1_preallocated_mnemonic + ), + image=constants.TOOLBOX_IMAGE, + ) + private_key = private_key_result.output + + return { + "optimism_package": op_stack_args, + "external_l1_network_params": { + "network_id": l1_chain_id, + "rpc_kind": "standard", + "el_rpc_url": l1_rpc_url, + "el_ws_url": l1_ws_url, + "cl_rpc_url": l1_beacon_url, + "priv_key": private_key, + }, + } diff --git a/main.star b/main.star index 23869c53c..a5f0de868 100644 --- a/main.star +++ b/main.star @@ -10,6 +10,7 @@ cdk_erigon_package = "./cdk_erigon.star" databases_package = "./databases.star" deploy_zkevm_contracts_package = "./deploy_zkevm_contracts.star" ethereum_package = "./ethereum.star" +optimism_package = "github.com/ethpandaops/optimism-package/main.star@1.2.0" zkevm_pool_manager_package = "./zkevm_pool_manager.star" deploy_l2_contracts_package = "./deploy_l2_contracts.star" @@ -28,7 +29,7 @@ assertoor_package = "./src/additional_services/assertoor.star" def run(plan, args={}): # Parse args. - (deployment_stages, args) = input_parser.parse_args(plan, args) + (deployment_stages, args, op_stack_args) = input_parser.parse_args(plan, args) plan.print("Deploying the following components: " + str(deployment_stages)) verbosity = args.get("verbosity", "") if verbosity == constants.LOG_LEVEL.debug or verbosity == constants.LOG_LEVEL.trace: @@ -146,6 +147,13 @@ def run(plan, args={}): else: plan.print("Skipping the deployment of contracts on L2") + # Deploy an OP Stack rollup. + if deployment_stages.get("deploy_optimism_rollup", False): + plan.print("Deploying an OP Stack rollup with args: " + str(op_stack_args)) + import_module(optimism_package).run(plan, op_stack_args) + else: + plan.print("Skipping the deployment of an Optimism rollup") + # Launching additional services. additional_services = args["additional_services"] @@ -215,7 +223,7 @@ def deploy_helper_service(plan, args): plan.add_service( name=helper_service_name, config=ServiceConfig( - image=constants.TX_SPAMMER_IMG, + image=constants.TOOLBOX_IMAGE, files={"/opt/zkevm": get_rollup_info_artifact}, # These two lines are only necessary to deploy to any Kubernetes environment (e.g. GKE). entrypoint=["bash", "-c"], diff --git a/src/additional_services/tx_spammer.star b/src/additional_services/tx_spammer.star index 077be147c..ca42b5b94 100644 --- a/src/additional_services/tx_spammer.star +++ b/src/additional_services/tx_spammer.star @@ -8,7 +8,7 @@ def run(plan, args, contract_setup_addresses): plan.add_service( name="tx-spammer" + args["deployment_suffix"], config=ServiceConfig( - image=constants.TX_SPAMMER_IMG, + image=constants.TOOLBOX_IMAGE, files={ "/opt/scripts": Directory(artifact_names=[tx_spammer_config_artifacts]), }, diff --git a/src/package_io/constants.star b/src/package_io/constants.star index fc5e015f9..27e6ec03e 100644 --- a/src/package_io/constants.star +++ b/src/package_io/constants.star @@ -11,4 +11,4 @@ SEQUENCER_TYPE = struct( ZKEVM="zkevm", ) -TX_SPAMMER_IMG = "leovct/toolbox:0.0.7" +TOOLBOX_IMAGE = "leovct/toolbox:0.0.7" diff --git a/templates/contract-deploy/run-contract-setup.sh b/templates/contract-deploy/run-contract-setup.sh index 63fdec691..5b316731b 100755 --- a/templates/contract-deploy/run-contract-setup.sh +++ b/templates/contract-deploy/run-contract-setup.sh @@ -308,6 +308,25 @@ cast send \ "$(jq -r '.polygonDataCommitteeAddress' combined.json)" # {{end}} +# Deploy deterministic proxy. +# https://github.com/Arachnid/deterministic-deployment-prox +# You can find the `signer_address`, `transaction` and `deployer_address` by looking at the README. +echo_ts "Deploying deterministic deployment proxy" +signer_address="0x3fab184622dc19b6109349b94811493bf2a45362" +transaction="0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222" +deployer_address="0x4e59b44847b379578588920ca78fbf26c0b4956c" +cast send \ + --rpc-url "{{.l1_rpc_url}}" \ + --mnemonic "{{.l1_preallocated_mnemonic}}" \ + --value "0.01ether" \ + "$signer_address" +cast publish --rpc-url "{{.l1_rpc_url}}" "$transaction" +if [[ $(cast code --rpc-url "{{.l1_rpc_url}}" $deployer_address) == "0x" ]]; then + echo_ts "No code at deployer address: $deployer_address" + exit 1 +fi + + # If we've configured the l1 network with the minimal preset, we # should probably wait for the first finalized block. This isn't # strictly specific to minimal preset, but if we don't have "minimal" @@ -315,7 +334,7 @@ cast send \ # finalized block l1_preset="{{.l1_preset}}" if [[ $l1_preset == "minimal" ]]; then - wait_for_finalized_block; + wait_for_finalized_block fi # The contract setup is done! diff --git a/templates/contract-deploy/run-l2-contract-setup.sh b/templates/contract-deploy/run-l2-contract-setup.sh index 69108a39e..7c429897c 100644 --- a/templates/contract-deploy/run-l2-contract-setup.sh +++ b/templates/contract-deploy/run-l2-contract-setup.sh @@ -89,23 +89,6 @@ if [[ -z "$l1_private_key" ]]; then l1_private_key=$(cast wallet private-key "{{.l1_preallocated_mnemonic}}") fi -# shellcheck disable=SC2078 -if [[ "{{.l1_deploy_deterministic_deployment_proxy}}" ]]; then - echo_ts "Deploying deterministic deployment proxy on l1" - cast send \ - --rpc-url "{{.l1_rpc_url}}" \ - --private-key "$l1_private_key" \ - --value "$gas_cost" \ - "$signer_address" - cast publish --rpc-url "{{.l1_rpc_url}}" "$transaction" - if [[ $(cast code --rpc-url "{{.l1_rpc_url}}" $deployer_address) == "0x" ]]; then - echo_ts "No code at expected l1 address: $deployer_address" - exit 1; - fi -else - echo_ts "Skipping deployment of deterministic deployment proxy on l1" -fi - # shellcheck disable=SC2078 if [[ "{{.l2_deploy_deterministic_deployment_proxy}}" ]]; then echo_ts "Deploying deterministic deployment proxy on l2"