diff --git a/.gitignore b/.gitignore index bf19fc6..5a08ef8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ nitro-nodes-setup/out/ nitro-nodes-setup/nitro-vars.yml +l2-setup/out diff --git a/l2-setup/README.md b/l2-setup/README.md index e0eb709..069ed69 100644 --- a/l2-setup/README.md +++ b/l2-setup/README.md @@ -8,36 +8,30 @@ To get started, follow the [installation](../README.md#installation) guide to se The following commands have to be executed in [`l2-setup`](./) directory -- Edit [`l2-config.env`](./templates/configs/l2-config.env) and fill in the following values +- Edit [`l2-vars.yml`](./l2-vars.yml) with the required values ```bash - # L1 Chain ID - CERC_L1_CHAIN_ID= + # L1 chain ID + l1_chain_id: "" # L1 RPC endpoint - CERC_L1_RPC= + l1_rpc: "" # L1 RPC endpoint host or IP address - CERC_L1_HOST= + l1_host: "" # L1 RPC endpoint port number - CERC_L1_PORT= + l1_port: "" # L1 Beacon endpoint - CERC_L1_BEACON= + l1_beacon: "" # Address of the funded account on L1 # Used for optimism contracts deployment - CERC_L1_ADDRESS= + l1_address: "" # Private key of the funded account on L1 - CERC_L1_PRIV_KEY= - - # Funding amount for Optimism Proposer account on L1 (default: 0.2 ether) - CERC_PROPOSER_AMOUNT= - - # Amount to send the batcher on L2 (default: 0.1 ether) - CERC_BATCHER_AMOUNT= + l1_priv_key: "" ``` - To setup and run L2, execute the `run-optimism.yml` Ansible playbook by running the following command. @@ -56,10 +50,10 @@ The following commands have to be executed in [`l2-setup`](./) directory - To run using existing contracts deployment - - Update the [`vars.yml`](./vars.yml) with paths to required artifacts + - Update `artifact_path` in [`setup-vars.yml`](./setup-vars.yml) file with path to data directory of the existing deployment - - Run the ansible playbook with `"existing_l1_deployment": true` in the `--extra-vars` parameter: + - Run the ansible playbook with `"existing_contracts_deployment": true` in the `--extra-vars` parameter: ```bash - LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{"target_host" : "localhost", "existing_l1_deployment": true}' -kK --user $USER + LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{"target_host" : "localhost", "existing_contracts_deployment": true}' -kK --user $USER ``` diff --git a/l2-setup/l2-vars.yml b/l2-setup/l2-vars.yml new file mode 100644 index 0000000..e76811e --- /dev/null +++ b/l2-setup/l2-vars.yml @@ -0,0 +1,9 @@ +l1_chain_id: "" +l1_rpc: "" +l1_host: "" +l1_port: "" +l1_beacon: "" +l1_address: "" +l1_priv_key: "" +proposer_amount: "0.2 ether" +batcher_amount: "0.1 ether" diff --git a/l2-setup/run-optimism.yml b/l2-setup/run-optimism.yml index f700173..86f6186 100644 --- a/l2-setup/run-optimism.yml +++ b/l2-setup/run-optimism.yml @@ -2,7 +2,8 @@ hosts: "{{ target_host }}" vars_files: - - vars.yml + - setup-vars.yml + - l2-vars.yml environment: PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin" @@ -54,31 +55,32 @@ - name: Generate config.env for L2 deployment template: - src: "./templates/configs/l2-config.env" + src: "./templates/configs/l2-config.env.j2" dest: "{{ l2_directory }}/optimism-deployment/config.env" - name: Copy deployed contract addresses and configuration files block: - name: Copy l1 deployment file copy: - src: "{{ contract_addresses }}" + src: "{{ artifact_path }}/l1_deployment/{{ l1_chain_id }}-deploy.json" dest: "{{ l2_directory }}/optimism-deployment/data/l1_deployment" - name: Copy l2 configuration file copy: - src: "{{ l2_config_file }}" + src: "{{ artifact_path }}/l2_config/{{ l1_chain_id }}.json" dest: "{{ l2_directory }}/optimism-deployment/data/l2_config" - name: Copy allocs-l2 file copy: - src: "{{ allocs_l2_file }}" + src: "{{ artifact_path }}/l2_config/allocs-l2.json" dest: "{{ l2_directory }}/optimism-deployment/data/l2_config" - name: Copy l2 jwt file copy: - src: "{{ l2_jwt_file }}" + src: "{{ artifact_path }}/l2_config/l2-jwt.txt" dest: "{{ l2_directory }}/optimism-deployment/data/l2_config" - when: existing_l1_deployment + + when: existing_contracts_deployment - name: Start L2-deployment command: laconic-so deployment --dir optimism-deployment start diff --git a/l2-setup/setup-vars.yml b/l2-setup/setup-vars.yml new file mode 100644 index 0000000..ea03344 --- /dev/null +++ b/l2-setup/setup-vars.yml @@ -0,0 +1,4 @@ +skip_container_build: false +l2_directory: "./out" +existing_contracts_deployment: false +artifact_path: "" diff --git a/l2-setup/templates/configs/l2-config.env b/l2-setup/templates/configs/l2-config.env deleted file mode 100644 index dc5be92..0000000 --- a/l2-setup/templates/configs/l2-config.env +++ /dev/null @@ -1,10 +0,0 @@ -CERC_ALLOW_UNPROTECTED_TXS=true -CERC_L1_CHAIN_ID= -CERC_L1_RPC= -CERC_L1_BEACON= -CERC_L1_HOST= -CERC_L1_PORT= -CERC_L1_ADDRESS= -CERC_L1_PRIV_KEY= -CERC_L2_PROPOSER_AMOUNT= -CERC_L2_BATCHER_AMOUNT= diff --git a/l2-setup/templates/configs/l2-config.env.j2 b/l2-setup/templates/configs/l2-config.env.j2 new file mode 100644 index 0000000..11fdfaf --- /dev/null +++ b/l2-setup/templates/configs/l2-config.env.j2 @@ -0,0 +1,9 @@ +CERC_L1_CHAIN_ID={{ l1_chain_id }} +CERC_L1_RPC={{ l1_rpc }} +CERC_L1_HOST={{ l1_host }} +CERC_L1_PORT={{ l1_port }} +CERC_L1_BEACON={{ l1_beacon }} +CERC_L1_ADDRESS={{ l1_address }} +CERC_L1_PRIV_KEY={{ l1_priv_key }} +CERC_PROPOSER_AMOUNT={{ proposer_amount }} +CERC_BATCHER_AMOUNT={{ batcher_amount }} diff --git a/l2-setup/vars.yml b/l2-setup/vars.yml deleted file mode 100644 index c40cd92..0000000 --- a/l2-setup/vars.yml +++ /dev/null @@ -1,7 +0,0 @@ -skip_container_build: false -l2_directory: 'out' -existing_l1_deployment: false -contract_addresses: "" -l2_config_file: "" -allocs_l2_file: "" -l2_jwt_file: ""