filecoin-project / lotus

Reference implementation of the Filecoin protocol, written in Go
https://lotus.filecoin.io/
Other
2.83k stars 1.25k forks source link

Message Index re-conciliation should also fill in missing messages from the cannonical chain #12281

Open aarshkshah1992 opened 2 months ago

aarshkshah1992 commented 2 months ago

Checklist

Lotus component

What is the motivation behind this feature request? Is your feature request related to a problem? Please describe.

On startup, the message index currently performs a "re-conciliation" process to clean up mesages that have been re-orged by walking back from the head of the cannonical chain upto the earliest epoch in the index and removing messages from all tipsets in the index that are not on the cannonical chain. This can be found here:

https://github.com/filecoin-project/lotus/blob/89f042e1a8e984b883790b952e0535b88e0dad5b/chain/index/msgindex.go#L104

However, it then directly starts syncing the message Index from the head of the cannonical chain without first filling in entries between the (last tipset in the index on the cannonical chain <> current head of the cannonical chain) which can cause missing entries in the Index unless they are manually backfilled. We should fix this.

See https://github.com/filecoin-project/lotus/blob/89f042e1a8e984b883790b952e0535b88e0dad5b/chain/index/msgindex.go#L133

Describe the solution you'd like

We should backfill messages in the index between (latest tipset in the index <> current head of cannonical chain) after re-conciliation is complete.

Describe alternatives you've considered

No response

Additional context

No response

aarshkshah1992 commented 2 months ago

@Stebalien Let me know what you think.