diff --git a/app/app.go b/app/app.go index 439e4ce5..edbf21a0 100644 --- a/app/app.go +++ b/app/app.go @@ -217,10 +217,10 @@ type App struct { invCheckPeriod uint - cudosPath string - cudosSha256 string - configPath string - configSha256 string + cudosGenesisPath string + cudosGenesisSha256 string + cudosMigrationConfigPath string + cudosMigrationConfigSha256 string // keys to access the substores keys map[string]*sdk.KVStoreKey @@ -261,7 +261,7 @@ type App struct { // NewSimApp returns a reference to an initialized SimApp. func New( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, - skipUpgradeHeights map[int64]bool, homePath string, invCheckPeriod uint, cudosPath string, configPath string, cudosSha256 string, configSha256 string, encodingConfig appparams.EncodingConfig, enabledProposals []wasm.ProposalType, + skipUpgradeHeights map[int64]bool, homePath string, invCheckPeriod uint, cudosGenesisPath string, cudosMigrationConfigPath string, cudosGenesisSha256 string, cudosMigrationConfigSha256 string, encodingConfig appparams.EncodingConfig, enabledProposals []wasm.ProposalType, appOpts servertypes.AppOptions, wasmOpts []wasm.Option, baseAppOptions ...func(*baseapp.BaseApp), ) *App { @@ -285,18 +285,18 @@ func New( memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) app := &App{ - BaseApp: bApp, - legacyAmino: legacyAmino, - appCodec: appCodec, - interfaceRegistry: interfaceRegistry, - invCheckPeriod: invCheckPeriod, - cudosPath: cudosPath, - configPath: configPath, - cudosSha256: cudosSha256, - configSha256: configSha256, - keys: keys, - tkeys: tkeys, - memKeys: memKeys, + BaseApp: bApp, + legacyAmino: legacyAmino, + appCodec: appCodec, + interfaceRegistry: interfaceRegistry, + invCheckPeriod: invCheckPeriod, + cudosGenesisPath: cudosGenesisPath, + cudosGenesisSha256: cudosGenesisSha256, + cudosMigrationConfigPath: cudosMigrationConfigPath, + cudosMigrationConfigSha256: cudosMigrationConfigSha256, + keys: keys, + tkeys: tkeys, + memKeys: memKeys, } app.ParamsKeeper = initParamsKeeper(appCodec, legacyAmino, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) @@ -731,8 +731,8 @@ func getNetworkInfo(app *App, ctx sdk.Context) (*NetworkConfig, error) { // Load network config from file if given var networkInfo *NetworkConfig var err error - if app.configPath != "" { - networkInfo, err = LoadNetworkConfigFromFile(app.configPath, &app.configSha256) + if app.cudosMigrationConfigPath != "" { + networkInfo, err = LoadNetworkConfigFromFile(app.cudosMigrationConfigPath, &app.cudosMigrationConfigSha256) if err != nil { return nil, err } @@ -755,7 +755,7 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) { manifest := NewUpgradeManifest() - if app.cudosPath == "" { + if app.cudosGenesisPath == "" { return nil, fmt.Errorf("cudos path not set") } diff --git a/app/upgrade_cudos.go b/app/upgrade_cudos.go index 1e881ba4..100ac44a 100644 --- a/app/upgrade_cudos.go +++ b/app/upgrade_cudos.go @@ -147,19 +147,19 @@ func CudosMergeUpgradeHandler(app *App, ctx sdk.Context, cudosCfg *CudosMergeCon return fmt.Errorf("cudos CudosMergeConfig not provided (null pointer passed in)") } - if app.cudosPath == "" { + if app.cudosGenesisPath == "" { return fmt.Errorf("cudos path not set") } - actualGenesisSha256Hex, err := GenerateSHA256FromFile(app.cudosPath) + actualGenesisSha256Hex, err := GenerateSHA256FromFile(app.cudosGenesisPath) if err != nil { - return fmt.Errorf("failed to generate sha256 out of genesis file %v: %w", app.cudosPath, err) + return fmt.Errorf("failed to generate sha256 out of genesis file %v: %w", app.cudosGenesisPath, err) } - if app.cudosSha256 != actualGenesisSha256Hex { - return fmt.Errorf("sha256 failed to verify: genesis file \"%v\" hash %v does not match expected hash %v", app.cudosPath, actualGenesisSha256Hex, app.cudosSha256) + if app.cudosGenesisSha256 != actualGenesisSha256Hex { + return fmt.Errorf("sha256 failed to verify: genesis file \"%v\" hash %v does not match expected hash %v", app.cudosGenesisPath, actualGenesisSha256Hex, app.cudosGenesisSha256) } - _, genDoc, err := genutiltypes.GenesisStateFromGenFile(app.cudosPath) + _, genDoc, err := genutiltypes.GenesisStateFromGenFile(app.cudosGenesisPath) if err != nil { return fmt.Errorf("failed to unmarshal genesis state: %w", err) } diff --git a/cmd/fetchd/cmd/cudos_merge.go b/cmd/fetchd/cmd/cudos_merge.go index bfec112b..4e183e87 100644 --- a/cmd/fetchd/cmd/cudos_merge.go +++ b/cmd/fetchd/cmd/cudos_merge.go @@ -7,15 +7,15 @@ import ( // Module init related flags const ( - FlagCudosPath = "cudos-path" - FlagConfigPath = "config-path" - FlagCudosSha256 = "cudos-sha256" - FlagConfigSha256 = "config-sha256" + FlagCudosGenesisPath = "cudos-genesis-path" + FlagCudosGenesisSha256 = "cudos-genesis-sha256" + FlagCudosMigrationConfigPath = "cudos-migration-config-path" + FlagCudosMigrationConfigSha256 = "cudos-migration-config-sha256" ) func AddCudosFlags(startCmd *cobra.Command) { - startCmd.Flags().String(FlagCudosPath, "", "Cudos genesis file path. Required to be provided *exclusively* during cudos migration upgrade node start, *ignored* on all subsequent node starts.") - startCmd.Flags().String(FlagConfigPath, "", "Upgrade config file path. Required to be provided *exclusively* during cudos migration upgrade node start, *ignored* on all subsequent node starts.") - startCmd.Flags().String(FlagCudosSha256, "", "Sha256 of the cudos genesis file. Optional to be provided *exclusively* during cudos migration upgrade node start, *ignored* on all subsequent node starts.") - startCmd.Flags().String(FlagConfigSha256, "", fmt.Sprintf("Sha256 of the upgrade config file. Required if to be provided *exclusively* during cudos migration upgrade node start and *only IF* \"%v\" flag has been provided, *ignored* on all subsequent node starts.", FlagConfigPath)) + startCmd.Flags().String(FlagCudosGenesisPath, "", "Cudos genesis file path. Required to be provided *exclusively* during cudos migration upgrade node start, *ignored* on all subsequent node starts.") + startCmd.Flags().String(FlagCudosMigrationConfigPath, "", "Upgrade config file path. Required to be provided *exclusively* during cudos migration upgrade node start, *ignored* on all subsequent node starts.") + startCmd.Flags().String(FlagCudosGenesisSha256, "", "Sha256 of the cudos genesis file. Optional to be provided *exclusively* during cudos migration upgrade node start, *ignored* on all subsequent node starts.") + startCmd.Flags().String(FlagCudosMigrationConfigSha256, "", fmt.Sprintf("Sha256 of the upgrade config file. Required if to be provided *exclusively* during cudos migration upgrade node start and *only IF* \"%v\" flag has been provided, *ignored* on all subsequent node starts.", FlagCudosMigrationConfigPath)) } diff --git a/cmd/fetchd/cmd/root.go b/cmd/fetchd/cmd/root.go index 5973fc46..47ddfa75 100644 --- a/cmd/fetchd/cmd/root.go +++ b/cmd/fetchd/cmd/root.go @@ -249,10 +249,10 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a logger, db, traceStore, true, skipUpgradeHeights, cast.ToString(appOpts.Get(flags.FlagHome)), cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), - cast.ToString(appOpts.Get(FlagCudosPath)), - cast.ToString(appOpts.Get(FlagConfigPath)), - cast.ToString(appOpts.Get(FlagCudosSha256)), - cast.ToString(appOpts.Get(FlagConfigSha256)), + cast.ToString(appOpts.Get(FlagCudosGenesisPath)), + cast.ToString(appOpts.Get(FlagCudosMigrationConfigPath)), + cast.ToString(appOpts.Get(FlagCudosGenesisSha256)), + cast.ToString(appOpts.Get(FlagCudosMigrationConfigSha256)), a.encCfg, app.GetEnabledProposals(), appOpts,