Skip to content

Commit e1734b9

Browse files
authored
feat(coprocessor): slow lane for dependent ops (#1907)
* feat(coprocessor): throttle dependent ops * feat(coprocessor): slow lane for dependent ops * refactor(coprocessor): decide slow lane per chain * Count dependent ops on insert * refactor(coprocessor): add schedule lane enum * feat(coprocessor): per-caller dependent ops limiter * feat(coprocessor): weight dependent ops by cost * feat(coprocessor): add per-chain caps * refactor(coprocessor): rename schedule lane to priority * feat(coprocessor): make priority continuous * fix(tfhe-worker): keep slow-lane priority monotonic * feat(host-listener): align op weights with HCU * refactor: make schedule priority binary * refactor(host-listener): drop distinct-caller cap * refactor(host-listener): remove per-caller limiter * refactor(host-listener): simplify slow-lane inputs * refactor(host-listener): remove unused tfhe_caller * refactor(host-listener): widen dependent ops counters * fix(host-listener): harden slow-lane disable path * fix(host-listener): bound slow-priority reset load in off mode * refactor(host-listener): simplify off-mode to promote seen chains * chore(charts): expose dependent ops cap in coprocessor values * fix(coprocessor): bump chart and simplify slow-lane op weights * refactor(host-listener): use unweighted dependent-op caps * chore(coprocessor): refresh sqlx cache after rebase * test(coprocessor): add contention e2e and chart guard * test(host-listener): simplify slow-lane scenario fixtures * docs(host-listener): add local slow-lane validation runbook * test(host-listener): harden slow-lane local validation * refactor(host-listener): clarify slow-lane naming * chore(host-listener): add auditable slow-lane validation runbook * test-suite: harden slow-lane validator bootstrap checks * test(host-listener): make slow-lane local validation deterministic * fix(tfhe-worker): preserve fast-lane order in early lock * refactor(host-listener): simplify slow-lane ingest classification * test(host-listener): assert schedule-priority migration contract * refactor(host-listener): use set-based slow-chain classification * refactor(host-listener): drop dependent-op counters and simplify classification * feat(host-listener): add lane-level queue and marking metrics * refactor(host-listener): drop lane queue DB metrics from hot path * fix(tfhe-worker): add starvation escape hatch and trim validation docs * refactor(host-listener): use explicit expect for metric registration * fix(host-listener): inherit slow lane from slow parent chains * refactor(slow-lane): tighten priority typing and cleanup * refactor(slow-lane): remove unused priority TryFrom * refactor(host-listener): use eager slow-lane reset in off mode * fix(host-listener): guard eager reset with advisory lock * fix(host-listener): block on eager reset advisory lock * docs(host-listener): add slow-lane testnet incident runbook * refactor(tfhe-worker): simplify fallback by making early lock lane-agnostic * docs(host-listener): switch slow-lane runbook to metrics/logs gates * refactor(host-listener): use sqlx query! for slow-lane DB helpers * fix(host-listener): use execute for advisory lock query * test(host-listener): add slow-lane inheritance and monotonicity coverage * perf(host-listener): batch off-mode slow-lane promotion * feat(host-listener): use inheritance-only parent metadata for slow lane * refactor(host-listener): dedupe slow-parent ids in DB helper * Revert "refactor(host-listener): dedupe slow-parent ids in DB helper" This reverts commit a9c181e. * docs(host-listener): clarify off-mode batched startup promotion * docs(host-listener): clarify inheritance_parents is ingest-only * test(host-listener): remove stale chain-id test and stabilize reorg assertions * fix(host-listener): resolve rebase regressions in imports and test DB init * fix(charts): bump coprocessor chart version to 0.8.1 * chore(host-listener): drop out-of-scope schedule_order extraction Also fix clippy checked_conversions in chain_id for pre-commit. * docs(host-listener): clarify dependent-ops cap semantics and tuning * fix(host-listener): count all dependent ops for slow-lane cap Drop is_allowed filter to avoid undercounting required producer ops. * docs(host-listener): clarify non-allowed ops can still be required * docs(host-listener): make slow-lane flag section concise * docs(host-listener): trim slow-lane runbook and local notes * fix(host-listener): count all inserted ops for slow-lane cap Use inserted-only per-chain counting to avoid underestimating required producer pressure. * test(host-listener): align slow-lane threshold matrix with inserted-only counting * feat(host-listener): account slow-lane over split dependency closures Keep no_fork parallelism, but aggregate inserted-op pressure over split dependency closures for slow-lane classification. * docs(host-listener): clarify split-closure slow-lane classifier * docs(host-listener): simplify split-dependency classifier comment * refactor(host-listener): namespace slow-lane advisory lock by chain * refactor(host-listener): remove cached chain_id label from Database * refactor(host-listener): simplify inserted-op counter update
1 parent 5b381fb commit e1734b9

27 files changed

+1434
-69
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.8.0
3+
version: 0.8.1
44
apiVersion: v2
55
keywords:
66
- fhevm

charts/coprocessor/templates/coprocessor-host-listener-catchup-only-deployment.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ spec:
4747
image: {{ .Values.hostListenerCatchupOnly.image.name }}:{{ .Values.hostListenerCatchupOnly.image.tag }}
4848
command: ["host_listener"]
4949
args:
50-
{{ toYaml .Values.hostListenerCatchupOnly.args | nindent 12 }}
50+
{{- range $arg := .Values.hostListenerCatchupOnly.args }}
51+
{{- if not (hasPrefix "--dependent-ops-max-per-chain=" $arg) }}
52+
- {{ $arg | quote }}
53+
{{- end }}
54+
{{- end }}
55+
- --dependent-ops-max-per-chain={{ int .Values.dependentOps.maxPerChain }}
5156
env:
5257
{{ toYaml .Values.hostListenerCatchupOnly.env | nindent 12 }}
5358
ports:

charts/coprocessor/templates/coprocessor-host-listener-deployment.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ spec:
4747
image: {{ .Values.hostListener.image.name }}:{{ .Values.hostListener.image.tag }}
4848
command: ["host_listener"]
4949
args:
50-
{{ toYaml .Values.hostListener.args | nindent 12 }}
50+
{{- range $arg := .Values.hostListener.args }}
51+
{{- if not (hasPrefix "--dependent-ops-max-per-chain=" $arg) }}
52+
- {{ $arg | quote }}
53+
{{- end }}
54+
{{- end }}
55+
- --dependent-ops-max-per-chain={{ int .Values.dependentOps.maxPerChain }}
5156
env:
5257
{{ toYaml .Values.hostListener.env | nindent 12 }}
5358
ports:

charts/coprocessor/templates/coprocessor-host-listener-poller-deployment.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ spec:
4747
image: {{ .Values.hostListenerPoller.image.name }}:{{ .Values.hostListenerPoller.image.tag }}
4848
command: ["host_listener_poller"]
4949
args:
50-
{{ toYaml .Values.hostListenerPoller.args | nindent 12 }}
50+
{{- range $arg := .Values.hostListenerPoller.args }}
51+
{{- if not (hasPrefix "--dependent-ops-max-per-chain=" $arg) }}
52+
- {{ $arg | quote }}
53+
{{- end }}
54+
{{- end }}
55+
- --dependent-ops-max-per-chain={{ int .Values.dependentOps.maxPerChain }}
5156
env:
5257
{{ toYaml .Values.hostListenerPoller.env | nindent 12 }}
5358
ports:

charts/coprocessor/values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# =============================================================================
22
# FHEVM Coprocessor Configuration
33
# =============================================================================
4+
5+
# -----------------------------------------------------------------------------
6+
# Shared host-listener dependence settings (applies to all HL types)
7+
# -----------------------------------------------------------------------------
8+
dependentOps:
9+
# Max dependent ops per chain per ingested block before slow-lane.
10+
# 0 disables slow-lane decisions.
11+
maxPerChain: 0
412
# This chart deploys the FHEVM coprocessor components including:
513
# - Configuration setup
614
# - Database migration
@@ -135,6 +143,7 @@ hostListener:
135143
# - --dependence-cache-size=10000
136144
# - --dependence-by-connexity # Whether to build connected components or linear chains (default no)
137145
# - --dependence-cross-block # Do chains cross L1 block boundaries (default yes)
146+
# --dependent-ops-max-per-chain is injected from dependentOps.maxPerChain
138147

139148
### Catchup parameters (optional)
140149
# - --catchup-margin
@@ -247,6 +256,7 @@ hostListenerPoller:
247256
# - --dependence-cache-size=10000
248257
# - --dependence-by-connexity # Whether to build connected components or linear chains (default no)
249258
# - --dependence-cross-block # Do chains cross L1 block boundaries (default yes)
259+
# --dependent-ops-max-per-chain is injected from dependentOps.maxPerChain
250260

251261
# Service ports configuration
252262
ports:
@@ -342,6 +352,7 @@ hostListenerCatchupOnly:
342352
# - --start-at-block # To catch up from a specific block
343353
# - --catchup-margin
344354
# - --catchup-paging
355+
# --dependent-ops-max-per-chain is injected from dependentOps.maxPerChain
345356

346357
# Service ports configuration
347358
ports:

coprocessor/fhevm-engine/.sqlx/query-193e44bce47bd04357a3e86a707c63c35621140ab5ed044d895f480f2ef90d71.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

coprocessor/fhevm-engine/.sqlx/query-5e688c149b2b6ef8058c825005d732d7cc4de56aa53a2d9db77c0cef1766a420.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coprocessor/fhevm-engine/.sqlx/query-d85f9e81a8049c2f66534f9e7a9c5b8900bedd9785fd4da3629978df3b589230.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coprocessor/fhevm-engine/.sqlx/query-e6783de9bead8fc13c6954369740763df1e7ae2a98aa0495b4245960b9a1bbfc.json

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coprocessor/fhevm-engine/.sqlx/query-eee88ff2cfe1661d1253970efd6962cf97d815b0812b0f704396e9f8500eb9f8.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)