-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Access] Add util command to backfill tx error messages db #6525
base: master
Are you sure you want to change the base?
[Access] Add util command to backfill tx error messages db #6525
Conversation
…BlockID, backend and ingestion engine, updated tests
… of github.com:The-K-R-O-K/flow-go into UlyanaAndrukhiv/6413-backfill-tx-error-messages
…sages' of github.com:The-K-R-O-K/flow-go into UlyanaAndrukhiv/6497-refactor-executionNodesForBlockID
… of github.com:The-K-R-O-K/flow-go into UlyanaAndrukhiv/6413-backfill-tx-error-messages
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6525 +/- ##
==========================================
+ Coverage 41.15% 41.35% +0.19%
==========================================
Files 2052 2025 -27
Lines 182196 180649 -1547
==========================================
- Hits 74983 74699 -284
+ Misses 100933 99709 -1224
+ Partials 6280 6241 -39
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
… of github.com:The-K-R-O-K/flow-go into UlyanaAndrukhiv/6413-backfill-tx-error-messages
… of github.com:The-K-R-O-K/flow-go into UlyanaAndrukhiv/6413-backfill-tx-error-messages
fetchTxErrorMessages := false | ||
for _, txResult := range results { | ||
if txResult.Failed { | ||
fetchTxErrorMessages = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we break in the loop after we found at least one failed result? It looks to me, that we could do this, maybe I missed something.
}, | ||
}) | ||
suite.Error(err) | ||
suite.Equal(err, admin.NewInvalidAdminReqErrorf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a dedicated method called ErrorIs
. Equal
is also good, just nitpicking :)
func createSnapshot(head *flow.Header) protocol.Snapshot { | ||
snapshot := &protocolmock.Snapshot{} | ||
func createSnapshot(head *flow.Header) *protocolmock.Snapshot { | ||
snapshot := new(protocolmock.Snapshot) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: better to use protocolmock.NewSnapshot(t)
as all New
mock functions have additional checks inside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, have a few comments!
Closes: #6413
Note: #6468 and #6499 should be merged first.
Context
This pull request introduces a utility command that allows ANs to backfill missing transaction error messages from start to end height and a set of ENs to their local databases. This ensures that historical ANs have the necessary data to serve requests moving forward.
The command accepts a list of EN IDs (
execution-node-ids
) , if not provided, it defaults to query any available EN. It optionally takes a start and end block height (start-height
,end-height
); if not provided, it defaults to theroot block
andlatest sealed block
.Before execution, the command checks if AN indexing is enabled. For each failed transaction within the block range, it retrieves and stores the error messages locally. It queries ENs in order and stops after the first successful response.
The command uses
GetTransactionErrorMessagesByBlockID
for optimized batch retrieval.Unit tests are included to ensure functionality.