fix(operator): manage subscription to events without panic
Manage Operator's event subscription
Description
Previously, the Operator panicked if one connection (either main or fallback) failed.
The previous solution to this (#1692) was to iterate infinitely over both connections, this had the "silent failure" problem, as an operator could fail and retry forever without notice to its owner.
Now if one connection fails, the Operator will use the other one, while continiously trying to reconnect to the failed one; and if both connections fail, and the retryables are consumed, the Operator will exit, logging the errors of each connection RPC, so the owner/manager of the Operator server can fix it accordingly.
This PR also added the usage of fallback when operator calls DisableVerifiers
To test
Follow guide in #1692 to set up a proxy to your anvil, but I recommend setting up 2 proxies so you can individually control each Operator RPC connection, with the following docker-compose.yml:
version: '3'
services:
nginx:
image: nginx:alpine
container_name: nginx-anvil-proxy
volumes:
- ./nginx:/etc/nginx
ports:
- "8082:8082"
nginx2:
image: nginx:alpine
container_name: nginx-anvil-proxy-2
volumes:
- ./nginx:/etc/nginx
ports:
- "8083:8082"
- Verify the Operator behaves as described, and while submitting proofs take down 1 connection, take down the other connection, take down both connections.
Type of change
Please delete options that are not relevant.
- [x] New feature
- [x] Bug fix
- [ ] Optimization
- [ ] Refactor
Checklist
- [ ] “Hotfix” to
testnet, everything else tostaging - [ ] Linked to Github Issue
- [ ] This change depends on code or research by an external entity
- [ ] Acknowledgements were updated to give credit
- [ ] Unit tests added
- [ ] This change requires new documentation.
- [ ] Documentation has been added/updated.
- [ ] This change is an Optimization
- [ ] Benchmarks added/run
- [ ] Has a known issue
- Link to the open issue addressing it
- [ ] If your PR changes the Operator compatibility (Ex: Upgrade prover versions)
- [ ] This PR adds compatibility for operator for both versions and do not change batcher/docs/examples
- [ ] This PR updates batcher and docs/examples to the newer version. This requires the operator are already updated to be compatible
Changes to gas cost
Generated at commit: a33d8a04aa35a8606bcd45a8a35bc7dea911b4c8, compared to commit: b77e8fdf474834f0b9d018c28322b5c29512002e
🧾 Summary (10% most significant diffs)
| Contract | Method | Avg (+/-) | % |
|---|---|---|---|
| RegistryCoordinatorHarness | blsApkRegistry stakeRegistry |
+354 ❌ +354 ❌ |
+57.47% +51.91% |
| StakeRegistryHarness | delegation | +146 ❌ | +22.19% |
Full diff report 👇
| Contract | Deployment Cost (+/-) | Method | Min (+/-) | % | Avg (+/-) | % | Median (+/-) | % | Max (+/-) | % | # Calls (+/-) |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Slasher | 728,578 (-870,247) | initialize | 366 (-556) | -60.30% | 366 (-556) | -60.30% | 366 (-556) | -60.30% | 366 (-556) | -60.30% | 6 (0) |
| RegistryCoordinatorHarness | 5,528,683 (-4,601,377) | blsApkRegistry initialize stakeRegistry |
970 (+354) 55,078,420 (-1,203,055) 1,036 (+354) |
+57.47% -2.14% +51.91% |
970 (+354) 55,078,420 (-1,203,055) 1,036 (+354) |
+57.47% -2.14% +51.91% |
970 (+354) 55,078,420 (-1,203,055) 1,036 (+354) |
+57.47% -2.14% +51.91% |
970 (+354) 55,078,420 (-1,203,055) 1,036 (+354) |
+57.47% -2.14% +51.91% |
6 (0) 6 (0) 6 (0) |
| StakeRegistryHarness | 2,590,172 (-2,549,338) | delegation initializeQuorum |
804 (+146) 144,420 (-1,780) |
+22.19% -1.22% |
804 (+146) 164,216 (-1,780) |
+22.19% -1.07% |
804 (+146) 164,320 (-1,780) |
+22.19% -1.07% |
804 (+146) 164,320 (-1,780) |
+22.19% -1.07% |
6 (0) 1,152 (0) |
| AlignedLayerServiceManager | 4,398,072 (-3,921,136) | batchesState createNewTask disableVerifier disabledVerifiers enableVerifier isVerifierDisabled receive setDisabledVerifiers |
5,132 (-278) 56,970 (-824) 24,602 (+303) 3,030 (+516) 23,748 (-443) 2,406 (-450) 23,301 (-195) 24,243 (-7) |
-5.14% -1.43% +1.25% +20.53% -1.83% -15.76% -0.83% -0.03% |
5,132 (-278) 76,868 (-920) 36,191 (+375) 3,030 (+516) 24,388 (-372) 2,406 (-450) 46,835 (-356) 35,262 (+86) |
-5.14% -1.18% +1.05% +20.53% -1.50% -15.76% -0.75% +0.24% |
5,132 (-278) 77,026 (-920) 36,191 (+375) 3,030 (+516) 24,388 (-372) 2,406 (-450) 47,115 (-357) 35,262 (+86) |
-5.14% -1.18% +1.05% +20.53% -1.50% -15.76% -0.75% +0.24% |
5,132 (-278) 77,812 (-956) 47,780 (+446) 3,030 (+516) 25,029 (-300) 2,406 (-450) 47,115 (-357) 46,282 (+179) |
-5.14% -1.21% +0.94% +20.53% -1.18% -15.76% -0.75% +0.39% |
256 (0) 256 (0) 2 (0) 1 (0) 2 (0) 3 (0) 256 (0) 2 (0) |
| AVSDirectory | 1,485,692 (-1,689,090) | initialize | 97,570 (-3,067) | -3.05% | 97,570 (-3,067) | -3.05% | 97,570 (-3,067) | -3.05% | 97,570 (-3,067) | -3.05% | 6 (0) |
| ServiceManagerMock | 1,340,500 (-1,292,283) | initialize | 71,296 (-2,066) | -2.82% | 71,296 (-2,066) | -2.82% | 71,296 (-2,066) | -2.82% | 71,296 (-2,066) | -2.82% | 6 (0) |
| ProxyAdmin | 412,495 (-345,151) | upgrade upgradeAndCall |
38,758 (-883) 55,403,611 (-1,228,407) |
-2.23% -2.17% |
38,767 (-883) 55,403,611 (-1,228,407) |
-2.23% -2.17% |
38,770 (-883) 55,403,611 (-1,228,407) |
-2.23% -2.17% |
38,770 (-883) 55,403,611 (-1,228,407) |
-2.23% -2.17% |
24 (0) 6 (0) |
| BLSApkRegistryHarness | 1,676,721 (-1,447,516) | initializeQuorum setBLSPublicKey |
45,382 (-596) 89,551 (-556) |
-1.30% -0.62% |
45,382 (-596) 89,551 (-556) |
-1.30% -0.62% |
45,382 (-596) 89,551 (-556) |
-1.30% -0.62% |
45,382 (-596) 89,551 (-556) |
-1.30% -0.62% |
1,152 (0) 6 (0) |
| TransparentUpgradeableProxy | 521,501 (-376,498) | fallback | 1,634 (+90) | +5.83% | 47,449 (-617) | -1.28% | 8,200 (+90) | +1.11% | 119,180 (-820) | -0.68% | 30 (0) |
| StrategyManagerMock | 1,146,070 (-1,255,302) | setAddresses | 88,974 (-768) | -0.86% | 88,974 (-768) | -0.86% | 88,974 (-768) | -0.86% | 88,974 (-768) | -0.86% | 6 (0) |
| IndexRegistry | 917,389 (-790,168) | initializeQuorum | 45,244 (-348) | -0.76% | 45,244 (-348) | -0.76% | 45,244 (-348) | -0.76% | 45,244 (-348) | -0.76% | 1,152 (0) |