-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: recompute tipset to generate missing events if event indexing is enabled #12463
feat: recompute tipset to generate missing events if event indexing is enabled #12463
Conversation
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.
Please update the PR title to match https://github.com/filecoin-project/lotus/blob/master/CONTRIBUTING.md#pr-title-conventions
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.
Please update the PR title to match https://github.com/filecoin-project/lotus/blob/master/CONTRIBUTING.md#pr-title-conventions
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.
Please update the PR title to match https://github.com/filecoin-project/lotus/blob/master/CONTRIBUTING.md#pr-title-conventions
chain/index/indexer.go
Outdated
@@ -21,6 +21,7 @@ var _ Indexer = (*SqliteIndexer)(nil) | |||
|
|||
// IdToRobustAddrFunc is a function type that resolves an actor ID to a robust address | |||
type IdToRobustAddrFunc func(ctx context.Context, emitter abi.ActorID, ts *types.TipSet) (address.Address, bool) | |||
type tipsetExecutorFnc func(ctx context.Context, ts *types.TipSet) (cid.Cid, cid.Cid, error) |
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.
Leaky abstraction here, since the two CIDs are always discarded. A couple of options to make this a bit nicer:
- Just use an
error
return and make the wrapper function 1 line longer to discard the others (even though currently it doesn't even need to be a wrapper, justindexer.SetTipsetExecutorFnc(sm.RecomputeTipSetState)
would do). - Just call it
recomputeTipSetState
and admit that this is all we're expecting here. - Make
SqliteIndexer
depend onStateManager
and load it in via fx to avoid jumping through hoops and to be completely honest.
(also, Fnc
-> Func
?)
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.
@rvagg Fixed this by using a recomputeTipSetState
function here that simply returns an error and passing in a wrapper to hide the AMT cids during construction.
I'm OK with this in principle since the only path to calling this would be from Aside from the review above, the only other comment I have is that it was kind of difficult tracing the calls with a |
PR title now matches the required format.
@rvagg I have addressed your review. I agree that there is some indirection involved in tracing the injection -> use flow for the repair function but can't think of a quick cleaner way here too. |
@rvagg Please let me know if I have your ✔️ on this PR and I can merge it to the parent branch. |
For #12453.
If we're unable to find events for a given receipt, we recompute the tipset to generate events and re-read the events true to enable auto-repair for events. This will work during reconciliation as well.