Copy artifact files if contracts are already deployed

This commit is contained in:
Adw8 2024-09-03 16:06:59 +05:30
parent 66172a91d5
commit e211814549
4 changed files with 60 additions and 15 deletions

View File

@ -11,30 +11,33 @@ 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
```bash
# Chain ID of the L1 chain
# L1 Chain ID
CERC_L1_CHAIN_ID=
# L1 RPC endpoint
CERC_L1_RPC=
# Amount to send the proposer on L2 (default: 0.2 ether)
CERC_L2_PROPOSER_AMOUNT=
# Amount to send the batcher on L2 (default: 0.1 ether)
CERC_L2_BATCHER_AMOUNT=
# L1 RPC endpoint host or IP address
CERC_L1_HOST=
# L1 RPC endpoint port number
CERC_L1_PORT=
# L1 Beacon endpoint
CERC_L1_BEACON=
# Address of the funded account on L1
# Used for optimism contracts deployment
CERC_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=
```
- To setup and run L2, execute the `run-optimism.yml` Ansible playbook by running the following command.
@ -50,3 +53,13 @@ The following commands have to be executed in [`l2-setup`](./) directory
```bash
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER
```
- To run using existing contracts deployment
- Update the [`vars.yml`](./vars.yml) with paths to required artifacts
- Run the ansible playbook with `"existing_l1_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
```

View File

@ -20,6 +20,7 @@
group: "{{ansible_user}}"
state: directory
recurse: yes
become: yes
- name: Clone fixturenet-optimism-stack
command: laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-optimism-stack --pull
@ -38,25 +39,48 @@
- name: Copy over spec file for L2 deployment
template:
src: "./templates/specs/l2-spec.yml.j2"
dest: "{{ l2_directory }}/fixturenet-optimism-spec.yml"
dest: "{{ l2_directory }}/optimism-spec.yml"
- name: Check if the deployment directory exists for L2
stat:
path: "{{ l2_directory }}/fixturenet-optimism-deployment"
path: "{{ l2_directory }}/optimism-deployment"
register: l2_deployment_dir
- name: Create a deployment from the spec file for L2
command: laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy create --spec-file fixturenet-optimism-spec.yml --deployment-dir fixturenet-optimism-deployment
command: laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy create --spec-file optimism-spec.yml --deployment-dir optimism-deployment
args:
chdir: "{{ l2_directory }}"
when: not l2_deployment_dir.stat.exists
- name: Copy config.env for L2 deployment
- name: Generate config.env for L2 deployment
template:
src: "./templates/configs/l2-config.env"
dest: "{{ l2_directory }}/fixturenet-optimism-deployment/config.env"
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 }}"
dest: "{{ l2_directory }}/optimism-deployment/data/l1_deployment"
- name: Copy l2 configuration file
copy:
src: "{{ l2_config_file }}"
dest: "{{ l2_directory }}/optimism-deployment/data/l2_config"
- name: Copy allocs-l2 file
copy:
src: "{{ allocs_l2_file }}"
dest: "{{ l2_directory }}/optimism-deployment/data/l2_config"
- name: Copy l2 jwt file
copy:
src: "{{ l2_jwt_file }}"
dest: "{{ l2_directory }}/optimism-deployment/data/l2_config"
when: existing_l1_deployment
- name: Start L2-deployment
command: laconic-so deployment --dir fixturenet-optimism-deployment start
command: laconic-so deployment --dir optimism-deployment start
args:
chdir: "{{ l2_directory }}"

View File

@ -1,9 +1,10 @@
CERC_ALLOW_UNPROTECTED_TXS=true
CERC_L1_CHAIN_ID=
CERC_L1_RPC=
CERC_L2_PROPOSER_AMOUNT=
CERC_L2_BATCHER_AMOUNT=
CERC_L1_BEACON=
CERC_L1_HOST=
CERC_L1_PORT=
CERC_L1_ADDRESS=
CERC_L1_PRIV_KEY=
CERC_L2_PROPOSER_AMOUNT=
CERC_L2_BATCHER_AMOUNT=

7
l2-setup/vars.yml Normal file
View File

@ -0,0 +1,7 @@
skip_container_build: false
l2_directory: 'out'
existing_l1_deployment: false
contract_addresses: ""
l2_config_file: ""
allocs_l2_file: ""
l2_jwt_file: ""