diff --git a/golang/cosmos/daemon/cmd/root.go b/golang/cosmos/daemon/cmd/root.go index fcc4fec295c0..35a59ceb1016 100644 --- a/golang/cosmos/daemon/cmd/root.go +++ b/golang/cosmos/daemon/cmd/root.go @@ -284,10 +284,14 @@ func (ac appCreator) newApp( const ( // FlagExportDir is the command-line flag for the "export" command specifying - // where the output of the export should be placed. + // where the output of the export should be placed. It contains both the + // items names below: the genesis file, and a directory containing the + // exported swing-store artifacts FlagExportDir = "export-dir" // ExportedGenesisFileName is the file name used to save the genesis in the export-dir ExportedGenesisFileName = "genesis.json" + // ExportedSwingStoreDirectoryName is the directory name used to save the swing-store + // export (artifacts only) in the export-dir ExportedSwingStoreDirectoryName = "swing-store" ) @@ -319,6 +323,10 @@ func extendCosmosExportCommand(cmd *cobra.Command, hasVMController bool) { if err != nil { return err } + // We unconditionally set FlagSwingStoreExportDir as for export, it makes + // little sense for users to control this location separately, and we don't + // want to override any swing-store artifacts that may be associated to the + // current genesis. serverCtx.Viper.Set(gaia.FlagSwingStoreExportDir, swingStoreExportPath) // This will fail is a genesis.json already exists in the export-dir diff --git a/golang/cosmos/x/swingset/genesis.go b/golang/cosmos/x/swingset/genesis.go index 22fe6cd7e87a..1ff303077ffa 100644 --- a/golang/cosmos/x/swingset/genesis.go +++ b/golang/cosmos/x/swingset/genesis.go @@ -60,8 +60,15 @@ func InitGenesis(ctx sdk.Context, k Keeper, swingStoreExportsHandler *SwingStore } err = swingStoreExportsHandler.RestoreExport( - keeper.SwingStoreExportProvider{BlockHeight: snapshotHeight, GetExportDataReader: getExportDataReader, ReadNextArtifact: artifactProvider.ReadNextArtifact}, - keeper.SwingStoreRestoreOptions{ArtifactMode: keeper.SwingStoreArtifactModeReplay, ExportDataMode: keeper.SwingStoreExportDataModeAll}, + keeper.SwingStoreExportProvider{ + BlockHeight: snapshotHeight, + GetExportDataReader: getExportDataReader, + ReadNextArtifact: artifactProvider.ReadNextArtifact, + }, + keeper.SwingStoreRestoreOptions{ + ArtifactMode: keeper.SwingStoreArtifactModeReplay, + ExportDataMode: keeper.SwingStoreExportDataModeAll, + }, ) if err != nil { panic(err)