Skip to content

Commit

Permalink
feat: bootstrap devnet (#7578)
Browse files Browse the repository at this point in the history
This PR brings adds a new command to the cli called `bootstrap-devnet`
that will deploy a couple of helper conctracts (on L1 and L2) for use on
devnet.

Close #7478 #7532 #7559 #7560 #7566 #7567
  • Loading branch information
alexghr authored Jul 24, 2024
1 parent ea75bf8 commit ade373b
Show file tree
Hide file tree
Showing 25 changed files with 472 additions and 217 deletions.
109 changes: 0 additions & 109 deletions .github/scripts/extract_output.sh

This file was deleted.

113 changes: 67 additions & 46 deletions .github/workflows/devnet-deploys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ env:
TF_VAR_FORK_MNEMONIC: ${{ secrets.FORK_MNEMONIC }}
TF_VAR_INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
TF_VAR_FAUCET_ACCOUNT_INDEX: 5
CONTRACT_S3_BUCKET: s3://aztec-${{ env.DEPLOY_TAG }}-deployments

jobs:
setup:
Expand Down Expand Up @@ -105,19 +106,31 @@ jobs:
--private-key ${{ secrets.SEQ_1_PUBLISHER_PRIVATE_KEY }} \
--rpc-url https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/${{ secrets.FORK_API_KEY }} \
--l1-chain-id ${{ env.L1_CHAIN_ID }} \
| tee ./l1-contracts/addresses.txt
./.github/scripts/extract_output.sh l1-contracts ./l1-contracts/addresses.txt
--json \
| tee ./l1-contract_addresses.json
# upload contract addresses to S3
aws s3 cp ./l1-contract_addresses.json ${{ env.CONTRACT_S3_BUCKET }}/l1_contract_addresses.json
# export contract addresses so they can be used by subsequent terraform deployments
function extract() {
jq -r ".$1" ./l1-contract_addresses.json
}
echo "TF_VAR_ROLLUP_CONTRACT_ADDRESS=$(extract rollupAddress)" >>$GITHUB_ENV
echo "TF_VAR_REGISTRY_CONTRACT_ADDRESS=$(extract registryAddress)" >>$GITHUB_ENV
echo "TF_VAR_INBOX_CONTRACT_ADDRESS=$(extract inboxAddress)" >>$GITHUB_ENV
echo "TF_VAR_OUTBOX_CONTRACT_ADDRESS=$(extract outboxAddress)" >>$GITHUB_ENV
echo "TF_VAR_AVAILABILITY_ORACLE_CONTRACT_ADDRESS=$(extract availabilityOracleAddress)" >>$GITHUB_ENV
echo "TF_VAR_GAS_TOKEN_CONTRACT_ADDRESS=$(extract gasTokenAddress)" >>$GITHUB_ENV
echo "TF_VAR_GAS_PORTAL_CONTRACT_ADDRESS=$(extract gasPortalAddress)" >>$GITHUB_ENV
- name: Apply l1-contracts Terraform
working-directory: ./l1-contracts/terraform
run: |
terraform init -input=false -backend-config="key=${{ env.DEPLOY_TAG }}/l1-contracts"
terraform apply -input=false -auto-approve
- name: Upload L1 contract addresses to S3
run: |
aws s3 cp ./l1-contracts.json s3://aztec-${{ env.DEPLOY_TAG }}-deployments/l1_contract_addresses.json
- name: Init Aztec Node Terraform
working-directory: ./yarn-project/aztec/terraform/node
run: |
Expand All @@ -128,12 +141,6 @@ jobs:
run: |
terraform apply -input=false -auto-approve -replace="aws_efs_file_system.node_data_store"
- name: Deploy Faucet
working-directory: ./yarn-project/aztec/aztec-faucet
run: |
terraform init -input=false -backend-config="key=${{ env.DEPLOY_TAG }}/aztec-faucet"
terraform apply -input=false -auto-approve
- name: Deploy Provers
working-directory: ./yarn-project/aztec/terraform/prover
run: |
Expand Down Expand Up @@ -173,45 +180,59 @@ jobs:
run: |
./.github/scripts/wait_for_infra.sh pxe ${{ env.DEPLOY_TAG }} ${{ secrets.FORK_API_KEY }}
- name: Bootstrap devnet
- name: Deploy protocol contracts
run: |
docker pull aztecprotocol/aztec:${{ env.DEPLOY_TAG }}
docker run aztecprotocol/aztec:${{ env.DEPLOY_TAG }} bootstrap \
docker run aztecprotocol/aztec:${{ env.DEPLOY_TAG }} deploy-protocol-contracts \
--rpc-url https://api.aztec.network/${{ env.DEPLOY_TAG }}/aztec-pxe/${{ secrets.FORK_API_KEY }} \
--l1-chain-id ${{ env.L1_CHAIN_ID }} \
| tee ./bootstrap_addresses.txt
source ./.github/scripts/extract_output.sh l2-bootstrap ./bootstrap_addresses.txt
--json \
| tee ./protocol-contracts.json
aws s3 cp ./protocol-contracts.json ${{ env.CONTRACT_S3_BUCKET }}/protocol-contracts.json
- name: Deploy contracts
- name: Bootstrap devnet
run: |
docker run aztecprotocol/aztec:${{ env.DEPLOY_TAG }} create-account \
docker run aztecprotocol/aztec:${{ env.DEPLOY_TAG }} bootstrap-devnet \
--rpc-url https://api.aztec.network/${{ env.DEPLOY_TAG }}/aztec-pxe/${{ secrets.FORK_API_KEY }} \
| tee ./account.txt
source ./.github/scripts/extract_output.sh account ./account.txt
echo "PK: $AZTEC_PRIVATE_KEY"
echo "CA: $AZTEC_ADDRESS"
docker run aztecprotocol/aztec:${{ env.DEPLOY_TAG }} deploy TokenContract \
--rpc-url https://api.aztec.network/${{ env.DEPLOY_TAG }}/aztec-pxe/${{ secrets.FORK_API_KEY }} \
--args $AZTEC_ADDRESS DevCoin DEV 18 \
--private-key $AZTEC_PRIVATE_KEY \
| tee ./token_contract.txt
source ./.github/scripts/extract_output.sh l2-contract ./token_contract.txt TOKEN_CONTRACT_ADDRESS
--l1-rpc-url https://${{ env.DEPLOY_TAG }}-mainnet-fork.aztec.network:8545/${{ secrets.FORK_API_KEY }} \
--l1-chain-id ${{ env.L1_CHAIN_ID }} \
--l1-private-key ${{ secrets.SEQ_1_PUBLISHER_PRIVATE_KEY }} \
--json \
| tee ./devnet-contracts.json
docker run aztecprotocol/aztec:${{ env.DEPLOY_TAG }} deploy FPCContract \
--rpc-url https://api.aztec.network/${{ env.DEPLOY_TAG }}/aztec-pxe/${{ secrets.FORK_API_KEY }} \
--args $TOKEN_CONTRACT_ADDRESS $FEE_JUICE_ADDRESS \
--private-key $AZTEC_PRIVATE_KEY \
| tee ./fpc_contract.txt
source ./.github/scripts/extract_output.sh l2-contract ./fpc_contract.txt FPC_CONTRACT_ADDRESS
- name: Upload addreses to S3
run: |
echo '{
"fee_juice_address": "'$FEE_JUICE_ADDRESS'",
"key_registry_address": "'$KEY_REGISTRY_ADDRESS'",
"auth_registry_address": "'$AUTH_REGISTRY_ADDRESS'",
"token_contract_address": "'$TOKEN_CONTRACT_ADDRESS'",
"fpc_contract_address": "'$FPC_CONTRACT_ADDRESS'
}' > ./l2_addresses.json
aws s3 cp ./l2_addresses.json s3://aztec-${{ env.DEPLOY_TAG }}-deployments/l2_contract_addresses.json
aws s3 cp ./devnet-contracts.json ${{ env.CONTRACT_S3_BUCKET }}/devnet-contracts.json
deploy-faucet:
runs-on: ubuntu-latest
needs: [terraform_deploy, bootstrap]
steps:
- uses: actions/checkout@v4
with:
ref: "${{ env.GIT_COMMIT }}"
fetch-depth: 0
- uses: ./.github/ci-setup-action
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.7.5

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-2

- name: Retrieve contract addresses
run: |
aws s3 cp ${{ env.CONTRACT_S3_BUCKET }}/l1_contract_addresses.json ./l1-contract_addresses.json
aws s3 cp ${{ env.CONTRACT_S3_BUCKET }}/devnet-contracts.json ./devnet-contracts.json
echo "TF_VAR_GAS_TOKEN_CONTRACT_ADDRESS=$(jq -r '.gasTokenAddress' ./l1-contract_addresses.json)" >>$GITHUB_ENV
echo "TF_VAR_DEV_COIN_CONTRACT_ADDRESS=$(jq -r '.devCoinL1' ./devnet-contracts.json)" >>$GITHUB_ENV
- name: Deploy Faucet
working-directory: ./yarn-project/aztec/aztec-faucet
run: |
terraform init -input=false -backend-config="key=${{ env.DEPLOY_TAG }}/aztec-faucet"
terraform apply -input=false -auto-approve
1 change: 1 addition & 0 deletions yarn-project/aztec-faucet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"dependencies": {
"@aztec/ethereum": "workspace:^",
"@aztec/foundation": "workspace:^",
"@aztec/l1-artifacts": "workspace:^",
"koa": "^2.14.2",
"koa-cors": "^0.0.16",
"koa-router": "^12.0.0",
Expand Down
Loading

0 comments on commit ade373b

Please sign in to comment.