Merge branch 'main' into sai/upgrade_cosmos_v0.46

This commit is contained in:
Sai Kumar
2022-04-23 21:23:06 +05:30
161 changed files with 59008 additions and 258 deletions
+17
View File
@@ -0,0 +1,17 @@
package app
import (
sdk "github.com/cosmos/cosmos-sdk/types"
cmdcfg "github.com/tharsis/ethermint/cmd/config"
)
// sdk config
func init() {
config := sdk.GetConfig()
cmdcfg.SetBech32Prefixes(config)
cmdcfg.SetBip44CoinType(config)
config.Seal()
cmdcfg.RegisterDenoms()
}
+74 -3
View File
@@ -122,6 +122,16 @@ import (
// Force-load the tracer engines to trigger registration due to Go-Ethereum v1.10.15 changes
_ "github.com/ethereum/go-ethereum/eth/tracers/js"
_ "github.com/ethereum/go-ethereum/eth/tracers/native"
"github.com/tharsis/ethermint/x/auction"
auctionkeeper "github.com/tharsis/ethermint/x/auction/keeper"
auctiontypes "github.com/tharsis/ethermint/x/auction/types"
"github.com/tharsis/ethermint/x/bond"
bondkeeper "github.com/tharsis/ethermint/x/bond/keeper"
bondtypes "github.com/tharsis/ethermint/x/bond/types"
"github.com/tharsis/ethermint/x/nameservice"
nameservicekeeper "github.com/tharsis/ethermint/x/nameservice/keeper"
nameservicetypes "github.com/tharsis/ethermint/x/nameservice/types"
)
func init() {
@@ -130,10 +140,10 @@ func init() {
panic(err)
}
DefaultNodeHome = filepath.Join(userHomeDir, ".ethermintd")
DefaultNodeHome = filepath.Join(userHomeDir, ".chibaclonkd")
}
const appName = "ethermintd"
const appName = "chibaclonkd"
var (
// DefaultNodeHome default home directories for the application daemon
@@ -167,6 +177,10 @@ var (
// Ethermint modules
evm.AppModuleBasic{},
feemarket.AppModuleBasic{},
// Vulcanize chiba-clonk modules
auction.AppModuleBasic{},
bond.AppModuleBasic{},
nameservice.AppModuleBasic{},
)
// module account permissions
@@ -178,7 +192,13 @@ var (
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
// ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account
evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account
auctiontypes.ModuleName: nil,
auctiontypes.AuctionBurnModuleAccountName: nil,
nameservicetypes.ModuleName: nil,
nameservicetypes.RecordRentModuleAccountName: nil,
nameservicetypes.AuthorityRentModuleAccountName: nil,
bondtypes.ModuleName: nil,
}
// module accounts that are allowed to receive tokens
@@ -236,6 +256,12 @@ type EthermintApp struct {
EvmKeeper *evmkeeper.Keeper
FeeMarketKeeper feemarketkeeper.Keeper
// chiba-clonk keepers
AuctionKeeper auctionkeeper.Keeper
BondKeeper bondkeeper.Keeper
NameServiceKeeper nameservicekeeper.Keeper
NameServiceRecordKeeper nameservicekeeper.RecordKeeper
// the module manager
mm *module.Manager
@@ -275,6 +301,10 @@ func NewEthermintApp(
// ibchost.StoreKey, ibctransfertypes.StoreKey,
// ethermint keys
evmtypes.StoreKey, feemarkettypes.StoreKey,
// chiba-clonk keys
auctiontypes.StoreKey,
bondtypes.StoreKey,
nameservicetypes.StoreKey,
)
// Add the EVM transient store key
@@ -402,6 +432,27 @@ func NewEthermintApp(
appCodec, keys[feemarkettypes.StoreKey], app.GetSubspace(feemarkettypes.ModuleName),
)
// Create Vulcanize chiba-clonk keepers
app.AuctionKeeper = auctionkeeper.NewKeeper(
app.AccountKeeper, app.BankKeeper, keys[auctiontypes.StoreKey],
appCodec, app.GetSubspace(auctiontypes.ModuleName),
)
app.NameServiceRecordKeeper = nameservicekeeper.NewRecordKeeper(app.AuctionKeeper, keys[nameservicetypes.StoreKey], appCodec)
app.AuctionKeeper.SetUsageKeepers([]auctiontypes.AuctionUsageKeeper{app.NameServiceRecordKeeper})
app.BondKeeper = bondkeeper.NewKeeper(
appCodec, app.AccountKeeper, app.BankKeeper,
[]bondtypes.BondUsageKeeper{app.NameServiceRecordKeeper}, keys[bondtypes.StoreKey], app.GetSubspace(bondtypes.ModuleName),
)
app.NameServiceKeeper = nameservicekeeper.NewKeeper(
appCodec, app.AccountKeeper, app.BankKeeper,
app.NameServiceRecordKeeper, app.BondKeeper, app.AuctionKeeper,
keys[nameservicetypes.StoreKey], app.GetSubspace(nameservicetypes.ModuleName),
)
app.EvmKeeper = evmkeeper.NewKeeper(
appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], app.GetSubspace(evmtypes.ModuleName),
app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.FeeMarketKeeper,
@@ -493,6 +544,10 @@ func NewEthermintApp(
// Ethermint app modules
evm.NewAppModule(app.EvmKeeper, app.AccountKeeper),
feemarket.NewAppModule(app.FeeMarketKeeper),
// chiba-clonk modules
auction.NewAppModule(appCodec, app.AuctionKeeper),
bond.NewAppModule(appCodec, app.BondKeeper),
nameservice.NewAppModule(app.NameServiceKeeper),
)
// During begin block slashing happens after distr.BeginBlocker so that
@@ -521,6 +576,10 @@ func NewEthermintApp(
feegrant.ModuleName,
paramstypes.ModuleName,
vestingtypes.ModuleName,
// chiba-clonk modules
auctiontypes.ModuleName,
bondtypes.ModuleName,
nameservicetypes.ModuleName,
)
// NOTE: fee market module must go last in order to retrieve the block gas used.
@@ -544,6 +603,10 @@ func NewEthermintApp(
paramstypes.ModuleName,
upgradetypes.ModuleName,
vestingtypes.ModuleName,
// chiba-clonk modules
auctiontypes.ModuleName,
bondtypes.ModuleName,
nameservicetypes.ModuleName,
)
// NOTE: The genutils module must occur after staking so that pools are
@@ -571,6 +634,10 @@ func NewEthermintApp(
// Ethermint modules
evmtypes.ModuleName,
feemarkettypes.ModuleName,
// chiba-clonk modules
auctiontypes.ModuleName,
bondtypes.ModuleName,
nameservicetypes.ModuleName,
// NOTE: crisis module must go at the end to check for invariants on each module
crisistypes.ModuleName,
@@ -826,5 +893,9 @@ func initParamsKeeper(
// ethermint subspaces
paramsKeeper.Subspace(evmtypes.ModuleName)
paramsKeeper.Subspace(feemarkettypes.ModuleName)
// chiba-clonk subspaces
paramsKeeper.Subspace(auctiontypes.ModuleName)
paramsKeeper.Subspace(bondtypes.ModuleName)
paramsKeeper.Subspace(nameservicetypes.ModuleName)
return paramsKeeper
}
+15
View File
@@ -4,11 +4,14 @@ import (
"encoding/json"
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/tharsis/ethermint/encoding"
"github.com/cosmos/cosmos-sdk/db/memdb"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmtypes "github.com/tendermint/tendermint/types"
@@ -61,3 +64,15 @@ func Setup(isCheckTx bool, patchGenesis func(*EthermintApp, simapp.GenesisState)
return app
}
// CreateRandomAccounts will generate random accounts
func CreateRandomAccounts(accNum int) []sdk.AccAddress {
// createRandomAccounts is a strategy used by addTestAddrs() in order to generated addresses in random order.
testAddrs := make([]sdk.AccAddress, accNum)
for i := 0; i < accNum; i++ {
pk := ed25519.GenPrivKey().PubKey()
testAddrs[i] = sdk.AccAddress(pk.Address())
}
return testAddrs
}