From e44d623e961fc21c57d4b4b81bc3b272e5e2aa71 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 6 Mar 2024 15:04:55 -0800 Subject: [PATCH] resolve some of the TODOS --- core/blockchain.go | 7 +++---- core/blockchain_snapshot_test.go | 9 --------- core/chain_makers_test.go | 1 - metrics/prometheus/prometheus.go | 4 ++-- plugin/evm/vm.go | 2 +- 5 files changed, 6 insertions(+), 17 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index c751cb4216..69f9f5705f 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1285,10 +1285,9 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. } // If node is running in path mode, skip explicit gc operation // which is unnecessary in this mode. - // XXX - // if bc.triedb.Scheme() == rawdb.PathScheme { - // return nil - // } + if bc.triedb.Scheme() == rawdb.PathScheme { + return nil + } // Note: if InsertTrie must be the last step in verification that can return an error. // This allows [stateManager] to assume that if it inserts a trie without returning an diff --git a/core/blockchain_snapshot_test.go b/core/blockchain_snapshot_test.go index 62eb1a82cd..9b5cea4aa1 100644 --- a/core/blockchain_snapshot_test.go +++ b/core/blockchain_snapshot_test.go @@ -108,10 +108,6 @@ func (basic *snapshotTestBasic) prepare(t *testing.T) (*BlockChain, []*types.Blo } startPoint = point - // XXX - // if basic.commitBlock > 0 && basic.commitBlock == point { - // chain.TrieDB().Commit(blocks[point-1].Root(), false) - // } if basic.snapshotBlock > 0 && basic.snapshotBlock == point { // Flushing from 0 to snapshotBlock into the disk for i := uint64(0); i < point; i++ { @@ -524,11 +520,6 @@ func TestHighCommitCrashWithNewSnapshot(t *testing.T) { // Expected head block : C4 // Expected snapshot disk : C4 for _, scheme := range []string{rawdb.HashScheme, rawdb.PathScheme} { - expHead := uint64(0) - if scheme == rawdb.PathScheme { - expHead = uint64(4) - } - _ = expHead // XXX: expHead is not used test := &crashSnapshotTest{ snapshotTestBasic{ scheme: scheme, diff --git a/core/chain_makers_test.go b/core/chain_makers_test.go index 31c3f4435b..c3f6f576e4 100644 --- a/core/chain_makers_test.go +++ b/core/chain_makers_test.go @@ -63,7 +63,6 @@ func ExampleGenerateChain() { // each block and adds different features to gen based on the // block index. signer := types.HomesteadSigner{} - // XXX: Why is this 5 in geth? chain, _, err := GenerateChain(gspec.Config, genesis, dummy.NewCoinbaseFaker(), genDb, 3, 10, func(i int, gen *BlockGen) { switch i { case 0: diff --git a/metrics/prometheus/prometheus.go b/metrics/prometheus/prometheus.go index 9cd3bd1bd5..d6bcd92a62 100644 --- a/metrics/prometheus/prometheus.go +++ b/metrics/prometheus/prometheus.go @@ -73,6 +73,8 @@ func (g gatherer) Gather() ([]*dto.MetricFamily, error) { }, }}, }) + case metrics.GaugeInfo: + // XXX case metrics.GaugeFloat64: val := m.Snapshot().Value() mfs = append(mfs, &dto.MetricFamily{ @@ -194,5 +196,3 @@ func (g gatherer) Gather() ([]*dto.MetricFamily, error) { func Gatherer(reg metrics.Registry) prometheus.Gatherer { return gatherer{reg: reg} } - -// XXX diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index 9694fefe8b..98baeaef13 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -778,7 +778,7 @@ func (vm *VM) setAppRequestHandlers() { vm.chaindb, &trie.Config{ HashDB: &hashdb.Config{ - CleanCacheSize: vm.config.StateSyncServerTrieCache * units.MiB, // XXX + CleanCacheSize: vm.config.StateSyncServerTrieCache * units.MiB, }, }, )