Skip to content

Commit

Permalink
auth processing
Browse files Browse the repository at this point in the history
  • Loading branch information
MissingNO57 committed Jul 25, 2024
1 parent 84852d0 commit 0e3125e
Show file tree
Hide file tree
Showing 6 changed files with 416 additions and 15 deletions.
25 changes: 16 additions & 9 deletions app/app.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app

import (
"encoding/json"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -757,21 +758,27 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) {

app.UpgradeKeeper.SetUpgradeHandler("fetchd-v0.11.3-8-g929563a", func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {

genesisState, _, err := genutiltypes.GenesisStateFromGenFile(app.cudosPath)
if err != nil {
panic(fmt.Sprintf("failed to unmarshal genesis state: %w", err))
manifest := NewUpgradeManifest()

networkInfo, ok := NetworkInfos[ctx.ChainID()]
if !ok {
panic("Network info not found for chain id: " + ctx.ChainID())
}

err = ProcessAccounts(app, genesisState)
_, genDoc, err := genutiltypes.GenesisStateFromGenFile(app.cudosPath)
if err != nil {
panic(fmt.Sprintf("failed process accounts: %w", err))
panic(fmt.Sprintf("failed to unmarshal genesis state: %w", err))
}

manifest := NewUpgradeManifest()
// unmarshal the app state
var jsonData map[string]interface{}
if err = json.Unmarshal(genDoc.AppState, &jsonData); err != nil {
panic(fmt.Sprintf("failed to unmarshal app state: %w", err))
}

networkInfo, ok := NetworkInfos[ctx.ChainID()]
if !ok {
panic("Network info not found for chain id: " + ctx.ChainID())
err = ProcessAccounts(ctx, app, jsonData, networkInfo, manifest)
if err != nil {
panic(fmt.Sprintf("failed process accounts: %w", err))
}

// Perform ASI upgrade tasks
Expand Down
Loading

0 comments on commit 0e3125e

Please sign in to comment.