fix: simulations for custom modules' genesis params #43
56
scripts/laconicd-devnet.yaml
Executable file
56
scripts/laconicd-devnet.yaml
Executable file
@ -0,0 +1,56 @@
|
|||||||
|
dotenv: .env
|
||||||
|
ethermint_9000-1:
|
||||||
|
cmd: laconicd
|
||||||
|
start-flags: "--trace"
|
||||||
|
app-config:
|
||||||
|
minimum-gas-prices: 0aphoton
|
||||||
|
index-events:
|
||||||
|
- ethereum_tx.ethereumTxHash
|
||||||
|
json-rpc:
|
||||||
|
address: "0.0.0.0:{EVMRPC_PORT}"
|
||||||
|
ws-address: "0.0.0.0:{EVMRPC_PORT_WS}"
|
||||||
|
api: "eth,net,web3,debug"
|
||||||
|
validators:
|
||||||
|
- coins: 1000000000000000000stake,10000000000000000000000aphoton
|
||||||
|
staked: 1000000000000000000stake
|
||||||
|
mnemonic: ${VALIDATOR1_MNEMONIC}
|
||||||
|
- coins: 1000000000000000000stake,10000000000000000000000aphoton
|
||||||
|
staked: 1000000000000000000stake
|
||||||
|
mnemonic: ${VALIDATOR2_MNEMONIC}
|
||||||
|
accounts:
|
||||||
|
- name: community
|
||||||
|
coins: 10000000000000000000000aphoton
|
||||||
|
mnemonic: ${COMMUNITY_MNEMONIC}
|
||||||
|
- name: signer1
|
||||||
|
coins: 20000000000000000000000aphoton
|
||||||
|
mnemonic: ${SIGNER1_MNEMONIC}
|
||||||
|
- name: signer2
|
||||||
|
coins: 30000000000000000000000aphoton
|
||||||
|
mnemonic: ${SIGNER2_MNEMONIC}
|
||||||
|
|
||||||
|
genesis:
|
||||||
|
consensus_params:
|
||||||
|
block:
|
||||||
|
max_bytes: "1048576"
|
||||||
|
max_gas: "81500000"
|
||||||
|
app_state:
|
||||||
|
evm:
|
||||||
|
params:
|
||||||
|
evm_denom: aphoton
|
||||||
|
gov:
|
||||||
|
voting_params:
|
||||||
|
voting_period: "10s"
|
||||||
|
deposit_params:
|
||||||
|
max_deposit_period: "10s"
|
||||||
|
min_deposit:
|
||||||
|
- denom: "aphoton"
|
||||||
|
amount: "1"
|
||||||
|
transfer:
|
||||||
|
params:
|
||||||
|
receive_enabled: true
|
||||||
|
send_enabled: true
|
||||||
|
feemarket:
|
||||||
|
params:
|
||||||
|
no_base_fee: false
|
||||||
|
base_fee: "100000000000"
|
||||||
|
min_gas_multiplier: "0"
|
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||||
@ -19,6 +20,9 @@ import (
|
|||||||
|
|
||||||
"github.com/cerc-io/laconicd/x/auction/client/cli"
|
"github.com/cerc-io/laconicd/x/auction/client/cli"
|
||||||
"github.com/cerc-io/laconicd/x/auction/keeper"
|
"github.com/cerc-io/laconicd/x/auction/keeper"
|
||||||
|
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||||
|
|
||||||
|
"github.com/cerc-io/laconicd/x/auction/simulation"
|
||||||
"github.com/cerc-io/laconicd/x/auction/types"
|
"github.com/cerc-io/laconicd/x/auction/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -140,3 +144,25 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
|
|||||||
gs := ExportGenesis(ctx, am.keeper)
|
gs := ExportGenesis(ctx, am.keeper)
|
||||||
return cdc.MustMarshalJSON(&gs)
|
return cdc.MustMarshalJSON(&gs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
|
||||||
|
simulation.RandomizedGenState(simState)
|
||||||
|
}
|
||||||
|
|
||||||
|
// WeightedOperations returns the all the fee market module operations with their respective weights.
|
||||||
|
func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RandomizedParams creates randomized fee market param changes for the simulator.
|
||||||
|
func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterStoreDecoder registers a decoder for fee market module's types
|
||||||
|
func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {}
|
||||||
|
|
||||||
|
// ProposalContents doesn't return any content functions for governance proposals.
|
||||||
|
func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
23
x/auction/simulation/genesis.go
Normal file
23
x/auction/simulation/genesis.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package simulation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/cosmos/cosmos-sdk/types/module"
|
||||||
|
|
||||||
|
"github.com/cerc-io/laconicd/x/auction/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RandomizedGenState generates a random GenesisState
|
||||||
|
func RandomizedGenState(simState *module.SimulationState) {
|
||||||
|
auctionGenesis := types.DefaultGenesisState()
|
||||||
|
|
||||||
|
bz, err := json.MarshalIndent(auctionGenesis, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, bz)
|
||||||
|
|
||||||
|
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(auctionGenesis)
|
||||||
|
}
|
@ -4,6 +4,7 @@ package types
|
|||||||
// chain config values.
|
// chain config values.
|
||||||
func DefaultGenesisState() *GenesisState {
|
func DefaultGenesisState() *GenesisState {
|
||||||
return &GenesisState{
|
return &GenesisState{
|
||||||
Params: DefaultParams(),
|
Params: DefaultParams(),
|
||||||
|
Auctions: []*Auction{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,18 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/x/bond/client/cli"
|
"github.com/cerc-io/laconicd/x/bond/client/cli"
|
||||||
"github.com/cerc-io/laconicd/x/bond/keeper"
|
"github.com/cerc-io/laconicd/x/bond/keeper"
|
||||||
|
"github.com/cerc-io/laconicd/x/bond/simulation"
|
||||||
"github.com/cerc-io/laconicd/x/bond/types"
|
"github.com/cerc-io/laconicd/x/bond/types"
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/types/module"
|
"github.com/cosmos/cosmos-sdk/types/module"
|
||||||
|
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@ -99,6 +102,28 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
|
|||||||
return cdc.MustMarshalJSON(&gs)
|
return cdc.MustMarshalJSON(&gs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
|
||||||
|
simulation.RandomizedGenState(simState)
|
||||||
|
}
|
||||||
|
|
||||||
|
// WeightedOperations returns the all the fee market module operations with their respective weights.
|
||||||
|
func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RandomizedParams creates randomized fee market param changes for the simulator.
|
||||||
|
func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterStoreDecoder registers a decoder for fee market module's types
|
||||||
|
func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {}
|
||||||
|
|
||||||
|
// ProposalContents doesn't return any content functions for governance proposals.
|
||||||
|
func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (am AppModule) RegisterInvariants(registry sdk.InvariantRegistry) {
|
func (am AppModule) RegisterInvariants(registry sdk.InvariantRegistry) {
|
||||||
keeper.RegisterInvariants(registry, am.keeper)
|
keeper.RegisterInvariants(registry, am.keeper)
|
||||||
}
|
}
|
||||||
|
23
x/bond/simulation/genesis.go
Normal file
23
x/bond/simulation/genesis.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package simulation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/cosmos/cosmos-sdk/types/module"
|
||||||
|
|
||||||
|
"github.com/cerc-io/laconicd/x/bond/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RandomizedGenState generates a random GenesisState
|
||||||
|
func RandomizedGenState(simState *module.SimulationState) {
|
||||||
|
bondGenesis := types.DefaultGenesisState()
|
||||||
|
|
||||||
|
bz, err := json.MarshalIndent(bondGenesis, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, bz)
|
||||||
|
|
||||||
|
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(bondGenesis)
|
||||||
|
}
|
@ -5,5 +5,6 @@ package types
|
|||||||
func DefaultGenesisState() *GenesisState {
|
func DefaultGenesisState() *GenesisState {
|
||||||
return &GenesisState{
|
return &GenesisState{
|
||||||
Params: DefaultParams(),
|
Params: DefaultParams(),
|
||||||
|
Bonds: []*Bond{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,18 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/x/nameservice/client/cli"
|
"github.com/cerc-io/laconicd/x/nameservice/client/cli"
|
||||||
"github.com/cerc-io/laconicd/x/nameservice/keeper"
|
"github.com/cerc-io/laconicd/x/nameservice/keeper"
|
||||||
|
"github.com/cerc-io/laconicd/x/nameservice/simulation"
|
||||||
"github.com/cerc-io/laconicd/x/nameservice/types"
|
"github.com/cerc-io/laconicd/x/nameservice/types"
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/types/module"
|
"github.com/cosmos/cosmos-sdk/types/module"
|
||||||
|
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@ -89,6 +92,29 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
|
|||||||
return cdc.MustMarshalJSON(&gs)
|
return cdc.MustMarshalJSON(&gs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
|
||||||
|
simulation.RandomizedGenState(simState)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// WeightedOperations returns the all the fee market module operations with their respective weights.
|
||||||
|
func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RandomizedParams creates randomized fee market param changes for the simulator.
|
||||||
|
func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterStoreDecoder registers a decoder for fee market module's types
|
||||||
|
func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {}
|
||||||
|
|
||||||
|
// ProposalContents doesn't return any content functions for governance proposals.
|
||||||
|
func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (am AppModule) RegisterInvariants(registry sdk.InvariantRegistry) {
|
func (am AppModule) RegisterInvariants(registry sdk.InvariantRegistry) {
|
||||||
keeper.RegisterInvariants(registry, am.keeper)
|
keeper.RegisterInvariants(registry, am.keeper)
|
||||||
}
|
}
|
||||||
|
23
x/nameservice/simulation/genesis.go
Normal file
23
x/nameservice/simulation/genesis.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package simulation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/cosmos/cosmos-sdk/types/module"
|
||||||
|
|
||||||
|
"github.com/cerc-io/laconicd/x/nameservice/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RandomizedGenState generates a random GenesisState
|
||||||
|
func RandomizedGenState(simState *module.SimulationState) {
|
||||||
|
nameserviceGenesis := types.DefaultGenesisState()
|
||||||
|
|
||||||
|
bz, err := json.MarshalIndent(nameserviceGenesis, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, bz)
|
||||||
|
|
||||||
|
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(nameserviceGenesis)
|
||||||
|
}
|
@ -13,7 +13,10 @@ func NewGenesisState(params Params, records []Record, authorities []AuthorityEnt
|
|||||||
// chain config values.
|
// chain config values.
|
||||||
func DefaultGenesisState() *GenesisState {
|
func DefaultGenesisState() *GenesisState {
|
||||||
return &GenesisState{
|
return &GenesisState{
|
||||||
Params: DefaultParams(),
|
Params: DefaultParams(),
|
||||||
|
Records: []Record{},
|
||||||
|
Authorities: []AuthorityEntry{},
|
||||||
|
Names: []NameEntry{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user