From f33f52a45aeefac50e3eb711055489472d0fe40b Mon Sep 17 00:00:00 2001 From: spypsy Date: Thu, 4 Apr 2024 15:12:06 +0100 Subject: [PATCH 1/3] fix: mainnet fork redeploys --- .circleci/config.yml | 12 ++++++------ iac/mainnet-fork/terraform/main.tf | 7 ++++++- l1-contracts/scripts/ci_deploy_contracts.sh | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2b0d5c488d2d..7bfbe360a023 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1182,6 +1182,11 @@ jobs: deploy_dockerhub cli deploy_dockerhub aztec-faucet deploy_dockerhub mainnet-fork + - run: + name: "Deploy mainnet fork" + command: | + should_deploy || exit 0 + deploy_terraform_services iac/mainnet-fork - run: name: "Release canary to NPM: bb.js" command: | @@ -1212,11 +1217,6 @@ jobs: command: | should_release || exit 0 deploy_npm l1-contracts latest - - run: - name: "Deploy mainnet fork" - command: | - should_deploy || exit 0 - deploy_terraform_services iac/mainnet-fork mainnet-fork mainnet-fork aws_efs_file_system.aztec_mainnet_fork_data_store - run: name: "Deploy L1 contracts to mainnet fork" working_directory: l1-contracts @@ -1244,7 +1244,7 @@ jobs: # Check if l1-contracts have changed if [ "$CONTRACTS_DEPLOYED" -eq 1 ]; then echo "Contracts have changed, taint nodes to force redeploy.." - deploy_terraform_services yarn-project/aztec-node aztec aztec-node "aws_ecs_task_definition.aztec-node[0],aws_ecs_task_definition.aztec-node[1]" + deploy_terraform_services yarn-project/aztec-node aztec aztec-node "aws_ecs_task_definition.aztec-node[0],aws_ecs_task_definition.aztec-node[1]" 1 else deploy_terraform_services yarn-project/aztec-node aztec fi diff --git a/iac/mainnet-fork/terraform/main.tf b/iac/mainnet-fork/terraform/main.tf index 08198ba5e0b5..e8978b48120d 100644 --- a/iac/mainnet-fork/terraform/main.tf +++ b/iac/mainnet-fork/terraform/main.tf @@ -77,12 +77,17 @@ resource "aws_efs_file_system" "aztec_mainnet_fork_data_store" { creation_token = "${var.DEPLOY_TAG}-mainnet-fork-data" tags = { - Name = "${var.DEPLOY_TAG}-mainnet-fork-data" + Name = "${var.DEPLOY_TAG}-mainnet-fork-data" + TaskDefinitionArn = "${aws_ecs_task_definition.aztec_mainnet_fork.arn}" # This line forces recreation on task definition change } lifecycle_policy { transition_to_ia = "AFTER_30_DAYS" } + + lifecycle { + create_before_destroy = true + } } resource "aws_efs_mount_target" "aztec_fork_private_az1" { diff --git a/l1-contracts/scripts/ci_deploy_contracts.sh b/l1-contracts/scripts/ci_deploy_contracts.sh index a3ccd71600b2..e2f61e37b992 100755 --- a/l1-contracts/scripts/ci_deploy_contracts.sh +++ b/l1-contracts/scripts/ci_deploy_contracts.sh @@ -29,7 +29,7 @@ retry docker pull $CLI_IMAGE # remove 0x prefix from private key PRIVATE_KEY=${CONTRACT_PUBLISHER_PRIVATE_KEY#0x} -docker run \ +retry docker run \ $CLI_IMAGE \ deploy-l1-contracts -u $ETHEREUM_HOST -p $PRIVATE_KEY | tee ./serve/contract_addresses.json From 909647223da773e8a84cd6f58db64e12d99efbb7 Mon Sep 17 00:00:00 2001 From: spypsy Date: Thu, 4 Apr 2024 15:13:58 +0100 Subject: [PATCH 2/3] undo unecessary change --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7bfbe360a023..bc2958989a12 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1244,7 +1244,7 @@ jobs: # Check if l1-contracts have changed if [ "$CONTRACTS_DEPLOYED" -eq 1 ]; then echo "Contracts have changed, taint nodes to force redeploy.." - deploy_terraform_services yarn-project/aztec-node aztec aztec-node "aws_ecs_task_definition.aztec-node[0],aws_ecs_task_definition.aztec-node[1]" 1 + deploy_terraform_services yarn-project/aztec-node aztec aztec-node "aws_ecs_task_definition.aztec-node[0],aws_ecs_task_definition.aztec-node[1]" else deploy_terraform_services yarn-project/aztec-node aztec fi From 9bf380310cf2b0cc8e0e3144389e6d458d1873bd Mon Sep 17 00:00:00 2001 From: spypsy Date: Thu, 4 Apr 2024 15:45:21 +0100 Subject: [PATCH 3/3] custom retry loop --- l1-contracts/scripts/ci_deploy_contracts.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/l1-contracts/scripts/ci_deploy_contracts.sh b/l1-contracts/scripts/ci_deploy_contracts.sh index e2f61e37b992..914e28f128e7 100755 --- a/l1-contracts/scripts/ci_deploy_contracts.sh +++ b/l1-contracts/scripts/ci_deploy_contracts.sh @@ -29,9 +29,15 @@ retry docker pull $CLI_IMAGE # remove 0x prefix from private key PRIVATE_KEY=${CONTRACT_PUBLISHER_PRIVATE_KEY#0x} -retry docker run \ - $CLI_IMAGE \ - deploy-l1-contracts -u $ETHEREUM_HOST -p $PRIVATE_KEY | tee ./serve/contract_addresses.json + +# Retries up to 3 times with 10 second intervals +ATTEMPTS=3 +for i in $(seq 1 $ATTEMPTS); do + docker run \ + $CLI_IMAGE \ + deploy-l1-contracts -u $ETHEREUM_HOST -p $PRIVATE_KEY | tee $FILE_PATH && break + [ "$i" != "$ATTEMPTS" ] && sleep 10 +done ## Result format is: # Rollup Address: 0xe33d37702bb94e83ca09e7dc804c9f4c4ab8ee4a