Skip to content

Commit

Permalink
Manifest config logging
Browse files Browse the repository at this point in the history
  • Loading branch information
MissingNO57 committed Oct 3, 2024
1 parent a7c2bfa commit ba89d00
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,20 +727,21 @@ func (app *App) GetSubspace(moduleName string) paramstypes.Subspace {
return subspace
}

func getNetworkInfo(app *App, ctx sdk.Context) (*NetworkConfig, error) {
func getNetworkInfo(app *App, ctx sdk.Context, manifest *UpgradeManifest) (*NetworkConfig, error) {
// Load network config from file if given
var networkInfo *NetworkConfig
var err error
if app.cudosMigrationConfigPath != "" {
app.Logger().Info("Loading network config", "file", app.cudosMigrationConfigPath, "hash", app.cudosMigrationConfigSha256)
networkInfo, err = LoadNetworkConfigFromFile(app.cudosMigrationConfigPath, &app.cudosMigrationConfigSha256)
manifest.ConfigSource = fmt.Sprintf("file %s %s", app.cudosMigrationConfigPath, app.cudosMigrationConfigSha256)
if err != nil {
return nil, err
}
// Config file not given, config from hardcoded map
} else if info, ok := NetworkInfos[ctx.ChainID()]; ok {
app.Logger().Info("Loading network from map", "chain", ctx.ChainID())

manifest.ConfigSource = fmt.Sprintf("config map %s", ctx.ChainID())
networkInfo = &info
} else {
return nil, fmt.Errorf("network info not found for chain id: %s", ctx.ChainID())
Expand All @@ -762,7 +763,7 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) {
return nil, fmt.Errorf("cudos path not set")
}

networkInfo, err := getNetworkInfo(app, ctx)
networkInfo, err := getNetworkInfo(app, ctx, manifest)
if err != nil {
return nil, err
}
Expand Down
1 change: 1 addition & 0 deletions app/upgrade_v_11_4_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
const manifestFilenameBase = "upgrade_manifest.json"

type UpgradeManifest struct {
ConfigSource string `json:"config_source"`
Reconciliation *UpgradeReconciliation `json:"reconciliation,omitempty"`
Contracts *Contracts `json:"contracts,omitempty"`
IBC *UpgradeIBCTransfers `json:"ibc,omitempty"`
Expand Down

0 comments on commit ba89d00

Please sign in to comment.