Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxyyz committed Dec 22, 2023
1 parent 83b9f7f commit 32883f1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions cmd/nitro/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/cmd/conf"
"github.com/offchainlabs/nitro/cmd/ipfshelper"
"github.com/offchainlabs/nitro/cmd/prunning"
"github.com/offchainlabs/nitro/cmd/pruning"
"github.com/offchainlabs/nitro/cmd/util"
"github.com/offchainlabs/nitro/execution/gethexec"
"github.com/offchainlabs/nitro/statetransfer"
Expand Down Expand Up @@ -167,7 +167,7 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo
if err != nil {
return chainDb, nil, err
}
err = prunning.PruneChainDb(ctx, chainDb, stack, &config.Init, cacheConfig, l1Client, rollupAddrs, config.Node.ValidatorRequired())
err = pruning.PruneChainDb(ctx, chainDb, stack, &config.Init, cacheConfig, l1Client, rollupAddrs, config.Node.ValidatorRequired())
if err != nil {
return chainDb, nil, fmt.Errorf("error pruning: %w", err)
}
Expand Down Expand Up @@ -363,7 +363,7 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo
return chainDb, l2BlockChain, err
}

err = prunning.PruneChainDb(ctx, chainDb, stack, &config.Init, cacheConfig, l1Client, rollupAddrs, config.Node.ValidatorRequired())
err = pruning.PruneChainDb(ctx, chainDb, stack, &config.Init, cacheConfig, l1Client, rollupAddrs, config.Node.ValidatorRequired())
if err != nil {
return chainDb, nil, fmt.Errorf("error pruning: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/prunning/prunning.go → cmd/pruning/pruning.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package prunning
package pruning

import (
"context"
Expand Down
20 changes: 10 additions & 10 deletions system_tests/prunning_test.go → system_tests/pruning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/node"
"github.com/offchainlabs/nitro/cmd/conf"
"github.com/offchainlabs/nitro/cmd/prunning"
"github.com/offchainlabs/nitro/cmd/pruning"
"github.com/offchainlabs/nitro/execution/gethexec"
"github.com/offchainlabs/nitro/util/testhelpers"
)
Expand All @@ -28,7 +28,7 @@ func countStateEntries(db ethdb.Iteratee) int {
return entries
}

func TestPrunning(t *testing.T) {
func TestPruning(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -67,7 +67,7 @@ func TestPrunning(t *testing.T) {
chainDb, err := stack.OpenDatabase("chaindb", 0, 0, "", false)
Require(t, err)
defer chainDb.Close()
chainDbEntriesBeforePrunning := countStateEntries(chainDb)
chainDbEntriesBeforePruning := countStateEntries(chainDb)

prand := testhelpers.NewPseudoRandomDataSource(t, 1)
var testKeys [][]byte
Expand All @@ -88,21 +88,21 @@ func TestPrunning(t *testing.T) {
initConfig := conf.InitConfigDefault
initConfig.Prune = "full"
coreCacheConfig := gethexec.DefaultCacheConfigFor(stack, &builder.execConfig.Caching)
err = prunning.PruneChainDb(ctx, chainDb, stack, &initConfig, coreCacheConfig, builder.L1.Client, *builder.L2.ConsensusNode.DeployInfo, false)
err = pruning.PruneChainDb(ctx, chainDb, stack, &initConfig, coreCacheConfig, builder.L1.Client, *builder.L2.ConsensusNode.DeployInfo, false)
Require(t, err)

for _, key := range testKeys {
if has, _ := chainDb.Has(key); has {
Fatal(t, "test key hasn't been prunned as expected")
Fatal(t, "test key hasn't been pruned as expected")
}
}

chainDbEntriesAfterPrunning := countStateEntries(chainDb)
t.Log("db entries pre-prunning:", chainDbEntriesBeforePrunning)
t.Log("db entries post-prunning:", chainDbEntriesAfterPrunning)
chainDbEntriesAfterPruning := countStateEntries(chainDb)
t.Log("db entries pre-pruning:", chainDbEntriesBeforePruning)
t.Log("db entries post-pruning:", chainDbEntriesAfterPruning)

if chainDbEntriesAfterPrunning >= chainDbEntriesBeforePrunning {
Fatal(t, "The db doesn't have less entries after prunning then before. Before:", chainDbEntriesBeforePrunning, "After:", chainDbEntriesAfterPrunning)
if chainDbEntriesAfterPruning >= chainDbEntriesBeforePruning {
Fatal(t, "The db doesn't have less entries after pruning then before. Before:", chainDbEntriesBeforePruning, "After:", chainDbEntriesAfterPruning)
}
}()
builder := NewNodeBuilder(ctx).DefaultConfig(t, true)
Expand Down

0 comments on commit 32883f1

Please sign in to comment.