Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test-suite/e2e/test/pausedProtocol/pausedGateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Paused gateway', function () {
);
inputAlice.add64(18446744073709550042n);

await expect(inputAlice.encrypt()).to.be.rejectedWith(new RegExp('Input request failed'));
await expect(inputAlice.encrypt()).to.be.rejectedWith(new RegExp('Could not estimate gas'));
});

// The following test case should cover the Decryption.userDecryptionRequest method calling.
Expand Down
106 changes: 89 additions & 17 deletions test-suite/fhevm/config/relayer/local.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,72 @@
environment: development

gateway:
blockchain_rpc:
ws_url: "ws://localhost:8757"
http_url: "http://localhost:8757"
chain_id: 654321
ws_health_check_timeout_secs: 5
http_health_check_timeout_secs: 5
listener:
# Optional: set the starting block number for event subscriptions
# last_block_number: null
ws_reconnect_config:
max_attempts: 20
retry_interval_ms: 500
# Number of parallel listener instances (1-3)
listener_instances: 3
# TTL for event deduplication cache in seconds (1-10)
dedup_ttl_seconds: 5
dedup_max_capacity: 100000
tx_engine:
private_key: GATEWAY_PRIVATE_KEY
max_concurrency: 100
retry:
max_attempts: 100
retry_interval_ms: 500
tx_throttlers:
input_proof:
per_seconds: 20
capacity: 11000
safety_margin: 1000
user_decrypt:
per_seconds: 20
capacity: 11000
safety_margin: 1000
public_decrypt:
per_seconds: 20
capacity: 11000
safety_margin: 1000
readiness_checker:
max_concurrency: 100
retry:
max_attempts: 30
# The time is treated as seconds in code, even the config name has _ms suffix.
# This will be fixed in next rc, until then treat the value as seconds.
retry_interval_ms: 2
retry_interval_ms: 5000
public_decrypt:
max_concurrency: 250
capacity: 11000
safety_margin: 1000
user_decrypt:
max_concurrency: 250
capacity: 11000
safety_margin: 1000
contracts:
decryption_address: "0xB8Ae44365c45A7C5256b14F607CaE23BC040c354"
input_verification_address: "0xE61cff9C581c7c91AEF682c2C10e8632864339ab"
user_decrypt_shares_threshold: 9
log:

format: "compact" # compact, pretty, or json
show_file_line: true
show_thread_ids: true
show_timestamp: true
show_target: true

keyurl:
fhe_public_key:
data_id: "fhe-public-key-data-id"
url: "http://0.0.0.0:3001/publicKey.bin"
crs:
data_id: "crs-data-id"
url: "http://0.0.0.0:3001/crs2048.bin"

http:
endpoint: "0.0.0.0:3000"
Expand All @@ -27,20 +76,43 @@ http:
retry_after_seconds: 5
jitter_max_ms: 2000
metrics:
histogram_buckets: [0, 0.5, 1, 1.25, 1.5, 1.75, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 25, 30]

log:
format: "compact"
show_file_line: true
show_thread_ids: false
show_timestamp: true
show_target: true
histogram_buckets: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 40]
api_retry_after_seconds: 4


metrics:
endpoint: "0.0.0.0:9898"
query_duration_histogram_bucket: [0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0]
pool_wait_duration_seconds_histogram_bucket: [0.0001, 0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1.0, 3.0]
request_status_duration_histogram_bucket: [0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0, 30.0, 60.0, 300.0, 600.0, 1800.0, 3600.0]
transaction_duration_secs_histogram_bucket: [0.01, 0.1, 0.25, 0.50, 0.75, 1.0, 1.25, 1.5, 2.0, 5.0, 10.0]

storage:
db_path_rocksdb: "./.database"

development:
verbose_errors: true
sql_database_url: "postgresql://postgres:postgres@localhost:5433/relayer_db"
app_pool:
max_connections: 10
min_connections: 2
acquire_timeout_secs: 10
idle_timeout_secs: 300
max_lifetime_secs: 900
cron_pool:
max_connections: 5
min_connections: 1
acquire_timeout_secs: 30
idle_timeout_secs: 600
max_lifetime_secs: 1800
sql_health_check_timeout_secs: 5
cron:
# 60s for interval check
timeout_cron_interval: "60s"
# 30 mins timeout logic
public_decrypt_timeout: "30m"
user_decrypt_timeout: "30m"
input_proof_timeout: "30m"
# 1 hour interval for cleanup check
expiry_cron_interval: "5m"
# Retention Policies
public_decrypt_expiry: "365d" # 1 year
user_decrypt_expiry: "7d"
input_proof_expiry: "7d"
cron_startup_delay_after_recovery: "30s"
40 changes: 40 additions & 0 deletions test-suite/fhevm/docker-compose/relayer-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
services:
relayer-db:
container_name: fhevm-relayer-db
platform: linux/amd64
image: postgres:17
environment:
POSTGRES_DB: relayer_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
ports:
- "5433:5432"
volumes:
- relayer_postgres_data:/var/lib/postgresql/data

relayer-db-migration:
container_name: relayer-db-migration
platform: linux/amd64
image: ghcr.io/zama-ai/console/relayer-migrate:${RELAYER_MIGRATE_VERSION}
env_file:
- ../env/staging/.env.relayer.local
command:
- /bin/server
ports:
- "3001:3001"
depends_on:
relayer-db:
condition: service_healthy

relayer:
container_name: fhevm-relayer
platform: linux/amd64
Expand All @@ -12,3 +44,11 @@ services:
- ../config/relayer/local.yaml:/app/config/local.yaml
ports:
- "3000:3000"
depends_on:
relayer-db:
condition: service_healthy
relayer-db-migration:
condition: service_started

volumes:
relayer_postgres_data:
12 changes: 11 additions & 1 deletion test-suite/fhevm/env/staging/.env.relayer
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# =============================================================================
# DATABASE CONFIGURATION - SENSITIVE
# =============================================================================
# IMPORTANT: For testing only - move to secure storage in production
DATABASE_URL=postgres://postgres:postgres@relayer-db:5432/relayer_db
MAX_ATTEMPTS=20

# =============================================================================
# WALLET CONFIGURATION - SENSITIVE
# =============================================================================
Expand All @@ -21,4 +28,7 @@ APP_GATEWAY__CONTRACTS__DECRYPTION_ADDRESS=0x35760912360E875DA50D40a74305575c23D
APP_GATEWAY__CONTRACTS__INPUT_VERIFICATION_ADDRESS=0x1ceFA8E3F3271358218B52c33929Cf76078004c1
APP_GATEWAY__CONTRACTS__USER_DECRYPT_SHARES_THRESHOLD=1

RUST_LOG=info
# Storage configuration:
APP_STORAGE__SQL_DATABASE_URL=postgres://postgres:postgres@relayer-db:5432/relayer_db

RUST_LOG=debug
3 changes: 2 additions & 1 deletion test-suite/fhevm/fhevm-cli
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export HOST_VERSION=${HOST_VERSION:-"v0.10.5"}

# Other services.
export CORE_VERSION=${CORE_VERSION:-"v0.12.7"}
export RELAYER_VERSION=${RELAYER_VERSION:-"v0.6.0"}
export RELAYER_VERSION=${RELAYER_VERSION:-"v0.8.4"}
export RELAYER_MIGRATE_VERSION=${RELAYER_MIGRATE_VERSION:-"v0.8.3"}
# Test-suite docker image cannot be updated with 0.10.x releases because of the introduction a
# breaking change in delegate user decryption tests in https://github.com/zama-ai/fhevm/pull/1092
export TEST_SUITE_VERSION=${TEST_SUITE_VERSION:-"1c70735"}
Expand Down
Loading