Skip to content

Commit 5e02608

Browse files
committed
opt: remove CachedBlockstore
1 parent 0c8c472 commit 5e02608

File tree

4 files changed

+18
-38
lines changed

4 files changed

+18
-38
lines changed

pkg/fork/mock.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,20 @@ func (mockFork *MockFork) HasExpensiveForkBetween(parent, height abi.ChainEpoch)
3838

3939
func (mockFork *MockFork) GetForkUpgrade() *config.ForkUpgradeConfig {
4040
return &config.ForkUpgradeConfig{
41-
UpgradeSmokeHeight: -1,
42-
UpgradeBreezeHeight: -1,
43-
UpgradeIgnitionHeight: -1,
44-
UpgradeLiftoffHeight: -1,
45-
UpgradeAssemblyHeight: -1,
46-
UpgradeRefuelHeight: -1,
47-
UpgradeTapeHeight: -1,
48-
UpgradeKumquatHeight: -1,
49-
BreezeGasTampingDuration: -1,
50-
UpgradeCalicoHeight: -1,
51-
UpgradePersianHeight: -1,
52-
UpgradeOrangeHeight: -1,
53-
UpgradeClausHeight: -1,
41+
UpgradeSmokeHeight: -1,
42+
UpgradeBreezeHeight: -1,
43+
UpgradeIgnitionHeight: -1,
44+
UpgradeLiftoffHeight: -1,
45+
UpgradeAssemblyHeight: -1,
46+
UpgradeRefuelHeight: -1,
47+
UpgradeTapeHeight: -1,
48+
UpgradeKumquatHeight: -1,
49+
BreezeGasTampingDuration: -1,
50+
UpgradeCalicoHeight: -1,
51+
UpgradePersianHeight: -1,
52+
UpgradeOrangeHeight: -1,
53+
UpgradeClausHeight: -1,
54+
UpgradeWatermelonFixHeight: -1,
5455
}
5556
}
5657

pkg/gen/genesis/genesis.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ func VerifyPreSealedData(ctx context.Context, cs *chain.Store, stateroot cid.Cid
515515
Bsstore: cs.Blockstore(),
516516
SysCallsImpl: mkFakedSigSyscalls(syscalls),
517517
GasPriceSchedule: gasPriceSchedule,
518+
Fork: fork.NewMockFork(),
518519
}
519520

520521
vm, err := fvm.NewVM(ctx, vmopt)

pkg/genesis/genesis.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,7 @@ func MakeGenesis(ctx context.Context, rep repo.Repo, outFile, genesisTemplate st
6969
template.Timestamp = uint64(constants.Clock.Now().Unix())
7070
}
7171

72-
// TODO potentially replace this cached blockstore by a CBOR cache.
73-
cbs, err := blockstoreutil.CachedBlockstore(ctx, bs, blockstoreutil.DefaultCacheOpts())
74-
if err != nil {
75-
return nil, err
76-
}
77-
78-
b, err := genesis2.MakeGenesisBlock(context.TODO(), rep, cbs, template, para)
72+
b, err := genesis2.MakeGenesisBlock(context.TODO(), rep, bs, template, para)
7973
if err != nil {
8074
return nil, fmt.Errorf("make genesis block: %w", err)
8175
}
@@ -87,8 +81,8 @@ func MakeGenesis(ctx context.Context, rep repo.Repo, outFile, genesisTemplate st
8781
return nil, err
8882
}
8983

90-
offl := offline.Exchange(cbs)
91-
blkserv := blockservice.New(cbs, offl)
84+
offl := offline.Exchange(bs)
85+
blkserv := blockservice.New(bs, offl)
9286
dserv := merkledag.NewDAGService(blkserv)
9387

9488
if err := car.WriteCarWithWalker(context.TODO(), dserv, []cid.Cid{b.Genesis.Cid()}, f, gen.CarWalkFunc); err != nil {

venus-shared/blockstore/blockstore.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,6 @@ var (
7676
NewGCBlockstore = blockstore.NewGCBlockstore
7777
)
7878

79-
func DefaultCacheOpts() CacheOpts {
80-
return CacheOpts{
81-
HasBloomFilterSize: 0,
82-
HasBloomFilterHashes: 0,
83-
HasARCCacheSize: 512 << 10,
84-
}
85-
}
86-
87-
func CachedBlockstore(ctx context.Context, bs blockstore.Blockstore, opts CacheOpts) (Blockstore, error) {
88-
bsTmp, err := blockstore.CachedBlockstore(ctx, bs, opts)
89-
if err != nil {
90-
return nil, err
91-
}
92-
return WrapIDStore(bsTmp), nil
93-
}
94-
9579
type adaptedBlockstore struct {
9680
blockstore.Blockstore
9781
}

0 commit comments

Comments
 (0)