Skip to content

fix(nitro-worker): retry registration instead of crashlooping - #973

Merged
piohei merged 4 commits into
mainfrom
fix/nitro-auto-register-not-fatal
Aug 5, 2026
Merged

fix(nitro-worker): retry registration instead of crashlooping#973
piohei merged 4 commits into
mainfrom
fix/nitro-auto-register-not-fatal

Conversation

@0xOsiris

@0xOsiris 0xOsiris commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Note

Medium Risk
Changes nitro worker startup and L1 registration behavior when auto-register is enabled; misconfiguration could delay job leasing but avoids taking work with an unregistered enclave key.

Overview
Nitro worker --auto-register no longer exits on the first registration failure. Registration runs through a new register_with_retry path using unbounded, jittered exponential backoff (5s–300s) via backon, so transient or operator-fixable issues (unfunded key, PCR not approved, L1 down) keep the pod Running instead of CrashLoopBackOff.

The worker still does not lease proof jobs until on-chain registration succeeds; shutdown during the retry loop (Ctrl-C) exits cleanly without starting the worker. Shared metrics add enclave_key.registered (initialized to 0 before the first attempt) and enclave_key.registration_attempts by outcome (registered, already_registered, failed). Unit tests lock in unbounded retry and delay ceiling behavior for the backoff builder.

Reviewed by Cursor Bugbot for commit 0d775ab. Configure here.

`--auto-register` treated on-chain registration as a startup gate: any failure propagated
out of `run()` and exited the process. Every way registration can fail — PCR set not yet
approved, registration key unfunded, L1 unreachable, certificate chain not yet verifiable —
is a condition an operator resolves while the worker is running, so exiting turns all of
them into CrashLoopBackOff.

Worse, it destroys the path needed to fix them: `just proof-get-attestation`,
`proof-certmanager-prewarm` and `proof-register-key` all exec into the container and
require it to be in `Running` state. The failure blocked its own remedy — observed on
alphanet as 34 restarts with no way to inspect the enclave.

Registration now retries on a `backon` exponential backoff (5s → 5m, jittered, unbounded),
raced against ctrl-c so a pod being rolled does not wait out a full interval. The worker
stays up, keeps serving metrics, and simply does not lease proof jobs until the key is
registered — proofs signed by an unregistered key would not verify, so an unregistered
worker must be inert, not absent.

Jitter is load-bearing: replicas share one funding key, so un-jittered retries collide on
the same nonce every interval and fail as a group.

Adds two metrics so this is visible rather than inferred:
- `enclave_key.registered` gauge, published as 0 before the first attempt so "never
  registered" is a zero rather than an absent series a threshold monitor would ignore.
- `enclave_key.registration_attempts{outcome}` counter.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Benchmark Results

Base and PR measured on the same runner in the same workflow run.

Benchmark Base PR Change
flashblock_validation_launch_flashblock_sequence_eth_transfers/stream/4fb_x_125tx 28.5±0.10ms 29.2±0.36ms 🟡 +2.00%
flashblock_validation_launch_flashblock_sequence_eth_transfers/stream/4fb_x_250tx 57.0±0.43ms 58.1±0.26ms 🟡 +2.00%
flashblock_validation_launch_flashblock_sequence_eth_transfers/stream/4fb_x_50tx 11.9±0.13ms 12.0±0.11ms 🟡 +1.00%
flashblock_validation_launch_flashblock_sequence_eth_transfers_with_bal/stream/4fb_x_125tx 35.1±0.35ms 34.8±0.33ms 🟢 -0.99%
flashblock_validation_launch_flashblock_sequence_eth_transfers_with_bal/stream/4fb_x_250tx 74.5±0.33ms 74.3±0.30ms 🟢 +0.00%
flashblock_validation_launch_flashblock_sequence_eth_transfers_with_bal/stream/4fb_x_50tx 14.8±0.09ms 14.6±0.08ms 🟢 -0.99%
flashblock_validation_launch_flashblock_sequence_fib/stream/4fb_x_125tx 27.0±0.15ms 27.8±0.14ms 🟡 +3.00%
flashblock_validation_launch_flashblock_sequence_fib/stream/4fb_x_250tx 52.9±0.07ms 55.9±0.25ms 🟡 +6.00%
flashblock_validation_launch_flashblock_sequence_fib/stream/4fb_x_50tx 11.2±0.05ms 11.8±0.32ms 🟡 +5.00%
flashblock_validation_launch_flashblock_sequence_fib_with_bal/stream/4fb_x_125tx 29.1±0.16ms 29.1±0.13ms 🟢 +0.00%
flashblock_validation_launch_flashblock_sequence_fib_with_bal/stream/4fb_x_250tx 55.4±0.37ms 55.3±0.24ms 🟢 +0.00%
flashblock_validation_launch_flashblock_sequence_fib_with_bal/stream/4fb_x_50tx 13.7±0.09ms 13.6±0.15ms 🟢 +0.00%
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254/stream/4fb_x_10tx 136.0±0.10ms 136.7±0.37ms 🟡 +1.00%
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254/stream/4fb_x_12tx 163.2±0.30ms 163.3±0.19ms 🟢 +0.00%
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254/stream/4fb_x_5tx 68.5±0.07ms 69.0±0.06ms 🟡 +1.00%
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254_with_bal/stream/4fb_x_10tx 25.2±1.87ms 25.4±1.54ms 🟡 +1.00%
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254_with_bal/stream/4fb_x_12tx 27.3±0.77ms 26.7±1.60ms 🟢 -1.96%
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254_with_bal/stream/4fb_x_5tx 18.6±0.40ms 18.8±0.49ms 🟡 +1.00%
flashblock_validation_process_flashblock_eth_transfers/txs/1000 49.1±0.12ms 49.1±0.23ms 🟢 +0.00%
flashblock_validation_process_flashblock_eth_transfers/txs/50 2.7±0.02ms 2.7±0.02ms 🟢 +0.00%
flashblock_validation_process_flashblock_eth_transfers/txs/500 24.7±0.04ms 24.7±0.08ms 🟢 +0.00%
flashblock_validation_process_flashblock_eth_transfers_with_bal/txs/1000 50.3±0.38ms 50.3±0.35ms 🟢 +0.00%
flashblock_validation_process_flashblock_eth_transfers_with_bal/txs/50 3.4±0.09ms 3.2±0.02ms 🟢 -3.85%
flashblock_validation_process_flashblock_eth_transfers_with_bal/txs/500 25.7±0.30ms 26.0±1.23ms 🟡 +1.00%
flashblock_validation_process_flashblock_fib/txs/1000 48.5±0.19ms 48.3±0.05ms 🟢 +0.00%
flashblock_validation_process_flashblock_fib/txs/50 2.6±0.03ms 2.6±0.09ms 🟡 +2.00%
flashblock_validation_process_flashblock_fib/txs/500 24.4±0.03ms 24.3±0.10ms 🟢 +0.00%
flashblock_validation_process_flashblock_fib_with_bal/txs/1000 49.0±0.20ms 48.9±0.34ms 🟢 +0.00%
flashblock_validation_process_flashblock_fib_with_bal/txs/50 3.3±0.04ms 3.2±0.05ms 🟢 -1.96%
flashblock_validation_process_flashblock_fib_with_bal/txs/500 25.0±0.18ms 24.9±0.09ms 🟢 +0.00%
flashblock_validation_process_flashblock_world_id_like_bn254/txs/10 34.0±0.11ms 34.1±0.04ms 🟢 +0.00%
flashblock_validation_process_flashblock_world_id_like_bn254/txs/25 84.5±0.10ms 84.6±0.08ms 🟢 +0.00%
flashblock_validation_process_flashblock_world_id_like_bn254/txs/50 169.3±2.65ms 169.0±0.27ms 🟢 +0.00%
flashblock_validation_process_flashblock_world_id_like_bn254_with_bal/txs/10 6.0±0.24ms 5.7±0.32ms 🟢 -3.85%
flashblock_validation_process_flashblock_world_id_like_bn254_with_bal/txs/25 7.8±0.06ms 7.8±0.09ms 🟢 +0.00%
flashblock_validation_process_flashblock_world_id_like_bn254_with_bal/txs/50 14.3±0.16ms 14.3±0.10ms 🟢 +0.00%

🔴 regression > 10%  ·  🟡 slower  ·  🟢 faster. A regression > 10% fails the check.

Raw critcmp output
group                                                                                              base                                   pr
-----                                                                                              ----                                   --
flashblock_validation_launch_flashblock_sequence_eth_transfers/stream/4fb_x_125tx                  1.00     28.5±0.10ms        ? ?/sec    1.02     29.2±0.36ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_eth_transfers/stream/4fb_x_250tx                  1.00     57.0±0.43ms        ? ?/sec    1.02     58.1±0.26ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_eth_transfers/stream/4fb_x_50tx                   1.00     11.9±0.13ms        ? ?/sec    1.01     12.0±0.11ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_eth_transfers_with_bal/stream/4fb_x_125tx         1.01     35.1±0.35ms        ? ?/sec    1.00     34.8±0.33ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_eth_transfers_with_bal/stream/4fb_x_250tx         1.00     74.5±0.33ms        ? ?/sec    1.00     74.3±0.30ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_eth_transfers_with_bal/stream/4fb_x_50tx          1.01     14.8±0.09ms        ? ?/sec    1.00     14.6±0.08ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_fib/stream/4fb_x_125tx                            1.00     27.0±0.15ms        ? ?/sec    1.03     27.8±0.14ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_fib/stream/4fb_x_250tx                            1.00     52.9±0.07ms        ? ?/sec    1.06     55.9±0.25ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_fib/stream/4fb_x_50tx                             1.00     11.2±0.05ms        ? ?/sec    1.05     11.8±0.32ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_fib_with_bal/stream/4fb_x_125tx                   1.00     29.1±0.16ms        ? ?/sec    1.00     29.1±0.13ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_fib_with_bal/stream/4fb_x_250tx                   1.00     55.4±0.37ms        ? ?/sec    1.00     55.3±0.24ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_fib_with_bal/stream/4fb_x_50tx                    1.00     13.7±0.09ms        ? ?/sec    1.00     13.6±0.15ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254/stream/4fb_x_10tx             1.00    136.0±0.10ms        ? ?/sec    1.01    136.7±0.37ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254/stream/4fb_x_12tx             1.00    163.2±0.30ms        ? ?/sec    1.00    163.3±0.19ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254/stream/4fb_x_5tx              1.00     68.5±0.07ms        ? ?/sec    1.01     69.0±0.06ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254_with_bal/stream/4fb_x_10tx    1.00     25.2±1.87ms        ? ?/sec    1.01     25.4±1.54ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254_with_bal/stream/4fb_x_12tx    1.02     27.3±0.77ms        ? ?/sec    1.00     26.7±1.60ms        ? ?/sec
flashblock_validation_launch_flashblock_sequence_world_id_like_bn254_with_bal/stream/4fb_x_5tx     1.00     18.6±0.40ms        ? ?/sec    1.01     18.8±0.49ms        ? ?/sec
flashblock_validation_process_flashblock_eth_transfers/txs/1000                                    1.00     49.1±0.12ms        ? ?/sec    1.00     49.1±0.23ms        ? ?/sec
flashblock_validation_process_flashblock_eth_transfers/txs/50                                      1.00      2.7±0.02ms        ? ?/sec    1.00      2.7±0.02ms        ? ?/sec
flashblock_validation_process_flashblock_eth_transfers/txs/500                                     1.00     24.7±0.04ms        ? ?/sec    1.00     24.7±0.08ms        ? ?/sec
flashblock_validation_process_flashblock_eth_transfers_with_bal/txs/1000                           1.00     50.3±0.38ms        ? ?/sec    1.00     50.3±0.35ms        ? ?/sec
flashblock_validation_process_flashblock_eth_transfers_with_bal/txs/50                             1.04      3.4±0.09ms        ? ?/sec    1.00      3.2±0.02ms        ? ?/sec
flashblock_validation_process_flashblock_eth_transfers_with_bal/txs/500                            1.00     25.7±0.30ms        ? ?/sec    1.01     26.0±1.23ms        ? ?/sec
flashblock_validation_process_flashblock_fib/txs/1000                                              1.00     48.5±0.19ms        ? ?/sec    1.00     48.3±0.05ms        ? ?/sec
flashblock_validation_process_flashblock_fib/txs/50                                                1.00      2.6±0.03ms        ? ?/sec    1.02      2.6±0.09ms        ? ?/sec
flashblock_validation_process_flashblock_fib/txs/500                                               1.00     24.4±0.03ms        ? ?/sec    1.00     24.3±0.10ms        ? ?/sec
flashblock_validation_process_flashblock_fib_with_bal/txs/1000                                     1.00     49.0±0.20ms        ? ?/sec    1.00     48.9±0.34ms        ? ?/sec
flashblock_validation_process_flashblock_fib_with_bal/txs/50                                       1.02      3.3±0.04ms        ? ?/sec    1.00      3.2±0.05ms        ? ?/sec
flashblock_validation_process_flashblock_fib_with_bal/txs/500                                      1.00     25.0±0.18ms        ? ?/sec    1.00     24.9±0.09ms        ? ?/sec
flashblock_validation_process_flashblock_world_id_like_bn254/txs/10                                1.00     34.0±0.11ms        ? ?/sec    1.00     34.1±0.04ms        ? ?/sec
flashblock_validation_process_flashblock_world_id_like_bn254/txs/25                                1.00     84.5±0.10ms        ? ?/sec    1.00     84.6±0.08ms        ? ?/sec
flashblock_validation_process_flashblock_world_id_like_bn254/txs/50                                1.00    169.3±2.65ms        ? ?/sec    1.00    169.0±0.27ms        ? ?/sec
flashblock_validation_process_flashblock_world_id_like_bn254_with_bal/txs/10                       1.04      6.0±0.24ms        ? ?/sec    1.00      5.7±0.32ms        ? ?/sec
flashblock_validation_process_flashblock_world_id_like_bn254_with_bal/txs/25                       1.00      7.8±0.06ms        ? ?/sec    1.00      7.8±0.09ms        ? ?/sec
flashblock_validation_process_flashblock_world_id_like_bn254_with_bal/txs/50                       1.00     14.3±0.16ms        ? ?/sec    1.00     14.3±0.10ms        ? ?/sec

@0xOsiris
0xOsiris changed the base branch from main to fix/nitro-worker-self-prewarm August 4, 2026 22:12
Base automatically changed from fix/nitro-worker-self-prewarm to main August 5, 2026 11:09
@piohei
piohei merged commit 1cfb0a2 into main Aug 5, 2026
16 checks passed
@piohei
piohei deleted the fix/nitro-auto-register-not-fatal branch August 5, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants