Skip to content

Commit

Permalink
refactor: permissionless node package (#8)
Browse files Browse the repository at this point in the history
* chore: move cdk code to its own package

* ci: update jobs

* feat: add dbs to pless node

* feat: add remaining components like prover, synchronizer and rpc

* fix: typo

* early draft pless node

* chore: clean up

* feat: add genesis file arg

* chore: typos

* fix: more typos

* fix: db names

* chore: update default parameters

* chore: remove permissionless node deployment from cdk package

* chore: lint

* ci: only deploy cdk package for the moment

* chore: nit

* chore: nit

* chore: remove debug wait

* refactor: service names

* chore: same

* chore: lint

* chore: nit

* chore: nit

* chore: nit

* Minor changes to permissionless refactoring (#11)

* docs: adding initial diagram

* ops: sonarcloud setup

* ops: removing unecessary debug service

* refactor: dropping trusted

* refactor: naming for pless

* refactor: deployment_idx

find . -type f | grep -v ".git" | xargs -I xxx sed -i 's/deployment_idx/deployment_suffix/gi' xxx

* docs: adding note for running pless

* ops: security

* ops: updating for fid8

* docs: minor changes for fid8 testing

* ops: kurtosis lint

* fix: shellcheck

* docs: path fix

* docs: adding some comments

* nit: comments

---------

Co-authored-by: leovct <[email protected]>

* chore: clean up

* chore: clean up arch diagram changes

---------

Co-authored-by: John Hilliard <[email protected]>
  • Loading branch information
leovct and praetoriansentry authored Mar 19, 2024
1 parent 0ef3c28 commit d809975
Show file tree
Hide file tree
Showing 27 changed files with 466 additions and 291 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ concurrency:
cancel-in-progress: true

jobs:
deploy:
cdk_package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy devnet

- name: Deploy kurtosis package
uses: kurtosis-tech/kurtosis-github-action@v1
with:
path: .
args: cdk-params.yml
path: cdk
args: cdk/params.yml
41 changes: 22 additions & 19 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,47 @@ concurrency:
cancel-in-progress: true

jobs:
starklark:
package:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
package: ["cdk", "permissionless-node"]
steps:
- uses: actions/checkout@v4

# Install linters
- 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: Run kurtosis linter
run: kurtosis lint ${{ github.workspace }}
yaml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install yamllint
run: pip install yamllint
- name: Run yamllint
run: yamllint --config-file .yamllint.yml .

hadolint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install hadolint
run: |
sudo wget -O /usr/local/bin/hadolint https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64
sudo chmod +x /usr/local/bin/hadolint
- name: Run hadolint
run: find . -type f -name 'Dockerfile*' | sort | xargs -I {} hadolint --config .hadolint.yml {}
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install shellcheck
run: sudo apt install shellcheck

# Run linters
- name: Run kurtosis linter
working-directory: ${{ matrix.package }}
run: kurtosis lint .

- name: Run yamllint
working-directory: ${{ matrix.package }}
run: yamllint --config-file ${{ github.workspace }}/.yamllint.yml .

- name: Run hadolint
working-directory: ${{ matrix.package }}
run: find . -type f -name 'Dockerfile*' | sort | xargs -I {} hadolint --config ${{ github.workspace }}/.hadolint.yml {}

- name: Run shellcheck
working-directory: ${{ matrix.package }}
run: find . -type f -name '*.sh' | sort | xargs -I {} shellcheck {}
36 changes: 33 additions & 3 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ good and installed on your system, you can ~cd~ into this directory
and run:

#+begin_src bash
kurtosis run --enclave cdk-v1 --args-file cdk-params.yml .
kurtosis run --enclave cdk-v1 --args-file cdk/params.yml cdk
#+end_src

This command will take a few minutes but will basically run an entire
Expand All @@ -29,14 +29,14 @@ overwhelming. If we want to simply see the port mapping within the
~trusted-rpc~ port, we can run this command.

#+begin_src bash
kurtosis port print cdk-v1 zkevm-node-rpc-001 trusted-rpc
kurtosis port print cdk-v1 zkevm-node-rpc-001 http-rpc
#+end_src

For the sake of this document, I'm going to map that value to an
environment variable.

#+begin_src bash
export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 trusted-rpc)"
export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 http-rpc)"
#+end_src

That is the same environment variable that ~cast~ uses, so now I
Expand Down Expand Up @@ -84,13 +84,43 @@ container to be able to poke around.
kurtosis service shell cdk-v1 zkevm-node-sequencer-001
#+end_src

One of the most common ways to check the status of the system is to
make sure that batches are going through the normal progression of
trusted, virtual, and verified:

#+begin_src bash
cast rpc zkevm_batchNumber
cast rpc zkevm_virtualBatchNumber
cast rpc zkevm_verifiedBatchNumber
#+end_src

When everything is done, you might want to clean up with this command
which stopps everything and deletes it.

#+begin_src bash
kurtosis clean -a
#+end_src

** Permissionless Node

In addition to the core stack, you can also attach and synchronize a
permissionless node. Of course, you'll need the CDK stack running from
the previous commands. Assuming that has run and correctly created a
network, you'll need to pull the genesis file artifact out and add it
to your ~permissionless-node~ kurtosis package.

#+begin_src bash
kurtosis files download cdk-v1 zkevm /tmp
cp /tmp/zkevm/genesis.json permissionless-node/genesis.json
#+end_src

Now that we have the right genesis file, we can add a permissionless
node to the ~cdk-v1~ enclave:

#+begin_src bash
kurtosis run --enclave cdk-v1 --args-file permissionless-node/params.yml permissionless-node
#+end_src

** License

Copyright (c) 2024 PT Services DMCC
Expand Down
File renamed without changes.
File renamed without changes
8 changes: 7 additions & 1 deletion docs/cdk-ops.org → cdk/docs/cdk-ops.org
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cast send --private-key 0x183c492d0ba156041a7f31a1b188958a7a22eebadca741a7fe6443


#+begin_src bash
export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 trusted-rpc)"
export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-trusted-rpc-001 http-rpc)"
cast rpc zkevm_batchNumber
cast rpc zkevm_virtualBatchNumber
cast rpc zkevm_verifiedBatchNumber
Expand All @@ -30,6 +30,12 @@ cat *.json | jq '.abi[] | select(.type != "receive")' | jq -s | polycli abi deco
docker run -it --net=container:f0ce09999e30 nicolaka/netshoot:latest /bin/bash
#+end_src


Confirm that we're on the correct fork
#+begin_src bash
export ETH_RPC_URL="$(kurtosis port print cdk-v1 el-1-geth-lighthouse rpc)"
cast call 0x2F50ef6b8e8Ee4E579B17619A92dE3E2ffbD8AD2 'rollupIDToRollupData(uint32)(address,uint64,address,uint64,bytes32,uint64,uint64,uint64,uint64,uint64,uint64,uint8)' 1
#+end_src
* Chaos

#+begin_src bash
Expand Down
5 changes: 2 additions & 3 deletions kurtosis.yml → cdk/kurtosis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: github.com/0xPolygon/kurtosis-cdk
name: github.com/0xPolygon/kurtosis-cdk/cdk
description: |-
This package allows you to provision a full CDK environment within
Kurtosis
This package allows you to provision a full CDK environment within Kurtosis
replace: {}
Loading

0 comments on commit d809975

Please sign in to comment.