diff --git a/.github/tests/attach-second-cdk-pessimistic.yml b/.github/tests/attach-second-cdk-pessimistic.yml new file mode 100644 index 00000000..e2fe5dab --- /dev/null +++ b/.github/tests/attach-second-cdk-pessimistic.yml @@ -0,0 +1,39 @@ +deployment_stages: + deploy_l1: false + deploy_agglayer: false + +args: + deployment_suffix: "-002" + zkevm_rollup_chain_id: 20202 + zkevm_rollup_id: 2 + + # The following accounts have been generated using the following command: + # polycli wallet inspect --mnemonic 'bless share truly shadow primary sun relief border van gallery stairs edit reflect gentle athlete main device smile response rescue mirror floor say people' --addresses 9 | tee keys.txt | jq -r '.Addresses[] | [.ETHAddress, .HexPrivateKey] | @tsv' | awk 'BEGIN{split("sequencer,aggregator,claimtxmanager,timelock,admin,loadtest,agglayer,dac,proofsigner",roles,",")} {print "zkevm_l2_" roles[NR] "_address: \"" $1 "\""; print "zkevm_l2_" roles[NR] "_private_key: \"0x" $2 "\"\n"}' + # Note that admin and agglayer accounts have been removed since we're using the default accounts. + zkevm_l2_sequencer_address: "0xA670342930242407b9984e467353044f8472055e" + zkevm_l2_sequencer_private_key: "0x902ed4ce26b536617a4f26da5e0cd0ef61b514a076b4bd766d6ab8b97efbb8c1" + zkevm_l2_aggregator_address: "0xfC419a9d9Fe0DfA4Cf9971AcD1Fbcd356DD768FD" + zkevm_l2_aggregator_private_key: "0xa70db9fb4b84a6ba18c03cd2266116dd110538d6c4c88e67ca35a29b910da25d" + zkevm_l2_claimtxmanager_address: "0x93F63c24735f45Cd0266E87353071B64dd86bc05" + zkevm_l2_claimtxmanager_private_key: "0x38718f22097afba13be48d818964326c9c5c48133f51e3c3bfd6faf05f813b34" + zkevm_l2_timelock_address: "0xDB22C6f61A82d6AA6d3607289fC93774AC09413a" + zkevm_l2_timelock_private_key: "0xae4a69010583a09709baa563fa66f9e6f2dacf9e9c84b89932406b9a0521b561" + zkevm_l2_loadtest_address: "0xD5278fC3Dc72A226d5C04c3d2C85fd397A46fA08" + zkevm_l2_loadtest_private_key: "0xef4db4f97684b8307adc332ed6c1bc82d66d160f08e7427d082d66a23889625e" + zkevm_l2_dac_address: "0xDa07AAD7226B136bc24157Dc4Ff5A813490E20D0" + zkevm_l2_dac_private_key: "0x992c9ab11d5eab6b6c2634b8bb0b85f3d8d1acf25024dc99c359cb2afd9b40a7" + zkevm_l2_proofsigner_address: "0xf1a661D7b601Ec46a040f57193cC99aB8c4132FA" + zkevm_l2_proofsigner_private_key: "0xc7fe3a006d75ba9326d9792523385abb49057c66aee0b8b4248821a89713f975" + + + cdk_node_image: ghcr.io/0xpolygon/cdk:0.5.0-beta10 + cdk_erigon_node_image: hermeznetwork/cdk-erigon:v2.60.0 + zkevm_contracts_image: leovct/zkevm-contracts:v9.0.0-rc.3-pp-fork.12-patch.1 + additional_services: [] + consensus_contract_type: pessimistic + sequencer_type: erigon + erigon_strict_mode: false + gas_token_enabled: true + zkevm_use_real_verifier: true + enable_normalcy: true + diff --git a/.github/tests/combinations/fork11-legacy-zkevm-stack-rollup.yml b/.github/tests/combinations/fork11-legacy-zkevm-stack-rollup.yml index 72515dcf..8e2b824d 100644 --- a/.github/tests/combinations/fork11-legacy-zkevm-stack-rollup.yml +++ b/.github/tests/combinations/fork11-legacy-zkevm-stack-rollup.yml @@ -9,6 +9,7 @@ args: additional_services: - tx_spammer deploy_l2_contracts: true + agglayer_image: ghcr.io/agglayer/agglayer:0.2.0-rc.19 consensus_contract_type: rollup sequencer_type: zkevm deployment_stages: diff --git a/.github/tests/combinations/fork11-new-cdk-stack-cdk-validium.yml b/.github/tests/combinations/fork11-new-cdk-stack-cdk-validium.yml index 622d6fa2..3f2b08b2 100644 --- a/.github/tests/combinations/fork11-new-cdk-stack-cdk-validium.yml +++ b/.github/tests/combinations/fork11-new-cdk-stack-cdk-validium.yml @@ -9,5 +9,6 @@ args: additional_services: - tx_spammer deploy_l2_contracts: true + agglayer_image: ghcr.io/agglayer/agglayer:0.2.0-rc.19 consensus_contract_type: cdk-validium sequencer_type: erigon diff --git a/.github/tests/combinations/fork11-new-cdk-stack-rollup.yml b/.github/tests/combinations/fork11-new-cdk-stack-rollup.yml index 5af1190d..67dfc6b1 100644 --- a/.github/tests/combinations/fork11-new-cdk-stack-rollup.yml +++ b/.github/tests/combinations/fork11-new-cdk-stack-rollup.yml @@ -9,5 +9,6 @@ args: additional_services: - tx_spammer deploy_l2_contracts: true + agglayer_image: ghcr.io/agglayer/agglayer:0.2.0-rc.19 consensus_contract_type: rollup sequencer_type: erigon diff --git a/.github/tests/combinations/fork9-legacy-zkevm-stack-cdk-validium.yml b/.github/tests/combinations/fork9-legacy-zkevm-stack-cdk-validium.yml index c2fb5760..b725d0d4 100644 --- a/.github/tests/combinations/fork9-legacy-zkevm-stack-cdk-validium.yml +++ b/.github/tests/combinations/fork9-legacy-zkevm-stack-cdk-validium.yml @@ -11,6 +11,7 @@ args: - pless_zkevm_node - tx_spammer deploy_l2_contracts: true + agglayer_image: ghcr.io/agglayer/agglayer:0.2.0-rc.19 consensus_contract_type: cdk-validium sequencer_type: zkevm deployment_stages: diff --git a/.github/tests/combinations/fork9-legacy-zkevm-stack-rollup.yml b/.github/tests/combinations/fork9-legacy-zkevm-stack-rollup.yml index b071eaee..c6129ff2 100644 --- a/.github/tests/combinations/fork9-legacy-zkevm-stack-rollup.yml +++ b/.github/tests/combinations/fork9-legacy-zkevm-stack-rollup.yml @@ -11,6 +11,7 @@ args: - pless_zkevm_node - tx_spammer deploy_l2_contracts: true + agglayer_image: ghcr.io/agglayer/agglayer:0.2.0-rc.19 consensus_contract_type: rollup sequencer_type: zkevm deployment_stages: diff --git a/.github/tests/combinations/fork9-new-cdk-stack-cdk-validium.yml b/.github/tests/combinations/fork9-new-cdk-stack-cdk-validium.yml index 5616ffd4..1cb92f19 100644 --- a/.github/tests/combinations/fork9-new-cdk-stack-cdk-validium.yml +++ b/.github/tests/combinations/fork9-new-cdk-stack-cdk-validium.yml @@ -11,5 +11,6 @@ args: - pless_zkevm_node - tx_spammer deploy_l2_contracts: true + agglayer_image: ghcr.io/agglayer/agglayer:0.2.0-rc.19 consensus_contract_type: cdk-validium sequencer_type: erigon diff --git a/.github/tests/combinations/fork9-new-cdk-stack-rollup.yml b/.github/tests/combinations/fork9-new-cdk-stack-rollup.yml index de953d1a..243cd04b 100644 --- a/.github/tests/combinations/fork9-new-cdk-stack-rollup.yml +++ b/.github/tests/combinations/fork9-new-cdk-stack-rollup.yml @@ -11,5 +11,6 @@ args: - pless_zkevm_node - tx_spammer deploy_l2_contracts: true + agglayer_image: ghcr.io/agglayer/agglayer:0.2.0-rc.19 consensus_contract_type: rollup sequencer_type: erigon diff --git a/.github/tests/fork12-pessimistic.yml b/.github/tests/fork12-pessimistic.yml index aaf7f548..4c4e542f 100644 --- a/.github/tests/fork12-pessimistic.yml +++ b/.github/tests/fork12-pessimistic.yml @@ -1,12 +1,12 @@ args: - agglayer_image: ghcr.io/agglayer/agglayer:0.2.0-rc.11 cdk_erigon_node_image: hermeznetwork/cdk-erigon:v2.60.0 - zkevm_bridge_service_image: hermeznetwork/zkevm-bridge-service:v0.6.0-RC3 - zkevm_bridge_ui_image: leovct/zkevm-bridge-ui:multi-network zkevm_contracts_image: leovct/zkevm-contracts:v9.0.0-rc.3-pp-fork.12-patch.1 additional_services: [] consensus_contract_type: pessimistic sequencer_type: erigon erigon_strict_mode: false - #agglayer_prover_sp1_key: + gas_token_enabled: false + zkevm_use_real_verifier: true enable_normalcy: true + agglayer_prover_sp1_key: "" + diff --git a/.github/tests/forks/fork11.yml b/.github/tests/forks/fork11.yml index ee57de6e..5ffdb01a 100644 --- a/.github/tests/forks/fork11.yml +++ b/.github/tests/forks/fork11.yml @@ -23,3 +23,6 @@ args: - tx_spammer deploy_l2_contracts: true + + # https://github.com/agglayer/agglayer/tags + agglayer_image: ghcr.io/agglayer/agglayer:0.2.0-rc.19 diff --git a/.github/tests/forks/fork9.yml b/.github/tests/forks/fork9.yml index fbeee964..8a85bfc7 100644 --- a/.github/tests/forks/fork9.yml +++ b/.github/tests/forks/fork9.yml @@ -27,3 +27,6 @@ args: - tx_spammer deploy_l2_contracts: true + + # https://github.com/agglayer/agglayer/tags + agglayer_image: ghcr.io/agglayer/agglayer:0.2.0-rc.19 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8d37f164..0dd622b8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -50,7 +50,7 @@ jobs: run: find . -type f -name '*.Dockerfile' | sort | xargs -I {} hadolint --config ${{ github.workspace }}/.hadolint.yml {} - name: Run shellcheck - run: find . -type f -name '*.sh' | sort | xargs -I {} shellcheck {} + run: find . -type f -name '*.sh' | grep -v "./docs" | sort | xargs -I {} shellcheck {} check-test-combinations-and-cdk-version-matrix: runs-on: ubuntu-latest @@ -65,7 +65,7 @@ jobs: - name: Generate test combinations and cdk version matrix working-directory: .github/tests run: ./combine-ymls.sh - + - name: Check if test combinations and cdk version matrix are up to date run: | if [[ -n $(git status --porcelain) ]]; then diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4b00d8f1..1de16014 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,7 @@ # https://github.com/0xPolygon/cdk/blob/main/.github/workflows/test-e2e.yml name: Test -on: +on: pull_request: push: branches: [main] @@ -18,6 +18,7 @@ env: jobs: build-cdk-image: + if: false runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -38,10 +39,10 @@ jobs: - name: Build cdk docker image working-directory: cdk run: make build-docker - + - name: Save cdk image to archive run: docker save --output /tmp/cdk.tar cdk - + - name: Upload archive uses: actions/upload-artifact@v4 with: @@ -49,6 +50,7 @@ jobs: path: /tmp/cdk.tar cdk-e2e-tests: + if: false runs-on: ubuntu-latest timeout-minutes: 45 needs: build-cdk-image @@ -63,7 +65,7 @@ jobs: - "fork12-pessimistic" steps: - uses: actions/checkout@v4 - + - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -75,15 +77,15 @@ jobs: env: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} - + - name: Install Kurtosis CDK tools uses: ./.github/actions/setup-kurtosis-cdk - + - name: Install polycli run: | - tmp_dir=$(mktemp -d) - curl -L "https://github.com/0xPolygon/polygon-cli/releases/download/${{ env.POLYCLI_VERSION }}/polycli_${{ env.POLYCLI_VERSION }}_linux_amd64.tar.gz" | tar -xz -C "$tmp_dir" - mv "$tmp_dir"/* /usr/local/bin/polycli + tmp_dir=$(mktemp -d) + curl -L "https://github.com/0xPolygon/polygon-cli/releases/download/${{ env.POLYCLI_VERSION }}/polycli_${{ env.POLYCLI_VERSION }}_linux_amd64.tar.gz" | tar -xz -C "$tmp_dir" + mv "$tmp_dir"/* /usr/local/bin/polycli rm -rf "$tmp_dir" sudo chmod +x /usr/local/bin/polycli /usr/local/bin/polycli version @@ -97,13 +99,13 @@ jobs: - name: Setup bats uses: bats-core/bats-action@3.0.0 - + - name: Download cdk archive uses: actions/download-artifact@v4 with: name: cdk path: /tmp - + - name: Load cdk image run: | docker load --input /tmp/cdk.tar @@ -120,11 +122,11 @@ jobs: KURTOSIS_FOLDER: ${{ github.workspace }} BATS_LIB_PATH: /usr/lib/ agglayer_prover_sp1_key: ${{ secrets.SP1_PRIVATE_KEY }} - + - name: Dump enclave if: failure() run: kurtosis enclave dump cdk ./dump - + - name: Generate archive name if: failure() run: | diff --git a/docs/multi-pp-testing/README b/docs/multi-pp-testing/README new file mode 100755 index 00000000..3fcac4ef --- /dev/null +++ b/docs/multi-pp-testing/README @@ -0,0 +1,438 @@ +#!/bin/bash +echo "dont run this!" +exit 1; + +# # Multi Chain PP Test +# +# ## Infra Setup +# +# This is an example of a system where there are two PP chains and one +# FEP chain attached to the rollup manager. One chain uses a gas token +# and the others do not. Between those three chains we're going to +# attempt a bunch of bridge scenarios. +# +# To run this stuff you'll want to run most of these commands from +# within the kurtosis-cdk repo root. +# +# First we're going to do a Kurtosis run to spin up the networks. If +# you're going to run this you *need an SP1 key* in the `net1.yml` +# file. +kurtosis run --enclave pp --args-file docs/multi-pp-testing/net1.yml . +kurtosis run --enclave pp --args-file docs/multi-pp-testing/net2.yml . +kurtosis run --enclave pp --args-file docs/multi-pp-testing/net3.yml . + +# At this point we should be able to confirm that things look right +# for both chains. Recently, it seems like the fork id isn't initially +# detected by erigon which is causing the chain not to start up right +# away. +polycli monitor --rpc-url $(kurtosis port print pp cdk-erigon-rpc-001 rpc) +polycli monitor --rpc-url $(kurtosis port print pp cdk-erigon-rpc-002 rpc) +polycli monitor --rpc-url $(kurtosis port print pp cdk-erigon-rpc-003 rpc) + +# In order to proceed, we'll need to grab the combined files from both +# chains. We'll specifically want the create rollup parameters file +# from the second chain because we need to know the gas token address. +kurtosis service exec pp contracts-001 "cat /opt/zkevm/combined-001.json" | tail -n +2 | jq '.' > combined-001.json +kurtosis service exec pp contracts-002 "cat /opt/zkevm/combined-002.json" | tail -n +2 | jq '.' > combined-002.json +kurtosis service exec pp contracts-002 "cat /opt/zkevm-contracts/deployment/v2/create_rollup_parameters.json" | tail -n +2 | jq -r '.gasTokenAddress' > gas-token-address.json +kurtosis service exec pp contracts-003 "cat /opt/zkevm/combined-003.json" | tail -n +2 | jq '.' > combined-003.json + +# This diagnosis isn't critical, but it's nice to confirm that we are +# using a real verifier for the PP networks and mock for the FEP. +cast code --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-001.json | jq -r '.verifierAddress') +cast code --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-002.json | jq -r '.verifierAddress') +cast code --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-003.json | jq -r '.verifierAddress') + +# Check that the hash of the verifier is actually the sp1 verifier. It should be f33fc6bc90b5ea5e0272a7ab87d701bdd05ecd78b8111ca4f450eeff1e6df26a +kurtosis service exec pp contracts-001 'cat /opt/zkevm-contracts/artifacts/contracts/verifiers/SP1Verifier.sol/SP1Verifier.json' | tail -n +2 | jq -r '.deployedBytecode' | sha256sum +cast code --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-001.json | jq -r '.verifierAddress') | sha256sum +cast code --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-002.json | jq -r '.verifierAddress') | sha256sum + +# The third network here should use a mock verifier and should be different +cast code --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-003.json | jq -r '.verifierAddress') | sha256sum + +# It's also worth while probably to confirm that the vkey matches! +kurtosis service exec pp agglayer "agglayer vkey" + +# Let's make sure both rollups have the same vkey +cast call --json --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-001.json | jq -r '.polygonRollupManagerAddress') 'rollupIDToRollupDataV2(uint32 rollupID)(address,uint64,address,uint64,bytes32,uint64,uint64,uint64,uint64,uint8,bytes32,bytes32)' 1 | jq '.[11]' +cast call --json --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-001.json | jq -r '.polygonRollupManagerAddress') 'rollupIDToRollupDataV2(uint32 rollupID)(address,uint64,address,uint64,bytes32,uint64,uint64,uint64,uint64,uint8,bytes32,bytes32)' 2 | jq '.[11]' + +# At this point, the agglayer config needs to be manually updated for +# rollup2. This will add a second entry to the agglayer config. If the +# second chain is also pessimistic, this isn't strictly necessary, but +# there's no harm in it. +kurtosis service exec pp agglayer "sed -i 's/\[proof\-signers\]/2 = \"http:\/\/cdk-erigon-rpc-002:8123\"\n\[proof-signers\]/i' /etc/zkevm/agglayer-config.toml" +kurtosis service exec pp agglayer "sed -i 's/\[proof\-signers\]/3 = \"http:\/\/cdk-erigon-rpc-003:8123\"\n\[proof-signers\]/i' /etc/zkevm/agglayer-config.toml" +kurtosis service stop pp agglayer +kurtosis service start pp agglayer + +# Let's create a clean EOA for receiving bridges so that we can see +# things show up. This is a good way to make sure we don't mess things +# up by trying to exit more than we've deposited +cast wallet new +target_address=0xbecE3a31343c6019CDE0D5a4dF2AF8Df17ebcB0f +target_private_key=0x51caa196504216b1730280feb63ddd8c5ae194d13e57e58d559f1f1dc3eda7c9 + +# Let's setup some variables for future use +private_key="0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625" +eth_address=$(cast wallet address --private-key $private_key) +l1_rpc_url=http://$(kurtosis port print pp el-1-geth-lighthouse rpc) +l2_pp1_url=$(kurtosis port print pp cdk-erigon-rpc-001 rpc) +l2_pp2_url=$(kurtosis port print pp cdk-erigon-rpc-002 rpc) +l2_fep_url=$(kurtosis port print pp cdk-erigon-rpc-003 rpc) +bridge_address=$(cat combined-001.json | jq -r .polygonZkEVMBridgeAddress) +pol_address=$(cat combined-001.json | jq -r .polTokenAddress) +gas_token_address=$( combined-001.json +kurtosis service exec pp contracts-002 "cat /opt/zkevm/combined-002.json" | tail -n +2 | jq '.' > combined-002.json +kurtosis service exec pp contracts-002 "cat /opt/zkevm-contracts/deployment/v2/create_rollup_parameters.json" | tail -n +2 | jq -r '.gasTokenAddress' > gas-token-address.json +kurtosis service exec pp contracts-003 "cat /opt/zkevm/combined-003.json" | tail -n +2 | jq '.' > combined-003.json +``` + +This diagnosis isn't critical, but it's nice to confirm that we are +using a real verifier for the PP networks and mock for the FEP. + +``` +cast code --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-001.json | jq -r '.verifierAddress') +cast code --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-002.json | jq -r '.verifierAddress') +cast code --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-003.json | jq -r '.verifierAddress') +``` + +Check that the hash of the verifier is actually the sp1 verifier. It should be f33fc6bc90b5ea5e0272a7ab87d701bdd05ecd78b8111ca4f450eeff1e6df26a + +``` +kurtosis service exec pp contracts-001 'cat /opt/zkevm-contracts/artifacts/contracts/verifiers/SP1Verifier.sol/SP1Verifier.json' | tail -n +2 | jq -r '.deployedBytecode' | sha256sum +cast code --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-001.json | jq -r '.verifierAddress') | sha256sum +cast code --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-002.json | jq -r '.verifierAddress') | sha256sum +``` + +The third network here should use a mock verifier and should be different + +``` +cast code --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-003.json | jq -r '.verifierAddress') | sha256sum +``` + +It's also worth while probably to confirm that the vkey matches! + +``` +kurtosis service exec pp agglayer "agglayer vkey" +``` + +Let's make sure both rollups have the same vkey + +``` +cast call --json --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-001.json | jq -r '.polygonRollupManagerAddress') 'rollupIDToRollupDataV2(uint32 rollupID)(address,uint64,address,uint64,bytes32,uint64,uint64,uint64,uint64,uint8,bytes32,bytes32)' 1 | jq '.[11]' +cast call --json --rpc-url http://$(kurtosis port print pp el-1-geth-lighthouse rpc) $(cat combined-001.json | jq -r '.polygonRollupManagerAddress') 'rollupIDToRollupDataV2(uint32 rollupID)(address,uint64,address,uint64,bytes32,uint64,uint64,uint64,uint64,uint8,bytes32,bytes32)' 2 | jq '.[11]' +``` + +At this point, the agglayer config needs to be manually updated for +rollup2. This will add a second entry to the agglayer config. If the +second chain is also pessimistic, this isn't strictly necessary, but +there's no harm in it. + +``` +kurtosis service exec pp agglayer "sed -i 's/\[proof\-signers\]/2 = \"http:\/\/cdk-erigon-rpc-002:8123\"\n\[proof-signers\]/i' /etc/zkevm/agglayer-config.toml" +kurtosis service exec pp agglayer "sed -i 's/\[proof\-signers\]/3 = \"http:\/\/cdk-erigon-rpc-003:8123\"\n\[proof-signers\]/i' /etc/zkevm/agglayer-config.toml" +kurtosis service stop pp agglayer +kurtosis service start pp agglayer +``` + +Let's create a clean EOA for receiving bridges so that we can see +things show up. This is a good way to make sure we don't mess things +up by trying to exit more than we've deposited + +``` +cast wallet new +target_address=0xbecE3a31343c6019CDE0D5a4dF2AF8Df17ebcB0f +target_private_key=0x51caa196504216b1730280feb63ddd8c5ae194d13e57e58d559f1f1dc3eda7c9 +``` + +Let's setup some variables for future use + +``` +private_key="0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625" +eth_address=$(cast wallet address --private-key $private_key) +l1_rpc_url=http://$(kurtosis port print pp el-1-geth-lighthouse rpc) +l2_pp1_url=$(kurtosis port print pp cdk-erigon-rpc-001 rpc) +l2_pp2_url=$(kurtosis port print pp cdk-erigon-rpc-002 rpc) +l2_fep_url=$(kurtosis port print pp cdk-erigon-rpc-003 rpc) +bridge_address=$(cat combined-001.json | jq -r .polygonZkEVMBridgeAddress) +pol_address=$(cat combined-001.json | jq -r .polTokenAddress) +gas_token_address=$( docs/multi-pp-testing/test-scenarios.json diff --git a/docs/multi-pp-testing/lxly.pict b/docs/multi-pp-testing/lxly.pict new file mode 100644 index 00000000..0ec3a44f --- /dev/null +++ b/docs/multi-pp-testing/lxly.pict @@ -0,0 +1,25 @@ +# pict lxly.pict /f:json | jq -c '.[] | from_entries' +DepositChain : L1, PP1, PP2, FEP +DestinationChain : L1, PP1, PP2, FEP +DestinationAddress : EOA, Contract, Precompile +BridgeType : Asset, Message, Weth +Token : NativeEther, LocalERC20, Buggy, WETH, GasToken +MetaData : 0x, Random +ForceUpdate : True (4), False +Amount : 0, 1, Random, Max + +IF [DepositChain] = "L1" THEN [DestinationChain] <> "L1"; +IF [DepositChain] = "FEP" THEN [DestinationChain] <> "FEP"; +IF [DepositChain] = "PP1" THEN [DestinationChain] <> "PP1"; +IF [DepositChain] = "PP2" THEN [DestinationChain] <> "PP2"; +IF [DepositChain] = "PP2" AND [BridgeType] = "Message" THEN [Amount] = "0"; + +IF [BridgeType] = "Message" THEN [Token] = "NativeEther"; +IF [BridgeType] = "Weth" THEN [Token] = "WETH"; + + +IF [Token] = "WETH" THEN [DepositChain] = "PP2"; +IF [Token] = "LocalERC20" OR [Token] = "WETH" OR [Token] = "GasToken" OR [Token] = "Buggy" THEN [MetaData] = "0x"; + +IF [Amount] = "Max" THEN [Token] = "Buggy"; + diff --git a/docs/multi-pp-testing/net1.yml b/docs/multi-pp-testing/net1.yml new file mode 100644 index 00000000..a60f1d28 --- /dev/null +++ b/docs/multi-pp-testing/net1.yml @@ -0,0 +1,11 @@ +args: + zkevm_contracts_image: leovct/zkevm-contracts:v9.0.0-rc.3-pp-fork.12-patch.1 + additional_services: [] + consensus_contract_type: pessimistic + sequencer_type: erigon + erigon_strict_mode: false + gas_token_enabled: false + zkevm_use_real_verifier: true + enable_normalcy: true + agglayer_prover_sp1_key: 0xSOME_SP1_KEY + diff --git a/docs/multi-pp-testing/net2.yml b/docs/multi-pp-testing/net2.yml new file mode 100644 index 00000000..a7a0acce --- /dev/null +++ b/docs/multi-pp-testing/net2.yml @@ -0,0 +1,36 @@ +deployment_stages: + deploy_l1: false + deploy_agglayer: false + +args: + deployment_suffix: "-002" + zkevm_rollup_chain_id: 20202 + zkevm_rollup_id: 2 + + # The following accounts have been generated using the following command: + # polycli wallet inspect --mnemonic 'bless share truly shadow primary sun relief border van gallery stairs edit reflect gentle athlete main device smile response rescue mirror floor say people' --addresses 9 | tee keys.txt | jq -r '.Addresses[] | [.ETHAddress, .HexPrivateKey] | @tsv' | awk 'BEGIN{split("sequencer,aggregator,claimtxmanager,timelock,admin,loadtest,agglayer,dac,proofsigner",roles,",")} {print "zkevm_l2_" roles[NR] "_address: \"" $1 "\""; print "zkevm_l2_" roles[NR] "_private_key: \"0x" $2 "\"\n"}' + # Note that admin and agglayer accounts have been removed since we're using the default accounts. + zkevm_l2_sequencer_address: "0xA670342930242407b9984e467353044f8472055e" + zkevm_l2_sequencer_private_key: "0x902ed4ce26b536617a4f26da5e0cd0ef61b514a076b4bd766d6ab8b97efbb8c1" + zkevm_l2_aggregator_address: "0xfC419a9d9Fe0DfA4Cf9971AcD1Fbcd356DD768FD" + zkevm_l2_aggregator_private_key: "0xa70db9fb4b84a6ba18c03cd2266116dd110538d6c4c88e67ca35a29b910da25d" + zkevm_l2_claimtxmanager_address: "0x93F63c24735f45Cd0266E87353071B64dd86bc05" + zkevm_l2_claimtxmanager_private_key: "0x38718f22097afba13be48d818964326c9c5c48133f51e3c3bfd6faf05f813b34" + zkevm_l2_timelock_address: "0xDB22C6f61A82d6AA6d3607289fC93774AC09413a" + zkevm_l2_timelock_private_key: "0xae4a69010583a09709baa563fa66f9e6f2dacf9e9c84b89932406b9a0521b561" + zkevm_l2_loadtest_address: "0xD5278fC3Dc72A226d5C04c3d2C85fd397A46fA08" + zkevm_l2_loadtest_private_key: "0xef4db4f97684b8307adc332ed6c1bc82d66d160f08e7427d082d66a23889625e" + zkevm_l2_dac_address: "0xDa07AAD7226B136bc24157Dc4Ff5A813490E20D0" + zkevm_l2_dac_private_key: "0x992c9ab11d5eab6b6c2634b8bb0b85f3d8d1acf25024dc99c359cb2afd9b40a7" + zkevm_l2_proofsigner_address: "0xf1a661D7b601Ec46a040f57193cC99aB8c4132FA" + zkevm_l2_proofsigner_private_key: "0xc7fe3a006d75ba9326d9792523385abb49057c66aee0b8b4248821a89713f975" + + zkevm_contracts_image: leovct/zkevm-contracts:v9.0.0-rc.3-pp-fork.12-patch.1 + additional_services: [] + consensus_contract_type: pessimistic + sequencer_type: erigon + erigon_strict_mode: false + gas_token_enabled: true + zkevm_use_real_verifier: true + enable_normalcy: true + diff --git a/docs/multi-pp-testing/net3.yml b/docs/multi-pp-testing/net3.yml new file mode 100644 index 00000000..4676051a --- /dev/null +++ b/docs/multi-pp-testing/net3.yml @@ -0,0 +1,31 @@ +deployment_stages: + deploy_l1: false + deploy_agglayer: false + +args: + deployment_suffix: "-003" + zkevm_rollup_chain_id: 30303 + zkevm_rollup_id: 3 + + # The following accounts have been generated using the following command: + # polycli wallet inspect --mnemonic 'true suggest umbrella mountain try enrich donate can inform tragic camp venue' --addresses 9 | jq -r '.Addresses[] | [.ETHAddress, .HexPrivateKey] | @tsv' | awk 'BEGIN{split("sequencer,aggregator,claimtxmanager,timelock,admin,loadtest,agglayer,dac,proofsigner",roles,",")} {print "zkevm_l2_" roles[NR] "_address: \"" $1 "\""; print "zkevm_l2_" roles[NR] "_private_key: \"0x" $2 "\"\n"}' + # Note that admin and agglayer accounts have been removed since we're using the default accounts. + zkevm_l2_sequencer_address: "0x1583bf88Dfee6B10a7c6D18FEA8c85584Bc8ae8E" + zkevm_l2_sequencer_private_key: "0x741830ef92d530ad0c8a83e2296f866e4078bacaac2ea1357e870afc384302f3" + zkevm_l2_aggregator_address: "0xCAEfA8401448f79dAE0935A0ca6aA8CD4d665E7B" + zkevm_l2_aggregator_private_key: "0x4a44c4dbbebff3d7537a6049a36110854e25b8bf14b81f29ed00ce5ef934e952" + zkevm_l2_claimtxmanager_address: "0x8edC8CE0DB10137d513aB5767ffF13D1c51885a8" + zkevm_l2_claimtxmanager_private_key: "0x46bf651fcd46161385147081efc5befa229ae5254de1dfc61b41a1b65a11caeb" + zkevm_l2_timelock_address: "0x7Bf6Ce527660cF839AB43b1ce1F889256BAa0724" + zkevm_l2_timelock_private_key: "0xc374eb5487cbbb5f13a02ef848379695e9e101a35860679c9d63c3530921f973" + zkevm_l2_loadtest_address: "0x5198F56c367Dbfe36FC768dbb6565663EEded55b" + zkevm_l2_loadtest_private_key: "0xa1c26dd89c0c6253d180525afd0e152e41c7deba5525f90df66c2f19288e21c4" + zkevm_l2_dac_address: "0x6f5E3D0b07Ed95F5c4c72168F3A85C42aEF3789e" + zkevm_l2_dac_private_key: "0x78eea556baadadf043e43b54ab440a89b32cb6f51d7c317cfa5ed5d1289e7157" + zkevm_l2_proofsigner_address: "0xDcd1d53324a9Ae5a50a55F62556A771376Fe434D" + zkevm_l2_proofsigner_private_key: "0xcb1f295abf6538023fcf96eaa8e81969a65ba70ab61590187b77e2c01aaba748" + + zkevm_contracts_image: leovct/zkevm-contracts:v9.0.0-rc.3-pp-fork.12-patch.1 + additional_services: [] + sequencer_type: erigon + diff --git a/docs/multi-pp-testing/run.sh b/docs/multi-pp-testing/run.sh new file mode 100755 index 00000000..9045f881 --- /dev/null +++ b/docs/multi-pp-testing/run.sh @@ -0,0 +1,226 @@ +#!/bin/bash + +if [[ ! -e docs/multi-pp-testing/test-scenarios.json ]]; then + echo "expected to find test scenarios in docs/multi-pp-testing/test-scenarios.json. Maybe we're not in the root of the repo?" + exit 1 +fi + +tester_contract_address=0xc54E34B55EF562FE82Ca858F70D1B73244e86388 +test_erc20_buggy_addr=0x22939b3A4dFD9Fc6211F99Cdc6bd9f6708ae2956 +test_lxly_proxy_addr=0x1786B94e55cA57b897aF0f59a1e5b31EA0469547 +tester_contract_address=0xc54E34B55EF562FE82Ca858F70D1B73244e86388 + +l1_rpc_url=http://$(kurtosis port print pp el-1-geth-lighthouse rpc) +l2_pp1_url=$(kurtosis port print pp cdk-erigon-rpc-001 rpc) +l2_pp2_url=$(kurtosis port print pp cdk-erigon-rpc-002 rpc) +l2_fep_url=$(kurtosis port print pp cdk-erigon-rpc-003 rpc) + +l2_pp1b_url=$(kurtosis port print pp zkevm-bridge-service-001 rpc) +l2_pp2b_url=$(kurtosis port print pp zkevm-bridge-service-002 rpc) +l2_fepb_url=$(kurtosis port print pp zkevm-bridge-service-003 rpc) + +private_key="0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625" +eth_address="$(cast wallet address --private-key $private_key)" + +rpc_list="$l1_rpc_url $l2_fep_url $l2_pp1_url $l2_pp2_url" + +network_id_l1=0 +network_id_pp1=1 +network_id_pp2=2 +network_id_fep=3 + +bridge_address=$(cat combined-001.json | jq -r .polygonZkEVMBridgeAddress) +pol_address=$(cat combined-001.json | jq -r .polTokenAddress) +gas_token_address=$( /dev/null; do - ((counter++)) - echo_ts "No finalized block yet... Retrying ($counter)..." - if [[ $counter -ge $max_retries ]]; then - echo_ts "Exceeded maximum retry attempts. Exiting." - exit 1 - fi - sleep 5 - done -} - fund_account_on_l1() { name="$1" address="$2" @@ -334,9 +320,18 @@ fi # finalized block l1_preset="{{.l1_preset}}" if [[ $l1_preset == "minimal" ]]; then - wait_for_finalized_block + # This might not be required, but it seems like the downstream + # processes are more reliable if we wait for all of the deployments to + # finalize before moving on + current_block_number="$(cast block-number --rpc-url '{{.l1_rpc_url}}')" + finalized_block_number=0 + until [[ $finalized_block_number -gt $current_block_number ]]; do + sleep 5 + finalized_block_number="$(cast block-number --rpc-url '{{.l1_rpc_url}}' finalized)" + done fi # The contract setup is done! touch "/opt/zkevm/.init-complete{{.deployment_suffix}}.lock" + diff --git a/templates/trusted-node/cdk-node-config.toml b/templates/trusted-node/cdk-node-config.toml index 8ce7946c..5d17412f 100644 --- a/templates/trusted-node/cdk-node-config.toml +++ b/templates/trusted-node/cdk-node-config.toml @@ -45,10 +45,14 @@ Outputs = ["stderr"] VerifyProofInterval = "10s" GasOffset = 150000 SettlementBackend = "agglayer" +[RPC] + Port = {{.zkevm_cdk_node_port}} [AggSender] CertificateSendInterval = "1m" CheckSettledInterval = "5s" +MaxCertSize = 102760448 +SaveCertificatesToFilesPath="/tmp" [L1InfoTreeSync] # The initial block number from which to start syncing.