Skip to content

Commit

Permalink
Disable streamed genesis for bor spans
Browse files Browse the repository at this point in the history
  • Loading branch information
avalkov committed Oct 21, 2024
1 parent facb388 commit ba6537c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
11 changes: 10 additions & 1 deletion bor/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,14 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState) {

// ExportGenesis returns a GenesisState for a given context and keeper.
func ExportGenesis(ctx sdk.Context, keeper Keeper) types.GenesisState {
return types.NewGenesisState(keeper.GetParams(ctx), nil)
params := keeper.GetParams(ctx)

allSpans := keeper.GetAllSpans(ctx)
hmTypes.SortSpanByID(allSpans)

return types.NewGenesisState(
params,
// TODO think better way to export all spans
allSpans,
)
}
20 changes: 3 additions & 17 deletions bor/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ import (
)

var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ hmModule.HeimdallModuleBasic = AppModule{}
_ hmModule.StreamedGenesisExporter = AppModule{}
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ hmModule.HeimdallModuleBasic = AppModule{}
// _ module.AppModuleSimulation = AppModule{}
)

Expand Down Expand Up @@ -162,16 +161,3 @@ func (am AppModule) NewSideTxHandler() hmTypes.SideTxHandler {
func (am AppModule) NewPostTxHandler() hmTypes.PostTxHandler {
return NewPostTxHandler(am.keeper, am.contractCaller)
}

// NextGenesisData returns the next chunk of genesis data.
func (am AppModule) NextGenesisData(ctx sdk.Context, nextKey []byte, max int) (*hmModule.ModuleGenesisData, error) {
data, nextKey, err := am.keeper.IterateSpansAndCollect(ctx, nextKey, max)
if err != nil {
return nil, err
}
return &hmModule.ModuleGenesisData{
Path: "bor.spans",
Data: types.ModuleCdc.MustMarshalJSON(data),
NextKey: nextKey,
}, nil
}

0 comments on commit ba6537c

Please sign in to comment.