Skip to content
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

Merged
merged 4 commits into from
Sep 16, 2024

Conversation

aarshkshah1992
Copy link
Contributor

@aarshkshah1992 aarshkshah1992 commented Sep 14, 2024

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.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aarshkshah1992 aarshkshah1992 changed the title Recompute tipset to generate missing events if event indexing is enabled feat: Recompute tipset to generate missing events if event indexing is enabled Sep 16, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -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)
Copy link
Member

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:

  1. 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, just indexer.SetTipsetExecutorFnc(sm.RecomputeTipSetState) would do).
  2. Just call it recomputeTipSetState and admit that this is all we're expecting here.
  3. Make SqliteIndexer depend on StateManager and load it in via fx to avoid jumping through hoops and to be completely honest.

(also, Fnc -> Func?)

Copy link
Contributor Author

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.

@rvagg
Copy link
Member

rvagg commented Sep 16, 2024

I'm OK with this in principle since the only path to calling this would be from backfillIndex -> indexTipsetWithParentEvents. Getting there via Apply should not encounter it because the amt should be there.

Aside from the review above, the only other comment I have is that it was kind of difficult tracing the calls with a git grep down into this because it jumps around through 3 files to get to the top calls, that makes me a little sus about how clean the abstractions are, but I don't have any good suggestions, just an observation.

@aarshkshah1992 aarshkshah1992 changed the title feat: Recompute tipset to generate missing events if event indexing is enabled feat: recompute tipset to generate missing events if event indexing is enabled Sep 16, 2024
@github-actions github-actions bot dismissed their stale review September 16, 2024 08:03

PR title now matches the required format.

@aarshkshah1992
Copy link
Contributor Author

@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.

@aarshkshah1992
Copy link
Contributor Author

@rvagg Please let me know if I have your ✔️ on this PR and I can merge it to the parent branch.

@aarshkshah1992 aarshkshah1992 merged commit 6d84b03 into feat/msg-eth-tx-index Sep 16, 2024
40 of 42 checks passed
@aarshkshah1992 aarshkshah1992 deleted the feat/auto-repair-event-storage branch September 16, 2024 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ☑️ Done (Archive)
Development

Successfully merging this pull request may close these issues.

2 participants