From f491e39f22b0d654964180949f2a5bf9103efb27 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 20 May 2022 18:53:27 -0400 Subject: [PATCH] fix: vm: support raw blocks in chain export We need this for NV16 to include code in chain snapshots. NOTE: I've also checked the splitstore, and we appear to be doing the right thing there already. --- chain/store/snapshot.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/chain/store/snapshot.go b/chain/store/snapshot.go index b9630bcbd..07d086e1f 100644 --- a/chain/store/snapshot.go +++ b/chain/store/snapshot.go @@ -8,6 +8,7 @@ import ( "github.com/ipfs/go-cid" "github.com/ipld/go-car" carutil "github.com/ipld/go-car/util" + mh "github.com/multiformats/go-multihash" cbg "github.com/whyrusleeping/cbor-gen" "golang.org/x/xerrors" @@ -142,7 +143,18 @@ func (cs *ChainStore) WalkSnapshot(ctx context.Context, ts *types.TipSet, inclRe for _, c := range out { if seen.Visit(c) { - if c.Prefix().Codec != cid.DagCBOR { + prefix := c.Prefix() + + // Don't include identity CIDs. + if prefix.MhType == mh.IDENTITY { + continue + } + + // We only include raw and dagcbor, for now. + // Raw for "code" CIDs. + switch prefix.Codec { + case cid.Raw, cid.DagCBOR: + default: continue }