feat: replace the cosmos-db.DB interface with core/store interface (#21450)

This commit is contained in:
cool-developer
2024-08-30 21:25:25 +00:00
committed by GitHub
parent f843f1a478
commit ce4fb98cb8
119 changed files with 553 additions and 550 deletions
+6 -5
View File
@@ -9,6 +9,7 @@ import (
dbm "github.com/cosmos/cosmos-db"
"github.com/stretchr/testify/require"
corestore "cosmossdk.io/core/store"
"cosmossdk.io/log"
"github.com/cosmos/cosmos-sdk/baseapp"
@@ -59,7 +60,7 @@ func Run[T SimulationApp](
t *testing.T,
appFactory func(
logger log.Logger,
db dbm.DB,
db corestore.KVStoreWithBatch,
traceStore io.Writer,
loadLatest bool,
appOpts servertypes.AppOptions,
@@ -85,7 +86,7 @@ func RunWithSeeds[T SimulationApp](
t *testing.T,
appFactory func(
logger log.Logger,
db dbm.DB,
db corestore.KVStoreWithBatch,
traceStore io.Writer,
loadLatest bool,
appOpts servertypes.AppOptions,
@@ -134,7 +135,7 @@ func RunWithSeeds[T SimulationApp](
err = simtestutil.CheckExportSimulation(app, tCfg, simParams)
require.NoError(t, err)
if tCfg.Commit {
simtestutil.PrintStats(testInstance.DB)
simtestutil.PrintStats(testInstance.DB.(*dbm.GoLevelDB))
}
for _, step := range postRunActions {
step(t, testInstance)
@@ -153,7 +154,7 @@ func RunWithSeeds[T SimulationApp](
// - ExecLogWriter: Captures block and operation data coming from the simulation
type TestInstance[T SimulationApp] struct {
App T
DB dbm.DB
DB corestore.KVStoreWithBatch
WorkDir string
Cfg simtypes.Config
AppLogger log.Logger
@@ -168,7 +169,7 @@ type TestInstance[T SimulationApp] struct {
func NewSimulationAppInstance[T SimulationApp](
t *testing.T,
tCfg simtypes.Config,
appFactory func(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp)) T,
appFactory func(logger log.Logger, db corestore.KVStoreWithBatch, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp)) T,
) TestInstance[T] {
t.Helper()
workDir := t.TempDir()