Add offline linked-node owner email notifier - #66
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an offline linked-node owner notification flow that periodically checks oracle node status, resolves node owners via the Reader contract, throttles notifications via CStore, and sends a per-owner digest email using a new HTML template.
Changes:
- Added offline linked-node notifier service with CStore-backed per-owner 24h throttling plus unit tests.
- Added “nodes offline” email template, template loader/getter, and wired email sending in the email service.
- Extended config to include
OraclesApiand per-nodeOfflineNodesCronJobTiming, and started a new cron job incmd/main.go.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| templates/util.go | Adds template filename constant + loader for the new offline-nodes email template. |
| templates/html/email.nodes.offline.html | Introduces the HTML email template for offline linked-node digests. |
| templates/cache.go | Caches and exposes a getter for the new offline-nodes template. |
| templates/cache_test.go | Extends template cache tests and sets template path for tests. |
| service/offlineNodesNotifier.go | Implements oracle fetch + offline filtering + owner resolution + CStore throttling + email send. |
| service/offlineNodesNotifier_test.go | Adds tests for offline filtering, grouping, throttling, and fail-closed behavior. |
| service/emailService.go | Adds subject + SendOfflineNodesEmail + offline duration formatting. |
| config/config.testnet.json | Adds OraclesApi value. |
| config/config.devnet.json | Adds OraclesApi value. |
| config/config.mainnet.json | Adds OraclesApi and OfflineNodesCronJobTiming schedules. |
| config/config.go | Adds config fields + getter for OfflineNodesCronJobTiming. |
| cmd/main.go | Starts the offline-nodes notifier cron job when configured for the node. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
4
to
12
| "testing" | ||
|
|
||
| "github.com/NaeuralEdgeProtocol/ratio1-backend/config" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func init() { | ||
| config.Config.EmailTemplatesPath = "../templates/html/" | ||
| LoadAndCacheTemplates() |
aledefra
force-pushed
the
feat/offline-linked-node-owner-notifier
branch
from
June 9, 2026 16:24
d893e79 to
703fa8a
Compare
Comment on lines
+135
to
+146
| nodesByOwner := make(map[string][]OfflineNodeAlert) | ||
| for nodeAddress, ownerAddress := range ownersByNode { | ||
| owner := strings.TrimSpace(ownerAddress) | ||
| if owner == "" || strings.EqualFold(owner, "0x0000000000000000000000000000000000000000") { | ||
| continue | ||
| } | ||
| node, found := nodeByAddress[strings.ToLower(strings.TrimSpace(nodeAddress))] | ||
| if !found { | ||
| continue | ||
| } | ||
| nodesByOwner[owner] = append(nodesByOwner[owner], node) | ||
| } |
Comment on lines
+180
to
+188
| sentCount := 0 | ||
| for _, email := range emails { | ||
| err = sendOfflineNodesEmailFn(email, ownerNodes) | ||
| if err != nil { | ||
| log.Error("offline nodes notifier failed to send email to %s: %s", email, err.Error()) | ||
| continue | ||
| } | ||
| sentCount++ | ||
| } |
cristibleotiu
added a commit
that referenced
this pull request
Jun 10, 2026
Add offline linked-node owner email notifier (#66)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nodes_list, filter nodes offline for more than 24h, and resolve owners only via ReadergetNdNodesOwnersOraclesApiacross network configsBehavior
Verification
GOCACHE=/private/tmp/ratio1-go-cache go test ./service -run 'TestFetchOracleNodesListFiltersOfflineNodes|TestNotifyOfflineLinkedNodes' -count=1GOCACHE=/private/tmp/ratio1-go-cache go test ./templates -run 'TestTemplateGetters' -count=1