Skip to content

Commit

Permalink
Start adding simulation code back.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Witkowski committed Oct 5, 2023
1 parent 6a43635 commit 3162770
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
6 changes: 3 additions & 3 deletions x/ibcratelimit/ibcratelimitmodule/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
ibcratelimitclient "github.com/provenance-io/provenance/x/ibcratelimit/client"
ibcratelimitcli "github.com/provenance-io/provenance/x/ibcratelimit/client/cli"
"github.com/provenance-io/provenance/x/ibcratelimit/client/grpc"
"github.com/provenance-io/provenance/x/ibcratelimit/simulation"
"github.com/provenance-io/provenance/x/ibcratelimit/types"
)

Expand Down Expand Up @@ -98,9 +99,8 @@ func NewAppModule(ics4wrapper ibcratelimit.ICS4Wrapper) AppModule {
}

// GenerateGenesisState creates a randomized GenState of the ibcratelimit module.
func (am AppModule) GenerateGenesisState(_ *module.SimulationState) {
// Todo When we finish simulation
// simulation.RandomizedGenState(simState)
func (am AppModule) GenerateGenesisState(simState *module.SimulationState) {
simulation.RandomizedGenState(simState)
}

// ProposalContents returns content functions used to simulate governance proposals.
Expand Down
24 changes: 24 additions & 0 deletions x/ibcratelimit/simulation/genesis.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package simulation

// DONTCOVER

import (
"encoding/json"
"fmt"

"github.com/cosmos/cosmos-sdk/types/module"

"github.com/provenance-io/provenance/x/ibcratelimit/types"
)

// RandomizedGenState generates a random GenesisState for ibchooks
func RandomizedGenState(simState *module.SimulationState) {
genesis := types.DefaultGenesis()

bz, err := json.MarshalIndent(genesis, "", " ")
if err != nil {
panic(err)
}
fmt.Printf("Selected randomly generated ibchooks parameters:\n%s\n", bz)
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(genesis)
}

0 comments on commit 3162770

Please sign in to comment.