From b18e32521ec9c6c7669824ce0879a7ed94fb63be Mon Sep 17 00:00:00 2001 From: spypsy Date: Mon, 6 Oct 2025 11:28:53 +0000 Subject: [PATCH] feat: R2 snapshots custom domain --- spartan/aztec-network/values/archival-node.yaml | 2 +- spartan/environments/staging-ignition.env | 2 +- spartan/environments/staging-public.env | 2 +- spartan/environments/testnet.env | 2 +- spartan/terraform/cloudflare/main.tf | 9 +++++++++ spartan/terraform/cloudflare/outputs.tf | 2 +- spartan/terraform/cloudflare/variables.tf | 6 +++++- yarn-project/cli/src/config/chain_l2_config.ts | 10 +++++----- 8 files changed, 24 insertions(+), 11 deletions(-) diff --git a/spartan/aztec-network/values/archival-node.yaml b/spartan/aztec-network/values/archival-node.yaml index e520f9ac0664..fe89eb059b3a 100644 --- a/spartan/aztec-network/values/archival-node.yaml +++ b/spartan/aztec-network/values/archival-node.yaml @@ -3,7 +3,7 @@ telemetry: snapshots: uploadLocation: "" - syncUrl: "https://pub-f4a8c34d4bb7441ebf8f48d904512180.r2.dev/snapshots/staging-public/" + syncUrl: "https://aztec-labs-snapshots.com/staging-public/" frequency: "0 0 * * *" # daily uploads at midnight network: diff --git a/spartan/environments/staging-ignition.env b/spartan/environments/staging-ignition.env index 1c352b1c1a87..9a7a7debec86 100644 --- a/spartan/environments/staging-ignition.env +++ b/spartan/environments/staging-ignition.env @@ -21,7 +21,7 @@ ROLLUP_DEPLOYMENT_PRIVATE_KEY=REPLACE_WITH_GCP_SECRET OTEL_COLLECTOR_ENDPOINT=REPLACE_WITH_GCP_SECRET VERIFY_CONTRACTS=true ETHERSCAN_API_KEY=REPLACE_WITH_GCP_SECRET -STORE_SNAPSHOT_URL=s3://testnet-bucket/snapshots/staging-ignition/?endpoint=https://REPLACE_WITH_GCP_SECRET.r2.cloudflarestorage.com&publicBaseUrl=https://pub-f4a8c34d4bb7441ebf8f48d904512180.r2.dev +STORE_SNAPSHOT_URL=s3://testnet-bucket/staging-ignition/?endpoint=https://REPLACE_WITH_GCP_SECRET.r2.cloudflarestorage.com&publicBaseUrl=https://aztec-labs-snapshots.com R2_ACCESS_KEY_ID=REPLACE_WITH_GCP_SECRET R2_SECRET_ACCESS_KEY=REPLACE_WITH_GCP_SECRET BOT_TRANSFERS_REPLICAS=0 diff --git a/spartan/environments/staging-public.env b/spartan/environments/staging-public.env index c9ba2ccc351a..8c0fca603a32 100644 --- a/spartan/environments/staging-public.env +++ b/spartan/environments/staging-public.env @@ -16,7 +16,7 @@ OTEL_COLLECTOR_ENDPOINT=REPLACE_WITH_GCP_SECRET VERIFY_CONTRACTS=true ETHERSCAN_API_KEY=REPLACE_WITH_GCP_SECRET DEPLOY_INTERNAL_BOOTNODE=false -STORE_SNAPSHOT_URL="s3://testnet-bucket/snapshots/staging-public/?endpoint=https://REPLACE_WITH_GCP_SECRET.r2.cloudflarestorage.com&publicBaseUrl=https://pub-f4a8c34d4bb7441ebf8f48d904512180.r2.dev" +STORE_SNAPSHOT_URL="s3://testnet-bucket/staging-public/?endpoint=https://REPLACE_WITH_GCP_SECRET.r2.cloudflarestorage.com&publicBaseUrl=https://aztec-labs-snapshots.com" R2_ACCESS_KEY_ID=REPLACE_WITH_GCP_SECRET R2_SECRET_ACCESS_KEY=REPLACE_WITH_GCP_SECRET PROVER_FAILED_PROOF_STORE=gs://aztec-develop/staging-public/failed-proofs diff --git a/spartan/environments/testnet.env b/spartan/environments/testnet.env index ed7847a93184..b5bd4726f8e5 100644 --- a/spartan/environments/testnet.env +++ b/spartan/environments/testnet.env @@ -21,7 +21,7 @@ OTEL_COLLECTOR_ENDPOINT=REPLACE_WITH_GCP_SECRET VERIFY_CONTRACTS=true ETHERSCAN_API_KEY=REPLACE_WITH_GCP_SECRET -STORE_SNAPSHOT_URL=s3://testnet-bucket/snapshots/testnet/?endpoint=https://REPLACE_WITH_GCP_SECRET.r2.cloudflarestorage.com&publicBaseUrl=https://pub-f4a8c34d4bb7441ebf8f48d904512180.r2.dev +STORE_SNAPSHOT_URL=s3://testnet-bucket/testnet/?endpoint=https://REPLACE_WITH_GCP_SECRET.r2.cloudflarestorage.com&publicBaseUrl=https://aztec-labs-snapshots.com R2_ACCESS_KEY_ID=REPLACE_WITH_GCP_SECRET R2_SECRET_ACCESS_KEY=REPLACE_WITH_GCP_SECRET DEPLOY_INTERNAL_BOOTNODE=false diff --git a/spartan/terraform/cloudflare/main.tf b/spartan/terraform/cloudflare/main.tf index be1963c5e395..dfff09beec6c 100644 --- a/spartan/terraform/cloudflare/main.tf +++ b/spartan/terraform/cloudflare/main.tf @@ -28,3 +28,12 @@ resource "cloudflare_r2_managed_domain" "r2dev" { enabled = true } +# Attach custom domain to the R2 bucket +resource "cloudflare_r2_custom_domain" "aztec_labs_snapshots_com" { + account_id = var.R2_ACCOUNT_ID + bucket_name = cloudflare_r2_bucket.bucket.name + domain = var.DOMAIN + zone_id = var.R2_ZONE_ID + enabled = true +} + diff --git a/spartan/terraform/cloudflare/outputs.tf b/spartan/terraform/cloudflare/outputs.tf index 53f33a36bb2b..8c6af6d6a02e 100644 --- a/spartan/terraform/cloudflare/outputs.tf +++ b/spartan/terraform/cloudflare/outputs.tf @@ -11,5 +11,5 @@ output "s3_endpoint" { } output "upload_location" { - value = "s3://${cloudflare_r2_bucket.bucket.name}/snapshots/testnet/?endpoint=https://${var.R2_ACCOUNT_ID}.r2.cloudflarestorage.com&publicBaseUrl=https://pub-f4a8c34d4bb7441ebf8f48d904512180.r2.dev" + value = "s3://${cloudflare_r2_bucket.bucket.name}/testnet/?endpoint=https://${var.R2_ACCOUNT_ID}.r2.cloudflarestorage.com&publicBaseUrl=https://aztec-labs-snapshots.com" } diff --git a/spartan/terraform/cloudflare/variables.tf b/spartan/terraform/cloudflare/variables.tf index 38d22b01c1d4..9f50205ec6db 100644 --- a/spartan/terraform/cloudflare/variables.tf +++ b/spartan/terraform/cloudflare/variables.tf @@ -8,7 +8,7 @@ variable "R2_ACCOUNT_ID" { variable "DOMAIN" { type = string - default = "aztec-labs.com" + default = "aztec-labs-snapshots.com" } variable "SUBDOMAIN" { @@ -20,3 +20,7 @@ variable "BUCKET_NAME" { type = string default = "testnet-bucket" } + +variable "R2_ZONE_ID" { + type = string +} diff --git a/yarn-project/cli/src/config/chain_l2_config.ts b/yarn-project/cli/src/config/chain_l2_config.ts index 9a2b93db8f4b..aa08d6af7d7a 100644 --- a/yarn-project/cli/src/config/chain_l2_config.ts +++ b/yarn-project/cli/src/config/chain_l2_config.ts @@ -10,7 +10,7 @@ import publicIncludeMetrics from '../../public_include_metric_prefixes.json' wit import { cachedFetch } from './cached_fetch.js'; import { enrichEthAddressVar, enrichVar } from './enrich_env.js'; -const SNAPSHOT_URL = 'https://pub-f4a8c34d4bb7441ebf8f48d904512180.r2.dev/snapshots'; +const SNAPSHOTS_URL = 'https://aztec-labs-snapshots.com'; const defaultDBMapSizeKb = 128 * 1_024 * 1_024; // 128 GB const tbMapSizeKb = 1_024 * 1_024 * 1_024; // 1 TB @@ -99,7 +99,7 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = { seqMinTxsPerBlock: 0, seqMaxTxsPerBlock: 0, realProofs: true, - snapshotsUrls: [`${SNAPSHOT_URL}/staging-ignition/`], + snapshotsUrls: [`${SNAPSHOTS_URL}/staging-ignition/`], autoUpdate: 'config-and-version', autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-ignition.json', maxTxPoolSize: 100_000_000, // 100MB @@ -179,7 +179,7 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = { seqMinTxsPerBlock: 0, seqMaxTxsPerBlock: 20, realProofs: true, - snapshotsUrls: [`${SNAPSHOT_URL}/staging-public/`], + snapshotsUrls: [`${SNAPSHOTS_URL}/staging-public/`], autoUpdate: 'config-and-version', autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-public.json', publicIncludeMetrics, @@ -231,7 +231,7 @@ export const testnetL2ChainConfig: L2ChainConfig = { seqMinTxsPerBlock: 0, seqMaxTxsPerBlock: 20, realProofs: true, - snapshotsUrls: [`${SNAPSHOT_URL}/testnet/`], + snapshotsUrls: [`${SNAPSHOTS_URL}/testnet/`], autoUpdate: 'config-and-version', autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/testnet.json', maxTxPoolSize: 100_000_000, // 100MB @@ -285,7 +285,7 @@ export const ignitionL2ChainConfig: L2ChainConfig = { seqMinTxsPerBlock: 0, seqMaxTxsPerBlock: 0, realProofs: true, - snapshotsUrls: ['https://storage.googleapis.com/aztec-testnet/snapshots/ignition/'], + snapshotsUrls: [`${SNAPSHOTS_URL}/ignition/`], autoUpdate: 'notify', autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/ignition.json', maxTxPoolSize: 100_000_000, // 100MB