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:splitstore:retain tipset references in hot store #9960

Merged
merged 5 commits into from
Jan 6, 2023

Conversation

ZenGround0
Copy link
Contributor

Related Issues

#9799

Proposed Changes

FEVM is introducing H(TipSetKey) to get a single blockhash to return in places where ethereum wants a single hash. This PR ensures that splitstore compaction will keep these cids pinned in the hotstore.

Additional Info

WIP as this still needs tests
Also I don't think we're actually writing tipset references to the chain store yet if I'm right about this we'll need to do that to actually test this out.

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

if pRef, err := tsRef(hdr.Parents); err != nil {
return xerrors.Errorf("error computing cid reference to parent tipset")
} else {
if err := s.walkObjectIncomplete(pRef, visitor, fHot, stopWalk); err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems likely tipsets produced before nv18 won't retroactively get references added to the store so this is an incomplete walk.

@ZenGround0 ZenGround0 added this to the Network v18 milestone Jan 3, 2023
@ZenGround0 ZenGround0 linked an issue Jan 3, 2023 that may be closed by this pull request
@ZenGround0 ZenGround0 marked this pull request as ready for review January 4, 2023 22:02
@ZenGround0 ZenGround0 requested a review from a team as a code owner January 4, 2023 22:02
@ZenGround0
Copy link
Contributor Author

ZenGround0 commented Jan 5, 2023

Test failure is known unrelated

@arajasek
Copy link
Contributor

arajasek commented Jan 6, 2023

Also I don't think we're actually writing tipset references to the chain store yet if I'm right about this we'll need to do that to actually test this out.

We are, here, so you should be good to test out (PR).

@@ -905,6 +905,14 @@ func (s *SplitStore) walkChain(ts *types.TipSet, inclState, inclMsgs abi.ChainEp
walkCnt := new(int64)
scanCnt := new(int64)

tsRef := func(cids []cid.Cid) (cid.Cid, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
tsRef := func(cids []cid.Cid) (cid.Cid, error) {
tsRef := func(blkCids []cid.Cid) (cid.Cid, error) {

Copy link
Contributor

Choose a reason for hiding this comment

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

Just so it's a bit clearer what we're doing.

@@ -905,6 +905,14 @@ func (s *SplitStore) walkChain(ts *types.TipSet, inclState, inclMsgs abi.ChainEp
walkCnt := new(int64)
scanCnt := new(int64)

tsRef := func(cids []cid.Cid) (cid.Cid, error) {
blk, err := types.NewTipSetKey(cids...).ToStorageBlock()
Copy link
Contributor

Choose a reason for hiding this comment

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

TipSetKey has a Cid() method you can call directly.

e := check.Height()
rawKey, err := check.Key().ToStorageBlock()
require.NoError(t, err)
checkRef := rawKey.Cid()
Copy link
Contributor

Choose a reason for hiding this comment

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

also directly Cid()able, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not GC tipset CID
2 participants