Skip to content

Commit

Permalink
Merge pull request #3 from ExocoreNetwork/develop-fix-updateParam-bug
Browse files Browse the repository at this point in the history
fix(UpdateParams/tests) Fix bugs and refine tests to ensure ‘make test’ works
  • Loading branch information
TimmyExogenous authored Mar 5, 2024
2 parents 65e90a6 + 3002441 commit eacf9e3
Show file tree
Hide file tree
Showing 88 changed files with 686 additions and 4,266 deletions.
2 changes: 1 addition & 1 deletion app/ethtest_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func NewTestGenesisState(codec codec.Codec) simapp.GenesisState {
Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))),
}

genesisState := NewDefaultGenesisState()
genesisState := NewDefaultGenesisState(codec)
return genesisStateWithValSet(codec, genesisState, valSet, []authtypes.GenesisAccount{acc}, balance)
}

Expand Down
60 changes: 56 additions & 4 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,74 @@ import (
"encoding/json"
"fmt"

tmproto "github.com/cometbft/cometbft/proto/tendermint/types"

"cosmossdk.io/simapp"

"github.com/ExocoreNetwork/exocore/utils"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/codec"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
claimstypes "github.com/evmos/evmos/v14/x/claims/types"
evmtypes "github.com/evmos/evmos/v14/x/evm/types"
inflationtypes "github.com/evmos/evmos/v14/x/inflation/types"

"github.com/evmos/evmos/v14/encoding"
)

// NewDefaultGenesisState generates the default state for the application.
func NewDefaultGenesisState() simapp.GenesisState {
func NewDefaultGenesisState(cdc codec.Codec) simapp.GenesisState {
encCfg := encoding.MakeConfig(ModuleBasics)
return ModuleBasics.DefaultGenesis(encCfg.Codec)
defaultGenesis := ModuleBasics.DefaultGenesis(encCfg.Codec)

// staking module
stakingGenesis := stakingtypes.GenesisState{}
rawGenesis := defaultGenesis[stakingtypes.ModuleName]
cdc.MustUnmarshalJSON(rawGenesis, &stakingGenesis)
stakingGenesis.Params.BondDenom = utils.BaseDenom
defaultGenesis[stakingtypes.ModuleName] = cdc.MustMarshalJSON(&stakingGenesis)

// crisis module
crisisGenesis := crisistypes.GenesisState{}
rawGenesis = defaultGenesis[crisistypes.ModuleName]
cdc.MustUnmarshalJSON(rawGenesis, &crisisGenesis)
crisisGenesis.ConstantFee.Denom = utils.BaseDenom
defaultGenesis[crisistypes.ModuleName] = cdc.MustMarshalJSON(&crisisGenesis)

// gov module
govGenesis := govtypesv1.GenesisState{}
rawGenesis = defaultGenesis[govtypes.ModuleName]
cdc.MustUnmarshalJSON(rawGenesis, &govGenesis)
govGenesis.Params.MinDeposit[0].Denom = utils.BaseDenom
defaultGenesis[govtypes.ModuleName] = cdc.MustMarshalJSON(&govGenesis)

// evm module
evmGenesis := evmtypes.GenesisState{}
rawGenesis = defaultGenesis[evmtypes.ModuleName]
cdc.MustUnmarshalJSON(rawGenesis, &evmGenesis)
evmGenesis.Params.EvmDenom = utils.BaseDenom
defaultGenesis[evmtypes.ModuleName] = cdc.MustMarshalJSON(&evmGenesis)

// inflation module
inflationGenesis := inflationtypes.GenesisState{}
rawGenesis = defaultGenesis[inflationtypes.ModuleName]
cdc.MustUnmarshalJSON(rawGenesis, &inflationGenesis)
inflationGenesis.Params.MintDenom = utils.BaseDenom
defaultGenesis[inflationtypes.ModuleName] = cdc.MustMarshalJSON(&inflationGenesis)

// claims module
claimsGenesis := claimstypes.GenesisState{}
rawGenesis = defaultGenesis[claimstypes.ModuleName]
cdc.MustUnmarshalJSON(rawGenesis, &claimsGenesis)
claimsGenesis.Params.ClaimsDenom = utils.BaseDenom
defaultGenesis[claimstypes.ModuleName] = cdc.MustMarshalJSON(&claimsGenesis)

return defaultGenesis
}

// ExportAppStateAndValidators exports the state of the application for a genesis
Expand Down
8 changes: 4 additions & 4 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
"github.com/evmos/evmos/v14/encoding"
feemarkettypes "github.com/evmos/evmos/v14/x/feemarket/types"

"github.com/evmos/evmos/v14/cmd/config"
"github.com/evmos/evmos/v14/utils"
"github.com/ExocoreNetwork/exocore/cmd/config"
"github.com/ExocoreNetwork/exocore/utils"
)

func init() {
Expand Down Expand Up @@ -106,7 +106,7 @@ func Setup(
)
if !isCheckTx {
// init chain must be called to stop deliverState from being nil
genesisState := NewDefaultGenesisState()
genesisState := NewDefaultGenesisState(app.appCodec)
genesisState = GenesisStateWithValSet(app, genesisState, valSet, []authtypes.GenesisAccount{acc}, balance)

// Verify feeMarket genesis
Expand Down Expand Up @@ -218,6 +218,6 @@ func SetupTestingApp(chainID string, isPrintLog bool) func() (ibctesting.Testing
simtestutil.NewAppOptionsWithFlagHome(DefaultNodeHome),
baseapp.SetChainID(chainID),
)
return app, NewDefaultGenesisState()
return app, NewDefaultGenesisState(app.appCodec)
}
}
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,14 @@ replace (
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
// use Cosmos-SDK fork to enable Ledger functionality
github.com/cosmos/cosmos-sdk => github.com/evmos/cosmos-sdk v0.47.4-evmos.2
//github.com/cosmos/cosmos-sdk => ../cosmos-sdk
//fix cosmos-sdk error
github.com/cosmos/gogoproto => github.com/cosmos/gogoproto v1.4.10
// use Evmos geth fork
github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26-evmos-rc2
// use exocore fork of evmos
github.com/evmos/evmos/v14 => github.com/ExocoreNetwork/evmos/v14 v14.1.1-0.20240205024453-5e8090e42ef4
//github.com/evmos/evmos/v14 => ../ExocoreNetwork/evmos
// Security Advisory https://github.com/advisories/GHSA-h395-qcrw-5vmq
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1
// replace broken goleveldb
Expand Down
Loading

0 comments on commit eacf9e3

Please sign in to comment.