Skip to content

Commit

Permalink
feat: add batching module to app
Browse files Browse the repository at this point in the history
  • Loading branch information
hacheigriega committed Sep 4, 2024
1 parent 76468fc commit 9b8c319
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
25 changes: 23 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,12 @@ import (

"github.com/sedaprotocol/seda-chain/app/keepers"
appparams "github.com/sedaprotocol/seda-chain/app/params"

// Used in cosmos-sdk when registering the route for swagger docs.
_ "github.com/sedaprotocol/seda-chain/client/docs/statik"
"github.com/sedaprotocol/seda-chain/x/batching"
batchingkeeper "github.com/sedaprotocol/seda-chain/x/batching/keeper"
batchingtypes "github.com/sedaprotocol/seda-chain/x/batching/types"
dataproxy "github.com/sedaprotocol/seda-chain/x/data-proxy"
dataproxykeeper "github.com/sedaprotocol/seda-chain/x/data-proxy/keeper"
dataproxytypes "github.com/sedaprotocol/seda-chain/x/data-proxy/types"
Expand Down Expand Up @@ -187,6 +191,7 @@ var (
wasmstorage.AppModuleBasic{},
tally.AppModuleBasic{},
dataproxy.AppModuleBasic{},
batching.AppModuleBasic{},
)

// module account permissions
Expand Down Expand Up @@ -244,6 +249,7 @@ type App struct {
WasmStorageKeeper wasmstoragekeeper.Keeper
TallyKeeper tallykeeper.Keeper
DataProxyKeeper dataproxykeeper.Keeper
BatchingKeeper batchingkeeper.Keeper

mm *module.Manager
bmm module.BasicManager
Expand Down Expand Up @@ -308,7 +314,7 @@ func NewApp(
feegrant.StoreKey, evidencetypes.StoreKey, circuittypes.StoreKey, authzkeeper.StoreKey, group.StoreKey,
capabilitytypes.StoreKey, ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey,
wasmtypes.StoreKey, icahosttypes.StoreKey, icacontrollertypes.StoreKey, packetforwardtypes.StoreKey,
crisistypes.StoreKey, wasmstoragetypes.StoreKey, dataproxytypes.StoreKey,
crisistypes.StoreKey, wasmstoragetypes.StoreKey, dataproxytypes.StoreKey, batchingtypes.StoreKey,
)

memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
Expand Down Expand Up @@ -627,7 +633,18 @@ func NewApp(

app.TallyKeeper = tallykeeper.NewKeeper(app.WasmStorageKeeper, contractKeeper, app.WasmKeeper)

app.DataProxyKeeper = *dataproxykeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[dataproxytypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String())
app.DataProxyKeeper = *dataproxykeeper.NewKeeper(
appCodec,
runtime.NewKVStoreService(keys[dataproxytypes.StoreKey]),
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.BatchingKeeper = batchingkeeper.NewKeeper(
appCodec,
runtime.NewKVStoreService(keys[batchingtypes.StoreKey]),
authtypes.NewModuleAddress(batchingtypes.ModuleName).String(),
app.StakingKeeper,
)

/* =================================================== */
/* TRANSFER STACK */
Expand Down Expand Up @@ -743,6 +760,7 @@ func NewApp(
wasmstorage.NewAppModule(appCodec, app.WasmStorageKeeper),
tally.NewAppModule(app.TallyKeeper),
dataproxy.NewAppModule(appCodec, app.DataProxyKeeper),
batching.NewAppModule(appCodec, app.BatchingKeeper),
crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, nil), // always be last to make sure that it checks for all invariants and not only part of them
)

Expand Down Expand Up @@ -800,6 +818,7 @@ func NewApp(
wasmstoragetypes.ModuleName,
tallytypes.ModuleName,
dataproxytypes.ModuleName,
batchingtypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
Expand Down Expand Up @@ -831,6 +850,7 @@ func NewApp(
wasmstoragetypes.ModuleName,
tallytypes.ModuleName,
dataproxytypes.ModuleName,
batchingtypes.ModuleName,
)

// NOTE: The genutils module must occur after sdkstaking so that pools are
Expand Down Expand Up @@ -868,6 +888,7 @@ func NewApp(
wasmstoragetypes.ModuleName,
tallytypes.ModuleName,
dataproxytypes.ModuleName,
batchingtypes.ModuleName,
}
app.mm.SetOrderInitGenesis(genesisModuleOrder...)
app.mm.SetOrderExportGenesis(genesisModuleOrder...)
Expand Down
4 changes: 2 additions & 2 deletions x/batching/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Keeper struct {
params collections.Item[types.Params]
}

func NewKeeper(cdc codec.BinaryCodec, storeService storetypes.KVStoreService, authority string, sk types.StakingKeeper) *Keeper {
func NewKeeper(cdc codec.BinaryCodec, storeService storetypes.KVStoreService, authority string, sk types.StakingKeeper) Keeper {
sb := collections.NewSchemaBuilder(storeService)

k := Keeper{
Expand All @@ -43,7 +43,7 @@ func NewKeeper(cdc codec.BinaryCodec, storeService storetypes.KVStoreService, au
panic(err)
}
k.Schema = schema
return &k
return k
}

func (k Keeper) SetCurrentBatchNum(ctx context.Context, batchNum uint64) error {
Expand Down

0 comments on commit 9b8c319

Please sign in to comment.