Conversation
There was a problem hiding this comment.
Pull request overview
This pull request implements Lido CSM v2, which represents a significant architectural refactor focused on separating storage concerns and streamlining the validator exit workflow. The changes introduce dedicated storage adapters for exits and performance data, consolidate relay-related functionality, and update the notification system to use a structured notifier service instead of Telegram.
Key changes include:
- Introduction of separate storage layers for exits (JSON) and performance (SQLite)
- Consolidation of relay functionality from separate "used" and "allowed" adapters into a unified
Relaysadapter - Replacement of Telegram-based notifications with a structured notifier service that supports multiple notification types
- Removal of v1-specific event watchers and scanners, replaced with a focused exit request event scanner
Reviewed changes
Copilot reviewed 105 out of 115 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/mocks/vebo_mock.go | Removed WatchReportSubmittedEvents method; updated ScanVeboValidatorExitRequestEvent to include operatorId parameter |
| internal/mocks/storage_mock.go | Removed entire file containing v1 storage port mock implementation |
| internal/mocks/relays_mock.go | Added new mock for unified Relays port supporting both allow list and used relays retrieval |
| internal/mocks/performance_mock.go | Added new mock for PerformanceStorage interface |
| internal/mocks/notifier_mock.go | Updated to support multiple notification types (missing receipts, exit requests, relay issues) instead of generic SendNotification |
| internal/mocks/ipfs_mock.go | Changed return type from OriginalReport to Report domain type |
| internal/mocks/exits.go | Added new mock for ExitsStorage interface |
| internal/mocks/exitValidator_mock.go | Updated comments to clarify port/interface usage |
| internal/mocks/execution_mock.go | Added IsSyncing and GetBlockHasReceipts methods; removed transaction receipt methods |
| internal/mocks/dappmanager_mock.go | Added new mock for DappManager adapter |
| internal/mocks/csparameters_mock.go | Added new mock for CsParametersPort interface |
| internal/mocks/csfeedistributor_mock.go | Added new mock for CsFeeDistributorPort interface |
| internal/mocks/csFeeDistributorImpl_mock.go | Removed file containing v1 implementation mock |
| internal/mocks/beaconchain_mock.go | Added GetSyncingStatus, GetBlockNumber, and GetGenesisTime methods |
| internal/config/config_loader.go | Updated configuration structure to support v2 architecture; removed WebSocket URL and v1-specific contract addresses |
| internal/application/services/validatorExitRequestEventScanner.go | Removed v1 validator exit request event scanner implementation |
| internal/application/services/relaysChecker.go | Updated to use unified Relays port and type-specific notification methods |
| internal/application/services/loadPendingHashes.go | Removed v1 pending hashes loader implementation |
| internal/application/services/loadHashes_test.go | Added tests for v2 all hashes loader service |
| internal/application/services/loadHashes.go | Added new all hashes loader for v2 architecture |
| internal/application/services/exitRequestEventScanner_test.go | Added comprehensive tests for v2 exit request event scanner |
| internal/application/services/exitRequestEventScanner.go | Added new exit request event scanner with improved block range calculation |
| internal/application/services/events_watcher.go | Removed v1 events watcher implementation |
| internal/application/services/ejector.go | Updated to use ExitsStorage port and type-specific notification methods |
| internal/application/services/distributionLogUpdatedEventScanner.go | Removed v1 distribution log updated event scanner |
| internal/application/services/csModuleEventsScanner.go | Removed v1 CS module events scanner |
| internal/application/services/csFeeOracleEventsScanner.go | Removed v1 CS fee oracle events scanner |
| internal/application/services/api_server.go | Simplified API server to use separated storage ports and removed v1-specific endpoints |
| internal/application/ports/vebo_port.go | Removed WatchReportSubmittedEvents method from VeboPort interface |
| internal/application/ports/storage_port.go | Removed entire v1 StoragePort interface file |
| internal/application/ports/relaysused_port.go | Removed separate RelaysUsedPort interface |
| internal/application/ports/relays_port.go | Updated to define unified Relays interface combining used and allowed relays |
| internal/application/ports/performanceStorage_port.go | Added new PerformanceStorage port interface |
| internal/application/ports/notifier_port.go | Updated NotifierPort to support type-specific notification methods |
| internal/application/ports/ipfs_port.go | Changed return type from OriginalReport to Report |
| internal/application/ports/exitsStorage_port.go | Added new ExitsStorage port interface |
| internal/application/ports/execution_port.go | Added GetBlockHasReceipts; removed timestamp and transaction receipt methods |
| internal/application/ports/csparameters_port.go | Added new CsParametersPort interface |
| internal/application/ports/csmodule_port.go | Removed entire v1 CsModulePort interface |
| internal/application/ports/csfeeoracle_port.go | Removed entire v1 CsFeeOraclePort interface |
| internal/application/ports/csfeedistributor_port.go | Updated to focus on retrieving log CIDs instead of watching events |
| internal/application/ports/csfeedistributorImpl_port.go | Removed v1 CsFeeDistributorImplPort interface |
| internal/application/ports/beaconchain_port.go | Added GetBlockNumber and GetGenesisTime methods |
| internal/application/ports/api_port.go | Removed entire API port interface file |
| internal/application/domain/vebo_events.go | Removed VeboReportSubmitted event type |
| internal/application/domain/report.go | Simplified Report structure for v2; removed OriginalReport type |
| internal/application/domain/notification.go | Added new notification domain types for v2 |
| internal/application/domain/csmodule_events.go | Removed entire CS module events domain file |
| internal/application/domain/csfeeoracle_events.go | Removed CS fee oracle events domain file |
| internal/application/domain/csfeedistributor_events.go | Removed CS fee distributor events domain file |
| internal/application/domain/config.go | Removed TelegramConfig domain type |
| internal/adapters/vebo/vebo_integration_test.go | Updated to use ExitsStorage mock and removed WebSocket client |
| internal/adapters/vebo/vebo.go | Removed WebSocket client and WatchReportSubmittedEvents method |
| internal/adapters/storage/telegram_test.go | Removed v1 telegram storage tests |
| internal/adapters/storage/telegram.go | Removed v1 telegram storage implementation |
| internal/adapters/storage/storage_adapter.go | Removed v1 JSON storage adapter |
| internal/adapters/storage/processingStarted.go | Removed processing started storage methods |
| internal/adapters/storage/performance/performance.go | Added new SQLite-based performance storage adapter |
| internal/adapters/storage/operators.go | Removed v1 operators storage implementation |
| internal/adapters/storage/migrations_test.go | Removed v1 migrations tests |
| internal/adapters/storage/migrations.go | Removed v1 migrations implementation |
| internal/adapters/storage/helpers_test.go | Removed v1 storage test helpers |
| internal/adapters/storage/exits/operators.go | Added new exits-specific JSON storage for operator data |
| internal/adapters/storage/exits/json.go | Added new JSON storage implementation for exits |
| internal/adapters/storage/elRewardsStealingPenaltiesReported.go | Removed EL rewards stealing penalties storage |
| internal/adapters/storage/addresses_test.go | Removed v1 addresses storage tests |
| internal/adapters/storage/addresses.go | Removed v1 addresses storage implementation |
| internal/adapters/relaysUsed/relaysUsed_adapter.go | Removed separate relays used adapter |
| internal/adapters/relaysAllowed/relaysAllowed_adapter.go | Removed separate relays allowed adapter |
| internal/adapters/relays/relays.go | Added unified relays adapter combining used and allowed functionality |
| internal/adapters/notifier/notifier_adapter.go | Removed v1 Telegram notifier adapter |
| internal/adapters/notifier/notifier.go | Added new structured notifier with type-specific notification methods |
| internal/adapters/ipfs/ipfs_integration_test.go | Added integration tests for v2 IPFS adapter |
| internal/adapters/ipfs/ipfs_adapter_integration_test.go | Removed v1 IPFS integration tests |
| internal/adapters/ipfs/ipfs_adapter.go | Removed v1 IPFS adapter |
| internal/adapters/ipfs/ipfs.go | Added new IPFS adapter supporting both single report and array responses |
| internal/adapters/exitvalidator/exitvalidator.go | Renamed types and updated references |
| internal/adapters/execution/execution_integration_test.go | Added v2 execution adapter integration tests |
| internal/adapters/execution/execution_adapter_integration_test.go | Removed v1 execution adapter integration tests |
| internal/adapters/execution/execution.go | Replaced transaction receipt methods with block receipts; removed timestamp retrieval |
| internal/adapters/dappmanager/dappmanager.go | Added new DappManager adapter for notifications configuration |
| internal/adapters/csparameters/csparameters_integration_test.go | Added integration tests for CS parameters adapter |
| internal/adapters/csparameters/csparameters.go | Added new CS parameters adapter for exit delay configuration |
| internal/adapters/csfeedistributor/csfeedistributor_integration_test.go | Added integration tests for CS fee distributor adapter |
| internal/adapters/csfeedistributor/csfeedistributor.go | Added new CS fee distributor adapter for retrieving log CIDs |
| internal/adapters/csFeeOracle/csFeeOracle_integration_test.go | Removed v1 CS fee oracle integration tests |
| go.mod | Added SQLite dependency; removed Telegram bot dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // TODO: wait for PR in docs to add the proper link | ||
| message = fmt.Sprintf("- 🚪 Validator %s failed to exit, a manual exit is required. Click here to learn how to do the exit manually %s", exitRequest.Event.ValidatorIndex, "https://docs.dappnode.io/docs/user/staking/gnosis-chain/solo#1-exit-the-validator-from-the-dappnode-ui") | ||
| if err := ve.notifierPort.SendNotification(message); err != nil { | ||
| message := fmt.Sprintf("- 🚪 Validator %s failed to exit, a manual exit is required. Click here to [learn how to do the exit manually](https://docs.dappnode.io/docs/user/staking/gnosis-chain/solo#1-exit-the-validator-from-the-dappnode-ui)", exitRequest.Event.ValidatorIndex) |
There was a problem hiding this comment.
The error message references documentation for Gnosis Chain (gnosis-chain/solo), but this code appears to be for Lido CSM which runs on Ethereum mainnet and Hoodi testnet. Consider updating the documentation link to point to the correct network-specific exit instructions.
| message := fmt.Sprintf("- 🚪 Validator %s failed to exit, a manual exit is required. Click here to [learn how to do the exit manually](https://docs.dappnode.io/docs/user/staking/gnosis-chain/solo#1-exit-the-validator-from-the-dappnode-ui)", exitRequest.Event.ValidatorIndex) | |
| // TODO: Update the link below to the finalized Ethereum mainnet/Hoodi testnet exit instructions when available | |
| message := fmt.Sprintf("- 🚪 Validator %s failed to exit, a manual exit is required. Click here to [learn how to do the exit manually](https://docs.lido.fi/guides/node-operators/validator-exit/)", exitRequest.Event.ValidatorIndex) |
| IsBanner bool `json:"isBanner"` | ||
| CorrelationId string `json:"correlationId"` | ||
| Metric *struct { | ||
| Treshold float64 `json:"treshold"` |
There was a problem hiding this comment.
Corrected spelling of 'Treshold' to 'Threshold'.
| Treshold float64 `json:"treshold"` | |
| Threshold float64 `json:"treshold"` // Note: JSON tag kept as "treshold" for compatibility |
| mevBoostDnpName string | ||
| } | ||
|
|
||
| func NewARelays( |
There was a problem hiding this comment.
The function name NewARelays appears to have an errant 'A' character. It should likely be NewRelays to follow Go naming conventions.
| func NewARelays( | |
| func NewRelays( |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.