From 1c0603cfee5d7876402f22da4b37e70bca9665cf Mon Sep 17 00:00:00 2001 From: spypsy Date: Mon, 4 Dec 2023 13:27:45 +0000 Subject: [PATCH 1/4] fix(ci): login to ecr to fetch contracts image --- l1-contracts/scripts/ci_deploy_contracts.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/l1-contracts/scripts/ci_deploy_contracts.sh b/l1-contracts/scripts/ci_deploy_contracts.sh index a0ff8f612dd..f297153d82e 100755 --- a/l1-contracts/scripts/ci_deploy_contracts.sh +++ b/l1-contracts/scripts/ci_deploy_contracts.sh @@ -14,6 +14,9 @@ if check_rebuild "cache-$CONTENT_HASH-$DEPLOY_TAG-deployed" $REPOSITORY; then exit 0 fi +# Login to pull our ecr images with docker. +ecr_login + mkdir -p serve # Contract addresses will be mounted in the serve directory docker run \ From 72913a7d0c8aca19595793855a2f58ebfadfa156 Mon Sep 17 00:00:00 2001 From: spypsy Date: Mon, 4 Dec 2023 14:33:46 +0000 Subject: [PATCH 2/4] test script locally --- build-system/scripts/deploy_terraform | 2 +- l1-contracts/scripts/ci_deploy_contracts.sh | 25 +++++++++++---------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/build-system/scripts/deploy_terraform b/build-system/scripts/deploy_terraform index ce2231853aa..825d8cc41e5 100755 --- a/build-system/scripts/deploy_terraform +++ b/build-system/scripts/deploy_terraform @@ -43,4 +43,4 @@ for RESOURCE in $TO_TAINT; do terraform taint $RESOURCE || true done -terraform apply -input=false -auto-approve +terraform plan -input=false -auto-approve diff --git a/l1-contracts/scripts/ci_deploy_contracts.sh b/l1-contracts/scripts/ci_deploy_contracts.sh index f297153d82e..336f0386f23 100755 --- a/l1-contracts/scripts/ci_deploy_contracts.sh +++ b/l1-contracts/scripts/ci_deploy_contracts.sh @@ -1,18 +1,19 @@ #!/bin/bash -export ETHEREUM_HOST=$DEPLOY_TAG-mainnet-fork.aztec.network:8545/$FORK_API_KEY +export ETHEREUM_HOST=https://$DEPLOY_TAG-mainnet-fork.aztec.network:8545/$FORK_API_KEY +# export ETHEREUM_HOST=http://localhost:8545 REPOSITORY="l1-contracts" -CONTENT_HASH=$(calculate_content_hash $REPOSITORY) +# CONTENT_HASH=$(calculate_content_hash $REPOSITORY) -echo "Last successfully published commit: $CONTENT_HASH" +# echo "Last successfully published commit: $CONTENT_HASH" -# Check if image hash has alredy been deployed. -if check_rebuild "cache-$CONTENT_HASH-$DEPLOY_TAG-deployed" $REPOSITORY; then - echo "No changes detected, no contract deploy necessary." - exit 0 -fi +# # Check if image hash has alredy been deployed. +# if check_rebuild "cache-$CONTENT_HASH-$DEPLOY_TAG-deployed" $REPOSITORY; then +# echo "No changes detected, no contract deploy necessary." +# exit 0 +# fi # Login to pull our ecr images with docker. ecr_login @@ -31,8 +32,8 @@ for KEY in ROLLUP_CONTRACT_ADDRESS REGISTRY_CONTRACT_ADDRESS INBOX_CONTRACT_ADDR export TF_VAR_$KEY=$VALUE done -# Write TF state variables -deploy_terraform l1-contracts ./terraform +# # Write TF state variables +# deploy_terraform l1-contracts ./terraform -# Tag the image as deployed. -retry tag_remote_image $REPOSITORY cache-$CONTENT_HASH cache-$CONTENT_HASH-$DEPLOY_TAG-deployed +# # Tag the image as deployed. +# retry tag_remote_image $REPOSITORY cache-$CONTENT_HASH cache-$CONTENT_HASH-$DEPLOY_TAG-deployed From e413b9c1642d633e4d50ed6e75de4661b2a5948d Mon Sep 17 00:00:00 2001 From: spypsy Date: Mon, 4 Dec 2023 15:13:36 +0000 Subject: [PATCH 3/4] fix(ci): l1-contract directories --- build-system/scripts/deploy_terraform | 2 +- l1-contracts/scripts/ci_deploy_contracts.sh | 23 ++++++++++----------- l1-contracts/scripts/deploy_contracts.sh | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/build-system/scripts/deploy_terraform b/build-system/scripts/deploy_terraform index 825d8cc41e5..ce2231853aa 100755 --- a/build-system/scripts/deploy_terraform +++ b/build-system/scripts/deploy_terraform @@ -43,4 +43,4 @@ for RESOURCE in $TO_TAINT; do terraform taint $RESOURCE || true done -terraform plan -input=false -auto-approve +terraform apply -input=false -auto-approve diff --git a/l1-contracts/scripts/ci_deploy_contracts.sh b/l1-contracts/scripts/ci_deploy_contracts.sh index 336f0386f23..f07256db876 100755 --- a/l1-contracts/scripts/ci_deploy_contracts.sh +++ b/l1-contracts/scripts/ci_deploy_contracts.sh @@ -1,19 +1,18 @@ #!/bin/bash export ETHEREUM_HOST=https://$DEPLOY_TAG-mainnet-fork.aztec.network:8545/$FORK_API_KEY -# export ETHEREUM_HOST=http://localhost:8545 REPOSITORY="l1-contracts" -# CONTENT_HASH=$(calculate_content_hash $REPOSITORY) +CONTENT_HASH=$(calculate_content_hash $REPOSITORY) -# echo "Last successfully published commit: $CONTENT_HASH" +echo "Last successfully published commit: $CONTENT_HASH" -# # Check if image hash has alredy been deployed. -# if check_rebuild "cache-$CONTENT_HASH-$DEPLOY_TAG-deployed" $REPOSITORY; then -# echo "No changes detected, no contract deploy necessary." -# exit 0 -# fi +# Check if image hash has alredy been deployed. +if check_rebuild "cache-$CONTENT_HASH-$DEPLOY_TAG-deployed" $REPOSITORY; then + echo "No changes detected, no contract deploy necessary." + exit 0 +fi # Login to pull our ecr images with docker. ecr_login @@ -21,7 +20,7 @@ ecr_login mkdir -p serve # Contract addresses will be mounted in the serve directory docker run \ - -v $(pwd)/serve:/usr/src/contracts/serve \ + -v $(pwd)/serve:/usr/src/l1-contracts/serve \ -e ETHEREUM_HOST=$ETHEREUM_HOST -e PRIVATE_KEY=$CONTRACT_PUBLISHER_PRIVATE_KEY \ "$ECR_URL/l1-contracts:cache-$CONTENT_HASH"-x86_64 \ ./scripts/deploy_contracts.sh @@ -29,11 +28,11 @@ docker run \ # Write the contract addresses as terraform variables for KEY in ROLLUP_CONTRACT_ADDRESS REGISTRY_CONTRACT_ADDRESS INBOX_CONTRACT_ADDRESS OUTBOX_CONTRACT_ADDRESS; do VALUE=$(jq -r .$KEY ./serve/contract_addresses.json) - export TF_VAR_$KEY=$VALUE + echo "TF_VAR_$KEY=$VALUE" done # # Write TF state variables -# deploy_terraform l1-contracts ./terraform +deploy_terraform l1-contracts ./terraform # # Tag the image as deployed. -# retry tag_remote_image $REPOSITORY cache-$CONTENT_HASH cache-$CONTENT_HASH-$DEPLOY_TAG-deployed +retry tag_remote_image $REPOSITORY cache-$CONTENT_HASH cache-$CONTENT_HASH-$DEPLOY_TAG-deployed diff --git a/l1-contracts/scripts/deploy_contracts.sh b/l1-contracts/scripts/deploy_contracts.sh index bdd4ebe8053..6223a0719a9 100755 --- a/l1-contracts/scripts/deploy_contracts.sh +++ b/l1-contracts/scripts/deploy_contracts.sh @@ -32,7 +32,7 @@ export REGISTRY_CONTRACT_ADDRESS=$(deploy_contract ./src/core/messagebridge/Regi export INBOX_CONTRACT_ADDRESS=$(deploy_contract ./src/core/messagebridge/Inbox.sol:Inbox "$REGISTRY_CONTRACT_ADDRESS" | extract_deployed_to) export OUTBOX_CONTRACT_ADDRESS=$(deploy_contract ./src/core/messagebridge/Outbox.sol:Outbox "$REGISTRY_CONTRACT_ADDRESS" | extract_deployed_to) export ROLLUP_CONTRACT_ADDRESS=$(deploy_contract ./src/core/Rollup.sol:Rollup "$REGISTRY_CONTRACT_ADDRESS" | extract_deployed_to) -export CONTRACT_DEPLOYMENT_EMITTER_ADDRESS=$(deploy_contract ./src/core/periphery/ContractDeploymentEmitter.sol:ContractDeploymentEmitter | extract_deployed_to) +export CONTRACT_DEPLOYMENT_EMITTER_ADDRESS=$(deploy_contract ./src/periphery/ContractDeploymentEmitter.sol:ContractDeploymentEmitter | extract_deployed_to) # Store contract addresses in a JSON file jq -n \ From a24ca1af14f083da9f18a8a97c95878708951809 Mon Sep 17 00:00:00 2001 From: spypsy Date: Mon, 4 Dec 2023 15:17:16 +0000 Subject: [PATCH 4/4] fix typos --- l1-contracts/scripts/ci_deploy_contracts.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/l1-contracts/scripts/ci_deploy_contracts.sh b/l1-contracts/scripts/ci_deploy_contracts.sh index f07256db876..80cbf28173a 100755 --- a/l1-contracts/scripts/ci_deploy_contracts.sh +++ b/l1-contracts/scripts/ci_deploy_contracts.sh @@ -28,11 +28,11 @@ docker run \ # Write the contract addresses as terraform variables for KEY in ROLLUP_CONTRACT_ADDRESS REGISTRY_CONTRACT_ADDRESS INBOX_CONTRACT_ADDRESS OUTBOX_CONTRACT_ADDRESS; do VALUE=$(jq -r .$KEY ./serve/contract_addresses.json) - echo "TF_VAR_$KEY=$VALUE" + export TF_VAR_$KEY=$VALUE done -# # Write TF state variables +# Write TF state variables deploy_terraform l1-contracts ./terraform -# # Tag the image as deployed. +# Tag the image as deployed. retry tag_remote_image $REPOSITORY cache-$CONTENT_HASH cache-$CONTENT_HASH-$DEPLOY_TAG-deployed