Draft
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reworks the “claimer” flow by removing the bespoke claimer repository APIs, extending the schema/model to track claim-submitted/claim-accepted tx hashes and per-app claim event scan checkpoints, and updating the claimer service to operate via the general-purpose repository interfaces.
Changes:
- Remove
ClaimerRepositoryand Postgres claimer queries; add new epoch repo update methods for claim tx hashes. - Extend
applicationandepochpersistence/model with claim scan checkpoints and separate submitted/accepted claim tx hash fields. - Rewrite claimer tick logic to iterate enabled applications, scan claim events, update epoch status/tx hashes, and optionally submit claims.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/claimer/service.go | Switch Tick() to new update flow using generic repo/client + configured default block |
| internal/claimer/claimer.go | New claimer core logic: per-app epoch scanning, event collection, tx submission/confirmation |
| internal/claimer/blockchain.go | Removed old claimer blockchain helper implementation |
| internal/repository/repository.go | Remove ClaimerRepository; add epoch tx-hash update methods to EpochRepository |
| internal/repository/postgres/epoch.go | Implement new tx-hash update methods; include new tx hash fields in ListEpochs |
| internal/repository/postgres/application.go | Persist and map new application claim scan checkpoint columns |
| internal/repository/postgres/schema/migrations/000001_create_initial_schema.up.sql | Add new columns for claim checkpoints and per-epoch tx hashes |
| internal/repository/postgres/db/rollupsdb/public/table/application.go | Jet table updates for new application columns |
| internal/repository/postgres/db/rollupsdb/public/table/epoch.go | Jet table updates for new epoch columns |
| internal/model/models.go | Add model fields for claim checkpoints and separate submitted/accepted tx hashes |
| internal/repository/postgres/claimer.go | Removed old Postgres claimer query/update implementation |
| internal/repository/repotest/claimer_test_cases.go | Removed repository claimer test suite file |
Comments suppressed due to low confidence (2)
internal/repository/repotest/claimer_test_cases.go:1
- This file removal deletes the ClaimerSuite and helper builders, but internal/repository/repotest/repotest.go still invokes NewClaimerSuite. As-is, the repotest package will no longer compile. Either keep/move these claimer repository test cases (adapted to the new schema/API) or remove the Claimer suite registration from repotest.go.
internal/repository/postgres/epoch.go:736 - ListEpochs now selects/scans ClaimSubmittedTransactionHash and ClaimAcceptedTransactionHash, but other epoch fetch paths (e.g., GetEpoch / GetEpochByVirtualIndex) still only populate ClaimTransactionHash. This can lead to these new fields always being nil in API responses or callers that use GetEpoch. Consider updating the other SELECT/Scan projections for consistency with the expanded model.Epoch struct.
sel := table.Epoch.
SELECT(
table.Epoch.ApplicationID,
table.Epoch.Index,
table.Epoch.FirstBlock,
table.Epoch.LastBlock,
table.Epoch.InputIndexLowerBound,
table.Epoch.InputIndexUpperBound,
table.Epoch.MachineHash,
table.Epoch.OutputsMerkleRoot,
table.Epoch.Commitment,
table.Epoch.ClaimTransactionHash,
table.Epoch.ClaimSubmittedTransactionHash,
table.Epoch.ClaimAcceptedTransactionHash,
table.Epoch.TournamentAddress,
table.Epoch.Status,
table.Epoch.VirtualIndex,
table.Epoch.CreatedAt,
table.Epoch.UpdatedAt,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+60
to
+64
| type iRepository interface { | ||
| repository.ApplicationRepository | ||
| repository.EpochRepository | ||
| repository.NodeConfigRepository | ||
| } |
internal/repository/postgres/schema/migrations/000001_create_initial_schema.up.sql
Outdated
Show resolved
Hide resolved
d363b3b to
8803ee9
Compare
8803ee9 to
031bf63
Compare
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.