Skip to content

Commit

Permalink
fix inject error
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer-zq committed Jul 23, 2024
1 parent f1ec4a2 commit 0b3f90a
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 100 deletions.
6 changes: 3 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
appante "github.com/bianjieai/irita/app/ante"
"github.com/bianjieai/irita/crypto/hd"
"github.com/bianjieai/irita/lite"
appkeeper "github.com/bianjieai/irita/modules/evm"
appevm "github.com/bianjieai/irita/modules/evm"
tibc "github.com/bianjieai/irita/modules/tibc"
tibckeeper "github.com/bianjieai/irita/modules/tibc/keeper"
"github.com/bianjieai/irita/wrapper"
Expand Down Expand Up @@ -353,7 +353,7 @@ func NewIritaApp(
)
app.nodeKeeper = node.NewKeeper(appCodec, keys[nodetypes.StoreKey], app.GetSubspace(node.ModuleName))

stakingKeeper := wrapper.NewStakingKeeper(app.nodeKeeper)
stakingKeeper := wrapper.NewStakingKeeper(&app.nodeKeeper)
app.slashingKeeper = slashingkeeper.NewKeeper(
appCodec,
cdc,
Expand Down Expand Up @@ -456,7 +456,7 @@ func NewIritaApp(
authorityAddr,
app.accountKeeper,
app.bankKeeper,
appkeeper.WNodeKeeper{Keeper: app.nodeKeeper},
appevm.NewStakingKeeper(app.nodeKeeper),
app.FeeMarketKeeper,
nil,
geth.NewEVM,
Expand Down
45 changes: 27 additions & 18 deletions app/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import (
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
"github.com/cosmos/cosmos-sdk/x/feegrant"
"github.com/cosmos/cosmos-sdk/x/group"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
evmmodulev1 "github.com/evmos/ethermint/api/ethermint/evm/module/v1"

Check failure on line 27 in app/app_config.go

View workflow job for this annotation

GitHub Actions / Test Units

github.com/evmos/[email protected]: replacement directory /Users/dreamer/workspace/github/bianjieai/ethermint does not exist
feemarketmodulev1 "github.com/evmos/ethermint/api/ethermint/feemarket/module/v1"
evmtypes "github.com/evmos/ethermint/x/evm/types"
Expand All @@ -46,19 +44,24 @@ import (
tokentypes "mods.irisnet.org/modules/token/types"

genutilmodulev1 "iritamod.bianjie.ai/api/iritamod/genutil/module/v1"
identitymodulev1 "iritamod.bianjie.ai/api/iritamod/identity/module/v1"
nodemodulev1 "iritamod.bianjie.ai/api/iritamod/node/module/v1"
paramsmodulev1 "iritamod.bianjie.ai/api/iritamod/params/module/v1"
slashingmodulev1 "iritamod.bianjie.ai/api/iritamod/slashing/module/v1"
upgrademodulev1 "iritamod.bianjie.ai/api/iritamod/upgrade/module/v1"
genutiltypes "iritamod.bianjie.ai/modules/genutil"
identitytypes "iritamod.bianjie.ai/modules/identity/types"
nodetypes "iritamod.bianjie.ai/modules/node/types"
paramstypes "iritamod.bianjie.ai/modules/params/types"
slashingtypes "iritamod.bianjie.ai/modules/slashing/types"
upgradetypes "iritamod.bianjie.ai/modules/upgrade/types"

_ "github.com/bianjieai/tibc-go/modules/tibc/apps/mt_transfer" // import for side-effects
_ "iritamod.bianjie.ai/modules/genutil" // import for side-effects
_ "iritamod.bianjie.ai/modules/identity" // import for side-effects
_ "iritamod.bianjie.ai/modules/node" // import for side-effects
_ "iritamod.bianjie.ai/modules/params" // import for side-effects
_ "iritamod.bianjie.ai/modules/slashing" // import for side-effects
_ "iritamod.bianjie.ai/modules/upgrade" // import for side-effects
_ "mods.irisnet.org/modules/mt" // import for side-effects
_ "mods.irisnet.org/modules/oracle" // import for side-effects
Expand All @@ -78,29 +81,29 @@ var (
// can do so safely.
genesisModuleOrder = []string{
capabilitytypes.ModuleName,
authtypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
nodetypes.ModuleName,
nodetypes.ModuleName,
slashingtypes.ModuleName,
crisistypes.ModuleName,
genutiltypes.ModuleName,
crisistypes.ModuleName,
genutiltypes.ModuleName,
evidencetypes.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
upgradetypes.ModuleName,
consensustypes.ModuleName,
mttypes.ModuleName,
nfttypes.ModuleName,
servicetypes.ModuleName,
servicetypes.ModuleName,
oracletypes.ModuleName,
randomtypes.ModuleName,
recordtypes.ModuleName,
identitytypes.ModuleName,
tokentypes.ModuleName,
tibchost.ModuleName,
tibcnfttypes.ModuleName,
tibcmttypes.ModuleName,
evmtypes.ModuleName,
tibcmttypes.ModuleName,
evmtypes.ModuleName,
feemarkettypes.ModuleName,
}

Expand All @@ -113,6 +116,7 @@ var (
{Account: servicetypes.RequestAccName},
{Account: servicetypes.FeeCollectorName, Permissions: []string{authtypes.Burner}},
{Account: tokentypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}},
{Account: evmtypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, // used for secure addition and subtraction of balance using module account
}

// blocked account addresses
Expand All @@ -122,7 +126,7 @@ var (
servicetypes.RequestAccName,
servicetypes.FeeCollectorName,
tokentypes.ModuleName,
evmtypes.ModuleName,
evmtypes.ModuleName,
feemarkettypes.ModuleName,
// We allow the following module accounts to receive funds:
// govtypes.ModuleName
Expand Down Expand Up @@ -152,6 +156,7 @@ var (
genutiltypes.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
identitytypes.ModuleName,
mttypes.ModuleName,
nfttypes.ModuleName,
servicetypes.ModuleName,
Expand All @@ -160,7 +165,7 @@ var (
recordtypes.ModuleName,
tokentypes.ModuleName,
consensustypes.ModuleName,
evmtypes.ModuleName,
evmtypes.ModuleName,
feemarkettypes.ModuleName,
},
EndBlockers: []string{
Expand All @@ -178,14 +183,15 @@ var (
paramstypes.ModuleName,
upgradetypes.ModuleName,
consensustypes.ModuleName,
identitytypes.ModuleName,
mttypes.ModuleName,
nfttypes.ModuleName,
servicetypes.ModuleName,
oracletypes.ModuleName,
randomtypes.ModuleName,
recordtypes.ModuleName,
tokentypes.ModuleName,
evmtypes.ModuleName,
evmtypes.ModuleName,
feemarkettypes.ModuleName,
},
OverrideStoreKeys: []*runtimev1alpha1.StoreKeyConfig{
Expand Down Expand Up @@ -264,6 +270,10 @@ var (
Name: consensustypes.ModuleName,
Config: appconfig.WrapAny(&consensusmodulev1.Module{}),
},
{
Name: identitytypes.ModuleName,
Config: appconfig.WrapAny(&identitymodulev1.Module{}),
},
{
Name: nfttypes.ModuleName,
Config: appconfig.WrapAny(&nftmodule.Module{}),
Expand Down Expand Up @@ -303,9 +313,8 @@ var (
}),
},
{
Name: feemarkettypes.ModuleName,
Config: appconfig.WrapAny(&feemarketmodulev1.Module{
}),
Name: feemarkettypes.ModuleName,
Config: appconfig.WrapAny(&feemarketmodulev1.Module{}),
},
},
})
Expand All @@ -317,4 +326,4 @@ func DefaultDepinjectOptions() DepinjectOptions {
Providers: []interface{}{},
Consumers: []interface{}{},
}
}
}
74 changes: 25 additions & 49 deletions app/app_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import (
"os"

"cosmossdk.io/depinject"
"github.com/bianjieai/irita/crypto/hd"
appkeeper "github.com/bianjieai/irita/modules/evm"
"github.com/bianjieai/irita/wrapper"
tibchost "github.com/bianjieai/tibc-go/modules/tibc/core/24-host"

dbm "github.com/cometbft/cometbft-db"
"github.com/cometbft/cometbft/libs/log"
"github.com/cosmos/cosmos-sdk/baseapp"
Expand All @@ -25,35 +22,32 @@ import (
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper"
feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
cosmosparamstypes "github.com/cosmos/cosmos-sdk/x/params/types"

evmkeeper "github.com/evmos/ethermint/x/evm/keeper"
evmtypes "github.com/evmos/ethermint/x/evm/types"
feemarketkeeper "github.com/evmos/ethermint/x/feemarket/keeper"
feemarkettypes "github.com/evmos/ethermint/x/feemarket/types"

identitykeeper "iritamod.bianjie.ai/modules/identity/keeper"
nodekeeper "iritamod.bianjie.ai/modules/node/keeper"
paramskeeper "iritamod.bianjie.ai/modules/params/keeper"
slashingkeeper "iritamod.bianjie.ai/modules/slashing/keeper"
upgradekeeper "iritamod.bianjie.ai/modules/upgrade/keeper"

mtkeeper "mods.irisnet.org/modules/mt/keeper"
nftkeeper "mods.irisnet.org/modules/nft/keeper"
oraclekeeper "mods.irisnet.org/modules/oracle/keeper"
randomkeeper "mods.irisnet.org/modules/random/keeper"
recordkeeper "mods.irisnet.org/modules/record/keeper"
recordtypes "mods.irisnet.org/modules/record/types"
servicekeeper "mods.irisnet.org/modules/service/keeper"
servicetypes "mods.irisnet.org/modules/service/types"
tokenkeeper "mods.irisnet.org/modules/token/keeper"
tokentypes "mods.irisnet.org/modules/token/types"
identitykeeper "iritamod.bianjie.ai/modules/identity/keeper"
nodekeeper "iritamod.bianjie.ai/modules/node/keeper"
nodetypes "iritamod.bianjie.ai/modules/node/types"
slashingkeeper "iritamod.bianjie.ai/modules/slashing/keeper"
upgradekeeper "iritamod.bianjie.ai/modules/upgrade/keeper"

"github.com/bianjieai/irita/crypto/hd"
"github.com/bianjieai/irita/wrapper"
)

var _ servertypes.Application = (*IritaAppV2)(nil)
Expand Down Expand Up @@ -84,7 +78,7 @@ type IritaAppV2 struct {
OracleKeeper oraclekeeper.Keeper
RandomKeeper randomkeeper.Keeper
IdentityKeeper identitykeeper.Keeper
NodeKeeper nodekeeper.Keeper
NodeKeeper *nodekeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
CapabilityKeeper *capabilitykeeper.Keeper
ConsensusParamsKeeper consensuskeeper.Keeper
Expand Down Expand Up @@ -123,21 +117,18 @@ func NewIritaAppV2(

providers = append(depInjectOptions.Providers,
appOpts,
func(nodeKeeper nodekeeper.Keeper) *wrapper.StakingKeeper {
return wrapper.NewStakingKeeper(nodeKeeper)
},

func(evmKeeper *evmkeeper.Keeper) tokentypes.EVMKeeper {
return wrapper.NewEVMKeeper(evmKeeper)
},

func(nodeKeeper nodekeeper.Keeper) evmtypes.StakingKeeper {
return appkeeper.WNodeKeeper{Keeper: nodeKeeper}
},
)
// merge the AppConfig and other configuration in one config
appConfig = depinject.Configs(
depInjectOptions.Config,
depinject.Provide(
wrapper.ProvideSlashingStakingKeeper,
wrapper.ProvideEvidenceStakingKeeper,
wrapper.ProvideEvmStakingKeeper,
wrapper.ProvideEVMKeeper,
wrapper.ProvideICS20Keeper,
wrapper.ProvideEvmConstructor,
),
depinject.Supply(
providers...,

Expand Down Expand Up @@ -237,7 +228,7 @@ func NewIritaAppV2(
os.Exit(1)
}

app.initParamsKeeper()
// app.initParamsKeeper()

/**** Module Options ****/

Expand Down Expand Up @@ -295,22 +286,7 @@ func (app *IritaAppV2) kvStoreKeys() map[string]*storetypes.KVStoreKey {
// getSubspace returns a param subspace for a given module name.
//
// NOTE: This is solely to be used for testing purposes.
func (app *IritaAppV2) getSubspace(moduleName string) paramstypes.Subspace {
func (app *IritaAppV2) getSubspace(moduleName string) cosmosparamstypes.Subspace {
subspace, _ := app.ParamsKeeper.GetSubspace(moduleName)
return subspace
}

// initParamsKeeper init params keeper and its subspaces
func (app *IritaAppV2) initParamsKeeper() {
app.ParamsKeeper.Subspace(authtypes.ModuleName)
app.ParamsKeeper.Subspace(banktypes.ModuleName)
app.ParamsKeeper.Subspace(nodetypes.ModuleName)
app.ParamsKeeper.Subspace(slashingtypes.ModuleName)
app.ParamsKeeper.Subspace(crisistypes.ModuleName)
app.ParamsKeeper.Subspace(tokentypes.ModuleName)
app.ParamsKeeper.Subspace(recordtypes.ModuleName)
app.ParamsKeeper.Subspace(servicetypes.ModuleName)
app.ParamsKeeper.Subspace(tibchost.ModuleName)
app.ParamsKeeper.Subspace(evmtypes.ModuleName)
app.ParamsKeeper.Subspace(feemarkettypes.ModuleName)
}
}
2 changes: 2 additions & 0 deletions cmd/irita/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"os"

"github.com/cometbft/cometbft/crypto/algo"
"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"

Expand All @@ -11,6 +12,7 @@ import (
)

func main() {
algo.Algo = algo.SM2
rootCmd, _ := cmd.NewRootCmd()
if err := svrcmd.Execute(rootCmd,"", app.DefaultNodeHome); err != nil {
switch e := err.(type) {
Expand Down
17 changes: 9 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ go 1.19
replace (
github.com/cometbft/cometbft => github.com/bianjieai/cometbft v0.37.5-irita-240628
github.com/cosmos/cosmos-sdk => github.com/bianjieai/cosmos-sdk v0.47.12-irita-20240701
github.com/evmos/ethermint => github.com/bianjieai/ethermint v0.22.0-irishub-20240512.0.20240722070835-b3635f161021
github.com/evmos/ethermint => /Users/dreamer/workspace/github/bianjieai/ethermint
// github.com/evmos/ethermint => github.com/bianjieai/ethermint v0.22.0-irishub-20240512.0.20240723082239-bd28be056dc7
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb
)
Expand All @@ -15,13 +16,13 @@ require (
cosmossdk.io/tools/rosetta v0.2.1
github.com/bianjieai/tibc-go v0.5.1-0.20240710015305-5ebf9ca08920
github.com/cosmos/cosmos-sdk v0.47.12
iritamod.bianjie.ai/api v0.0.0-20240722082141-08d88a40c224
iritamod.bianjie.ai/modules/genutil v0.0.0-20240722082141-08d88a40c224
iritamod.bianjie.ai/modules/identity v0.0.0-20240722082141-08d88a40c224
iritamod.bianjie.ai/modules/node v0.0.0-20240722082141-08d88a40c224
iritamod.bianjie.ai/modules/params v0.0.0-20240722082141-08d88a40c224
iritamod.bianjie.ai/modules/slashing v0.0.0-20240722082141-08d88a40c224
iritamod.bianjie.ai/modules/upgrade v0.0.0-20240722082141-08d88a40c224
iritamod.bianjie.ai/api v0.0.0-20240723085042-0822c26e608e
iritamod.bianjie.ai/modules/genutil v0.0.0-20240723085042-0822c26e608e
iritamod.bianjie.ai/modules/identity v0.0.0-20240723085042-0822c26e608e
iritamod.bianjie.ai/modules/node v0.0.0-20240723085042-0822c26e608e
iritamod.bianjie.ai/modules/params v0.0.0-20240723085042-0822c26e608e
iritamod.bianjie.ai/modules/slashing v0.0.0-20240723085042-0822c26e608e
iritamod.bianjie.ai/modules/upgrade v0.0.0-20240723085042-0822c26e608e
mods.irisnet.org/modules/mt v0.0.0-20240705013837-55f906fb239e
mods.irisnet.org/modules/nft v0.0.0-20240705013837-55f906fb239e
mods.irisnet.org/modules/oracle v0.0.0-20240705013837-55f906fb239e
Expand Down
Loading

0 comments on commit 0b3f90a

Please sign in to comment.