From d7544233e20de665f49dc925a839017bcf34d7ea Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Tue, 10 Oct 2023 09:12:13 -0700 Subject: [PATCH 1/3] refactor: change default mempool version in config (#1238) --- cmd/zetacored/root.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cmd/zetacored/root.go b/cmd/zetacored/root.go index 84713de816..82a146c582 100644 --- a/cmd/zetacored/root.go +++ b/cmd/zetacored/root.go @@ -92,7 +92,7 @@ func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) { customAppTemplate, customAppConfig := initAppConfig() - return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, tmcfg.DefaultConfig()) + return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, initTmConfig()) }, } @@ -107,6 +107,18 @@ func initAppConfig() (string, interface{}) { return servercfg.AppConfig(zetacoredconfig.BaseDenom) } +// initTmConfig overrides the default Tendermint config +func initTmConfig() *tmcfg.Config { + cfg := tmcfg.DefaultConfig() + + // use mempool version 1 to enable tx priority + if cfg.Mempool != nil { + cfg.Mempool.Version = tmcfg.MempoolV1 + } + + return cfg +} + func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig) { rootCmd.AddCommand( ethermintclient.ValidateChainID( From 996f35d496edf1393bd2e2ad954f5e9bfd6e345f Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Tue, 10 Oct 2023 09:40:06 -0700 Subject: [PATCH 2/3] fix(`MsgWhitelistERC20`): set unique index for generate cctx (#1245) * update index * remove deprecated functions * make generate * add return value in message * initialize test * whitelist tests * make generate --- docs/openapi/openapi.swagger.yaml | 5 + docs/spec/crosschain/messages.md | 3 + proto/crosschain/tx.proto | 5 +- x/crosschain/keeper/cctx_utils.go | 10 +- .../keeper/msg_server_whitelist_erc20.go | 72 +++-- .../keeper/msg_server_whitelist_erc20_test.go | 177 +++++++++++ x/crosschain/types/tx.pb.go | 277 ++++++++++++------ x/fungible/types/errors.go | 51 ++-- 8 files changed, 461 insertions(+), 139 deletions(-) create mode 100644 x/crosschain/keeper/msg_server_whitelist_erc20_test.go diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 3c4345f108..e7694c9585 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -50449,6 +50449,11 @@ definitions: type: object crosschainMsgWhitelistERC20Response: type: object + properties: + zrc20_address: + type: string + cctx_index: + type: string crosschainOutTxTracker: type: object properties: diff --git a/docs/spec/crosschain/messages.md b/docs/spec/crosschain/messages.md index 41c32d9f13..43a8678e41 100644 --- a/docs/spec/crosschain/messages.md +++ b/docs/spec/crosschain/messages.md @@ -207,6 +207,9 @@ message MsgVoteOnObservedInboundTx { ## MsgWhitelistERC20 +WhitelistERC20 deploys a new zrc20, create a foreign coin object for the ERC20 +and emit a crosschain tx to whitelist the ERC20 on the external chain + ```proto message MsgWhitelistERC20 { string creator = 1; diff --git a/proto/crosschain/tx.proto b/proto/crosschain/tx.proto index 417b899787..51826c92bc 100644 --- a/proto/crosschain/tx.proto +++ b/proto/crosschain/tx.proto @@ -37,7 +37,10 @@ message MsgWhitelistERC20 { int64 gas_limit = 7; } -message MsgWhitelistERC20Response {} +message MsgWhitelistERC20Response { + string zrc20_address = 1; + string cctx_index = 2; +} message MsgAddToOutTxTracker { string creator = 1; diff --git a/x/crosschain/keeper/cctx_utils.go b/x/crosschain/keeper/cctx_utils.go index b04b79a9b5..d77d928017 100644 --- a/x/crosschain/keeper/cctx_utils.go +++ b/x/crosschain/keeper/cctx_utils.go @@ -4,10 +4,10 @@ import ( "errors" "fmt" + cosmoserrors "cosmossdk.io/errors" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -24,24 +24,24 @@ func (k Keeper) UpdateNonce(ctx sdk.Context, receiveChainID int64, cctx *types.C nonce, found := k.GetChainNonces(ctx, chain.ChainName.String()) if !found { - return sdkerrors.Wrap(types.ErrCannotFindReceiverNonce, fmt.Sprintf("Chain(%s) | Identifiers : %s ", chain.ChainName.String(), cctx.LogIdentifierForCCTX())) + return cosmoserrors.Wrap(types.ErrCannotFindReceiverNonce, fmt.Sprintf("Chain(%s) | Identifiers : %s ", chain.ChainName.String(), cctx.LogIdentifierForCCTX())) } // SET nonce cctx.GetCurrentOutTxParam().OutboundTxTssNonce = nonce.Nonce tss, found := k.GetTSS(ctx) if !found { - return sdkerrors.Wrap(types.ErrCannotFindTSSKeys, fmt.Sprintf("Chain(%s) | Identifiers : %s ", chain.ChainName.String(), cctx.LogIdentifierForCCTX())) + return cosmoserrors.Wrap(types.ErrCannotFindTSSKeys, fmt.Sprintf("Chain(%s) | Identifiers : %s ", chain.ChainName.String(), cctx.LogIdentifierForCCTX())) } p, found := k.GetPendingNonces(ctx, tss.TssPubkey, receiveChainID) if !found { - return sdkerrors.Wrap(types.ErrCannotFindPendingNonces, fmt.Sprintf("chain_id %d, nonce %d", receiveChainID, nonce.Nonce)) + return cosmoserrors.Wrap(types.ErrCannotFindPendingNonces, fmt.Sprintf("chain_id %d, nonce %d", receiveChainID, nonce.Nonce)) } // #nosec G701 always in range if p.NonceHigh != int64(nonce.Nonce) { - return sdkerrors.Wrap(types.ErrNonceMismatch, fmt.Sprintf("chain_id %d, high nonce %d, current nonce %d", receiveChainID, p.NonceHigh, nonce.Nonce)) + return cosmoserrors.Wrap(types.ErrNonceMismatch, fmt.Sprintf("chain_id %d, high nonce %d, current nonce %d", receiveChainID, p.NonceHigh, nonce.Nonce)) } nonce.Nonce++ diff --git a/x/crosschain/keeper/msg_server_whitelist_erc20.go b/x/crosschain/keeper/msg_server_whitelist_erc20.go index a4118fc774..bd8d7b5f60 100644 --- a/x/crosschain/keeper/msg_server_whitelist_erc20.go +++ b/x/crosschain/keeper/msg_server_whitelist_erc20.go @@ -6,36 +6,45 @@ import ( "math/big" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - tmbytes "github.com/tendermint/tendermint/libs/bytes" - tmtypes "github.com/tendermint/tendermint/types" + "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" ) +// WhitelistERC20 deploys a new zrc20, create a foreign coin object for the ERC20 +// and emit a crosschain tx to whitelist the ERC20 on the external chain func (k Keeper) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelistERC20) (*types.MsgWhitelistERC20Response, error) { ctx := sdk.UnwrapSDKContext(goCtx) if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group1) { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Deploy can only be executed by the correct policy account") + return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Deploy can only be executed by the correct policy account") } erc20Addr := ethcommon.HexToAddress(msg.Erc20Address) if erc20Addr == (ethcommon.Address{}) { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid ERC20 contract address (%s)", msg.Erc20Address) + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid ERC20 contract address (%s)", msg.Erc20Address) } - // check if it's already whitelisted + // check if the erc20 is already whitelisted foreignCoins := k.fungibleKeeper.GetAllForeignCoins(ctx) - for _, fcoin := range foreignCoins { - assetAddr := ethcommon.HexToAddress(fcoin.Asset) - if assetAddr == erc20Addr && fcoin.ForeignChainId == msg.ChainId { - return nil, sdkerrors.Wrapf(types.ErrInvalidAddress, "ERC20 contract address (%s) already whitelisted on chain (%d)", msg.Erc20Address, msg.ChainId) + for _, fCoin := range foreignCoins { + assetAddr := ethcommon.HexToAddress(fCoin.Asset) + if assetAddr == erc20Addr && fCoin.ForeignChainId == msg.ChainId { + return nil, errorsmod.Wrapf( + fungibletypes.ErrForeignCoinAlreadyExist, + "ERC20 contract address (%s) already whitelisted on chain (%d)", + msg.Erc20Address, + msg.ChainId, + ) } } + tss, found := k.GetTSS(ctx) if !found { return nil, errorsmod.Wrapf(types.ErrCannotFindTSSKeys, "Cannot create new admin cmd of type whitelistERC20") @@ -43,10 +52,12 @@ func (k Keeper) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelistERC chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.ChainId) if chain == nil { - return nil, sdkerrors.Wrapf(types.ErrInvalidChainID, "chain id (%d) not supported", msg.ChainId) + return nil, errorsmod.Wrapf(types.ErrInvalidChainID, "chain id (%d) not supported", msg.ChainId) } + // use a temporary context for the zrc20 deployment tmpCtx, commit := ctx.CacheContext() + // add to the foreign coins. Deploy ZRC20 contract for it. zrc20Addr, err := k.fungibleKeeper.DeployZRC20Contract( tmpCtx, @@ -60,29 +71,43 @@ func (k Keeper) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelistERC big.NewInt(msg.GasLimit), ) if err != nil { - return nil, sdkerrors.Wrapf(types.ErrDeployContract, "failed to deploy ZRC20 contract for ERC20 contract address (%s) on chain (%d)", msg.Erc20Address, msg.ChainId) + return nil, errorsmod.Wrapf( + types.ErrDeployContract, + "failed to deploy ZRC20 contract for ERC20 contract address (%s) on chain (%d)", + msg.Erc20Address, + msg.ChainId, + ) } if zrc20Addr == (ethcommon.Address{}) { - return nil, sdkerrors.Wrapf(types.ErrDeployContract, "deployed ZRC20 return 0 address for ERC20 contract address (%s) on chain (%d)", msg.Erc20Address, msg.ChainId) + return nil, errorsmod.Wrapf( + types.ErrDeployContract, + "deployed ZRC20 return 0 address for ERC20 contract address (%s) on chain (%d)", + msg.Erc20Address, + msg.ChainId, + ) } + // get necessary parameters to create the cctx param, found := k.zetaObserverKeeper.GetCoreParamsByChainID(ctx, msg.ChainId) if !found { - return nil, sdkerrors.Wrapf(types.ErrInvalidChainID, "core params not found for chain id (%d)", msg.ChainId) + return nil, errorsmod.Wrapf(types.ErrInvalidChainID, "core params not found for chain id (%d)", msg.ChainId) } - medianGasPrice, isFound := k.GetMedianGasPriceInUint(ctx, msg.ChainId) if !isFound { - return nil, sdkerrors.Wrapf(types.ErrUnableToGetGasPrice, "median gas price not found for chain id (%d)", msg.ChainId) + return nil, errorsmod.Wrapf(types.ErrUnableToGetGasPrice, "median gas price not found for chain id (%d)", msg.ChainId) } medianGasPrice = medianGasPrice.MulUint64(2) // overpays gas price by 2x - hash := tmbytes.HexBytes(tmtypes.Tx(ctx.TxBytes()).Hash()) + // calculate the cctx index + // we use the deployed zrc20 contract address to generate a unique index + // since other parts of the system may use the zrc20 for the index, we add a message specific suffix + hash := crypto.Keccak256Hash(zrc20Addr.Bytes(), []byte("WhitelistERC20")) + index := hash.Hex() - index := crypto.Keccak256Hash(hash.Bytes()) + // create a cmd cctx to whitelist the erc20 on the external chain cctx := types.CrossChainTx{ Creator: msg.Creator, - Index: index.String(), + Index: index, ZetaFees: sdk.NewUint(0), RelayedMessage: fmt.Sprintf("%s:%s", common.CmdWhitelistERC20, msg.Erc20Address), CctxStatus: &types.Status{ @@ -96,7 +121,7 @@ func (k Keeper) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelistERC TxOrigin: "", CoinType: common.CoinType_Cmd, Asset: "", - Amount: sdk.Uint{}, + Amount: math.Uint{}, InboundTxObservedHash: hash.String(), // all Upper case Cosmos TX HEX, with no 0x prefix InboundTxObservedExternalHeight: 0, InboundTxBallotIndex: "", @@ -107,7 +132,7 @@ func (k Keeper) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelistERC Receiver: param.Erc20CustodyContractAddress, ReceiverChainId: msg.ChainId, CoinType: common.CoinType_Cmd, - Amount: sdk.NewUint(0), + Amount: math.NewUint(0), OutboundTxTssNonce: 0, OutboundTxGasLimit: 100_000, OutboundTxGasPrice: medianGasPrice.String(), @@ -137,6 +162,11 @@ func (k Keeper) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelistERC } k.fungibleKeeper.SetForeignCoins(ctx, foreignCoin) k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx) + commit() - return &types.MsgWhitelistERC20Response{}, nil + + return &types.MsgWhitelistERC20Response{ + Zrc20Address: zrc20Addr.Hex(), + CctxIndex: index, + }, nil } diff --git a/x/crosschain/keeper/msg_server_whitelist_erc20_test.go b/x/crosschain/keeper/msg_server_whitelist_erc20_test.go new file mode 100644 index 0000000000..0f7fa29916 --- /dev/null +++ b/x/crosschain/keeper/msg_server_whitelist_erc20_test.go @@ -0,0 +1,177 @@ +package keeper_test + +import ( + "fmt" + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/common" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/crosschain/types" + fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" +) + +func TestKeeper_WhitelistERC20(t *testing.T) { + t.Run("can deploy and whitelist an erc20", func(t *testing.T) { + k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) + k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) + + chainID := getValidEthChainID(t) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + + deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) + setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, chainID, "foobar", "FOOBAR") + k.SetTssAndUpdateNonce(ctx, *sample.Tss()) + k.SetGasPrice(ctx, types.GasPrice{ + ChainId: chainID, + MedianIndex: 0, + Prices: []uint64{1}, + }) + + erc20Address := sample.EthAddress().Hex() + res, err := k.WhitelistERC20(ctx, &types.MsgWhitelistERC20{ + Creator: admin, + Erc20Address: erc20Address, + ChainId: chainID, + Name: "foo", + Symbol: "FOO", + Decimals: 18, + GasLimit: 100000, + }) + require.NoError(t, err) + require.NotNil(t, res) + zrc20 := res.Zrc20Address + cctxIndex := res.CctxIndex + + // check zrc20 and cctx created + assertContractDeployment(t, sdkk.EvmKeeper, ctx, ethcommon.HexToAddress(zrc20)) + fc, found := zk.FungibleKeeper.GetForeignCoins(ctx, zrc20) + require.True(t, found) + require.EqualValues(t, "foo", fc.Name) + require.EqualValues(t, erc20Address, fc.Asset) + cctx, found := k.GetCrossChainTx(ctx, cctxIndex) + require.True(t, found) + require.EqualValues(t, fmt.Sprintf("%s:%s", common.CmdWhitelistERC20, erc20Address), cctx.RelayedMessage) + + // Ensure that whitelist a new erc20 create a cctx with a different index + res, err = k.WhitelistERC20(ctx, &types.MsgWhitelistERC20{ + Creator: admin, + Erc20Address: sample.EthAddress().Hex(), + ChainId: chainID, + Name: "bar", + Symbol: "BAR", + Decimals: 18, + GasLimit: 100000, + }) + require.NoError(t, err) + require.NotNil(t, res) + require.NotEqual(t, cctxIndex, res.CctxIndex) + }) + + t.Run("should fail if not authorized", func(t *testing.T) { + k, ctx, _, _ := keepertest.CrosschainKeeper(t) + k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) + + _, err := k.WhitelistERC20(ctx, &types.MsgWhitelistERC20{ + Creator: sample.AccAddress(), + Erc20Address: sample.EthAddress().Hex(), + ChainId: getValidEthChainID(t), + Name: "foo", + Symbol: "FOO", + Decimals: 18, + GasLimit: 100000, + }) + require.ErrorIs(t, err, sdkerrors.ErrUnauthorized) + }) + + t.Run("should fail if invalid erc20 address", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) + + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + + _, err := k.WhitelistERC20(ctx, &types.MsgWhitelistERC20{ + Creator: admin, + Erc20Address: "invalid", + ChainId: getValidEthChainID(t), + Name: "foo", + Symbol: "FOO", + Decimals: 18, + GasLimit: 100000, + }) + require.ErrorIs(t, err, sdkerrors.ErrInvalidAddress) + }) + + t.Run("should fail if foreign coin already exists for the asset", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) + + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + + chainID := getValidEthChainID(t) + asset := sample.EthAddress().Hex() + fc := sample.ForeignCoins(t, sample.EthAddress().Hex()) + fc.Asset = asset + fc.ForeignChainId = chainID + zk.FungibleKeeper.SetForeignCoins(ctx, fc) + + _, err := k.WhitelistERC20(ctx, &types.MsgWhitelistERC20{ + Creator: admin, + Erc20Address: asset, + ChainId: chainID, + Name: "foo", + Symbol: "FOO", + Decimals: 18, + GasLimit: 100000, + }) + require.ErrorIs(t, err, fungibletypes.ErrForeignCoinAlreadyExist) + }) + + t.Run("should fail if no tss set", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) + + chainID := getValidEthChainID(t) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + + erc20Address := sample.EthAddress().Hex() + _, err := k.WhitelistERC20(ctx, &types.MsgWhitelistERC20{ + Creator: admin, + Erc20Address: erc20Address, + ChainId: chainID, + Name: "foo", + Symbol: "FOO", + Decimals: 18, + GasLimit: 100000, + }) + require.ErrorIs(t, err, types.ErrCannotFindTSSKeys) + }) + + t.Run("should fail if nox valid chain ID", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) + + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + k.SetTssAndUpdateNonce(ctx, *sample.Tss()) + + erc20Address := sample.EthAddress().Hex() + _, err := k.WhitelistERC20(ctx, &types.MsgWhitelistERC20{ + Creator: admin, + Erc20Address: erc20Address, + ChainId: 10000, + Name: "foo", + Symbol: "FOO", + Decimals: 18, + GasLimit: 100000, + }) + require.ErrorIs(t, err, types.ErrInvalidChainID) + }) +} diff --git a/x/crosschain/types/tx.pb.go b/x/crosschain/types/tx.pb.go index f255d88bc9..3261f28ea9 100644 --- a/x/crosschain/types/tx.pb.go +++ b/x/crosschain/types/tx.pb.go @@ -212,6 +212,8 @@ func (m *MsgWhitelistERC20) GetGasLimit() int64 { } type MsgWhitelistERC20Response struct { + Zrc20Address string `protobuf:"bytes,1,opt,name=zrc20_address,json=zrc20Address,proto3" json:"zrc20_address,omitempty"` + CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"` } func (m *MsgWhitelistERC20Response) Reset() { *m = MsgWhitelistERC20Response{} } @@ -247,6 +249,20 @@ func (m *MsgWhitelistERC20Response) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWhitelistERC20Response proto.InternalMessageInfo +func (m *MsgWhitelistERC20Response) GetZrc20Address() string { + if m != nil { + return m.Zrc20Address + } + return "" +} + +func (m *MsgWhitelistERC20Response) GetCctxIndex() string { + if m != nil { + return m.CctxIndex + } + return "" +} + type MsgAddToOutTxTracker struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` @@ -1230,93 +1246,94 @@ func init() { func init() { proto.RegisterFile("crosschain/tx.proto", fileDescriptor_81d6d611190b7635) } var fileDescriptor_81d6d611190b7635 = []byte{ - // 1361 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcd, 0x6e, 0xdb, 0xc6, - 0x13, 0x37, 0x63, 0x5b, 0x96, 0xc6, 0x96, 0x63, 0xaf, 0x9d, 0x98, 0xa1, 0x13, 0x39, 0xa1, 0xff, - 0xc9, 0x3f, 0x28, 0x62, 0x29, 0x75, 0x5a, 0x34, 0x4d, 0x7b, 0x68, 0x6c, 0xa4, 0x8e, 0x9b, 0xca, - 0x0e, 0x68, 0xa5, 0x05, 0x72, 0x21, 0x28, 0x72, 0x4d, 0x11, 0x16, 0xb9, 0x02, 0x77, 0x65, 0x48, - 0x41, 0x4f, 0x05, 0x7a, 0xe8, 0xad, 0x87, 0x02, 0x2d, 0xfa, 0x02, 0x7d, 0x95, 0xf4, 0x16, 0xf4, - 0xd4, 0xf6, 0x10, 0xb4, 0xc9, 0x1b, 0xf4, 0x09, 0x8a, 0xfd, 0x20, 0x2d, 0xca, 0x96, 0x64, 0xbb, - 0xe8, 0x89, 0x3b, 0xb3, 0xf3, 0xf1, 0x9b, 0x9d, 0x99, 0xdd, 0x21, 0x2c, 0xb8, 0x31, 0xa1, 0xd4, - 0x6d, 0x38, 0x41, 0x54, 0x61, 0x9d, 0x72, 0x2b, 0x26, 0x8c, 0xa0, 0x6b, 0x2f, 0x30, 0x73, 0x04, - 0xaf, 0x2c, 0x56, 0x24, 0xc6, 0xe5, 0x23, 0x39, 0x63, 0xc1, 0x25, 0x61, 0x48, 0xa2, 0x8a, 0xfc, - 0x48, 0x1d, 0x63, 0xd1, 0x27, 0x3e, 0x11, 0xcb, 0x0a, 0x5f, 0x49, 0xae, 0xb9, 0x03, 0x0b, 0x55, - 0xea, 0x3f, 0x6b, 0x79, 0x0e, 0xc3, 0x35, 0x4a, 0x1f, 0x7a, 0x5e, 0x8c, 0x29, 0x45, 0x3a, 0x4c, - 0xb9, 0x31, 0x76, 0x18, 0x89, 0x75, 0xed, 0xba, 0x76, 0xbb, 0x60, 0x25, 0x24, 0xba, 0x06, 0xc0, - 0x28, 0xb5, 0x5b, 0xed, 0xfa, 0x01, 0xee, 0xea, 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 0xdc, 0xa2, 0x64, 0x6f, 0xaa, 0x56, 0x35, 0x20, 0xaf, 0x8e, 0x38, 0x56, 0x8f, 0x52, 0x4a, 0xa3, - 0x9b, 0x30, 0x9b, 0xac, 0xd5, 0xb1, 0x4d, 0x4a, 0x13, 0x09, 0x57, 0x9e, 0xdc, 0x16, 0xe4, 0x9c, - 0x90, 0xb4, 0x23, 0x26, 0x1f, 0xa5, 0x8d, 0xca, 0x19, 0x53, 0x6e, 0x29, 0x75, 0x1e, 0x65, 0x88, - 0x29, 0x75, 0x7c, 0x79, 0xf4, 0x05, 0x2b, 0x21, 0xd1, 0x55, 0x00, 0x7e, 0xe4, 0xaa, 0x83, 0x0b, - 0x12, 0x67, 0x10, 0xa9, 0xc6, 0xbd, 0x05, 0x17, 0x83, 0xc8, 0x56, 0x8f, 0xa3, 0xec, 0x56, 0xd9, - 0x72, 0xc5, 0x20, 0xea, 0x6d, 0xd1, 0xcc, 0x74, 0x30, 0x2d, 0x24, 0xd2, 0xe9, 0x20, 0x9b, 0xd7, - 0x99, 0x51, 0x79, 0xe5, 0xb6, 0x58, 0xc7, 0x26, 0x71, 0xe0, 0x07, 0x91, 0x5e, 0x94, 0x80, 0x58, - 0x67, 0x57, 0xd0, 0xfc, 0xfe, 0x73, 0x28, 0xc5, 0x4c, 0x9f, 0x15, 0x1b, 0x92, 0x30, 0xff, 0x07, - 0xe6, 0xe0, 0x14, 0xa7, 0x95, 0xf0, 0xad, 0x06, 0xb3, 0x55, 0xea, 0xef, 0x61, 0xb6, 0x43, 0x3c, - 0xfc, 0x04, 0x77, 0x87, 0x4d, 0x79, 0x15, 0x28, 0xc8, 0x87, 0x6f, 0x0f, 0x33, 0x51, 0x00, 0xd3, - 0xeb, 0xf3, 0xe9, 0xf0, 0xd0, 0xae, 0x3f, 0x11, 0x1b, 0xd6, 0x91, 0x0c, 0xba, 0x03, 0x88, 0xd7, - 0x37, 0x0d, 0xfc, 0x08, 0xc7, 0xb6, 0x9a, 0xcc, 0x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, 0x78, - 0xf2, 0xf2, 0x4d, 0x49, 0x7b, 0xf5, 0xa6, 0xa4, 0xfd, 0xf9, 0xa6, 0xa4, 0x7d, 0xf7, 0xb6, 0x34, - 0xf6, 0xea, 0x6d, 0x69, 0xec, 0xb7, 0xb7, 0xa5, 0xb1, 0xe7, 0xef, 0xf6, 0xbc, 0x60, 0xdc, 0xea, - 0x9a, 0xfc, 0xbf, 0x4f, 0x1c, 0x54, 0x3a, 0x95, 0xde, 0xbf, 0x7e, 0xfe, 0xa0, 0xd5, 0x73, 0xe2, - 0x7f, 0xfd, 0xde, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd7, 0x41, 0x25, 0x03, 0x10, 0x10, 0x00, - 0x00, + // 1383 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0x36, 0x89, 0x63, 0xbf, 0xc4, 0x69, 0xb2, 0x49, 0x9b, 0xed, 0xa6, 0x71, 0xda, 0x0d, + 0x2d, 0x15, 0x6a, 0xec, 0xe2, 0x82, 0x28, 0x85, 0x03, 0x4d, 0x54, 0xd2, 0x50, 0x9c, 0x54, 0x1b, + 0x17, 0xa4, 0x5e, 0x56, 0xeb, 0xdd, 0xc9, 0x7a, 0x15, 0xef, 0x8e, 0xb5, 0x33, 0x8e, 0xec, 0x88, + 0x13, 0x12, 0x07, 0x6e, 0x1c, 0x90, 0x40, 0x7c, 0x01, 0xbe, 0x4a, 0xb9, 0x55, 0x9c, 0x28, 0x87, + 0x0a, 0x9a, 0x6f, 0xc0, 0x27, 0x40, 0xf3, 0x67, 0x37, 0x5e, 0x27, 0xb6, 0xe3, 0x20, 0x4e, 0x9e, + 0xf7, 0xe6, 0xfd, 0xde, 0xbf, 0x79, 0x6f, 0xe6, 0xad, 0x61, 0xc1, 0x89, 0x30, 0x21, 0x4e, 0xdd, + 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d5, 0x21, 0xeb, 0x22, 0xc7, 0x0f, 0xec, 0x06, 0xd1, + 0x32, 0x37, 0x94, 0x3b, 0x79, 0x33, 0xa1, 0xd5, 0x65, 0xc8, 0x79, 0x36, 0xb1, 0x1a, 0x7e, 0xe0, + 0x53, 0x6d, 0x8a, 0xdb, 0xc8, 0x7a, 0x36, 0xf9, 0x92, 0xd1, 0x86, 0x05, 0xd7, 0x4e, 0xc5, 0x14, + 0x47, 0xcc, 0x22, 0x38, 0x4a, 0x45, 0x20, 0x22, 0x9c, 0x39, 0xea, 0x8e, 0x60, 0x05, 0xc0, 0x71, + 0x68, 0xdb, 0xf2, 0x43, 0x17, 0xb5, 0xe3, 0xa4, 0x32, 0xce, 0x36, 0x63, 0x18, 0xaf, 0x15, 0x58, + 0xac, 0x10, 0xef, 0x91, 0xeb, 0x56, 0xf1, 0x6e, 0x8b, 0x56, 0xdb, 0xd5, 0xc8, 0x76, 0x0e, 0x50, + 0x34, 0x20, 0x71, 0xdd, 0x39, 0xb9, 0x94, 0xce, 0xc9, 0x22, 0x4c, 0x86, 0x38, 0x74, 0x10, 0xcf, + 0xd5, 0x84, 0x29, 0x08, 0x75, 0x09, 0xa6, 0x68, 0xdb, 0xaa, 0xdb, 0xa4, 0x2e, 0x93, 0x95, 0xa1, + 0xed, 0x27, 0x36, 0xa9, 0xab, 0x6b, 0x30, 0xd9, 0x8c, 0x30, 0xde, 0xe7, 0xd9, 0x9a, 0x2e, 0xe7, + 0x8b, 0xb2, 0xaa, 0x9e, 0x31, 0xa6, 0x29, 0xf6, 0x58, 0x00, 0xb5, 0x06, 0x76, 0x0e, 0x84, 0x82, + 0x8c, 0x08, 0x80, 0x73, 0xb8, 0x8e, 0x6b, 0x90, 0x4d, 0xa2, 0x13, 0xd9, 0x9b, 0x8a, 0x63, 0x2b, + 0xc0, 0xf5, 0xb3, 0x42, 0x4b, 0x2a, 0x66, 0x9f, 0x27, 0xd7, 0x44, 0x01, 0x3e, 0x44, 0x9f, 0x47,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, 0xd0, 0x1f, 0x8c, 0x8a, 0x48, + 0xac, 0x77, 0x20, 0x9f, 0x9e, 0x3f, 0x4a, 0xc3, 0x55, 0xa5, 0x00, 0xfa, 0x47, 0x23, 0x02, 0x12, + 0xd3, 0x4d, 0x80, 0xae, 0x21, 0xe2, 0xee, 0x70, 0x35, 0x27, 0xd2, 0xfa, 0x07, 0xa3, 0x48, 0x27, + 0x16, 0x7f, 0x51, 0x40, 0xeb, 0x3b, 0x41, 0x3c, 0x1c, 0xae, 0xb2, 0x1f, 0x56, 0xdf, 0xb8, 0x38, + 0x36, 0x71, 0xee, 0x27, 0x05, 0x96, 0xfa, 0xdd, 0xed, 0x1f, 0x8f, 0xaa, 0x3f, 0x81, 0xea, 0x8f, + 0x2e, 0x0c, 0xed, 0xae, 0xd0, 0x9e, 0x2f, 0xc5, 0x73, 0x54, 0x68, 0x1a, 0x71, 0x9e, 0x0a, 0xed, + 0xf3, 0xe5, 0xf6, 0xad, 0x02, 0x73, 0xa7, 0x3e, 0x8c, 0xcb, 0xc3, 0xd5, 0xf5, 0x62, 0xf4, 0x87, + 0xa3, 0x63, 0x62, 0x27, 0x36, 0x9e, 0xbe, 0x7c, 0x5b, 0x50, 0x5e, 0xbd, 0x2d, 0x28, 0x7f, 0xbd, + 0x2d, 0x28, 0x3f, 0x1c, 0x17, 0xc6, 0x5e, 0x1d, 0x17, 0xc6, 0xfe, 0x38, 0x2e, 0x8c, 0xbd, 0x78, + 0xbf, 0xeb, 0x05, 0x63, 0x5a, 0xd7, 0xc5, 0x7f, 0x04, 0xb1, 0x81, 0x52, 0xbb, 0xd4, 0xfd, 0xcf, + 0x01, 0x7b, 0xd0, 0x6a, 0x19, 0xfe, 0xcd, 0x7f, 0xff, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x43, + 0xc6, 0x61, 0x3f, 0x54, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1833,6 +1850,20 @@ func (m *MsgWhitelistERC20Response) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l + if len(m.CctxIndex) > 0 { + i -= len(m.CctxIndex) + copy(dAtA[i:], m.CctxIndex) + i = encodeVarintTx(dAtA, i, uint64(len(m.CctxIndex))) + i-- + dAtA[i] = 0x12 + } + if len(m.Zrc20Address) > 0 { + i -= len(m.Zrc20Address) + copy(dAtA[i:], m.Zrc20Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Zrc20Address))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -2602,6 +2633,14 @@ func (m *MsgWhitelistERC20Response) Size() (n int) { } var l int _ = l + l = len(m.Zrc20Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.CctxIndex) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -3353,6 +3392,70 @@ func (m *MsgWhitelistERC20Response) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgWhitelistERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Zrc20Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Zrc20Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CctxIndex", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CctxIndex = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/fungible/types/errors.go b/x/fungible/types/errors.go index 6bfec4c107..8ab68525a3 100644 --- a/x/fungible/types/errors.go +++ b/x/fungible/types/errors.go @@ -8,29 +8,30 @@ import ( // x/fungible module sentinel errors var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") - ErrABIPack = sdkerrors.Register(ModuleName, 1101, "abi pack error") - ErrABIGet = sdkerrors.Register(ModuleName, 1102, "abi get error") - ErrUnexpectedEvent = sdkerrors.Register(ModuleName, 1103, "unexpected event") - ErrABIUnpack = sdkerrors.Register(ModuleName, 1104, "abi unpack error") - ErrBlanceQuery = sdkerrors.Register(ModuleName, 1105, "balance query error") - ErrBalanceInvariance = sdkerrors.Register(ModuleName, 1106, "balance invariance error") - ErrContractNotFound = sdkerrors.Register(ModuleName, 1107, "contract not found") - ErrChainNotFound = sdkerrors.Register(ModuleName, 1108, "chain not found") - ErrContractCall = sdkerrors.Register(ModuleName, 1109, "contract call error") - ErrSystemContractNotFound = sdkerrors.Register(ModuleName, 1110, "system contract not found") - ErrInvalidAddress = sdkerrors.Register(ModuleName, 1111, "invalid address") - ErrStateVariableNotFound = sdkerrors.Register(ModuleName, 1112, "state variable not found") - ErrDeployContract = sdkerrors.Register(ModuleName, 1113, "deploy contract error") - ErrEmitEvent = sdkerrors.Register(ModuleName, 1114, "emit event error") - ErrInvalidDecimals = sdkerrors.Register(ModuleName, 1115, "invalid decimals") - ErrGasPriceNotFound = sdkerrors.Register(ModuleName, 1116, "gas price not found") - ErrUpdateNonce = sdkerrors.Register(ModuleName, 1117, "update nonce error") - ErrInvalidGasLimit = sdkerrors.Register(ModuleName, 1118, "invalid gas limit") - ErrSetBytecode = sdkerrors.Register(ModuleName, 1119, "set bytecode error") - ErrInvalidContract = sdkerrors.Register(ModuleName, 1120, "invalid contract") - ErrPausedZRC20 = sdkerrors.Register(ModuleName, 1121, "ZRC20 is paused") - ErrForeignCoinNotFound = sdkerrors.Register(ModuleName, 1122, "foreign coin not found") - ErrForeignCoinCapReached = sdkerrors.Register(ModuleName, 1123, "foreign coin cap reached") - ErrCallNonContract = sdkerrors.Register(ModuleName, 1124, "can't call a non-contract address") + ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") + ErrABIPack = sdkerrors.Register(ModuleName, 1101, "abi pack error") + ErrABIGet = sdkerrors.Register(ModuleName, 1102, "abi get error") + ErrUnexpectedEvent = sdkerrors.Register(ModuleName, 1103, "unexpected event") + ErrABIUnpack = sdkerrors.Register(ModuleName, 1104, "abi unpack error") + ErrBlanceQuery = sdkerrors.Register(ModuleName, 1105, "balance query error") + ErrBalanceInvariance = sdkerrors.Register(ModuleName, 1106, "balance invariance error") + ErrContractNotFound = sdkerrors.Register(ModuleName, 1107, "contract not found") + ErrChainNotFound = sdkerrors.Register(ModuleName, 1108, "chain not found") + ErrContractCall = sdkerrors.Register(ModuleName, 1109, "contract call error") + ErrSystemContractNotFound = sdkerrors.Register(ModuleName, 1110, "system contract not found") + ErrInvalidAddress = sdkerrors.Register(ModuleName, 1111, "invalid address") + ErrStateVariableNotFound = sdkerrors.Register(ModuleName, 1112, "state variable not found") + ErrDeployContract = sdkerrors.Register(ModuleName, 1113, "deploy contract error") + ErrEmitEvent = sdkerrors.Register(ModuleName, 1114, "emit event error") + ErrInvalidDecimals = sdkerrors.Register(ModuleName, 1115, "invalid decimals") + ErrGasPriceNotFound = sdkerrors.Register(ModuleName, 1116, "gas price not found") + ErrUpdateNonce = sdkerrors.Register(ModuleName, 1117, "update nonce error") + ErrInvalidGasLimit = sdkerrors.Register(ModuleName, 1118, "invalid gas limit") + ErrSetBytecode = sdkerrors.Register(ModuleName, 1119, "set bytecode error") + ErrInvalidContract = sdkerrors.Register(ModuleName, 1120, "invalid contract") + ErrPausedZRC20 = sdkerrors.Register(ModuleName, 1121, "ZRC20 is paused") + ErrForeignCoinNotFound = sdkerrors.Register(ModuleName, 1122, "foreign coin not found") + ErrForeignCoinCapReached = sdkerrors.Register(ModuleName, 1123, "foreign coin cap reached") + ErrCallNonContract = sdkerrors.Register(ModuleName, 1124, "can't call a non-contract address") + ErrForeignCoinAlreadyExist = sdkerrors.Register(ModuleName, 1125, "foreign coin already exist") ) From 23d77246db11a9434443012c7c1df14a9fa09c1f Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Tue, 10 Oct 2023 12:00:55 -0700 Subject: [PATCH 3/3] fix(`observer`): remove error return in `IsAuthorized` (#1250) * update function * regenerate interfaces * update for crosschain --- testutil/keeper/mocks/crosschain/account.go | 2 +- testutil/keeper/mocks/crosschain/bank.go | 2 +- testutil/keeper/mocks/crosschain/fungible.go | 2 +- testutil/keeper/mocks/crosschain/observer.go | 16 +++------------- testutil/keeper/mocks/crosschain/staking.go | 2 +- testutil/keeper/mocks/fungible/account.go | 2 +- testutil/keeper/mocks/fungible/bank.go | 2 +- testutil/keeper/mocks/fungible/evm.go | 2 +- testutil/keeper/mocks/fungible/observer.go | 2 +- x/crosschain/keeper/keeper_chain_nonces.go | 10 ++++------ .../keeper_cross_chain_tx_vote_inbound_tx.go | 5 ++--- .../keeper_cross_chain_tx_vote_outbound_tx.go | 5 ++--- x/crosschain/keeper/keeper_gas_price.go | 9 ++++----- x/crosschain/keeper/keeper_out_tx_tracker.go | 7 ++----- x/crosschain/types/expected_keepers.go | 2 +- x/observer/keeper/keeper_utils.go | 8 ++++---- x/observer/keeper/msg_server_add_blame_vote.go | 5 ++--- x/observer/keeper/msg_server_add_block_header.go | 5 ++--- 18 files changed, 34 insertions(+), 54 deletions(-) diff --git a/testutil/keeper/mocks/crosschain/account.go b/testutil/keeper/mocks/crosschain/account.go index bde82aa1df..69df546af1 100644 --- a/testutil/keeper/mocks/crosschain/account.go +++ b/testutil/keeper/mocks/crosschain/account.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.34.2. DO NOT EDIT. +// Code generated by mockery v2.35.2. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/crosschain/bank.go b/testutil/keeper/mocks/crosschain/bank.go index bf4e73987b..8b4e4c1b04 100644 --- a/testutil/keeper/mocks/crosschain/bank.go +++ b/testutil/keeper/mocks/crosschain/bank.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.34.2. DO NOT EDIT. +// Code generated by mockery v2.35.2. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/crosschain/fungible.go b/testutil/keeper/mocks/crosschain/fungible.go index ba803b9a52..1a1452f5c7 100644 --- a/testutil/keeper/mocks/crosschain/fungible.go +++ b/testutil/keeper/mocks/crosschain/fungible.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.34.2. DO NOT EDIT. +// Code generated by mockery v2.35.2. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/crosschain/observer.go b/testutil/keeper/mocks/crosschain/observer.go index 0f1d2b310c..8ddc1504cd 100644 --- a/testutil/keeper/mocks/crosschain/observer.go +++ b/testutil/keeper/mocks/crosschain/observer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.34.2. DO NOT EDIT. +// Code generated by mockery v2.35.2. DO NOT EDIT. package mocks @@ -333,27 +333,17 @@ func (_m *CrosschainObserverKeeper) GetParams(ctx types.Context) observertypes.P } // IsAuthorized provides a mock function with given fields: ctx, address, chain -func (_m *CrosschainObserverKeeper) IsAuthorized(ctx types.Context, address string, chain *common.Chain) (bool, error) { +func (_m *CrosschainObserverKeeper) IsAuthorized(ctx types.Context, address string, chain *common.Chain) bool { ret := _m.Called(ctx, address, chain) var r0 bool - var r1 error - if rf, ok := ret.Get(0).(func(types.Context, string, *common.Chain) (bool, error)); ok { - return rf(ctx, address, chain) - } if rf, ok := ret.Get(0).(func(types.Context, string, *common.Chain) bool); ok { r0 = rf(ctx, address, chain) } else { r0 = ret.Get(0).(bool) } - if rf, ok := ret.Get(1).(func(types.Context, string, *common.Chain) error); ok { - r1 = rf(ctx, address, chain) - } else { - r1 = ret.Error(1) - } - - return r0, r1 + return r0 } // IsInboundEnabled provides a mock function with given fields: ctx diff --git a/testutil/keeper/mocks/crosschain/staking.go b/testutil/keeper/mocks/crosschain/staking.go index 0faf55a58a..7288ae4125 100644 --- a/testutil/keeper/mocks/crosschain/staking.go +++ b/testutil/keeper/mocks/crosschain/staking.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.34.2. DO NOT EDIT. +// Code generated by mockery v2.35.2. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/account.go b/testutil/keeper/mocks/fungible/account.go index 81f510c6d3..6a77932f69 100644 --- a/testutil/keeper/mocks/fungible/account.go +++ b/testutil/keeper/mocks/fungible/account.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.34.2. DO NOT EDIT. +// Code generated by mockery v2.35.2. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/bank.go b/testutil/keeper/mocks/fungible/bank.go index da56574169..d04228faf7 100644 --- a/testutil/keeper/mocks/fungible/bank.go +++ b/testutil/keeper/mocks/fungible/bank.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.34.2. DO NOT EDIT. +// Code generated by mockery v2.35.2. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/evm.go b/testutil/keeper/mocks/fungible/evm.go index e0ac00173c..fe04262d80 100644 --- a/testutil/keeper/mocks/fungible/evm.go +++ b/testutil/keeper/mocks/fungible/evm.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.34.2. DO NOT EDIT. +// Code generated by mockery v2.35.2. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/observer.go b/testutil/keeper/mocks/fungible/observer.go index fc7ec327b6..d627f7d980 100644 --- a/testutil/keeper/mocks/fungible/observer.go +++ b/testutil/keeper/mocks/fungible/observer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.34.2. DO NOT EDIT. +// Code generated by mockery v2.35.2. DO NOT EDIT. package mocks diff --git a/x/crosschain/keeper/keeper_chain_nonces.go b/x/crosschain/keeper/keeper_chain_nonces.go index 90291845ed..7ecd816075 100644 --- a/x/crosschain/keeper/keeper_chain_nonces.go +++ b/x/crosschain/keeper/keeper_chain_nonces.go @@ -4,13 +4,12 @@ import ( "context" "fmt" - zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" "github.com/zeta-chain/zetacore/x/crosschain/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -108,12 +107,11 @@ func (k msgServer) NonceVoter(goCtx context.Context, msg *types.MsgNonceVoter) ( ctx := sdk.UnwrapSDKContext(goCtx) chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.ChainId) if chain == nil { - return nil, zetaObserverTypes.ErrSupportedChains + return nil, observertypes.ErrSupportedChains } - ok, err := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain) - if !ok { - return nil, err + if ok := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain); !ok { + return nil, observertypes.ErrNotAuthorizedPolicy } chainNonce, isFound := k.GetChainNonces(ctx, chain.ChainName.String()) diff --git a/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go b/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go index 62c7813976..a384c320ba 100644 --- a/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go +++ b/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go @@ -77,9 +77,8 @@ func (k msgServer) VoteOnObservedInboundTx(goCtx context.Context, msg *types.Msg tssPub = tss.TssPubkey } // IsAuthorized does various checks against the list of observer mappers - ok, err := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, observationChain) - if !ok { - return nil, err + if ok := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, observationChain); !ok { + return nil, observerTypes.ErrNotAuthorizedPolicy } index := msg.Digest() diff --git a/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go b/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go index f8b845a925..f7d781bfd2 100644 --- a/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go +++ b/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go @@ -73,9 +73,8 @@ func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.Ms return nil, err } //Check is msg.Creator is authorized to vote - ok, err := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, observationChain) - if !ok { - return nil, err + if ok := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, observationChain); !ok { + return nil, observerTypes.ErrNotAuthorizedPolicy } // Check if CCTX exists diff --git a/x/crosschain/keeper/keeper_gas_price.go b/x/crosschain/keeper/keeper_gas_price.go index 63ea8e527f..50a103bec9 100644 --- a/x/crosschain/keeper/keeper_gas_price.go +++ b/x/crosschain/keeper/keeper_gas_price.go @@ -13,7 +13,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" "github.com/zeta-chain/zetacore/x/crosschain/types" - zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -127,11 +127,10 @@ func (k msgServer) GasPriceVoter(goCtx context.Context, msg *types.MsgGasPriceVo chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.ChainId) if chain == nil { - return nil, zetaObserverTypes.ErrSupportedChains + return nil, observertypes.ErrSupportedChains } - ok, err := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain) - if !ok { - return nil, err + if ok := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain); !ok { + return nil, observertypes.ErrNotAuthorizedPolicy } if chain == nil { return nil, sdkerrors.Wrap(types.ErrUnsupportedChain, fmt.Sprintf("ChainID : %d ", msg.ChainId)) diff --git a/x/crosschain/keeper/keeper_out_tx_tracker.go b/x/crosschain/keeper/keeper_out_tx_tracker.go index 5053687bd4..a11329aea2 100644 --- a/x/crosschain/keeper/keeper_out_tx_tracker.go +++ b/x/crosschain/keeper/keeper_out_tx_tracker.go @@ -173,11 +173,8 @@ func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToO adminPolicyAccount := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group1) isAdmin := msg.Creator == adminPolicyAccount - isObserver, err := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain) - if err != nil { - ctx.Logger().Error("Error while checking if the account is an observer", err) - return nil, cosmoserrors.Wrap(observertypes.ErrNotAuthorized, fmt.Sprintf("error IsAuthorized %s", msg.Creator)) - } + isObserver := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain) + // Sender needs to be either the admin policy account or an observer if !(isAdmin || isObserver) { return nil, cosmoserrors.Wrap(observertypes.ErrNotAuthorized, fmt.Sprintf("Creator %s", msg.Creator)) diff --git a/x/crosschain/types/expected_keepers.go b/x/crosschain/types/expected_keepers.go index fc5960b5e5..5b83869099 100644 --- a/x/crosschain/types/expected_keepers.go +++ b/x/crosschain/types/expected_keepers.go @@ -63,7 +63,7 @@ type ZetaObserverKeeper interface { SetLastObserverCount(ctx sdk.Context, lbc *zetaObserverTypes.LastObserverCount) AddVoteToBallot(ctx sdk.Context, ballot zetaObserverTypes.Ballot, address string, observationType zetaObserverTypes.VoteType) (zetaObserverTypes.Ballot, error) CheckIfFinalizingVote(ctx sdk.Context, ballot zetaObserverTypes.Ballot) (zetaObserverTypes.Ballot, bool) - IsAuthorized(ctx sdk.Context, address string, chain *common.Chain) (bool, error) + IsAuthorized(ctx sdk.Context, address string, chain *common.Chain) bool FindBallot(ctx sdk.Context, index string, chain *common.Chain, observationType zetaObserverTypes.ObservationType) (ballot zetaObserverTypes.Ballot, isNew bool, err error) AddBallotToList(ctx sdk.Context, ballot zetaObserverTypes.Ballot) GetBlockHeader(ctx sdk.Context, hash []byte) (val common.BlockHeader, found bool) diff --git a/x/observer/keeper/keeper_utils.go b/x/observer/keeper/keeper_utils.go index e36cd8e934..8424985d31 100644 --- a/x/observer/keeper/keeper_utils.go +++ b/x/observer/keeper/keeper_utils.go @@ -32,17 +32,17 @@ func (k Keeper) CheckIfFinalizingVote(ctx sdk.Context, ballot types.Ballot) (typ } // IsAuthorized checks whether a signer is authorized to sign , by checking their address against the observer mapper which contains the observer list for the chain and type -func (k Keeper) IsAuthorized(ctx sdk.Context, address string, chain *common.Chain) (bool, error) { +func (k Keeper) IsAuthorized(ctx sdk.Context, address string, chain *common.Chain) bool { observerMapper, found := k.GetObserverMapper(ctx, chain) if !found { - return false, errors.Wrap(types.ErrNotAuthorized, fmt.Sprintf("observer list not present for chain %s", chain.String())) + return false } for _, obs := range observerMapper.ObserverList { if obs == address { - return true, nil + return true } } - return false, errors.Wrap(types.ErrNotAuthorized, fmt.Sprintf("address: %s", address)) + return false } func (k Keeper) FindBallot(ctx sdk.Context, index string, chain *common.Chain, observationType types.ObservationType) (ballot types.Ballot, isNew bool, err error) { diff --git a/x/observer/keeper/msg_server_add_blame_vote.go b/x/observer/keeper/msg_server_add_blame_vote.go index b21bd30c69..1330cc4815 100644 --- a/x/observer/keeper/msg_server_add_blame_vote.go +++ b/x/observer/keeper/msg_server_add_blame_vote.go @@ -19,9 +19,8 @@ func (k msgServer) AddBlameVote(goCtx context.Context, vote *types.MsgAddBlameVo return nil, sdkerrors.Wrap(crosschainTypes.ErrUnsupportedChain, fmt.Sprintf("ChainID %d, Blame vote", vote.ChainId)) } // IsAuthorized does various checks against the list of observer mappers - ok, err := k.IsAuthorized(ctx, vote.Creator, observationChain) - if !ok { - return nil, err + if ok := k.IsAuthorized(ctx, vote.Creator, observationChain); !ok { + return nil, types.ErrNotAuthorizedPolicy } index := vote.Digest() diff --git a/x/observer/keeper/msg_server_add_block_header.go b/x/observer/keeper/msg_server_add_block_header.go index 8ee4ffa5cd..185fd9d061 100644 --- a/x/observer/keeper/msg_server_add_block_header.go +++ b/x/observer/keeper/msg_server_add_block_header.go @@ -17,9 +17,8 @@ func (k msgServer) AddBlockHeader(goCtx context.Context, msg *types.MsgAddBlockH // check authorization for this chain chain := common.GetChainFromChainID(msg.ChainId) - ok, err := k.IsAuthorized(ctx, msg.Creator, chain) - if !ok { - return nil, cosmoserrors.Wrap(types.ErrNotAuthorizedPolicy, err.Error()) + if ok := k.IsAuthorized(ctx, msg.Creator, chain); !ok { + return nil, types.ErrNotAuthorizedPolicy } // add vote to ballot