Skip to content

Commit

Permalink
[config] Configure action store as default (#4464)
Browse files Browse the repository at this point in the history
  • Loading branch information
envestcc authored Oct 31, 2024
1 parent 882cb4e commit 2d2523c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions actpool/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ var (
MinGasPriceStr: big.NewInt(unit.Qev).String(),
BlackList: []string{},
MaxNumBlobsPerAcct: 16,
Store: &StoreConfig{
Store: actionStoreConfig{
Datadir: "/var/data/actpool.cache",
Datacap: 1024 * 1024 * 100, // 100MB
},
ReadInterval: 10 * time.Minute,
},
}
)

Expand Down
13 changes: 13 additions & 0 deletions e2etest/e2etest.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"os"
"slices"
"testing"
"time"
Expand Down Expand Up @@ -346,18 +347,27 @@ func initDBPaths(r *require.Assertions, cfg *config.Config) {
r.NoError(err)
testBlobPath, err := testutil.PathOfTempFile("blob")
r.NoError(err)
testStakingIndexPath, err := testutil.PathOfTempFile("stakingindex")
r.NoError(err)

cfg.Chain.TrieDBPatchFile = ""
cfg.Chain.TrieDBPath = testTriePath
cfg.Chain.ChainDBPath = testDBPath
cfg.Chain.BlobStoreDBPath = ""
cfg.Chain.IndexDBPath = testIndexPath
cfg.Chain.StakingIndexDBPath = testStakingIndexPath
cfg.Chain.ContractStakingIndexDBPath = testContractIndexPath
cfg.Chain.BloomfilterIndexDBPath = testBloomfilterIndexPath
cfg.Chain.CandidateIndexDBPath = testCandidateIndexPath
cfg.System.SystemLogDBPath = testSystemLogPath
cfg.Consensus.RollDPoS.ConsensusDBPath = testConsensusPath
cfg.Chain.BlobStoreDBPath = testBlobPath

if cfg.ActPool.Store != nil {
testActionStorePath, err := os.MkdirTemp(os.TempDir(), "actionstore")
r.NoError(err)
cfg.ActPool.Store.Store.Datadir = testActionStorePath
}
}

func clearDBPaths(cfg *config.Config) {
Expand All @@ -372,4 +382,7 @@ func clearDBPaths(cfg *config.Config) {
testutil.CleanupPath(cfg.System.SystemLogDBPath)
testutil.CleanupPath(cfg.Consensus.RollDPoS.ConsensusDBPath)
testutil.CleanupPath(cfg.Chain.BlobStoreDBPath)
if cfg.ActPool.Store != nil {
testutil.CleanupPath(cfg.ActPool.Store.Store.Datadir)
}
}
7 changes: 7 additions & 0 deletions server/itx/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package itx

import (
"context"
"os"
"testing"
"time"

Expand Down Expand Up @@ -82,6 +83,8 @@ func newConfig(t *testing.T) (config.Config, func()) {
require.NoError(err)
contractIndexPath, err := testutil.PathOfTempFile("contractindxer.db")
require.NoError(err)
testActionStorePath, err := os.MkdirTemp(os.TempDir(), "actionstore")
require.NoError(err)
cfg := config.Default
cfg.API.GRPCPort = testutil.RandomPort()
cfg.API.HTTPPort = testutil.RandomPort()
Expand All @@ -92,12 +95,16 @@ func newConfig(t *testing.T) (config.Config, func()) {
cfg.Chain.TrieDBPatchFile = ""
cfg.Chain.BlobStoreDBPath = blobPath
cfg.Chain.ContractStakingIndexDBPath = contractIndexPath
if cfg.ActPool.Store != nil {
cfg.ActPool.Store.Store.Datadir = testActionStorePath
}
return cfg, func() {
testutil.CleanupPath(dbPath)
testutil.CleanupPath(triePath)
testutil.CleanupPath(indexPath)
testutil.CleanupPath(blobPath)
testutil.CleanupPath(contractIndexPath)
testutil.CleanupPath(blobPath)
testutil.CleanupPath(testActionStorePath)
}
}

0 comments on commit 2d2523c

Please sign in to comment.