diff --git a/host-contracts/.env.polygonAmoy b/host-contracts/.env.polygonAmoy new file mode 100644 index 0000000000..8e0ab92a49 --- /dev/null +++ b/host-contracts/.env.polygonAmoy @@ -0,0 +1,48 @@ +# Polygon Amoy Configuration Example +# Copy this file to .env and fill in your actual values + +# Your wallet mnemonic or use DEPLOYER_PRIVATE_KEY below +MNEMONIC="REPLACE_WITH_MNEMONIC" + +# Chain IDs +CHAIN_ID="80002" # Polygon Amoy testnet +CHAIN_ID_GATEWAY="54321" # Update this if your gateway is on a different chain + +# Deployer account - USE YOUR ACTUAL PRIVATE KEY (without 0x prefix or with it, both work) +DEPLOYER_PRIVATE_KEY="REPLACE_WITH_PRIVATE_KEY" + +# RPC URL - Get from Alchemy, Infura, or use public RPC +# Alchemy: https://polygon-amoy.g.alchemy.com/v2/YOUR-API-KEY +# Infura: https://polygon-amoy.infura.io/v3/YOUR-API-KEY +# Public (not recommended for production): https://rpc-amoy.polygon.technology +# RPC_URL="https://rpc-amoy.polygon.technology" +RPC_URL="https://polygon-amoy.g.alchemy.com/v2/REPLACE_WITH_ALCHEMY_API_KEY" + +# Hardhat Network +HARDHAT_NETWORK="polygonAmoy" + +# Gateway addresses (update these to match your gateway deployment) +DECRYPTION_ADDRESS="0x35760912360E875DA50D40a74305575c23D55783" +INPUT_VERIFICATION_ADDRESS="0x1ceFA8E3F3271358218B52c33929Cf76078004c1" + +# KMS Configuration +NUM_KMS_NODES="1" +PUBLIC_DECRYPTION_THRESHOLD="1" +KMS_SIGNER_ADDRESS_0="0xC628FE1bB4202aC1AF3E6D1D7a2C3411A8973C46" + +# Coprocessor Configuration +NUM_COPROCESSORS="1" +COPROCESSOR_THRESHOLD="1" +COPROCESSOR_SIGNER_ADDRESS_0="0x6254A198F67ad40290a2E7B48aDB2d19B71f67BD" + +# Pausers +NUM_PAUSERS="2" +PAUSER_ADDRESS_0="0xa44366bAA26296c1409AD1e284264212029F02f1" +PAUSER_ADDRESS_1="0xc1d91b49A1B3D1324E93F86778C44a03f1063f1b" +PAUSER_PRIVATE_KEY="0x7ae52cf0d3011ef7fecbe22d9537aeda1a9e42a0596e8def5d49970eb59e7a40" + +# Owner +NEW_OWNER_PRIVATE_KEY="0x7ae52cf0d3011ef7fecbe22d9537aeda1a9e42a0596e8def5d49970eb59e7a40" + +# Note: Make sure your deployer account has enough MATIC on Polygon Amoy +# Get test MATIC from: https://faucet.polygon.technology/ diff --git a/host-contracts/hardhat.config.ts b/host-contracts/hardhat.config.ts index 3dc36b5872..e9ae57f534 100644 --- a/host-contracts/hardhat.config.ts +++ b/host-contracts/hardhat.config.ts @@ -68,6 +68,7 @@ const chainIds = { staging: 12345, zwsDev: 1337, mainnet: 1, + polygonAmoy: 80002, custom: 9999, }; @@ -113,6 +114,7 @@ const config: HardhatUserConfig = { sepolia: getChainConfig('sepolia'), localHostChain: getChainConfig('localHostChain'), mainnet: getChainConfig('mainnet'), + polygonAmoy: getChainConfig('polygonAmoy'), custom: getChainConfig('custom'), }, paths: { diff --git a/test-suite/e2e/contracts/E2ECoprocessorConfigLocal.sol b/test-suite/e2e/contracts/E2ECoprocessorConfigLocal.sol index 4908acc9dc..b25939db1f 100644 --- a/test-suite/e2e/contracts/E2ECoprocessorConfigLocal.sol +++ b/test-suite/e2e/contracts/E2ECoprocessorConfigLocal.sol @@ -7,9 +7,9 @@ library DefaultCoprocessorConfig { function getConfig() internal pure returns (CoprocessorConfig memory) { return CoprocessorConfig({ - ACLAddress: 0x05fD9B5EFE0a996095f42Ed7e77c390810CF660c, - CoprocessorAddress: 0xcCAe95fF1d11656358E782570dF0418F59fA40e1, - KMSVerifierAddress: 0xa1880e99d86F081E8D3868A8C4732C8f65dfdB11 + ACLAddress: REPLACE_WITH_DEPLOYED_ACL_ADDRESS, + CoprocessorAddress: REPLACE_WITH_DEPLOYED_FHEVMEXECUTOR_ADDRESS, + KMSVerifierAddress: REPLACE_WITH_DEPLOYED_KMSVERIFIER_ADDRESS }); } } diff --git a/test-suite/e2e/hardhat.config.ts b/test-suite/e2e/hardhat.config.ts index 1391ac3a8e..34f62004a5 100644 --- a/test-suite/e2e/hardhat.config.ts +++ b/test-suite/e2e/hardhat.config.ts @@ -76,7 +76,7 @@ const chainIds = { localNative: 8009, devnetNative: 9000, localCoprocessor: 12345, - staging: 12345, + staging: 80002, // polygonAmoy zwsDev: 1337, sepolia: 11155111, mainnet: 1, diff --git a/test-suite/fhevm/docker-compose/coprocessor-docker-compose.yml b/test-suite/fhevm/docker-compose/coprocessor-docker-compose.yml index e5390b2bca..0d8b2c5ae5 100644 --- a/test-suite/fhevm/docker-compose/coprocessor-docker-compose.yml +++ b/test-suite/fhevm/docker-compose/coprocessor-docker-compose.yml @@ -10,7 +10,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.coprocessor.local + - ../env/staging/.env.coprocessor environment: - KEY_ID=${FHE_KEY_ID} command: @@ -30,7 +30,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.coprocessor.local + - ../env/staging/.env.coprocessor command: - host_listener - --database-url=${DATABASE_URL} @@ -54,7 +54,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.coprocessor.local + - ../env/staging/.env.coprocessor command: - host_listener_poller - --database-url=${DATABASE_URL} @@ -82,7 +82,7 @@ services: timeout: 5s retries: 3 env_file: - - ../env/staging/.env.coprocessor.local + - ../env/staging/.env.coprocessor command: - gw_listener - --database-url=${DATABASE_URL} @@ -108,7 +108,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.coprocessor.local + - ../env/staging/.env.coprocessor command: - tfhe_worker - --run-bg-worker @@ -134,7 +134,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.coprocessor.local + - ../env/staging/.env.coprocessor command: - zkproof_worker - --database-url=${DATABASE_URL} @@ -158,7 +158,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.coprocessor.local + - ../env/staging/.env.coprocessor command: - sns_worker - --database-url=${DATABASE_URL} @@ -195,7 +195,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.coprocessor.local + - ../env/staging/.env.coprocessor command: - transaction_sender - --database-url=${DATABASE_URL} diff --git a/test-suite/fhevm/docker-compose/core-docker-compose.yml b/test-suite/fhevm/docker-compose/core-docker-compose.yml index b40333ecf5..cb9332eeef 100644 --- a/test-suite/fhevm/docker-compose/core-docker-compose.yml +++ b/test-suite/fhevm/docker-compose/core-docker-compose.yml @@ -4,7 +4,7 @@ services: container_name: kms-core image: ghcr.io/zama-ai/kms/core-service:${CORE_VERSION} env_file: - - ../env/staging/.env.core.local + - ../env/staging/.env.core entrypoint: - /bin/sh - -c diff --git a/test-suite/fhevm/docker-compose/database-docker-compose.yml b/test-suite/fhevm/docker-compose/database-docker-compose.yml index deec2e549a..4847956f2c 100644 --- a/test-suite/fhevm/docker-compose/database-docker-compose.yml +++ b/test-suite/fhevm/docker-compose/database-docker-compose.yml @@ -4,7 +4,7 @@ services: image: postgres:15.7 restart: always env_file: - - ../env/staging/.env.database.local + - ../env/staging/.env.database ports: - '5432:5432' healthcheck: diff --git a/test-suite/fhevm/docker-compose/gateway-mocked-payment-docker-compose.yml b/test-suite/fhevm/docker-compose/gateway-mocked-payment-docker-compose.yml index dddfc2d11b..bf2d477b9b 100644 --- a/test-suite/fhevm/docker-compose/gateway-mocked-payment-docker-compose.yml +++ b/test-suite/fhevm/docker-compose/gateway-mocked-payment-docker-compose.yml @@ -10,7 +10,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.gateway-mocked-payment.local + - ../env/staging/.env.gateway-mocked-payment command: - npx hardhat task:deployMockedZamaOFT @@ -26,7 +26,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.gateway-mocked-payment.local + - ../env/staging/.env.gateway-mocked-payment command: - npx hardhat task:setTxSenderMockedPayment depends_on: diff --git a/test-suite/fhevm/docker-compose/gateway-node-docker-compose.yml b/test-suite/fhevm/docker-compose/gateway-node-docker-compose.yml index 7a83016e4a..7493a844b9 100644 --- a/test-suite/fhevm/docker-compose/gateway-node-docker-compose.yml +++ b/test-suite/fhevm/docker-compose/gateway-node-docker-compose.yml @@ -3,7 +3,7 @@ services: container_name: gateway-node image: ghcr.io/foundry-rs/foundry:v1.3.5 env_file: - - ../env/staging/.env.gateway-node.local + - ../env/staging/.env.gateway-node entrypoint: - anvil - --block-time diff --git a/test-suite/fhevm/docker-compose/gateway-sc-docker-compose.yml b/test-suite/fhevm/docker-compose/gateway-sc-docker-compose.yml index 0ac0dc53af..f29eb5b1b4 100644 --- a/test-suite/fhevm/docker-compose/gateway-sc-docker-compose.yml +++ b/test-suite/fhevm/docker-compose/gateway-sc-docker-compose.yml @@ -10,7 +10,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.gateway-sc.local + - ../env/staging/.env.gateway-sc command: - npx hardhat task:deployAllGatewayContracts volumes: @@ -27,7 +27,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.gateway-sc.local + - ../env/staging/.env.gateway-sc command: - npx hardhat task:addHostChainsToGatewayConfig depends_on: @@ -49,7 +49,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.gateway-sc.local + - ../env/staging/.env.gateway-sc command: - npx hardhat task:addGatewayPausers depends_on: @@ -71,7 +71,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.gateway-sc.local + - ../env/staging/.env.gateway-sc # Using test parameters (--params-type 1) is currently not possible at it can make the random # tests fail with a high probability (1/2 chance), so we instead use default parameters (--params-type 0). # See https://github.com/zama-ai/fhevm-internal/issues/685 @@ -96,7 +96,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.gateway-sc.local + - ../env/staging/.env.gateway-sc # Using test parameters (--params-type 1) is currently not possible for keygen (see above), and # CRS parameters must be of the same type as the keygen parameters. # See https://github.com/zama-ai/fhevm-internal/issues/685 diff --git a/test-suite/fhevm/docker-compose/kms-connector-docker-compose.yml b/test-suite/fhevm/docker-compose/kms-connector-docker-compose.yml index fc764d9671..6802fd45a3 100644 --- a/test-suite/fhevm/docker-compose/kms-connector-docker-compose.yml +++ b/test-suite/fhevm/docker-compose/kms-connector-docker-compose.yml @@ -6,7 +6,7 @@ services: context: ../../.. dockerfile: kms-connector/connector-db/Dockerfile env_file: - - ../env/staging/.env.kms-connector.local + - ../env/staging/.env.kms-connector kms-connector-gw-listener: container_name: kms-connector-gw-listener @@ -19,7 +19,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.kms-connector.local + - ../env/staging/.env.kms-connector depends_on: kms-connector-db-migration: condition: service_completed_successfully @@ -35,7 +35,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.kms-connector.local + - ../env/staging/.env.kms-connector depends_on: kms-connector-db-migration: condition: service_completed_successfully @@ -51,7 +51,7 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.kms-connector.local + - ../env/staging/.env.kms-connector depends_on: kms-connector-db-migration: condition: service_completed_successfully diff --git a/test-suite/fhevm/docker-compose/minio-docker-compose.yml b/test-suite/fhevm/docker-compose/minio-docker-compose.yml index 1368c5e101..668195bf79 100644 --- a/test-suite/fhevm/docker-compose/minio-docker-compose.yml +++ b/test-suite/fhevm/docker-compose/minio-docker-compose.yml @@ -3,7 +3,7 @@ services: container_name: fhevm-minio image: quay.io/minio/minio env_file: - - ../env/staging/.env.minio.local + - ../env/staging/.env.minio ports: - "9000:9000" - "9001:9001" @@ -19,7 +19,7 @@ services: container_name: fhevm-minio-setup image: quay.io/minio/mc env_file: - - ../env/staging/.env.minio.local + - ../env/staging/.env.minio entrypoint: - /bin/sh - -c diff --git a/test-suite/fhevm/docker-compose/relayer-docker-compose.yml b/test-suite/fhevm/docker-compose/relayer-docker-compose.yml index c7b5fc7d7a..dd9cce3b66 100644 --- a/test-suite/fhevm/docker-compose/relayer-docker-compose.yml +++ b/test-suite/fhevm/docker-compose/relayer-docker-compose.yml @@ -4,7 +4,7 @@ services: platform: linux/amd64 image: ghcr.io/zama-ai/console/relayer:${RELAYER_VERSION} env_file: - - ../env/staging/.env.relayer.local + - ../env/staging/.env.relayer command: - /bin/server - --config-file=/app/config/local.yaml diff --git a/test-suite/fhevm/docker-compose/test-suite-docker-compose.yml b/test-suite/fhevm/docker-compose/test-suite-docker-compose.yml index d21879b879..caa0a2dd7b 100644 --- a/test-suite/fhevm/docker-compose/test-suite-docker-compose.yml +++ b/test-suite/fhevm/docker-compose/test-suite-docker-compose.yml @@ -2,7 +2,8 @@ services: test-suite-e2e-debug: container_name: fhevm-test-suite-e2e-debug - image: ghcr.io/zama-ai/fhevm/test-suite/e2e:${TEST_SUITE_VERSION} + # image: ghcr.io/zama-ai/fhevm/test-suite/e2e:${TEST_SUITE_VERSION} + image: local-e2e-test build: context: ../../.. # root directory of the repository dockerfile: test-suite/e2e/Dockerfile @@ -11,6 +12,6 @@ services: cache_to: - type=gha,mode=max env_file: - - ../env/staging/.env.test-suite.local + - ../env/staging/.env.test-suite command: - tail -f /dev/null diff --git a/test-suite/fhevm/env/staging/.env.coprocessor b/test-suite/fhevm/env/staging/.env.coprocessor index 4609ef0384..f8c4a82d74 100644 --- a/test-suite/fhevm/env/staging/.env.coprocessor +++ b/test-suite/fhevm/env/staging/.env.coprocessor @@ -7,7 +7,7 @@ POSTGRES_PASSWORD=postgres DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/coprocessor" # ============================================================================= -# API & AUTHENTICATION - SENSITIVE +# API & AUTHENTICATION - SENSITIVE # ============================================================================= # IMPORTANT: For testing only - move to secure storage in production TENANT_API_KEY=a1503fb6-d79b-4e9e-826d-44cf262f3e05 @@ -34,12 +34,12 @@ FHE_KEY_ID=421c8116661b2150a46badd3956564ad8d4981718d30fa66a36342bee1b13dbf # HOST NETWORK CONFIGURATION # ============================================================================= # host_listener uses RPC_WS_URL (ws/wss), poller uses RPC_HTTP_URL (http/https) -RPC_HTTP_URL=http://host-node:8545 -RPC_WS_URL=ws://host-node:8545 -CHAIN_ID=12345 -ACL_CONTRACT_ADDRESS=0x05fD9B5EFE0a996095f42Ed7e77c390810CF660c -INPUT_VERIFIER_ADDRESS=0x857Ca72A957920Fa0FB138602995839866Bd4005 -FHEVM_EXECUTOR_CONTRACT_ADDRESS=0xcCAe95fF1d11656358E782570dF0418F59fA40e1 +RPC_HTTP_URL=https://rpc-amoy.polygon.technology +RPC_WS_URL=wss://polygon-amoy.g.alchemy.com/v2/REPLACE_WITH_ALCHEMY_API_KEY +CHAIN_ID=80002 +ACL_CONTRACT_ADDRESS=REPLACE_WITH_DEPLOYED_ACL_ADDRESS +INPUT_VERIFIER_ADDRESS=REPLACE_WITH_DEPLOYED_INPUT_VERIFIER_ADDRESS +FHEVM_EXECUTOR_CONTRACT_ADDRESS=REPLACE_WITH_DEPLOYED_FHEVMEXECUTOR_ADDRESS # ============================================================================= # GATEWAY NETWORK CONFIGURATION - SENSITIVE diff --git a/test-suite/fhevm/env/staging/.env.gateway-sc b/test-suite/fhevm/env/staging/.env.gateway-sc index 458e42e2f1..3fbdca0d01 100644 --- a/test-suite/fhevm/env/staging/.env.gateway-sc +++ b/test-suite/fhevm/env/staging/.env.gateway-sc @@ -85,9 +85,9 @@ CUSTODIAN_ENCRYPTION_KEY_0="0xea8b8b710d770493a41b588808ea8e09d986561f73d5232277 NUM_HOST_CHAINS=1 # Host chain 1 -HOST_CHAIN_CHAIN_ID_0=12345 -HOST_CHAIN_FHEVM_EXECUTOR_ADDRESS_0=0xcCAe95fF1d11656358E782570dF0418F59fA40e1 -HOST_CHAIN_ACL_ADDRESS_0=0x05fD9B5EFE0a996095f42Ed7e77c390810CF660c +HOST_CHAIN_CHAIN_ID_0=80002 +HOST_CHAIN_FHEVM_EXECUTOR_ADDRESS_0=REPLACE_WITH_DEPLOYED_FHEVMEXECUTOR_ADDRESS +HOST_CHAIN_ACL_ADDRESS_0=REPLACE_WITH_DEPLOYED_ACL_ADDRESS HOST_CHAIN_NAME_0= HOST_CHAIN_WEBSITE_0= diff --git a/test-suite/fhevm/env/staging/.env.test-suite b/test-suite/fhevm/env/staging/.env.test-suite index 0959e8260a..4dc7845689 100644 --- a/test-suite/fhevm/env/staging/.env.test-suite +++ b/test-suite/fhevm/env/staging/.env.test-suite @@ -2,13 +2,13 @@ # WALLET CONFIGURATION - SENSITIVE # ============================================================================= # IMPORTANT: For testing only - move to secure storage in production -MNEMONIC=adapt mosquito move limb mobile illegal tree voyage juice mosquito burger raise father hope layer +MNEMONIC=REPLACE_WITH_MNEMONIC # ============================================================================= # NETWORK CONFIGURATION # ============================================================================= CHAIN_ID_GATEWAY=54321 -RPC_URL=http://host-node:8545 +RPC_URL=https://polygon-amoy.g.alchemy.com/v2/REPLACE_WITH_ALCHEMY_API_KEY # ============================================================================= # CONTRACT ADDRESSES @@ -21,12 +21,14 @@ INPUT_VERIFICATION_ADDRESS=0x1ceFA8E3F3271358218B52c33929Cf76078004c1 DECRYPTION_ORACLE_ADDRESS=0xD0fA6194Db6cfCDF733c64F1F272AeA66e968D3C ## Host -KMS_VERIFIER_CONTRACT_ADDRESS=0xa1880e99d86F081E8D3868A8C4732C8f65dfdB11 -ACL_CONTRACT_ADDRESS=0x05fD9B5EFE0a996095f42Ed7e77c390810CF660c -INPUT_VERIFIER_CONTRACT_ADDRESS=0x857Ca72A957920Fa0FB138602995839866Bd4005 -FHEVM_EXECUTOR_CONTRACT_ADDRESS=0xcCAe95fF1d11656358E782570dF0418F59fA40e1 +KMS_VERIFIER_CONTRACT_ADDRESS=REPLACE_WITH_DEPLOYED_KMSVERIFIER_ADDRESS +ACL_CONTRACT_ADDRESS=REPLACE_WITH_DEPLOYED_ACL_ADDRESS +INPUT_VERIFIER_CONTRACT_ADDRESS=REPLACE_WITH_DEPLOYED_INPUT_VERIFIER_ADDRESS +FHEVM_EXECUTOR_CONTRACT_ADDRESS=REPLACE_WITH_DEPLOYED_FHEVMEXECUTOR_ADDRESS # ============================================================================= # SERVICE ENDPOINTS # ============================================================================= -RELAYER_URL=http://fhevm-relayer:3000 \ No newline at end of file +RELAYER_URL=http://fhevm-relayer:3000 + +HARDHAT_NETWORK=staging \ No newline at end of file diff --git a/test-suite/fhevm/scripts/setup-kms-signer-address.sh b/test-suite/fhevm/scripts/setup-kms-signer-address.sh index 6dfba136c8..7a0854e7a3 100755 --- a/test-suite/fhevm/scripts/setup-kms-signer-address.sh +++ b/test-suite/fhevm/scripts/setup-kms-signer-address.sh @@ -23,7 +23,7 @@ log_error() { SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" BASE_URL="http://localhost:9000/kms-public/PUB/VerfAddress" ENV_HOST="${SCRIPT_DIR}/../env/staging/.env.host-sc.local" -ENV_GATEWAY="${SCRIPT_DIR}/../env/staging/.env.gateway-sc.local" +ENV_GATEWAY="${SCRIPT_DIR}/../env/staging/.env.gateway-sc" KEY_SIGNER_ID=$(docker logs kms-core | grep "Successfully stored public server signing key under the handle" | sed 's/.*handle \([^ ]*\).*/\1/') SIGNER_ADDRESS_URL="$BASE_URL/$KEY_SIGNER_ID"