Skip to content

Commit 93ff633

Browse files
committed
chore(coprocessor): update config for gw-listener and txn-sender
Update default values in both Rust code and the charts. Namely, make retries for stuff that is supposed to eventually succeed to practically infinite. Also, add all missing parameters in the chart file for gw-listener and txn-sender. In general, update default values to more sensible ones for prod.
1 parent f5040fb commit 93ff633

File tree

7 files changed

+140
-112
lines changed

7 files changed

+140
-112
lines changed

charts/coprocessor/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: coprocessor
22
description: A helm chart to distribute and deploy Zama fhevm Co-Processor services
3-
version: 0.6.2
3+
version: 0.7.0
44
apiVersion: v2
55
keywords:
66
- fhevm

charts/coprocessor/values.yaml

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,21 @@ gwListener:
234234
# Command line arguments for the gateway listener
235235
args:
236236
- --database-url=$(DATABASE_URL)
237+
- --database-pool-size=16
238+
- --verify-proof-req-database-channel=event_zkpok_new_work
237239
- --gw-url=ws://gateway-rpc-node:8548
238240
- --input-verification-address=$(INPUT_VERIFICATION_ADDRESS)
239-
- --verify-proof-req-database-channel="event_zkpok_new_work"
240-
- --database-pool-size=16
241+
- --kms-generation-address=$(KMS_GENERATION_ADDRESS)
241242
- --error-sleep-initial-secs=1
242243
- --error-sleep-max-secs=10
244+
- --health-check-port=8080
245+
- --metrics-addr=0.0.0.0:9100
246+
- --provider-max-retries=4294967295
247+
- --provider-retry-interval=4s
248+
- --log-level=INFO
243249
- --get-logs-poll-interval=1s
244250
- --get-logs-block-batch-size=100
245-
# NEW ARG: KMS generation contract address
246-
- --kms-generation-address=$(KMS_GENERATION_ADDRESS)
251+
- --service-name=gw-listener
247252
### Catchup parameters (optional)
248253
# --catchup-kms-generation-from-block BLOCK_NUMBER
249254
# To go back in time from latest block
@@ -456,8 +461,8 @@ zkProofWorker:
456461
# Command line arguments for ZK proof worker
457462
args:
458463
- --database-url=$(DATABASE_URL)
459-
- --pg-listen-channel="event_zkpok_new_work"
460-
- --pg-notify-channel="event_zkpok_computed"
464+
- --pg-listen-channel=event_zkpok_new_work
465+
- --pg-notify-channel=event_zkpok_computed
461466
- --pg-polling-interval=5
462467
- --pg-pool-connections=5
463468
- --pg-timeout=15s
@@ -694,24 +699,59 @@ txSender:
694699
key: coprocessor-db-url
695700
- name: TX_SENDER_PRIVATE_KEY
696701
value: "0x8f82b3f482c19a95ac29c82cf048c076ed0de2530c64a73f2d2d7d1e64b5cc6e"
697-
- name: ZKPOK_MANAGER_ADDRESS
702+
- name: INPUT_VERIFICATION_ADDRESS
698703
valueFrom:
699704
configMapKeyRef:
700705
name: gateway-sc-addresses
701-
key: zkpok_manager.address
702-
- name: CIPHERTEXT_STORAGE_ADDRESS
706+
key: input_verification.address
707+
- name: CIPHERTEXT_COMMITS_ADDRESS
703708
valueFrom:
704709
configMapKeyRef:
705710
name: gateway-sc-addresses
706-
key: fhevm.address
711+
key: ciphertext_commits.address
712+
- name: MULTICHAIN_ACL_ADDRESS
713+
valueFrom:
714+
configMapKeyRef:
715+
name: gw-sc-addresses
716+
key: multichain_acl.address
707717

708718
# Command line arguments for transaction sender
709719
args:
710-
- --database-url=$(DATABASE_URL)
711-
- --gateway-url=http://gateway-anvil-node:8546
720+
- --input-verification-address=$(INPUT_VERIFICATION_ADDRESS)
721+
- --ciphertext-commits-address=$(CIPHERTEXT_COMMITS_ADDRESS)
722+
- --multichain-acl-address=$(MULTICHAIN_ACL_ADDRESS)
723+
- --gateway-url=ws://gateway-rpc-node:8548
724+
- --signer-type=private-key
712725
- --private-key=$(TX_SENDER_PRIVATE_KEY)
713-
- --zkpok-manager-address=$(ZKPOK_MANAGER_ADDRESS)
714-
- --ciphertext-storage-address=$(CIPHERTEXT_STORAGE_ADDRESS)
726+
- --database-url=$(DATABASE_URL)
727+
- --database-pool-size=10
728+
- --database-polling-interval-secs=1
729+
- --verify-proof-resp-database-channel=event_zkpok_computed
730+
- --add-ciphertexts-database-channel=event_ciphertexts_uploaded
731+
- --allow-handle-database-channel=event_allowed_handle
732+
- --verify-proof-resp-batch-limit=128
733+
- --verify-proof-resp-max-retries=6
734+
- --verify-proof-remove-after-max-retries
735+
- --add-ciphertexts-batch-limit=10
736+
- --allow-handle-batch-limit=10
737+
- --allow-handle-max-retries=4294967295
738+
- --add-ciphertexts-max-retries=4294967295
739+
- --error-sleep-initial-secs=1
740+
- --error-sleep-max-secs=300
741+
- --txn-receipt-timeout-secs=10
742+
- --required-txn-confirmations=0
743+
- --review-after-unlimited-retries=30
744+
- --provider-max-retries=4294967295
745+
- --provider-retry-interval=4s
746+
- --health-check-port=8080
747+
- --metrics-addr=0.0.0.0:9100
748+
- --health-check-timeout=4s
749+
- --log-level=INFO
750+
- --gas-limit-overprovision-percent=120
751+
- --graceful-shutdown-timeout=8s
752+
- --service-name=txn-sender
753+
- --metric-host-txn-latency=0.1:60.0:0.1
754+
- --metric-zkproof-txn-latency=0.1:60.0:0.1
715755

716756
# Service ports configuration
717757
ports:

coprocessor/README.md

Lines changed: 57 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -145,81 +145,47 @@ Options:
145145

146146
```bash
147147
$ gw_listener --help
148-
Usage: gw_listener [OPTIONS] --gw-url <GW_URL> --input-verification-address <INPUT_VERIFICATION_ADDRESS> --kms-management-address <KMS_MANAGEMENT_ADDRESS>
148+
Usage: gw_listener [OPTIONS] --gw-url <GW_URL> --input-verification-address <INPUT_VERIFICATION_ADDRESS> --kms-generation-address <KMS_GENERATION_ADDRESS>
149149

150150
Options:
151151
--database-url <DATABASE_URL>
152+
152153
--database-pool-size <DATABASE_POOL_SIZE>
153154
[default: 16]
154155
--verify-proof-req-database-channel <VERIFY_PROOF_REQ_DATABASE_CHANNEL>
155-
[default: verify_proof_requests]
156+
[default: event_zkpok_new_work]
156157
--gw-url <GW_URL>
158+
157159
-i, --input-verification-address <INPUT_VERIFICATION_ADDRESS>
158-
--kms-management-address <KMS_MANAGEMENT_ADDRESS>
160+
161+
--kms-generation-address <KMS_GENERATION_ADDRESS>
162+
159163
--error-sleep-initial-secs <ERROR_SLEEP_INITIAL_SECS>
160164
[default: 1]
161165
--error-sleep-max-secs <ERROR_SLEEP_MAX_SECS>
162166
[default: 10]
163-
--catchup-kms-generation-from-block <BLOCK_NUMBER OR -BLOCKS_BACK>
164-
[default: None]
165-
-h, --help
166-
Print help
167-
-V, --version
168-
Print version
169-
```
170-
171-
For more info, please check [gw-listener README](fhevm-engine/gw-listener/README.md)
172-
173-
##### sns-worker
174-
175-
```bash
176-
$ sns_worker --help
177-
Usage: sns_worker [OPTIONS] --pg-listen-channel <PG_LISTEN_CHANNEL> --pg-notify-channel <PG_NOTIFY_CHANNEL>
178-
179-
Options:
180-
--work-items-batch-size <WORK_ITEMS_BATCH_SIZE>
181-
Work items batch size [default: 4]
182-
--pg-listen-channel <PG_LISTEN_CHANNEL>
183-
NOTIFY/LISTEN channel for database that the worker listen to
184-
--pg-notify-channel <PG_NOTIFY_CHANNEL>
185-
NOTIFY/LISTEN channel for database that the worker notify to
186-
--pg-polling-interval <PG_POLLING_INTERVAL>
187-
Polling interval in seconds [default: 60]
188-
--pg-pool-connections <PG_POOL_CONNECTIONS>
189-
Postgres pool connections [default: 10]
190-
--database-url <DATABASE_URL>
191-
Postgres database url. If unspecified DATABASE_URL environment variable is used
192-
--keys-file-path <KEYS_FILE_PATH>
193-
KeySet file. If unspecified the the keys are read from the database (not implemented)
167+
--health-check-port <HEALTH_CHECK_PORT>
168+
[default: 8080]
169+
--metrics-addr <METRICS_ADDR>
170+
Prometheus metrics server address [default: 0.0.0.0:9100]
171+
--health-check-timeout <HEALTH_CHECK_TIMEOUT>
172+
[default: 4s]
173+
--provider-max-retries <PROVIDER_MAX_RETRIES>
174+
[default: 4294967295]
175+
--provider-retry-interval <PROVIDER_RETRY_INTERVAL>
176+
[default: 4s]
177+
--log-level <LOG_LEVEL>
178+
[default: INFO]
179+
--host-chain-id <HOST_CHAIN_ID>
180+
181+
--get-logs-poll-interval <GET_LOGS_POLL_INTERVAL>
182+
[default: 1s]
183+
--get-logs-block-batch-size <GET_LOGS_BLOCK_BATCH_SIZE>
184+
[default: 100]
194185
--service-name <SERVICE_NAME>
195-
sns-executor service name in OTLP traces (not implemented) [default: sns-executor]
196-
-h, --help
197-
Print help
198-
-V, --version
199-
Print version
200-
```
201-
202-
##### zkproof-worker
203-
204-
```bash
205-
$ zkproof_worker --help
206-
Usage: zkproof_worker [OPTIONS]
207-
208-
Options:
209-
-d, --database-url <DATABASE_URL>
210-
211-
--database-pool-size <DATABASE_POOL_SIZE>
212-
[default: 10]
213-
--database-polling-interval-secs <DATABASE_POLLING_INTERVAL_SECS>
214-
[default: 5]
215-
-v, --verify-proof-req-database-channel <VERIFY_PROOF_REQ_DATABASE_CHANNEL>
216-
[default: verify_proof_resquests]
217-
-t, --tokio-blocking-threads <TOKIO_BLOCKING_THREADS>
218-
[default: 16]
219-
--error-sleep-initial-secs <ERROR_SLEEP_INITIAL_SECS>
220-
[default: 1]
221-
--error-sleep-max-secs <ERROR_SLEEP_MAX_SECS>
222-
[default: 10]
186+
gw-listener service name in OTLP traces [default: gw-listener]
187+
--catchup-kms-generation-from-block <CATCHUP_KMS_GENERATION_FROM_BLOCK>
188+
Can be negative from last processed block
223189
-h, --help
224190
Print help
225191
-V, --version
@@ -250,37 +216,59 @@ Options:
250216
--database-pool-size <DATABASE_POOL_SIZE>
251217
[default: 10]
252218
--database-polling-interval-secs <DATABASE_POLLING_INTERVAL_SECS>
253-
[default: 5]
219+
[default: 1]
254220
--verify-proof-resp-database-channel <VERIFY_PROOF_RESP_DATABASE_CHANNEL>
255-
[default: verify_proof_responses]
221+
[default: event_zkpok_computed]
256222
--add-ciphertexts-database-channel <ADD_CIPHERTEXTS_DATABASE_CHANNEL>
257-
[default: add_ciphertexts]
223+
[default: event_ciphertexts_uploaded]
258224
--allow-handle-database-channel <ALLOW_HANDLE_DATABASE_CHANNEL>
259225
[default: event_allowed_handle]
260226
--verify-proof-resp-batch-limit <VERIFY_PROOF_RESP_BATCH_LIMIT>
261227
[default: 128]
262228
--verify-proof-resp-max-retries <VERIFY_PROOF_RESP_MAX_RETRIES>
263-
[default: 3]
229+
[default: 6]
264230
--verify-proof-remove-after-max-retries
265231

266232
--add-ciphertexts-batch-limit <ADD_CIPHERTEXTS_BATCH_LIMIT>
267233
[default: 10]
268234
--allow-handle-batch-limit <ALLOW_HANDLE_BATCH_LIMIT>
269235
[default: 10]
270236
--allow-handle-max-retries <ALLOW_HANDLE_MAX_RETRIES>
271-
[default: 10]
237+
[default: 4294967295]
272238
--add-ciphertexts-max-retries <ADD_CIPHERTEXTS_MAX_RETRIES>
273-
[default: 15]
239+
[default: 4294967295]
274240
--error-sleep-initial-secs <ERROR_SLEEP_INITIAL_SECS>
275241
[default: 1]
276242
--error-sleep-max-secs <ERROR_SLEEP_MAX_SECS>
277-
[default: 16]
243+
[default: 300]
278244
--txn-receipt-timeout-secs <TXN_RECEIPT_TIMEOUT_SECS>
279245
[default: 10]
280246
--required-txn-confirmations <REQUIRED_TXN_CONFIRMATIONS>
281247
[default: 0]
282248
--review-after-unlimited-retries <REVIEW_AFTER_UNLIMITED_RETRIES>
283249
[default: 30]
250+
--provider-max-retries <PROVIDER_MAX_RETRIES>
251+
[default: 4294967295]
252+
--provider-retry-interval <PROVIDER_RETRY_INTERVAL>
253+
[default: 4s]
254+
--health-check-port <HEALTH_CHECK_PORT>
255+
[default: 8080]
256+
--metrics-addr <METRICS_ADDR>
257+
Prometheus metrics server address [default: 0.0.0.0:9100]
258+
--health-check-timeout <HEALTH_CHECK_TIMEOUT>
259+
[default: 4s]
260+
--log-level <LOG_LEVEL>
261+
[default: INFO]
262+
--gas-limit-overprovision-percent <GAS_LIMIT_OVERPROVISION_PERCENT>
263+
[default: 120]
264+
--graceful-shutdown-timeout <GRACEFUL_SHUTDOWN_TIMEOUT>
265+
[default: 8s]
266+
--service-name <SERVICE_NAME>
267+
service name in OTLP traces [default: txn-sender]
268+
--metric-host-txn-latency <METRIC_HOST_TXN_LATENCY>
269+
Prometheus metrics: coprocessor_host_txn_latency_seconds [default: 0.1:60.0:0.1]
270+
--metric-zkproof-txn-latency <METRIC_ZKPROOF_TXN_LATENCY>
271+
Prometheus metrics: coprocessor_zkproof_txn_latency_seconds [default: 0.1:60.0:0.1]
284272
-h, --help
285273
Print help
286274
-V, --version

coprocessor/fhevm-engine/gw-listener/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The **gw-listener** service listens for events from the GW and dispatches them t
66

77
**gw-listener** listens for input proof verification events from the InputVerification contract and inserts them into the DB into the `verify_proofs` table.
88

9-
The gw-listener will notify **zkproof-worker** services that work is available over the `verify_proof_requests` DB channel (configurable, but this is the default one).
9+
The gw-listener will notify **zkproof-worker** services that work is available over the `event_zkpok_new_work` DB channel (configurable, but this is the default one).
1010

1111
Once a ZK proof request is verified, a zkproof-worker should set:
1212
* `verified = true or false`

coprocessor/fhevm-engine/gw-listener/src/bin/gw_listener.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ struct Conf {
2020
#[arg(long)]
2121
database_url: Option<String>,
2222

23-
#[arg(long, default_value = "16")]
23+
#[arg(long, default_value_t = 16)]
2424
database_pool_size: u32,
2525

26-
#[arg(long, default_value = "verify_proof_requests")]
26+
#[arg(long, default_value = "event_zkpok_new_work")]
2727
verify_proof_req_database_channel: String,
2828

2929
#[arg(long)]
@@ -35,10 +35,10 @@ struct Conf {
3535
#[arg(long)]
3636
kms_generation_address: Address,
3737

38-
#[arg(long, default_value = "1")]
38+
#[arg(long, default_value_t = 1)]
3939
error_sleep_initial_secs: u16,
4040

41-
#[arg(long, default_value = "10")]
41+
#[arg(long, default_value_t = 10)]
4242
error_sleep_max_secs: u16,
4343

4444
#[arg(long, default_value_t = 8080)]
@@ -51,7 +51,7 @@ struct Conf {
5151
#[arg(long, default_value = "4s", value_parser = parse_duration)]
5252
health_check_timeout: Duration,
5353

54-
#[arg(long, default_value = "1000000")]
54+
#[arg(long, default_value_t = u32::MAX)]
5555
provider_max_retries: u32,
5656

5757
#[arg(long, default_value = "4s", value_parser = parse_duration)]

0 commit comments

Comments
 (0)