diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index bf672a69d5..b25443460a 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -37,6 +37,7 @@ import ( const MaxItemsForList = 10 +// Copy represents a set of modules for which, the entire state is copied without any modifications var Copy = map[string]bool{ slashingtypes.ModuleName: true, govtypes.ModuleName: true, @@ -50,6 +51,8 @@ var Copy = map[string]bool{ emissionsModuleTypes.ModuleName: true, authz.ModuleName: true, } + +// Skip represents a set of modules for which, the entire state is skipped and nothing gets imported var Skip = map[string]bool{ evmtypes.ModuleName: true, stakingtypes.ModuleName: true, @@ -60,6 +63,7 @@ var Skip = map[string]bool{ group.ModuleName: true, } +// Modify represents a set of modules for which, the state is modified before importing. Each Module should have a corresponding Modify function var Modify = map[string]bool{ crosschaintypes.ModuleName: true, observertypes.ModuleName: true, @@ -141,6 +145,8 @@ func ImportDataIntoFile(genDoc *types.GenesisDoc, importFile *types.GenesisDoc, return nil } +// ModifyCrossChainState modifies the crosschain state before importing +// It truncates the crosschain transactions, inbound transactions and finalized inbounds to MaxItemsForList func ModifyCrossChainState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { importedCrossChainGenState := crosschaintypes.GetGenesisStateFromAppState(cdc, importAppState) importedCrossChainGenState.CrossChainTxs = importedCrossChainGenState.CrossChainTxs[:math.Min(MaxItemsForList, len(importedCrossChainGenState.CrossChainTxs))] @@ -154,6 +160,8 @@ func ModifyCrossChainState(appState map[string]json.RawMessage, importAppState m return nil } +// ModifyObserverState modifies the observer state before importing +// It truncates the ballots and nonce to cctx list to MaxItemsForList func ModifyObserverState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { importedObserverGenState := observertypes.GetGenesisStateFromAppState(cdc, importAppState) importedObserverGenState.Ballots = importedObserverGenState.Ballots[:math.Min(MaxItemsForList, len(importedObserverGenState.Ballots))]