From b3c84ece58b09e2dbfbd58e587f835bb4915633d Mon Sep 17 00:00:00 2001 From: yilong <390715082@qq.com> Date: Wed, 5 Jun 2024 13:46:24 +0800 Subject: [PATCH] Update iritamod and module definitions --- app/ante/ante.go | 2 -- app/ante/handler_options.go | 6 ---- app/ante/perm.go | 63 ----------------------------------- app/app.go | 16 --------- app/app_test.go | 17 +--------- cmd/irita/cmd/genaccounts.go | 21 ------------ cmd/irita/cmd/genrootcert.go | 4 +-- cmd/irita/cmd/testnet.go | 25 +++----------- cmd/irita/cmd/utils.go | 4 +-- go.mod | 23 +++++++------ go.sum | 4 +-- modules/evm/eth.go | 27 --------------- proto/opb/genesis.proto | 12 ------- proto/opb/opb.proto | 18 ---------- proto/opb/query.proto | 25 -------------- proto/opb/tx.proto | 42 ----------------------- proto/wservice/genesis.proto | 12 ------- proto/wservice/wservice.proto | 14 -------- simapp/app.go | 12 ------- simapp/test_helpers.go | 12 ------- wallet/keys/export.go | 4 +-- 21 files changed, 27 insertions(+), 336 deletions(-) delete mode 100644 app/ante/perm.go delete mode 100644 proto/opb/genesis.proto delete mode 100644 proto/opb/opb.proto delete mode 100644 proto/opb/query.proto delete mode 100644 proto/opb/tx.proto delete mode 100644 proto/wservice/genesis.proto delete mode 100644 proto/wservice/wservice.proto diff --git a/app/ante/ante.go b/app/ante/ante.go index 12608fba..a7e5145a 100644 --- a/app/ante/ante.go +++ b/app/ante/ante.go @@ -5,7 +5,6 @@ import ( "runtime/debug" evmmoduleante "github.com/bianjieai/irita/modules/evm" - "github.com/bianjieai/iritamod/modules/perm" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" @@ -19,7 +18,6 @@ import ( ) type HandlerOptions struct { - PermKeeper perm.Keeper AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper FeegrantKeeper authante.FeegrantKeeper diff --git a/app/ante/handler_options.go b/app/ante/handler_options.go index 2f81ef94..b4c8cd01 100644 --- a/app/ante/handler_options.go +++ b/app/ante/handler_options.go @@ -2,7 +2,6 @@ package ante import ( evmmoduleante "github.com/bianjieai/irita/modules/evm" - "github.com/bianjieai/iritamod/modules/perm" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/ante" tokenkeeper "github.com/irisnet/irismod/modules/token/keeper" @@ -13,8 +12,6 @@ func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler { return sdk.ChainAnteDecorators( ethermintante.NewEthSetUpContextDecorator(options.EvmKeeper), // outermost AnteDecorator. SetUpContext must be called first - perm.NewAuthDecorator(options.PermKeeper), - evmmoduleante.NewEthContractCallableDecorator(options.PermKeeper), evmmoduleante.NewEthSigVerificationDecorator(options.EvmKeeper, options.AccountKeeper, options.SignModeHandler), ethermintante.NewEthMempoolFeeDecorator(options.EvmKeeper), // Check eth effective gas price against minimal-gas-prices @@ -30,7 +27,6 @@ func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler { func newCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler { return sdk.ChainAnteDecorators( ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first - perm.NewAuthDecorator(options.PermKeeper), ante.NewMempoolFeeDecorator(), ante.NewValidateBasicDecorator(), ante.NewValidateMemoDecorator(options.AccountKeeper), @@ -53,8 +49,6 @@ func newCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler { ante.NewSetUpContextDecorator(), // perm check - perm.NewAuthDecorator(options.PermKeeper), - evmmoduleante.NewEthContractCallableDecorator(options.PermKeeper), evmmoduleante.NewEthSigVerificationDecorator(options.EvmKeeper, options.AccountKeeper, options.SignModeHandler), // NOTE: extensions option decorator removed diff --git a/app/ante/perm.go b/app/ante/perm.go deleted file mode 100644 index 5502a1ca..00000000 --- a/app/ante/perm.go +++ /dev/null @@ -1,63 +0,0 @@ -package ante - -import ( - tibctypes "github.com/bianjieai/irita/modules/tibc/types" - "github.com/bianjieai/iritamod/modules/identity" - "github.com/bianjieai/iritamod/modules/node" - "github.com/bianjieai/iritamod/modules/params" - "github.com/bianjieai/iritamod/modules/perm" - upgradetypes "github.com/bianjieai/iritamod/modules/upgrade/types" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - mttypes "github.com/irisnet/irismod/modules/mt/types" - nfttypes "github.com/irisnet/irismod/modules/nft/types" - oracletypes "github.com/irisnet/irismod/modules/oracle/types" - servicetypes "github.com/irisnet/irismod/modules/service/types" - tokentypes "github.com/irisnet/irismod/modules/token/types" -) - -func RegisterAccessControl(permKeeper perm.Keeper) perm.Keeper { - // permission auth - permKeeper.RegisterMsgAuth(&perm.MsgAssignRoles{}, perm.RoleRootAdmin, perm.RolePermAdmin) - permKeeper.RegisterMsgAuth(&perm.MsgUnassignRoles{}, perm.RoleRootAdmin, perm.RolePermAdmin) - - // blacklist auth - permKeeper.RegisterMsgAuth(&perm.MsgBlockAccount{}, perm.RoleRootAdmin, perm.RoleBlacklistAdmin) - permKeeper.RegisterMsgAuth(&perm.MsgUnblockAccount{}, perm.RoleRootAdmin, perm.RoleBlacklistAdmin) - permKeeper.RegisterMsgAuth(&perm.MsgBlockContract{}, perm.RoleRootAdmin, perm.RoleBlacklistAdmin) - permKeeper.RegisterMsgAuth(&perm.MsgUnblockContract{}, perm.RoleRootAdmin, perm.RoleBlacklistAdmin) - - // node auth - permKeeper.RegisterModuleAuth(node.ModuleName, perm.RoleRootAdmin, perm.RoleNodeAdmin) - permKeeper.RegisterMsgAuth(&node.MsgRemoveValidator{}, perm.RoleRootAdmin, perm.RoleNodeAdmin) - permKeeper.RegisterMsgAuth(&node.MsgCreateValidator{}, perm.RoleRootAdmin, perm.RoleNodeAdmin) - permKeeper.RegisterMsgAuth(&node.MsgUpdateValidator{}, perm.RoleRootAdmin, perm.RoleNodeAdmin) - permKeeper.RegisterModuleAuth(slashingtypes.ModuleName, perm.RoleRootAdmin, perm.RoleNodeAdmin) - - // param auth - permKeeper.RegisterModuleAuth(params.ModuleName, perm.RoleRootAdmin, perm.RoleParamAdmin) - - // identity auth - permKeeper.RegisterMsgAuth(&identity.MsgCreateIdentity{}, perm.RoleRootAdmin, perm.RoleIDAdmin) - - // oracle auth - permKeeper.RegisterModuleAuth(oracletypes.ModuleName, perm.RoleRootAdmin, perm.RolePowerUser) - - // power user auth - permKeeper.RegisterMsgAuth(&tokentypes.MsgIssueToken{}, perm.RoleRootAdmin, perm.RolePowerUser) - permKeeper.RegisterMsgAuth(&nfttypes.MsgIssueDenom{}, perm.RoleRootAdmin, perm.RolePowerUser) - permKeeper.RegisterMsgAuth(&mttypes.MsgIssueDenom{}, perm.RoleRootAdmin, perm.RolePowerUser) - permKeeper.RegisterMsgAuth(&servicetypes.MsgDefineService{}, perm.RoleRootAdmin, perm.RolePowerUser) - permKeeper.RegisterMsgAuth(&servicetypes.MsgBindService{}, perm.RoleRootAdmin, perm.RolePowerUser) - - // upgrade auth - permKeeper.RegisterModuleAuth(upgradetypes.ModuleName, perm.RoleRootAdmin, perm.RoleNodeAdmin) - - // tibc auth - permKeeper.RegisterModuleAuth(tibctypes.ModuleName, perm.RoleRootAdmin, perm.RoleNodeAdmin) - permKeeper.RegisterMsgAuth(&tibctypes.MsgCreateClient{}, perm.RoleRootAdmin, perm.RoleNodeAdmin) - permKeeper.RegisterMsgAuth(&tibctypes.MsgRegisterRelayer{}, perm.RoleRootAdmin, perm.RoleNodeAdmin) - permKeeper.RegisterMsgAuth(&tibctypes.MsgUpgradeClient{}, perm.RoleRootAdmin, perm.RoleNodeAdmin) - permKeeper.RegisterMsgAuth(&tibctypes.MsgSetRoutingRules{}, perm.RoleRootAdmin, perm.RoleNodeAdmin) - - return permKeeper -} diff --git a/app/app.go b/app/app.go index 71dd0916..e17c676b 100644 --- a/app/app.go +++ b/app/app.go @@ -92,9 +92,6 @@ import ( nodekeeper "github.com/bianjieai/iritamod/modules/node/keeper" nodetypes "github.com/bianjieai/iritamod/modules/node/types" cparams "github.com/bianjieai/iritamod/modules/params" - "github.com/bianjieai/iritamod/modules/perm" - permkeeper "github.com/bianjieai/iritamod/modules/perm/keeper" - permtypes "github.com/bianjieai/iritamod/modules/perm/types" cslashing "github.com/bianjieai/iritamod/modules/slashing" "github.com/bianjieai/iritamod/modules/upgrade" upgradekeeper "github.com/bianjieai/iritamod/modules/upgrade/keeper" @@ -146,7 +143,6 @@ var storeKeys = []string{ servicetypes.StoreKey, oracletypes.StoreKey, randomtypes.StoreKey, - permtypes.StoreKey, identitytypes.StoreKey, nodetypes.StoreKey, tibchost.StoreKey, @@ -181,7 +177,6 @@ var ( service.AppModuleBasic{}, oracle.AppModuleBasic{}, random.AppModuleBasic{}, - perm.AppModuleBasic{}, identity.AppModuleBasic{}, node.AppModuleBasic{}, tibc.AppModule{}, @@ -263,7 +258,6 @@ type IritaApp struct { serviceKeeper servicekeeper.Keeper oracleKeeper oraclekeeper.Keeper randomKeeper randomkeeper.Keeper - permKeeper permkeeper.Keeper identityKeeper identitykeeper.Keeper nodeKeeper nodekeeper.Keeper feeGrantKeeper feegrantkeeper.Keeper @@ -379,9 +373,6 @@ func NewIritaApp( stakingtypes.NewMultiStakingHooks(app.slashingKeeper.Hooks()), ) - permKeeper := permkeeper.NewKeeper(appCodec, keys[permtypes.StoreKey]) - app.permKeeper = appante.RegisterAccessControl(permKeeper) - app.identityKeeper = identitykeeper.NewKeeper(appCodec, keys[identitytypes.StoreKey]) // evm @@ -448,7 +439,6 @@ func NewIritaApp( service.NewAppModule(appCodec, app.serviceKeeper, app.accountKeeper, app.bankKeeper), oracle.NewAppModule(appCodec, app.oracleKeeper, app.accountKeeper, app.bankKeeper), random.NewAppModule(appCodec, app.randomKeeper, app.accountKeeper, app.bankKeeper), - perm.NewAppModule(appCodec, app.permKeeper), identity.NewAppModule(app.identityKeeper), record.NewAppModule(appCodec, app.recordKeeper, app.accountKeeper, app.bankKeeper), node.NewAppModule(appCodec, app.nodeKeeper), @@ -467,7 +457,6 @@ func NewIritaApp( app.mm.SetOrderBeginBlockers( paramstypes.ModuleName, upgradetypes.ModuleName, - permtypes.ModuleName, authtypes.ModuleName, nodetypes.ModuleName, banktypes.ModuleName, @@ -494,7 +483,6 @@ func NewIritaApp( app.mm.SetOrderEndBlockers( paramstypes.ModuleName, upgradetypes.ModuleName, - permtypes.ModuleName, authtypes.ModuleName, nodetypes.ModuleName, banktypes.ModuleName, @@ -527,7 +515,6 @@ func NewIritaApp( app.mm.SetOrderInitGenesis( paramstypes.ModuleName, upgradetypes.ModuleName, - permtypes.ModuleName, authtypes.ModuleName, nodetypes.ModuleName, banktypes.ModuleName, @@ -555,7 +542,6 @@ func NewIritaApp( app.mm.SetOrderMigrations( paramstypes.ModuleName, upgradetypes.ModuleName, - permtypes.ModuleName, authtypes.ModuleName, nodetypes.ModuleName, banktypes.ModuleName, @@ -603,7 +589,6 @@ func NewIritaApp( service.NewAppModule(appCodec, app.serviceKeeper, app.accountKeeper, app.bankKeeper), oracle.NewAppModule(appCodec, app.oracleKeeper, app.accountKeeper, app.bankKeeper), random.NewAppModule(appCodec, app.randomKeeper, app.accountKeeper, app.bankKeeper), - perm.NewAppModule(appCodec, app.permKeeper), identity.NewAppModule(app.identityKeeper), node.NewAppModule(appCodec, app.nodeKeeper), tibc.NewAppModule(app.tibcKeeper), @@ -626,7 +611,6 @@ func NewIritaApp( app.SetBeginBlocker(app.BeginBlocker) anteHandler := appante.NewAnteHandler( appante.HandlerOptions{ - PermKeeper: app.permKeeper, AccountKeeper: app.accountKeeper, BankKeeper: app.bankKeeper, TokenKeeper: app.tokenKeeper, diff --git a/app/app_test.go b/app/app_test.go index 7f182937..018dad0f 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -9,7 +9,6 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/tmhash" "github.com/tendermint/tendermint/libs/log" dbm "github.com/tendermint/tm-db" @@ -21,12 +20,10 @@ import ( tokentypes "github.com/irisnet/irismod/modules/token/types" "github.com/bianjieai/iritamod/modules/node" - "github.com/bianjieai/iritamod/modules/perm" ) var ( - rootAdmin = sdk.AccAddress(tmhash.SumTruncated([]byte("rootAdmin"))) - rootStr = `-----BEGIN CERTIFICATE----- + rootStr = `-----BEGIN CERTIFICATE----- MIIBxTCCAXegAwIBAgIUHMPutrm+7FT7fIFf2fEgyQnIg8kwBQYDK2VwMFgxCzAJ BgNVBAYTAkNOMQ0wCwYDVQQIDARyb290MQ0wCwYDVQQHDARyb290MQ0wCwYDVQQK DARyb290MQ0wCwYDVQQLDARyb290MQ0wCwYDVQQDDARyb290MB4XDTIwMDYxOTA3 @@ -97,18 +94,6 @@ func setGenesis(iapp *IritaApp) error { tokenGenState.Tokens = append(tokenGenState.Tokens, pointToken) genesisState[tokentypes.ModuleName] = iapp.appCodec.MustMarshalJSON(&tokenGenState) - // add root admin - permGenState := perm.GetGenesisStateFromAppState(iapp.appCodec, genesisState) - permGenState.RoleAccounts = append( - permGenState.RoleAccounts, - perm.RoleAccount{ - Address: rootAdmin.String(), - Roles: []perm.Role{perm.RoleRootAdmin}, - }, - ) - permGenStateBz := iapp.cdc.MustMarshalJSON(permGenState) - genesisState[perm.ModuleName] = permGenStateBz - stateBytes, err := codec.MarshalJSONIndent(iapp.cdc, genesisState) if err != nil { return err diff --git a/cmd/irita/cmd/genaccounts.go b/cmd/irita/cmd/genaccounts.go index 73b1d964..9fb5dbde 100644 --- a/cmd/irita/cmd/genaccounts.go +++ b/cmd/irita/cmd/genaccounts.go @@ -10,7 +10,6 @@ import ( evmtypes "github.com/tharsis/ethermint/x/evm/types" "github.com/spf13/cobra" - "github.com/spf13/viper" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -22,8 +21,6 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - - "github.com/bianjieai/iritamod/modules/perm" ) const ( @@ -126,7 +123,6 @@ func AddGenesisAccountCmd(defaultNodeHome string, defaultCliHome string) *cobra. } authGenState := authtypes.GetGenesisStateFromAppState(cdc, appState) - permGenState := perm.GetGenesisStateFromAppState(cdc, appState) accs, err := authtypes.UnpackAccounts(authGenState.Accounts) if err != nil { @@ -148,17 +144,6 @@ func AddGenesisAccountCmd(defaultNodeHome string, defaultCliHome string) *cobra. } authGenState.Accounts = genAccs - // Add root admin - if viper.GetBool(flagRootAdmin) { - permGenState.RoleAccounts = append( - permGenState.RoleAccounts, - perm.RoleAccount{ - Address: addr.String(), - Roles: []perm.Role{perm.RoleRootAdmin}, - }, - ) - } - authGenStateBz, err := cdc.MarshalJSON(&authGenState) if err != nil { return fmt.Errorf("failed to marshal auth genesis state: %w", err) @@ -175,13 +160,7 @@ func AddGenesisAccountCmd(defaultNodeHome string, defaultCliHome string) *cobra. return fmt.Errorf("failed to marshal bank genesis state: %w", err) } - permGenStateBz, err := cdc.MarshalJSON(&permGenState) - if err != nil { - return fmt.Errorf("failed to marshal perm genesis state: %w", err) - } - appState[banktypes.ModuleName] = bankGenStateBz - appState[perm.ModuleName] = permGenStateBz //evm config var evmGenState evmtypes.GenesisState diff --git a/cmd/irita/cmd/genrootcert.go b/cmd/irita/cmd/genrootcert.go index da0cf181..fe170991 100644 --- a/cmd/irita/cmd/genrootcert.go +++ b/cmd/irita/cmd/genrootcert.go @@ -3,7 +3,7 @@ package cmd import ( "encoding/json" "fmt" - "io/ioutil" + "os" "github.com/spf13/cobra" @@ -29,7 +29,7 @@ func GenRootCert(defaultNodeHome string) *cobra.Command { serverCtx := server.GetServerContextFromCmd(cmd) config := serverCtx.Config - cert, err := ioutil.ReadFile(args[0]) + cert, err := os.ReadFile(args[0]) if err != nil { return err } diff --git a/cmd/irita/cmd/testnet.go b/cmd/irita/cmd/testnet.go index cf78b1a3..3c034c59 100644 --- a/cmd/irita/cmd/testnet.go +++ b/cmd/irita/cmd/testnet.go @@ -6,7 +6,6 @@ import ( "bufio" "encoding/json" "fmt" - "io/ioutil" "math" "net" "os" @@ -36,6 +35,7 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" srvconfig "github.com/cosmos/cosmos-sdk/server/config" + "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -49,7 +49,6 @@ import ( "github.com/bianjieai/iritamod/modules/genutil" "github.com/bianjieai/iritamod/modules/node" - "github.com/bianjieai/iritamod/modules/perm" "github.com/bianjieai/iritamod/utils" evmosConfig "github.com/tharsis/ethermint/server/config" @@ -119,7 +118,7 @@ func testnetCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalance return cmd } -// Initialize the testnet +// InitTestnet Initialize the testnet func InitTestnet( clientCtx client.Context, cmd *cobra.Command, config *tmconfig.Config, mbm module.BasicManager, @@ -236,7 +235,7 @@ func InitTestnet( return err } - addr, secret, err := server.GenerateSaveCoinKey(kb, nodeDirName, true, signAlgo) + addr, secret, err := testutil.GenerateSaveCoinKey(kb, nodeDirName, "", true, signAlgo) if err != nil { _ = os.RemoveAll(outputDir) return err @@ -269,7 +268,7 @@ func InitTestnet( genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0, 0)) - cert, err := ioutil.ReadFile(certPath) + cert, err := os.ReadFile(certPath) if err != nil { return err } @@ -334,7 +333,7 @@ func initGenFiles( genFiles []string, numValidators int, monikers []string, nodeIDs []string, rootCertPath string, ) error { - rootCertBz, err := ioutil.ReadFile(rootCertPath) + rootCertBz, err := os.ReadFile(rootCertPath) if err != nil { return fmt.Errorf("failed to read root certificate: %s", err.Error()) } @@ -433,20 +432,6 @@ func initGenFiles( fMKGenState.Params.NoBaseFee = true appGenState[evmfmttypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&fMKGenState) - // add all genesis accounts as root admins - var permGenState perm.GenesisState - jsonMarshaler.MustUnmarshalJSON(appGenState[perm.ModuleName], &permGenState) - for _, account := range genAccounts { - permGenState.RoleAccounts = append( - permGenState.RoleAccounts, - perm.RoleAccount{ - Address: account.GetAddress().String(), - Roles: []perm.Role{perm.RoleRootAdmin}, - }, - ) - } - appGenState[perm.ModuleName] = jsonMarshaler.MustMarshalJSON(&permGenState) - appGenStateJSON, err := json.MarshalIndent(appGenState, "", " ") if err != nil { return err diff --git a/cmd/irita/cmd/utils.go b/cmd/irita/cmd/utils.go index 8e13517b..22bdc2be 100644 --- a/cmd/irita/cmd/utils.go +++ b/cmd/irita/cmd/utils.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "os" "strings" @@ -177,7 +177,7 @@ func handleResponsePostRun(cdc codec.JSONCodec, cmd *cobra.Command) { if w != nil { _ = w.Close() } - out, _ := ioutil.ReadAll(r) + out, _ := io.ReadAll(r) os.Stdout = rescueStdout fmt.Println(parseYAML(cmd, out)) } diff --git a/go.mod b/go.mod index fcc57ed8..52e9ff99 100644 --- a/go.mod +++ b/go.mod @@ -2,11 +2,22 @@ module github.com/bianjieai/irita go 1.17 +replace ( + github.com/cosmos/cosmos-sdk => github.com/bianjieai/cosmos-sdk v0.45.1-irita-20220816 + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.2-alpha.regen.4 + github.com/tendermint/tendermint => github.com/bianjieai/tendermint v0.34.8-irita-210413.0.20211012090339-cee6e09e8ae3 + github.com/tharsis/ethermint => github.com/bianjieai/ethermint v0.10.2-irita-20230315 +) + require ( - github.com/99designs/keyring v1.1.6 - github.com/bianjieai/iritamod v1.2.1-0.20230613082613-3fb58cc1f431 + github.com/bianjieai/iritamod v1.5.0 github.com/bianjieai/tibc-go v0.3.1-0.20220412124234-9b75094ff868 github.com/cosmos/cosmos-sdk v0.45.2 + github.com/irisnet/irismod v1.6.0 +) + +require ( + github.com/99designs/keyring v1.1.6 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/iavl v0.17.3 github.com/dvsekhvalnov/jose2go v0.0.0-20201001154944-b09cfaf05951 @@ -15,7 +26,6 @@ require ( github.com/gogo/protobuf v1.3.3 github.com/gorilla/mux v1.8.0 github.com/improbable-eng/grpc-web v0.15.0 - github.com/irisnet/irismod v1.6.0 github.com/mitchellh/go-homedir v1.1.0 github.com/mtibben/percent v0.2.1 github.com/olebedev/config v0.0.0-20190528211619-364964f3a8e4 @@ -160,10 +170,3 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect ) - -replace ( - github.com/cosmos/cosmos-sdk => github.com/bianjieai/cosmos-sdk v0.45.1-irita-20220816 - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.2-alpha.regen.4 - github.com/tendermint/tendermint => github.com/bianjieai/tendermint v0.34.8-irita-210413.0.20211012090339-cee6e09e8ae3 - github.com/tharsis/ethermint => github.com/bianjieai/ethermint v0.10.2-irita-20230315 -) diff --git a/go.sum b/go.sum index be2a8b58..9345fda8 100644 --- a/go.sum +++ b/go.sum @@ -645,8 +645,8 @@ github.com/bianjieai/cosmos-sdk v0.45.1-irita-20220816 h1:P6+9MxwW+sACE1/M7rJq7N github.com/bianjieai/cosmos-sdk v0.45.1-irita-20220816/go.mod h1:844fVGwl2JVfV8cxsr0+A0mtcYUkkPlEW3Q4skuEwaI= github.com/bianjieai/ethermint v0.10.2-irita-20230315 h1:OzTtBrRh42b6GqBY/0ec9NfYIH8TIh+sGb5N96hrQsQ= github.com/bianjieai/ethermint v0.10.2-irita-20230315/go.mod h1:wY1g0XkLenjcgfuok56QprJPZk8/1Z2DKiDsjqnZWso= -github.com/bianjieai/iritamod v1.2.1-0.20230613082613-3fb58cc1f431 h1:IvgtaLostSVc2FzaU8sdspbHiIV5VHZMGgq0DTp1oqQ= -github.com/bianjieai/iritamod v1.2.1-0.20230613082613-3fb58cc1f431/go.mod h1:5woISMgARzwIysP3WFP5WZ2eod2dDcAGgRGVfpuT08Q= +github.com/bianjieai/iritamod v1.5.0 h1:4Wc5ic73A49ODv+AY4H+NAKe0utq36s68LPCmVfWyIw= +github.com/bianjieai/iritamod v1.5.0/go.mod h1:Yo1fSgvOE3YKjzwtfORxuCmgmgr6Jq32/2NYp2m5/YI= github.com/bianjieai/tendermint v0.34.8-irita-210413.0.20211012090339-cee6e09e8ae3 h1:M4C+ilCPiP2c2yMdeYaZLwquEBfFa4Uvt1BDviSYD0E= github.com/bianjieai/tendermint v0.34.8-irita-210413.0.20211012090339-cee6e09e8ae3/go.mod h1:2u6xthTnwDYLhO38cDYp8CxzKq7hwJFvCXeK1pEErtM= github.com/bianjieai/tibc-go v0.3.1-0.20220412124234-9b75094ff868 h1:dPS+AcwCQsWTMXRgZwO+Yy2rY8y9G+X38MA7toAivok= diff --git a/modules/evm/eth.go b/modules/evm/eth.go index 0e03f172..3b51c616 100644 --- a/modules/evm/eth.go +++ b/modules/evm/eth.go @@ -3,8 +3,6 @@ package evm import ( "math/big" - permtypes "github.com/bianjieai/iritamod/modules/perm/types" - "github.com/tharsis/ethermint/crypto/ethsecp256k1" sdk "github.com/cosmos/cosmos-sdk/types" @@ -157,28 +155,3 @@ func (esvd EthSigVerificationDecorator) anteHandle(msgEthTx *evmtypes.MsgEthereu type ContractCallable interface { GetBlockContract(sdk.Context, []byte) bool } - -type EthContractCallableDecorator struct { - contractCallable ContractCallable -} - -func NewEthContractCallableDecorator(contractCallable ContractCallable) EthContractCallableDecorator { - return EthContractCallableDecorator{contractCallable: contractCallable} -} - -func (e EthContractCallableDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { - for _, msg := range tx.GetMsgs() { - msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx) - if !ok { - return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid transaction type %T, expected %T", tx, (*evmtypes.MsgEthereumTx)(nil)) - } - ethTx := msgEthTx.AsTransaction() - if ethTx.To() != nil { - state := e.contractCallable.GetBlockContract(ctx, ethTx.To().Bytes()) - if state { - return ctx, sdkerrors.Wrapf(permtypes.ErrContractDisable, "the contract %s is in contract deny list ! ", ethTx.To()) - } - } - } - return next(ctx, tx, simulate) -} diff --git a/proto/opb/genesis.proto b/proto/opb/genesis.proto deleted file mode 100644 index 6e1e2e09..00000000 --- a/proto/opb/genesis.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package irita.opb; - -import "opb/opb.proto"; -import "gogoproto/gogo.proto"; - -option go_package = "github.com/bianjieai/irita/modules/opb/types"; - -// GenesisState defines the OPB module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/proto/opb/opb.proto b/proto/opb/opb.proto deleted file mode 100644 index 37763470..00000000 --- a/proto/opb/opb.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; -package irita.opb; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/bianjieai/irita/modules/opb/types"; -option (gogoproto.goproto_getters_all) = false; - -// Params defines the parameters for the OPB module. -message Params { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; - - string base_token_denom = 1 [(gogoproto.moretags) = "yaml:\"base_token_denom\""]; - string point_token_denom = 2 [(gogoproto.moretags) = "yaml:\"point_token_denom\""]; - string base_token_manager = 3 [(gogoproto.moretags) = "yaml:\"base_token_manager\""]; - bool unrestricted_token_transfer = 4 [(gogoproto.moretags) = "yaml:\"unrestricted_token_transfer\""]; -} diff --git a/proto/opb/query.proto b/proto/opb/query.proto deleted file mode 100644 index 8abcadb7..00000000 --- a/proto/opb/query.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -package irita.opb; - -import "opb/opb.proto"; -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; - -option go_package = "github.com/bianjieai/irita/modules/opb/types"; - -// Query defines the gRPC querier service for the OPB module -service Query { - // Params queries the parameters of the OPB module - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/irita/opb/params"; - } -} - -// QueryParamsRequest is the request type for the Query/Params RPC method -message QueryParamsRequest {} - -// QueryParamsResponse is the response type for the Query/Params RPC method -message QueryParamsResponse { - Params params = 1 [ (gogoproto.nullable) = false ]; -} - diff --git a/proto/opb/tx.proto b/proto/opb/tx.proto deleted file mode 100644 index 1342e9cf..00000000 --- a/proto/opb/tx.proto +++ /dev/null @@ -1,42 +0,0 @@ -syntax = "proto3"; -package irita.opb; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/bianjieai/irita/modules/opb/types"; -option (gogoproto.goproto_getters_all) = false; - -// Msg defines the OPB Msg service. -service Msg { - // Mint defines a method for minting the base native token. - rpc Mint(MsgMint) returns (MsgMintResponse); - - // Reclaim defines a method for reclaiming the specified native token - // from the corresponding escrow. - rpc Reclaim(MsgReclaim) returns (MsgReclaimResponse); - -} - -// MsgMint defines a message to mint the base native token. -message MsgMint { - option (gogoproto.equal) = true; - - uint64 amount = 1; - string recipient = 2; - string operator = 3; -} - -// MsgMintResponse defines the Msg/Mint response type. -message MsgMintResponse {} - -// MsgReclaim defines a message to reclaim the specified native token. -message MsgReclaim { - option (gogoproto.equal) = true; - - string denom = 1; - string recipient = 2; - string operator = 3; -} - -// MsgReclaimResponse defines the Msg/Reclaim response type. -message MsgReclaimResponse {} diff --git a/proto/wservice/genesis.proto b/proto/wservice/genesis.proto deleted file mode 100644 index 7540aff4..00000000 --- a/proto/wservice/genesis.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package irita.wservice; - -import "wservice/wservice.proto"; -import "gogoproto/gogo.proto"; - -option go_package = "github.com/bianjieai/irita/modules/wservice/types"; - -// GenesisState defines the NFT module's genesis state -message GenesisState { - repeated RequestSequence req_sequence = 1 [ (gogoproto.nullable) = false ]; -} \ No newline at end of file diff --git a/proto/wservice/wservice.proto b/proto/wservice/wservice.proto deleted file mode 100644 index d77de9a3..00000000 --- a/proto/wservice/wservice.proto +++ /dev/null @@ -1,14 +0,0 @@ -syntax = "proto3"; -package irita.wservice; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/bianjieai/irita/modules/wservice/types"; -option (gogoproto.goproto_getters_all) = false; - -message RequestSequence { - option (gogoproto.equal) = true; - - string key = 1 [(gogoproto.moretags) = "yaml:\"key\""]; - string value = 2 [(gogoproto.moretags) = "yaml:\"value\""]; -} \ No newline at end of file diff --git a/simapp/app.go b/simapp/app.go index 436a35c4..86e2d652 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -83,9 +83,6 @@ import ( nodekeeper "github.com/bianjieai/iritamod/modules/node/keeper" nodetypes "github.com/bianjieai/iritamod/modules/node/types" cparams "github.com/bianjieai/iritamod/modules/params" - "github.com/bianjieai/iritamod/modules/perm" - permkeeper "github.com/bianjieai/iritamod/modules/perm/keeper" - permtypes "github.com/bianjieai/iritamod/modules/perm/types" cslashing "github.com/bianjieai/iritamod/modules/slashing" "github.com/bianjieai/iritamod/modules/upgrade" upgradekeeper "github.com/bianjieai/iritamod/modules/upgrade/keeper" @@ -132,7 +129,6 @@ var ( service.AppModuleBasic{}, oracle.AppModuleBasic{}, random.AppModuleBasic{}, - perm.AppModuleBasic{}, identity.AppModuleBasic{}, node.AppModuleBasic{}, tibc.AppModule{}, @@ -185,7 +181,6 @@ type SimApp struct { ServiceKeeper servicekeeper.Keeper OracleKeeper oraclekeeper.Keeper RandomKeeper randomkeeper.Keeper - PermKeeper permkeeper.Keeper IdentityKeeper identitykeeper.Keeper NodeKeeper nodekeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper @@ -244,7 +239,6 @@ func NewSimApp( servicetypes.StoreKey, oracletypes.StoreKey, randomtypes.StoreKey, - permtypes.StoreKey, identitytypes.StoreKey, nodetypes.StoreKey, @@ -318,9 +312,6 @@ func NewSimApp( stakingtypes.NewMultiStakingHooks(app.SlashingKeeper.Hooks()), ) - PermKeeper := permkeeper.NewKeeper(appCodec, keys[permtypes.StoreKey]) - app.PermKeeper = PermKeeper - app.IdentityKeeper = identitykeeper.NewKeeper(appCodec, keys[identitytypes.StoreKey]) // set the BaseApp's parameter store @@ -368,7 +359,6 @@ func NewSimApp( service.NewAppModule(appCodec, app.ServiceKeeper, app.AccountKeeper, app.BankKeeper), oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper), random.NewAppModule(appCodec, app.RandomKeeper, app.AccountKeeper, app.BankKeeper), - perm.NewAppModule(appCodec, app.PermKeeper), identity.NewAppModule(app.IdentityKeeper), record.NewAppModule(appCodec, app.RecordKeeper, app.AccountKeeper, app.BankKeeper), node.NewAppModule(appCodec, app.NodeKeeper), @@ -400,7 +390,6 @@ func NewSimApp( // so that other modules that want to create or claim capabilities afterwards in InitChain // can do so safely. app.mm.SetOrderInitGenesis( - permtypes.ModuleName, capabilitytypes.ModuleName, authtypes.ModuleName, nodetypes.ModuleName, @@ -446,7 +435,6 @@ func NewSimApp( service.NewAppModule(appCodec, app.ServiceKeeper, app.AccountKeeper, app.BankKeeper), oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper), random.NewAppModule(appCodec, app.RandomKeeper, app.AccountKeeper, app.BankKeeper), - perm.NewAppModule(appCodec, app.PermKeeper), identity.NewAppModule(app.IdentityKeeper), node.NewAppModule(appCodec, app.NodeKeeper), diff --git a/simapp/test_helpers.go b/simapp/test_helpers.go index f5d87d83..1158d5b4 100644 --- a/simapp/test_helpers.go +++ b/simapp/test_helpers.go @@ -12,7 +12,6 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/tmhash" "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmtypes "github.com/tendermint/tendermint/types" @@ -34,7 +33,6 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/bianjieai/iritamod/modules/node" - "github.com/bianjieai/iritamod/modules/perm" ) const BondDenom = sdk.DefaultBondDenom @@ -65,16 +63,6 @@ func Setup(isCheckTx bool) *SimApp { // init chain must be called to stop deliverState from being nil genesisState := NewDefaultGenesisState() - // add root admin - permGenState := perm.GetGenesisStateFromAppState(app.appCodec, genesisState) - permGenState.RoleAccounts = append(permGenState.RoleAccounts, - perm.RoleAccount{ - Address: sdk.AccAddress(tmhash.SumTruncated([]byte("rootAdmin"))).String(), - Roles: []perm.Role{perm.RoleRootAdmin}, - }) - permGenStateBz := app.cdc.MustMarshalJSON(permGenState) - genesisState[perm.ModuleName] = permGenStateBz - // add root cert validatorGenState := node.GetGenesisStateFromAppState(app.appCodec, genesisState) validatorGenState.RootCert = rootCert diff --git a/wallet/keys/export.go b/wallet/keys/export.go index a4bef7ca..5d44968e 100644 --- a/wallet/keys/export.go +++ b/wallet/keys/export.go @@ -3,7 +3,7 @@ package keys import ( "bufio" "fmt" - "io/ioutil" + "os" "path" "github.com/spf13/cobra" @@ -50,7 +50,7 @@ func runExportCmd(cmd *cobra.Command, args []string, generator KeybaseGenerator) filename = path.Join("./", filename) } - if err = ioutil.WriteFile(filename, []byte(armor), 0444); err != nil { + if err = os.WriteFile(filename, []byte(armor), 0444); err != nil { return err }