Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
leovct committed Nov 21, 2024
1 parent 7819576 commit 05d8995
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/tests/gas-token/pre-deployed.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
args:
gas_token_enabled: true
gas_token_address: ""
gas_token_address: "0xCHANGEME"
80 changes: 80 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,86 @@ jobs:
name: ${{ env.ARCHIVE_NAME }}
path: ./dump

pre-deployed-gas-token:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# This step will only execute if the necessary secrets are available, preventing failures
# on pull requests from forked repositories.
if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_TOKEN }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

- name: Deploy L1 chain
run: kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --args-file=./.github/tests/external-l1/deploy-local-l1.yml .

- name: Deploy gas token on L1
run: |
zkevm_contracts_version="v8.0.0-rc.4-fork.12"
echo "Cloning zkevm-contracts $zkevm_contracts_version..."
git clone https://github.com/0xPolygonHermez/zkevm-contracts
pushd zkevm-contracts
git checkout $zkevm_contracts_version
npm install @openzeppelin/[email protected]
printf "[profile.default]\nsrc = 'contracts'\nout = 'out'\nlibs = ['node_modules']\n" > foundry.toml
echo "Deploying gas token to L1..."
l1_rpc_url=$(kurtosis port print ${{ env.ENCLAVE_NAME }} el-1-geth-lighthouse rpc)
gas_token_address=$(forge create \
--json \
--rpc-url $l1_rpc_url \
--mnemonic "giant issue aisle success illegal bike spike question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy very lucky have athlete" \
contracts/mocks/ERC20PermitMock.sol:ERC20PermitMock \
--constructor-args "CDK Gas Token" "CDK" "0xE34aaF64b29273B7D567FCFc40544c014EEe9970" "1000000000000000000000000" \
| jq --raw-output '.deployedTo')
if [[ -z "$gas_token_address" ]]; then
echo "Unable to deploy gas token"
exit 1
fi
echo "Gas token contract deployed at $gas_token_address on L1"
popd
yq -Y --in-place ".args.gas_token_address = \"$gas_token_address\"" ./.github/tests/gas-token/pre-deployed.yml
- name: Deploy the rest of the stack
run: |
kurtosis run \
--enclave=${{ env.ENCLAVE_NAME }} \
--args-file=./.github/tests/gas-token/pre-deployed.yml \
. \
'{"deployment_stages": {"deploy_l1": false}}'
- name: Inspect enclave
run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }}

- name: Monitor verified batches
working-directory: .github/scripts
run: |
./monitor-verified-batches.sh \
--enclave ${{ env.ENCLAVE_NAME }} \
--rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-rpc-001 rpc)"
- name: Dump enclave
if: ${{ !cancelled() }}
run: kurtosis enclave dump ${{ env.ENCLAVE_NAME }} ./dump

- name: Upload enclave dump
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: dump_pre_deployed_gas_token${{ github.run_id }}
path: ./dump

additional-services:
runs-on: ubuntu-latest
timeout-minutes: 30
Expand Down
9 changes: 7 additions & 2 deletions templates/contract-deploy/run-contract-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,17 @@ forge create \
contracts/mocks/ERC20PermitMock.sol:ERC20PermitMock \
--constructor-args "CDK Gas Token" "CDK" "{{.zkevm_l2_admin_address}}" "1000000000000000000000000" \
> gasToken-erc20.json
jq \
--slurpfile c gasToken-erc20.json \
'.gasTokenAddress = $c[0].deployedTo' \
/opt/contract-deploy/create_rollup_parameters.json \
> /opt/zkevm-contracts/deployment/v2/create_rollup_parameters.json
# {{else}}
echo_ts "Using L1 pre-deployed gas token: {{ .gas_token_address }}"
# {{end}}
jq \
--slurpfile c gasToken-erc20.json \
'.gasTokenAddress = $c[0].deployedTo' \
--arg c "{{ .gas_token_address }}" \
'.gasTokenAddress = $c' \
/opt/contract-deploy/create_rollup_parameters.json \
> /opt/zkevm-contracts/deployment/v2/create_rollup_parameters.json
# {{end}}
Expand Down

0 comments on commit 05d8995

Please sign in to comment.