From 9b8c319f8336e50c2dc0de64f9b7e2742e165870 Mon Sep 17 00:00:00 2001 From: hacheigriega Date: Wed, 4 Sep 2024 15:39:28 -0400 Subject: [PATCH] feat: add batching module to app --- app/app.go | 25 +++++++++++++++++++++++-- x/batching/keeper/keeper.go | 4 ++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/app.go b/app/app.go index c6d5bd8a..28e1875b 100644 --- a/app/app.go +++ b/app/app.go @@ -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" @@ -187,6 +191,7 @@ var ( wasmstorage.AppModuleBasic{}, tally.AppModuleBasic{}, dataproxy.AppModuleBasic{}, + batching.AppModuleBasic{}, ) // module account permissions @@ -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 @@ -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) @@ -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 */ @@ -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 ) @@ -800,6 +818,7 @@ func NewApp( wasmstoragetypes.ModuleName, tallytypes.ModuleName, dataproxytypes.ModuleName, + batchingtypes.ModuleName, ) app.mm.SetOrderEndBlockers( @@ -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 @@ -868,6 +888,7 @@ func NewApp( wasmstoragetypes.ModuleName, tallytypes.ModuleName, dataproxytypes.ModuleName, + batchingtypes.ModuleName, } app.mm.SetOrderInitGenesis(genesisModuleOrder...) app.mm.SetOrderExportGenesis(genesisModuleOrder...) diff --git a/x/batching/keeper/keeper.go b/x/batching/keeper/keeper.go index 960ab238..45f013c9 100644 --- a/x/batching/keeper/keeper.go +++ b/x/batching/keeper/keeper.go @@ -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{ @@ -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 {