Skip to content

Commit

Permalink
refactor: break down stages into starlark packages (#30)
Browse files Browse the repository at this point in the history
* refactor: break down stages into starlark packages

* ci: add job to test both monolith and incremental approaches

* fix: ci

* chore: make cdk_central_env and permissionless_node even

* chore: rename file

* chore: nit

* fix: genesis artifact issue

* ci: fix incremental deployment

* chore: nit

* ci: fix incremental workflow 2

* fix: genesis artifact issue when deploying stage by stage

* chore: nit

* doc: document stages in `params.yml`

* chore: simplify l2 params by moving them into templates

* doc: add docs

* chore: add back rollup consensus into params

* chore: rename `l1_network_id` into `l1_chain_id`

* chore: get rid of l1 funding amount in params.yml

* chore: remove explorer config from params.yml

* refactor: stages implementation with booleans

* chore: lint

* fix: typos

* chore: lint

* feat: move db to its own package

* chore: rename ethereum pkg

* ci: fix incremental workflow

* ci: last fix

* fix: zkevm bridge address

* fix: gas token feature

* doc: document hack
  • Loading branch information
leovct authored Mar 27, 2024
1 parent b00ce0f commit d96aa86
Show file tree
Hide file tree
Showing 15 changed files with 706 additions and 601 deletions.
69 changes: 68 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ concurrency:
cancel-in-progress: true

jobs:
cdk:
# Deploy the CDK environment in one step.
monolithic_cdk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -21,3 +22,69 @@ jobs:
with:
path: .
args: params.yml

# Deploy the CDK environment incrementally, stage by stage.
incremental_cdk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# Install tools.
- name: Install kurtosis
run: |
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install kurtosis-cli
kurtosis analytics disable
- name: Install yq
run: |
sudo add-apt-repository ppa:rmescandon/yq
sudo apt update
sudo apt install --yes yq
# Deploy components.
- name: Disable All Deployment Steps
run: |
yq e '.deploy_l1 = false' --inplace params.yml
yq e '.deploy_zkevm_contracts_on_l1 = false' --inplace params.yml
yq e '.deploy_databases = false' --inplace params.yml
yq e '.deploy_cdk_central_environment = false' --inplace params.yml
yq e '.deploy_cdk_bridge_infra = false' --inplace params.yml
yq e '.deploy_zkevm_permissionless_node = false' --inplace params.yml
- name: Deploy L1
run: |
yq e '.deploy_l1 = true' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq e '.deploy_l1 = false' --inplace params.yml # reset
- name: Deploy ZkEVM Contracts on L1
run: |
yq e '.deploy_zkevm_contracts_on_l1 = true' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq e '.deploy_zkevm_contracts_on_l1 = false' --inplace params.yml # reset
- name: Deploy ZkEVM Node and CDK Peripheral Databases
run: |
yq e '.deploy_databases = true' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq e '.deploy_databases = false' --inplace params.yml # reset
- name: Deploy CDK Central Environment
run: |
yq e '.deploy_cdk_central_environment = true' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq e '.deploy_cdk_central_environment = false' --inplace params.yml # reset
- name: Deploy CDK Bridge Infrastructure
run: |
yq e '.deploy_cdk_bridge_infra = true' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq e '.deploy_cdk_bridge_infra = false' --inplace params.yml # reset
- name: Deploy ZkEVM Permissionless Node
run: |
yq e '.deploy_zkevm_permissionless_node = true' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq e '.deploy_zkevm_permissionless_node = false' --inplace params.yml # reset
53 changes: 37 additions & 16 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -124,43 +124,64 @@ kurtosis run --enclave cdk-v1 --args-file params.yml --main-file zkevm_permissio

** For Developers

Rather than executing the deployment process as a monolithic operation, you can break it down into stages and run each stage separately. The `stages` parameter indicates the specific stages you wish the deployment to proceed through. By default, it will execute all the stages.
Rather than executing the deployment process as a monolithic operation, you can break it down into stages and run each stage separately.

You can enable a stage by setting the boolean value to /true/ and disable it by setting it to /false/. By default, all stages will be executed.

Currently, the deployment process includes the following stages:

1. Deploy L1
2. Configure L1 (which involves funding accounts, deploying CDK contracts, and creating configuration files)
3. Deploy Trusted / Central Environment
4. Deploy Bridge, AggLayer, and DAC
5. Deploy Permissionless Node
1. Deploy Local L1
2. Deploy ZkEVM Contracts on L1
3. Deploy ZkEVM Node and CDK Peripheral Databases
4. Deploy CDK Central/Trusted Environment
5. Deploy CDK/Bridge Infrastructure
6. Deploy Permissioless Node

Here's an example of how you can specify the stages to run through.

#+begin_src bash
# Execute the first stage (deploy L1).
yq e '.stages = [1]' --inplace params.yml
# Disable all deployment steps.
yq e 'deploy_l1 = false' --inplace params.yml
yq e '.deploy_zkevm_contracts_on_l1 = false' --inplace params.yml
yq e '.deploy_databases = false' --inplace params.yml
yq e '.deploy_cdk_central_environment = false' --inplace params.yml
yq e '.deploy_cdk_bridge_infra = false' --inplace params.yml
yq e '.deploy_zkevm_permissionless_node = false' --inplace params.yml

# Deploy L1
yq e '.deploy_l1 = true' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq e '.deploy_l1 = false' --inplace params.yml # reset
# Perform additional tasks...

# Execute the second stage (configure L1).
yq e '.stages = [2]' --inplace params.yml
# Deploy ZkEVM Contracts on L1
yq e '.deploy_zkevm_contracts_on_l1 = true' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq e '.deploy_zkevm_contracts_on_l1 = false' --inplace params.yml # reset
# Perform additional tasks...

# Execute the thirs stage (deploy trusted/central environment).
yq e '.stages = [3]' --inplace params.yml
# Deploy ZkEVM Node and CDK Peripheral Databases
yq e '.deploy_databases = true' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq e '.deploy_databases = false' --inplace params.yml # reset
# Perform additional tasks...

# Execute the fourth stage (deploy bridge/agglayer/dac).
yq e '.stages = [4]' --inplace params.yml
# Deploy CDK Central Environment
yq e '.deploy_cdk_central_environment = true' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq e '.deploy_cdk_central_environment = false' --inplace params.yml # reset
# Perform additional tasks...

# Execute the fifth stage (deploy permissionless node).
yq e '.stages = [5]' --inplace params.yml
# Deploy CDK Bridge Infrastructure
yq e '.deploy_cdk_bridge_infra = true' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq e '.deploy_cdk_bridge_infra = false' --inplace params.yml # reset
# Perform additional tasks...

# Deploy ZkEVM Permissionless Node
yq e '.deploy_zkevm_permissionless_node = true' --inplace params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq e '.deploy_zkevm_permissionless_node = false' --inplace params.yml # reset
#+end_src

** License
Expand Down
Loading

0 comments on commit d96aa86

Please sign in to comment.