From dcfc02b40084115bce0df90a698e3d6b70464a7f Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Tue, 3 Sep 2024 08:30:34 +0000 Subject: [PATCH] Configurable mainnet fork resources --- .github/workflows/devnet-deploys.yml | 12 ++++++++++++ iac/mainnet-fork/terraform/main.tf | 4 ++-- iac/mainnet-fork/terraform/variables.tf | 10 ++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/devnet-deploys.yml b/.github/workflows/devnet-deploys.yml index f61b49aefda..a11f5cd9075 100644 --- a/.github/workflows/devnet-deploys.yml +++ b/.github/workflows/devnet-deploys.yml @@ -65,6 +65,8 @@ env: TF_VAR_FORK_MNEMONIC: ${{ secrets.FORK_MNEMONIC }} TF_VAR_INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }} TF_VAR_FORK_ADMIN_API_KEY: ${{ secrets.DEVNET_API_KEY }} + TF_VAR_MAINNET_FORK_CPU_UNITS: 2048 + TF_VAR_MAINNET_FORK_MEMORY_UNITS: 4096 # Faucet TF_VAR_FAUCET_ACCOUNT_INDEX: 9 @@ -123,6 +125,8 @@ jobs: min_txs_per_block: ${{ steps.set_network_vars.outputs.min_txs_per_block }} bot_flush_setup_txs: ${{ steps.set_network_vars.outputs.bot_flush_setup_txs }} bot_max_pending_txs: ${{ steps.set_network_vars.outputs.bot_max_pending_txs }} + mainnet_fork_cpu_units: ${{ steps.set_network_vars.outputs.mainnet_fork_cpu_units }} + mainnet_fork_memory_units: ${{ steps.set_network_vars.outputs.mainnet_fork_memory_units }} steps: - name: Set network vars shell: bash @@ -151,6 +155,8 @@ jobs: echo "bot_follow_chain=PROVEN" >> $GITHUB_OUTPUT echo "bot_flush_setup_txs=false" >> $GITHUB_OUTPUT echo "bot_max_pending_txs=1" >> $GITHUB_OUTPUT + echo "mainnet_fork_cpu_units=2048" >> $GITHUB_OUTPUT + echo "mainnet_fork_memory_units=4096" >> $GITHUB_OUTPUT elif [ "$BRANCH_NAME" = "provernet" ] then echo "deploy_tag=provernet" >> $GITHUB_OUTPUT @@ -173,6 +179,8 @@ jobs: echo "bot_follow_chain=NONE" >> $GITHUB_OUTPUT echo "bot_flush_setup_txs=true" >> $GITHUB_OUTPUT echo "bot_max_pending_txs=32" >> $GITHUB_OUTPUT + echo "mainnet_fork_cpu_units=8192" >> $GITHUB_OUTPUT + echo "mainnet_fork_memory_units=32768" >> $GITHUB_OUTPUT elif [ "$BRANCH_NAME" = "alphanet" ] then echo "deploy_tag=alphanet" >> $GITHUB_OUTPUT @@ -195,6 +203,8 @@ jobs: echo "bot_follow_chain=PROVEN" >> $GITHUB_OUTPUT echo "bot_flush_setup_txs=false" >> $GITHUB_OUTPUT echo "bot_max_pending_txs=1" >> $GITHUB_OUTPUT + echo "mainnet_fork_cpu_units=2048" >> $GITHUB_OUTPUT + echo "mainnet_fork_memory_units=4096" >> $GITHUB_OUTPUT else echo "Unrecognized Branch!!" exit 1 @@ -400,6 +410,8 @@ jobs: TF_VAR_BOT_NO_WAIT_FOR_TRANSFERS: ${{ needs.set-network.outputs.bot_no_wait }} TF_VAR_SEQ_MIN_TX_PER_BLOCK: 1 TF_VAR_SEQ_MAX_TX_PER_BLOCK: ${{ needs.set-network.outputs.max_txs_per_block }} + TF_VAR_MAINNET_FORK_CPU_UNITS: ${{ needs.set-network.outputs.mainnet_fork_cpu_units }} + TF_VAR_MAINNET_FORK_MEMORY_UNITS: ${{ needs.set-network.outputs.mainnet_fork_memory_units }} steps: - uses: actions/checkout@v4 with: diff --git a/iac/mainnet-fork/terraform/main.tf b/iac/mainnet-fork/terraform/main.tf index 49c407db09c..737be2e298f 100644 --- a/iac/mainnet-fork/terraform/main.tf +++ b/iac/mainnet-fork/terraform/main.tf @@ -102,8 +102,8 @@ resource "aws_ecs_task_definition" "aztec_mainnet_fork" { family = "${var.DEPLOY_TAG}-mainnet-fork" requires_compatibilities = ["FARGATE"] network_mode = "awsvpc" - cpu = "2048" - memory = "4096" + cpu = var.MAINNET_FORK_CPU_UNITS + memory = var.MAINNET_FORK_MEMORY_UNITS execution_role_arn = data.terraform_remote_state.setup_iac.outputs.ecs_task_execution_role_arn volume { diff --git a/iac/mainnet-fork/terraform/variables.tf b/iac/mainnet-fork/terraform/variables.tf index 1ba3012169b..c64895845c9 100644 --- a/iac/mainnet-fork/terraform/variables.tf +++ b/iac/mainnet-fork/terraform/variables.tf @@ -25,3 +25,13 @@ variable "DEPLOY_TAG" { variable "L1_CHAIN_ID" { type = string } + +variable "MAINNET_FORK_CPU_UNITS" { + type = string + default = "2048" +} + +variable "MAINNET_FORK_MEMORY_UNITS" { + type = string + default = "4096" +}