Skip to content

Commit

Permalink
fix init genesis order
Browse files Browse the repository at this point in the history
  • Loading branch information
kocubinski committed Dec 11, 2024
1 parent 91d4291 commit 1d25773
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 0 additions & 2 deletions simapp/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
validatemodulev1 "cosmossdk.io/api/cosmos/validate/module/v1"
vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1"
"cosmossdk.io/depinject/appconfig"
benchmark "cosmossdk.io/tools/benchmark/module"
"cosmossdk.io/x/accounts"
"cosmossdk.io/x/authz"
_ "cosmossdk.io/x/authz/module" // import for side-effects
Expand Down Expand Up @@ -175,7 +174,6 @@ var (
circuittypes.ModuleName,
pooltypes.ModuleName,
epochstypes.ModuleName,
benchmark.ModuleName,
},
// When ExportGenesis is not specified, the export genesis module order
// is equal to the init genesis order
Expand Down
9 changes: 9 additions & 0 deletions simapp/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
package simapp

import (
runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1"
appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1"
benchmarkmodulev1 "cosmossdk.io/api/cosmos/benchmark/module/v1"
"cosmossdk.io/depinject/appconfig"
benchmark "cosmossdk.io/tools/benchmark/module"
"fmt"
)

func init() {
Expand All @@ -27,4 +29,11 @@ func init() {
},
}),
})
runtimeConfig := &runtimev1alpha1.Module{}
err := appConfig.Modules[0].Config.UnmarshalTo(runtimeConfig)
if err != nil {
panic(fmt.Errorf("benchmark init: failed to unmarshal runtime module config: %w", err))
}
runtimeConfig.InitGenesis = append(runtimeConfig.InitGenesis, benchmark.ModuleName)
appConfig.Modules[0].Config = appconfig.WrapAny(runtimeConfig)
}
2 changes: 0 additions & 2 deletions simapp/v2/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
validatemodulev1 "cosmossdk.io/api/cosmos/validate/module/v1"
vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1"
"cosmossdk.io/depinject/appconfig"
benchmark "cosmossdk.io/tools/benchmark/module"
"cosmossdk.io/x/accounts"
"cosmossdk.io/x/authz"
_ "cosmossdk.io/x/authz/module" // import for side-effects
Expand Down Expand Up @@ -174,7 +173,6 @@ var (
circuittypes.ModuleName,
pooltypes.ModuleName,
epochstypes.ModuleName,
benchmark.ModuleName,
},
// When ExportGenesis is not specified, the export genesis module order
// is equal to the init genesis order
Expand Down
9 changes: 9 additions & 0 deletions simapp/v2/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
package simapp

import (
runtimev2 "cosmossdk.io/api/cosmos/app/runtime/v2"
appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1"
benchmarkmodulev1 "cosmossdk.io/api/cosmos/benchmark/module/v1"
"cosmossdk.io/depinject/appconfig"
benchmark "cosmossdk.io/tools/benchmark/module"
"fmt"
)

func init() {
Expand All @@ -27,4 +29,11 @@ func init() {
},
}),
})
runtimeConfig := &runtimev2.Module{}
err := ModuleConfig.Modules[0].Config.UnmarshalTo(runtimeConfig)
if err != nil {
panic(fmt.Errorf("benchmark init: failed to unmarshal runtime module config: %w", err))
}
runtimeConfig.InitGenesis = append(runtimeConfig.InitGenesis, benchmark.ModuleName)
ModuleConfig.Modules[0].Config = appconfig.WrapAny(runtimeConfig)
}

0 comments on commit 1d25773

Please sign in to comment.