fix: orhphaned jobs indexing - #73
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses allocation “orphaning”/duplicate indexing issues by persisting Ethereum log index on allocation events, deduplicating inserts using a partial unique index, and applying a targeted owner override for a known set of orphaned allocation transactions.
Changes:
- Persist
LogIndexon decoded allocation logs and add a partial unique index on(tx_hash, log_index)to prevent duplicate inserts when log index is available. - Adjust stats sync range to start from
LastBlockNumber + 1to avoid reprocessing the previously processed block. - Add a deterministic owner override for a known set of orphaned allocation transactions/nodes, with unit tests covering the override logic and log index persistence.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| storage/allocationStorer.go | Adds ON CONFLICT DO NOTHING insert behavior for allocations keyed by (tx_hash, log_index) when log_index is present. |
| storage/allocationStorer_test.go | Updates allocation fixtures to populate LogIndex to align with new schema expectations. |
| service/statsService.go | Skips reprocessing last processed block; adds orphaned-allocation owner override; persists LogIndex from chain logs. |
| service/statsService_test.go | Adds unit tests for orphaned owner override and for decodeAllocLogs persisting LogIndex. |
| scripts/infuraFunctions.go | Persists LogIndex in script-side allocation log decoding. |
| model/poaiEvents.go | Adds LogIndex field and a partial composite unique index on (tx_hash, log_index) where log_index IS NOT NULL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cristibleotiu
approved these changes
Jul 13, 2026
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.
No description provided.