From c545822e5ac5d4edf8dec65b7f0aacca9170d6fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Kunze=20K=C3=BCllmer?= <31522760+fedekunze@users.noreply.github.com> Date: Tue, 14 Feb 2023 16:22:55 +0100 Subject: [PATCH] chore(test): prepare test files for refactor (#1391) * chore(test): prepare test files for refactor * refactor modules * changelog * lint --- CHANGELOG.md | 3 +- app/ante/cosmos/ante_test.go | 170 ----- app/ante/cosmos/authz_test.go | 158 ++++ app/ante/cosmos/setup_test.go | 120 +++ app/ante/cosmos/utils_test.go | 107 --- app/ante/evm/ante_test.go | 87 ++- app/ante/evm/{setup.go => setup_ctx.go} | 3 +- app/ante/evm/setup_ctx_test.go | 43 ++ app/ante/evm/setup_test.go | 139 +++- app/ante/evm/utils_test.go | 104 --- app/ante/setup_test.go | 73 ++ app/ante/sigverify_test.go | 29 - app/ante/utils_test.go | 91 +-- crypto/ethsecp256k1/keys.pb.go | 28 +- types/account.pb.go | 24 +- types/dynamic_fee.pb.go | 24 +- types/indexer.pb.go | 22 +- types/web3.pb.go | 22 +- x/claims/keeper/abci_test.go | 7 - x/claims/keeper/integration_test.go | 201 ----- x/claims/keeper/keeper_test.go | 169 ----- x/claims/keeper/setup_test.go | 47 ++ x/claims/keeper/utils_test.go | 339 +++++++++ x/claims/migrations/v3/types/genesis.pb.go | 34 +- x/claims/types/claims.pb.go | 36 +- x/claims/types/genesis.pb.go | 34 +- x/claims/types/query.pb.go | 84 ++- x/claims/types/query.pb.gw.go | 38 +- x/claims/types/tx.pb.go | 42 +- x/claims/types/tx.pb.gw.go | 32 +- x/epochs/keeper/setup_test.go | 41 ++ .../keeper/{keeper_test.go => utils_test.go} | 39 +- x/epochs/types/genesis.pb.go | 34 +- x/epochs/types/query.pb.go | 52 +- x/epochs/types/query.pb.gw.go | 32 +- x/erc20/keeper/erc20_utils_test.go | 75 ++ x/erc20/keeper/mock_test.go | 105 +++ x/erc20/keeper/setup_test.go | 74 ++ .../keeper/{keeper_test.go => utils_test.go} | 516 ++++--------- x/erc20/migrations/v3/types/genesis.pb.go | 30 +- x/erc20/types/erc20.pb.go | 50 +- x/erc20/types/genesis.pb.go | 28 +- x/erc20/types/query.pb.go | 68 +- x/erc20/types/query.pb.gw.go | 32 +- x/erc20/types/tx.pb.go | 74 +- x/erc20/types/tx.pb.gw.go | 32 +- x/evm/keeper/block_proposer.go | 31 + x/evm/keeper/{utils.go => fees.go} | 60 +- x/evm/keeper/fees_test.go | 517 +++++++++++++ x/evm/keeper/keeper_test.go | 407 ----------- x/evm/keeper/setup_test.go | 213 ++++++ x/evm/keeper/utils_test.go | 687 +++++------------- x/evm/migrations/v4/types/evm.pb.go | 72 +- x/evm/migrations/v5/types/evm.pb.go | 19 +- x/evm/types/events.pb.go | 38 +- x/evm/types/evm.pb.go | 66 +- x/evm/types/genesis.pb.go | 28 +- x/evm/types/query.pb.go | 192 ++++- x/evm/types/query.pb.gw.go | 82 +-- x/evm/types/tx.pb.go | 82 ++- x/evm/types/tx.pb.gw.go | 32 +- x/feemarket/keeper/integration_test.go | 260 ------- x/feemarket/keeper/keeper_test.go | 161 ---- x/feemarket/keeper/setup_test.go | 54 ++ x/feemarket/keeper/utils_test.go | 373 ++++++++++ .../migrations/v4/types/feemarket.pb.go | 24 +- x/feemarket/types/events.pb.go | 26 +- x/feemarket/types/feemarket.pb.go | 24 +- x/feemarket/types/genesis.pb.go | 22 +- x/feemarket/types/query.pb.go | 74 +- x/feemarket/types/query.pb.gw.go | 30 +- x/feemarket/types/tx.pb.go | 42 +- x/feemarket/types/tx.pb.gw.go | 32 +- x/incentives/keeper/evm_hooks_test.go | 10 - x/incentives/keeper/setup_test.go | 50 ++ .../keeper/{keeper_test.go => utils_test.go} | 68 +- .../migrations/v2/types/genesis.pb.go | 30 +- .../migrations/v2/types/incentives.pb.go | 46 +- x/incentives/types/genesis.pb.go | 30 +- x/incentives/types/incentives.pb.go | 46 +- x/incentives/types/query.pb.go | 120 ++- x/incentives/types/query.pb.gw.go | 56 +- x/incentives/types/tx.pb.go | 42 +- x/incentives/types/tx.pb.gw.go | 32 +- x/inflation/keeper/setup_test.go | 43 ++ .../keeper/{keeper_test.go => utils_test.go} | 43 +- x/inflation/migrations/v2/types/genesis.pb.go | 28 +- .../migrations/v2/types/inflation.pb.go | 30 +- x/inflation/types/genesis.pb.go | 28 +- x/inflation/types/inflation.pb.go | 30 +- x/inflation/types/query.pb.go | 122 +++- x/inflation/types/query.pb.gw.go | 42 +- x/inflation/types/tx.pb.go | 42 +- x/inflation/types/tx.pb.gw.go | 32 +- .../ibc_callbacks_integration_suite_test.go | 170 ----- x/recovery/keeper/mock_test.go | 51 ++ .../keeper/{keeper_test.go => setup_test.go} | 30 + x/recovery/keeper/utils_test.go | 158 +++- x/recovery/migrations/v2/types/genesis.pb.go | 34 +- x/recovery/types/genesis.pb.go | 34 +- x/recovery/types/query.pb.go | 42 +- x/recovery/types/query.pb.gw.go | 30 +- x/recovery/types/tx.pb.go | 42 +- x/recovery/types/tx.pb.gw.go | 32 +- x/revenue/keeper/integration_test.go | 267 ------- x/revenue/keeper/keeper_test.go | 179 ----- x/revenue/keeper/setup_test.go | 59 ++ x/revenue/keeper/utils_test.go | 398 ++++++++++ x/revenue/migrations/v2/types/genesis.pb.go | 30 +- x/revenue/types/events.pb.go | 38 +- x/revenue/types/genesis.pb.go | 30 +- x/revenue/types/query.pb.go | 94 ++- x/revenue/types/query.pb.gw.go | 48 +- x/revenue/types/revenue.pb.go | 20 +- x/revenue/types/tx.pb.go | 90 ++- x/revenue/types/tx.pb.gw.go | 40 +- x/vesting/keeper/keeper_test.go | 270 ------- x/vesting/keeper/setup_test.go | 64 ++ x/vesting/keeper/utils_test.go | 215 +++++- x/vesting/types/events.pb.go | 32 +- x/vesting/types/query.pb.go | 39 +- x/vesting/types/query.pb.gw.go | 30 +- x/vesting/types/tx.pb.go | 78 +- x/vesting/types/tx.pb.gw.go | 40 +- x/vesting/types/vesting.pb.go | 28 +- 125 files changed, 6199 insertions(+), 4723 deletions(-) delete mode 100644 app/ante/cosmos/ante_test.go create mode 100644 app/ante/cosmos/setup_test.go rename app/ante/evm/{setup.go => setup_ctx.go} (99%) create mode 100644 app/ante/evm/setup_ctx_test.go create mode 100644 app/ante/setup_test.go delete mode 100644 x/claims/keeper/keeper_test.go create mode 100644 x/claims/keeper/setup_test.go create mode 100644 x/claims/keeper/utils_test.go create mode 100644 x/epochs/keeper/setup_test.go rename x/epochs/keeper/{keeper_test.go => utils_test.go} (81%) create mode 100644 x/erc20/keeper/erc20_utils_test.go create mode 100644 x/erc20/keeper/mock_test.go create mode 100644 x/erc20/keeper/setup_test.go rename x/erc20/keeper/{keeper_test.go => utils_test.go} (75%) create mode 100644 x/evm/keeper/block_proposer.go rename x/evm/keeper/{utils.go => fees.go} (81%) create mode 100644 x/evm/keeper/fees_test.go create mode 100644 x/evm/keeper/setup_test.go create mode 100644 x/feemarket/keeper/setup_test.go create mode 100644 x/feemarket/keeper/utils_test.go create mode 100644 x/incentives/keeper/setup_test.go rename x/incentives/keeper/{keeper_test.go => utils_test.go} (93%) create mode 100644 x/inflation/keeper/setup_test.go rename x/inflation/keeper/{keeper_test.go => utils_test.go} (81%) delete mode 100644 x/recovery/keeper/ibc_callbacks_integration_suite_test.go create mode 100644 x/recovery/keeper/mock_test.go rename x/recovery/keeper/{keeper_test.go => setup_test.go} (78%) delete mode 100644 x/revenue/keeper/keeper_test.go create mode 100644 x/revenue/keeper/setup_test.go create mode 100644 x/revenue/keeper/utils_test.go delete mode 100644 x/vesting/keeper/keeper_test.go create mode 100644 x/vesting/keeper/setup_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 411e9ea675..b0e5d2b425 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +- (test) [\#1391](https://github.com/evmos/evmos/pull/1391) Refactor test files - (claims) [#1378](https://github.com/evmos/evmos/pull/1378) Validate authorized channels when updating claims params - (test) [#1348](https://github.com/evmos/evmos/pull/1348) Add query executions to e2e upgrade test suite - (deps) [#1370](https://github.com/evmos/evmos/pull/1370) Bump Cosmos SDK version to [`v0.46.9-ledger`](https://github.com/evmos/cosmos-sdk/releases/tag/v0.46.9-ledger) @@ -73,7 +74,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ - (deps) [#1370](https://github.com/evmos/evmos/pull/1370) Bump Cosmos SDK version to [`v0.46.9-ledger`](https://github.com/evmos/cosmos-sdk/releases/tag/v0.46.9-ledger) - (deps) [#1370](https://github.com/evmos/evmos/pull/1370) Bump Tendermint version to [`v0.34.26`](https://github.com/informalsystems/tendermint/releases/tag/v0.34.26) -- (deps) [#1374](https://github.com/evmos/evmos/pull/1374) Bump Gin version to [`v1.7.7`](github.com/gin-gonic/gin/releases/tag/v1.7.7) +- (deps) [#1374](https://github.com/evmos/evmos/pull/1374) Bump Gin version to [`v1.7.7`](https://github.com/gin-gonic/gin/releases/tag/v1.7.7) - (ante) [#1382](https://github.com/evmos/evmos/pull/1382) Add `AnteHandler` decorator for `x/authz` messages ## [v11.0.1] - 2023-02-04 diff --git a/app/ante/cosmos/ante_test.go b/app/ante/cosmos/ante_test.go deleted file mode 100644 index 9a64fb0e1e..0000000000 --- a/app/ante/cosmos/ante_test.go +++ /dev/null @@ -1,170 +0,0 @@ -package cosmos_test - -import ( - "fmt" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - sdkvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - "github.com/cosmos/cosmos-sdk/x/authz" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - evmtypes "github.com/evmos/evmos/v11/x/evm/types" - abci "github.com/tendermint/tendermint/abci/types" -) - -func (suite *AnteTestSuite) TestRejectMsgsInAuthz() { - testPrivKeys, testAddresses, err := generatePrivKeyAddressPairs(10) - suite.Require().NoError(err) - - distantFuture := time.Date(9000, 1, 1, 0, 0, 0, 0, time.UTC) - - newMsgGrant := func(msgTypeUrl string) *authz.MsgGrant { - msg, err := authz.NewMsgGrant( - testAddresses[0], - testAddresses[1], - authz.NewGenericAuthorization(msgTypeUrl), - &distantFuture, - ) - if err != nil { - panic(err) - } - return msg - } - - testcases := []struct { - name string - msgs []sdk.Msg - expectedCode uint32 - isEIP712 bool - }{ - { - name: "a MsgGrant with MsgEthereumTx typeURL on the authorization field is blocked", - msgs: []sdk.Msg{newMsgGrant(sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{}))}, - expectedCode: sdkerrors.ErrUnauthorized.ABCICode(), - }, - { - name: "a MsgGrant with MsgCreateVestingAccount typeURL on the authorization field is blocked", - msgs: []sdk.Msg{newMsgGrant(sdk.MsgTypeURL(&sdkvesting.MsgCreateVestingAccount{}))}, - expectedCode: sdkerrors.ErrUnauthorized.ABCICode(), - }, - { - name: "a MsgGrant with MsgEthereumTx typeURL on the authorization field included on EIP712 tx is blocked", - msgs: []sdk.Msg{newMsgGrant(sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{}))}, - expectedCode: sdkerrors.ErrUnauthorized.ABCICode(), - isEIP712: true, - }, - { - name: "a MsgExec with nested messages (valid: MsgSend and invalid: MsgEthereumTx) is blocked", - msgs: []sdk.Msg{ - newMsgExec( - testAddresses[1], - []sdk.Msg{ - banktypes.NewMsgSend( - testAddresses[0], - testAddresses[3], - sdk.NewCoins(sdk.NewInt64Coin(evmtypes.DefaultEVMDenom, 100e6)), - ), - &evmtypes.MsgEthereumTx{}, - }, - ), - }, - expectedCode: sdkerrors.ErrUnauthorized.ABCICode(), - }, - { - name: "a MsgExec with nested MsgExec messages that has invalid messages is blocked", - msgs: []sdk.Msg{ - createNestedMsgExec( - testAddresses[1], - 2, - []sdk.Msg{ - &evmtypes.MsgEthereumTx{}, - }, - ), - }, - expectedCode: sdkerrors.ErrUnauthorized.ABCICode(), - }, - { - name: "a MsgExec with more nested MsgExec messages than allowed and with valid messages is blocked", - msgs: []sdk.Msg{ - createNestedMsgExec( - testAddresses[1], - 6, - []sdk.Msg{ - banktypes.NewMsgSend( - testAddresses[0], - testAddresses[3], - sdk.NewCoins(sdk.NewInt64Coin(evmtypes.DefaultEVMDenom, 100e6)), - ), - }, - ), - }, - expectedCode: sdkerrors.ErrUnauthorized.ABCICode(), - }, - { - name: "two MsgExec messages NOT containing a blocked msg but between the two have more nesting than the allowed. Then, is blocked", - msgs: []sdk.Msg{ - createNestedMsgExec( - testAddresses[1], - 5, - []sdk.Msg{ - banktypes.NewMsgSend( - testAddresses[0], - testAddresses[3], - sdk.NewCoins(sdk.NewInt64Coin(evmtypes.DefaultEVMDenom, 100e6)), - ), - }, - ), - createNestedMsgExec( - testAddresses[1], - 5, - []sdk.Msg{ - banktypes.NewMsgSend( - testAddresses[0], - testAddresses[3], - sdk.NewCoins(sdk.NewInt64Coin(evmtypes.DefaultEVMDenom, 100e6)), - ), - }, - ), - }, - expectedCode: sdkerrors.ErrUnauthorized.ABCICode(), - }, - } - - for _, tc := range testcases { - suite.Run(fmt.Sprintf("Case %s", tc.name), func() { - suite.SetupTest() - var ( - tx sdk.Tx - err error - ) - - if tc.isEIP712 { - tx, err = createEIP712CosmosTx(testAddresses[0], testPrivKeys[0], tc.msgs) - } else { - tx, err = createTx(testPrivKeys[0], tc.msgs...) - } - suite.Require().NoError(err) - - txEncoder := suite.clientCtx.TxConfig.TxEncoder() - bz, err := txEncoder(tx) - suite.Require().NoError(err) - - resCheckTx := suite.app.CheckTx( - abci.RequestCheckTx{ - Tx: bz, - Type: abci.CheckTxType_New, - }, - ) - suite.Require().Equal(resCheckTx.Code, tc.expectedCode, resCheckTx.Log) - - // TODO uncomment this on v12 release. ATM the anteHandler works on CheckTx mode - // resDeliverTx := suite.app.DeliverTx( - // abci.RequestDeliverTx{ - // Tx: bz, - // }, - // ) - // suite.Require().Equal(resDeliverTx.Code, tc.expectedCode, resDeliverTx.Log) - }) - } -} diff --git a/app/ante/cosmos/authz_test.go b/app/ante/cosmos/authz_test.go index 451f759ee7..461fed8c8e 100644 --- a/app/ante/cosmos/authz_test.go +++ b/app/ante/cosmos/authz_test.go @@ -6,9 +6,11 @@ import ( "time" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" "github.com/cosmos/cosmos-sdk/x/authz" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -270,3 +272,159 @@ func TestAuthzLimiterDecorator(t *testing.T) { }) } } + +func (suite *AnteTestSuite) TestRejectMsgsInAuthz() { + testPrivKeys, testAddresses, err := generatePrivKeyAddressPairs(10) + suite.Require().NoError(err) + + distantFuture := time.Date(9000, 1, 1, 0, 0, 0, 0, time.UTC) + + newMsgGrant := func(msgTypeUrl string) *authz.MsgGrant { + msg, err := authz.NewMsgGrant( + testAddresses[0], + testAddresses[1], + authz.NewGenericAuthorization(msgTypeUrl), + &distantFuture, + ) + if err != nil { + panic(err) + } + return msg + } + + testcases := []struct { + name string + msgs []sdk.Msg + expectedCode uint32 + isEIP712 bool + }{ + { + name: "a MsgGrant with MsgEthereumTx typeURL on the authorization field is blocked", + msgs: []sdk.Msg{newMsgGrant(sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{}))}, + expectedCode: sdkerrors.ErrUnauthorized.ABCICode(), + }, + { + name: "a MsgGrant with MsgCreateVestingAccount typeURL on the authorization field is blocked", + msgs: []sdk.Msg{newMsgGrant(sdk.MsgTypeURL(&sdkvesting.MsgCreateVestingAccount{}))}, + expectedCode: sdkerrors.ErrUnauthorized.ABCICode(), + }, + { + name: "a MsgGrant with MsgEthereumTx typeURL on the authorization field included on EIP712 tx is blocked", + msgs: []sdk.Msg{newMsgGrant(sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{}))}, + expectedCode: sdkerrors.ErrUnauthorized.ABCICode(), + isEIP712: true, + }, + { + name: "a MsgExec with nested messages (valid: MsgSend and invalid: MsgEthereumTx) is blocked", + msgs: []sdk.Msg{ + newMsgExec( + testAddresses[1], + []sdk.Msg{ + banktypes.NewMsgSend( + testAddresses[0], + testAddresses[3], + sdk.NewCoins(sdk.NewInt64Coin(evmtypes.DefaultEVMDenom, 100e6)), + ), + &evmtypes.MsgEthereumTx{}, + }, + ), + }, + expectedCode: sdkerrors.ErrUnauthorized.ABCICode(), + }, + { + name: "a MsgExec with nested MsgExec messages that has invalid messages is blocked", + msgs: []sdk.Msg{ + createNestedMsgExec( + testAddresses[1], + 2, + []sdk.Msg{ + &evmtypes.MsgEthereumTx{}, + }, + ), + }, + expectedCode: sdkerrors.ErrUnauthorized.ABCICode(), + }, + { + name: "a MsgExec with more nested MsgExec messages than allowed and with valid messages is blocked", + msgs: []sdk.Msg{ + createNestedMsgExec( + testAddresses[1], + 6, + []sdk.Msg{ + banktypes.NewMsgSend( + testAddresses[0], + testAddresses[3], + sdk.NewCoins(sdk.NewInt64Coin(evmtypes.DefaultEVMDenom, 100e6)), + ), + }, + ), + }, + expectedCode: sdkerrors.ErrUnauthorized.ABCICode(), + }, + { + name: "two MsgExec messages NOT containing a blocked msg but between the two have more nesting than the allowed. Then, is blocked", + msgs: []sdk.Msg{ + createNestedMsgExec( + testAddresses[1], + 5, + []sdk.Msg{ + banktypes.NewMsgSend( + testAddresses[0], + testAddresses[3], + sdk.NewCoins(sdk.NewInt64Coin(evmtypes.DefaultEVMDenom, 100e6)), + ), + }, + ), + createNestedMsgExec( + testAddresses[1], + 5, + []sdk.Msg{ + banktypes.NewMsgSend( + testAddresses[0], + testAddresses[3], + sdk.NewCoins(sdk.NewInt64Coin(evmtypes.DefaultEVMDenom, 100e6)), + ), + }, + ), + }, + expectedCode: sdkerrors.ErrUnauthorized.ABCICode(), + }, + } + + for _, tc := range testcases { + suite.Run(fmt.Sprintf("Case %s", tc.name), func() { + suite.SetupTest() + var ( + tx sdk.Tx + err error + ) + + if tc.isEIP712 { + tx, err = createEIP712CosmosTx(testAddresses[0], testPrivKeys[0], tc.msgs) + } else { + tx, err = createTx(testPrivKeys[0], tc.msgs...) + } + suite.Require().NoError(err) + + txEncoder := suite.clientCtx.TxConfig.TxEncoder() + bz, err := txEncoder(tx) + suite.Require().NoError(err) + + resCheckTx := suite.app.CheckTx( + abci.RequestCheckTx{ + Tx: bz, + Type: abci.CheckTxType_New, + }, + ) + suite.Require().Equal(resCheckTx.Code, tc.expectedCode, resCheckTx.Log) + + // TODO uncomment this on v12 release. ATM the anteHandler works on CheckTx mode + // resDeliverTx := suite.app.DeliverTx( + // abci.RequestDeliverTx{ + // Tx: bz, + // }, + // ) + // suite.Require().Equal(resDeliverTx.Code, tc.expectedCode, resDeliverTx.Log) + }) + } +} diff --git a/app/ante/cosmos/setup_test.go b/app/ante/cosmos/setup_test.go new file mode 100644 index 0000000000..798e47190a --- /dev/null +++ b/app/ante/cosmos/setup_test.go @@ -0,0 +1,120 @@ +package cosmos_test + +import ( + "math" + "testing" + "time" + + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/simapp" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/app/ante" + evmante "github.com/evmos/evmos/v11/app/ante/evm" + "github.com/evmos/evmos/v11/encoding" + "github.com/evmos/evmos/v11/ethereum/eip712" + "github.com/evmos/evmos/v11/types" + "github.com/evmos/evmos/v11/utils" + "github.com/evmos/evmos/v11/x/evm/statedb" + evmtypes "github.com/evmos/evmos/v11/x/evm/types" + feemarkettypes "github.com/evmos/evmos/v11/x/feemarket/types" + "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" +) + +type AnteTestSuite struct { + suite.Suite + + ctx sdk.Context + app *app.Evmos + clientCtx client.Context + anteHandler sdk.AnteHandler + ethSigner ethtypes.Signer + enableFeemarket bool + enableLondonHF bool + evmParamsOption func(*evmtypes.Params) +} + +const TestGasLimit uint64 = 100000 + +var chainID = utils.TestnetChainID + "-1" + +func (suite *AnteTestSuite) StateDB() *statedb.StateDB { + return statedb.New(suite.ctx, suite.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(suite.ctx.HeaderHash().Bytes()))) +} + +func (suite *AnteTestSuite) SetupTest() { + checkTx := false + + suite.app = app.EthSetup(checkTx, func(app *app.Evmos, genesis simapp.GenesisState) simapp.GenesisState { + if suite.enableFeemarket { + // setup feemarketGenesis params + feemarketGenesis := feemarkettypes.DefaultGenesisState() + feemarketGenesis.Params.EnableHeight = 1 + feemarketGenesis.Params.NoBaseFee = false + // Verify feeMarket genesis + err := feemarketGenesis.Validate() + suite.Require().NoError(err) + genesis[feemarkettypes.ModuleName] = app.AppCodec().MustMarshalJSON(feemarketGenesis) + } + evmGenesis := evmtypes.DefaultGenesisState() + evmGenesis.Params.AllowUnprotectedTxs = false + if !suite.enableLondonHF { + maxInt := sdkmath.NewInt(math.MaxInt64) + evmGenesis.Params.ChainConfig.LondonBlock = &maxInt + evmGenesis.Params.ChainConfig.ArrowGlacierBlock = &maxInt + evmGenesis.Params.ChainConfig.GrayGlacierBlock = &maxInt + evmGenesis.Params.ChainConfig.MergeNetsplitBlock = &maxInt + evmGenesis.Params.ChainConfig.ShanghaiBlock = &maxInt + evmGenesis.Params.ChainConfig.CancunBlock = &maxInt + } + if suite.evmParamsOption != nil { + suite.evmParamsOption(&evmGenesis.Params) + } + genesis[evmtypes.ModuleName] = app.AppCodec().MustMarshalJSON(evmGenesis) + return genesis + }) + + suite.ctx = suite.app.BaseApp.NewContext(checkTx, tmproto.Header{Height: 2, ChainID: "evmos_9000-1", Time: time.Now().UTC()}) + suite.ctx = suite.ctx.WithMinGasPrices(sdk.NewDecCoins(sdk.NewDecCoin(utils.BaseDenom, sdk.OneInt()))) + suite.ctx = suite.ctx.WithBlockGasMeter(sdk.NewGasMeter(1000000000000000000)) + suite.app.EvmKeeper.WithChainID(suite.ctx) + + infCtx := suite.ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) + suite.app.AccountKeeper.SetParams(infCtx, authtypes.DefaultParams()) + + encodingConfig := encoding.MakeConfig(app.ModuleBasics) + // We're using TestMsg amino encoding in some tests, so register it here. + encodingConfig.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil) + eip712.SetEncodingConfig(encodingConfig) + + suite.clientCtx = client.Context{}.WithTxConfig(encodingConfig.TxConfig) + + anteHandler := ante.NewAnteHandler(ante.HandlerOptions{ + AccountKeeper: suite.app.AccountKeeper, + BankKeeper: suite.app.BankKeeper, + EvmKeeper: suite.app.EvmKeeper, + FeegrantKeeper: suite.app.FeeGrantKeeper, + StakingKeeper: suite.app.StakingKeeper, + IBCKeeper: suite.app.IBCKeeper, + FeeMarketKeeper: suite.app.FeeMarketKeeper, + SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), + SigGasConsumer: ante.SigVerificationGasConsumer, + ExtensionOptionChecker: types.HasDynamicFeeExtensionOption, + TxFeeChecker: evmante.NewDynamicFeeChecker(suite.app.EvmKeeper), + }) + + suite.anteHandler = anteHandler + suite.ethSigner = ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID()) +} + +func TestAnteTestSuite(t *testing.T) { + suite.Run(t, &AnteTestSuite{ + enableLondonHF: true, + }) +} diff --git a/app/ante/cosmos/utils_test.go b/app/ante/cosmos/utils_test.go index 257396817e..5a0c9666df 100644 --- a/app/ante/cosmos/utils_test.go +++ b/app/ante/cosmos/utils_test.go @@ -1,15 +1,10 @@ package cosmos_test import ( - "math" - "testing" "time" sdkmath "cosmossdk.io/math" - "github.com/stretchr/testify/suite" - "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/signer/core/apitypes" @@ -18,31 +13,21 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/simapp" - "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/authz" "github.com/evmos/evmos/v11/app" - "github.com/evmos/evmos/v11/app/ante" - evmante "github.com/evmos/evmos/v11/app/ante/evm" cryptocodec "github.com/evmos/evmos/v11/crypto/codec" "github.com/evmos/evmos/v11/crypto/ethsecp256k1" "github.com/evmos/evmos/v11/encoding" "github.com/evmos/evmos/v11/ethereum/eip712" "github.com/evmos/evmos/v11/tests" "github.com/evmos/evmos/v11/types" - "github.com/evmos/evmos/v11/utils" - "github.com/evmos/evmos/v11/x/evm/statedb" evmtypes "github.com/evmos/evmos/v11/x/evm/types" - feemarkettypes "github.com/evmos/evmos/v11/x/feemarket/types" - - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" ) var _ sdk.AnteHandler = (&MockAnteHandler{}).AnteHandle @@ -58,98 +43,6 @@ func (mah *MockAnteHandler) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool return ctx, nil } -type AnteTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.Evmos - clientCtx client.Context - anteHandler sdk.AnteHandler - ethSigner ethtypes.Signer - enableFeemarket bool - enableLondonHF bool - evmParamsOption func(*evmtypes.Params) -} - -const TestGasLimit uint64 = 100000 - -var chainID = utils.TestnetChainID + "-1" - -func (suite *AnteTestSuite) StateDB() *statedb.StateDB { - return statedb.New(suite.ctx, suite.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(suite.ctx.HeaderHash().Bytes()))) -} - -func (suite *AnteTestSuite) SetupTest() { - checkTx := false - - suite.app = app.EthSetup(checkTx, func(app *app.Evmos, genesis simapp.GenesisState) simapp.GenesisState { - if suite.enableFeemarket { - // setup feemarketGenesis params - feemarketGenesis := feemarkettypes.DefaultGenesisState() - feemarketGenesis.Params.EnableHeight = 1 - feemarketGenesis.Params.NoBaseFee = false - // Verify feeMarket genesis - err := feemarketGenesis.Validate() - suite.Require().NoError(err) - genesis[feemarkettypes.ModuleName] = app.AppCodec().MustMarshalJSON(feemarketGenesis) - } - evmGenesis := evmtypes.DefaultGenesisState() - evmGenesis.Params.AllowUnprotectedTxs = false - if !suite.enableLondonHF { - maxInt := sdkmath.NewInt(math.MaxInt64) - evmGenesis.Params.ChainConfig.LondonBlock = &maxInt - evmGenesis.Params.ChainConfig.ArrowGlacierBlock = &maxInt - evmGenesis.Params.ChainConfig.GrayGlacierBlock = &maxInt - evmGenesis.Params.ChainConfig.MergeNetsplitBlock = &maxInt - evmGenesis.Params.ChainConfig.ShanghaiBlock = &maxInt - evmGenesis.Params.ChainConfig.CancunBlock = &maxInt - } - if suite.evmParamsOption != nil { - suite.evmParamsOption(&evmGenesis.Params) - } - genesis[evmtypes.ModuleName] = app.AppCodec().MustMarshalJSON(evmGenesis) - return genesis - }) - - suite.ctx = suite.app.BaseApp.NewContext(checkTx, tmproto.Header{Height: 2, ChainID: chainID, Time: time.Now().UTC()}) - suite.ctx = suite.ctx.WithMinGasPrices(sdk.NewDecCoins(sdk.NewDecCoin(utils.BaseDenom, sdk.OneInt()))) - suite.ctx = suite.ctx.WithBlockGasMeter(sdk.NewGasMeter(1000000000000000000)) - suite.app.EvmKeeper.WithChainID(suite.ctx) - - infCtx := suite.ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) - suite.app.AccountKeeper.SetParams(infCtx, authtypes.DefaultParams()) - - encodingConfig := encoding.MakeConfig(app.ModuleBasics) - // We're using TestMsg amino encoding in some tests, so register it here. - encodingConfig.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil) - eip712.SetEncodingConfig(encodingConfig) - - suite.clientCtx = client.Context{}.WithTxConfig(encodingConfig.TxConfig) - - anteHandler := ante.NewAnteHandler(ante.HandlerOptions{ - AccountKeeper: suite.app.AccountKeeper, - BankKeeper: suite.app.BankKeeper, - EvmKeeper: suite.app.EvmKeeper, - FeegrantKeeper: suite.app.FeeGrantKeeper, - StakingKeeper: suite.app.StakingKeeper, - IBCKeeper: suite.app.IBCKeeper, - FeeMarketKeeper: suite.app.FeeMarketKeeper, - SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), - SigGasConsumer: ante.SigVerificationGasConsumer, - ExtensionOptionChecker: types.HasDynamicFeeExtensionOption, - TxFeeChecker: evmante.NewDynamicFeeChecker(suite.app.EvmKeeper), - }) - - suite.anteHandler = anteHandler - suite.ethSigner = ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID()) -} - -func TestAnteTestSuite(t *testing.T) { - suite.Run(t, &AnteTestSuite{ - enableLondonHF: true, - }) -} - func (suite *AnteTestSuite) CreateTestCosmosTxBuilder(gasPrice sdkmath.Int, denom string, msgs ...sdk.Msg) client.TxBuilder { txBuilder := suite.clientCtx.TxConfig.NewTxBuilder() diff --git a/app/ante/evm/ante_test.go b/app/ante/evm/ante_test.go index 8ed5e01002..fd6c9dbb24 100644 --- a/app/ante/evm/ante_test.go +++ b/app/ante/evm/ante_test.go @@ -8,21 +8,18 @@ import ( sdkmath "cosmossdk.io/math" kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" - + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx/signing" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/authz" - - sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/ethereum/go-ethereum/core/types" ethparams "github.com/ethereum/go-ethereum/params" + "github.com/evmos/evmos/v11/tests" evmtypes "github.com/evmos/evmos/v11/x/evm/types" - - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) func (suite *AnteTestSuite) TestAnteHandler() { @@ -315,7 +312,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { from := acc.GetAddress() gas := uint64(200000) amount := sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100*int64(gas)))) - txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, suite.ctx.ChainID(), gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "ethermint_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -326,7 +323,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { gas := uint64(200000) coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100*int64(gas))) amount := sdk.NewCoins(coinAmount) - txBuilder := suite.CreateTestEIP712TxBuilderMsgDelegate(from, privKey, suite.ctx.ChainID(), gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMsgDelegate(from, privKey, "ethermint_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -337,7 +334,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MsgCreateValidator(from, privKey, suite.ctx.ChainID(), gas, amount) + txBuilder := suite.CreateTestEIP712MsgCreateValidator(from, privKey, "ethermint_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -348,7 +345,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MsgCreateValidator2(from, privKey, suite.ctx.ChainID(), gas, amount) + txBuilder := suite.CreateTestEIP712MsgCreateValidator2(from, privKey, "ethermint_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -361,7 +358,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { gas := uint64(200000) // reusing the gasAmount for deposit deposit := sdk.NewCoins(coinAmount) - txBuilder := suite.CreateTestEIP712SubmitProposal(from, privKey, suite.ctx.ChainID(), gas, gasAmount, deposit) + txBuilder := suite.CreateTestEIP712SubmitProposal(from, privKey, "ethermint_9000-1", gas, gasAmount, deposit) return txBuilder.GetTx() }, false, false, true, }, @@ -379,7 +376,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { from, grantee, &banktypes.SendAuthorization{SpendLimit: gasAmount}, &expiresAt, ) suite.Require().NoError(err) - return suite.CreateTestEIP712SingleMessageTxBuilder(from, privKey, suite.ctx.ChainID(), gas, gasAmount, msg).GetTx() + return suite.CreateTestEIP712SingleMessageTxBuilder(from, privKey, "ethermint_9000-1", gas, gasAmount, msg).GetTx() }, false, false, true, }, @@ -390,7 +387,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) gasAmount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712GrantAllowance(from, privKey, suite.ctx.ChainID(), gas, gasAmount) + txBuilder := suite.CreateTestEIP712GrantAllowance(from, privKey, "ethermint_9000-1", gas, gasAmount) return txBuilder.GetTx() }, false, false, true, }, @@ -401,7 +398,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MsgEditValidator(from, privKey, suite.ctx.ChainID(), gas, amount) + txBuilder := suite.CreateTestEIP712MsgEditValidator(from, privKey, "ethermint_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -412,7 +409,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MsgSubmitEvidence(from, privKey, suite.ctx.ChainID(), gas, amount) + txBuilder := suite.CreateTestEIP712MsgSubmitEvidence(from, privKey, "ethermint_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -423,7 +420,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712SubmitProposalV1(from, privKey, suite.ctx.ChainID(), gas, amount) + txBuilder := suite.CreateTestEIP712SubmitProposalV1(from, privKey, "ethermint_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -434,7 +431,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MsgExec(from, privKey, suite.ctx.ChainID(), gas, amount) + txBuilder := suite.CreateTestEIP712MsgExec(from, privKey, "ethermint_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -445,7 +442,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MsgVoteV1(from, privKey, suite.ctx.ChainID(), gas, amount) + txBuilder := suite.CreateTestEIP712MsgVoteV1(from, privKey, "ethermint_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -456,7 +453,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MultipleMsgSend(from, privKey, suite.ctx.ChainID(), gas, amount) + txBuilder := suite.CreateTestEIP712MultipleMsgSend(from, privKey, "ethermint_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -467,7 +464,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MultipleSignerMsgs(from, privKey, suite.ctx.ChainID(), gas, amount) + txBuilder := suite.CreateTestEIP712MultipleSignerMsgs(from, privKey, "ethermint_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, false, }, @@ -477,7 +474,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { from := acc.GetAddress() gas := uint64(200000) amount := sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100*int64(gas)))) - txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "evmos_9002-1", gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "ethermint_9002-1", gas, amount) return txBuilder.GetTx() }, false, false, false, }, @@ -487,7 +484,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { from := acc.GetAddress() gas := uint64(200000) amount := sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100*int64(gas)))) - txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, suite.ctx.ChainID(), gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "ethermint_9001-1", gas, amount) txBuilder.SetGasLimit(uint64(300000)) txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(30)))) return txBuilder.GetTx() @@ -499,7 +496,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { from := acc.GetAddress() gas := uint64(200000) amount := sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100*int64(gas)))) - txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "evmos_9001-1", gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "ethermint_9001-1", gas, amount) return txBuilder.GetTx() }, false, false, false, }, @@ -509,7 +506,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { from := acc.GetAddress() gas := uint64(200000) amount := sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100*int64(gas)))) - txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, suite.ctx.ChainID(), gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "ethermint_9001-1", gas, amount) nonce, err := suite.app.AccountKeeper.GetSequence(suite.ctx, acc.GetAddress()) suite.Require().NoError(err) sigsV2 := signing.SignatureV2{ @@ -531,7 +528,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { from := acc.GetAddress() gas := uint64(200000) amount := sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100*int64(gas)))) - txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, suite.ctx.ChainID(), gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "ethermint_9001-1", gas, amount) nonce, err := suite.app.AccountKeeper.GetSequence(suite.ctx, acc.GetAddress()) suite.Require().NoError(err) sigsV2 := signing.SignatureV2{ @@ -575,7 +572,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "evmos", + "photon", sdk.NewInt(1), ), ), @@ -585,7 +582,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { privKey, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, msg, - suite.ctx.ChainID(), + "ethermint_9000-1", 2000000, "EIP-712", ) @@ -605,7 +602,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "evmos", + "photon", sdk.NewInt(1), ), ), @@ -615,7 +612,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { privKeys, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, msg, - suite.ctx.ChainID(), + "ethermint_9000-1", 2000000, "EIP-712", ) @@ -635,7 +632,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "evmos", + "photon", sdk.NewInt(1), ), ), @@ -645,7 +642,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { privKeys, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, msg, - suite.ctx.ChainID(), + "ethermint_9000-1", 2000000, "mixed", // Combine EIP-712 and standard signatures ) @@ -670,7 +667,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { privKeys, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, msg, - suite.ctx.ChainID(), + "ethermint_9000-1", 2000000, "mixed", // Combine EIP-712 and standard signatures ) @@ -690,7 +687,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "evmos", + "photon", sdk.NewInt(1), ), ), @@ -700,7 +697,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { privKeys, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, msg, - "evmos_9005-1", + "ethermint_9005-1", 2000000, "mixed", ) @@ -720,7 +717,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "evmos", + "photon", sdk.NewInt(1), ), ), @@ -730,7 +727,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { privKeys, signing.SignMode_SIGN_MODE_DIRECT, msg, - suite.ctx.ChainID(), + "ethermint_9000-1", 2000000, "mixed", ) @@ -750,7 +747,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "evmos", + "photon", sdk.NewInt(1), ), ), @@ -760,7 +757,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { privKeys, signing.SignMode_SIGN_MODE_DIRECT, msg, - suite.ctx.ChainID(), + "ethermint_9000-1", 2000, "mixed", // Combine EIP-712 and standard signatures ) @@ -780,7 +777,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "evmos", + "photon", sdk.NewInt(1), ), ), @@ -790,7 +787,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { privKeys, signing.SignMode_SIGN_MODE_DIRECT, msg, - suite.ctx.ChainID(), + "ethermint_9000-1", 2000, "EIP-712", ) @@ -814,7 +811,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "evmos", + "photon", sdk.NewInt(1), ), ), @@ -824,7 +821,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { privKeys, signing.SignMode_SIGN_MODE_DIRECT, msg, - suite.ctx.ChainID(), + "ethermint_9000-1", 2000, "EIP-712", ) @@ -844,7 +841,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "evmos", + "photon", sdk.NewInt(1), ), ), @@ -854,7 +851,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { privKey, signing.SignMode_SIGN_MODE_DIRECT, msg, - suite.ctx.ChainID(), + "ethermint_9000-1", 2000, "EIP-712", ) diff --git a/app/ante/evm/setup.go b/app/ante/evm/setup_ctx.go similarity index 99% rename from app/ante/evm/setup.go rename to app/ante/evm/setup_ctx.go index 029180396f..bed448cf54 100644 --- a/app/ante/evm/setup.go +++ b/app/ante/evm/setup_ctx.go @@ -74,6 +74,7 @@ func (eeed EthEmitEventDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulat // After eth tx passed ante handler, the fee is deducted and nonce increased, it shouldn't be ignored by json-rpc, // we need to emit some basic events at the very end of ante handler to be indexed by tendermint. txIndex := eeed.evmKeeper.GetTxIndexTransient(ctx) + for i, msg := range tx.GetMsgs() { msgEthTx, ok := msg.(*evmtypes.MsgEthereumTx) if !ok { @@ -85,7 +86,7 @@ func (eeed EthEmitEventDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulat ctx.EventManager().EmitEvent(sdk.NewEvent( evmtypes.EventTypeEthereumTx, sdk.NewAttribute(evmtypes.AttributeKeyEthereumTxHash, msgEthTx.Hash), - sdk.NewAttribute(evmtypes.AttributeKeyTxIndex, strconv.FormatUint(txIndex+uint64(i), 10)), + sdk.NewAttribute(evmtypes.AttributeKeyTxIndex, strconv.FormatUint(txIndex+uint64(i), 10)), // #nosec G701 )) } diff --git a/app/ante/evm/setup_ctx_test.go b/app/ante/evm/setup_ctx_test.go new file mode 100644 index 0000000000..eee56d7e5e --- /dev/null +++ b/app/ante/evm/setup_ctx_test.go @@ -0,0 +1,43 @@ +package evm_test + +import ( + "math/big" + + evmante "github.com/evmos/evmos/v11/app/ante/evm" + + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + evmtypes "github.com/evmos/evmos/v11/x/evm/types" +) + +func (suite *AnteTestSuite) TestEthSetupContextDecorator() { + dec := evmante.NewEthSetUpContextDecorator(suite.app.EvmKeeper) + tx := evmtypes.NewTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), 1000, big.NewInt(1), nil, nil, nil, nil) + + testCases := []struct { + name string + tx sdk.Tx + expPass bool + }{ + {"invalid transaction type - does not implement GasTx", &invalidTx{}, false}, + { + "success - transaction implement GasTx", + tx, + true, + }, + } + + for _, tc := range testCases { + suite.Run(tc.name, func() { + ctx, err := dec.AnteHandle(suite.ctx, tc.tx, false, NextFn) + + if tc.expPass { + suite.Require().NoError(err) + suite.Equal(storetypes.GasConfig{}, ctx.KVGasConfig()) + suite.Equal(storetypes.GasConfig{}, ctx.TransientKVGasConfig()) + } else { + suite.Require().Error(err) + } + }) + } +} diff --git a/app/ante/evm/setup_test.go b/app/ante/evm/setup_test.go index eee56d7e5e..973f98519c 100644 --- a/app/ante/evm/setup_test.go +++ b/app/ante/evm/setup_test.go @@ -1,43 +1,116 @@ package evm_test import ( - "math/big" + "math" + "testing" + "time" - evmante "github.com/evmos/evmos/v11/app/ante/evm" + "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/simapp" + "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/evmos/evmos/v11/app" + ante "github.com/evmos/evmos/v11/app/ante" + "github.com/evmos/evmos/v11/encoding" + "github.com/evmos/evmos/v11/ethereum/eip712" + "github.com/evmos/evmos/v11/x/evm/statedb" evmtypes "github.com/evmos/evmos/v11/x/evm/types" + feemarkettypes "github.com/evmos/evmos/v11/x/feemarket/types" ) -func (suite *AnteTestSuite) TestEthSetupContextDecorator() { - dec := evmante.NewEthSetUpContextDecorator(suite.app.EvmKeeper) - tx := evmtypes.NewTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), 1000, big.NewInt(1), nil, nil, nil, nil) - - testCases := []struct { - name string - tx sdk.Tx - expPass bool - }{ - {"invalid transaction type - does not implement GasTx", &invalidTx{}, false}, - { - "success - transaction implement GasTx", - tx, - true, - }, - } - - for _, tc := range testCases { - suite.Run(tc.name, func() { - ctx, err := dec.AnteHandle(suite.ctx, tc.tx, false, NextFn) - - if tc.expPass { - suite.Require().NoError(err) - suite.Equal(storetypes.GasConfig{}, ctx.KVGasConfig()) - suite.Equal(storetypes.GasConfig{}, ctx.TransientKVGasConfig()) - } else { - suite.Require().Error(err) - } - }) - } +type AnteTestSuite struct { + suite.Suite + + ctx sdk.Context + app *app.Evmos + clientCtx client.Context + anteHandler sdk.AnteHandler + ethSigner types.Signer + enableFeemarket bool + enableLondonHF bool + evmParamsOption func(*evmtypes.Params) +} + +const TestGasLimit uint64 = 100000 + +func (suite *AnteTestSuite) StateDB() *statedb.StateDB { + return statedb.New(suite.ctx, suite.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(suite.ctx.HeaderHash().Bytes()))) +} + +func (suite *AnteTestSuite) SetupTest() { + checkTx := false + + suite.app = app.EthSetup(checkTx, func(app *app.Evmos, genesis simapp.GenesisState) simapp.GenesisState { + if suite.enableFeemarket { + // setup feemarketGenesis params + feemarketGenesis := feemarkettypes.DefaultGenesisState() + feemarketGenesis.Params.EnableHeight = 1 + feemarketGenesis.Params.NoBaseFee = false + // Verify feeMarket genesis + err := feemarketGenesis.Validate() + suite.Require().NoError(err) + genesis[feemarkettypes.ModuleName] = app.AppCodec().MustMarshalJSON(feemarketGenesis) + } + evmGenesis := evmtypes.DefaultGenesisState() + evmGenesis.Params.AllowUnprotectedTxs = false + if !suite.enableLondonHF { + maxInt := sdkmath.NewInt(math.MaxInt64) + evmGenesis.Params.ChainConfig.LondonBlock = &maxInt + evmGenesis.Params.ChainConfig.ArrowGlacierBlock = &maxInt + evmGenesis.Params.ChainConfig.GrayGlacierBlock = &maxInt + evmGenesis.Params.ChainConfig.MergeNetsplitBlock = &maxInt + evmGenesis.Params.ChainConfig.ShanghaiBlock = &maxInt + evmGenesis.Params.ChainConfig.CancunBlock = &maxInt + } + if suite.evmParamsOption != nil { + suite.evmParamsOption(&evmGenesis.Params) + } + genesis[evmtypes.ModuleName] = app.AppCodec().MustMarshalJSON(evmGenesis) + return genesis + }) + + suite.ctx = suite.app.BaseApp.NewContext(checkTx, tmproto.Header{Height: 2, ChainID: "ethermint_9000-1", Time: time.Now().UTC()}) + suite.ctx = suite.ctx.WithMinGasPrices(sdk.NewDecCoins(sdk.NewDecCoin(evmtypes.DefaultEVMDenom, sdk.OneInt()))) + suite.ctx = suite.ctx.WithBlockGasMeter(sdk.NewGasMeter(1000000000000000000)) + suite.app.EvmKeeper.WithChainID(suite.ctx) + + infCtx := suite.ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) + suite.app.AccountKeeper.SetParams(infCtx, authtypes.DefaultParams()) + + encodingConfig := encoding.MakeConfig(app.ModuleBasics) + // We're using TestMsg amino encoding in some tests, so register it here. + encodingConfig.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil) + eip712.SetEncodingConfig(encodingConfig) + + suite.clientCtx = client.Context{}.WithTxConfig(encodingConfig.TxConfig) + + suite.Require().NotNil(suite.app.AppCodec()) + + anteHandler := ante.NewAnteHandler(ante.HandlerOptions{ + Cdc: suite.app.AppCodec(), + AccountKeeper: suite.app.AccountKeeper, + BankKeeper: suite.app.BankKeeper, + EvmKeeper: suite.app.EvmKeeper, + FeegrantKeeper: suite.app.FeeGrantKeeper, + IBCKeeper: suite.app.IBCKeeper, + FeeMarketKeeper: suite.app.FeeMarketKeeper, + SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), + SigGasConsumer: ante.SigVerificationGasConsumer, + }) + + suite.anteHandler = anteHandler + suite.ethSigner = types.LatestSignerForChainID(suite.app.EvmKeeper.ChainID()) +} + +func TestAnteTestSuite(t *testing.T) { + suite.Run(t, &AnteTestSuite{ + enableLondonHF: true, + }) } diff --git a/app/ante/evm/utils_test.go b/app/ante/evm/utils_test.go index f38a9e2fc7..292bb403df 100644 --- a/app/ante/evm/utils_test.go +++ b/app/ante/evm/utils_test.go @@ -3,13 +3,10 @@ package evm_test import ( "encoding/json" "fmt" - "math" "math/big" - "testing" "time" sdkmath "cosmossdk.io/math" - "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" @@ -19,7 +16,6 @@ import ( "github.com/ethereum/go-ethereum/signer/core/apitypes" "github.com/evmos/evmos/v11/ethereum/eip712" "github.com/evmos/evmos/v11/types" - "github.com/evmos/evmos/v11/utils" "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" @@ -30,15 +26,12 @@ import ( kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/crypto/types/multisig" - "github.com/cosmos/cosmos-sdk/simapp" - "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" txtypes "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" sdkante "github.com/cosmos/cosmos-sdk/x/auth/ante" authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authz "github.com/cosmos/cosmos-sdk/x/authz" cryptocodec "github.com/evmos/evmos/v11/crypto/codec" "github.com/evmos/evmos/v11/crypto/ethsecp256k1" @@ -48,107 +41,10 @@ import ( "github.com/cosmos/cosmos-sdk/x/feegrant" govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/evmos/evmos/v11/app" - ante "github.com/evmos/evmos/v11/app/ante" - "github.com/evmos/evmos/v11/encoding" "github.com/evmos/evmos/v11/tests" - "github.com/evmos/evmos/v11/x/evm/statedb" evmtypes "github.com/evmos/evmos/v11/x/evm/types" - feemarkettypes "github.com/evmos/evmos/v11/x/feemarket/types" - - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" ) -type AnteTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.Evmos - clientCtx client.Context - anteHandler sdk.AnteHandler - ethSigner ethtypes.Signer - enableFeemarket bool - enableLondonHF bool - evmParamsOption func(*evmtypes.Params) -} - -const TestGasLimit uint64 = 100000 - -func (suite *AnteTestSuite) StateDB() *statedb.StateDB { - return statedb.New(suite.ctx, suite.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(suite.ctx.HeaderHash().Bytes()))) -} - -func (suite *AnteTestSuite) SetupTest() { - checkTx := false - - suite.app = app.EthSetup(checkTx, func(app *app.Evmos, genesis simapp.GenesisState) simapp.GenesisState { - if suite.enableFeemarket { - // setup feemarketGenesis params - feemarketGenesis := feemarkettypes.DefaultGenesisState() - feemarketGenesis.Params.EnableHeight = 1 - feemarketGenesis.Params.NoBaseFee = false - // Verify feeMarket genesis - err := feemarketGenesis.Validate() - suite.Require().NoError(err) - genesis[feemarkettypes.ModuleName] = app.AppCodec().MustMarshalJSON(feemarketGenesis) - } - evmGenesis := evmtypes.DefaultGenesisState() - evmGenesis.Params.AllowUnprotectedTxs = false - if !suite.enableLondonHF { - maxInt := sdkmath.NewInt(math.MaxInt64) - evmGenesis.Params.ChainConfig.LondonBlock = &maxInt - evmGenesis.Params.ChainConfig.ArrowGlacierBlock = &maxInt - evmGenesis.Params.ChainConfig.GrayGlacierBlock = &maxInt - evmGenesis.Params.ChainConfig.MergeNetsplitBlock = &maxInt - evmGenesis.Params.ChainConfig.ShanghaiBlock = &maxInt - evmGenesis.Params.ChainConfig.CancunBlock = &maxInt - } - if suite.evmParamsOption != nil { - suite.evmParamsOption(&evmGenesis.Params) - } - genesis[evmtypes.ModuleName] = app.AppCodec().MustMarshalJSON(evmGenesis) - return genesis - }) - - suite.ctx = suite.app.BaseApp.NewContext(checkTx, tmproto.Header{Height: 2, ChainID: utils.TestnetChainID + "-1", Time: time.Now().UTC()}) - suite.ctx = suite.ctx.WithMinGasPrices(sdk.NewDecCoins(sdk.NewDecCoin(evmtypes.DefaultEVMDenom, sdk.OneInt()))) - suite.ctx = suite.ctx.WithBlockGasMeter(sdk.NewGasMeter(1000000000000000000)) - suite.app.EvmKeeper.WithChainID(suite.ctx) - - infCtx := suite.ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) - suite.app.AccountKeeper.SetParams(infCtx, authtypes.DefaultParams()) - - encodingConfig := encoding.MakeConfig(app.ModuleBasics) - // We're using TestMsg amino encoding in some tests, so register it here. - encodingConfig.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil) - eip712.SetEncodingConfig(encodingConfig) - - suite.clientCtx = client.Context{}.WithTxConfig(encodingConfig.TxConfig) - - suite.Require().NotNil(suite.app.AppCodec()) - - anteHandler := ante.NewAnteHandler(ante.HandlerOptions{ - Cdc: suite.app.AppCodec(), - AccountKeeper: suite.app.AccountKeeper, - BankKeeper: suite.app.BankKeeper, - EvmKeeper: suite.app.EvmKeeper, - FeegrantKeeper: suite.app.FeeGrantKeeper, - IBCKeeper: suite.app.IBCKeeper, - FeeMarketKeeper: suite.app.FeeMarketKeeper, - SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), - SigGasConsumer: ante.SigVerificationGasConsumer, - }) - - suite.anteHandler = anteHandler - suite.ethSigner = ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID()) -} - -func TestAnteTestSuite(t *testing.T) { - suite.Run(t, &AnteTestSuite{ - enableLondonHF: true, - }) -} - func (suite *AnteTestSuite) BuildTestEthTx( from common.Address, to common.Address, diff --git a/app/ante/setup_test.go b/app/ante/setup_test.go new file mode 100644 index 0000000000..88c1b1efe4 --- /dev/null +++ b/app/ante/setup_test.go @@ -0,0 +1,73 @@ +package ante_test + +import ( + "testing" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/crypto/ethsecp256k1" + "github.com/evmos/evmos/v11/utils" + feemarkettypes "github.com/evmos/evmos/v11/x/feemarket/types" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + "github.com/tendermint/tendermint/crypto/tmhash" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmversion "github.com/tendermint/tendermint/proto/tendermint/version" + "github.com/tendermint/tendermint/version" +) + +var s *AnteTestSuite + +type AnteTestSuite struct { + suite.Suite + + ctx sdk.Context + app *app.Evmos + denom string +} + +func (suite *AnteTestSuite) SetupTest() { + t := suite.T() + privCons, err := ethsecp256k1.GenerateKey() + require.NoError(t, err) + consAddress := sdk.ConsAddress(privCons.PubKey().Address()) + + isCheckTx := false + suite.app = app.Setup(isCheckTx, feemarkettypes.DefaultGenesisState()) + suite.Require().NotNil(suite.app.AppCodec()) + suite.ctx = suite.app.BaseApp.NewContext(isCheckTx, tmproto.Header{ + Height: 1, + ChainID: "evmos_9001-1", + Time: time.Now().UTC(), + ProposerAddress: consAddress.Bytes(), + + Version: tmversion.Consensus{ + Block: version.BlockProtocol, + }, + LastBlockId: tmproto.BlockID{ + Hash: tmhash.Sum([]byte("block_id")), + PartSetHeader: tmproto.PartSetHeader{ + Total: 11, + Hash: tmhash.Sum([]byte("partset_header")), + }, + }, + AppHash: tmhash.Sum([]byte("app")), + DataHash: tmhash.Sum([]byte("data")), + EvidenceHash: tmhash.Sum([]byte("evidence")), + ValidatorsHash: tmhash.Sum([]byte("validators")), + NextValidatorsHash: tmhash.Sum([]byte("next_validators")), + ConsensusHash: tmhash.Sum([]byte("consensus")), + LastResultsHash: tmhash.Sum([]byte("last_result")), + }) + + suite.denom = utils.BaseDenom + evmParams := suite.app.EvmKeeper.GetParams(suite.ctx) + evmParams.EvmDenom = suite.denom + _ = suite.app.EvmKeeper.SetParams(suite.ctx, evmParams) +} + +func TestAnteTestSuite(t *testing.T) { + s = new(AnteTestSuite) + suite.Run(t, s) +} diff --git a/app/ante/sigverify_test.go b/app/ante/sigverify_test.go index 2fd2d324a4..3d1c37f334 100644 --- a/app/ante/sigverify_test.go +++ b/app/ante/sigverify_test.go @@ -1,8 +1,6 @@ package ante_test import ( - "fmt" - "strings" "testing" "github.com/stretchr/testify/require" @@ -24,33 +22,6 @@ import ( "github.com/evmos/evmos/v11/encoding" ) -func generatePubKeysAndSignatures(n int, msg []byte, _ bool) (pubkeys []cryptotypes.PubKey, signatures [][]byte) { - pubkeys = make([]cryptotypes.PubKey, n) - signatures = make([][]byte, n) - for i := 0; i < n; i++ { - privkey, _ := ethsecp256k1.GenerateKey() - pubkeys[i] = privkey.PubKey() - signatures[i], _ = privkey.Sign(msg) - } - return -} - -func expectedGasCostByKeys(pubkeys []cryptotypes.PubKey) uint64 { - cost := uint64(0) - for _, pubkey := range pubkeys { - pubkeyType := strings.ToLower(fmt.Sprintf("%T", pubkey)) - switch { - case strings.Contains(pubkeyType, "ed25519"): - cost += authtypes.DefaultSigVerifyCostED25519 - case strings.Contains(pubkeyType, "ethsecp256k1"): - cost += ante.Secp256k1VerifyCost - default: - panic("unexpected key type") - } - } - return cost -} - func TestConsumeSignatureVerificationGas(t *testing.T) { params := authtypes.DefaultParams() msg := []byte{1, 2, 3, 4} diff --git a/app/ante/utils_test.go b/app/ante/utils_test.go index 88c1b1efe4..183725381a 100644 --- a/app/ante/utils_test.go +++ b/app/ante/utils_test.go @@ -1,73 +1,38 @@ package ante_test import ( - "testing" - "time" + "fmt" + "strings" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/evmos/evmos/v11/app" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/evmos/evmos/v11/app/ante" "github.com/evmos/evmos/v11/crypto/ethsecp256k1" - "github.com/evmos/evmos/v11/utils" - feemarkettypes "github.com/evmos/evmos/v11/x/feemarket/types" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - "github.com/tendermint/tendermint/crypto/tmhash" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmversion "github.com/tendermint/tendermint/proto/tendermint/version" - "github.com/tendermint/tendermint/version" ) -var s *AnteTestSuite - -type AnteTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.Evmos - denom string -} - -func (suite *AnteTestSuite) SetupTest() { - t := suite.T() - privCons, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - consAddress := sdk.ConsAddress(privCons.PubKey().Address()) - - isCheckTx := false - suite.app = app.Setup(isCheckTx, feemarkettypes.DefaultGenesisState()) - suite.Require().NotNil(suite.app.AppCodec()) - suite.ctx = suite.app.BaseApp.NewContext(isCheckTx, tmproto.Header{ - Height: 1, - ChainID: "evmos_9001-1", - Time: time.Now().UTC(), - ProposerAddress: consAddress.Bytes(), - - Version: tmversion.Consensus{ - Block: version.BlockProtocol, - }, - LastBlockId: tmproto.BlockID{ - Hash: tmhash.Sum([]byte("block_id")), - PartSetHeader: tmproto.PartSetHeader{ - Total: 11, - Hash: tmhash.Sum([]byte("partset_header")), - }, - }, - AppHash: tmhash.Sum([]byte("app")), - DataHash: tmhash.Sum([]byte("data")), - EvidenceHash: tmhash.Sum([]byte("evidence")), - ValidatorsHash: tmhash.Sum([]byte("validators")), - NextValidatorsHash: tmhash.Sum([]byte("next_validators")), - ConsensusHash: tmhash.Sum([]byte("consensus")), - LastResultsHash: tmhash.Sum([]byte("last_result")), - }) - - suite.denom = utils.BaseDenom - evmParams := suite.app.EvmKeeper.GetParams(suite.ctx) - evmParams.EvmDenom = suite.denom - _ = suite.app.EvmKeeper.SetParams(suite.ctx, evmParams) +func generatePubKeysAndSignatures(n int, msg []byte, _ bool) (pubkeys []cryptotypes.PubKey, signatures [][]byte) { + pubkeys = make([]cryptotypes.PubKey, n) + signatures = make([][]byte, n) + for i := 0; i < n; i++ { + privkey, _ := ethsecp256k1.GenerateKey() + pubkeys[i] = privkey.PubKey() + signatures[i], _ = privkey.Sign(msg) + } + return } -func TestAnteTestSuite(t *testing.T) { - s = new(AnteTestSuite) - suite.Run(t, s) +func expectedGasCostByKeys(pubkeys []cryptotypes.PubKey) uint64 { + cost := uint64(0) + for _, pubkey := range pubkeys { + pubkeyType := strings.ToLower(fmt.Sprintf("%T", pubkey)) + switch { + case strings.Contains(pubkeyType, "ed25519"): + cost += authtypes.DefaultSigVerifyCostED25519 + case strings.Contains(pubkeyType, "ethsecp256k1"): + cost += ante.Secp256k1VerifyCost + default: + panic("unexpected key type") + } + } + return cost } diff --git a/crypto/ethsecp256k1/keys.pb.go b/crypto/ethsecp256k1/keys.pb.go index fccf6ad451..b571bf3d92 100644 --- a/crypto/ethsecp256k1/keys.pb.go +++ b/crypto/ethsecp256k1/keys.pb.go @@ -5,17 +5,20 @@ package ethsecp256k1 import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -36,9 +39,11 @@ func (*PubKey) ProtoMessage() {} func (*PubKey) Descriptor() ([]byte, []int) { return fileDescriptor_0c10cadcf35beb64, []int{0} } + func (m *PubKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_PubKey.Marshal(b, m, deterministic) @@ -51,12 +56,15 @@ func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *PubKey) XXX_Merge(src proto.Message) { xxx_messageInfo_PubKey.Merge(m, src) } + func (m *PubKey) XXX_Size() int { return m.Size() } + func (m *PubKey) XXX_DiscardUnknown() { xxx_messageInfo_PubKey.DiscardUnknown(m) } @@ -83,9 +91,11 @@ func (*PrivKey) ProtoMessage() {} func (*PrivKey) Descriptor() ([]byte, []int) { return fileDescriptor_0c10cadcf35beb64, []int{1} } + func (m *PrivKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *PrivKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_PrivKey.Marshal(b, m, deterministic) @@ -98,12 +108,15 @@ func (m *PrivKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *PrivKey) XXX_Merge(src proto.Message) { xxx_messageInfo_PrivKey.Merge(m, src) } + func (m *PrivKey) XXX_Size() int { return m.Size() } + func (m *PrivKey) XXX_DiscardUnknown() { xxx_messageInfo_PrivKey.DiscardUnknown(m) } @@ -214,6 +227,7 @@ func encodeVarintKeys(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *PubKey) Size() (n int) { if m == nil { return 0 @@ -243,9 +257,11 @@ func (m *PrivKey) Size() (n int) { func sovKeys(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozKeys(x uint64) (n int) { return sovKeys(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *PubKey) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -330,6 +346,7 @@ func (m *PubKey) Unmarshal(dAtA []byte) error { } return nil } + func (m *PrivKey) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -414,6 +431,7 @@ func (m *PrivKey) Unmarshal(dAtA []byte) error { } return nil } + func skipKeys(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/types/account.pb.go b/types/account.pb.go index 55a8f3ea55..70cf735c6f 100644 --- a/types/account.pb.go +++ b/types/account.pb.go @@ -5,19 +5,22 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/x/auth/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -39,9 +42,11 @@ func (*EthAccount) ProtoMessage() {} func (*EthAccount) Descriptor() ([]byte, []int) { return fileDescriptor_4edc057d42a619ef, []int{0} } + func (m *EthAccount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EthAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EthAccount.Marshal(b, m, deterministic) @@ -54,12 +59,15 @@ func (m *EthAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *EthAccount) XXX_Merge(src proto.Message) { xxx_messageInfo_EthAccount.Merge(m, src) } + func (m *EthAccount) XXX_Size() int { return m.Size() } + func (m *EthAccount) XXX_DiscardUnknown() { xxx_messageInfo_EthAccount.DiscardUnknown(m) } @@ -149,6 +157,7 @@ func encodeVarintAccount(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *EthAccount) Size() (n int) { if m == nil { return 0 @@ -169,9 +178,11 @@ func (m *EthAccount) Size() (n int) { func sovAccount(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozAccount(x uint64) (n int) { return sovAccount(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *EthAccount) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -290,6 +301,7 @@ func (m *EthAccount) Unmarshal(dAtA []byte) error { } return nil } + func skipAccount(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/types/dynamic_fee.pb.go b/types/dynamic_fee.pb.go index 0e48a08959..9e5e30acb3 100644 --- a/types/dynamic_fee.pb.go +++ b/types/dynamic_fee.pb.go @@ -5,18 +5,21 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -36,9 +39,11 @@ func (*ExtensionOptionDynamicFeeTx) ProtoMessage() {} func (*ExtensionOptionDynamicFeeTx) Descriptor() ([]byte, []int) { return fileDescriptor_9d7cf05c9992c480, []int{0} } + func (m *ExtensionOptionDynamicFeeTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ExtensionOptionDynamicFeeTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ExtensionOptionDynamicFeeTx.Marshal(b, m, deterministic) @@ -51,12 +56,15 @@ func (m *ExtensionOptionDynamicFeeTx) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *ExtensionOptionDynamicFeeTx) XXX_Merge(src proto.Message) { xxx_messageInfo_ExtensionOptionDynamicFeeTx.Merge(m, src) } + func (m *ExtensionOptionDynamicFeeTx) XXX_Size() int { return m.Size() } + func (m *ExtensionOptionDynamicFeeTx) XXX_DiscardUnknown() { xxx_messageInfo_ExtensionOptionDynamicFeeTx.DiscardUnknown(m) } @@ -134,6 +142,7 @@ func encodeVarintDynamicFee(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *ExtensionOptionDynamicFeeTx) Size() (n int) { if m == nil { return 0 @@ -148,9 +157,11 @@ func (m *ExtensionOptionDynamicFeeTx) Size() (n int) { func sovDynamicFee(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozDynamicFee(x uint64) (n int) { return sovDynamicFee(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *ExtensionOptionDynamicFeeTx) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -235,6 +246,7 @@ func (m *ExtensionOptionDynamicFeeTx) Unmarshal(dAtA []byte) error { } return nil } + func skipDynamicFee(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/types/indexer.pb.go b/types/indexer.pb.go index 95a0bd1d85..277544c237 100644 --- a/types/indexer.pb.go +++ b/types/indexer.pb.go @@ -5,17 +5,20 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -50,9 +53,11 @@ func (*TxResult) ProtoMessage() {} func (*TxResult) Descriptor() ([]byte, []int) { return fileDescriptor_1197e10a8be8ed28, []int{0} } + func (m *TxResult) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *TxResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_TxResult.Marshal(b, m, deterministic) @@ -65,12 +70,15 @@ func (m *TxResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *TxResult) XXX_Merge(src proto.Message) { xxx_messageInfo_TxResult.Merge(m, src) } + func (m *TxResult) XXX_Size() int { return m.Size() } + func (m *TxResult) XXX_DiscardUnknown() { xxx_messageInfo_TxResult.DiscardUnknown(m) } @@ -180,6 +188,7 @@ func encodeVarintIndexer(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *TxResult) Size() (n int) { if m == nil { return 0 @@ -213,9 +222,11 @@ func (m *TxResult) Size() (n int) { func sovIndexer(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozIndexer(x uint64) (n int) { return sovIndexer(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *TxResult) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -400,6 +411,7 @@ func (m *TxResult) Unmarshal(dAtA []byte) error { } return nil } + func skipIndexer(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/types/web3.pb.go b/types/web3.pb.go index 764db948df..cc6913480c 100644 --- a/types/web3.pb.go +++ b/types/web3.pb.go @@ -5,17 +5,20 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -43,9 +46,11 @@ func (*ExtensionOptionsWeb3Tx) ProtoMessage() {} func (*ExtensionOptionsWeb3Tx) Descriptor() ([]byte, []int) { return fileDescriptor_9eb7cd56e3c92bc3, []int{0} } + func (m *ExtensionOptionsWeb3Tx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ExtensionOptionsWeb3Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ExtensionOptionsWeb3Tx.Marshal(b, m, deterministic) @@ -58,12 +63,15 @@ func (m *ExtensionOptionsWeb3Tx) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *ExtensionOptionsWeb3Tx) XXX_Merge(src proto.Message) { xxx_messageInfo_ExtensionOptionsWeb3Tx.Merge(m, src) } + func (m *ExtensionOptionsWeb3Tx) XXX_Size() int { return m.Size() } + func (m *ExtensionOptionsWeb3Tx) XXX_DiscardUnknown() { xxx_messageInfo_ExtensionOptionsWeb3Tx.DiscardUnknown(m) } @@ -152,6 +160,7 @@ func encodeVarintWeb3(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *ExtensionOptionsWeb3Tx) Size() (n int) { if m == nil { return 0 @@ -175,9 +184,11 @@ func (m *ExtensionOptionsWeb3Tx) Size() (n int) { func sovWeb3(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozWeb3(x uint64) (n int) { return sovWeb3(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *ExtensionOptionsWeb3Tx) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -313,6 +324,7 @@ func (m *ExtensionOptionsWeb3Tx) Unmarshal(dAtA []byte) error { } return nil } + func skipWeb3(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/claims/keeper/abci_test.go b/x/claims/keeper/abci_test.go index 7e8146f093..fea14026ca 100644 --- a/x/claims/keeper/abci_test.go +++ b/x/claims/keeper/abci_test.go @@ -283,10 +283,3 @@ func (suite *KeeperTestSuite) TestClawbackEscrowedTokensABCI() { }) } } - -func newEthAccount(baseAccount *authtypes.BaseAccount) evmostypes.EthAccount { - return evmostypes.EthAccount{ - BaseAccount: baseAccount, - CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(), - } -} diff --git a/x/claims/keeper/integration_test.go b/x/claims/keeper/integration_test.go index 388ecce88e..73829bfaad 100644 --- a/x/claims/keeper/integration_test.go +++ b/x/claims/keeper/integration_test.go @@ -1,41 +1,20 @@ package keeper_test import ( - "encoding/json" "math" - "math/big" - "strconv" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/tx/signing" - authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/evmos/evmos/v11/app" - "github.com/evmos/evmos/v11/contracts" "github.com/evmos/evmos/v11/crypto/ethsecp256k1" - "github.com/evmos/evmos/v11/encoding" - "github.com/evmos/evmos/v11/server/config" - "github.com/evmos/evmos/v11/tests" "github.com/evmos/evmos/v11/testutil" "github.com/evmos/evmos/v11/utils" "github.com/evmos/evmos/v11/x/claims/types" - evm "github.com/evmos/evmos/v11/x/evm/types" - incentivestypes "github.com/evmos/evmos/v11/x/incentives/types" inflationtypes "github.com/evmos/evmos/v11/x/inflation/types" ) @@ -333,183 +312,3 @@ var _ = Describe("Claiming", Ordered, func() { }) }) }) - -func getAddr(priv *ethsecp256k1.PrivKey) sdk.AccAddress { - return sdk.AccAddress(priv.PubKey().Address().Bytes()) -} - -func delegate(priv *ethsecp256k1.PrivKey, delegateAmount sdk.Coin) { - accountAddress := sdk.AccAddress(priv.PubKey().Address().Bytes()) - - val, err := sdk.ValAddressFromBech32(s.validator.OperatorAddress) - s.Require().NoError(err) - - delegateMsg := stakingtypes.NewMsgDelegate(accountAddress, val, delegateAmount) - deliverTx(priv, delegateMsg) -} - -func govProposal(priv *ethsecp256k1.PrivKey) uint64 { - stakeDenom := stakingtypes.DefaultParams().BondDenom - accountAddress := sdk.AccAddress(priv.PubKey().Address().Bytes()) - contractAddress := deployContract(priv) - content := incentivestypes.NewRegisterIncentiveProposal( - "test", - "description", - contractAddress.String(), - sdk.DecCoins{sdk.NewDecCoinFromDec(utils.BaseDenom, sdk.NewDecWithPrec(5, 2))}, - 1000, - ) - - deposit := sdk.NewCoins(sdk.NewCoin(stakeDenom, sdk.NewInt(100000000))) - msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, accountAddress) - s.Require().NoError(err) - - res := deliverTx(priv, msg) - submitEvent := res.GetEvents()[8] - Expect(submitEvent.Type).To(Equal("submit_proposal")) - Expect(string(submitEvent.Attributes[0].Key)).To(Equal("proposal_id")) - - proposalID, err := strconv.ParseUint(string(submitEvent.Attributes[0].Value), 10, 64) - s.Require().NoError(err) - - return proposalID -} - -func vote(priv *ethsecp256k1.PrivKey, proposalID uint64) { - accountAddress := sdk.AccAddress(priv.PubKey().Address().Bytes()) - - voteMsg := govv1beta1.NewMsgVote(accountAddress, proposalID, govv1beta1.OptionAbstain) - deliverTx(priv, voteMsg) -} - -func sendEthToSelf(priv *ethsecp256k1.PrivKey) { - chainID := s.app.EvmKeeper.ChainID() - from := common.BytesToAddress(priv.PubKey().Address().Bytes()) - nonce := s.app.EvmKeeper.GetNonce(s.ctx, from) - - msgEthereumTx := evm.NewTx(chainID, nonce, &from, nil, 100000, nil, s.app.FeeMarketKeeper.GetBaseFee(s.ctx), big.NewInt(1), nil, ðtypes.AccessList{}) - msgEthereumTx.From = from.String() - performEthTx(priv, msgEthereumTx) -} - -func deployContract(priv *ethsecp256k1.PrivKey) common.Address { - chainID := s.app.EvmKeeper.ChainID() - from := common.BytesToAddress(priv.PubKey().Address().Bytes()) - nonce := s.app.EvmKeeper.GetNonce(s.ctx, from) - - ctorArgs, err := contracts.ERC20MinterBurnerDecimalsContract.ABI.Pack("", "Test", "TTT", uint8(18)) - s.Require().NoError(err) - - data := append(contracts.ERC20MinterBurnerDecimalsContract.Bin, ctorArgs...) //nolint:gocritic - args, err := json.Marshal(&evm.TransactionArgs{ - From: &s.address, - Data: (*hexutil.Bytes)(&data), - }) - s.Require().NoError(err) - - ctx := sdk.WrapSDKContext(s.ctx) - res, err := s.queryClientEvm.EstimateGas(ctx, &evm.EthCallRequest{ - Args: args, - GasCap: config.DefaultGasCap, - }) - s.Require().NoError(err) - - msgEthereumTx := evm.NewTxContract(chainID, nonce, nil, res.Gas, nil, s.app.FeeMarketKeeper.GetBaseFee(s.ctx), big.NewInt(1), data, ðtypes.AccessList{}) - msgEthereumTx.From = from.String() - - performEthTx(priv, msgEthereumTx) - s.Commit() - - contractAddress := crypto.CreateAddress(from, nonce) - acc := s.app.EvmKeeper.GetAccountWithoutBalance(s.ctx, contractAddress) - s.Require().NotEmpty(acc) - s.Require().True(acc.IsContract()) - return contractAddress -} - -func performEthTx(priv *ethsecp256k1.PrivKey, msgEthereumTx *evm.MsgEthereumTx) { - // Sign transaction - err := msgEthereumTx.Sign(s.ethSigner, tests.NewSigner(priv)) - s.Require().NoError(err) - - // Assemble transaction from fields - encodingConfig := encoding.MakeConfig(app.ModuleBasics) - txBuilder := encodingConfig.TxConfig.NewTxBuilder() - tx, err := msgEthereumTx.BuildTx(txBuilder, utils.BaseDenom) - s.Require().NoError(err) - - // Encode transaction by default Tx encoder and broadcasted over the network - txEncoder := encodingConfig.TxConfig.TxEncoder() - bz, err := txEncoder(tx) - s.Require().NoError(err) - - req := abci.RequestDeliverTx{Tx: bz} - res := s.app.BaseApp.DeliverTx(req) - Expect(res.IsOK()).To(Equal(true)) -} - -func deliverTx(priv *ethsecp256k1.PrivKey, msgs ...sdk.Msg) abci.ResponseDeliverTx { - encodingConfig := encoding.MakeConfig(app.ModuleBasics) - accountAddress := sdk.AccAddress(priv.PubKey().Address().Bytes()) - - txBuilder := encodingConfig.TxConfig.NewTxBuilder() - - txBuilder.SetGasLimit(1000000) - txBuilder.SetFeeAmount(sdk.Coins{defaultTxFee}) - - err := txBuilder.SetMsgs(msgs...) - s.Require().NoError(err) - - seq, err := s.app.AccountKeeper.GetSequence(s.ctx, accountAddress) - s.Require().NoError(err) - - // First round: we gather all the signer infos. We use the "set empty - // signature" hack to do that. - sigV2 := signing.SignatureV2{ - PubKey: priv.PubKey(), - Data: &signing.SingleSignatureData{ - SignMode: encodingConfig.TxConfig.SignModeHandler().DefaultMode(), - Signature: nil, - }, - Sequence: seq, - } - - sigsV2 := []signing.SignatureV2{sigV2} - - err = txBuilder.SetSignatures(sigsV2...) - s.Require().NoError(err) - - // Second round: all signer infos are set, so each signer can sign. - accNumber := s.app.AccountKeeper.GetAccount(s.ctx, accountAddress).GetAccountNumber() - signerData := authsigning.SignerData{ - ChainID: s.ctx.ChainID(), - AccountNumber: accNumber, - Sequence: seq, - } - sigV2, err = tx.SignWithPrivKey( - encodingConfig.TxConfig.SignModeHandler().DefaultMode(), signerData, - txBuilder, priv, encodingConfig.TxConfig, - seq, - ) - s.Require().NoError(err) - - sigsV2 = []signing.SignatureV2{sigV2} - err = txBuilder.SetSignatures(sigsV2...) - s.Require().NoError(err) - - // bz are bytes to be broadcasted over the network - bz, err := encodingConfig.TxConfig.TxEncoder()(txBuilder.GetTx()) - s.Require().NoError(err) - - req := abci.RequestDeliverTx{Tx: bz} - res := s.app.BaseApp.DeliverTx(req) - Expect(res.IsOK()).To(Equal(true), res.Log) - return res -} - -func getEthTxFee() sdk.Coin { - baseFee := s.app.FeeMarketKeeper.GetBaseFee(s.ctx) - baseFee.Mul(baseFee, big.NewInt(100000)) - feeAmt := baseFee.Quo(baseFee, big.NewInt(2)) - return sdk.NewCoin(utils.BaseDenom, sdkmath.NewIntFromBigInt(feeAmt)) -} diff --git a/x/claims/keeper/keeper_test.go b/x/claims/keeper/keeper_test.go deleted file mode 100644 index 23b4a02f08..0000000000 --- a/x/claims/keeper/keeper_test.go +++ /dev/null @@ -1,169 +0,0 @@ -package keeper_test - -import ( - "testing" - "time" - - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "github.com/evmos/evmos/v11/crypto/ethsecp256k1" - "github.com/evmos/evmos/v11/tests" - feemarkettypes "github.com/evmos/evmos/v11/x/feemarket/types" - - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/evmos/evmos/v11/app" - "github.com/evmos/evmos/v11/testutil" - "github.com/evmos/evmos/v11/x/claims/types" - evm "github.com/evmos/evmos/v11/x/evm/types" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/tmhash" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmversion "github.com/tendermint/tendermint/proto/tendermint/version" - "github.com/tendermint/tendermint/version" -) - -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - - app *app.Evmos - queryClient types.QueryClient - queryClientEvm evm.QueryClient - address common.Address - signer keyring.Signer - ethSigner ethtypes.Signer - validator stakingtypes.Validator -} - -var s *KeeperTestSuite - -func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) - suite.Run(t, s) - - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") -} - -func (suite *KeeperTestSuite) SetupTest() { - suite.DoSetupTest(suite.T()) -} - -func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { - // account key - priv, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) - suite.signer = tests.NewSigner(priv) - - // consensus key - privCons, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - consAddress := sdk.ConsAddress(privCons.PubKey().Address()) - - suite.app = app.Setup(false, feemarkettypes.DefaultGenesisState()) - suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{ - Height: 1, - ChainID: "evmos_9001-1", - Time: time.Now().UTC(), - ProposerAddress: consAddress.Bytes(), - - Version: tmversion.Consensus{ - Block: version.BlockProtocol, - }, - LastBlockId: tmproto.BlockID{ - Hash: tmhash.Sum([]byte("block_id")), - PartSetHeader: tmproto.PartSetHeader{ - Total: 11, - Hash: tmhash.Sum([]byte("partset_header")), - }, - }, - AppHash: tmhash.Sum([]byte("app")), - DataHash: tmhash.Sum([]byte("data")), - EvidenceHash: tmhash.Sum([]byte("evidence")), - ValidatorsHash: tmhash.Sum([]byte("validators")), - NextValidatorsHash: tmhash.Sum([]byte("next_validators")), - ConsensusHash: tmhash.Sum([]byte("consensus")), - LastResultsHash: tmhash.Sum([]byte("last_result")), - }) - - queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, suite.app.ClaimsKeeper) - suite.queryClient = types.NewQueryClient(queryHelper) - - queryHelperEvm := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - evm.RegisterQueryServer(queryHelperEvm, suite.app.EvmKeeper) - suite.queryClientEvm = evm.NewQueryClient(queryHelperEvm) - - params := types.DefaultParams() - params.AirdropStartTime = suite.ctx.BlockTime().UTC() - err = suite.app.ClaimsKeeper.SetParams(suite.ctx, params) - require.NoError(t, err) - - stakingParams := suite.app.StakingKeeper.GetParams(suite.ctx) - stakingParams.BondDenom = params.GetClaimsDenom() - suite.app.StakingKeeper.SetParams(suite.ctx, stakingParams) - - // Set Validator - valAddr := sdk.ValAddress(suite.address.Bytes()) - validator, err := stakingtypes.NewValidator(valAddr, privCons.PubKey(), stakingtypes.Description{}) - require.NoError(t, err) - validator = stakingkeeper.TestingUpdateValidator(suite.app.StakingKeeper, suite.ctx, validator, true) - err = suite.app.StakingKeeper.AfterValidatorCreated(suite.ctx, validator.GetOperator()) - require.NoError(t, err) - err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) - require.NoError(t, err) - validators := s.app.StakingKeeper.GetValidators(s.ctx, 1) - suite.validator = validators[0] - - suite.ethSigner = ethtypes.LatestSignerForChainID(s.app.EvmKeeper.ChainID()) -} - -func (suite *KeeperTestSuite) SetupTestWithEscrow() { - suite.SetupTest() - params := suite.app.ClaimsKeeper.GetParams(suite.ctx) - - coins := sdk.NewCoins(sdk.NewCoin(params.ClaimsDenom, sdk.NewInt(10000000))) - err := testutil.FundModuleAccount(suite.ctx, suite.app.BankKeeper, types.ModuleName, coins) - suite.Require().NoError(err) -} - -// Commit commits and starts a new block with an updated context. -func (suite *KeeperTestSuite) Commit() { - suite.CommitAfter(time.Second * 0) -} - -// Commit commits a block at a given time. -func (suite *KeeperTestSuite) CommitAfter(t time.Duration) { - header := suite.ctx.BlockHeader() - suite.app.EndBlocker(suite.ctx, abci.RequestEndBlock{Height: header.Height}) - _ = suite.app.Commit() - - header.Height++ - header.Time = header.Time.Add(t) - suite.app.BeginBlock(abci.RequestBeginBlock{ - Header: header, - }) - - // update ctx - suite.ctx = suite.app.BaseApp.NewContext(false, header) - - queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, suite.app.ClaimsKeeper) - suite.queryClient = types.NewQueryClient(queryHelper) - - queryHelperEvm := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - evm.RegisterQueryServer(queryHelperEvm, suite.app.EvmKeeper) - suite.queryClientEvm = evm.NewQueryClient(queryHelperEvm) -} diff --git a/x/claims/keeper/setup_test.go b/x/claims/keeper/setup_test.go new file mode 100644 index 0000000000..22520da1dc --- /dev/null +++ b/x/claims/keeper/setup_test.go @@ -0,0 +1,47 @@ +package keeper_test + +import ( + "testing" + + "github.com/ethereum/go-ethereum/common" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/x/claims/types" + evm "github.com/evmos/evmos/v11/x/evm/types" + "github.com/stretchr/testify/suite" +) + +var s *KeeperTestSuite + +type KeeperTestSuite struct { + suite.Suite + + ctx sdk.Context + + app *app.Evmos + queryClient types.QueryClient + queryClientEvm evm.QueryClient + address common.Address + signer keyring.Signer + ethSigner ethtypes.Signer + validator stakingtypes.Validator +} + +func TestKeeperTestSuite(t *testing.T) { + s = new(KeeperTestSuite) + suite.Run(t, s) + + // Run Ginkgo integration tests + RegisterFailHandler(Fail) + RunSpecs(t, "Keeper Suite") +} + +func (suite *KeeperTestSuite) SetupTest() { + suite.DoSetupTest(suite.T()) +} diff --git a/x/claims/keeper/utils_test.go b/x/claims/keeper/utils_test.go new file mode 100644 index 0000000000..b6022e5040 --- /dev/null +++ b/x/claims/keeper/utils_test.go @@ -0,0 +1,339 @@ +package keeper_test + +import ( + "encoding/json" + "math/big" + "strconv" + "time" + + . "github.com/onsi/gomega" + + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/contracts" + "github.com/evmos/evmos/v11/crypto/ethsecp256k1" + "github.com/evmos/evmos/v11/encoding" + "github.com/evmos/evmos/v11/server/config" + "github.com/evmos/evmos/v11/tests" + "github.com/evmos/evmos/v11/testutil" + evmostypes "github.com/evmos/evmos/v11/types" + "github.com/evmos/evmos/v11/utils" + "github.com/evmos/evmos/v11/x/claims/types" + evm "github.com/evmos/evmos/v11/x/evm/types" + feemarkettypes "github.com/evmos/evmos/v11/x/feemarket/types" + incentivestypes "github.com/evmos/evmos/v11/x/incentives/types" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/crypto/tmhash" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmversion "github.com/tendermint/tendermint/proto/tendermint/version" + "github.com/tendermint/tendermint/version" +) + +func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { + // account key + priv, err := ethsecp256k1.GenerateKey() + require.NoError(t, err) + suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) + suite.signer = tests.NewSigner(priv) + + // consensus key + privCons, err := ethsecp256k1.GenerateKey() + require.NoError(t, err) + consAddress := sdk.ConsAddress(privCons.PubKey().Address()) + + suite.app = app.Setup(false, feemarkettypes.DefaultGenesisState()) + suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{ + Height: 1, + ChainID: "evmos_9001-1", + Time: time.Now().UTC(), + ProposerAddress: consAddress.Bytes(), + + Version: tmversion.Consensus{ + Block: version.BlockProtocol, + }, + LastBlockId: tmproto.BlockID{ + Hash: tmhash.Sum([]byte("block_id")), + PartSetHeader: tmproto.PartSetHeader{ + Total: 11, + Hash: tmhash.Sum([]byte("partset_header")), + }, + }, + AppHash: tmhash.Sum([]byte("app")), + DataHash: tmhash.Sum([]byte("data")), + EvidenceHash: tmhash.Sum([]byte("evidence")), + ValidatorsHash: tmhash.Sum([]byte("validators")), + NextValidatorsHash: tmhash.Sum([]byte("next_validators")), + ConsensusHash: tmhash.Sum([]byte("consensus")), + LastResultsHash: tmhash.Sum([]byte("last_result")), + }) + + queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, suite.app.ClaimsKeeper) + suite.queryClient = types.NewQueryClient(queryHelper) + + queryHelperEvm := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + evm.RegisterQueryServer(queryHelperEvm, suite.app.EvmKeeper) + suite.queryClientEvm = evm.NewQueryClient(queryHelperEvm) + + params := types.DefaultParams() + params.AirdropStartTime = suite.ctx.BlockTime().UTC() + err = suite.app.ClaimsKeeper.SetParams(suite.ctx, params) + require.NoError(t, err) + + stakingParams := suite.app.StakingKeeper.GetParams(suite.ctx) + stakingParams.BondDenom = params.GetClaimsDenom() + suite.app.StakingKeeper.SetParams(suite.ctx, stakingParams) + + // Set Validator + valAddr := sdk.ValAddress(suite.address.Bytes()) + validator, err := stakingtypes.NewValidator(valAddr, privCons.PubKey(), stakingtypes.Description{}) + require.NoError(t, err) + validator = stakingkeeper.TestingUpdateValidator(suite.app.StakingKeeper, suite.ctx, validator, true) + err = suite.app.StakingKeeper.AfterValidatorCreated(suite.ctx, validator.GetOperator()) + require.NoError(t, err) + err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) + require.NoError(t, err) + validators := s.app.StakingKeeper.GetValidators(s.ctx, 1) + suite.validator = validators[0] + + suite.ethSigner = ethtypes.LatestSignerForChainID(s.app.EvmKeeper.ChainID()) +} + +func (suite *KeeperTestSuite) SetupTestWithEscrow() { + suite.SetupTest() + params := suite.app.ClaimsKeeper.GetParams(suite.ctx) + + coins := sdk.NewCoins(sdk.NewCoin(params.ClaimsDenom, sdk.NewInt(10000000))) + err := testutil.FundModuleAccount(suite.ctx, suite.app.BankKeeper, types.ModuleName, coins) + suite.Require().NoError(err) +} + +// Commit commits and starts a new block with an updated context. +func (suite *KeeperTestSuite) Commit() { + suite.CommitAfter(time.Second * 0) +} + +// Commit commits a block at a given time. +func (suite *KeeperTestSuite) CommitAfter(t time.Duration) { + header := suite.ctx.BlockHeader() + suite.app.EndBlocker(suite.ctx, abci.RequestEndBlock{Height: header.Height}) + _ = suite.app.Commit() + + header.Height++ + header.Time = header.Time.Add(t) + suite.app.BeginBlock(abci.RequestBeginBlock{ + Header: header, + }) + + // update ctx + suite.ctx = suite.app.BaseApp.NewContext(false, header) + + queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, suite.app.ClaimsKeeper) + suite.queryClient = types.NewQueryClient(queryHelper) + + queryHelperEvm := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + evm.RegisterQueryServer(queryHelperEvm, suite.app.EvmKeeper) + suite.queryClientEvm = evm.NewQueryClient(queryHelperEvm) +} + +func newEthAccount(baseAccount *authtypes.BaseAccount) evmostypes.EthAccount { + return evmostypes.EthAccount{ + BaseAccount: baseAccount, + CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(), + } +} + +func getAddr(priv *ethsecp256k1.PrivKey) sdk.AccAddress { + return sdk.AccAddress(priv.PubKey().Address().Bytes()) +} + +func delegate(priv *ethsecp256k1.PrivKey, delegateAmount sdk.Coin) { + accountAddress := sdk.AccAddress(priv.PubKey().Address().Bytes()) + + val, err := sdk.ValAddressFromBech32(s.validator.OperatorAddress) + s.Require().NoError(err) + + delegateMsg := stakingtypes.NewMsgDelegate(accountAddress, val, delegateAmount) + deliverTx(priv, delegateMsg) +} + +func govProposal(priv *ethsecp256k1.PrivKey) uint64 { + stakeDenom := stakingtypes.DefaultParams().BondDenom + accountAddress := sdk.AccAddress(priv.PubKey().Address().Bytes()) + contractAddress := deployContract(priv) + content := incentivestypes.NewRegisterIncentiveProposal( + "test", + "description", + contractAddress.String(), + sdk.DecCoins{sdk.NewDecCoinFromDec(utils.BaseDenom, sdk.NewDecWithPrec(5, 2))}, + 1000, + ) + + deposit := sdk.NewCoins(sdk.NewCoin(stakeDenom, sdk.NewInt(100000000))) + msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, accountAddress) + s.Require().NoError(err) + + res := deliverTx(priv, msg) + submitEvent := res.GetEvents()[8] + Expect(submitEvent.Type).To(Equal("submit_proposal")) + Expect(string(submitEvent.Attributes[0].Key)).To(Equal("proposal_id")) + + proposalID, err := strconv.ParseUint(string(submitEvent.Attributes[0].Value), 10, 64) + s.Require().NoError(err) + + return proposalID +} + +func vote(priv *ethsecp256k1.PrivKey, proposalID uint64) { + accountAddress := sdk.AccAddress(priv.PubKey().Address().Bytes()) + + voteMsg := govv1beta1.NewMsgVote(accountAddress, proposalID, govv1beta1.OptionAbstain) + deliverTx(priv, voteMsg) +} + +func sendEthToSelf(priv *ethsecp256k1.PrivKey) { + chainID := s.app.EvmKeeper.ChainID() + from := common.BytesToAddress(priv.PubKey().Address().Bytes()) + nonce := s.app.EvmKeeper.GetNonce(s.ctx, from) + + msgEthereumTx := evm.NewTx(chainID, nonce, &from, nil, 100000, nil, s.app.FeeMarketKeeper.GetBaseFee(s.ctx), big.NewInt(1), nil, ðtypes.AccessList{}) + msgEthereumTx.From = from.String() + performEthTx(priv, msgEthereumTx) +} + +func deployContract(priv *ethsecp256k1.PrivKey) common.Address { + chainID := s.app.EvmKeeper.ChainID() + from := common.BytesToAddress(priv.PubKey().Address().Bytes()) + nonce := s.app.EvmKeeper.GetNonce(s.ctx, from) + + ctorArgs, err := contracts.ERC20MinterBurnerDecimalsContract.ABI.Pack("", "Test", "TTT", uint8(18)) + s.Require().NoError(err) + + data := append(contracts.ERC20MinterBurnerDecimalsContract.Bin, ctorArgs...) //nolint:gocritic + args, err := json.Marshal(&evm.TransactionArgs{ + From: &s.address, + Data: (*hexutil.Bytes)(&data), + }) + s.Require().NoError(err) + + ctx := sdk.WrapSDKContext(s.ctx) + res, err := s.queryClientEvm.EstimateGas(ctx, &evm.EthCallRequest{ + Args: args, + GasCap: config.DefaultGasCap, + }) + s.Require().NoError(err) + + msgEthereumTx := evm.NewTxContract(chainID, nonce, nil, res.Gas, nil, s.app.FeeMarketKeeper.GetBaseFee(s.ctx), big.NewInt(1), data, ðtypes.AccessList{}) + msgEthereumTx.From = from.String() + + performEthTx(priv, msgEthereumTx) + s.Commit() + + contractAddress := crypto.CreateAddress(from, nonce) + acc := s.app.EvmKeeper.GetAccountWithoutBalance(s.ctx, contractAddress) + s.Require().NotEmpty(acc) + s.Require().True(acc.IsContract()) + return contractAddress +} + +func performEthTx(priv *ethsecp256k1.PrivKey, msgEthereumTx *evm.MsgEthereumTx) { + // Sign transaction + err := msgEthereumTx.Sign(s.ethSigner, tests.NewSigner(priv)) + s.Require().NoError(err) + + // Assemble transaction from fields + encodingConfig := encoding.MakeConfig(app.ModuleBasics) + txBuilder := encodingConfig.TxConfig.NewTxBuilder() + tx, err := msgEthereumTx.BuildTx(txBuilder, utils.BaseDenom) + s.Require().NoError(err) + + // Encode transaction by default Tx encoder and broadcasted over the network + txEncoder := encodingConfig.TxConfig.TxEncoder() + bz, err := txEncoder(tx) + s.Require().NoError(err) + + req := abci.RequestDeliverTx{Tx: bz} + res := s.app.BaseApp.DeliverTx(req) + Expect(res.IsOK()).To(Equal(true)) +} + +func deliverTx(priv *ethsecp256k1.PrivKey, msgs ...sdk.Msg) abci.ResponseDeliverTx { + encodingConfig := encoding.MakeConfig(app.ModuleBasics) + accountAddress := sdk.AccAddress(priv.PubKey().Address().Bytes()) + + txBuilder := encodingConfig.TxConfig.NewTxBuilder() + + txBuilder.SetGasLimit(1000000) + txBuilder.SetFeeAmount(sdk.Coins{defaultTxFee}) + + err := txBuilder.SetMsgs(msgs...) + s.Require().NoError(err) + + seq, err := s.app.AccountKeeper.GetSequence(s.ctx, accountAddress) + s.Require().NoError(err) + + // First round: we gather all the signer infos. We use the "set empty + // signature" hack to do that. + sigV2 := signing.SignatureV2{ + PubKey: priv.PubKey(), + Data: &signing.SingleSignatureData{ + SignMode: encodingConfig.TxConfig.SignModeHandler().DefaultMode(), + Signature: nil, + }, + Sequence: seq, + } + + sigsV2 := []signing.SignatureV2{sigV2} + + err = txBuilder.SetSignatures(sigsV2...) + s.Require().NoError(err) + + // Second round: all signer infos are set, so each signer can sign. + accNumber := s.app.AccountKeeper.GetAccount(s.ctx, accountAddress).GetAccountNumber() + signerData := authsigning.SignerData{ + ChainID: s.ctx.ChainID(), + AccountNumber: accNumber, + Sequence: seq, + } + sigV2, err = tx.SignWithPrivKey( + encodingConfig.TxConfig.SignModeHandler().DefaultMode(), signerData, + txBuilder, priv, encodingConfig.TxConfig, + seq, + ) + s.Require().NoError(err) + + sigsV2 = []signing.SignatureV2{sigV2} + err = txBuilder.SetSignatures(sigsV2...) + s.Require().NoError(err) + + // bz are bytes to be broadcasted over the network + bz, err := encodingConfig.TxConfig.TxEncoder()(txBuilder.GetTx()) + s.Require().NoError(err) + + req := abci.RequestDeliverTx{Tx: bz} + res := s.app.BaseApp.DeliverTx(req) + Expect(res.IsOK()).To(Equal(true), res.Log) + return res +} + +func getEthTxFee() sdk.Coin { + baseFee := s.app.FeeMarketKeeper.GetBaseFee(s.ctx) + baseFee.Mul(baseFee, big.NewInt(100000)) + feeAmt := baseFee.Quo(baseFee, big.NewInt(2)) + return sdk.NewCoin(utils.BaseDenom, sdkmath.NewIntFromBigInt(feeAmt)) +} diff --git a/x/claims/migrations/v3/types/genesis.pb.go b/x/claims/migrations/v3/types/genesis.pb.go index b624163589..29c6c9e4f4 100644 --- a/x/claims/migrations/v3/types/genesis.pb.go +++ b/x/claims/migrations/v3/types/genesis.pb.go @@ -5,23 +5,26 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + time "time" + _ "github.com/cosmos/gogoproto/gogoproto" "github.com/evmos/evmos/v11/x/claims/types" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "google.golang.org/protobuf/types/known/durationpb" _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf + _ = time.Kitchen +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -43,9 +46,11 @@ func (*V3GenesisState) ProtoMessage() {} func (*V3GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_f2f8f1d6f18af278, []int{0} } + func (m *V3GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V3GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V3GenesisState.Marshal(b, m, deterministic) @@ -58,12 +63,15 @@ func (m *V3GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } + func (m *V3GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_V3GenesisState.Merge(m, src) } + func (m *V3GenesisState) XXX_Size() int { return m.Size() } + func (m *V3GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_V3GenesisState.DiscardUnknown(m) } @@ -109,9 +117,11 @@ func (*V3Params) ProtoMessage() {} func (*V3Params) Descriptor() ([]byte, []int) { return fileDescriptor_f2f8f1d6f18af278, []int{1} } + func (m *V3Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V3Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V3Params.Marshal(b, m, deterministic) @@ -124,12 +134,15 @@ func (m *V3Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *V3Params) XXX_Merge(src proto.Message) { xxx_messageInfo_V3Params.Merge(m, src) } + func (m *V3Params) XXX_Size() int { return m.Size() } + func (m *V3Params) XXX_DiscardUnknown() { xxx_messageInfo_V3Params.DiscardUnknown(m) } @@ -367,6 +380,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *V3GenesisState) Size() (n int) { if m == nil { return 0 @@ -421,9 +435,11 @@ func (m *V3Params) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *V3GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -541,6 +557,7 @@ func (m *V3GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func (m *V3Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -806,6 +823,7 @@ func (m *V3Params) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/claims/types/claims.pb.go b/x/claims/types/claims.pb.go index 5627dab479..c77ebe0372 100644 --- a/x/claims/types/claims.pb.go +++ b/x/claims/types/claims.pb.go @@ -5,18 +5,21 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -81,9 +84,11 @@ func (*Claim) ProtoMessage() {} func (*Claim) Descriptor() ([]byte, []int) { return fileDescriptor_a7153f2307523893, []int{0} } + func (m *Claim) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Claim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Claim.Marshal(b, m, deterministic) @@ -96,12 +101,15 @@ func (m *Claim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Claim) XXX_Merge(src proto.Message) { xxx_messageInfo_Claim.Merge(m, src) } + func (m *Claim) XXX_Size() int { return m.Size() } + func (m *Claim) XXX_DiscardUnknown() { xxx_messageInfo_Claim.DiscardUnknown(m) } @@ -139,9 +147,11 @@ func (*ClaimsRecordAddress) ProtoMessage() {} func (*ClaimsRecordAddress) Descriptor() ([]byte, []int) { return fileDescriptor_a7153f2307523893, []int{1} } + func (m *ClaimsRecordAddress) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ClaimsRecordAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ClaimsRecordAddress.Marshal(b, m, deterministic) @@ -154,12 +164,15 @@ func (m *ClaimsRecordAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *ClaimsRecordAddress) XXX_Merge(src proto.Message) { xxx_messageInfo_ClaimsRecordAddress.Merge(m, src) } + func (m *ClaimsRecordAddress) XXX_Size() int { return m.Size() } + func (m *ClaimsRecordAddress) XXX_DiscardUnknown() { xxx_messageInfo_ClaimsRecordAddress.DiscardUnknown(m) } @@ -195,9 +208,11 @@ func (*ClaimsRecord) ProtoMessage() {} func (*ClaimsRecord) Descriptor() ([]byte, []int) { return fileDescriptor_a7153f2307523893, []int{2} } + func (m *ClaimsRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ClaimsRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ClaimsRecord.Marshal(b, m, deterministic) @@ -210,12 +225,15 @@ func (m *ClaimsRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *ClaimsRecord) XXX_Merge(src proto.Message) { xxx_messageInfo_ClaimsRecord.Merge(m, src) } + func (m *ClaimsRecord) XXX_Size() int { return m.Size() } + func (m *ClaimsRecord) XXX_DiscardUnknown() { xxx_messageInfo_ClaimsRecord.DiscardUnknown(m) } @@ -432,6 +450,7 @@ func encodeVarintClaims(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *Claim) Size() (n int) { if m == nil { return 0 @@ -484,9 +503,11 @@ func (m *ClaimsRecord) Size() (n int) { func sovClaims(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozClaims(x uint64) (n int) { return sovClaims(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *Claim) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -610,6 +631,7 @@ func (m *Claim) Unmarshal(dAtA []byte) error { } return nil } + func (m *ClaimsRecordAddress) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -796,6 +818,7 @@ func (m *ClaimsRecordAddress) Unmarshal(dAtA []byte) error { } return nil } + func (m *ClaimsRecord) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -950,6 +973,7 @@ func (m *ClaimsRecord) Unmarshal(dAtA []byte) error { } return nil } + func skipClaims(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/claims/types/genesis.pb.go b/x/claims/types/genesis.pb.go index 406da8b8ae..b7056300d6 100644 --- a/x/claims/types/genesis.pb.go +++ b/x/claims/types/genesis.pb.go @@ -5,22 +5,25 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + time "time" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "google.golang.org/protobuf/types/known/durationpb" _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf + _ = time.Kitchen +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -42,9 +45,11 @@ func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_f2f8f1d6f18af278, []int{0} } + func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) @@ -57,12 +62,15 @@ func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState.Merge(m, src) } + func (m *GenesisState) XXX_Size() int { return m.Size() } + func (m *GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState.DiscardUnknown(m) } @@ -108,9 +116,11 @@ func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_f2f8f1d6f18af278, []int{1} } + func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Params.Marshal(b, m, deterministic) @@ -123,12 +133,15 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Params) XXX_Merge(src proto.Message) { xxx_messageInfo_Params.Merge(m, src) } + func (m *Params) XXX_Size() int { return m.Size() } + func (m *Params) XXX_DiscardUnknown() { xxx_messageInfo_Params.DiscardUnknown(m) } @@ -366,6 +379,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -420,9 +434,11 @@ func (m *Params) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -540,6 +556,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -805,6 +822,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/claims/types/query.pb.go b/x/claims/types/query.pb.go index 03d4fa7de9..ba7117c239 100644 --- a/x/claims/types/query.pb.go +++ b/x/claims/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" query "github.com/cosmos/cosmos-sdk/types/query" @@ -16,15 +20,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -34,8 +37,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryTotalUnclaimedRequest is the request type for the Query/TotalUnclaimed // RPC method. -type QueryTotalUnclaimedRequest struct { -} +type QueryTotalUnclaimedRequest struct{} func (m *QueryTotalUnclaimedRequest) Reset() { *m = QueryTotalUnclaimedRequest{} } func (m *QueryTotalUnclaimedRequest) String() string { return proto.CompactTextString(m) } @@ -43,9 +45,11 @@ func (*QueryTotalUnclaimedRequest) ProtoMessage() {} func (*QueryTotalUnclaimedRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f3bf523ec58a3aba, []int{0} } + func (m *QueryTotalUnclaimedRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryTotalUnclaimedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryTotalUnclaimedRequest.Marshal(b, m, deterministic) @@ -58,12 +62,15 @@ func (m *QueryTotalUnclaimedRequest) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } + func (m *QueryTotalUnclaimedRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryTotalUnclaimedRequest.Merge(m, src) } + func (m *QueryTotalUnclaimedRequest) XXX_Size() int { return m.Size() } + func (m *QueryTotalUnclaimedRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryTotalUnclaimedRequest.DiscardUnknown(m) } @@ -83,9 +90,11 @@ func (*QueryTotalUnclaimedResponse) ProtoMessage() {} func (*QueryTotalUnclaimedResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f3bf523ec58a3aba, []int{1} } + func (m *QueryTotalUnclaimedResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryTotalUnclaimedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryTotalUnclaimedResponse.Marshal(b, m, deterministic) @@ -98,12 +107,15 @@ func (m *QueryTotalUnclaimedResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryTotalUnclaimedResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryTotalUnclaimedResponse.Merge(m, src) } + func (m *QueryTotalUnclaimedResponse) XXX_Size() int { return m.Size() } + func (m *QueryTotalUnclaimedResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryTotalUnclaimedResponse.DiscardUnknown(m) } @@ -118,8 +130,7 @@ func (m *QueryTotalUnclaimedResponse) GetCoins() github_com_cosmos_cosmos_sdk_ty } // QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} +type QueryParamsRequest struct{} func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } @@ -127,9 +138,11 @@ func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f3bf523ec58a3aba, []int{2} } + func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) @@ -142,12 +155,15 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsRequest.Merge(m, src) } + func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } + func (m *QueryParamsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } @@ -166,9 +182,11 @@ func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f3bf523ec58a3aba, []int{3} } + func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) @@ -181,12 +199,15 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsResponse.Merge(m, src) } + func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } + func (m *QueryParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } @@ -213,9 +234,11 @@ func (*QueryClaimsRecordsRequest) ProtoMessage() {} func (*QueryClaimsRecordsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f3bf523ec58a3aba, []int{4} } + func (m *QueryClaimsRecordsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryClaimsRecordsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryClaimsRecordsRequest.Marshal(b, m, deterministic) @@ -228,12 +251,15 @@ func (m *QueryClaimsRecordsRequest) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } + func (m *QueryClaimsRecordsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryClaimsRecordsRequest.Merge(m, src) } + func (m *QueryClaimsRecordsRequest) XXX_Size() int { return m.Size() } + func (m *QueryClaimsRecordsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryClaimsRecordsRequest.DiscardUnknown(m) } @@ -262,9 +288,11 @@ func (*QueryClaimsRecordsResponse) ProtoMessage() {} func (*QueryClaimsRecordsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f3bf523ec58a3aba, []int{5} } + func (m *QueryClaimsRecordsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryClaimsRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryClaimsRecordsResponse.Marshal(b, m, deterministic) @@ -277,12 +305,15 @@ func (m *QueryClaimsRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } + func (m *QueryClaimsRecordsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryClaimsRecordsResponse.Merge(m, src) } + func (m *QueryClaimsRecordsResponse) XXX_Size() int { return m.Size() } + func (m *QueryClaimsRecordsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryClaimsRecordsResponse.DiscardUnknown(m) } @@ -316,9 +347,11 @@ func (*QueryClaimsRecordRequest) ProtoMessage() {} func (*QueryClaimsRecordRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f3bf523ec58a3aba, []int{6} } + func (m *QueryClaimsRecordRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryClaimsRecordRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryClaimsRecordRequest.Marshal(b, m, deterministic) @@ -331,12 +364,15 @@ func (m *QueryClaimsRecordRequest) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } + func (m *QueryClaimsRecordRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryClaimsRecordRequest.Merge(m, src) } + func (m *QueryClaimsRecordRequest) XXX_Size() int { return m.Size() } + func (m *QueryClaimsRecordRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryClaimsRecordRequest.DiscardUnknown(m) } @@ -365,9 +401,11 @@ func (*QueryClaimsRecordResponse) ProtoMessage() {} func (*QueryClaimsRecordResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f3bf523ec58a3aba, []int{7} } + func (m *QueryClaimsRecordResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryClaimsRecordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryClaimsRecordResponse.Marshal(b, m, deterministic) @@ -380,12 +418,15 @@ func (m *QueryClaimsRecordResponse) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } + func (m *QueryClaimsRecordResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryClaimsRecordResponse.Merge(m, src) } + func (m *QueryClaimsRecordResponse) XXX_Size() int { return m.Size() } + func (m *QueryClaimsRecordResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryClaimsRecordResponse.DiscardUnknown(m) } @@ -459,8 +500,10 @@ var fileDescriptor_f3bf523ec58a3aba = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -537,18 +580,20 @@ type QueryServer interface { } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +type UnimplementedQueryServer struct{} func (*UnimplementedQueryServer) TotalUnclaimed(ctx context.Context, req *QueryTotalUnclaimedRequest) (*QueryTotalUnclaimedResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TotalUnclaimed not implemented") } + func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } + func (*UnimplementedQueryServer) ClaimsRecords(ctx context.Context, req *QueryClaimsRecordsRequest) (*QueryClaimsRecordsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ClaimsRecords not implemented") } + func (*UnimplementedQueryServer) ClaimsRecord(ctx context.Context, req *QueryClaimsRecordRequest) (*QueryClaimsRecordResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ClaimsRecord not implemented") } @@ -942,6 +987,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *QueryTotalUnclaimedRequest) Size() (n int) { if m == nil { return 0 @@ -1051,9 +1097,11 @@ func (m *QueryClaimsRecordResponse) Size() (n int) { func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *QueryTotalUnclaimedRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1104,6 +1152,7 @@ func (m *QueryTotalUnclaimedRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryTotalUnclaimedResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1188,6 +1237,7 @@ func (m *QueryTotalUnclaimedResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1238,6 +1288,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1321,6 +1372,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryClaimsRecordsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1407,6 +1459,7 @@ func (m *QueryClaimsRecordsRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryClaimsRecordsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1527,6 +1580,7 @@ func (m *QueryClaimsRecordsResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryClaimsRecordRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1609,6 +1663,7 @@ func (m *QueryClaimsRecordRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryClaimsRecordResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1727,6 +1782,7 @@ func (m *QueryClaimsRecordResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/claims/types/query.pb.gw.go b/x/claims/types/query.pb.gw.go index 55626f49c0..3ad4ad9935 100644 --- a/x/claims/types/query.pb.gw.go +++ b/x/claims/types/query.pb.gw.go @@ -25,13 +25,15 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join +var ( + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join +) func request_Query_TotalUnclaimed_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryTotalUnclaimedRequest @@ -39,7 +41,6 @@ func request_Query_TotalUnclaimed_0(ctx context.Context, marshaler runtime.Marsh msg, err := client.TotalUnclaimed(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_TotalUnclaimed_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -48,7 +49,6 @@ func local_request_Query_TotalUnclaimed_0(ctx context.Context, marshaler runtime msg, err := server.TotalUnclaimed(ctx, &protoReq) return msg, metadata, err - } func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -57,7 +57,6 @@ func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,12 +65,9 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Params(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_ClaimsRecords_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Query_ClaimsRecords_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Query_ClaimsRecords_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryClaimsRecordsRequest @@ -86,7 +82,6 @@ func request_Query_ClaimsRecords_0(ctx context.Context, marshaler runtime.Marsha msg, err := client.ClaimsRecords(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_ClaimsRecords_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -102,7 +97,6 @@ func local_request_Query_ClaimsRecords_0(ctx context.Context, marshaler runtime. msg, err := server.ClaimsRecords(ctx, &protoReq) return msg, metadata, err - } func request_Query_ClaimsRecord_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -129,7 +123,6 @@ func request_Query_ClaimsRecord_0(ctx context.Context, marshaler runtime.Marshal msg, err := client.ClaimsRecord(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_ClaimsRecord_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -156,7 +149,6 @@ func local_request_Query_ClaimsRecord_0(ctx context.Context, marshaler runtime.M msg, err := server.ClaimsRecord(ctx, &protoReq) return msg, metadata, err - } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -164,7 +156,6 @@ func local_request_Query_ClaimsRecord_0(ctx context.Context, marshaler runtime.M // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_TotalUnclaimed_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -185,7 +176,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_TotalUnclaimed_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -208,7 +198,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ClaimsRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -231,7 +220,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ClaimsRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ClaimsRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -254,7 +242,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ClaimsRecord_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -297,7 +284,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_TotalUnclaimed_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -315,7 +301,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_TotalUnclaimed_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -335,7 +320,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ClaimsRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -355,7 +339,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ClaimsRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ClaimsRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -375,7 +358,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ClaimsRecord_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil diff --git a/x/claims/types/tx.pb.go b/x/claims/types/tx.pb.go index 1c442eb2be..847c373e43 100644 --- a/x/claims/types/tx.pb.go +++ b/x/claims/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" @@ -14,15 +18,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -45,9 +48,11 @@ func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_da3f957232eaa283, []int{0} } + func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) @@ -60,12 +65,15 @@ func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } + func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParams.Merge(m, src) } + func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParams) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } @@ -88,8 +96,7 @@ func (m *MsgUpdateParams) GetParams() Params { // MsgUpdateParamsResponse defines the response structure for executing a // MsgUpdateParams message. -type MsgUpdateParamsResponse struct { -} +type MsgUpdateParamsResponse struct{} func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } @@ -97,9 +104,11 @@ func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_da3f957232eaa283, []int{1} } + func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) @@ -112,12 +121,15 @@ func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } + func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } @@ -156,8 +168,10 @@ var fileDescriptor_da3f957232eaa283 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -197,8 +211,7 @@ type MsgServer interface { } // UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} +type UnimplementedMsgServer struct{} func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") @@ -313,6 +326,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *MsgUpdateParams) Size() (n int) { if m == nil { return 0 @@ -340,9 +354,11 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -458,6 +474,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -508,6 +525,7 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/claims/types/tx.pb.gw.go b/x/claims/types/tx.pb.gw.go index 702841d7bf..a5367c383c 100644 --- a/x/claims/types/tx.pb.gw.go +++ b/x/claims/types/tx.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - var ( - filter_Msg_UpdateParams_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join ) +var filter_Msg_UpdateParams_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + func request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateParams var metadata runtime.ServerMetadata @@ -50,7 +50,6 @@ func request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler msg, err := client.UpdateParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,7 +65,6 @@ func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Mar msg, err := server.UpdateParams(ctx, &protoReq) return msg, metadata, err - } // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". @@ -74,7 +72,6 @@ func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Mar // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { - mux.Handle("POST", pattern_Msg_UpdateParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -95,7 +92,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_UpdateParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -138,7 +134,6 @@ func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.C // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "MsgClient" to call the correct interceptors. func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { - mux.Handle("POST", pattern_Msg_UpdateParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -156,16 +151,11 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_UpdateParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil } -var ( - pattern_Msg_UpdateParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"evmos", "claims", "v1", "tx", "update_params"}, "", runtime.AssumeColonVerbOpt(false))) -) +var pattern_Msg_UpdateParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"evmos", "claims", "v1", "tx", "update_params"}, "", runtime.AssumeColonVerbOpt(false))) -var ( - forward_Msg_UpdateParams_0 = runtime.ForwardResponseMessage -) +var forward_Msg_UpdateParams_0 = runtime.ForwardResponseMessage diff --git a/x/epochs/keeper/setup_test.go b/x/epochs/keeper/setup_test.go new file mode 100644 index 0000000000..2bd8713eca --- /dev/null +++ b/x/epochs/keeper/setup_test.go @@ -0,0 +1,41 @@ +package keeper_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + + evm "github.com/evmos/evmos/v11/x/evm/types" + + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/x/epochs/types" +) + +type KeeperTestSuite struct { + suite.Suite + + ctx sdk.Context + app *app.Evmos + queryClientEvm evm.QueryClient + queryClient types.QueryClient + consAddress sdk.ConsAddress +} + +var s *KeeperTestSuite + +func TestKeeperTestSuite(t *testing.T) { + s = new(KeeperTestSuite) + suite.Run(t, s) + + // Run Ginkgo integration tests + RegisterFailHandler(Fail) + RunSpecs(t, "Keeper Suite") +} + +func (suite *KeeperTestSuite) SetupTest() { + suite.DoSetupTest(suite.T()) +} diff --git a/x/epochs/keeper/keeper_test.go b/x/epochs/keeper/utils_test.go similarity index 81% rename from x/epochs/keeper/keeper_test.go rename to x/epochs/keeper/utils_test.go index c20899e20e..5db2184dc9 100644 --- a/x/epochs/keeper/keeper_test.go +++ b/x/epochs/keeper/utils_test.go @@ -1,53 +1,20 @@ package keeper_test import ( - "testing" "time" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/x/epochs/types" + evm "github.com/evmos/evmos/v11/x/evm/types" "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/tmhash" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmversion "github.com/tendermint/tendermint/proto/tendermint/version" "github.com/tendermint/tendermint/version" - - evm "github.com/evmos/evmos/v11/x/evm/types" - - "github.com/evmos/evmos/v11/app" - "github.com/evmos/evmos/v11/x/epochs/types" ) -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.Evmos - queryClientEvm evm.QueryClient - queryClient types.QueryClient - consAddress sdk.ConsAddress -} - -var s *KeeperTestSuite - -func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) - suite.Run(t, s) - - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") -} - -func (suite *KeeperTestSuite) SetupTest() { - suite.DoSetupTest(suite.T()) -} - // Test helpers func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { checkTx := false diff --git a/x/epochs/types/genesis.pb.go b/x/epochs/types/genesis.pb.go index f8a4c45372..1290afdab6 100644 --- a/x/epochs/types/genesis.pb.go +++ b/x/epochs/types/genesis.pb.go @@ -5,22 +5,25 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + time "time" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "google.golang.org/protobuf/types/known/durationpb" _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf + _ = time.Kitchen +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -53,9 +56,11 @@ func (*EpochInfo) ProtoMessage() {} func (*EpochInfo) Descriptor() ([]byte, []int) { return fileDescriptor_c74bc0b3e7fa01c2, []int{0} } + func (m *EpochInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EpochInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EpochInfo.Marshal(b, m, deterministic) @@ -68,12 +73,15 @@ func (m *EpochInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *EpochInfo) XXX_Merge(src proto.Message) { xxx_messageInfo_EpochInfo.Merge(m, src) } + func (m *EpochInfo) XXX_Size() int { return m.Size() } + func (m *EpochInfo) XXX_DiscardUnknown() { xxx_messageInfo_EpochInfo.DiscardUnknown(m) } @@ -141,9 +149,11 @@ func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_c74bc0b3e7fa01c2, []int{1} } + func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) @@ -156,12 +166,15 @@ func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState.Merge(m, src) } + func (m *GenesisState) XXX_Size() int { return m.Size() } + func (m *GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState.DiscardUnknown(m) } @@ -337,6 +350,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *EpochInfo) Size() (n int) { if m == nil { return 0 @@ -383,9 +397,11 @@ func (m *GenesisState) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *EpochInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -625,6 +641,7 @@ func (m *EpochInfo) Unmarshal(dAtA []byte) error { } return nil } + func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -709,6 +726,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/epochs/types/query.pb.go b/x/epochs/types/query.pb.go index 874b912f72..a764ad4a14 100644 --- a/x/epochs/types/query.pb.go +++ b/x/epochs/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" @@ -14,15 +18,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -43,9 +46,11 @@ func (*QueryEpochsInfoRequest) ProtoMessage() {} func (*QueryEpochsInfoRequest) Descriptor() ([]byte, []int) { return fileDescriptor_d13f5778acd937ff, []int{0} } + func (m *QueryEpochsInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryEpochsInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryEpochsInfoRequest.Marshal(b, m, deterministic) @@ -58,12 +63,15 @@ func (m *QueryEpochsInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *QueryEpochsInfoRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryEpochsInfoRequest.Merge(m, src) } + func (m *QueryEpochsInfoRequest) XXX_Size() int { return m.Size() } + func (m *QueryEpochsInfoRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryEpochsInfoRequest.DiscardUnknown(m) } @@ -92,9 +100,11 @@ func (*QueryEpochsInfoResponse) ProtoMessage() {} func (*QueryEpochsInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor_d13f5778acd937ff, []int{1} } + func (m *QueryEpochsInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryEpochsInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryEpochsInfoResponse.Marshal(b, m, deterministic) @@ -107,12 +117,15 @@ func (m *QueryEpochsInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *QueryEpochsInfoResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryEpochsInfoResponse.Merge(m, src) } + func (m *QueryEpochsInfoResponse) XXX_Size() int { return m.Size() } + func (m *QueryEpochsInfoResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryEpochsInfoResponse.DiscardUnknown(m) } @@ -146,9 +159,11 @@ func (*QueryCurrentEpochRequest) ProtoMessage() {} func (*QueryCurrentEpochRequest) Descriptor() ([]byte, []int) { return fileDescriptor_d13f5778acd937ff, []int{2} } + func (m *QueryCurrentEpochRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCurrentEpochRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCurrentEpochRequest.Marshal(b, m, deterministic) @@ -161,12 +176,15 @@ func (m *QueryCurrentEpochRequest) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } + func (m *QueryCurrentEpochRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCurrentEpochRequest.Merge(m, src) } + func (m *QueryCurrentEpochRequest) XXX_Size() int { return m.Size() } + func (m *QueryCurrentEpochRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryCurrentEpochRequest.DiscardUnknown(m) } @@ -193,9 +211,11 @@ func (*QueryCurrentEpochResponse) ProtoMessage() {} func (*QueryCurrentEpochResponse) Descriptor() ([]byte, []int) { return fileDescriptor_d13f5778acd937ff, []int{3} } + func (m *QueryCurrentEpochResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCurrentEpochResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCurrentEpochResponse.Marshal(b, m, deterministic) @@ -208,12 +228,15 @@ func (m *QueryCurrentEpochResponse) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } + func (m *QueryCurrentEpochResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCurrentEpochResponse.Merge(m, src) } + func (m *QueryCurrentEpochResponse) XXX_Size() int { return m.Size() } + func (m *QueryCurrentEpochResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryCurrentEpochResponse.DiscardUnknown(m) } @@ -270,8 +293,10 @@ var fileDescriptor_d13f5778acd937ff = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -322,12 +347,12 @@ type QueryServer interface { } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +type UnimplementedQueryServer struct{} func (*UnimplementedQueryServer) EpochInfos(ctx context.Context, req *QueryEpochsInfoRequest) (*QueryEpochsInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EpochInfos not implemented") } + func (*UnimplementedQueryServer) CurrentEpoch(ctx context.Context, req *QueryCurrentEpochRequest) (*QueryCurrentEpochResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CurrentEpoch not implemented") } @@ -542,6 +567,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *QueryEpochsInfoRequest) Size() (n int) { if m == nil { return 0 @@ -602,9 +628,11 @@ func (m *QueryCurrentEpochResponse) Size() (n int) { func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *QueryEpochsInfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -691,6 +719,7 @@ func (m *QueryEpochsInfoRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryEpochsInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -811,6 +840,7 @@ func (m *QueryEpochsInfoResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCurrentEpochRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -893,6 +923,7 @@ func (m *QueryCurrentEpochRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCurrentEpochResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -962,6 +993,7 @@ func (m *QueryCurrentEpochResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/epochs/types/query.pb.gw.go b/x/epochs/types/query.pb.gw.go index 3bcc3289fb..f99bae35b3 100644 --- a/x/epochs/types/query.pb.gw.go +++ b/x/epochs/types/query.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - var ( - filter_Query_EpochInfos_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join ) +var filter_Query_EpochInfos_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + func request_Query_EpochInfos_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryEpochsInfoRequest var metadata runtime.ServerMetadata @@ -50,7 +50,6 @@ func request_Query_EpochInfos_0(ctx context.Context, marshaler runtime.Marshaler msg, err := client.EpochInfos(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_EpochInfos_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,12 +65,9 @@ func local_request_Query_EpochInfos_0(ctx context.Context, marshaler runtime.Mar msg, err := server.EpochInfos(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_CurrentEpoch_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Query_CurrentEpoch_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Query_CurrentEpoch_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryCurrentEpochRequest @@ -86,7 +82,6 @@ func request_Query_CurrentEpoch_0(ctx context.Context, marshaler runtime.Marshal msg, err := client.CurrentEpoch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_CurrentEpoch_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -102,7 +97,6 @@ func local_request_Query_CurrentEpoch_0(ctx context.Context, marshaler runtime.M msg, err := server.CurrentEpoch(ctx, &protoReq) return msg, metadata, err - } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -110,7 +104,6 @@ func local_request_Query_CurrentEpoch_0(ctx context.Context, marshaler runtime.M // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_EpochInfos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -131,7 +124,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_EpochInfos_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_CurrentEpoch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -154,7 +146,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_CurrentEpoch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -197,7 +188,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_EpochInfos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -215,7 +205,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_EpochInfos_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_CurrentEpoch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -235,7 +224,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_CurrentEpoch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil diff --git a/x/erc20/keeper/erc20_utils_test.go b/x/erc20/keeper/erc20_utils_test.go new file mode 100644 index 0000000000..f0b12f0e28 --- /dev/null +++ b/x/erc20/keeper/erc20_utils_test.go @@ -0,0 +1,75 @@ +package keeper_test + +import ( + "fmt" + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + "github.com/evmos/evmos/v11/contracts" + "github.com/evmos/evmos/v11/x/erc20/types" + evm "github.com/evmos/evmos/v11/x/evm/types" +) + +func (suite *KeeperTestSuite) MintERC20Token(contractAddr, from, to common.Address, amount *big.Int) *evm.MsgEthereumTx { + transferData, err := contracts.ERC20MinterBurnerDecimalsContract.ABI.Pack("mint", to, amount) + suite.Require().NoError(err) + return suite.sendTx(contractAddr, from, transferData) +} + +func (suite *KeeperTestSuite) TransferERC20TokenToModule(contractAddr, from common.Address, amount *big.Int) *evm.MsgEthereumTx { + transferData, err := contracts.ERC20MinterBurnerDecimalsContract.ABI.Pack("transfer", types.ModuleAddress, amount) + suite.Require().NoError(err) + return suite.sendTx(contractAddr, from, transferData) +} + +func (suite *KeeperTestSuite) GrantERC20Token(contractAddr, from, to common.Address, roleString string) *evm.MsgEthereumTx { + // 0xCc508cD0818C85b8b8a1aB4cEEef8d981c8956A6 MINTER_ROLE + role := crypto.Keccak256([]byte(roleString)) + // needs to be an array not a slice + var v [32]byte + copy(v[:], role) + + transferData, err := contracts.ERC20MinterBurnerDecimalsContract.ABI.Pack("grantRole", v, to) + suite.Require().NoError(err) + return suite.sendTx(contractAddr, from, transferData) +} + +func (suite *KeeperTestSuite) BalanceOf(contract, account common.Address) interface{} { + erc20 := contracts.ERC20MinterBurnerDecimalsContract.ABI + + res, err := suite.app.Erc20Keeper.CallEVM(suite.ctx, erc20, types.ModuleAddress, contract, false, "balanceOf", account) + if err != nil { + return nil + } + + unpacked, err := erc20.Unpack("balanceOf", res.Ret) + if err != nil { + return nil + } + if len(unpacked) == 0 { + return nil + } + + return unpacked[0] +} + +func (suite *KeeperTestSuite) NameOf(contract common.Address) string { + erc20 := contracts.ERC20MinterBurnerDecimalsContract.ABI + + res, err := suite.app.Erc20Keeper.CallEVM(suite.ctx, erc20, types.ModuleAddress, contract, false, "name") + suite.Require().NoError(err) + suite.Require().NotNil(res) + + unpacked, err := erc20.Unpack("name", res.Ret) + suite.Require().NoError(err) + suite.Require().NotEmpty(unpacked) + + return fmt.Sprintf("%v", unpacked[0]) +} + +func (suite *KeeperTestSuite) TransferERC20Token(contractAddr, from, to common.Address, amount *big.Int) *evm.MsgEthereumTx { + transferData, err := contracts.ERC20MinterBurnerDecimalsContract.ABI.Pack("transfer", to, amount) + suite.Require().NoError(err) + return suite.sendTx(contractAddr, from, transferData) +} diff --git a/x/erc20/keeper/mock_test.go b/x/erc20/keeper/mock_test.go new file mode 100644 index 0000000000..301c2f03ab --- /dev/null +++ b/x/erc20/keeper/mock_test.go @@ -0,0 +1,105 @@ +package keeper_test + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/evmos/evmos/v11/x/erc20/types" + "github.com/evmos/evmos/v11/x/evm/statedb" + evm "github.com/evmos/evmos/v11/x/evm/types" + "github.com/stretchr/testify/mock" +) + +var _ types.EVMKeeper = &MockEVMKeeper{} + +type MockEVMKeeper struct { + mock.Mock +} + +func (m *MockEVMKeeper) GetParams(ctx sdk.Context) evm.Params { + args := m.Called(mock.Anything) + return args.Get(0).(evm.Params) +} + +func (m *MockEVMKeeper) GetAccountWithoutBalance(ctx sdk.Context, addr common.Address) *statedb.Account { + args := m.Called(mock.Anything, mock.Anything) + if args.Get(0) == nil { + return nil + } + return args.Get(0).(*statedb.Account) +} + +func (m *MockEVMKeeper) EstimateGas(c context.Context, req *evm.EthCallRequest) (*evm.EstimateGasResponse, error) { + args := m.Called(mock.Anything, mock.Anything) + if args.Get(0) == nil { + return nil, args.Error(1) + } + return args.Get(0).(*evm.EstimateGasResponse), args.Error(1) +} + +func (m *MockEVMKeeper) ApplyMessage(ctx sdk.Context, msg core.Message, tracer vm.EVMLogger, commit bool) (*evm.MsgEthereumTxResponse, error) { + args := m.Called(mock.Anything, mock.Anything, mock.Anything, mock.Anything) + + if args.Get(0) == nil { + return nil, args.Error(1) + } + return args.Get(0).(*evm.MsgEthereumTxResponse), args.Error(1) +} + +var _ types.BankKeeper = &MockBankKeeper{} + +type MockBankKeeper struct { + mock.Mock +} + +func (b *MockBankKeeper) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error { + args := b.Called(mock.Anything, mock.Anything, mock.Anything, mock.Anything) + return args.Error(0) +} + +func (b *MockBankKeeper) SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error { + args := b.Called(mock.Anything, mock.Anything, mock.Anything, mock.Anything) + return args.Error(0) +} + +func (b *MockBankKeeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { + args := b.Called(mock.Anything, mock.Anything, mock.Anything) + return args.Error(0) +} + +func (b *MockBankKeeper) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { + args := b.Called(mock.Anything, mock.Anything, mock.Anything) + return args.Error(0) +} + +func (b *MockBankKeeper) IsSendEnabledCoin(ctx sdk.Context, coin sdk.Coin) bool { + args := b.Called(mock.Anything, mock.Anything) + return args.Bool(0) +} + +func (b *MockBankKeeper) BlockedAddr(addr sdk.AccAddress) bool { + args := b.Called(mock.Anything) + return args.Bool(0) +} + +func (b *MockBankKeeper) GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) { + args := b.Called(mock.Anything, mock.Anything) + return args.Get(0).(banktypes.Metadata), args.Bool(1) +} + +func (b *MockBankKeeper) SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) { +} + +func (b *MockBankKeeper) HasSupply(ctx sdk.Context, denom string) bool { + args := b.Called(mock.Anything, mock.Anything) + return args.Bool(0) +} + +func (b *MockBankKeeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin { + args := b.Called(mock.Anything, mock.Anything) + return args.Get(0).(sdk.Coin) +} diff --git a/x/erc20/keeper/setup_test.go b/x/erc20/keeper/setup_test.go new file mode 100644 index 0000000000..9eaf339a76 --- /dev/null +++ b/x/erc20/keeper/setup_test.go @@ -0,0 +1,74 @@ +package keeper_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + ibcgotesting "github.com/cosmos/ibc-go/v6/testing" + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/evmos/evmos/v11/app" + ibctesting "github.com/evmos/evmos/v11/ibc/testing" + "github.com/evmos/evmos/v11/x/erc20/types" + evm "github.com/evmos/evmos/v11/x/evm/types" + "github.com/stretchr/testify/suite" +) + +type KeeperTestSuite struct { + suite.Suite + + ctx sdk.Context + app *app.Evmos + queryClientEvm evm.QueryClient + queryClient types.QueryClient + address common.Address + consAddress sdk.ConsAddress + clientCtx client.Context //nolint:unused + ethSigner ethtypes.Signer + validator stakingtypes.Validator + signer keyring.Signer + mintFeeCollector bool + + coordinator *ibcgotesting.Coordinator + + // testing chains used for convenience and readability + EvmosChain *ibcgotesting.TestChain + IBCOsmosisChain *ibcgotesting.TestChain + IBCCosmosChain *ibcgotesting.TestChain + + pathOsmosisEvmos *ibctesting.Path + pathCosmosEvmos *ibctesting.Path + pathOsmosisCosmos *ibctesting.Path + + suiteIBCTesting bool +} + +var ( + s *KeeperTestSuite + // sendAndReceiveMsgFee corresponds to the fees paid on Evmos chain when calling the SendAndReceive function + // This function makes 3 cosmos txs under the hood + sendAndReceiveMsgFee = sdk.NewInt(ibctesting.DefaultFeeAmt * 3) + // sendBackCoinsFee corresponds to the fees paid on Evmos chain when calling the SendBackCoins function + // or calling the SendAndReceive from another chain to Evmos + // This function makes 2 cosmos txs under the hood + sendBackCoinsFee = sdk.NewInt(ibctesting.DefaultFeeAmt * 2) +) + +func TestKeeperTestSuite(t *testing.T) { + s = new(KeeperTestSuite) + suite.Run(t, s) + + // Run Ginkgo integration tests + RegisterFailHandler(Fail) + RunSpecs(t, "Keeper Suite") +} + +func (suite *KeeperTestSuite) SetupTest() { + suite.DoSetupTest(suite.T()) +} diff --git a/x/erc20/keeper/keeper_test.go b/x/erc20/keeper/utils_test.go similarity index 75% rename from x/erc20/keeper/keeper_test.go rename to x/erc20/keeper/utils_test.go index b365858bf1..a74ed8b1a9 100644 --- a/x/erc20/keeper/keeper_test.go +++ b/x/erc20/keeper/utils_test.go @@ -1,115 +1,65 @@ package keeper_test import ( - "context" "encoding/json" - "fmt" "math/big" "strconv" - "testing" "time" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/crypto/keyring" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" + ibcgotesting "github.com/cosmos/ibc-go/v6/testing" + ibcgotestinghelpers "github.com/cosmos/ibc-go/v6/testing/simapp/helpers" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/crypto" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/tmhash" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmversion "github.com/tendermint/tendermint/proto/tendermint/version" - "github.com/tendermint/tendermint/version" - - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/crypto" + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/contracts" "github.com/evmos/evmos/v11/crypto/ethsecp256k1" + ibctesting "github.com/evmos/evmos/v11/ibc/testing" "github.com/evmos/evmos/v11/server/config" "github.com/evmos/evmos/v11/tests" + teststypes "github.com/evmos/evmos/v11/types/tests" + "github.com/evmos/evmos/v11/utils" + claimstypes "github.com/evmos/evmos/v11/x/claims/types" + "github.com/evmos/evmos/v11/x/erc20/types" "github.com/evmos/evmos/v11/x/evm/statedb" evm "github.com/evmos/evmos/v11/x/evm/types" feemarkettypes "github.com/evmos/evmos/v11/x/feemarket/types" - - "github.com/evmos/evmos/v11/app" - "github.com/evmos/evmos/v11/contracts" - ibctesting "github.com/evmos/evmos/v11/ibc/testing" - claimstypes "github.com/evmos/evmos/v11/x/claims/types" - "github.com/evmos/evmos/v11/x/erc20/types" inflationtypes "github.com/evmos/evmos/v11/x/inflation/types" - - transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" - ibcgotesting "github.com/cosmos/ibc-go/v6/testing" - ibcgotestinghelpers "github.com/cosmos/ibc-go/v6/testing/simapp/helpers" - teststypes "github.com/evmos/evmos/v11/types/tests" - "github.com/evmos/evmos/v11/utils" -) - -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.Evmos - queryClientEvm evm.QueryClient - queryClient types.QueryClient - address common.Address - consAddress sdk.ConsAddress - clientCtx client.Context //nolint:unused - ethSigner ethtypes.Signer - validator stakingtypes.Validator - signer keyring.Signer - mintFeeCollector bool - - coordinator *ibcgotesting.Coordinator - - // testing chains used for convenience and readability - EvmosChain *ibcgotesting.TestChain - IBCOsmosisChain *ibcgotesting.TestChain - IBCCosmosChain *ibcgotesting.TestChain - - pathOsmosisEvmos *ibctesting.Path - pathCosmosEvmos *ibctesting.Path - pathOsmosisCosmos *ibctesting.Path - - suiteIBCTesting bool -} - -var ( - s *KeeperTestSuite - // sendAndReceiveMsgFee corresponds to the fees paid on Evmos chain when calling the SendAndReceive function - // This function makes 3 cosmos txs under the hood - sendAndReceiveMsgFee = sdk.NewInt(ibctesting.DefaultFeeAmt * 3) - // sendBackCoinsFee corresponds to the fees paid on Evmos chain when calling the SendBackCoins function - // or calling the SendAndReceive from another chain to Evmos - // This function makes 2 cosmos txs under the hood - sendBackCoinsFee = sdk.NewInt(ibctesting.DefaultFeeAmt * 2) + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/crypto/tmhash" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmversion "github.com/tendermint/tendermint/proto/tendermint/version" + "github.com/tendermint/tendermint/version" ) -func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) - suite.Run(t, s) - - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") -} - -func (suite *KeeperTestSuite) SetupTest() { - suite.DoSetupTest(suite.T()) +func CreatePacket(amount, denom, sender, receiver, srcPort, srcChannel, dstPort, dstChannel string, seq, timeout uint64) channeltypes.Packet { + transfer := transfertypes.FungibleTokenPacketData{ + Amount: amount, + Denom: denom, + Receiver: sender, + Sender: receiver, + } + return channeltypes.NewPacket( + transfer.GetBytes(), + seq, + srcPort, + srcChannel, + dstPort, + dstChannel, + clienttypes.ZeroHeight(), // timeout height disabled + timeout, + ) } func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { @@ -197,66 +147,6 @@ func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { } } -var timeoutHeight = clienttypes.NewHeight(1000, 1000) - -func (suite *KeeperTestSuite) sendAndReceiveMessage( - path *ibctesting.Path, - originEndpoint *ibctesting.Endpoint, - destEndpoint *ibctesting.Endpoint, - originChain *ibcgotesting.TestChain, - coin string, - amount int64, - sender, receiver string, - seq uint64, - ibcCoinMetadata string, -) { - transferMsg := transfertypes.NewMsgTransfer(originEndpoint.ChannelConfig.PortID, originEndpoint.ChannelID, sdk.NewCoin(coin, sdk.NewInt(amount)), sender, receiver, timeoutHeight, 0, "") - _, err := ibctesting.SendMsgs(originChain, ibctesting.DefaultFeeAmt, transferMsg) - suite.Require().NoError(err) // message committed - // Recreate the packet that was sent - var transfer transfertypes.FungibleTokenPacketData - if ibcCoinMetadata == "" { - transfer = transfertypes.NewFungibleTokenPacketData(coin, strconv.Itoa(int(amount)), sender, receiver, "") - } else { - transfer = transfertypes.NewFungibleTokenPacketData(ibcCoinMetadata, strconv.Itoa(int(amount)), sender, receiver, "") - } - packet := channeltypes.NewPacket(transfer.GetBytes(), seq, originEndpoint.ChannelConfig.PortID, originEndpoint.ChannelID, destEndpoint.ChannelConfig.PortID, destEndpoint.ChannelID, timeoutHeight, 0) - // Receive message on the counterparty side, and send ack - err = path.RelayPacket(packet) - suite.Require().NoError(err) -} - -func (suite *KeeperTestSuite) SendAndReceiveMessage(path *ibctesting.Path, origin *ibcgotesting.TestChain, coin string, amount int64, sender, receiver string, seq uint64, ibcCoinMetadata string) { - // Send coin from A to B - suite.sendAndReceiveMessage(path, path.EndpointA, path.EndpointB, origin, coin, amount, sender, receiver, seq, ibcCoinMetadata) -} - -// Send back coins (from path endpoint B to A). In case of IBC coins need to provide ibcCoinMetadata (//, e.g.: "transfer/channel-0/aevmos") as input parameter. -// We need this to instantiate properly a FungibleTokenPacketData https://github.com/cosmos/ibc-go/blob/main/docs/architecture/adr-001-coin-source-tracing.md -func (suite *KeeperTestSuite) SendBackCoins(path *ibctesting.Path, origin *ibcgotesting.TestChain, coin string, amount int64, sender, receiver string, seq uint64, ibcCoinMetadata string) { - // Send coin from B to A - suite.sendAndReceiveMessage(path, path.EndpointB, path.EndpointA, origin, coin, amount, sender, receiver, seq, ibcCoinMetadata) -} - -func CreatePacket(amount, denom, sender, receiver, srcPort, srcChannel, dstPort, dstChannel string, seq, timeout uint64) channeltypes.Packet { - transfer := transfertypes.FungibleTokenPacketData{ - Amount: amount, - Denom: denom, - Receiver: sender, - Sender: receiver, - } - return channeltypes.NewPacket( - transfer.GetBytes(), - seq, - srcPort, - srcChannel, - dstPort, - dstChannel, - clienttypes.ZeroHeight(), // timeout height disabled - timeout, - ) -} - func (suite *KeeperTestSuite) SetupIBCTest() { // initializes 3 test chains suite.coordinator = ibctesting.NewCoordinator(suite.T(), 1, 2) @@ -365,6 +255,8 @@ func (suite *KeeperTestSuite) SetupIBCTest() { suite.Require().NoError(err) } +var timeoutHeight = clienttypes.NewHeight(1000, 1000) + func (suite *KeeperTestSuite) StateDB() *statedb.StateDB { return statedb.New(suite.ctx, suite.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(suite.ctx.HeaderHash().Bytes()))) } @@ -376,6 +268,75 @@ func (suite *KeeperTestSuite) MintFeeCollector(coins sdk.Coins) { suite.Require().NoError(err) } +func (suite *KeeperTestSuite) sendTx(contractAddr, from common.Address, transferData []byte) *evm.MsgEthereumTx { + ctx := sdk.WrapSDKContext(suite.ctx) + chainID := suite.app.EvmKeeper.ChainID() + + args, err := json.Marshal(&evm.TransactionArgs{To: &contractAddr, From: &from, Data: (*hexutil.Bytes)(&transferData)}) + suite.Require().NoError(err) + res, err := suite.queryClientEvm.EstimateGas(ctx, &evm.EthCallRequest{ + Args: args, + GasCap: config.DefaultGasCap, + }) + suite.Require().NoError(err) + + nonce := suite.app.EvmKeeper.GetNonce(suite.ctx, suite.address) + + // Mint the max gas to the FeeCollector to ensure balance in case of refund + evmParams := suite.app.EvmKeeper.GetParams(suite.ctx) + suite.MintFeeCollector(sdk.NewCoins(sdk.NewCoin(evmParams.EvmDenom, sdk.NewInt(suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx).Int64()*int64(res.Gas))))) + + ercTransferTx := evm.NewTx( + chainID, + nonce, + &contractAddr, + nil, + res.Gas, + nil, + suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx), + big.NewInt(1), + transferData, + ðtypes.AccessList{}, // accesses + ) + + ercTransferTx.From = suite.address.Hex() + err = ercTransferTx.Sign(ethtypes.LatestSignerForChainID(chainID), suite.signer) + suite.Require().NoError(err) + rsp, err := suite.app.EvmKeeper.EthereumTx(ctx, ercTransferTx) + suite.Require().NoError(err) + suite.Require().Empty(rsp.VmError) + return ercTransferTx +} + +// Commit commits and starts a new block with an updated context. +func (suite *KeeperTestSuite) Commit() { + suite.CommitAndBeginBlockAfter(time.Hour * 1) +} + +// Commit commits a block at a given time. Reminder: At the end of each +// Tendermint Consensus round the following methods are run +// 1. BeginBlock +// 2. DeliverTx +// 3. EndBlock +// 4. Commit +func (suite *KeeperTestSuite) CommitAndBeginBlockAfter(t time.Duration) { + header := suite.ctx.BlockHeader() + _ = suite.app.Commit() + + header.Height++ + header.Time = header.Time.Add(t) + suite.app.BeginBlock(abci.RequestBeginBlock{ + Header: header, + }) + + // update ctx + suite.ctx = suite.app.BaseApp.NewContext(false, header) + + queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + evm.RegisterQueryServer(queryHelper, suite.app.EvmKeeper) + suite.queryClientEvm = evm.NewQueryClient(queryHelper) +} + // DeployContract deploys the ERC20MinterBurnerDecimalsContract. func (suite *KeeperTestSuite) DeployContract(name, symbol string, decimals uint8) (common.Address, error) { ctx := sdk.WrapSDKContext(suite.ctx) @@ -518,228 +479,6 @@ func (suite *KeeperTestSuite) DeployContractDirectBalanceManipulation(name strin return crypto.CreateAddress(suite.address, nonce) } -// Commit commits and starts a new block with an updated context. -func (suite *KeeperTestSuite) Commit() { - suite.CommitAndBeginBlockAfter(time.Hour * 1) -} - -// Commit commits a block at a given time. Reminder: At the end of each -// Tendermint Consensus round the following methods are run -// 1. BeginBlock -// 2. DeliverTx -// 3. EndBlock -// 4. Commit -func (suite *KeeperTestSuite) CommitAndBeginBlockAfter(t time.Duration) { - header := suite.ctx.BlockHeader() - _ = suite.app.Commit() - - header.Height++ - header.Time = header.Time.Add(t) - suite.app.BeginBlock(abci.RequestBeginBlock{ - Header: header, - }) - - // update ctx - suite.ctx = suite.app.BaseApp.NewContext(false, header) - - queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - evm.RegisterQueryServer(queryHelper, suite.app.EvmKeeper) - suite.queryClientEvm = evm.NewQueryClient(queryHelper) -} - -func (suite *KeeperTestSuite) MintERC20Token(contractAddr, from, to common.Address, amount *big.Int) *evm.MsgEthereumTx { - transferData, err := contracts.ERC20MinterBurnerDecimalsContract.ABI.Pack("mint", to, amount) - suite.Require().NoError(err) - return suite.sendTx(contractAddr, from, transferData) -} - -func (suite *KeeperTestSuite) TransferERC20TokenToModule(contractAddr, from common.Address, amount *big.Int) *evm.MsgEthereumTx { - transferData, err := contracts.ERC20MinterBurnerDecimalsContract.ABI.Pack("transfer", types.ModuleAddress, amount) - suite.Require().NoError(err) - return suite.sendTx(contractAddr, from, transferData) -} - -func (suite *KeeperTestSuite) GrantERC20Token(contractAddr, from, to common.Address, roleString string) *evm.MsgEthereumTx { - // 0xCc508cD0818C85b8b8a1aB4cEEef8d981c8956A6 MINTER_ROLE - role := crypto.Keccak256([]byte(roleString)) - // needs to be an array not a slice - var v [32]byte - copy(v[:], role) - - transferData, err := contracts.ERC20MinterBurnerDecimalsContract.ABI.Pack("grantRole", v, to) - suite.Require().NoError(err) - return suite.sendTx(contractAddr, from, transferData) -} - -func (suite *KeeperTestSuite) sendTx(contractAddr, from common.Address, transferData []byte) *evm.MsgEthereumTx { - ctx := sdk.WrapSDKContext(suite.ctx) - chainID := suite.app.EvmKeeper.ChainID() - - args, err := json.Marshal(&evm.TransactionArgs{To: &contractAddr, From: &from, Data: (*hexutil.Bytes)(&transferData)}) - suite.Require().NoError(err) - res, err := suite.queryClientEvm.EstimateGas(ctx, &evm.EthCallRequest{ - Args: args, - GasCap: config.DefaultGasCap, - }) - suite.Require().NoError(err) - - nonce := suite.app.EvmKeeper.GetNonce(suite.ctx, suite.address) - - // Mint the max gas to the FeeCollector to ensure balance in case of refund - evmParams := suite.app.EvmKeeper.GetParams(suite.ctx) - suite.MintFeeCollector(sdk.NewCoins(sdk.NewCoin(evmParams.EvmDenom, sdk.NewInt(suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx).Int64()*int64(res.Gas))))) - - ercTransferTx := evm.NewTx( - chainID, - nonce, - &contractAddr, - nil, - res.Gas, - nil, - suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx), - big.NewInt(1), - transferData, - ðtypes.AccessList{}, // accesses - ) - - ercTransferTx.From = suite.address.Hex() - err = ercTransferTx.Sign(ethtypes.LatestSignerForChainID(chainID), suite.signer) - suite.Require().NoError(err) - rsp, err := suite.app.EvmKeeper.EthereumTx(ctx, ercTransferTx) - suite.Require().NoError(err) - suite.Require().Empty(rsp.VmError) - return ercTransferTx -} - -func (suite *KeeperTestSuite) BalanceOf(contract, account common.Address) interface{} { - erc20 := contracts.ERC20MinterBurnerDecimalsContract.ABI - - res, err := suite.app.Erc20Keeper.CallEVM(suite.ctx, erc20, types.ModuleAddress, contract, false, "balanceOf", account) - if err != nil { - return nil - } - - unpacked, err := erc20.Unpack("balanceOf", res.Ret) - if err != nil { - return nil - } - if len(unpacked) == 0 { - return nil - } - - return unpacked[0] -} - -func (suite *KeeperTestSuite) NameOf(contract common.Address) string { - erc20 := contracts.ERC20MinterBurnerDecimalsContract.ABI - - res, err := suite.app.Erc20Keeper.CallEVM(suite.ctx, erc20, types.ModuleAddress, contract, false, "name") - suite.Require().NoError(err) - suite.Require().NotNil(res) - - unpacked, err := erc20.Unpack("name", res.Ret) - suite.Require().NoError(err) - suite.Require().NotEmpty(unpacked) - - return fmt.Sprintf("%v", unpacked[0]) -} - -func (suite *KeeperTestSuite) TransferERC20Token(contractAddr, from, to common.Address, amount *big.Int) *evm.MsgEthereumTx { - transferData, err := contracts.ERC20MinterBurnerDecimalsContract.ABI.Pack("transfer", to, amount) - suite.Require().NoError(err) - return suite.sendTx(contractAddr, from, transferData) -} - -var _ types.EVMKeeper = &MockEVMKeeper{} - -type MockEVMKeeper struct { - mock.Mock -} - -func (m *MockEVMKeeper) GetParams(ctx sdk.Context) evm.Params { - args := m.Called(mock.Anything) - return args.Get(0).(evm.Params) -} - -func (m *MockEVMKeeper) GetAccountWithoutBalance(ctx sdk.Context, addr common.Address) *statedb.Account { - args := m.Called(mock.Anything, mock.Anything) - if args.Get(0) == nil { - return nil - } - return args.Get(0).(*statedb.Account) -} - -func (m *MockEVMKeeper) EstimateGas(c context.Context, req *evm.EthCallRequest) (*evm.EstimateGasResponse, error) { - args := m.Called(mock.Anything, mock.Anything) - if args.Get(0) == nil { - return nil, args.Error(1) - } - return args.Get(0).(*evm.EstimateGasResponse), args.Error(1) -} - -func (m *MockEVMKeeper) ApplyMessage(ctx sdk.Context, msg core.Message, tracer vm.EVMLogger, commit bool) (*evm.MsgEthereumTxResponse, error) { - args := m.Called(mock.Anything, mock.Anything, mock.Anything, mock.Anything) - - if args.Get(0) == nil { - return nil, args.Error(1) - } - return args.Get(0).(*evm.MsgEthereumTxResponse), args.Error(1) -} - -var _ types.BankKeeper = &MockBankKeeper{} - -type MockBankKeeper struct { - mock.Mock -} - -func (b *MockBankKeeper) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error { - args := b.Called(mock.Anything, mock.Anything, mock.Anything, mock.Anything) - return args.Error(0) -} - -func (b *MockBankKeeper) SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error { - args := b.Called(mock.Anything, mock.Anything, mock.Anything, mock.Anything) - return args.Error(0) -} - -func (b *MockBankKeeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { - args := b.Called(mock.Anything, mock.Anything, mock.Anything) - return args.Error(0) -} - -func (b *MockBankKeeper) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { - args := b.Called(mock.Anything, mock.Anything, mock.Anything) - return args.Error(0) -} - -func (b *MockBankKeeper) IsSendEnabledCoin(ctx sdk.Context, coin sdk.Coin) bool { - args := b.Called(mock.Anything, mock.Anything) - return args.Bool(0) -} - -func (b *MockBankKeeper) BlockedAddr(addr sdk.AccAddress) bool { - args := b.Called(mock.Anything) - return args.Bool(0) -} - -func (b *MockBankKeeper) GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) { - args := b.Called(mock.Anything, mock.Anything) - return args.Get(0).(banktypes.Metadata), args.Bool(1) -} - -func (b *MockBankKeeper) SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) { -} - -func (b *MockBankKeeper) HasSupply(ctx sdk.Context, denom string) bool { - args := b.Called(mock.Anything, mock.Anything) - return args.Bool(0) -} - -func (b *MockBankKeeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin { - args := b.Called(mock.Anything, mock.Anything) - return args.Get(0).(sdk.Coin) -} - // DeployContract deploys the ERC20MinterBurnerDecimalsContract. func (suite *KeeperTestSuite) DeployContractToChain(name, symbol string, decimals uint8) (common.Address, error) { ctx := sdk.WrapSDKContext(s.EvmosChain.GetContext()) @@ -781,3 +520,42 @@ func (suite *KeeperTestSuite) DeployContractToChain(name, symbol string, decimal suite.Require().Empty(rsp.VmError) return crypto.CreateAddress(from, nonce), nil } + +func (suite *KeeperTestSuite) sendAndReceiveMessage( + path *ibctesting.Path, + originEndpoint *ibctesting.Endpoint, + destEndpoint *ibctesting.Endpoint, + originChain *ibcgotesting.TestChain, + coin string, + amount int64, + sender, receiver string, + seq uint64, + ibcCoinMetadata string, +) { + transferMsg := transfertypes.NewMsgTransfer(originEndpoint.ChannelConfig.PortID, originEndpoint.ChannelID, sdk.NewCoin(coin, sdk.NewInt(amount)), sender, receiver, timeoutHeight, 0, "") + _, err := ibctesting.SendMsgs(originChain, ibctesting.DefaultFeeAmt, transferMsg) + suite.Require().NoError(err) // message committed + // Recreate the packet that was sent + var transfer transfertypes.FungibleTokenPacketData + if ibcCoinMetadata == "" { + transfer = transfertypes.NewFungibleTokenPacketData(coin, strconv.Itoa(int(amount)), sender, receiver, "") + } else { + transfer = transfertypes.NewFungibleTokenPacketData(ibcCoinMetadata, strconv.Itoa(int(amount)), sender, receiver, "") + } + packet := channeltypes.NewPacket(transfer.GetBytes(), seq, originEndpoint.ChannelConfig.PortID, originEndpoint.ChannelID, destEndpoint.ChannelConfig.PortID, destEndpoint.ChannelID, timeoutHeight, 0) + // Receive message on the counterparty side, and send ack + err = path.RelayPacket(packet) + suite.Require().NoError(err) +} + +func (suite *KeeperTestSuite) SendAndReceiveMessage(path *ibctesting.Path, origin *ibcgotesting.TestChain, coin string, amount int64, sender, receiver string, seq uint64, ibcCoinMetadata string) { + // Send coin from A to B + suite.sendAndReceiveMessage(path, path.EndpointA, path.EndpointB, origin, coin, amount, sender, receiver, seq, ibcCoinMetadata) +} + +// Send back coins (from path endpoint B to A). In case of IBC coins need to provide ibcCoinMetadata (//, e.g.: "transfer/channel-0/aevmos") as input parameter. +// We need this to instantiate properly a FungibleTokenPacketData https://github.com/cosmos/ibc-go/blob/main/docs/architecture/adr-001-coin-source-tracing.md +func (suite *KeeperTestSuite) SendBackCoins(path *ibctesting.Path, origin *ibcgotesting.TestChain, coin string, amount int64, sender, receiver string, seq uint64, ibcCoinMetadata string) { + // Send coin from B to A + suite.sendAndReceiveMessage(path, path.EndpointB, path.EndpointA, origin, coin, amount, sender, receiver, seq, ibcCoinMetadata) +} diff --git a/x/erc20/migrations/v3/types/genesis.pb.go b/x/erc20/migrations/v3/types/genesis.pb.go index 6af3b87eed..7e85ba8f1c 100644 --- a/x/erc20/migrations/v3/types/genesis.pb.go +++ b/x/erc20/migrations/v3/types/genesis.pb.go @@ -5,18 +5,21 @@ package v3types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - "github.com/evmos/evmos/v11/x/erc20/types" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + "github.com/evmos/evmos/v11/x/erc20/types" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -38,9 +41,11 @@ func (*V3GenesisState) ProtoMessage() {} func (*V3GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_2f4674601b0d6987, []int{0} } + func (m *V3GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V3GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V3GenesisState.Marshal(b, m, deterministic) @@ -53,12 +58,15 @@ func (m *V3GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } + func (m *V3GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_V3GenesisState.Merge(m, src) } + func (m *V3GenesisState) XXX_Size() int { return m.Size() } + func (m *V3GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_V3GenesisState.DiscardUnknown(m) } @@ -94,9 +102,11 @@ func (*V3Params) ProtoMessage() {} func (*V3Params) Descriptor() ([]byte, []int) { return fileDescriptor_2f4674601b0d6987, []int{1} } + func (m *V3Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V3Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V3Params.Marshal(b, m, deterministic) @@ -109,12 +119,15 @@ func (m *V3Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *V3Params) XXX_Merge(src proto.Message) { xxx_messageInfo_V3Params.Merge(m, src) } + func (m *V3Params) XXX_Size() int { return m.Size() } + func (m *V3Params) XXX_DiscardUnknown() { xxx_messageInfo_V3Params.DiscardUnknown(m) } @@ -266,6 +279,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *V3GenesisState) Size() (n int) { if m == nil { return 0 @@ -301,9 +315,11 @@ func (m *V3Params) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *V3GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -421,6 +437,7 @@ func (m *V3GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func (m *V3Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -511,6 +528,7 @@ func (m *V3Params) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/erc20/types/erc20.pb.go b/x/erc20/types/erc20.pb.go index baccf6a9b2..4dc3fb7eba 100644 --- a/x/erc20/types/erc20.pb.go +++ b/x/erc20/types/erc20.pb.go @@ -5,18 +5,21 @@ package types import ( fmt "fmt" - types "github.com/cosmos/cosmos-sdk/x/bank/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + types "github.com/cosmos/cosmos-sdk/x/bank/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -76,9 +79,11 @@ func (*TokenPair) ProtoMessage() {} func (*TokenPair) Descriptor() ([]byte, []int) { return fileDescriptor_668d5dc537f45142, []int{0} } + func (m *TokenPair) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *TokenPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_TokenPair.Marshal(b, m, deterministic) @@ -91,12 +96,15 @@ func (m *TokenPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *TokenPair) XXX_Merge(src proto.Message) { xxx_messageInfo_TokenPair.Merge(m, src) } + func (m *TokenPair) XXX_Size() int { return m.Size() } + func (m *TokenPair) XXX_DiscardUnknown() { xxx_messageInfo_TokenPair.DiscardUnknown(m) } @@ -148,9 +156,11 @@ func (*RegisterCoinProposal) ProtoMessage() {} func (*RegisterCoinProposal) Descriptor() ([]byte, []int) { return fileDescriptor_668d5dc537f45142, []int{1} } + func (m *RegisterCoinProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *RegisterCoinProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_RegisterCoinProposal.Marshal(b, m, deterministic) @@ -163,12 +173,15 @@ func (m *RegisterCoinProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } + func (m *RegisterCoinProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_RegisterCoinProposal.Merge(m, src) } + func (m *RegisterCoinProposal) XXX_Size() int { return m.Size() } + func (m *RegisterCoinProposal) XXX_DiscardUnknown() { xxx_messageInfo_RegisterCoinProposal.DiscardUnknown(m) } @@ -213,9 +226,11 @@ func (*RegisterERC20Proposal) ProtoMessage() {} func (*RegisterERC20Proposal) Descriptor() ([]byte, []int) { return fileDescriptor_668d5dc537f45142, []int{2} } + func (m *RegisterERC20Proposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *RegisterERC20Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_RegisterERC20Proposal.Marshal(b, m, deterministic) @@ -228,12 +243,15 @@ func (m *RegisterERC20Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } + func (m *RegisterERC20Proposal) XXX_Merge(src proto.Message) { xxx_messageInfo_RegisterERC20Proposal.Merge(m, src) } + func (m *RegisterERC20Proposal) XXX_Size() int { return m.Size() } + func (m *RegisterERC20Proposal) XXX_DiscardUnknown() { xxx_messageInfo_RegisterERC20Proposal.DiscardUnknown(m) } @@ -279,9 +297,11 @@ func (*ToggleTokenConversionProposal) ProtoMessage() {} func (*ToggleTokenConversionProposal) Descriptor() ([]byte, []int) { return fileDescriptor_668d5dc537f45142, []int{3} } + func (m *ToggleTokenConversionProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ToggleTokenConversionProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ToggleTokenConversionProposal.Marshal(b, m, deterministic) @@ -294,12 +314,15 @@ func (m *ToggleTokenConversionProposal) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } + func (m *ToggleTokenConversionProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_ToggleTokenConversionProposal.Merge(m, src) } + func (m *ToggleTokenConversionProposal) XXX_Size() int { return m.Size() } + func (m *ToggleTokenConversionProposal) XXX_DiscardUnknown() { xxx_messageInfo_ToggleTokenConversionProposal.DiscardUnknown(m) } @@ -340,9 +363,11 @@ func (*ProposalMetadata) ProtoMessage() {} func (*ProposalMetadata) Descriptor() ([]byte, []int) { return fileDescriptor_668d5dc537f45142, []int{4} } + func (m *ProposalMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ProposalMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ProposalMetadata.Marshal(b, m, deterministic) @@ -355,12 +380,15 @@ func (m *ProposalMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } + func (m *ProposalMetadata) XXX_Merge(src proto.Message) { xxx_messageInfo_ProposalMetadata.Merge(m, src) } + func (m *ProposalMetadata) XXX_Size() int { return m.Size() } + func (m *ProposalMetadata) XXX_DiscardUnknown() { xxx_messageInfo_ProposalMetadata.DiscardUnknown(m) } @@ -454,6 +482,7 @@ func (this *TokenPair) Equal(that interface{}) bool { } return true } + func (this *ToggleTokenConversionProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -484,6 +513,7 @@ func (this *ToggleTokenConversionProposal) Equal(that interface{}) bool { } return true } + func (m *TokenPair) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -725,6 +755,7 @@ func encodeVarintErc20(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *TokenPair) Size() (n int) { if m == nil { return 0 @@ -833,9 +864,11 @@ func (m *ProposalMetadata) Size() (n int) { func sovErc20(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozErc20(x uint64) (n int) { return sovErc20(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *TokenPair) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -989,6 +1022,7 @@ func (m *TokenPair) Unmarshal(dAtA []byte) error { } return nil } + func (m *RegisterCoinProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1137,6 +1171,7 @@ func (m *RegisterCoinProposal) Unmarshal(dAtA []byte) error { } return nil } + func (m *RegisterERC20Proposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1283,6 +1318,7 @@ func (m *RegisterERC20Proposal) Unmarshal(dAtA []byte) error { } return nil } + func (m *ToggleTokenConversionProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1429,6 +1465,7 @@ func (m *ToggleTokenConversionProposal) Unmarshal(dAtA []byte) error { } return nil } + func (m *ProposalMetadata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1513,6 +1550,7 @@ func (m *ProposalMetadata) Unmarshal(dAtA []byte) error { } return nil } + func skipErc20(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/erc20/types/genesis.pb.go b/x/erc20/types/genesis.pb.go index aac2b486fc..c82166420c 100644 --- a/x/erc20/types/genesis.pb.go +++ b/x/erc20/types/genesis.pb.go @@ -5,17 +5,20 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -37,9 +40,11 @@ func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_2f4674601b0d6987, []int{0} } + func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) @@ -52,12 +57,15 @@ func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState.Merge(m, src) } + func (m *GenesisState) XXX_Size() int { return m.Size() } + func (m *GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState.DiscardUnknown(m) } @@ -93,9 +101,11 @@ func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_2f4674601b0d6987, []int{1} } + func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Params.Marshal(b, m, deterministic) @@ -108,12 +118,15 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Params) XXX_Merge(src proto.Message) { xxx_messageInfo_Params.Merge(m, src) } + func (m *Params) XXX_Size() int { return m.Size() } + func (m *Params) XXX_DiscardUnknown() { xxx_messageInfo_Params.DiscardUnknown(m) } @@ -265,6 +278,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -300,9 +314,11 @@ func (m *Params) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -420,6 +436,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -510,6 +527,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/erc20/types/query.pb.go b/x/erc20/types/query.pb.go index 05b5f4f1e9..6f64e772c4 100644 --- a/x/erc20/types/query.pb.go +++ b/x/erc20/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" @@ -14,15 +18,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -43,9 +46,11 @@ func (*QueryTokenPairsRequest) ProtoMessage() {} func (*QueryTokenPairsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_fba814bce17cabdf, []int{0} } + func (m *QueryTokenPairsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryTokenPairsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryTokenPairsRequest.Marshal(b, m, deterministic) @@ -58,12 +63,15 @@ func (m *QueryTokenPairsRequest) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *QueryTokenPairsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryTokenPairsRequest.Merge(m, src) } + func (m *QueryTokenPairsRequest) XXX_Size() int { return m.Size() } + func (m *QueryTokenPairsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryTokenPairsRequest.DiscardUnknown(m) } @@ -92,9 +100,11 @@ func (*QueryTokenPairsResponse) ProtoMessage() {} func (*QueryTokenPairsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_fba814bce17cabdf, []int{1} } + func (m *QueryTokenPairsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryTokenPairsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryTokenPairsResponse.Marshal(b, m, deterministic) @@ -107,12 +117,15 @@ func (m *QueryTokenPairsResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *QueryTokenPairsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryTokenPairsResponse.Merge(m, src) } + func (m *QueryTokenPairsResponse) XXX_Size() int { return m.Size() } + func (m *QueryTokenPairsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryTokenPairsResponse.DiscardUnknown(m) } @@ -146,9 +159,11 @@ func (*QueryTokenPairRequest) ProtoMessage() {} func (*QueryTokenPairRequest) Descriptor() ([]byte, []int) { return fileDescriptor_fba814bce17cabdf, []int{2} } + func (m *QueryTokenPairRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryTokenPairRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryTokenPairRequest.Marshal(b, m, deterministic) @@ -161,12 +176,15 @@ func (m *QueryTokenPairRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } + func (m *QueryTokenPairRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryTokenPairRequest.Merge(m, src) } + func (m *QueryTokenPairRequest) XXX_Size() int { return m.Size() } + func (m *QueryTokenPairRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryTokenPairRequest.DiscardUnknown(m) } @@ -193,9 +211,11 @@ func (*QueryTokenPairResponse) ProtoMessage() {} func (*QueryTokenPairResponse) Descriptor() ([]byte, []int) { return fileDescriptor_fba814bce17cabdf, []int{3} } + func (m *QueryTokenPairResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryTokenPairResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryTokenPairResponse.Marshal(b, m, deterministic) @@ -208,12 +228,15 @@ func (m *QueryTokenPairResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *QueryTokenPairResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryTokenPairResponse.Merge(m, src) } + func (m *QueryTokenPairResponse) XXX_Size() int { return m.Size() } + func (m *QueryTokenPairResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryTokenPairResponse.DiscardUnknown(m) } @@ -228,8 +251,7 @@ func (m *QueryTokenPairResponse) GetTokenPair() TokenPair { } // QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} +type QueryParamsRequest struct{} func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } @@ -237,9 +259,11 @@ func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_fba814bce17cabdf, []int{4} } + func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) @@ -252,12 +276,15 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsRequest.Merge(m, src) } + func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } + func (m *QueryParamsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } @@ -277,9 +304,11 @@ func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_fba814bce17cabdf, []int{5} } + func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) @@ -292,12 +321,15 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsResponse.Merge(m, src) } + func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } + func (m *QueryParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } @@ -359,8 +391,10 @@ var fileDescriptor_fba814bce17cabdf = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -424,15 +458,16 @@ type QueryServer interface { } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +type UnimplementedQueryServer struct{} func (*UnimplementedQueryServer) TokenPairs(ctx context.Context, req *QueryTokenPairsRequest) (*QueryTokenPairsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TokenPairs not implemented") } + func (*UnimplementedQueryServer) TokenPair(ctx context.Context, req *QueryTokenPairRequest) (*QueryTokenPairResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TokenPair not implemented") } + func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } @@ -730,6 +765,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *QueryTokenPairsRequest) Size() (n int) { if m == nil { return 0 @@ -809,9 +845,11 @@ func (m *QueryParamsResponse) Size() (n int) { func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *QueryTokenPairsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -898,6 +936,7 @@ func (m *QueryTokenPairsRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryTokenPairsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1018,6 +1057,7 @@ func (m *QueryTokenPairsResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryTokenPairRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1100,6 +1140,7 @@ func (m *QueryTokenPairRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryTokenPairResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1183,6 +1224,7 @@ func (m *QueryTokenPairResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1233,6 +1275,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1316,6 +1359,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/erc20/types/query.pb.gw.go b/x/erc20/types/query.pb.gw.go index 24ffa5ec99..9d6a58c5a5 100644 --- a/x/erc20/types/query.pb.gw.go +++ b/x/erc20/types/query.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - var ( - filter_Query_TokenPairs_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join ) +var filter_Query_TokenPairs_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + func request_Query_TokenPairs_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryTokenPairsRequest var metadata runtime.ServerMetadata @@ -50,7 +50,6 @@ func request_Query_TokenPairs_0(ctx context.Context, marshaler runtime.Marshaler msg, err := client.TokenPairs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_TokenPairs_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,7 +65,6 @@ func local_request_Query_TokenPairs_0(ctx context.Context, marshaler runtime.Mar msg, err := server.TokenPairs(ctx, &protoReq) return msg, metadata, err - } func request_Query_TokenPair_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -93,7 +91,6 @@ func request_Query_TokenPair_0(ctx context.Context, marshaler runtime.Marshaler, msg, err := client.TokenPair(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_TokenPair_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -120,7 +117,6 @@ func local_request_Query_TokenPair_0(ctx context.Context, marshaler runtime.Mars msg, err := server.TokenPair(ctx, &protoReq) return msg, metadata, err - } func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -129,7 +125,6 @@ func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -138,7 +133,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Params(ctx, &protoReq) return msg, metadata, err - } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -146,7 +140,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_TokenPairs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -167,7 +160,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_TokenPairs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_TokenPair_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -190,7 +182,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_TokenPair_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -213,7 +204,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -256,7 +246,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_TokenPairs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -274,7 +263,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_TokenPairs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_TokenPair_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -294,7 +282,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_TokenPair_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -314,7 +301,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil diff --git a/x/erc20/types/tx.pb.go b/x/erc20/types/tx.pb.go index 40b95450e2..b87d9d3bd9 100644 --- a/x/erc20/types/tx.pb.go +++ b/x/erc20/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" @@ -17,15 +21,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -50,9 +53,11 @@ func (*MsgConvertCoin) ProtoMessage() {} func (*MsgConvertCoin) Descriptor() ([]byte, []int) { return fileDescriptor_f8926fc6cb676914, []int{0} } + func (m *MsgConvertCoin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgConvertCoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgConvertCoin.Marshal(b, m, deterministic) @@ -65,12 +70,15 @@ func (m *MsgConvertCoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } + func (m *MsgConvertCoin) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgConvertCoin.Merge(m, src) } + func (m *MsgConvertCoin) XXX_Size() int { return m.Size() } + func (m *MsgConvertCoin) XXX_DiscardUnknown() { xxx_messageInfo_MsgConvertCoin.DiscardUnknown(m) } @@ -99,8 +107,7 @@ func (m *MsgConvertCoin) GetSender() string { } // MsgConvertCoinResponse returns no fields -type MsgConvertCoinResponse struct { -} +type MsgConvertCoinResponse struct{} func (m *MsgConvertCoinResponse) Reset() { *m = MsgConvertCoinResponse{} } func (m *MsgConvertCoinResponse) String() string { return proto.CompactTextString(m) } @@ -108,9 +115,11 @@ func (*MsgConvertCoinResponse) ProtoMessage() {} func (*MsgConvertCoinResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f8926fc6cb676914, []int{1} } + func (m *MsgConvertCoinResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgConvertCoinResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgConvertCoinResponse.Marshal(b, m, deterministic) @@ -123,12 +132,15 @@ func (m *MsgConvertCoinResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *MsgConvertCoinResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgConvertCoinResponse.Merge(m, src) } + func (m *MsgConvertCoinResponse) XXX_Size() int { return m.Size() } + func (m *MsgConvertCoinResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgConvertCoinResponse.DiscardUnknown(m) } @@ -154,9 +166,11 @@ func (*MsgConvertERC20) ProtoMessage() {} func (*MsgConvertERC20) Descriptor() ([]byte, []int) { return fileDescriptor_f8926fc6cb676914, []int{2} } + func (m *MsgConvertERC20) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgConvertERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgConvertERC20.Marshal(b, m, deterministic) @@ -169,12 +183,15 @@ func (m *MsgConvertERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } + func (m *MsgConvertERC20) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgConvertERC20.Merge(m, src) } + func (m *MsgConvertERC20) XXX_Size() int { return m.Size() } + func (m *MsgConvertERC20) XXX_DiscardUnknown() { xxx_messageInfo_MsgConvertERC20.DiscardUnknown(m) } @@ -203,8 +220,7 @@ func (m *MsgConvertERC20) GetSender() string { } // MsgConvertERC20Response returns no fields -type MsgConvertERC20Response struct { -} +type MsgConvertERC20Response struct{} func (m *MsgConvertERC20Response) Reset() { *m = MsgConvertERC20Response{} } func (m *MsgConvertERC20Response) String() string { return proto.CompactTextString(m) } @@ -212,9 +228,11 @@ func (*MsgConvertERC20Response) ProtoMessage() {} func (*MsgConvertERC20Response) Descriptor() ([]byte, []int) { return fileDescriptor_f8926fc6cb676914, []int{3} } + func (m *MsgConvertERC20Response) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgConvertERC20Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgConvertERC20Response.Marshal(b, m, deterministic) @@ -227,12 +245,15 @@ func (m *MsgConvertERC20Response) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *MsgConvertERC20Response) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgConvertERC20Response.Merge(m, src) } + func (m *MsgConvertERC20Response) XXX_Size() int { return m.Size() } + func (m *MsgConvertERC20Response) XXX_DiscardUnknown() { xxx_messageInfo_MsgConvertERC20Response.DiscardUnknown(m) } @@ -255,9 +276,11 @@ func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_f8926fc6cb676914, []int{4} } + func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) @@ -270,12 +293,15 @@ func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } + func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParams.Merge(m, src) } + func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParams) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } @@ -299,8 +325,7 @@ func (m *MsgUpdateParams) GetParams() Params { // MsgUpdateParamsResponse defines the response structure for executing a // MsgUpdateParams message. // Since: cosmos-sdk 0.47 -type MsgUpdateParamsResponse struct { -} +type MsgUpdateParamsResponse struct{} func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } @@ -308,9 +333,11 @@ func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f8926fc6cb676914, []int{5} } + func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) @@ -323,12 +350,15 @@ func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } + func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } @@ -387,8 +417,10 @@ var fileDescriptor_f8926fc6cb676914 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -458,15 +490,16 @@ type MsgServer interface { } // UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} +type UnimplementedMsgServer struct{} func (*UnimplementedMsgServer) ConvertCoin(ctx context.Context, req *MsgConvertCoin) (*MsgConvertCoinResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ConvertCoin not implemented") } + func (*UnimplementedMsgServer) ConvertERC20(ctx context.Context, req *MsgConvertERC20) (*MsgConvertERC20Response, error) { return nil, status.Errorf(codes.Unimplemented, "method ConvertERC20 not implemented") } + func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } @@ -771,6 +804,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *MsgConvertCoin) Size() (n int) { if m == nil { return 0 @@ -858,9 +892,11 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *MsgConvertCoin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1008,6 +1044,7 @@ func (m *MsgConvertCoin) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgConvertCoinResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1058,6 +1095,7 @@ func (m *MsgConvertCoinResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgConvertERC20) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1238,6 +1276,7 @@ func (m *MsgConvertERC20) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgConvertERC20Response) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1288,6 +1327,7 @@ func (m *MsgConvertERC20Response) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1403,6 +1443,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1453,6 +1494,7 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/erc20/types/tx.pb.gw.go b/x/erc20/types/tx.pb.gw.go index 0ae973ccc0..bb35c5edd6 100644 --- a/x/erc20/types/tx.pb.gw.go +++ b/x/erc20/types/tx.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - var ( - filter_Msg_ConvertCoin_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join ) +var filter_Msg_ConvertCoin_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + func request_Msg_ConvertCoin_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgConvertCoin var metadata runtime.ServerMetadata @@ -50,7 +50,6 @@ func request_Msg_ConvertCoin_0(ctx context.Context, marshaler runtime.Marshaler, msg, err := client.ConvertCoin(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Msg_ConvertCoin_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,12 +65,9 @@ func local_request_Msg_ConvertCoin_0(ctx context.Context, marshaler runtime.Mars msg, err := server.ConvertCoin(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Msg_ConvertERC20_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Msg_ConvertERC20_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Msg_ConvertERC20_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgConvertERC20 @@ -86,7 +82,6 @@ func request_Msg_ConvertERC20_0(ctx context.Context, marshaler runtime.Marshaler msg, err := client.ConvertERC20(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Msg_ConvertERC20_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -102,7 +97,6 @@ func local_request_Msg_ConvertERC20_0(ctx context.Context, marshaler runtime.Mar msg, err := server.ConvertERC20(ctx, &protoReq) return msg, metadata, err - } // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". @@ -110,7 +104,6 @@ func local_request_Msg_ConvertERC20_0(ctx context.Context, marshaler runtime.Mar // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { - mux.Handle("GET", pattern_Msg_ConvertCoin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -131,7 +124,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_ConvertCoin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Msg_ConvertERC20_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -154,7 +146,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_ConvertERC20_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -197,7 +188,6 @@ func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.C // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "MsgClient" to call the correct interceptors. func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { - mux.Handle("GET", pattern_Msg_ConvertCoin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -215,7 +205,6 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_ConvertCoin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Msg_ConvertERC20_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -235,7 +224,6 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_ConvertERC20_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil diff --git a/x/evm/keeper/block_proposer.go b/x/evm/keeper/block_proposer.go new file mode 100644 index 0000000000..9ce1d49d2c --- /dev/null +++ b/x/evm/keeper/block_proposer.go @@ -0,0 +1,31 @@ +package keeper + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/ethereum/go-ethereum/common" +) + +// GetCoinbaseAddress returns the block proposer's validator operator address. +func (k Keeper) GetCoinbaseAddress(ctx sdk.Context, proposerAddress sdk.ConsAddress) (common.Address, error) { + validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, GetProposerAddress(ctx, proposerAddress)) + if !found { + return common.Address{}, errorsmod.Wrapf( + stakingtypes.ErrNoValidatorFound, + "failed to retrieve validator from block proposer address %s", + proposerAddress.String(), + ) + } + + coinbase := common.BytesToAddress(validator.GetOperator()) + return coinbase, nil +} + +// GetProposerAddress returns current block proposer's address when provided proposer address is empty. +func GetProposerAddress(ctx sdk.Context, proposerAddress sdk.ConsAddress) sdk.ConsAddress { + if len(proposerAddress) == 0 { + proposerAddress = ctx.BlockHeader().ProposerAddress + } + return proposerAddress +} diff --git a/x/evm/keeper/utils.go b/x/evm/keeper/fees.go similarity index 81% rename from x/evm/keeper/utils.go rename to x/evm/keeper/fees.go index 8232e02931..e8772a61e5 100644 --- a/x/evm/keeper/utils.go +++ b/x/evm/keeper/fees.go @@ -27,32 +27,32 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" errortypes "github.com/cosmos/cosmos-sdk/types/errors" authante "github.com/cosmos/cosmos-sdk/x/auth/ante" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/evmos/evmos/v11/x/evm/types" ) -// GetCoinbaseAddress returns the block proposer's validator operator address. -func (k Keeper) GetCoinbaseAddress(ctx sdk.Context, proposerAddress sdk.ConsAddress) (common.Address, error) { - validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, GetProposerAddress(ctx, proposerAddress)) - if !found { - return common.Address{}, errorsmod.Wrapf( - stakingtypes.ErrNoValidatorFound, - "failed to retrieve validator from block proposer address %s", - proposerAddress.String(), +// CheckSenderBalance validates that the tx cost value is positive and that the +// sender has enough funds to pay for the fees and value of the transaction. +func CheckSenderBalance( + balance sdkmath.Int, + txData types.TxData, +) error { + cost := txData.Cost() + + if cost.Sign() < 0 { + return errorsmod.Wrapf( + errortypes.ErrInvalidCoins, + "tx cost (%s) is negative and invalid", cost, ) } - coinbase := common.BytesToAddress(validator.GetOperator()) - return coinbase, nil -} - -// GetProposerAddress returns current block proposer's address when provided proposer address is empty. -func GetProposerAddress(ctx sdk.Context, proposerAddress sdk.ConsAddress) sdk.ConsAddress { - if len(proposerAddress) == 0 { - proposerAddress = ctx.BlockHeader().ProposerAddress + if balance.IsNegative() || balance.BigInt().Cmp(cost) < 0 { + return errorsmod.Wrapf( + errortypes.ErrInsufficientFunds, + "sender balance < tx cost (%s < %s)", balance, txData.Cost(), + ) } - return proposerAddress + return nil } // DeductTxCostsFromUserBalance deducts the fees from the user balance. Returns an @@ -126,27 +126,3 @@ func VerifyFee( return sdk.Coins{{Denom: denom, Amount: sdkmath.NewIntFromBigInt(feeAmt)}}, nil } - -// CheckSenderBalance validates that the tx cost value is positive and that the -// sender has enough funds to pay for the fees and value of the transaction. -func CheckSenderBalance( - balance sdkmath.Int, - txData types.TxData, -) error { - cost := txData.Cost() - - if cost.Sign() < 0 { - return errorsmod.Wrapf( - errortypes.ErrInvalidCoins, - "tx cost (%s) is negative and invalid", cost, - ) - } - - if balance.IsNegative() || balance.BigInt().Cmp(cost) < 0 { - return errorsmod.Wrapf( - errortypes.ErrInsufficientFunds, - "sender balance < tx cost (%s < %s)", balance, txData.Cost(), - ) - } - return nil -} diff --git a/x/evm/keeper/fees_test.go b/x/evm/keeper/fees_test.go new file mode 100644 index 0000000000..4aa3563402 --- /dev/null +++ b/x/evm/keeper/fees_test.go @@ -0,0 +1,517 @@ +package keeper_test + +import ( + "math/big" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + ethparams "github.com/ethereum/go-ethereum/params" + "github.com/evmos/evmos/v11/x/evm/keeper" + evmtypes "github.com/evmos/evmos/v11/x/evm/types" +) + +func (suite *KeeperTestSuite) TestCheckSenderBalance() { + hundredInt := sdkmath.NewInt(100) + zeroInt := sdk.ZeroInt() + oneInt := sdk.OneInt() + fiveInt := sdkmath.NewInt(5) + fiftyInt := sdkmath.NewInt(50) + negInt := sdkmath.NewInt(-10) + + testCases := []struct { + name string + to string + gasLimit uint64 + gasPrice *sdkmath.Int + gasFeeCap *big.Int + gasTipCap *big.Int + cost *sdkmath.Int + from string + accessList *ethtypes.AccessList + expectPass bool + enableFeemarket bool + }{ + { + name: "Enough balance", + to: suite.address.String(), + gasLimit: 10, + gasPrice: &oneInt, + cost: &oneInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: true, + }, + { + name: "Equal balance", + to: suite.address.String(), + gasLimit: 99, + gasPrice: &oneInt, + cost: &oneInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: true, + }, + { + name: "negative cost", + to: suite.address.String(), + gasLimit: 1, + gasPrice: &oneInt, + cost: &negInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: false, + }, + { + name: "Higher gas limit, not enough balance", + to: suite.address.String(), + gasLimit: 100, + gasPrice: &oneInt, + cost: &oneInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: false, + }, + { + name: "Higher gas price, enough balance", + to: suite.address.String(), + gasLimit: 10, + gasPrice: &fiveInt, + cost: &oneInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: true, + }, + { + name: "Higher gas price, not enough balance", + to: suite.address.String(), + gasLimit: 20, + gasPrice: &fiveInt, + cost: &oneInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: false, + }, + { + name: "Higher cost, enough balance", + to: suite.address.String(), + gasLimit: 10, + gasPrice: &fiveInt, + cost: &fiftyInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: true, + }, + { + name: "Higher cost, not enough balance", + to: suite.address.String(), + gasLimit: 10, + gasPrice: &fiveInt, + cost: &hundredInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: false, + }, + { + name: "Enough balance w/ enableFeemarket", + to: suite.address.String(), + gasLimit: 10, + gasFeeCap: big.NewInt(1), + cost: &oneInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: true, + enableFeemarket: true, + }, + { + name: "Equal balance w/ enableFeemarket", + to: suite.address.String(), + gasLimit: 99, + gasFeeCap: big.NewInt(1), + cost: &oneInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: true, + enableFeemarket: true, + }, + { + name: "negative cost w/ enableFeemarket", + to: suite.address.String(), + gasLimit: 1, + gasFeeCap: big.NewInt(1), + cost: &negInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: false, + enableFeemarket: true, + }, + { + name: "Higher gas limit, not enough balance w/ enableFeemarket", + to: suite.address.String(), + gasLimit: 100, + gasFeeCap: big.NewInt(1), + cost: &oneInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: false, + enableFeemarket: true, + }, + { + name: "Higher gas price, enough balance w/ enableFeemarket", + to: suite.address.String(), + gasLimit: 10, + gasFeeCap: big.NewInt(5), + cost: &oneInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: true, + enableFeemarket: true, + }, + { + name: "Higher gas price, not enough balance w/ enableFeemarket", + to: suite.address.String(), + gasLimit: 20, + gasFeeCap: big.NewInt(5), + cost: &oneInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: false, + enableFeemarket: true, + }, + { + name: "Higher cost, enough balance w/ enableFeemarket", + to: suite.address.String(), + gasLimit: 10, + gasFeeCap: big.NewInt(5), + cost: &fiftyInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: true, + enableFeemarket: true, + }, + { + name: "Higher cost, not enough balance w/ enableFeemarket", + to: suite.address.String(), + gasLimit: 10, + gasFeeCap: big.NewInt(5), + cost: &hundredInt, + from: suite.address.String(), + accessList: ðtypes.AccessList{}, + expectPass: false, + enableFeemarket: true, + }, + } + + vmdb := suite.StateDB() + vmdb.AddBalance(suite.address, hundredInt.BigInt()) + balance := vmdb.GetBalance(suite.address) + suite.Require().Equal(balance, hundredInt.BigInt()) + err := vmdb.Commit() + suite.Require().NoError(err, "Unexpected error while committing to vmdb: %d", err) + + for i, tc := range testCases { + suite.Run(tc.name, func() { + to := common.HexToAddress(tc.from) + + var amount, gasPrice, gasFeeCap, gasTipCap *big.Int + if tc.cost != nil { + amount = tc.cost.BigInt() + } + + if tc.enableFeemarket { + gasFeeCap = tc.gasFeeCap + if tc.gasTipCap == nil { + gasTipCap = oneInt.BigInt() + } else { + gasTipCap = tc.gasTipCap + } + } else if tc.gasPrice != nil { + gasPrice = tc.gasPrice.BigInt() + } + + tx := evmtypes.NewTx(zeroInt.BigInt(), 1, &to, amount, tc.gasLimit, gasPrice, gasFeeCap, gasTipCap, nil, tc.accessList) + tx.From = tc.from + + txData, _ := evmtypes.UnpackTxData(tx.Data) + + acct := suite.app.EvmKeeper.GetAccountOrEmpty(suite.ctx, suite.address) + err := keeper.CheckSenderBalance( + sdkmath.NewIntFromBigInt(acct.Balance), + txData, + ) + + if tc.expectPass { + suite.Require().NoError(err, "valid test %d failed", i) + } else { + suite.Require().Error(err, "invalid test %d passed", i) + } + }) + } +} + +// TestVerifyFeeAndDeductTxCostsFromUserBalance is a test method for both the VerifyFee +// function and the DeductTxCostsFromUserBalance method. +// +// NOTE: This method combines testing for both functions, because these used to be +// in one function and share a lot of the same setup. +// In practice, the two tested functions will also be sequentially executed. +func (suite *KeeperTestSuite) TestVerifyFeeAndDeductTxCostsFromUserBalance() { + hundredInt := sdkmath.NewInt(100) + zeroInt := sdk.ZeroInt() + oneInt := sdkmath.NewInt(1) + fiveInt := sdkmath.NewInt(5) + fiftyInt := sdkmath.NewInt(50) + + // should be enough to cover all test cases + initBalance := sdkmath.NewInt((ethparams.InitialBaseFee + 10) * 105) + + testCases := []struct { + name string + gasLimit uint64 + gasPrice *sdkmath.Int + gasFeeCap *big.Int + gasTipCap *big.Int + cost *sdkmath.Int + accessList *ethtypes.AccessList + expectPassVerify bool + expectPassDeduct bool + enableFeemarket bool + from string + malleate func() + }{ + { + name: "Enough balance", + gasLimit: 10, + gasPrice: &oneInt, + cost: &oneInt, + accessList: ðtypes.AccessList{}, + expectPassVerify: true, + expectPassDeduct: true, + from: suite.address.String(), + }, + { + name: "Equal balance", + gasLimit: 100, + gasPrice: &oneInt, + cost: &oneInt, + accessList: ðtypes.AccessList{}, + expectPassVerify: true, + expectPassDeduct: true, + from: suite.address.String(), + }, + { + name: "Higher gas limit, not enough balance", + gasLimit: 105, + gasPrice: &oneInt, + cost: &oneInt, + accessList: ðtypes.AccessList{}, + expectPassVerify: true, + expectPassDeduct: false, + from: suite.address.String(), + }, + { + name: "Higher gas price, enough balance", + gasLimit: 20, + gasPrice: &fiveInt, + cost: &oneInt, + accessList: ðtypes.AccessList{}, + expectPassVerify: true, + expectPassDeduct: true, + from: suite.address.String(), + }, + { + name: "Higher gas price, not enough balance", + gasLimit: 20, + gasPrice: &fiftyInt, + cost: &oneInt, + accessList: ðtypes.AccessList{}, + expectPassVerify: true, + expectPassDeduct: false, + from: suite.address.String(), + }, + // This case is expected to be true because the fees can be deducted, but the tx + // execution is going to fail because there is no more balance to pay the cost + { + name: "Higher cost, enough balance", + gasLimit: 100, + gasPrice: &oneInt, + cost: &fiftyInt, + accessList: ðtypes.AccessList{}, + expectPassVerify: true, + expectPassDeduct: true, + from: suite.address.String(), + }, + // testcases with enableFeemarket enabled. + { + name: "Invalid gasFeeCap w/ enableFeemarket", + gasLimit: 10, + gasFeeCap: big.NewInt(1), + gasTipCap: big.NewInt(1), + cost: &oneInt, + accessList: ðtypes.AccessList{}, + expectPassVerify: false, + expectPassDeduct: true, + enableFeemarket: true, + from: suite.address.String(), + }, + { + name: "empty tip fee is valid to deduct", + gasLimit: 10, + gasFeeCap: big.NewInt(ethparams.InitialBaseFee), + gasTipCap: big.NewInt(1), + cost: &oneInt, + accessList: ðtypes.AccessList{}, + expectPassVerify: true, + expectPassDeduct: true, + enableFeemarket: true, + from: suite.address.String(), + }, + { + name: "effectiveTip equal to gasTipCap", + gasLimit: 100, + gasFeeCap: big.NewInt(ethparams.InitialBaseFee + 2), + cost: &oneInt, + accessList: ðtypes.AccessList{}, + expectPassVerify: true, + expectPassDeduct: true, + enableFeemarket: true, + from: suite.address.String(), + }, + { + name: "effectiveTip equal to (gasFeeCap - baseFee)", + gasLimit: 105, + gasFeeCap: big.NewInt(ethparams.InitialBaseFee + 1), + gasTipCap: big.NewInt(2), + cost: &oneInt, + accessList: ðtypes.AccessList{}, + expectPassVerify: true, + expectPassDeduct: true, + enableFeemarket: true, + from: suite.address.String(), + }, + { + name: "Invalid from address", + gasLimit: 10, + gasPrice: &oneInt, + cost: &oneInt, + accessList: ðtypes.AccessList{}, + expectPassVerify: true, + expectPassDeduct: false, + from: "abcdef", + }, + { + name: "Enough balance - with access list", + gasLimit: 10, + gasPrice: &oneInt, + cost: &oneInt, + accessList: ðtypes.AccessList{ + ethtypes.AccessTuple{ + Address: suite.address, + StorageKeys: []common.Hash{}, + }, + }, + expectPassVerify: true, + expectPassDeduct: true, + from: suite.address.String(), + }, + { + name: "gasLimit < intrinsicGas during IsCheckTx", + gasLimit: 1, + gasPrice: &oneInt, + cost: &oneInt, + accessList: ðtypes.AccessList{}, + expectPassVerify: false, + expectPassDeduct: true, + from: suite.address.String(), + malleate: func() { + suite.ctx = suite.ctx.WithIsCheckTx(true) + }, + }, + } + + for i, tc := range testCases { + suite.Run(tc.name, func() { + suite.enableFeemarket = tc.enableFeemarket + suite.SetupTest() + vmdb := suite.StateDB() + + if tc.malleate != nil { + tc.malleate() + } + var amount, gasPrice, gasFeeCap, gasTipCap *big.Int + if tc.cost != nil { + amount = tc.cost.BigInt() + } + + if suite.enableFeemarket { + if tc.gasFeeCap != nil { + gasFeeCap = tc.gasFeeCap + } + if tc.gasTipCap == nil { + gasTipCap = oneInt.BigInt() + } else { + gasTipCap = tc.gasTipCap + } + vmdb.AddBalance(suite.address, initBalance.BigInt()) + balance := vmdb.GetBalance(suite.address) + suite.Require().Equal(balance, initBalance.BigInt()) + } else { + if tc.gasPrice != nil { + gasPrice = tc.gasPrice.BigInt() + } + + vmdb.AddBalance(suite.address, hundredInt.BigInt()) + balance := vmdb.GetBalance(suite.address) + suite.Require().Equal(balance, hundredInt.BigInt()) + } + err := vmdb.Commit() + suite.Require().NoError(err, "Unexpected error while committing to vmdb: %d", err) + + tx := evmtypes.NewTx(zeroInt.BigInt(), 1, &suite.address, amount, tc.gasLimit, gasPrice, gasFeeCap, gasTipCap, nil, tc.accessList) + tx.From = tc.from + + txData, _ := evmtypes.UnpackTxData(tx.Data) + + evmParams := suite.app.EvmKeeper.GetParams(suite.ctx) + ethCfg := evmParams.GetChainConfig().EthereumConfig(nil) + baseFee := suite.app.EvmKeeper.GetBaseFee(suite.ctx, ethCfg) + priority := evmtypes.GetTxPriority(txData, baseFee) + + fees, err := keeper.VerifyFee(txData, evmtypes.DefaultEVMDenom, baseFee, false, false, suite.ctx.IsCheckTx()) + if tc.expectPassVerify { + suite.Require().NoError(err, "valid test %d failed - '%s'", i, tc.name) + if tc.enableFeemarket { + baseFee := suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx) + suite.Require().Equal( + fees, + sdk.NewCoins( + sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewIntFromBigInt(txData.EffectiveFee(baseFee))), + ), + "valid test %d failed, fee value is wrong - '%s'", i, tc.name, + ) + suite.Require().Equal(int64(0), priority) + } else { + suite.Require().Equal( + fees, + sdk.NewCoins( + sdk.NewCoin(evmtypes.DefaultEVMDenom, tc.gasPrice.Mul(sdkmath.NewIntFromUint64(tc.gasLimit))), + ), + "valid test %d failed, fee value is wrong - '%s'", i, tc.name, + ) + } + } else { + suite.Require().Error(err, "invalid test %d passed - '%s'", i, tc.name) + suite.Require().Nil(fees, "invalid test %d passed. fees value must be nil - '%s'", i, tc.name) + } + + err = suite.app.EvmKeeper.DeductTxCostsFromUserBalance(suite.ctx, fees, common.HexToAddress(tx.From)) + if tc.expectPassDeduct { + suite.Require().NoError(err, "valid test %d failed - '%s'", i, tc.name) + } else { + suite.Require().Error(err, "invalid test %d passed - '%s'", i, tc.name) + } + }) + } + suite.enableFeemarket = false // reset flag +} diff --git a/x/evm/keeper/keeper_test.go b/x/evm/keeper/keeper_test.go index dcbcfb13b4..04b3dfe018 100644 --- a/x/evm/keeper/keeper_test.go +++ b/x/evm/keeper/keeper_test.go @@ -2,427 +2,20 @@ package keeper_test import ( _ "embed" - "encoding/json" - "math" "math/big" - "testing" - "time" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - sdkmath "cosmossdk.io/math" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/simapp" - sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/evmos/evmos/v11/app" - "github.com/evmos/evmos/v11/utils" - feemarkettypes "github.com/evmos/evmos/v11/x/feemarket/types" - tmjson "github.com/tendermint/tendermint/libs/json" - "github.com/evmos/evmos/v11/crypto/ethsecp256k1" - "github.com/evmos/evmos/v11/encoding" - "github.com/evmos/evmos/v11/server/config" - "github.com/evmos/evmos/v11/tests" evmostypes "github.com/evmos/evmos/v11/types" "github.com/evmos/evmos/v11/x/evm/keeper" "github.com/evmos/evmos/v11/x/evm/statedb" evmtypes "github.com/evmos/evmos/v11/x/evm/types" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/tmhash" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmversion "github.com/tendermint/tendermint/proto/tendermint/version" - "github.com/tendermint/tendermint/version" -) - -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.Evmos - queryClient evmtypes.QueryClient - address common.Address - consAddress sdk.ConsAddress - - // for generate test tx - clientCtx client.Context - ethSigner ethtypes.Signer - - appCodec codec.Codec - signer keyring.Signer - - enableFeemarket bool - enableLondonHF bool - mintFeeCollector bool - denom string -} - -var ( - s *KeeperTestSuite - chainID = utils.TestnetChainID + "-1" ) -func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) - s.enableFeemarket = false - s.enableLondonHF = true - suite.Run(t, s) - - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") -} - -func (suite *KeeperTestSuite) SetupTest() { - checkTx := false - suite.app = app.Setup(checkTx, nil) - suite.SetupApp(checkTx) -} - -func (suite *KeeperTestSuite) SetupTestWithT(t require.TestingT) { - checkTx := false - suite.app = app.Setup(checkTx, nil) - suite.SetupAppWithT(checkTx, t) -} - -func (suite *KeeperTestSuite) SetupApp(checkTx bool) { - suite.SetupAppWithT(checkTx, suite.T()) -} - -// SetupApp setup test environment, it uses`require.TestingT` to support both `testing.T` and `testing.B`. -func (suite *KeeperTestSuite) SetupAppWithT(checkTx bool, t require.TestingT) { - // account key, use a constant account to keep unit test deterministic. - ecdsaPriv, err := crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") - require.NoError(t, err) - priv := ðsecp256k1.PrivKey{ - Key: crypto.FromECDSA(ecdsaPriv), - } - suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) - suite.signer = tests.NewSigner(priv) - - // consensus key - priv, err = ethsecp256k1.GenerateKey() - require.NoError(t, err) - suite.consAddress = sdk.ConsAddress(priv.PubKey().Address()) - - suite.app = app.EthSetup(checkTx, func(app *app.Evmos, genesis simapp.GenesisState) simapp.GenesisState { - feemarketGenesis := feemarkettypes.DefaultGenesisState() - if suite.enableFeemarket { - feemarketGenesis.Params.EnableHeight = 1 - feemarketGenesis.Params.NoBaseFee = false - } else { - feemarketGenesis.Params.NoBaseFee = true - } - genesis[feemarkettypes.ModuleName] = app.AppCodec().MustMarshalJSON(feemarketGenesis) - if !suite.enableLondonHF { - evmGenesis := evmtypes.DefaultGenesisState() - maxInt := sdkmath.NewInt(math.MaxInt64) - evmGenesis.Params.ChainConfig.LondonBlock = &maxInt - evmGenesis.Params.ChainConfig.ArrowGlacierBlock = &maxInt - evmGenesis.Params.ChainConfig.GrayGlacierBlock = &maxInt - evmGenesis.Params.ChainConfig.MergeNetsplitBlock = &maxInt - evmGenesis.Params.ChainConfig.ShanghaiBlock = &maxInt - evmGenesis.Params.ChainConfig.CancunBlock = &maxInt - genesis[evmtypes.ModuleName] = app.AppCodec().MustMarshalJSON(evmGenesis) - } - return genesis - }) - - if suite.mintFeeCollector { - // mint some coin to fee collector - coins := sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(int64(params.TxGas)-1))) - genesisState := app.NewTestGenesisState(suite.app.AppCodec()) - balances := []banktypes.Balance{ - { - Address: suite.app.AccountKeeper.GetModuleAddress(authtypes.FeeCollectorName).String(), - Coins: coins, - }, - } - var bankGenesis banktypes.GenesisState - suite.app.AppCodec().MustUnmarshalJSON(genesisState[banktypes.ModuleName], &bankGenesis) - // Update balances and total supply - bankGenesis.Balances = append(bankGenesis.Balances, balances...) - bankGenesis.Supply = bankGenesis.Supply.Add(coins...) - genesisState[banktypes.ModuleName] = suite.app.AppCodec().MustMarshalJSON(&bankGenesis) - - // we marshal the genesisState of all module to a byte array - stateBytes, err := tmjson.MarshalIndent(genesisState, "", " ") - require.NoError(t, err) - - // Initialize the chain - suite.app.InitChain( - abci.RequestInitChain{ - ChainId: chainID, - Validators: []abci.ValidatorUpdate{}, - ConsensusParams: app.DefaultConsensusParams, - AppStateBytes: stateBytes, - }, - ) - } - - suite.ctx = suite.app.NewContext(checkTx, tmproto.Header{ - Height: 1, - ChainID: chainID, - Time: time.Now().UTC(), - ProposerAddress: suite.consAddress.Bytes(), - Version: tmversion.Consensus{ - Block: version.BlockProtocol, - }, - LastBlockId: tmproto.BlockID{ - Hash: tmhash.Sum([]byte("block_id")), - PartSetHeader: tmproto.PartSetHeader{ - Total: 11, - Hash: tmhash.Sum([]byte("partset_header")), - }, - }, - AppHash: tmhash.Sum([]byte("app")), - DataHash: tmhash.Sum([]byte("data")), - EvidenceHash: tmhash.Sum([]byte("evidence")), - ValidatorsHash: tmhash.Sum([]byte("validators")), - NextValidatorsHash: tmhash.Sum([]byte("next_validators")), - ConsensusHash: tmhash.Sum([]byte("consensus")), - LastResultsHash: tmhash.Sum([]byte("last_result")), - }) - - queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - evmtypes.RegisterQueryServer(queryHelper, suite.app.EvmKeeper) - suite.queryClient = evmtypes.NewQueryClient(queryHelper) - - acc := &evmostypes.EthAccount{ - BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(suite.address.Bytes()), nil, 0, 0), - CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(), - } - - suite.app.AccountKeeper.SetAccount(suite.ctx, acc) - - valAddr := sdk.ValAddress(suite.address.Bytes()) - validator, err := stakingtypes.NewValidator(valAddr, priv.PubKey(), stakingtypes.Description{}) - require.NoError(t, err) - err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) - require.NoError(t, err) - err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) - require.NoError(t, err) - suite.app.StakingKeeper.SetValidator(suite.ctx, validator) - - encodingConfig := encoding.MakeConfig(app.ModuleBasics) - suite.clientCtx = client.Context{}.WithTxConfig(encodingConfig.TxConfig) - suite.ethSigner = ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID()) - suite.appCodec = encodingConfig.Codec - suite.denom = evmtypes.DefaultEVMDenom -} - -func (suite *KeeperTestSuite) EvmDenom() string { - ctx := sdk.WrapSDKContext(suite.ctx) - rsp, _ := suite.queryClient.Params(ctx, &evmtypes.QueryParamsRequest{}) - return rsp.Params.EvmDenom -} - -// Commit and begin new block -func (suite *KeeperTestSuite) Commit() { - _ = suite.app.Commit() - header := suite.ctx.BlockHeader() - header.Height++ - suite.app.BeginBlock(abci.RequestBeginBlock{ - Header: header, - }) - - // update ctx - suite.ctx = suite.app.NewContext(false, header) - - queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - evmtypes.RegisterQueryServer(queryHelper, suite.app.EvmKeeper) - suite.queryClient = evmtypes.NewQueryClient(queryHelper) -} - -func (suite *KeeperTestSuite) StateDB() *statedb.StateDB { - return statedb.New(suite.ctx, suite.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(suite.ctx.HeaderHash().Bytes()))) -} - -// DeployTestContract deploy a test erc20 contract and returns the contract address -func (suite *KeeperTestSuite) DeployTestContract(t require.TestingT, owner common.Address, supply *big.Int) common.Address { - ctx := sdk.WrapSDKContext(suite.ctx) - chainID := suite.app.EvmKeeper.ChainID() - - ctorArgs, err := evmtypes.ERC20Contract.ABI.Pack("", owner, supply) - require.NoError(t, err) - - nonce := suite.app.EvmKeeper.GetNonce(suite.ctx, suite.address) - - data := evmtypes.ERC20Contract.Bin - data = append(data, ctorArgs...) - args, err := json.Marshal(&evmtypes.TransactionArgs{ - From: &suite.address, - Data: (*hexutil.Bytes)(&data), - }) - require.NoError(t, err) - res, err := suite.queryClient.EstimateGas(ctx, &evmtypes.EthCallRequest{ - Args: args, - GasCap: config.DefaultGasCap, - ProposerAddress: suite.ctx.BlockHeader().ProposerAddress, - }) - require.NoError(t, err) - - var erc20DeployTx *evmtypes.MsgEthereumTx - if suite.enableFeemarket { - erc20DeployTx = evmtypes.NewTxContract( - chainID, - nonce, - nil, // amount - res.Gas, // gasLimit - nil, // gasPrice - suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx), - big.NewInt(1), - data, // input - ðtypes.AccessList{}, // accesses - ) - } else { - erc20DeployTx = evmtypes.NewTxContract( - chainID, - nonce, - nil, // amount - res.Gas, // gasLimit - nil, // gasPrice - nil, nil, - data, // input - nil, // accesses - ) - } - - erc20DeployTx.From = suite.address.Hex() - err = erc20DeployTx.Sign(ethtypes.LatestSignerForChainID(chainID), suite.signer) - require.NoError(t, err) - rsp, err := suite.app.EvmKeeper.EthereumTx(ctx, erc20DeployTx) - require.NoError(t, err) - require.Empty(t, rsp.VmError) - return crypto.CreateAddress(suite.address, nonce) -} - -func (suite *KeeperTestSuite) TransferERC20Token(t require.TestingT, contractAddr, from, to common.Address, amount *big.Int) *evmtypes.MsgEthereumTx { - ctx := sdk.WrapSDKContext(suite.ctx) - chainID := suite.app.EvmKeeper.ChainID() - - transferData, err := evmtypes.ERC20Contract.ABI.Pack("transfer", to, amount) - require.NoError(t, err) - args, err := json.Marshal(&evmtypes.TransactionArgs{To: &contractAddr, From: &from, Data: (*hexutil.Bytes)(&transferData)}) - require.NoError(t, err) - res, err := suite.queryClient.EstimateGas(ctx, &evmtypes.EthCallRequest{ - Args: args, - GasCap: 25_000_000, - ProposerAddress: suite.ctx.BlockHeader().ProposerAddress, - }) - require.NoError(t, err) - - nonce := suite.app.EvmKeeper.GetNonce(suite.ctx, suite.address) - - var ercTransferTx *evmtypes.MsgEthereumTx - if suite.enableFeemarket { - ercTransferTx = evmtypes.NewTx( - chainID, - nonce, - &contractAddr, - nil, - res.Gas, - nil, - suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx), - big.NewInt(1), - transferData, - ðtypes.AccessList{}, // accesses - ) - } else { - ercTransferTx = evmtypes.NewTx( - chainID, - nonce, - &contractAddr, - nil, - res.Gas, - nil, - nil, nil, - transferData, - nil, - ) - } - - ercTransferTx.From = suite.address.Hex() - err = ercTransferTx.Sign(ethtypes.LatestSignerForChainID(chainID), suite.signer) - require.NoError(t, err) - rsp, err := suite.app.EvmKeeper.EthereumTx(ctx, ercTransferTx) - require.NoError(t, err) - require.Empty(t, rsp.VmError) - return ercTransferTx -} - -// DeployTestMessageCall deploy a test erc20 contract and returns the contract address -func (suite *KeeperTestSuite) DeployTestMessageCall(t require.TestingT) common.Address { - ctx := sdk.WrapSDKContext(suite.ctx) - chainID := suite.app.EvmKeeper.ChainID() - - data := evmtypes.TestMessageCall.Bin - args, err := json.Marshal(&evmtypes.TransactionArgs{ - From: &suite.address, - Data: (*hexutil.Bytes)(&data), - }) - require.NoError(t, err) - - res, err := suite.queryClient.EstimateGas(ctx, &evmtypes.EthCallRequest{ - Args: args, - GasCap: config.DefaultGasCap, - ProposerAddress: suite.ctx.BlockHeader().ProposerAddress, - }) - require.NoError(t, err) - - nonce := suite.app.EvmKeeper.GetNonce(suite.ctx, suite.address) - - var erc20DeployTx *evmtypes.MsgEthereumTx - if suite.enableFeemarket { - erc20DeployTx = evmtypes.NewTxContract( - chainID, - nonce, - nil, // amount - res.Gas, // gasLimit - nil, // gasPrice - suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx), - big.NewInt(1), - data, // input - ðtypes.AccessList{}, // accesses - ) - } else { - erc20DeployTx = evmtypes.NewTxContract( - chainID, - nonce, - nil, // amount - res.Gas, // gasLimit - nil, // gasPrice - nil, nil, - data, // input - nil, // accesses - ) - } - - erc20DeployTx.From = suite.address.Hex() - err = erc20DeployTx.Sign(ethtypes.LatestSignerForChainID(chainID), suite.signer) - require.NoError(t, err) - rsp, err := suite.app.EvmKeeper.EthereumTx(ctx, erc20DeployTx) - require.NoError(t, err) - require.Empty(t, rsp.VmError) - return crypto.CreateAddress(suite.address, nonce) -} - func (suite *KeeperTestSuite) TestWithChainID() { testCases := []struct { name string diff --git a/x/evm/keeper/setup_test.go b/x/evm/keeper/setup_test.go new file mode 100644 index 0000000000..606d04fe21 --- /dev/null +++ b/x/evm/keeper/setup_test.go @@ -0,0 +1,213 @@ +package keeper_test + +import ( + "math" + "testing" + "time" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/params" + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/crypto/ethsecp256k1" + "github.com/evmos/evmos/v11/encoding" + "github.com/evmos/evmos/v11/tests" + evmostypes "github.com/evmos/evmos/v11/types" + evmtypes "github.com/evmos/evmos/v11/x/evm/types" + feemarkettypes "github.com/evmos/evmos/v11/x/feemarket/types" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/crypto/tmhash" + tmjson "github.com/tendermint/tendermint/libs/json" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmversion "github.com/tendermint/tendermint/proto/tendermint/version" + "github.com/tendermint/tendermint/version" +) + +type KeeperTestSuite struct { + suite.Suite + + ctx sdk.Context + app *app.Evmos + queryClient evmtypes.QueryClient + address common.Address + consAddress sdk.ConsAddress + + // for generate test tx + clientCtx client.Context + ethSigner ethtypes.Signer + + appCodec codec.Codec + signer keyring.Signer + + enableFeemarket bool + enableLondonHF bool + mintFeeCollector bool + denom string +} + +var s *KeeperTestSuite + +func TestKeeperTestSuite(t *testing.T) { + s = new(KeeperTestSuite) + s.enableFeemarket = false + s.enableLondonHF = true + suite.Run(t, s) + + // Run Ginkgo integration tests + RegisterFailHandler(Fail) + RunSpecs(t, "Keeper Suite") +} + +func (suite *KeeperTestSuite) SetupTest() { + checkTx := false + suite.app = app.Setup(checkTx, nil) + suite.SetupApp(checkTx) +} + +func (suite *KeeperTestSuite) SetupTestWithT(t require.TestingT) { + checkTx := false + suite.app = app.Setup(checkTx, nil) + suite.SetupAppWithT(checkTx, t) +} + +func (suite *KeeperTestSuite) SetupApp(checkTx bool) { + suite.SetupAppWithT(checkTx, suite.T()) +} + +// SetupApp setup test environment, it uses`require.TestingT` to support both `testing.T` and `testing.B`. +func (suite *KeeperTestSuite) SetupAppWithT(checkTx bool, t require.TestingT) { + // account key, use a constant account to keep unit test deterministic. + ecdsaPriv, err := crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") + require.NoError(t, err) + priv := ðsecp256k1.PrivKey{ + Key: crypto.FromECDSA(ecdsaPriv), + } + suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) + suite.signer = tests.NewSigner(priv) + + // consensus key + priv, err = ethsecp256k1.GenerateKey() + require.NoError(t, err) + suite.consAddress = sdk.ConsAddress(priv.PubKey().Address()) + + suite.app = app.EthSetup(checkTx, func(app *app.Evmos, genesis simapp.GenesisState) simapp.GenesisState { + feemarketGenesis := feemarkettypes.DefaultGenesisState() + if suite.enableFeemarket { + feemarketGenesis.Params.EnableHeight = 1 + feemarketGenesis.Params.NoBaseFee = false + } else { + feemarketGenesis.Params.NoBaseFee = true + } + genesis[feemarkettypes.ModuleName] = app.AppCodec().MustMarshalJSON(feemarketGenesis) + if !suite.enableLondonHF { + evmGenesis := evmtypes.DefaultGenesisState() + maxInt := sdkmath.NewInt(math.MaxInt64) + evmGenesis.Params.ChainConfig.LondonBlock = &maxInt + evmGenesis.Params.ChainConfig.ArrowGlacierBlock = &maxInt + evmGenesis.Params.ChainConfig.GrayGlacierBlock = &maxInt + evmGenesis.Params.ChainConfig.MergeNetsplitBlock = &maxInt + evmGenesis.Params.ChainConfig.ShanghaiBlock = &maxInt + evmGenesis.Params.ChainConfig.CancunBlock = &maxInt + genesis[evmtypes.ModuleName] = app.AppCodec().MustMarshalJSON(evmGenesis) + } + return genesis + }) + + if suite.mintFeeCollector { + // mint some coin to fee collector + coins := sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(int64(params.TxGas)-1))) + genesisState := app.NewTestGenesisState(suite.app.AppCodec()) + balances := []banktypes.Balance{ + { + Address: suite.app.AccountKeeper.GetModuleAddress(authtypes.FeeCollectorName).String(), + Coins: coins, + }, + } + var bankGenesis banktypes.GenesisState + suite.app.AppCodec().MustUnmarshalJSON(genesisState[banktypes.ModuleName], &bankGenesis) + // Update balances and total supply + bankGenesis.Balances = append(bankGenesis.Balances, balances...) + bankGenesis.Supply = bankGenesis.Supply.Add(coins...) + genesisState[banktypes.ModuleName] = suite.app.AppCodec().MustMarshalJSON(&bankGenesis) + + // we marshal the genesisState of all module to a byte array + stateBytes, err := tmjson.MarshalIndent(genesisState, "", " ") + require.NoError(t, err) + + // Initialize the chain + suite.app.InitChain( + abci.RequestInitChain{ + ChainId: "evmos_9000-1", + Validators: []abci.ValidatorUpdate{}, + ConsensusParams: app.DefaultConsensusParams, + AppStateBytes: stateBytes, + }, + ) + } + + suite.ctx = suite.app.NewContext(checkTx, tmproto.Header{ + Height: 1, + ChainID: "evmos_9000-1", + Time: time.Now().UTC(), + ProposerAddress: suite.consAddress.Bytes(), + Version: tmversion.Consensus{ + Block: version.BlockProtocol, + }, + LastBlockId: tmproto.BlockID{ + Hash: tmhash.Sum([]byte("block_id")), + PartSetHeader: tmproto.PartSetHeader{ + Total: 11, + Hash: tmhash.Sum([]byte("partset_header")), + }, + }, + AppHash: tmhash.Sum([]byte("app")), + DataHash: tmhash.Sum([]byte("data")), + EvidenceHash: tmhash.Sum([]byte("evidence")), + ValidatorsHash: tmhash.Sum([]byte("validators")), + NextValidatorsHash: tmhash.Sum([]byte("next_validators")), + ConsensusHash: tmhash.Sum([]byte("consensus")), + LastResultsHash: tmhash.Sum([]byte("last_result")), + }) + + queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + evmtypes.RegisterQueryServer(queryHelper, suite.app.EvmKeeper) + suite.queryClient = evmtypes.NewQueryClient(queryHelper) + + acc := &evmostypes.EthAccount{ + BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(suite.address.Bytes()), nil, 0, 0), + CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(), + } + + suite.app.AccountKeeper.SetAccount(suite.ctx, acc) + + valAddr := sdk.ValAddress(suite.address.Bytes()) + validator, err := stakingtypes.NewValidator(valAddr, priv.PubKey(), stakingtypes.Description{}) + require.NoError(t, err) + err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) + require.NoError(t, err) + err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) + require.NoError(t, err) + suite.app.StakingKeeper.SetValidator(suite.ctx, validator) + + encodingConfig := encoding.MakeConfig(app.ModuleBasics) + suite.clientCtx = client.Context{}.WithTxConfig(encodingConfig.TxConfig) + suite.ethSigner = ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID()) + suite.appCodec = encodingConfig.Codec + suite.denom = evmtypes.DefaultEVMDenom +} diff --git a/x/evm/keeper/utils_test.go b/x/evm/keeper/utils_test.go index 4aa3563402..e7f3df9b8b 100644 --- a/x/evm/keeper/utils_test.go +++ b/x/evm/keeper/utils_test.go @@ -1,517 +1,214 @@ package keeper_test import ( + "encoding/json" "math/big" - sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" - ethparams "github.com/ethereum/go-ethereum/params" - "github.com/evmos/evmos/v11/x/evm/keeper" + "github.com/ethereum/go-ethereum/crypto" + "github.com/evmos/evmos/v11/server/config" + "github.com/evmos/evmos/v11/x/evm/statedb" evmtypes "github.com/evmos/evmos/v11/x/evm/types" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" ) -func (suite *KeeperTestSuite) TestCheckSenderBalance() { - hundredInt := sdkmath.NewInt(100) - zeroInt := sdk.ZeroInt() - oneInt := sdk.OneInt() - fiveInt := sdkmath.NewInt(5) - fiftyInt := sdkmath.NewInt(50) - negInt := sdkmath.NewInt(-10) - - testCases := []struct { - name string - to string - gasLimit uint64 - gasPrice *sdkmath.Int - gasFeeCap *big.Int - gasTipCap *big.Int - cost *sdkmath.Int - from string - accessList *ethtypes.AccessList - expectPass bool - enableFeemarket bool - }{ - { - name: "Enough balance", - to: suite.address.String(), - gasLimit: 10, - gasPrice: &oneInt, - cost: &oneInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: true, - }, - { - name: "Equal balance", - to: suite.address.String(), - gasLimit: 99, - gasPrice: &oneInt, - cost: &oneInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: true, - }, - { - name: "negative cost", - to: suite.address.String(), - gasLimit: 1, - gasPrice: &oneInt, - cost: &negInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: false, - }, - { - name: "Higher gas limit, not enough balance", - to: suite.address.String(), - gasLimit: 100, - gasPrice: &oneInt, - cost: &oneInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: false, - }, - { - name: "Higher gas price, enough balance", - to: suite.address.String(), - gasLimit: 10, - gasPrice: &fiveInt, - cost: &oneInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: true, - }, - { - name: "Higher gas price, not enough balance", - to: suite.address.String(), - gasLimit: 20, - gasPrice: &fiveInt, - cost: &oneInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: false, - }, - { - name: "Higher cost, enough balance", - to: suite.address.String(), - gasLimit: 10, - gasPrice: &fiveInt, - cost: &fiftyInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: true, - }, - { - name: "Higher cost, not enough balance", - to: suite.address.String(), - gasLimit: 10, - gasPrice: &fiveInt, - cost: &hundredInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: false, - }, - { - name: "Enough balance w/ enableFeemarket", - to: suite.address.String(), - gasLimit: 10, - gasFeeCap: big.NewInt(1), - cost: &oneInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: true, - enableFeemarket: true, - }, - { - name: "Equal balance w/ enableFeemarket", - to: suite.address.String(), - gasLimit: 99, - gasFeeCap: big.NewInt(1), - cost: &oneInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: true, - enableFeemarket: true, - }, - { - name: "negative cost w/ enableFeemarket", - to: suite.address.String(), - gasLimit: 1, - gasFeeCap: big.NewInt(1), - cost: &negInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: false, - enableFeemarket: true, - }, - { - name: "Higher gas limit, not enough balance w/ enableFeemarket", - to: suite.address.String(), - gasLimit: 100, - gasFeeCap: big.NewInt(1), - cost: &oneInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: false, - enableFeemarket: true, - }, - { - name: "Higher gas price, enough balance w/ enableFeemarket", - to: suite.address.String(), - gasLimit: 10, - gasFeeCap: big.NewInt(5), - cost: &oneInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: true, - enableFeemarket: true, - }, - { - name: "Higher gas price, not enough balance w/ enableFeemarket", - to: suite.address.String(), - gasLimit: 20, - gasFeeCap: big.NewInt(5), - cost: &oneInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: false, - enableFeemarket: true, - }, - { - name: "Higher cost, enough balance w/ enableFeemarket", - to: suite.address.String(), - gasLimit: 10, - gasFeeCap: big.NewInt(5), - cost: &fiftyInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: true, - enableFeemarket: true, - }, - { - name: "Higher cost, not enough balance w/ enableFeemarket", - to: suite.address.String(), - gasLimit: 10, - gasFeeCap: big.NewInt(5), - cost: &hundredInt, - from: suite.address.String(), - accessList: ðtypes.AccessList{}, - expectPass: false, - enableFeemarket: true, - }, - } - - vmdb := suite.StateDB() - vmdb.AddBalance(suite.address, hundredInt.BigInt()) - balance := vmdb.GetBalance(suite.address) - suite.Require().Equal(balance, hundredInt.BigInt()) - err := vmdb.Commit() - suite.Require().NoError(err, "Unexpected error while committing to vmdb: %d", err) - - for i, tc := range testCases { - suite.Run(tc.name, func() { - to := common.HexToAddress(tc.from) - - var amount, gasPrice, gasFeeCap, gasTipCap *big.Int - if tc.cost != nil { - amount = tc.cost.BigInt() - } - - if tc.enableFeemarket { - gasFeeCap = tc.gasFeeCap - if tc.gasTipCap == nil { - gasTipCap = oneInt.BigInt() - } else { - gasTipCap = tc.gasTipCap - } - } else if tc.gasPrice != nil { - gasPrice = tc.gasPrice.BigInt() - } - - tx := evmtypes.NewTx(zeroInt.BigInt(), 1, &to, amount, tc.gasLimit, gasPrice, gasFeeCap, gasTipCap, nil, tc.accessList) - tx.From = tc.from - - txData, _ := evmtypes.UnpackTxData(tx.Data) - - acct := suite.app.EvmKeeper.GetAccountOrEmpty(suite.ctx, suite.address) - err := keeper.CheckSenderBalance( - sdkmath.NewIntFromBigInt(acct.Balance), - txData, - ) - - if tc.expectPass { - suite.Require().NoError(err, "valid test %d failed", i) - } else { - suite.Require().Error(err, "invalid test %d passed", i) - } - }) - } +func (suite *KeeperTestSuite) EvmDenom() string { + ctx := sdk.WrapSDKContext(suite.ctx) + rsp, _ := suite.queryClient.Params(ctx, &evmtypes.QueryParamsRequest{}) + return rsp.Params.EvmDenom } -// TestVerifyFeeAndDeductTxCostsFromUserBalance is a test method for both the VerifyFee -// function and the DeductTxCostsFromUserBalance method. -// -// NOTE: This method combines testing for both functions, because these used to be -// in one function and share a lot of the same setup. -// In practice, the two tested functions will also be sequentially executed. -func (suite *KeeperTestSuite) TestVerifyFeeAndDeductTxCostsFromUserBalance() { - hundredInt := sdkmath.NewInt(100) - zeroInt := sdk.ZeroInt() - oneInt := sdkmath.NewInt(1) - fiveInt := sdkmath.NewInt(5) - fiftyInt := sdkmath.NewInt(50) +// Commit and begin new block +func (suite *KeeperTestSuite) Commit() { + _ = suite.app.Commit() + header := suite.ctx.BlockHeader() + header.Height++ + suite.app.BeginBlock(abci.RequestBeginBlock{ + Header: header, + }) + + // update ctx + suite.ctx = suite.app.NewContext(false, header) + + queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + evmtypes.RegisterQueryServer(queryHelper, suite.app.EvmKeeper) + suite.queryClient = evmtypes.NewQueryClient(queryHelper) +} - // should be enough to cover all test cases - initBalance := sdkmath.NewInt((ethparams.InitialBaseFee + 10) * 105) +func (suite *KeeperTestSuite) StateDB() *statedb.StateDB { + return statedb.New(suite.ctx, suite.app.EvmKeeper, statedb.NewEmptyTxConfig(common.BytesToHash(suite.ctx.HeaderHash().Bytes()))) +} - testCases := []struct { - name string - gasLimit uint64 - gasPrice *sdkmath.Int - gasFeeCap *big.Int - gasTipCap *big.Int - cost *sdkmath.Int - accessList *ethtypes.AccessList - expectPassVerify bool - expectPassDeduct bool - enableFeemarket bool - from string - malleate func() - }{ - { - name: "Enough balance", - gasLimit: 10, - gasPrice: &oneInt, - cost: &oneInt, - accessList: ðtypes.AccessList{}, - expectPassVerify: true, - expectPassDeduct: true, - from: suite.address.String(), - }, - { - name: "Equal balance", - gasLimit: 100, - gasPrice: &oneInt, - cost: &oneInt, - accessList: ðtypes.AccessList{}, - expectPassVerify: true, - expectPassDeduct: true, - from: suite.address.String(), - }, - { - name: "Higher gas limit, not enough balance", - gasLimit: 105, - gasPrice: &oneInt, - cost: &oneInt, - accessList: ðtypes.AccessList{}, - expectPassVerify: true, - expectPassDeduct: false, - from: suite.address.String(), - }, - { - name: "Higher gas price, enough balance", - gasLimit: 20, - gasPrice: &fiveInt, - cost: &oneInt, - accessList: ðtypes.AccessList{}, - expectPassVerify: true, - expectPassDeduct: true, - from: suite.address.String(), - }, - { - name: "Higher gas price, not enough balance", - gasLimit: 20, - gasPrice: &fiftyInt, - cost: &oneInt, - accessList: ðtypes.AccessList{}, - expectPassVerify: true, - expectPassDeduct: false, - from: suite.address.String(), - }, - // This case is expected to be true because the fees can be deducted, but the tx - // execution is going to fail because there is no more balance to pay the cost - { - name: "Higher cost, enough balance", - gasLimit: 100, - gasPrice: &oneInt, - cost: &fiftyInt, - accessList: ðtypes.AccessList{}, - expectPassVerify: true, - expectPassDeduct: true, - from: suite.address.String(), - }, - // testcases with enableFeemarket enabled. - { - name: "Invalid gasFeeCap w/ enableFeemarket", - gasLimit: 10, - gasFeeCap: big.NewInt(1), - gasTipCap: big.NewInt(1), - cost: &oneInt, - accessList: ðtypes.AccessList{}, - expectPassVerify: false, - expectPassDeduct: true, - enableFeemarket: true, - from: suite.address.String(), - }, - { - name: "empty tip fee is valid to deduct", - gasLimit: 10, - gasFeeCap: big.NewInt(ethparams.InitialBaseFee), - gasTipCap: big.NewInt(1), - cost: &oneInt, - accessList: ðtypes.AccessList{}, - expectPassVerify: true, - expectPassDeduct: true, - enableFeemarket: true, - from: suite.address.String(), - }, - { - name: "effectiveTip equal to gasTipCap", - gasLimit: 100, - gasFeeCap: big.NewInt(ethparams.InitialBaseFee + 2), - cost: &oneInt, - accessList: ðtypes.AccessList{}, - expectPassVerify: true, - expectPassDeduct: true, - enableFeemarket: true, - from: suite.address.String(), - }, - { - name: "effectiveTip equal to (gasFeeCap - baseFee)", - gasLimit: 105, - gasFeeCap: big.NewInt(ethparams.InitialBaseFee + 1), - gasTipCap: big.NewInt(2), - cost: &oneInt, - accessList: ðtypes.AccessList{}, - expectPassVerify: true, - expectPassDeduct: true, - enableFeemarket: true, - from: suite.address.String(), - }, - { - name: "Invalid from address", - gasLimit: 10, - gasPrice: &oneInt, - cost: &oneInt, - accessList: ðtypes.AccessList{}, - expectPassVerify: true, - expectPassDeduct: false, - from: "abcdef", - }, - { - name: "Enough balance - with access list", - gasLimit: 10, - gasPrice: &oneInt, - cost: &oneInt, - accessList: ðtypes.AccessList{ - ethtypes.AccessTuple{ - Address: suite.address, - StorageKeys: []common.Hash{}, - }, - }, - expectPassVerify: true, - expectPassDeduct: true, - from: suite.address.String(), - }, - { - name: "gasLimit < intrinsicGas during IsCheckTx", - gasLimit: 1, - gasPrice: &oneInt, - cost: &oneInt, - accessList: ðtypes.AccessList{}, - expectPassVerify: false, - expectPassDeduct: true, - from: suite.address.String(), - malleate: func() { - suite.ctx = suite.ctx.WithIsCheckTx(true) - }, - }, +// DeployTestContract deploy a test erc20 contract and returns the contract address +func (suite *KeeperTestSuite) DeployTestContract(t require.TestingT, owner common.Address, supply *big.Int) common.Address { + ctx := sdk.WrapSDKContext(suite.ctx) + chainID := suite.app.EvmKeeper.ChainID() + + ctorArgs, err := evmtypes.ERC20Contract.ABI.Pack("", owner, supply) + require.NoError(t, err) + + nonce := suite.app.EvmKeeper.GetNonce(suite.ctx, suite.address) + + data := evmtypes.ERC20Contract.Bin + data = append(data, ctorArgs...) + args, err := json.Marshal(&evmtypes.TransactionArgs{ + From: &suite.address, + Data: (*hexutil.Bytes)(&data), + }) + require.NoError(t, err) + res, err := suite.queryClient.EstimateGas(ctx, &evmtypes.EthCallRequest{ + Args: args, + GasCap: config.DefaultGasCap, + ProposerAddress: suite.ctx.BlockHeader().ProposerAddress, + }) + require.NoError(t, err) + + var erc20DeployTx *evmtypes.MsgEthereumTx + if suite.enableFeemarket { + erc20DeployTx = evmtypes.NewTxContract( + chainID, + nonce, + nil, // amount + res.Gas, // gasLimit + nil, // gasPrice + suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx), + big.NewInt(1), + data, // input + ðtypes.AccessList{}, // accesses + ) + } else { + erc20DeployTx = evmtypes.NewTxContract( + chainID, + nonce, + nil, // amount + res.Gas, // gasLimit + nil, // gasPrice + nil, nil, + data, // input + nil, // accesses + ) } - for i, tc := range testCases { - suite.Run(tc.name, func() { - suite.enableFeemarket = tc.enableFeemarket - suite.SetupTest() - vmdb := suite.StateDB() - - if tc.malleate != nil { - tc.malleate() - } - var amount, gasPrice, gasFeeCap, gasTipCap *big.Int - if tc.cost != nil { - amount = tc.cost.BigInt() - } - - if suite.enableFeemarket { - if tc.gasFeeCap != nil { - gasFeeCap = tc.gasFeeCap - } - if tc.gasTipCap == nil { - gasTipCap = oneInt.BigInt() - } else { - gasTipCap = tc.gasTipCap - } - vmdb.AddBalance(suite.address, initBalance.BigInt()) - balance := vmdb.GetBalance(suite.address) - suite.Require().Equal(balance, initBalance.BigInt()) - } else { - if tc.gasPrice != nil { - gasPrice = tc.gasPrice.BigInt() - } - - vmdb.AddBalance(suite.address, hundredInt.BigInt()) - balance := vmdb.GetBalance(suite.address) - suite.Require().Equal(balance, hundredInt.BigInt()) - } - err := vmdb.Commit() - suite.Require().NoError(err, "Unexpected error while committing to vmdb: %d", err) - - tx := evmtypes.NewTx(zeroInt.BigInt(), 1, &suite.address, amount, tc.gasLimit, gasPrice, gasFeeCap, gasTipCap, nil, tc.accessList) - tx.From = tc.from - - txData, _ := evmtypes.UnpackTxData(tx.Data) + erc20DeployTx.From = suite.address.Hex() + err = erc20DeployTx.Sign(ethtypes.LatestSignerForChainID(chainID), suite.signer) + require.NoError(t, err) + rsp, err := suite.app.EvmKeeper.EthereumTx(ctx, erc20DeployTx) + require.NoError(t, err) + require.Empty(t, rsp.VmError) + return crypto.CreateAddress(suite.address, nonce) +} - evmParams := suite.app.EvmKeeper.GetParams(suite.ctx) - ethCfg := evmParams.GetChainConfig().EthereumConfig(nil) - baseFee := suite.app.EvmKeeper.GetBaseFee(suite.ctx, ethCfg) - priority := evmtypes.GetTxPriority(txData, baseFee) +func (suite *KeeperTestSuite) TransferERC20Token(t require.TestingT, contractAddr, from, to common.Address, amount *big.Int) *evmtypes.MsgEthereumTx { + ctx := sdk.WrapSDKContext(suite.ctx) + chainID := suite.app.EvmKeeper.ChainID() + + transferData, err := evmtypes.ERC20Contract.ABI.Pack("transfer", to, amount) + require.NoError(t, err) + args, err := json.Marshal(&evmtypes.TransactionArgs{To: &contractAddr, From: &from, Data: (*hexutil.Bytes)(&transferData)}) + require.NoError(t, err) + res, err := suite.queryClient.EstimateGas(ctx, &evmtypes.EthCallRequest{ + Args: args, + GasCap: 25_000_000, + ProposerAddress: suite.ctx.BlockHeader().ProposerAddress, + }) + require.NoError(t, err) + + nonce := suite.app.EvmKeeper.GetNonce(suite.ctx, suite.address) + + var ercTransferTx *evmtypes.MsgEthereumTx + if suite.enableFeemarket { + ercTransferTx = evmtypes.NewTx( + chainID, + nonce, + &contractAddr, + nil, + res.Gas, + nil, + suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx), + big.NewInt(1), + transferData, + ðtypes.AccessList{}, // accesses + ) + } else { + ercTransferTx = evmtypes.NewTx( + chainID, + nonce, + &contractAddr, + nil, + res.Gas, + nil, + nil, nil, + transferData, + nil, + ) + } - fees, err := keeper.VerifyFee(txData, evmtypes.DefaultEVMDenom, baseFee, false, false, suite.ctx.IsCheckTx()) - if tc.expectPassVerify { - suite.Require().NoError(err, "valid test %d failed - '%s'", i, tc.name) - if tc.enableFeemarket { - baseFee := suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx) - suite.Require().Equal( - fees, - sdk.NewCoins( - sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewIntFromBigInt(txData.EffectiveFee(baseFee))), - ), - "valid test %d failed, fee value is wrong - '%s'", i, tc.name, - ) - suite.Require().Equal(int64(0), priority) - } else { - suite.Require().Equal( - fees, - sdk.NewCoins( - sdk.NewCoin(evmtypes.DefaultEVMDenom, tc.gasPrice.Mul(sdkmath.NewIntFromUint64(tc.gasLimit))), - ), - "valid test %d failed, fee value is wrong - '%s'", i, tc.name, - ) - } - } else { - suite.Require().Error(err, "invalid test %d passed - '%s'", i, tc.name) - suite.Require().Nil(fees, "invalid test %d passed. fees value must be nil - '%s'", i, tc.name) - } + ercTransferTx.From = suite.address.Hex() + err = ercTransferTx.Sign(ethtypes.LatestSignerForChainID(chainID), suite.signer) + require.NoError(t, err) + rsp, err := suite.app.EvmKeeper.EthereumTx(ctx, ercTransferTx) + require.NoError(t, err) + require.Empty(t, rsp.VmError) + return ercTransferTx +} - err = suite.app.EvmKeeper.DeductTxCostsFromUserBalance(suite.ctx, fees, common.HexToAddress(tx.From)) - if tc.expectPassDeduct { - suite.Require().NoError(err, "valid test %d failed - '%s'", i, tc.name) - } else { - suite.Require().Error(err, "invalid test %d passed - '%s'", i, tc.name) - } - }) +// DeployTestMessageCall deploy a test erc20 contract and returns the contract address +func (suite *KeeperTestSuite) DeployTestMessageCall(t require.TestingT) common.Address { + ctx := sdk.WrapSDKContext(suite.ctx) + chainID := suite.app.EvmKeeper.ChainID() + + data := evmtypes.TestMessageCall.Bin + args, err := json.Marshal(&evmtypes.TransactionArgs{ + From: &suite.address, + Data: (*hexutil.Bytes)(&data), + }) + require.NoError(t, err) + + res, err := suite.queryClient.EstimateGas(ctx, &evmtypes.EthCallRequest{ + Args: args, + GasCap: config.DefaultGasCap, + ProposerAddress: suite.ctx.BlockHeader().ProposerAddress, + }) + require.NoError(t, err) + + nonce := suite.app.EvmKeeper.GetNonce(suite.ctx, suite.address) + + var erc20DeployTx *evmtypes.MsgEthereumTx + if suite.enableFeemarket { + erc20DeployTx = evmtypes.NewTxContract( + chainID, + nonce, + nil, // amount + res.Gas, // gasLimit + nil, // gasPrice + suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx), + big.NewInt(1), + data, // input + ðtypes.AccessList{}, // accesses + ) + } else { + erc20DeployTx = evmtypes.NewTxContract( + chainID, + nonce, + nil, // amount + res.Gas, // gasLimit + nil, // gasPrice + nil, nil, + data, // input + nil, // accesses + ) } - suite.enableFeemarket = false // reset flag + + erc20DeployTx.From = suite.address.Hex() + err = erc20DeployTx.Sign(ethtypes.LatestSignerForChainID(chainID), suite.signer) + require.NoError(t, err) + rsp, err := suite.app.EvmKeeper.EthereumTx(ctx, erc20DeployTx) + require.NoError(t, err) + require.Empty(t, rsp.VmError) + return crypto.CreateAddress(suite.address, nonce) } diff --git a/x/evm/migrations/v4/types/evm.pb.go b/x/evm/migrations/v4/types/evm.pb.go index ce2681e47c..b3a2648cf2 100644 --- a/x/evm/migrations/v4/types/evm.pb.go +++ b/x/evm/migrations/v4/types/evm.pb.go @@ -5,18 +5,21 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -48,9 +51,11 @@ func (*V4Params) ProtoMessage() {} func (*V4Params) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{0} } + func (m *V4Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V4Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V4Params.Marshal(b, m, deterministic) @@ -63,12 +68,15 @@ func (m *V4Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *V4Params) XXX_Merge(src proto.Message) { xxx_messageInfo_V4Params.Merge(m, src) } + func (m *V4Params) XXX_Size() int { return m.Size() } + func (m *V4Params) XXX_DiscardUnknown() { xxx_messageInfo_V4Params.DiscardUnknown(m) } @@ -129,9 +137,11 @@ func (*ExtraEIPs) ProtoMessage() {} func (*ExtraEIPs) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{1} } + func (m *ExtraEIPs) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ExtraEIPs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ExtraEIPs.Marshal(b, m, deterministic) @@ -144,12 +154,15 @@ func (m *ExtraEIPs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *ExtraEIPs) XXX_Merge(src proto.Message) { xxx_messageInfo_ExtraEIPs.Merge(m, src) } + func (m *ExtraEIPs) XXX_Size() int { return m.Size() } + func (m *ExtraEIPs) XXX_DiscardUnknown() { xxx_messageInfo_ExtraEIPs.DiscardUnknown(m) } @@ -213,9 +226,11 @@ func (*V4ChainConfig) ProtoMessage() {} func (*V4ChainConfig) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{2} } + func (m *V4ChainConfig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V4ChainConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V4ChainConfig.Marshal(b, m, deterministic) @@ -228,12 +243,15 @@ func (m *V4ChainConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } + func (m *V4ChainConfig) XXX_Merge(src proto.Message) { xxx_messageInfo_V4ChainConfig.Merge(m, src) } + func (m *V4ChainConfig) XXX_Size() int { return m.Size() } + func (m *V4ChainConfig) XXX_DiscardUnknown() { xxx_messageInfo_V4ChainConfig.DiscardUnknown(m) } @@ -268,9 +286,11 @@ func (*V4State) ProtoMessage() {} func (*V4State) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{3} } + func (m *V4State) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V4State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V4State.Marshal(b, m, deterministic) @@ -283,12 +303,15 @@ func (m *V4State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *V4State) XXX_Merge(src proto.Message) { xxx_messageInfo_V4State.Merge(m, src) } + func (m *V4State) XXX_Size() int { return m.Size() } + func (m *V4State) XXX_DiscardUnknown() { xxx_messageInfo_V4State.DiscardUnknown(m) } @@ -325,9 +348,11 @@ func (*TransactionV4Logs) ProtoMessage() {} func (*TransactionV4Logs) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{4} } + func (m *TransactionV4Logs) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *TransactionV4Logs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_TransactionV4Logs.Marshal(b, m, deterministic) @@ -340,12 +365,15 @@ func (m *TransactionV4Logs) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } + func (m *TransactionV4Logs) XXX_Merge(src proto.Message) { xxx_messageInfo_TransactionV4Logs.Merge(m, src) } + func (m *TransactionV4Logs) XXX_Size() int { return m.Size() } + func (m *TransactionV4Logs) XXX_DiscardUnknown() { xxx_messageInfo_TransactionV4Logs.DiscardUnknown(m) } @@ -401,9 +429,11 @@ func (*V4Log) ProtoMessage() {} func (*V4Log) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{5} } + func (m *V4Log) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V4Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V4Log.Marshal(b, m, deterministic) @@ -416,12 +446,15 @@ func (m *V4Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *V4Log) XXX_Merge(src proto.Message) { xxx_messageInfo_V4Log.Merge(m, src) } + func (m *V4Log) XXX_Size() int { return m.Size() } + func (m *V4Log) XXX_DiscardUnknown() { xxx_messageInfo_V4Log.DiscardUnknown(m) } @@ -516,9 +549,11 @@ func (*V4TxResult) ProtoMessage() {} func (*V4TxResult) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{6} } + func (m *V4TxResult) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V4TxResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V4TxResult.Marshal(b, m, deterministic) @@ -531,12 +566,15 @@ func (m *V4TxResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *V4TxResult) XXX_Merge(src proto.Message) { xxx_messageInfo_V4TxResult.Merge(m, src) } + func (m *V4TxResult) XXX_Size() int { return m.Size() } + func (m *V4TxResult) XXX_DiscardUnknown() { xxx_messageInfo_V4TxResult.DiscardUnknown(m) } @@ -557,9 +595,11 @@ func (*V4AccessTuple) ProtoMessage() {} func (*V4AccessTuple) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{7} } + func (m *V4AccessTuple) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V4AccessTuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V4AccessTuple.Marshal(b, m, deterministic) @@ -572,12 +612,15 @@ func (m *V4AccessTuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } + func (m *V4AccessTuple) XXX_Merge(src proto.Message) { xxx_messageInfo_V4AccessTuple.Merge(m, src) } + func (m *V4AccessTuple) XXX_Size() int { return m.Size() } + func (m *V4AccessTuple) XXX_DiscardUnknown() { xxx_messageInfo_V4AccessTuple.DiscardUnknown(m) } @@ -617,9 +660,11 @@ func (*V4TraceConfig) ProtoMessage() {} func (*V4TraceConfig) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{8} } + func (m *V4TraceConfig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V4TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V4TraceConfig.Marshal(b, m, deterministic) @@ -632,12 +677,15 @@ func (m *V4TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } + func (m *V4TraceConfig) XXX_Merge(src proto.Message) { xxx_messageInfo_V4TraceConfig.Merge(m, src) } + func (m *V4TraceConfig) XXX_Size() int { return m.Size() } + func (m *V4TraceConfig) XXX_DiscardUnknown() { xxx_messageInfo_V4TraceConfig.DiscardUnknown(m) } @@ -1621,6 +1669,7 @@ func encodeVarintEvm(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *V4Params) Size() (n int) { if m == nil { return 0 @@ -1923,9 +1972,11 @@ func (m *V4TraceConfig) Size() (n int) { func sovEvm(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozEvm(x uint64) (n int) { return sovEvm(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *V4Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2134,6 +2185,7 @@ func (m *V4Params) Unmarshal(dAtA []byte) error { } return nil } + func (m *ExtraEIPs) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2260,6 +2312,7 @@ func (m *ExtraEIPs) Unmarshal(dAtA []byte) error { } return nil } + func (m *V4ChainConfig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2974,6 +3027,7 @@ func (m *V4ChainConfig) Unmarshal(dAtA []byte) error { } return nil } + func (m *V4State) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3088,6 +3142,7 @@ func (m *V4State) Unmarshal(dAtA []byte) error { } return nil } + func (m *TransactionV4Logs) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3204,6 +3259,7 @@ func (m *TransactionV4Logs) Unmarshal(dAtA []byte) error { } return nil } + func (m *V4Log) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3493,6 +3549,7 @@ func (m *V4Log) Unmarshal(dAtA []byte) error { } return nil } + func (m *V4TxResult) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3715,6 +3772,7 @@ func (m *V4TxResult) Unmarshal(dAtA []byte) error { } return nil } + func (m *V4AccessTuple) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3829,6 +3887,7 @@ func (m *V4AccessTuple) Unmarshal(dAtA []byte) error { } return nil } + func (m *V4TraceConfig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4149,6 +4208,7 @@ func (m *V4TraceConfig) Unmarshal(dAtA []byte) error { } return nil } + func skipEvm(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/evm/migrations/v5/types/evm.pb.go b/x/evm/migrations/v5/types/evm.pb.go index 1d873e4d24..f77b7e07be 100644 --- a/x/evm/migrations/v5/types/evm.pb.go +++ b/x/evm/migrations/v5/types/evm.pb.go @@ -5,17 +5,20 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -35,9 +38,11 @@ func (*V5ExtraEIPs) ProtoMessage() {} func (*V5ExtraEIPs) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{1} } + func (m *V5ExtraEIPs) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V5ExtraEIPs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V5ExtraEIPs.Marshal(b, m, deterministic) @@ -50,12 +55,15 @@ func (m *V5ExtraEIPs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *V5ExtraEIPs) XXX_Merge(src proto.Message) { xxx_messageInfo_V5ExtraEIPs.Merge(m, src) } + func (m *V5ExtraEIPs) XXX_Size() int { return m.Size() } + func (m *V5ExtraEIPs) XXX_DiscardUnknown() { xxx_messageInfo_V5ExtraEIPs.DiscardUnknown(m) } @@ -255,6 +263,7 @@ func (m *V5ExtraEIPs) Size() (n int) { func sovEvm(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozEvm(x uint64) (n int) { return sovEvm(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } diff --git a/x/evm/types/events.pb.go b/x/evm/types/events.pb.go index 306ed674fa..acbcafdeec 100644 --- a/x/evm/types/events.pb.go +++ b/x/evm/types/events.pb.go @@ -5,16 +5,19 @@ package types import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -46,9 +49,11 @@ func (*EventEthereumTx) ProtoMessage() {} func (*EventEthereumTx) Descriptor() ([]byte, []int) { return fileDescriptor_432e0d592184bde3, []int{0} } + func (m *EventEthereumTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EventEthereumTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EventEthereumTx.Marshal(b, m, deterministic) @@ -61,12 +66,15 @@ func (m *EventEthereumTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } + func (m *EventEthereumTx) XXX_Merge(src proto.Message) { xxx_messageInfo_EventEthereumTx.Merge(m, src) } + func (m *EventEthereumTx) XXX_Size() int { return m.Size() } + func (m *EventEthereumTx) XXX_DiscardUnknown() { xxx_messageInfo_EventEthereumTx.DiscardUnknown(m) } @@ -134,9 +142,11 @@ func (*EventTxLog) ProtoMessage() {} func (*EventTxLog) Descriptor() ([]byte, []int) { return fileDescriptor_432e0d592184bde3, []int{1} } + func (m *EventTxLog) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EventTxLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EventTxLog.Marshal(b, m, deterministic) @@ -149,12 +159,15 @@ func (m *EventTxLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *EventTxLog) XXX_Merge(src proto.Message) { xxx_messageInfo_EventTxLog.Merge(m, src) } + func (m *EventTxLog) XXX_Size() int { return m.Size() } + func (m *EventTxLog) XXX_DiscardUnknown() { xxx_messageInfo_EventTxLog.DiscardUnknown(m) } @@ -184,9 +197,11 @@ func (*EventMessage) ProtoMessage() {} func (*EventMessage) Descriptor() ([]byte, []int) { return fileDescriptor_432e0d592184bde3, []int{2} } + func (m *EventMessage) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EventMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EventMessage.Marshal(b, m, deterministic) @@ -199,12 +214,15 @@ func (m *EventMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *EventMessage) XXX_Merge(src proto.Message) { xxx_messageInfo_EventMessage.Merge(m, src) } + func (m *EventMessage) XXX_Size() int { return m.Size() } + func (m *EventMessage) XXX_DiscardUnknown() { xxx_messageInfo_EventMessage.DiscardUnknown(m) } @@ -244,9 +262,11 @@ func (*EventBlockBloom) ProtoMessage() {} func (*EventBlockBloom) Descriptor() ([]byte, []int) { return fileDescriptor_432e0d592184bde3, []int{3} } + func (m *EventBlockBloom) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EventBlockBloom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EventBlockBloom.Marshal(b, m, deterministic) @@ -259,12 +279,15 @@ func (m *EventBlockBloom) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } + func (m *EventBlockBloom) XXX_Merge(src proto.Message) { xxx_messageInfo_EventBlockBloom.Merge(m, src) } + func (m *EventBlockBloom) XXX_Size() int { return m.Size() } + func (m *EventBlockBloom) XXX_DiscardUnknown() { xxx_messageInfo_EventBlockBloom.DiscardUnknown(m) } @@ -503,6 +526,7 @@ func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *EventEthereumTx) Size() (n int) { if m == nil { return 0 @@ -592,9 +616,11 @@ func (m *EventBlockBloom) Size() (n int) { func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozEvents(x uint64) (n int) { return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *EventEthereumTx) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -869,6 +895,7 @@ func (m *EventEthereumTx) Unmarshal(dAtA []byte) error { } return nil } + func (m *EventTxLog) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -951,6 +978,7 @@ func (m *EventTxLog) Unmarshal(dAtA []byte) error { } return nil } + func (m *EventMessage) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1097,6 +1125,7 @@ func (m *EventMessage) Unmarshal(dAtA []byte) error { } return nil } + func (m *EventBlockBloom) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1179,6 +1208,7 @@ func (m *EventBlockBloom) Unmarshal(dAtA []byte) error { } return nil } + func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/evm/types/evm.pb.go b/x/evm/types/evm.pb.go index 180fa8e7b1..3d42f808c1 100644 --- a/x/evm/types/evm.pb.go +++ b/x/evm/types/evm.pb.go @@ -5,18 +5,21 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -48,9 +51,11 @@ func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{0} } + func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Params.Marshal(b, m, deterministic) @@ -63,12 +68,15 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Params) XXX_Merge(src proto.Message) { xxx_messageInfo_Params.Merge(m, src) } + func (m *Params) XXX_Size() int { return m.Size() } + func (m *Params) XXX_DiscardUnknown() { xxx_messageInfo_Params.DiscardUnknown(m) } @@ -167,9 +175,11 @@ func (*ChainConfig) ProtoMessage() {} func (*ChainConfig) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{1} } + func (m *ChainConfig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ChainConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ChainConfig.Marshal(b, m, deterministic) @@ -182,12 +192,15 @@ func (m *ChainConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *ChainConfig) XXX_Merge(src proto.Message) { xxx_messageInfo_ChainConfig.Merge(m, src) } + func (m *ChainConfig) XXX_Size() int { return m.Size() } + func (m *ChainConfig) XXX_DiscardUnknown() { xxx_messageInfo_ChainConfig.DiscardUnknown(m) } @@ -222,9 +235,11 @@ func (*State) ProtoMessage() {} func (*State) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{2} } + func (m *State) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_State.Marshal(b, m, deterministic) @@ -237,12 +252,15 @@ func (m *State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *State) XXX_Merge(src proto.Message) { xxx_messageInfo_State.Merge(m, src) } + func (m *State) XXX_Size() int { return m.Size() } + func (m *State) XXX_DiscardUnknown() { xxx_messageInfo_State.DiscardUnknown(m) } @@ -279,9 +297,11 @@ func (*TransactionLogs) ProtoMessage() {} func (*TransactionLogs) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{3} } + func (m *TransactionLogs) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *TransactionLogs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_TransactionLogs.Marshal(b, m, deterministic) @@ -294,12 +314,15 @@ func (m *TransactionLogs) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } + func (m *TransactionLogs) XXX_Merge(src proto.Message) { xxx_messageInfo_TransactionLogs.Merge(m, src) } + func (m *TransactionLogs) XXX_Size() int { return m.Size() } + func (m *TransactionLogs) XXX_DiscardUnknown() { xxx_messageInfo_TransactionLogs.DiscardUnknown(m) } @@ -355,9 +378,11 @@ func (*Log) ProtoMessage() {} func (*Log) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{4} } + func (m *Log) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Log.Marshal(b, m, deterministic) @@ -370,12 +395,15 @@ func (m *Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Log) XXX_Merge(src proto.Message) { xxx_messageInfo_Log.Merge(m, src) } + func (m *Log) XXX_Size() int { return m.Size() } + func (m *Log) XXX_DiscardUnknown() { xxx_messageInfo_Log.DiscardUnknown(m) } @@ -470,9 +498,11 @@ func (*TxResult) ProtoMessage() {} func (*TxResult) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{5} } + func (m *TxResult) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *TxResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_TxResult.Marshal(b, m, deterministic) @@ -485,12 +515,15 @@ func (m *TxResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *TxResult) XXX_Merge(src proto.Message) { xxx_messageInfo_TxResult.Merge(m, src) } + func (m *TxResult) XXX_Size() int { return m.Size() } + func (m *TxResult) XXX_DiscardUnknown() { xxx_messageInfo_TxResult.DiscardUnknown(m) } @@ -511,9 +544,11 @@ func (*AccessTuple) ProtoMessage() {} func (*AccessTuple) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{6} } + func (m *AccessTuple) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *AccessTuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AccessTuple.Marshal(b, m, deterministic) @@ -526,12 +561,15 @@ func (m *AccessTuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *AccessTuple) XXX_Merge(src proto.Message) { xxx_messageInfo_AccessTuple.Merge(m, src) } + func (m *AccessTuple) XXX_Size() int { return m.Size() } + func (m *AccessTuple) XXX_DiscardUnknown() { xxx_messageInfo_AccessTuple.DiscardUnknown(m) } @@ -571,9 +609,11 @@ func (*TraceConfig) ProtoMessage() {} func (*TraceConfig) Descriptor() ([]byte, []int) { return fileDescriptor_d21ecc92c8c8583e, []int{7} } + func (m *TraceConfig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_TraceConfig.Marshal(b, m, deterministic) @@ -586,12 +626,15 @@ func (m *TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *TraceConfig) XXX_Merge(src proto.Message) { xxx_messageInfo_TraceConfig.Merge(m, src) } + func (m *TraceConfig) XXX_Size() int { return m.Size() } + func (m *TraceConfig) XXX_DiscardUnknown() { xxx_messageInfo_TraceConfig.DiscardUnknown(m) } @@ -1539,6 +1582,7 @@ func encodeVarintEvm(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *Params) Size() (n int) { if m == nil { return 0 @@ -1830,9 +1874,11 @@ func (m *TraceConfig) Size() (n int) { func sovEvm(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozEvm(x uint64) (n int) { return sovEvm(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2084,6 +2130,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } + func (m *ChainConfig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2798,6 +2845,7 @@ func (m *ChainConfig) Unmarshal(dAtA []byte) error { } return nil } + func (m *State) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2912,6 +2960,7 @@ func (m *State) Unmarshal(dAtA []byte) error { } return nil } + func (m *TransactionLogs) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3028,6 +3077,7 @@ func (m *TransactionLogs) Unmarshal(dAtA []byte) error { } return nil } + func (m *Log) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3317,6 +3367,7 @@ func (m *Log) Unmarshal(dAtA []byte) error { } return nil } + func (m *TxResult) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3539,6 +3590,7 @@ func (m *TxResult) Unmarshal(dAtA []byte) error { } return nil } + func (m *AccessTuple) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3653,6 +3705,7 @@ func (m *AccessTuple) Unmarshal(dAtA []byte) error { } return nil } + func (m *TraceConfig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3973,6 +4026,7 @@ func (m *TraceConfig) Unmarshal(dAtA []byte) error { } return nil } + func skipEvm(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/evm/types/genesis.pb.go b/x/evm/types/genesis.pb.go index 9ad847bd39..7bdeb22541 100644 --- a/x/evm/types/genesis.pb.go +++ b/x/evm/types/genesis.pb.go @@ -5,17 +5,20 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -37,9 +40,11 @@ func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_9bcdec50cc9d156d, []int{0} } + func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) @@ -52,12 +57,15 @@ func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState.Merge(m, src) } + func (m *GenesisState) XXX_Size() int { return m.Size() } + func (m *GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState.DiscardUnknown(m) } @@ -96,9 +104,11 @@ func (*GenesisAccount) ProtoMessage() {} func (*GenesisAccount) Descriptor() ([]byte, []int) { return fileDescriptor_9bcdec50cc9d156d, []int{1} } + func (m *GenesisAccount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *GenesisAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisAccount.Marshal(b, m, deterministic) @@ -111,12 +121,15 @@ func (m *GenesisAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } + func (m *GenesisAccount) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisAccount.Merge(m, src) } + func (m *GenesisAccount) XXX_Size() int { return m.Size() } + func (m *GenesisAccount) XXX_DiscardUnknown() { xxx_messageInfo_GenesisAccount.DiscardUnknown(m) } @@ -283,6 +296,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -326,9 +340,11 @@ func (m *GenesisAccount) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -446,6 +462,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func (m *GenesisAccount) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -594,6 +611,7 @@ func (m *GenesisAccount) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/evm/types/query.pb.go b/x/evm/types/query.pb.go index 82466dee11..b54f13bb3d 100644 --- a/x/evm/types/query.pb.go +++ b/x/evm/types/query.pb.go @@ -6,6 +6,11 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + time "time" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" @@ -17,17 +22,15 @@ import ( codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf + _ = time.Kitchen +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -47,9 +50,11 @@ func (*QueryAccountRequest) ProtoMessage() {} func (*QueryAccountRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{0} } + func (m *QueryAccountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryAccountRequest.Marshal(b, m, deterministic) @@ -62,12 +67,15 @@ func (m *QueryAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryAccountRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryAccountRequest.Merge(m, src) } + func (m *QueryAccountRequest) XXX_Size() int { return m.Size() } + func (m *QueryAccountRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryAccountRequest.DiscardUnknown(m) } @@ -90,9 +98,11 @@ func (*QueryAccountResponse) ProtoMessage() {} func (*QueryAccountResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{1} } + func (m *QueryAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryAccountResponse.Marshal(b, m, deterministic) @@ -105,12 +115,15 @@ func (m *QueryAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } + func (m *QueryAccountResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryAccountResponse.Merge(m, src) } + func (m *QueryAccountResponse) XXX_Size() int { return m.Size() } + func (m *QueryAccountResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryAccountResponse.DiscardUnknown(m) } @@ -151,9 +164,11 @@ func (*QueryCosmosAccountRequest) ProtoMessage() {} func (*QueryCosmosAccountRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{2} } + func (m *QueryCosmosAccountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCosmosAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCosmosAccountRequest.Marshal(b, m, deterministic) @@ -166,12 +181,15 @@ func (m *QueryCosmosAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } + func (m *QueryCosmosAccountRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCosmosAccountRequest.Merge(m, src) } + func (m *QueryCosmosAccountRequest) XXX_Size() int { return m.Size() } + func (m *QueryCosmosAccountRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryCosmosAccountRequest.DiscardUnknown(m) } @@ -195,9 +213,11 @@ func (*QueryCosmosAccountResponse) ProtoMessage() {} func (*QueryCosmosAccountResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{3} } + func (m *QueryCosmosAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCosmosAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCosmosAccountResponse.Marshal(b, m, deterministic) @@ -210,12 +230,15 @@ func (m *QueryCosmosAccountResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } + func (m *QueryCosmosAccountResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCosmosAccountResponse.Merge(m, src) } + func (m *QueryCosmosAccountResponse) XXX_Size() int { return m.Size() } + func (m *QueryCosmosAccountResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryCosmosAccountResponse.DiscardUnknown(m) } @@ -256,9 +279,11 @@ func (*QueryValidatorAccountRequest) ProtoMessage() {} func (*QueryValidatorAccountRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{4} } + func (m *QueryValidatorAccountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryValidatorAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryValidatorAccountRequest.Marshal(b, m, deterministic) @@ -271,12 +296,15 @@ func (m *QueryValidatorAccountRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryValidatorAccountRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryValidatorAccountRequest.Merge(m, src) } + func (m *QueryValidatorAccountRequest) XXX_Size() int { return m.Size() } + func (m *QueryValidatorAccountRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryValidatorAccountRequest.DiscardUnknown(m) } @@ -300,9 +328,11 @@ func (*QueryValidatorAccountResponse) ProtoMessage() {} func (*QueryValidatorAccountResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{5} } + func (m *QueryValidatorAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryValidatorAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryValidatorAccountResponse.Marshal(b, m, deterministic) @@ -315,12 +345,15 @@ func (m *QueryValidatorAccountResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } + func (m *QueryValidatorAccountResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryValidatorAccountResponse.Merge(m, src) } + func (m *QueryValidatorAccountResponse) XXX_Size() int { return m.Size() } + func (m *QueryValidatorAccountResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryValidatorAccountResponse.DiscardUnknown(m) } @@ -360,9 +393,11 @@ func (*QueryBalanceRequest) ProtoMessage() {} func (*QueryBalanceRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{6} } + func (m *QueryBalanceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryBalanceRequest.Marshal(b, m, deterministic) @@ -375,12 +410,15 @@ func (m *QueryBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryBalanceRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryBalanceRequest.Merge(m, src) } + func (m *QueryBalanceRequest) XXX_Size() int { return m.Size() } + func (m *QueryBalanceRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryBalanceRequest.DiscardUnknown(m) } @@ -399,9 +437,11 @@ func (*QueryBalanceResponse) ProtoMessage() {} func (*QueryBalanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{7} } + func (m *QueryBalanceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryBalanceResponse.Marshal(b, m, deterministic) @@ -414,12 +454,15 @@ func (m *QueryBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } + func (m *QueryBalanceResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryBalanceResponse.Merge(m, src) } + func (m *QueryBalanceResponse) XXX_Size() int { return m.Size() } + func (m *QueryBalanceResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryBalanceResponse.DiscardUnknown(m) } @@ -447,9 +490,11 @@ func (*QueryStorageRequest) ProtoMessage() {} func (*QueryStorageRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{8} } + func (m *QueryStorageRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryStorageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStorageRequest.Marshal(b, m, deterministic) @@ -462,12 +507,15 @@ func (m *QueryStorageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryStorageRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStorageRequest.Merge(m, src) } + func (m *QueryStorageRequest) XXX_Size() int { return m.Size() } + func (m *QueryStorageRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryStorageRequest.DiscardUnknown(m) } @@ -487,9 +535,11 @@ func (*QueryStorageResponse) ProtoMessage() {} func (*QueryStorageResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{9} } + func (m *QueryStorageResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryStorageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStorageResponse.Marshal(b, m, deterministic) @@ -502,12 +552,15 @@ func (m *QueryStorageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } + func (m *QueryStorageResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStorageResponse.Merge(m, src) } + func (m *QueryStorageResponse) XXX_Size() int { return m.Size() } + func (m *QueryStorageResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryStorageResponse.DiscardUnknown(m) } @@ -533,9 +586,11 @@ func (*QueryCodeRequest) ProtoMessage() {} func (*QueryCodeRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{10} } + func (m *QueryCodeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodeRequest.Marshal(b, m, deterministic) @@ -548,12 +603,15 @@ func (m *QueryCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } + func (m *QueryCodeRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodeRequest.Merge(m, src) } + func (m *QueryCodeRequest) XXX_Size() int { return m.Size() } + func (m *QueryCodeRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodeRequest.DiscardUnknown(m) } @@ -573,9 +631,11 @@ func (*QueryCodeResponse) ProtoMessage() {} func (*QueryCodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{11} } + func (m *QueryCodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodeResponse.Marshal(b, m, deterministic) @@ -588,12 +648,15 @@ func (m *QueryCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } + func (m *QueryCodeResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodeResponse.Merge(m, src) } + func (m *QueryCodeResponse) XXX_Size() int { return m.Size() } + func (m *QueryCodeResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodeResponse.DiscardUnknown(m) } @@ -621,9 +684,11 @@ func (*QueryTxLogsRequest) ProtoMessage() {} func (*QueryTxLogsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{12} } + func (m *QueryTxLogsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryTxLogsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryTxLogsRequest.Marshal(b, m, deterministic) @@ -636,12 +701,15 @@ func (m *QueryTxLogsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryTxLogsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryTxLogsRequest.Merge(m, src) } + func (m *QueryTxLogsRequest) XXX_Size() int { return m.Size() } + func (m *QueryTxLogsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryTxLogsRequest.DiscardUnknown(m) } @@ -662,9 +730,11 @@ func (*QueryTxLogsResponse) ProtoMessage() {} func (*QueryTxLogsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{13} } + func (m *QueryTxLogsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryTxLogsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryTxLogsResponse.Marshal(b, m, deterministic) @@ -677,12 +747,15 @@ func (m *QueryTxLogsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryTxLogsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryTxLogsResponse.Merge(m, src) } + func (m *QueryTxLogsResponse) XXX_Size() int { return m.Size() } + func (m *QueryTxLogsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryTxLogsResponse.DiscardUnknown(m) } @@ -704,8 +777,7 @@ func (m *QueryTxLogsResponse) GetPagination() *query.PageResponse { } // QueryParamsRequest defines the request type for querying x/evm parameters. -type QueryParamsRequest struct { -} +type QueryParamsRequest struct{} func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } @@ -713,9 +785,11 @@ func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{14} } + func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) @@ -728,12 +802,15 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsRequest.Merge(m, src) } + func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } + func (m *QueryParamsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } @@ -752,9 +829,11 @@ func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{15} } + func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) @@ -767,12 +846,15 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsResponse.Merge(m, src) } + func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } + func (m *QueryParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } @@ -804,9 +886,11 @@ func (*EthCallRequest) ProtoMessage() {} func (*EthCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{16} } + func (m *EthCallRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EthCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EthCallRequest.Marshal(b, m, deterministic) @@ -819,12 +903,15 @@ func (m *EthCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } + func (m *EthCallRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_EthCallRequest.Merge(m, src) } + func (m *EthCallRequest) XXX_Size() int { return m.Size() } + func (m *EthCallRequest) XXX_DiscardUnknown() { xxx_messageInfo_EthCallRequest.DiscardUnknown(m) } @@ -871,9 +958,11 @@ func (*EstimateGasResponse) ProtoMessage() {} func (*EstimateGasResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{17} } + func (m *EstimateGasResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EstimateGasResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EstimateGasResponse.Marshal(b, m, deterministic) @@ -886,12 +975,15 @@ func (m *EstimateGasResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *EstimateGasResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_EstimateGasResponse.Merge(m, src) } + func (m *EstimateGasResponse) XXX_Size() int { return m.Size() } + func (m *EstimateGasResponse) XXX_DiscardUnknown() { xxx_messageInfo_EstimateGasResponse.DiscardUnknown(m) } @@ -932,9 +1024,11 @@ func (*QueryTraceTxRequest) ProtoMessage() {} func (*QueryTraceTxRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{18} } + func (m *QueryTraceTxRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryTraceTxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryTraceTxRequest.Marshal(b, m, deterministic) @@ -947,12 +1041,15 @@ func (m *QueryTraceTxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryTraceTxRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryTraceTxRequest.Merge(m, src) } + func (m *QueryTraceTxRequest) XXX_Size() int { return m.Size() } + func (m *QueryTraceTxRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryTraceTxRequest.DiscardUnknown(m) } @@ -1027,9 +1124,11 @@ func (*QueryTraceTxResponse) ProtoMessage() {} func (*QueryTraceTxResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{19} } + func (m *QueryTraceTxResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryTraceTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryTraceTxResponse.Marshal(b, m, deterministic) @@ -1042,12 +1141,15 @@ func (m *QueryTraceTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } + func (m *QueryTraceTxResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryTraceTxResponse.Merge(m, src) } + func (m *QueryTraceTxResponse) XXX_Size() int { return m.Size() } + func (m *QueryTraceTxResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryTraceTxResponse.DiscardUnknown(m) } @@ -1085,9 +1187,11 @@ func (*QueryTraceBlockRequest) ProtoMessage() {} func (*QueryTraceBlockRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{20} } + func (m *QueryTraceBlockRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryTraceBlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryTraceBlockRequest.Marshal(b, m, deterministic) @@ -1100,12 +1204,15 @@ func (m *QueryTraceBlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *QueryTraceBlockRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryTraceBlockRequest.Merge(m, src) } + func (m *QueryTraceBlockRequest) XXX_Size() int { return m.Size() } + func (m *QueryTraceBlockRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryTraceBlockRequest.DiscardUnknown(m) } @@ -1173,9 +1280,11 @@ func (*QueryTraceBlockResponse) ProtoMessage() {} func (*QueryTraceBlockResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{21} } + func (m *QueryTraceBlockResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryTraceBlockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryTraceBlockResponse.Marshal(b, m, deterministic) @@ -1188,12 +1297,15 @@ func (m *QueryTraceBlockResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *QueryTraceBlockResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryTraceBlockResponse.Merge(m, src) } + func (m *QueryTraceBlockResponse) XXX_Size() int { return m.Size() } + func (m *QueryTraceBlockResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryTraceBlockResponse.DiscardUnknown(m) } @@ -1209,8 +1321,7 @@ func (m *QueryTraceBlockResponse) GetData() []byte { // QueryBaseFeeRequest defines the request type for querying the EIP1559 base // fee. -type QueryBaseFeeRequest struct { -} +type QueryBaseFeeRequest struct{} func (m *QueryBaseFeeRequest) Reset() { *m = QueryBaseFeeRequest{} } func (m *QueryBaseFeeRequest) String() string { return proto.CompactTextString(m) } @@ -1218,9 +1329,11 @@ func (*QueryBaseFeeRequest) ProtoMessage() {} func (*QueryBaseFeeRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{22} } + func (m *QueryBaseFeeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryBaseFeeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryBaseFeeRequest.Marshal(b, m, deterministic) @@ -1233,12 +1346,15 @@ func (m *QueryBaseFeeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryBaseFeeRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryBaseFeeRequest.Merge(m, src) } + func (m *QueryBaseFeeRequest) XXX_Size() int { return m.Size() } + func (m *QueryBaseFeeRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryBaseFeeRequest.DiscardUnknown(m) } @@ -1257,9 +1373,11 @@ func (*QueryBaseFeeResponse) ProtoMessage() {} func (*QueryBaseFeeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e15a877459347994, []int{23} } + func (m *QueryBaseFeeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryBaseFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryBaseFeeResponse.Marshal(b, m, deterministic) @@ -1272,12 +1390,15 @@ func (m *QueryBaseFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } + func (m *QueryBaseFeeResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryBaseFeeResponse.Merge(m, src) } + func (m *QueryBaseFeeResponse) XXX_Size() int { return m.Size() } + func (m *QueryBaseFeeResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryBaseFeeResponse.DiscardUnknown(m) } @@ -1408,8 +1529,10 @@ var fileDescriptor_e15a877459347994 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -1596,42 +1719,52 @@ type QueryServer interface { } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +type UnimplementedQueryServer struct{} func (*UnimplementedQueryServer) Account(ctx context.Context, req *QueryAccountRequest) (*QueryAccountResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Account not implemented") } + func (*UnimplementedQueryServer) CosmosAccount(ctx context.Context, req *QueryCosmosAccountRequest) (*QueryCosmosAccountResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CosmosAccount not implemented") } + func (*UnimplementedQueryServer) ValidatorAccount(ctx context.Context, req *QueryValidatorAccountRequest) (*QueryValidatorAccountResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ValidatorAccount not implemented") } + func (*UnimplementedQueryServer) Balance(ctx context.Context, req *QueryBalanceRequest) (*QueryBalanceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented") } + func (*UnimplementedQueryServer) Storage(ctx context.Context, req *QueryStorageRequest) (*QueryStorageResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Storage not implemented") } + func (*UnimplementedQueryServer) Code(ctx context.Context, req *QueryCodeRequest) (*QueryCodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Code not implemented") } + func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } + func (*UnimplementedQueryServer) EthCall(ctx context.Context, req *EthCallRequest) (*MsgEthereumTxResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EthCall not implemented") } + func (*UnimplementedQueryServer) EstimateGas(ctx context.Context, req *EthCallRequest) (*EstimateGasResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EstimateGas not implemented") } + func (*UnimplementedQueryServer) TraceTx(ctx context.Context, req *QueryTraceTxRequest) (*QueryTraceTxResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TraceTx not implemented") } + func (*UnimplementedQueryServer) TraceBlock(ctx context.Context, req *QueryTraceBlockRequest) (*QueryTraceBlockResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TraceBlock not implemented") } + func (*UnimplementedQueryServer) BaseFee(ctx context.Context, req *QueryBaseFeeRequest) (*QueryBaseFeeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BaseFee not implemented") } @@ -2837,6 +2970,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *QueryAccountRequest) Size() (n int) { if m == nil { return 0 @@ -3232,9 +3366,11 @@ func (m *QueryBaseFeeResponse) Size() (n int) { func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *QueryAccountRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3317,6 +3453,7 @@ func (m *QueryAccountRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryAccountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3450,6 +3587,7 @@ func (m *QueryAccountResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCosmosAccountRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3532,6 +3670,7 @@ func (m *QueryCosmosAccountRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCosmosAccountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3652,6 +3791,7 @@ func (m *QueryCosmosAccountResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryValidatorAccountRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3734,6 +3874,7 @@ func (m *QueryValidatorAccountRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryValidatorAccountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3854,6 +3995,7 @@ func (m *QueryValidatorAccountResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryBalanceRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3936,6 +4078,7 @@ func (m *QueryBalanceRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryBalanceResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4018,6 +4161,7 @@ func (m *QueryBalanceResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryStorageRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4132,6 +4276,7 @@ func (m *QueryStorageRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryStorageResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4214,6 +4359,7 @@ func (m *QueryStorageResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4296,6 +4442,7 @@ func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4380,6 +4527,7 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryTxLogsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4498,6 +4646,7 @@ func (m *QueryTxLogsRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryTxLogsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4618,6 +4767,7 @@ func (m *QueryTxLogsResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4668,6 +4818,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4751,6 +4902,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *EthCallRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4907,6 +5059,7 @@ func (m *EthCallRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *EstimateGasResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4976,6 +5129,7 @@ func (m *EstimateGasResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryTraceTxRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5269,6 +5423,7 @@ func (m *QueryTraceTxRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryTraceTxResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5353,6 +5508,7 @@ func (m *QueryTraceTxResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryTraceBlockRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5610,6 +5766,7 @@ func (m *QueryTraceBlockRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryTraceBlockResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5694,6 +5851,7 @@ func (m *QueryTraceBlockResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryBaseFeeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5744,6 +5902,7 @@ func (m *QueryBaseFeeRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryBaseFeeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5830,6 +5989,7 @@ func (m *QueryBaseFeeResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/evm/types/query.pb.gw.go b/x/evm/types/query.pb.gw.go index a7ba3846af..2132d3eaa6 100644 --- a/x/evm/types/query.pb.gw.go +++ b/x/evm/types/query.pb.gw.go @@ -25,13 +25,15 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join +var ( + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join +) func request_Query_Account_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryAccountRequest @@ -57,7 +59,6 @@ func request_Query_Account_0(ctx context.Context, marshaler runtime.Marshaler, c msg, err := client.Account(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Account_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -84,7 +85,6 @@ func local_request_Query_Account_0(ctx context.Context, marshaler runtime.Marsha msg, err := server.Account(ctx, &protoReq) return msg, metadata, err - } func request_Query_CosmosAccount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -111,7 +111,6 @@ func request_Query_CosmosAccount_0(ctx context.Context, marshaler runtime.Marsha msg, err := client.CosmosAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_CosmosAccount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -138,7 +137,6 @@ func local_request_Query_CosmosAccount_0(ctx context.Context, marshaler runtime. msg, err := server.CosmosAccount(ctx, &protoReq) return msg, metadata, err - } func request_Query_ValidatorAccount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -165,7 +163,6 @@ func request_Query_ValidatorAccount_0(ctx context.Context, marshaler runtime.Mar msg, err := client.ValidatorAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_ValidatorAccount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -192,7 +189,6 @@ func local_request_Query_ValidatorAccount_0(ctx context.Context, marshaler runti msg, err := server.ValidatorAccount(ctx, &protoReq) return msg, metadata, err - } func request_Query_Balance_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -219,7 +215,6 @@ func request_Query_Balance_0(ctx context.Context, marshaler runtime.Marshaler, c msg, err := client.Balance(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Balance_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -246,7 +241,6 @@ func local_request_Query_Balance_0(ctx context.Context, marshaler runtime.Marsha msg, err := server.Balance(ctx, &protoReq) return msg, metadata, err - } func request_Query_Storage_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -284,7 +278,6 @@ func request_Query_Storage_0(ctx context.Context, marshaler runtime.Marshaler, c msg, err := client.Storage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Storage_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -322,7 +315,6 @@ func local_request_Query_Storage_0(ctx context.Context, marshaler runtime.Marsha msg, err := server.Storage(ctx, &protoReq) return msg, metadata, err - } func request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -349,7 +341,6 @@ func request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, clie msg, err := client.Code(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -376,7 +367,6 @@ func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler msg, err := server.Code(ctx, &protoReq) return msg, metadata, err - } func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -385,7 +375,6 @@ func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -394,12 +383,9 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Params(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_EthCall_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Query_EthCall_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Query_EthCall_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq EthCallRequest @@ -414,7 +400,6 @@ func request_Query_EthCall_0(ctx context.Context, marshaler runtime.Marshaler, c msg, err := client.EthCall(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_EthCall_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -430,12 +415,9 @@ func local_request_Query_EthCall_0(ctx context.Context, marshaler runtime.Marsha msg, err := server.EthCall(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_EstimateGas_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Query_EstimateGas_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Query_EstimateGas_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq EthCallRequest @@ -450,7 +432,6 @@ func request_Query_EstimateGas_0(ctx context.Context, marshaler runtime.Marshale msg, err := client.EstimateGas(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_EstimateGas_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -466,12 +447,9 @@ func local_request_Query_EstimateGas_0(ctx context.Context, marshaler runtime.Ma msg, err := server.EstimateGas(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_TraceTx_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Query_TraceTx_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Query_TraceTx_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryTraceTxRequest @@ -486,7 +464,6 @@ func request_Query_TraceTx_0(ctx context.Context, marshaler runtime.Marshaler, c msg, err := client.TraceTx(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_TraceTx_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -502,12 +479,9 @@ func local_request_Query_TraceTx_0(ctx context.Context, marshaler runtime.Marsha msg, err := server.TraceTx(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_TraceBlock_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Query_TraceBlock_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Query_TraceBlock_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryTraceBlockRequest @@ -522,7 +496,6 @@ func request_Query_TraceBlock_0(ctx context.Context, marshaler runtime.Marshaler msg, err := client.TraceBlock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_TraceBlock_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -538,7 +511,6 @@ func local_request_Query_TraceBlock_0(ctx context.Context, marshaler runtime.Mar msg, err := server.TraceBlock(ctx, &protoReq) return msg, metadata, err - } func request_Query_BaseFee_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -547,7 +519,6 @@ func request_Query_BaseFee_0(ctx context.Context, marshaler runtime.Marshaler, c msg, err := client.BaseFee(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_BaseFee_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -556,7 +527,6 @@ func local_request_Query_BaseFee_0(ctx context.Context, marshaler runtime.Marsha msg, err := server.BaseFee(ctx, &protoReq) return msg, metadata, err - } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -564,7 +534,6 @@ func local_request_Query_BaseFee_0(ctx context.Context, marshaler runtime.Marsha // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Account_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -585,7 +554,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Account_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_CosmosAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -608,7 +576,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_CosmosAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ValidatorAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -631,7 +598,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ValidatorAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Balance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -654,7 +620,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Balance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Storage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -677,7 +642,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Storage_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -700,7 +664,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -723,7 +686,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_EthCall_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -746,7 +708,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_EthCall_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_EstimateGas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -769,7 +730,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_EstimateGas_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_TraceTx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -792,7 +752,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_TraceTx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_TraceBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -815,7 +774,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_TraceBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_BaseFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -838,7 +796,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_BaseFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -881,7 +838,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Account_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -899,7 +855,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Account_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_CosmosAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -919,7 +874,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_CosmosAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ValidatorAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -939,7 +893,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ValidatorAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Balance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -959,7 +912,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Balance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Storage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -979,7 +931,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Storage_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -999,7 +950,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1019,7 +969,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_EthCall_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1039,7 +988,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_EthCall_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_EstimateGas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1059,7 +1007,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_EstimateGas_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_TraceTx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1079,7 +1026,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_TraceTx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_TraceBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1099,7 +1045,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_TraceBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_BaseFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1119,7 +1064,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_BaseFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil diff --git a/x/evm/types/tx.pb.go b/x/evm/types/tx.pb.go index e0c24eda14..3f93b4f3b3 100644 --- a/x/evm/types/tx.pb.go +++ b/x/evm/types/tx.pb.go @@ -7,6 +7,10 @@ import ( context "context" encoding_binary "encoding/binary" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -18,15 +22,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -54,9 +57,11 @@ func (*MsgEthereumTx) ProtoMessage() {} func (*MsgEthereumTx) Descriptor() ([]byte, []int) { return fileDescriptor_f75ac0a12d075f21, []int{0} } + func (m *MsgEthereumTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgEthereumTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgEthereumTx.Marshal(b, m, deterministic) @@ -69,12 +74,15 @@ func (m *MsgEthereumTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } + func (m *MsgEthereumTx) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgEthereumTx.Merge(m, src) } + func (m *MsgEthereumTx) XXX_Size() int { return m.Size() } + func (m *MsgEthereumTx) XXX_DiscardUnknown() { xxx_messageInfo_MsgEthereumTx.DiscardUnknown(m) } @@ -111,9 +119,11 @@ func (*LegacyTx) ProtoMessage() {} func (*LegacyTx) Descriptor() ([]byte, []int) { return fileDescriptor_f75ac0a12d075f21, []int{1} } + func (m *LegacyTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *LegacyTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_LegacyTx.Marshal(b, m, deterministic) @@ -126,12 +136,15 @@ func (m *LegacyTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *LegacyTx) XXX_Merge(src proto.Message) { xxx_messageInfo_LegacyTx.Merge(m, src) } + func (m *LegacyTx) XXX_Size() int { return m.Size() } + func (m *LegacyTx) XXX_DiscardUnknown() { xxx_messageInfo_LegacyTx.DiscardUnknown(m) } @@ -170,9 +183,11 @@ func (*AccessListTx) ProtoMessage() {} func (*AccessListTx) Descriptor() ([]byte, []int) { return fileDescriptor_f75ac0a12d075f21, []int{2} } + func (m *AccessListTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *AccessListTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AccessListTx.Marshal(b, m, deterministic) @@ -185,12 +200,15 @@ func (m *AccessListTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *AccessListTx) XXX_Merge(src proto.Message) { xxx_messageInfo_AccessListTx.Merge(m, src) } + func (m *AccessListTx) XXX_Size() int { return m.Size() } + func (m *AccessListTx) XXX_DiscardUnknown() { xxx_messageInfo_AccessListTx.DiscardUnknown(m) } @@ -231,9 +249,11 @@ func (*DynamicFeeTx) ProtoMessage() {} func (*DynamicFeeTx) Descriptor() ([]byte, []int) { return fileDescriptor_f75ac0a12d075f21, []int{3} } + func (m *DynamicFeeTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *DynamicFeeTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_DynamicFeeTx.Marshal(b, m, deterministic) @@ -246,12 +266,15 @@ func (m *DynamicFeeTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *DynamicFeeTx) XXX_Merge(src proto.Message) { xxx_messageInfo_DynamicFeeTx.Merge(m, src) } + func (m *DynamicFeeTx) XXX_Size() int { return m.Size() } + func (m *DynamicFeeTx) XXX_DiscardUnknown() { xxx_messageInfo_DynamicFeeTx.DiscardUnknown(m) } @@ -259,8 +282,7 @@ func (m *DynamicFeeTx) XXX_DiscardUnknown() { var xxx_messageInfo_DynamicFeeTx proto.InternalMessageInfo // ExtensionOptionsEthereumTx is an extension option for ethereum transactions -type ExtensionOptionsEthereumTx struct { -} +type ExtensionOptionsEthereumTx struct{} func (m *ExtensionOptionsEthereumTx) Reset() { *m = ExtensionOptionsEthereumTx{} } func (m *ExtensionOptionsEthereumTx) String() string { return proto.CompactTextString(m) } @@ -268,9 +290,11 @@ func (*ExtensionOptionsEthereumTx) ProtoMessage() {} func (*ExtensionOptionsEthereumTx) Descriptor() ([]byte, []int) { return fileDescriptor_f75ac0a12d075f21, []int{4} } + func (m *ExtensionOptionsEthereumTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ExtensionOptionsEthereumTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ExtensionOptionsEthereumTx.Marshal(b, m, deterministic) @@ -283,12 +307,15 @@ func (m *ExtensionOptionsEthereumTx) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } + func (m *ExtensionOptionsEthereumTx) XXX_Merge(src proto.Message) { xxx_messageInfo_ExtensionOptionsEthereumTx.Merge(m, src) } + func (m *ExtensionOptionsEthereumTx) XXX_Size() int { return m.Size() } + func (m *ExtensionOptionsEthereumTx) XXX_DiscardUnknown() { xxx_messageInfo_ExtensionOptionsEthereumTx.DiscardUnknown(m) } @@ -319,9 +346,11 @@ func (*MsgEthereumTxResponse) ProtoMessage() {} func (*MsgEthereumTxResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f75ac0a12d075f21, []int{5} } + func (m *MsgEthereumTxResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgEthereumTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgEthereumTxResponse.Marshal(b, m, deterministic) @@ -334,12 +363,15 @@ func (m *MsgEthereumTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } + func (m *MsgEthereumTxResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgEthereumTxResponse.Merge(m, src) } + func (m *MsgEthereumTxResponse) XXX_Size() int { return m.Size() } + func (m *MsgEthereumTxResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgEthereumTxResponse.DiscardUnknown(m) } @@ -361,9 +393,11 @@ func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_f75ac0a12d075f21, []int{6} } + func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) @@ -376,12 +410,15 @@ func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } + func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParams.Merge(m, src) } + func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParams) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } @@ -404,8 +441,7 @@ func (m *MsgUpdateParams) GetParams() Params { // MsgUpdateParamsResponse defines the response structure for executing a // MsgUpdateParams message. -type MsgUpdateParamsResponse struct { -} +type MsgUpdateParamsResponse struct{} func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } @@ -413,9 +449,11 @@ func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f75ac0a12d075f21, []int{7} } + func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) @@ -428,12 +466,15 @@ func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } + func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } @@ -519,8 +560,10 @@ var fileDescriptor_f75ac0a12d075f21 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -573,12 +616,12 @@ type MsgServer interface { } // UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} +type UnimplementedMsgServer struct{} func (*UnimplementedMsgServer) EthereumTx(ctx context.Context, req *MsgEthereumTx) (*MsgEthereumTxResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EthereumTx not implemented") } + func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } @@ -1195,6 +1238,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *MsgEthereumTx) Size() (n int) { if m == nil { return 0 @@ -1438,9 +1482,11 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *MsgEthereumTx) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1602,6 +1648,7 @@ func (m *MsgEthereumTx) Unmarshal(dAtA []byte) error { } return nil } + func (m *LegacyTx) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1930,6 +1977,7 @@ func (m *LegacyTx) Unmarshal(dAtA []byte) error { } return nil } + func (m *AccessListTx) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2328,6 +2376,7 @@ func (m *AccessListTx) Unmarshal(dAtA []byte) error { } return nil } + func (m *DynamicFeeTx) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2762,6 +2811,7 @@ func (m *DynamicFeeTx) Unmarshal(dAtA []byte) error { } return nil } + func (m *ExtensionOptionsEthereumTx) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2812,6 +2862,7 @@ func (m *ExtensionOptionsEthereumTx) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgEthereumTxResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3013,6 +3064,7 @@ func (m *MsgEthereumTxResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3128,6 +3180,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3178,6 +3231,7 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/evm/types/tx.pb.gw.go b/x/evm/types/tx.pb.gw.go index 08f7466776..3dab11cdd4 100644 --- a/x/evm/types/tx.pb.gw.go +++ b/x/evm/types/tx.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - var ( - filter_Msg_EthereumTx_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join ) +var filter_Msg_EthereumTx_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + func request_Msg_EthereumTx_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgEthereumTx var metadata runtime.ServerMetadata @@ -50,7 +50,6 @@ func request_Msg_EthereumTx_0(ctx context.Context, marshaler runtime.Marshaler, msg, err := client.EthereumTx(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Msg_EthereumTx_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,7 +65,6 @@ func local_request_Msg_EthereumTx_0(ctx context.Context, marshaler runtime.Marsh msg, err := server.EthereumTx(ctx, &protoReq) return msg, metadata, err - } // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". @@ -74,7 +72,6 @@ func local_request_Msg_EthereumTx_0(ctx context.Context, marshaler runtime.Marsh // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { - mux.Handle("POST", pattern_Msg_EthereumTx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -95,7 +92,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_EthereumTx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -138,7 +134,6 @@ func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.C // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "MsgClient" to call the correct interceptors. func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { - mux.Handle("POST", pattern_Msg_EthereumTx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -156,16 +151,11 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_EthereumTx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil } -var ( - pattern_Msg_EthereumTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"evmos", "evm", "v1", "ethereum_tx"}, "", runtime.AssumeColonVerbOpt(false))) -) +var pattern_Msg_EthereumTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"evmos", "evm", "v1", "ethereum_tx"}, "", runtime.AssumeColonVerbOpt(false))) -var ( - forward_Msg_EthereumTx_0 = runtime.ForwardResponseMessage -) +var forward_Msg_EthereumTx_0 = runtime.ForwardResponseMessage diff --git a/x/feemarket/keeper/integration_test.go b/x/feemarket/keeper/integration_test.go index a99faecf73..447e34ff80 100644 --- a/x/feemarket/keeper/integration_test.go +++ b/x/feemarket/keeper/integration_test.go @@ -1,38 +1,19 @@ package keeper_test import ( - "encoding/json" "math/big" "strings" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - sdkmath "cosmossdk.io/math" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client/tx" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/tx/signing" - authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" - authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/evmos/evmos/v11/app" "github.com/evmos/evmos/v11/crypto/ethsecp256k1" - "github.com/evmos/evmos/v11/encoding" "github.com/evmos/evmos/v11/tests" - "github.com/evmos/evmos/v11/utils" - "github.com/evmos/evmos/v11/x/feemarket/types" - "github.com/cosmos/cosmos-sdk/simapp" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - evmtypes "github.com/evmos/evmos/v11/x/evm/types" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" - dbm "github.com/tendermint/tm-db" ) var _ = Describe("Feemarket", func() { @@ -448,244 +429,3 @@ var _ = Describe("Feemarket", func() { }) }) }) - -// setupTestWithContext sets up a test chain with an example Cosmos send msg, -// given a local (validator config) and a global (feemarket param) minGasPrice -func setupTestWithContext(valMinGasPrice string, minGasPrice sdk.Dec, baseFee sdkmath.Int) (*ethsecp256k1.PrivKey, banktypes.MsgSend) { - privKey, msg := setupTest(valMinGasPrice + s.denom) - params := types.DefaultParams() - params.MinGasPrice = minGasPrice - err := s.app.FeeMarketKeeper.SetParams(s.ctx, params) - s.Require().NoError(err) - s.app.FeeMarketKeeper.SetBaseFee(s.ctx, baseFee.BigInt()) - s.Commit() - - return privKey, msg -} - -func setupTest(localMinGasPrices string) (*ethsecp256k1.PrivKey, banktypes.MsgSend) { - setupChain(localMinGasPrices) - - address, privKey := tests.NewAccAddressAndKey() - amount, ok := sdkmath.NewIntFromString("10000000000000000000") - s.Require().True(ok) - initBalance := sdk.Coins{sdk.Coin{ - Denom: s.denom, - Amount: amount, - }} - err := fundAccount(s.app.BankKeeper, s.ctx, address, initBalance) - s.Require().NoError(err) - - msg := banktypes.MsgSend{ - FromAddress: address.String(), - ToAddress: address.String(), - Amount: sdk.Coins{sdk.Coin{ - Denom: s.denom, - Amount: sdkmath.NewInt(10000), - }}, - } - s.Commit() - return privKey, msg -} - -// fundAccount is a utility function that funds an account by minting and -// sending the coins to the address. -func fundAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error { - if err := bankKeeper.MintCoins(ctx, evmtypes.ModuleName, amounts); err != nil { - return err - } - - return bankKeeper.SendCoinsFromModuleToAccount(ctx, evmtypes.ModuleName, addr, amounts) -} - -func setupChain(localMinGasPricesStr string) { - // Initialize the app, so we can use SetMinGasPrices to set the - // validator-specific min-gas-prices setting - db := dbm.NewMemDB() - newapp := app.NewEvmos( - log.NewNopLogger(), - db, - nil, - true, - map[int64]bool{}, - app.DefaultNodeHome, - 5, - encoding.MakeConfig(app.ModuleBasics), - simapp.EmptyAppOptions{}, - baseapp.SetMinGasPrices(localMinGasPricesStr), - ) - - genesisState := app.NewTestGenesisState(newapp.AppCodec()) - genesisState[types.ModuleName] = newapp.AppCodec().MustMarshalJSON(types.DefaultGenesisState()) - - stateBytes, err := json.MarshalIndent(genesisState, "", " ") - s.Require().NoError(err) - - // Initialize the chain - newapp.InitChain( - abci.RequestInitChain{ - ChainId: utils.TestnetChainID + "-1", - Validators: []abci.ValidatorUpdate{}, - AppStateBytes: stateBytes, - ConsensusParams: app.DefaultConsensusParams, - }, - ) - - s.app = newapp - s.SetupApp(false) -} - -func getNonce(addressBytes []byte) uint64 { - return s.app.EvmKeeper.GetNonce( - s.ctx, - common.BytesToAddress(addressBytes), - ) -} - -func buildEthTx( - priv *ethsecp256k1.PrivKey, - to *common.Address, - gasPrice *big.Int, - gasFeeCap *big.Int, - gasTipCap *big.Int, - accesses *ethtypes.AccessList, -) *evmtypes.MsgEthereumTx { - chainID := s.app.EvmKeeper.ChainID() - from := common.BytesToAddress(priv.PubKey().Address().Bytes()) - nonce := getNonce(from.Bytes()) - data := make([]byte, 0) - gasLimit := uint64(100000) - msgEthereumTx := evmtypes.NewTx( - chainID, - nonce, - to, - nil, - gasLimit, - gasPrice, - gasFeeCap, - gasTipCap, - data, - accesses, - ) - msgEthereumTx.From = from.String() - return msgEthereumTx -} - -func prepareEthTx(priv *ethsecp256k1.PrivKey, msgEthereumTx *evmtypes.MsgEthereumTx) []byte { - encodingConfig := encoding.MakeConfig(app.ModuleBasics) - option, err := codectypes.NewAnyWithValue(&evmtypes.ExtensionOptionsEthereumTx{}) - s.Require().NoError(err) - - txBuilder := encodingConfig.TxConfig.NewTxBuilder() - builder, ok := txBuilder.(authtx.ExtensionOptionsTxBuilder) - s.Require().True(ok) - builder.SetExtensionOptions(option) - - err = msgEthereumTx.Sign(s.ethSigner, tests.NewSigner(priv)) - s.Require().NoError(err) - - msgEthereumTx.From = "" - err = txBuilder.SetMsgs(msgEthereumTx) - s.Require().NoError(err) - - txData, err := evmtypes.UnpackTxData(msgEthereumTx.Data) - s.Require().NoError(err) - - evmDenom := s.app.EvmKeeper.GetParams(s.ctx).EvmDenom - fees := sdk.Coins{{Denom: evmDenom, Amount: sdkmath.NewIntFromBigInt(txData.Fee())}} - builder.SetFeeAmount(fees) - builder.SetGasLimit(msgEthereumTx.GetGas()) - - // bz are bytes to be broadcasted over the network - bz, err := encodingConfig.TxConfig.TxEncoder()(txBuilder.GetTx()) - s.Require().NoError(err) - - return bz -} - -func checkEthTx(priv *ethsecp256k1.PrivKey, msgEthereumTx *evmtypes.MsgEthereumTx) abci.ResponseCheckTx { - bz := prepareEthTx(priv, msgEthereumTx) - req := abci.RequestCheckTx{Tx: bz} - res := s.app.CheckTx(req) - return res -} - -func deliverEthTx(priv *ethsecp256k1.PrivKey, msgEthereumTx *evmtypes.MsgEthereumTx) abci.ResponseDeliverTx { - bz := prepareEthTx(priv, msgEthereumTx) - req := abci.RequestDeliverTx{Tx: bz} - res := s.app.BaseApp.DeliverTx(req) - return res -} - -func prepareCosmosTx(priv *ethsecp256k1.PrivKey, gasPrice *sdkmath.Int, msgs ...sdk.Msg) []byte { - encodingConfig := encoding.MakeConfig(app.ModuleBasics) - accountAddress := sdk.AccAddress(priv.PubKey().Address().Bytes()) - - txBuilder := encodingConfig.TxConfig.NewTxBuilder() - - txBuilder.SetGasLimit(1000000) - if gasPrice == nil { - _gasPrice := sdkmath.NewInt(1) - gasPrice = &_gasPrice - } - fees := &sdk.Coins{{Denom: s.denom, Amount: gasPrice.MulRaw(1000000)}} - txBuilder.SetFeeAmount(*fees) - err := txBuilder.SetMsgs(msgs...) - s.Require().NoError(err) - - seq, err := s.app.AccountKeeper.GetSequence(s.ctx, accountAddress) - s.Require().NoError(err) - - // First round: we gather all the signer infos. We use the "set empty - // signature" hack to do that. - sigV2 := signing.SignatureV2{ - PubKey: priv.PubKey(), - Data: &signing.SingleSignatureData{ - SignMode: encodingConfig.TxConfig.SignModeHandler().DefaultMode(), - Signature: nil, - }, - Sequence: seq, - } - - sigsV2 := []signing.SignatureV2{sigV2} - - err = txBuilder.SetSignatures(sigsV2...) - s.Require().NoError(err) - - // Second round: all signer infos are set, so each signer can sign. - accNumber := s.app.AccountKeeper.GetAccount(s.ctx, accountAddress).GetAccountNumber() - signerData := authsigning.SignerData{ - ChainID: s.ctx.ChainID(), - AccountNumber: accNumber, - Sequence: seq, - } - sigV2, err = tx.SignWithPrivKey( - encodingConfig.TxConfig.SignModeHandler().DefaultMode(), signerData, - txBuilder, priv, encodingConfig.TxConfig, - seq, - ) - s.Require().NoError(err) - - sigsV2 = []signing.SignatureV2{sigV2} - err = txBuilder.SetSignatures(sigsV2...) - s.Require().NoError(err) - - // bz are bytes to be broadcasted over the network - bz, err := encodingConfig.TxConfig.TxEncoder()(txBuilder.GetTx()) - s.Require().NoError(err) - return bz -} - -func checkTx(priv *ethsecp256k1.PrivKey, gasPrice *sdkmath.Int, msgs ...sdk.Msg) abci.ResponseCheckTx { - bz := prepareCosmosTx(priv, gasPrice, msgs...) - req := abci.RequestCheckTx{Tx: bz} - res := s.app.CheckTx(req) - return res -} - -func deliverTx(priv *ethsecp256k1.PrivKey, gasPrice *sdkmath.Int, msgs ...sdk.Msg) abci.ResponseDeliverTx { - bz := prepareCosmosTx(priv, gasPrice, msgs...) - req := abci.RequestDeliverTx{Tx: bz} - res := s.app.BaseApp.DeliverTx(req) - return res -} diff --git a/x/feemarket/keeper/keeper_test.go b/x/feemarket/keeper/keeper_test.go index 2ce5636bab..589caa458d 100644 --- a/x/feemarket/keeper/keeper_test.go +++ b/x/feemarket/keeper/keeper_test.go @@ -3,171 +3,10 @@ package keeper_test import ( _ "embed" "math/big" - "testing" - "time" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/crypto/keyring" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - "github.com/evmos/evmos/v11/app" - "github.com/evmos/evmos/v11/crypto/ethsecp256k1" - "github.com/evmos/evmos/v11/encoding" - "github.com/evmos/evmos/v11/tests" - evmostypes "github.com/evmos/evmos/v11/types" - "github.com/evmos/evmos/v11/utils" - evmtypes "github.com/evmos/evmos/v11/x/evm/types" - "github.com/evmos/evmos/v11/x/feemarket/types" - - "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/tmhash" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmversion "github.com/tendermint/tendermint/proto/tendermint/version" - "github.com/tendermint/tendermint/version" ) -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.Evmos - queryClient types.QueryClient - address common.Address - consAddress sdk.ConsAddress - - // for generate test tx - clientCtx client.Context - ethSigner ethtypes.Signer - - appCodec codec.Codec - signer keyring.Signer - denom string -} - -var s *KeeperTestSuite - -func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) - suite.Run(t, s) - - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") -} - -// SetupTest setup test environment, it uses`require.TestingT` to support both `testing.T` and `testing.B`. -func (suite *KeeperTestSuite) SetupTest() { - checkTx := false - suite.app = app.Setup(checkTx, nil) - suite.SetupApp(checkTx) -} - -func (suite *KeeperTestSuite) SetupApp(checkTx bool) { - t := suite.T() - // account key - priv, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) - suite.signer = tests.NewSigner(priv) - - // consensus key - priv, err = ethsecp256k1.GenerateKey() - require.NoError(t, err) - suite.consAddress = sdk.ConsAddress(priv.PubKey().Address()) - - suite.ctx = suite.app.BaseApp.NewContext(checkTx, tmproto.Header{ - Height: 1, - ChainID: utils.TestnetChainID + "-1", - Time: time.Now().UTC(), - ProposerAddress: suite.consAddress.Bytes(), - Version: tmversion.Consensus{ - Block: version.BlockProtocol, - }, - LastBlockId: tmproto.BlockID{ - Hash: tmhash.Sum([]byte("block_id")), - PartSetHeader: tmproto.PartSetHeader{ - Total: 11, - Hash: tmhash.Sum([]byte("partset_header")), - }, - }, - AppHash: tmhash.Sum([]byte("app")), - DataHash: tmhash.Sum([]byte("data")), - EvidenceHash: tmhash.Sum([]byte("evidence")), - ValidatorsHash: tmhash.Sum([]byte("validators")), - NextValidatorsHash: tmhash.Sum([]byte("next_validators")), - ConsensusHash: tmhash.Sum([]byte("consensus")), - LastResultsHash: tmhash.Sum([]byte("last_result")), - }) - - queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, suite.app.FeeMarketKeeper) - suite.queryClient = types.NewQueryClient(queryHelper) - - acc := &evmostypes.EthAccount{ - BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(suite.address.Bytes()), nil, 0, 0), - CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(), - } - - suite.app.AccountKeeper.SetAccount(suite.ctx, acc) - - valAddr := sdk.ValAddress(suite.address.Bytes()) - validator, err := stakingtypes.NewValidator(valAddr, priv.PubKey(), stakingtypes.Description{}) - require.NoError(t, err) - validator = stakingkeeper.TestingUpdateValidator(suite.app.StakingKeeper, suite.ctx, validator, true) - err = suite.app.StakingKeeper.AfterValidatorCreated(suite.ctx, validator.GetOperator()) - require.NoError(t, err) - - err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) - require.NoError(t, err) - suite.app.StakingKeeper.SetValidator(suite.ctx, validator) - - encodingConfig := encoding.MakeConfig(app.ModuleBasics) - suite.clientCtx = client.Context{}.WithTxConfig(encodingConfig.TxConfig) - suite.ethSigner = ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID()) - suite.appCodec = encodingConfig.Codec - suite.denom = evmtypes.DefaultEVMDenom -} - -// Commit commits and starts a new block with an updated context. -func (suite *KeeperTestSuite) Commit() { - suite.CommitAfter(time.Second * 0) -} - -// Commit commits a block at a given time. -func (suite *KeeperTestSuite) CommitAfter(t time.Duration) { - header := suite.ctx.BlockHeader() - suite.app.EndBlock(abci.RequestEndBlock{Height: header.Height}) - _ = suite.app.Commit() - - header.Height++ - header.Time = header.Time.Add(t) - suite.app.BeginBlock(abci.RequestBeginBlock{ - Header: header, - }) - - // update ctx - suite.ctx = suite.app.BaseApp.NewContext(false, header) - - queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, suite.app.FeeMarketKeeper) - suite.queryClient = types.NewQueryClient(queryHelper) -} - func (suite *KeeperTestSuite) TestSetGetBlockGasWanted() { testCases := []struct { name string diff --git a/x/feemarket/keeper/setup_test.go b/x/feemarket/keeper/setup_test.go new file mode 100644 index 0000000000..74aa966502 --- /dev/null +++ b/x/feemarket/keeper/setup_test.go @@ -0,0 +1,54 @@ +package keeper_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/x/feemarket/types" + "github.com/stretchr/testify/suite" +) + +type KeeperTestSuite struct { + suite.Suite + + ctx sdk.Context + app *app.Evmos + queryClient types.QueryClient + address common.Address + consAddress sdk.ConsAddress + + // for generate test tx + clientCtx client.Context + ethSigner ethtypes.Signer + + appCodec codec.Codec + signer keyring.Signer + denom string +} + +var s *KeeperTestSuite + +func TestKeeperTestSuite(t *testing.T) { + s = new(KeeperTestSuite) + suite.Run(t, s) + + // Run Ginkgo integration tests + RegisterFailHandler(Fail) + RunSpecs(t, "Keeper Suite") +} + +// SetupTest setup test environment, it uses`require.TestingT` to support both `testing.T` and `testing.B`. +func (suite *KeeperTestSuite) SetupTest() { + checkTx := false + suite.app = app.Setup(checkTx, nil) + suite.SetupApp(checkTx) +} diff --git a/x/feemarket/keeper/utils_test.go b/x/feemarket/keeper/utils_test.go new file mode 100644 index 0000000000..6e4cdb3337 --- /dev/null +++ b/x/feemarket/keeper/utils_test.go @@ -0,0 +1,373 @@ +package keeper_test + +import ( + "encoding/json" + "math/big" + "time" + + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/tx" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + 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" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/crypto/ethsecp256k1" + "github.com/evmos/evmos/v11/encoding" + "github.com/evmos/evmos/v11/tests" + evmostypes "github.com/evmos/evmos/v11/types" + evmtypes "github.com/evmos/evmos/v11/x/evm/types" + "github.com/evmos/evmos/v11/x/feemarket/types" + "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" + tmversion "github.com/tendermint/tendermint/proto/tendermint/version" + "github.com/tendermint/tendermint/version" + dbm "github.com/tendermint/tm-db" +) + +func (suite *KeeperTestSuite) SetupApp(checkTx bool) { + t := suite.T() + // account key + priv, err := ethsecp256k1.GenerateKey() + require.NoError(t, err) + suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) + suite.signer = tests.NewSigner(priv) + + // consensus key + priv, err = ethsecp256k1.GenerateKey() + require.NoError(t, err) + suite.consAddress = sdk.ConsAddress(priv.PubKey().Address()) + + suite.ctx = suite.app.BaseApp.NewContext(checkTx, tmproto.Header{ + Height: 1, + ChainID: "evmos_9000-1", + Time: time.Now().UTC(), + ProposerAddress: suite.consAddress.Bytes(), + Version: tmversion.Consensus{ + Block: version.BlockProtocol, + }, + LastBlockId: tmproto.BlockID{ + Hash: tmhash.Sum([]byte("block_id")), + PartSetHeader: tmproto.PartSetHeader{ + Total: 11, + Hash: tmhash.Sum([]byte("partset_header")), + }, + }, + AppHash: tmhash.Sum([]byte("app")), + DataHash: tmhash.Sum([]byte("data")), + EvidenceHash: tmhash.Sum([]byte("evidence")), + ValidatorsHash: tmhash.Sum([]byte("validators")), + NextValidatorsHash: tmhash.Sum([]byte("next_validators")), + ConsensusHash: tmhash.Sum([]byte("consensus")), + LastResultsHash: tmhash.Sum([]byte("last_result")), + }) + + queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, suite.app.FeeMarketKeeper) + suite.queryClient = types.NewQueryClient(queryHelper) + + acc := &evmostypes.EthAccount{ + BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(suite.address.Bytes()), nil, 0, 0), + CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(), + } + + suite.app.AccountKeeper.SetAccount(suite.ctx, acc) + + valAddr := sdk.ValAddress(suite.address.Bytes()) + validator, err := stakingtypes.NewValidator(valAddr, priv.PubKey(), stakingtypes.Description{}) + require.NoError(t, err) + validator = stakingkeeper.TestingUpdateValidator(suite.app.StakingKeeper, suite.ctx, validator, true) + err = suite.app.StakingKeeper.AfterValidatorCreated(suite.ctx, validator.GetOperator()) + require.NoError(t, err) + + err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) + require.NoError(t, err) + suite.app.StakingKeeper.SetValidator(suite.ctx, validator) + + encodingConfig := encoding.MakeConfig(app.ModuleBasics) + suite.clientCtx = client.Context{}.WithTxConfig(encodingConfig.TxConfig) + suite.ethSigner = ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID()) + suite.appCodec = encodingConfig.Codec + suite.denom = evmtypes.DefaultEVMDenom +} + +// Commit commits and starts a new block with an updated context. +func (suite *KeeperTestSuite) Commit() { + suite.CommitAfter(time.Second * 0) +} + +// Commit commits a block at a given time. +func (suite *KeeperTestSuite) CommitAfter(t time.Duration) { + header := suite.ctx.BlockHeader() + suite.app.EndBlock(abci.RequestEndBlock{Height: header.Height}) + _ = suite.app.Commit() + + header.Height++ + header.Time = header.Time.Add(t) + suite.app.BeginBlock(abci.RequestBeginBlock{ + Header: header, + }) + + // update ctx + suite.ctx = suite.app.BaseApp.NewContext(false, header) + + queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, suite.app.FeeMarketKeeper) + suite.queryClient = types.NewQueryClient(queryHelper) +} + +// setupTestWithContext sets up a test chain with an example Cosmos send msg, +// given a local (validator config) and a global (feemarket param) minGasPrice +func setupTestWithContext(valMinGasPrice string, minGasPrice sdk.Dec, baseFee sdkmath.Int) (*ethsecp256k1.PrivKey, banktypes.MsgSend) { + privKey, msg := setupTest(valMinGasPrice + s.denom) + params := types.DefaultParams() + params.MinGasPrice = minGasPrice + err := s.app.FeeMarketKeeper.SetParams(s.ctx, params) + s.Require().NoError(err) + s.app.FeeMarketKeeper.SetBaseFee(s.ctx, baseFee.BigInt()) + s.Commit() + + return privKey, msg +} + +func setupTest(localMinGasPrices string) (*ethsecp256k1.PrivKey, banktypes.MsgSend) { + setupChain(localMinGasPrices) + + address, privKey := tests.NewAccAddressAndKey() + amount, ok := sdkmath.NewIntFromString("10000000000000000000") + s.Require().True(ok) + initBalance := sdk.Coins{sdk.Coin{ + Denom: s.denom, + Amount: amount, + }} + err := fundAccount(s.app.BankKeeper, s.ctx, address, initBalance) + s.Require().NoError(err) + + msg := banktypes.MsgSend{ + FromAddress: address.String(), + ToAddress: address.String(), + Amount: sdk.Coins{sdk.Coin{ + Denom: s.denom, + Amount: sdkmath.NewInt(10000), + }}, + } + s.Commit() + return privKey, msg +} + +// fundAccount is a utility function that funds an account by minting and +// sending the coins to the address. +func fundAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error { + if err := bankKeeper.MintCoins(ctx, evmtypes.ModuleName, amounts); err != nil { + return err + } + + return bankKeeper.SendCoinsFromModuleToAccount(ctx, evmtypes.ModuleName, addr, amounts) +} + +func setupChain(localMinGasPricesStr string) { + // Initialize the app, so we can use SetMinGasPrices to set the + // validator-specific min-gas-prices setting + db := dbm.NewMemDB() + newapp := app.NewEvmos( + log.NewNopLogger(), + db, + nil, + true, + map[int64]bool{}, + app.DefaultNodeHome, + 5, + encoding.MakeConfig(app.ModuleBasics), + simapp.EmptyAppOptions{}, + baseapp.SetMinGasPrices(localMinGasPricesStr), + ) + + genesisState := app.NewTestGenesisState(newapp.AppCodec()) + genesisState[types.ModuleName] = newapp.AppCodec().MustMarshalJSON(types.DefaultGenesisState()) + + stateBytes, err := json.MarshalIndent(genesisState, "", " ") + s.Require().NoError(err) + + // Initialize the chain + newapp.InitChain( + abci.RequestInitChain{ + ChainId: "evmos_9000-1", + Validators: []abci.ValidatorUpdate{}, + AppStateBytes: stateBytes, + ConsensusParams: app.DefaultConsensusParams, + }, + ) + + s.app = newapp + s.SetupApp(false) +} + +func getNonce(addressBytes []byte) uint64 { + return s.app.EvmKeeper.GetNonce( + s.ctx, + common.BytesToAddress(addressBytes), + ) +} + +func buildEthTx( + priv *ethsecp256k1.PrivKey, + to *common.Address, + gasPrice *big.Int, + gasFeeCap *big.Int, + gasTipCap *big.Int, + accesses *ethtypes.AccessList, +) *evmtypes.MsgEthereumTx { + chainID := s.app.EvmKeeper.ChainID() + from := common.BytesToAddress(priv.PubKey().Address().Bytes()) + nonce := getNonce(from.Bytes()) + data := make([]byte, 0) + gasLimit := uint64(100000) + msgEthereumTx := evmtypes.NewTx( + chainID, + nonce, + to, + nil, + gasLimit, + gasPrice, + gasFeeCap, + gasTipCap, + data, + accesses, + ) + msgEthereumTx.From = from.String() + return msgEthereumTx +} + +func prepareEthTx(priv *ethsecp256k1.PrivKey, msgEthereumTx *evmtypes.MsgEthereumTx) []byte { + encodingConfig := encoding.MakeConfig(app.ModuleBasics) + option, err := codectypes.NewAnyWithValue(&evmtypes.ExtensionOptionsEthereumTx{}) + s.Require().NoError(err) + + txBuilder := encodingConfig.TxConfig.NewTxBuilder() + builder, ok := txBuilder.(authtx.ExtensionOptionsTxBuilder) + s.Require().True(ok) + builder.SetExtensionOptions(option) + + err = msgEthereumTx.Sign(s.ethSigner, tests.NewSigner(priv)) + s.Require().NoError(err) + + msgEthereumTx.From = "" + err = txBuilder.SetMsgs(msgEthereumTx) + s.Require().NoError(err) + + txData, err := evmtypes.UnpackTxData(msgEthereumTx.Data) + s.Require().NoError(err) + + evmDenom := s.app.EvmKeeper.GetParams(s.ctx).EvmDenom + fees := sdk.Coins{{Denom: evmDenom, Amount: sdkmath.NewIntFromBigInt(txData.Fee())}} + builder.SetFeeAmount(fees) + builder.SetGasLimit(msgEthereumTx.GetGas()) + + // bz are bytes to be broadcasted over the network + bz, err := encodingConfig.TxConfig.TxEncoder()(txBuilder.GetTx()) + s.Require().NoError(err) + + return bz +} + +func checkEthTx(priv *ethsecp256k1.PrivKey, msgEthereumTx *evmtypes.MsgEthereumTx) abci.ResponseCheckTx { + bz := prepareEthTx(priv, msgEthereumTx) + req := abci.RequestCheckTx{Tx: bz} + res := s.app.CheckTx(req) + return res +} + +func deliverEthTx(priv *ethsecp256k1.PrivKey, msgEthereumTx *evmtypes.MsgEthereumTx) abci.ResponseDeliverTx { + bz := prepareEthTx(priv, msgEthereumTx) + req := abci.RequestDeliverTx{Tx: bz} + res := s.app.BaseApp.DeliverTx(req) + return res +} + +func prepareCosmosTx(priv *ethsecp256k1.PrivKey, gasPrice *sdkmath.Int, msgs ...sdk.Msg) []byte { + encodingConfig := encoding.MakeConfig(app.ModuleBasics) + accountAddress := sdk.AccAddress(priv.PubKey().Address().Bytes()) + + txBuilder := encodingConfig.TxConfig.NewTxBuilder() + + txBuilder.SetGasLimit(1000000) + if gasPrice == nil { + _gasPrice := sdkmath.NewInt(1) + gasPrice = &_gasPrice + } + fees := &sdk.Coins{{Denom: s.denom, Amount: gasPrice.MulRaw(1000000)}} + txBuilder.SetFeeAmount(*fees) + err := txBuilder.SetMsgs(msgs...) + s.Require().NoError(err) + + seq, err := s.app.AccountKeeper.GetSequence(s.ctx, accountAddress) + s.Require().NoError(err) + + // First round: we gather all the signer infos. We use the "set empty + // signature" hack to do that. + sigV2 := signing.SignatureV2{ + PubKey: priv.PubKey(), + Data: &signing.SingleSignatureData{ + SignMode: encodingConfig.TxConfig.SignModeHandler().DefaultMode(), + Signature: nil, + }, + Sequence: seq, + } + + sigsV2 := []signing.SignatureV2{sigV2} + + err = txBuilder.SetSignatures(sigsV2...) + s.Require().NoError(err) + + // Second round: all signer infos are set, so each signer can sign. + accNumber := s.app.AccountKeeper.GetAccount(s.ctx, accountAddress).GetAccountNumber() + signerData := authsigning.SignerData{ + ChainID: s.ctx.ChainID(), + AccountNumber: accNumber, + Sequence: seq, + } + sigV2, err = tx.SignWithPrivKey( + encodingConfig.TxConfig.SignModeHandler().DefaultMode(), signerData, + txBuilder, priv, encodingConfig.TxConfig, + seq, + ) + s.Require().NoError(err) + + sigsV2 = []signing.SignatureV2{sigV2} + err = txBuilder.SetSignatures(sigsV2...) + s.Require().NoError(err) + + // bz are bytes to be broadcasted over the network + bz, err := encodingConfig.TxConfig.TxEncoder()(txBuilder.GetTx()) + s.Require().NoError(err) + return bz +} + +func checkTx(priv *ethsecp256k1.PrivKey, gasPrice *sdkmath.Int, msgs ...sdk.Msg) abci.ResponseCheckTx { + bz := prepareCosmosTx(priv, gasPrice, msgs...) + req := abci.RequestCheckTx{Tx: bz} + res := s.app.CheckTx(req) + return res +} + +func deliverTx(priv *ethsecp256k1.PrivKey, gasPrice *sdkmath.Int, msgs ...sdk.Msg) abci.ResponseDeliverTx { + bz := prepareCosmosTx(priv, gasPrice, msgs...) + req := abci.RequestDeliverTx{Tx: bz} + res := s.app.BaseApp.DeliverTx(req) + return res +} diff --git a/x/feemarket/migrations/v4/types/feemarket.pb.go b/x/feemarket/migrations/v4/types/feemarket.pb.go index 9427769714..80fa6bc169 100644 --- a/x/feemarket/migrations/v4/types/feemarket.pb.go +++ b/x/feemarket/migrations/v4/types/feemarket.pb.go @@ -5,18 +5,21 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -51,9 +54,11 @@ func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_4feb8b20cf98e6e1, []int{0} } + func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Params.Marshal(b, m, deterministic) @@ -66,12 +71,15 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Params) XXX_Merge(src proto.Message) { xxx_messageInfo_Params.Merge(m, src) } + func (m *Params) XXX_Size() int { return m.Size() } + func (m *Params) XXX_DiscardUnknown() { xxx_messageInfo_Params.DiscardUnknown(m) } @@ -232,6 +240,7 @@ func encodeVarintFeemarket(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *Params) Size() (n int) { if m == nil { return 0 @@ -262,9 +271,11 @@ func (m *Params) Size() (n int) { func sovFeemarket(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozFeemarket(x uint64) (n int) { return sovFeemarket(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -494,6 +505,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } + func skipFeemarket(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/feemarket/types/events.pb.go b/x/feemarket/types/events.pb.go index c36c98bdf9..30db10151c 100644 --- a/x/feemarket/types/events.pb.go +++ b/x/feemarket/types/events.pb.go @@ -5,16 +5,19 @@ package types import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -34,9 +37,11 @@ func (*EventFeeMarket) ProtoMessage() {} func (*EventFeeMarket) Descriptor() ([]byte, []int) { return fileDescriptor_c6edce8d670faff7, []int{0} } + func (m *EventFeeMarket) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EventFeeMarket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EventFeeMarket.Marshal(b, m, deterministic) @@ -49,12 +54,15 @@ func (m *EventFeeMarket) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } + func (m *EventFeeMarket) XXX_Merge(src proto.Message) { xxx_messageInfo_EventFeeMarket.Merge(m, src) } + func (m *EventFeeMarket) XXX_Size() int { return m.Size() } + func (m *EventFeeMarket) XXX_DiscardUnknown() { xxx_messageInfo_EventFeeMarket.DiscardUnknown(m) } @@ -82,9 +90,11 @@ func (*EventBlockGas) ProtoMessage() {} func (*EventBlockGas) Descriptor() ([]byte, []int) { return fileDescriptor_c6edce8d670faff7, []int{1} } + func (m *EventBlockGas) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EventBlockGas) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EventBlockGas.Marshal(b, m, deterministic) @@ -97,12 +107,15 @@ func (m *EventBlockGas) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } + func (m *EventBlockGas) XXX_Merge(src proto.Message) { xxx_messageInfo_EventBlockGas.Merge(m, src) } + func (m *EventBlockGas) XXX_Size() int { return m.Size() } + func (m *EventBlockGas) XXX_DiscardUnknown() { xxx_messageInfo_EventBlockGas.DiscardUnknown(m) } @@ -228,6 +241,7 @@ func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *EventFeeMarket) Size() (n int) { if m == nil { return 0 @@ -261,9 +275,11 @@ func (m *EventBlockGas) Size() (n int) { func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozEvents(x uint64) (n int) { return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *EventFeeMarket) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -346,6 +362,7 @@ func (m *EventFeeMarket) Unmarshal(dAtA []byte) error { } return nil } + func (m *EventBlockGas) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -460,6 +477,7 @@ func (m *EventBlockGas) Unmarshal(dAtA []byte) error { } return nil } + func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/feemarket/types/feemarket.pb.go b/x/feemarket/types/feemarket.pb.go index 4c7cc345a4..b523530c85 100644 --- a/x/feemarket/types/feemarket.pb.go +++ b/x/feemarket/types/feemarket.pb.go @@ -5,18 +5,21 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -51,9 +54,11 @@ func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_4feb8b20cf98e6e1, []int{0} } + func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Params.Marshal(b, m, deterministic) @@ -66,12 +71,15 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Params) XXX_Merge(src proto.Message) { xxx_messageInfo_Params.Merge(m, src) } + func (m *Params) XXX_Size() int { return m.Size() } + func (m *Params) XXX_DiscardUnknown() { xxx_messageInfo_Params.DiscardUnknown(m) } @@ -232,6 +240,7 @@ func encodeVarintFeemarket(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *Params) Size() (n int) { if m == nil { return 0 @@ -262,9 +271,11 @@ func (m *Params) Size() (n int) { func sovFeemarket(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozFeemarket(x uint64) (n int) { return sovFeemarket(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -494,6 +505,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } + func skipFeemarket(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/feemarket/types/genesis.pb.go b/x/feemarket/types/genesis.pb.go index 7d02b5aef9..3023b20faa 100644 --- a/x/feemarket/types/genesis.pb.go +++ b/x/feemarket/types/genesis.pb.go @@ -5,17 +5,20 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -38,9 +41,11 @@ func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_6241c21661288629, []int{0} } + func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) @@ -53,12 +58,15 @@ func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState.Merge(m, src) } + func (m *GenesisState) XXX_Size() int { return m.Size() } + func (m *GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState.DiscardUnknown(m) } @@ -156,6 +164,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -173,9 +182,11 @@ func (m *GenesisState) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -278,6 +289,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/feemarket/types/query.pb.go b/x/feemarket/types/query.pb.go index 07e55de72c..fc0f2dfeb3 100644 --- a/x/feemarket/types/query.pb.go +++ b/x/feemarket/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" @@ -14,15 +18,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -31,8 +34,7 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryParamsRequest defines the request type for querying x/evm parameters. -type QueryParamsRequest struct { -} +type QueryParamsRequest struct{} func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } @@ -40,9 +42,11 @@ func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_71a07c1ffd85fde2, []int{0} } + func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) @@ -55,12 +59,15 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsRequest.Merge(m, src) } + func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } + func (m *QueryParamsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } @@ -79,9 +86,11 @@ func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_71a07c1ffd85fde2, []int{1} } + func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) @@ -94,12 +103,15 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsResponse.Merge(m, src) } + func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } + func (m *QueryParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } @@ -115,8 +127,7 @@ func (m *QueryParamsResponse) GetParams() Params { // QueryBaseFeeRequest defines the request type for querying the EIP1559 base // fee. -type QueryBaseFeeRequest struct { -} +type QueryBaseFeeRequest struct{} func (m *QueryBaseFeeRequest) Reset() { *m = QueryBaseFeeRequest{} } func (m *QueryBaseFeeRequest) String() string { return proto.CompactTextString(m) } @@ -124,9 +135,11 @@ func (*QueryBaseFeeRequest) ProtoMessage() {} func (*QueryBaseFeeRequest) Descriptor() ([]byte, []int) { return fileDescriptor_71a07c1ffd85fde2, []int{2} } + func (m *QueryBaseFeeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryBaseFeeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryBaseFeeRequest.Marshal(b, m, deterministic) @@ -139,12 +152,15 @@ func (m *QueryBaseFeeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryBaseFeeRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryBaseFeeRequest.Merge(m, src) } + func (m *QueryBaseFeeRequest) XXX_Size() int { return m.Size() } + func (m *QueryBaseFeeRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryBaseFeeRequest.DiscardUnknown(m) } @@ -163,9 +179,11 @@ func (*QueryBaseFeeResponse) ProtoMessage() {} func (*QueryBaseFeeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_71a07c1ffd85fde2, []int{3} } + func (m *QueryBaseFeeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryBaseFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryBaseFeeResponse.Marshal(b, m, deterministic) @@ -178,12 +196,15 @@ func (m *QueryBaseFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } + func (m *QueryBaseFeeResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryBaseFeeResponse.Merge(m, src) } + func (m *QueryBaseFeeResponse) XXX_Size() int { return m.Size() } + func (m *QueryBaseFeeResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryBaseFeeResponse.DiscardUnknown(m) } @@ -192,8 +213,7 @@ var xxx_messageInfo_QueryBaseFeeResponse proto.InternalMessageInfo // QueryBlockGasRequest defines the request type for querying the EIP1559 base // fee. -type QueryBlockGasRequest struct { -} +type QueryBlockGasRequest struct{} func (m *QueryBlockGasRequest) Reset() { *m = QueryBlockGasRequest{} } func (m *QueryBlockGasRequest) String() string { return proto.CompactTextString(m) } @@ -201,9 +221,11 @@ func (*QueryBlockGasRequest) ProtoMessage() {} func (*QueryBlockGasRequest) Descriptor() ([]byte, []int) { return fileDescriptor_71a07c1ffd85fde2, []int{4} } + func (m *QueryBlockGasRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryBlockGasRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryBlockGasRequest.Marshal(b, m, deterministic) @@ -216,12 +238,15 @@ func (m *QueryBlockGasRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } + func (m *QueryBlockGasRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryBlockGasRequest.Merge(m, src) } + func (m *QueryBlockGasRequest) XXX_Size() int { return m.Size() } + func (m *QueryBlockGasRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryBlockGasRequest.DiscardUnknown(m) } @@ -240,9 +265,11 @@ func (*QueryBlockGasResponse) ProtoMessage() {} func (*QueryBlockGasResponse) Descriptor() ([]byte, []int) { return fileDescriptor_71a07c1ffd85fde2, []int{5} } + func (m *QueryBlockGasResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryBlockGasResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryBlockGasResponse.Marshal(b, m, deterministic) @@ -255,12 +282,15 @@ func (m *QueryBlockGasResponse) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } + func (m *QueryBlockGasResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryBlockGasResponse.Merge(m, src) } + func (m *QueryBlockGasResponse) XXX_Size() int { return m.Size() } + func (m *QueryBlockGasResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryBlockGasResponse.DiscardUnknown(m) } @@ -320,8 +350,10 @@ var fileDescriptor_71a07c1ffd85fde2 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -385,15 +417,16 @@ type QueryServer interface { } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +type UnimplementedQueryServer struct{} func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } + func (*UnimplementedQueryServer) BaseFee(ctx context.Context, req *QueryBaseFeeRequest) (*QueryBaseFeeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BaseFee not implemented") } + func (*UnimplementedQueryServer) BlockGas(ctx context.Context, req *QueryBlockGasRequest) (*QueryBlockGasResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BlockGas not implemented") } @@ -653,6 +686,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *QueryParamsRequest) Size() (n int) { if m == nil { return 0 @@ -719,9 +753,11 @@ func (m *QueryBlockGasResponse) Size() (n int) { func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -772,6 +808,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -855,6 +892,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryBaseFeeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -905,6 +943,7 @@ func (m *QueryBaseFeeRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryBaseFeeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -991,6 +1030,7 @@ func (m *QueryBaseFeeResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryBlockGasRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1041,6 +1081,7 @@ func (m *QueryBlockGasRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryBlockGasResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1110,6 +1151,7 @@ func (m *QueryBlockGasResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/feemarket/types/query.pb.gw.go b/x/feemarket/types/query.pb.gw.go index 2cf378342e..854dd3eb47 100644 --- a/x/feemarket/types/query.pb.gw.go +++ b/x/feemarket/types/query.pb.gw.go @@ -25,13 +25,15 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join +var ( + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join +) func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -39,7 +41,6 @@ func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -48,7 +49,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Params(ctx, &protoReq) return msg, metadata, err - } func request_Query_BaseFee_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -57,7 +57,6 @@ func request_Query_BaseFee_0(ctx context.Context, marshaler runtime.Marshaler, c msg, err := client.BaseFee(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_BaseFee_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,7 +65,6 @@ func local_request_Query_BaseFee_0(ctx context.Context, marshaler runtime.Marsha msg, err := server.BaseFee(ctx, &protoReq) return msg, metadata, err - } func request_Query_BlockGas_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -75,7 +73,6 @@ func request_Query_BlockGas_0(ctx context.Context, marshaler runtime.Marshaler, msg, err := client.BlockGas(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_BlockGas_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -84,7 +81,6 @@ func local_request_Query_BlockGas_0(ctx context.Context, marshaler runtime.Marsh msg, err := server.BlockGas(ctx, &protoReq) return msg, metadata, err - } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -92,7 +88,6 @@ func local_request_Query_BlockGas_0(ctx context.Context, marshaler runtime.Marsh // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -113,7 +108,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_BaseFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -136,7 +130,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_BaseFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_BlockGas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -159,7 +152,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_BlockGas_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -202,7 +194,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -220,7 +211,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_BaseFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -240,7 +230,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_BaseFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_BlockGas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -260,7 +249,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_BlockGas_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil diff --git a/x/feemarket/types/tx.pb.go b/x/feemarket/types/tx.pb.go index 69dc64a303..d477b0c225 100644 --- a/x/feemarket/types/tx.pb.go +++ b/x/feemarket/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" @@ -14,15 +18,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -45,9 +48,11 @@ func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_78aff2584dbf2838, []int{0} } + func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) @@ -60,12 +65,15 @@ func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } + func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParams.Merge(m, src) } + func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParams) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } @@ -88,8 +96,7 @@ func (m *MsgUpdateParams) GetParams() Params { // MsgUpdateParamsResponse defines the response structure for executing a // MsgUpdateParams message. -type MsgUpdateParamsResponse struct { -} +type MsgUpdateParamsResponse struct{} func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } @@ -97,9 +104,11 @@ func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_78aff2584dbf2838, []int{1} } + func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) @@ -112,12 +121,15 @@ func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } + func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } @@ -157,8 +169,10 @@ var fileDescriptor_78aff2584dbf2838 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -198,8 +212,7 @@ type MsgServer interface { } // UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} +type UnimplementedMsgServer struct{} func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") @@ -314,6 +327,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *MsgUpdateParams) Size() (n int) { if m == nil { return 0 @@ -341,9 +355,11 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -459,6 +475,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -509,6 +526,7 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/feemarket/types/tx.pb.gw.go b/x/feemarket/types/tx.pb.gw.go index 1dae7f7728..94e8fb7d8d 100644 --- a/x/feemarket/types/tx.pb.gw.go +++ b/x/feemarket/types/tx.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - var ( - filter_Msg_UpdateParams_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join ) +var filter_Msg_UpdateParams_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + func request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateParams var metadata runtime.ServerMetadata @@ -50,7 +50,6 @@ func request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler msg, err := client.UpdateParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,7 +65,6 @@ func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Mar msg, err := server.UpdateParams(ctx, &protoReq) return msg, metadata, err - } // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". @@ -74,7 +72,6 @@ func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Mar // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { - mux.Handle("POST", pattern_Msg_UpdateParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -95,7 +92,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_UpdateParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -138,7 +134,6 @@ func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.C // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "MsgClient" to call the correct interceptors. func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { - mux.Handle("POST", pattern_Msg_UpdateParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -156,16 +151,11 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_UpdateParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil } -var ( - pattern_Msg_UpdateParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ethermint", "feemarket", "v1", "tx", "update_params"}, "", runtime.AssumeColonVerbOpt(false))) -) +var pattern_Msg_UpdateParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ethermint", "feemarket", "v1", "tx", "update_params"}, "", runtime.AssumeColonVerbOpt(false))) -var ( - forward_Msg_UpdateParams_0 = runtime.ForwardResponseMessage -) +var forward_Msg_UpdateParams_0 = runtime.ForwardResponseMessage diff --git a/x/incentives/keeper/evm_hooks_test.go b/x/incentives/keeper/evm_hooks_test.go index 2c4e609c77..8d3e0a5584 100644 --- a/x/incentives/keeper/evm_hooks_test.go +++ b/x/incentives/keeper/evm_hooks_test.go @@ -19,16 +19,6 @@ import ( vestingtypes "github.com/evmos/evmos/v11/x/vesting/types" ) -// ensureHooksSet tries to set the hooks on EVMKeeper, this will fail if the -// incentives hook is already set -func (suite *KeeperTestSuite) ensureHooksSet() { - defer func() { - err := recover() - suite.Require().NotNil(err) - }() - suite.app.EvmKeeper.SetHooks(suite.app.IncentivesKeeper.Hooks()) -} - func (suite *KeeperTestSuite) TestEvmHooksStoreTxGasUsed() { var expGasUsed uint64 diff --git a/x/incentives/keeper/setup_test.go b/x/incentives/keeper/setup_test.go new file mode 100644 index 0000000000..38f1799fb7 --- /dev/null +++ b/x/incentives/keeper/setup_test.go @@ -0,0 +1,50 @@ +package keeper_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/suite" + + ethtypes "github.com/ethereum/go-ethereum/core/types" + evm "github.com/evmos/evmos/v11/x/evm/types" + + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/x/incentives/types" +) + +type KeeperTestSuite struct { + suite.Suite + + ctx sdk.Context + app *app.Evmos + queryClientEvm evm.QueryClient + queryClient types.QueryClient + address common.Address + consAddress sdk.ConsAddress + clientCtx client.Context + ethSigner ethtypes.Signer + signer keyring.Signer + mintFeeCollector bool +} + +var s *KeeperTestSuite + +func TestKeeperTestSuite(t *testing.T) { + s = new(KeeperTestSuite) + suite.Run(t, s) + + // Run Ginkgo integration tests + RegisterFailHandler(Fail) + RunSpecs(t, "Keeper Suite") +} + +func (suite *KeeperTestSuite) SetupTest() { + suite.DoSetupTest(suite.T()) +} diff --git a/x/incentives/keeper/keeper_test.go b/x/incentives/keeper/utils_test.go similarity index 93% rename from x/incentives/keeper/keeper_test.go rename to x/incentives/keeper/utils_test.go index a15e5d0a0d..1f3dd2da81 100644 --- a/x/incentives/keeper/keeper_test.go +++ b/x/incentives/keeper/utils_test.go @@ -4,42 +4,34 @@ import ( "encoding/json" "fmt" "math/big" - "testing" "time" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/crypto/keyring" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/tmhash" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmversion "github.com/tendermint/tendermint/proto/tendermint/version" - "github.com/tendermint/tendermint/version" - ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/contracts" "github.com/evmos/evmos/v11/crypto/ethsecp256k1" "github.com/evmos/evmos/v11/encoding" "github.com/evmos/evmos/v11/server/config" "github.com/evmos/evmos/v11/tests" evmostypes "github.com/evmos/evmos/v11/types" - evm "github.com/evmos/evmos/v11/x/evm/types" - - "github.com/evmos/evmos/v11/app" - "github.com/evmos/evmos/v11/contracts" epochstypes "github.com/evmos/evmos/v11/x/epochs/types" + evm "github.com/evmos/evmos/v11/x/evm/types" "github.com/evmos/evmos/v11/x/incentives/types" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/crypto/tmhash" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmversion "github.com/tendermint/tendermint/proto/tendermint/version" + "github.com/tendermint/tendermint/version" ) var ( @@ -68,36 +60,6 @@ var ( erc20Decimals = uint8(18) ) -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.Evmos - queryClientEvm evm.QueryClient - queryClient types.QueryClient - address common.Address - consAddress sdk.ConsAddress - clientCtx client.Context - ethSigner ethtypes.Signer - signer keyring.Signer - mintFeeCollector bool -} - -var s *KeeperTestSuite - -func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) - suite.Run(t, s) - - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") -} - -func (suite *KeeperTestSuite) SetupTest() { - suite.DoSetupTest(suite.T()) -} - // Test helpers func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { checkTx := false @@ -402,3 +364,13 @@ func (suite *KeeperTestSuite) NameOf(contract common.Address) string { return fmt.Sprintf("%v", unpacked[0]) } + +// ensureHooksSet tries to set the hooks on EVMKeeper, this will fail if the +// incentives hook is already set +func (suite *KeeperTestSuite) ensureHooksSet() { + defer func() { + err := recover() + suite.Require().NotNil(err) + }() + suite.app.EvmKeeper.SetHooks(suite.app.IncentivesKeeper.Hooks()) +} diff --git a/x/incentives/migrations/v2/types/genesis.pb.go b/x/incentives/migrations/v2/types/genesis.pb.go index c7826bd86f..ed86e833e4 100644 --- a/x/incentives/migrations/v2/types/genesis.pb.go +++ b/x/incentives/migrations/v2/types/genesis.pb.go @@ -5,18 +5,21 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -40,9 +43,11 @@ func (*V2GenesisState) ProtoMessage() {} func (*V2GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_7bb1f7c7e8ad160b, []int{0} } + func (m *V2GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V2GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V2GenesisState.Marshal(b, m, deterministic) @@ -55,12 +60,15 @@ func (m *V2GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } + func (m *V2GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_V2GenesisState.Merge(m, src) } + func (m *V2GenesisState) XXX_Size() int { return m.Size() } + func (m *V2GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_V2GenesisState.DiscardUnknown(m) } @@ -106,9 +114,11 @@ func (*V2Params) ProtoMessage() {} func (*V2Params) Descriptor() ([]byte, []int) { return fileDescriptor_7bb1f7c7e8ad160b, []int{1} } + func (m *V2Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V2Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V2Params.Marshal(b, m, deterministic) @@ -121,12 +131,15 @@ func (m *V2Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *V2Params) XXX_Merge(src proto.Message) { xxx_messageInfo_V2Params.Merge(m, src) } + func (m *V2Params) XXX_Size() int { return m.Size() } + func (m *V2Params) XXX_DiscardUnknown() { xxx_messageInfo_V2Params.DiscardUnknown(m) } @@ -318,6 +331,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *V2GenesisState) Size() (n int) { if m == nil { return 0 @@ -364,9 +378,11 @@ func (m *V2Params) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *V2GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -518,6 +534,7 @@ func (m *V2GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func (m *V2Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -688,6 +705,7 @@ func (m *V2Params) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/incentives/migrations/v2/types/incentives.pb.go b/x/incentives/migrations/v2/types/incentives.pb.go index be4e2fbe29..f18b4bc907 100644 --- a/x/incentives/migrations/v2/types/incentives.pb.go +++ b/x/incentives/migrations/v2/types/incentives.pb.go @@ -5,23 +5,26 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + time "time" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf + _ = time.Kitchen +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -50,9 +53,11 @@ func (*V2Incentive) ProtoMessage() {} func (*V2Incentive) Descriptor() ([]byte, []int) { return fileDescriptor_95b81e40854aec77, []int{0} } + func (m *V2Incentive) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V2Incentive) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V2Incentive.Marshal(b, m, deterministic) @@ -65,12 +70,15 @@ func (m *V2Incentive) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *V2Incentive) XXX_Merge(src proto.Message) { xxx_messageInfo_V2Incentive.Merge(m, src) } + func (m *V2Incentive) XXX_Size() int { return m.Size() } + func (m *V2Incentive) XXX_DiscardUnknown() { xxx_messageInfo_V2Incentive.DiscardUnknown(m) } @@ -128,9 +136,11 @@ func (*V2GasMeter) ProtoMessage() {} func (*V2GasMeter) Descriptor() ([]byte, []int) { return fileDescriptor_95b81e40854aec77, []int{1} } + func (m *V2GasMeter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V2GasMeter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V2GasMeter.Marshal(b, m, deterministic) @@ -143,12 +153,15 @@ func (m *V2GasMeter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *V2GasMeter) XXX_Merge(src proto.Message) { xxx_messageInfo_V2GasMeter.Merge(m, src) } + func (m *V2GasMeter) XXX_Size() int { return m.Size() } + func (m *V2GasMeter) XXX_DiscardUnknown() { xxx_messageInfo_V2GasMeter.DiscardUnknown(m) } @@ -196,9 +209,11 @@ func (*RegisterV2IncentiveProposal) ProtoMessage() {} func (*RegisterV2IncentiveProposal) Descriptor() ([]byte, []int) { return fileDescriptor_95b81e40854aec77, []int{2} } + func (m *RegisterV2IncentiveProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *RegisterV2IncentiveProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_RegisterV2IncentiveProposal.Marshal(b, m, deterministic) @@ -211,12 +226,15 @@ func (m *RegisterV2IncentiveProposal) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *RegisterV2IncentiveProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_RegisterV2IncentiveProposal.Merge(m, src) } + func (m *RegisterV2IncentiveProposal) XXX_Size() int { return m.Size() } + func (m *RegisterV2IncentiveProposal) XXX_DiscardUnknown() { xxx_messageInfo_RegisterV2IncentiveProposal.DiscardUnknown(m) } @@ -274,9 +292,11 @@ func (*CancelV2IncentiveProposal) ProtoMessage() {} func (*CancelV2IncentiveProposal) Descriptor() ([]byte, []int) { return fileDescriptor_95b81e40854aec77, []int{3} } + func (m *CancelV2IncentiveProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *CancelV2IncentiveProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CancelV2IncentiveProposal.Marshal(b, m, deterministic) @@ -289,12 +309,15 @@ func (m *CancelV2IncentiveProposal) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } + func (m *CancelV2IncentiveProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_CancelV2IncentiveProposal.Merge(m, src) } + func (m *CancelV2IncentiveProposal) XXX_Size() int { return m.Size() } + func (m *CancelV2IncentiveProposal) XXX_DiscardUnknown() { xxx_messageInfo_CancelV2IncentiveProposal.DiscardUnknown(m) } @@ -590,6 +613,7 @@ func encodeVarintV2Incentives(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *V2Incentive) Size() (n int) { if m == nil { return 0 @@ -691,9 +715,11 @@ func (m *CancelV2IncentiveProposal) Size() (n int) { func sovV2Incentives(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozV2Incentives(x uint64) (n int) { return sovV2Incentives(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *V2Incentive) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -881,6 +907,7 @@ func (m *V2Incentive) Unmarshal(dAtA []byte) error { } return nil } + func (m *V2GasMeter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1014,6 +1041,7 @@ func (m *V2GasMeter) Unmarshal(dAtA []byte) error { } return nil } + func (m *RegisterV2IncentiveProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1213,6 +1241,7 @@ func (m *RegisterV2IncentiveProposal) Unmarshal(dAtA []byte) error { } return nil } + func (m *CancelV2IncentiveProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1359,6 +1388,7 @@ func (m *CancelV2IncentiveProposal) Unmarshal(dAtA []byte) error { } return nil } + func skipV2Incentives(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/incentives/types/genesis.pb.go b/x/incentives/types/genesis.pb.go index 5887f87322..6edde7dfa6 100644 --- a/x/incentives/types/genesis.pb.go +++ b/x/incentives/types/genesis.pb.go @@ -5,18 +5,21 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -40,9 +43,11 @@ func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_7bb1f7c7e8ad160b, []int{0} } + func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) @@ -55,12 +60,15 @@ func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState.Merge(m, src) } + func (m *GenesisState) XXX_Size() int { return m.Size() } + func (m *GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState.DiscardUnknown(m) } @@ -106,9 +114,11 @@ func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_7bb1f7c7e8ad160b, []int{1} } + func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Params.Marshal(b, m, deterministic) @@ -121,12 +131,15 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Params) XXX_Merge(src proto.Message) { xxx_messageInfo_Params.Merge(m, src) } + func (m *Params) XXX_Size() int { return m.Size() } + func (m *Params) XXX_DiscardUnknown() { xxx_messageInfo_Params.DiscardUnknown(m) } @@ -316,6 +329,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -362,9 +376,11 @@ func (m *Params) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -516,6 +532,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -686,6 +703,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/incentives/types/incentives.pb.go b/x/incentives/types/incentives.pb.go index b800a3ba32..d975dd2413 100644 --- a/x/incentives/types/incentives.pb.go +++ b/x/incentives/types/incentives.pb.go @@ -5,23 +5,26 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + time "time" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf + _ = time.Kitchen +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -50,9 +53,11 @@ func (*Incentive) ProtoMessage() {} func (*Incentive) Descriptor() ([]byte, []int) { return fileDescriptor_95b81e40854aec77, []int{0} } + func (m *Incentive) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Incentive) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Incentive.Marshal(b, m, deterministic) @@ -65,12 +70,15 @@ func (m *Incentive) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Incentive) XXX_Merge(src proto.Message) { xxx_messageInfo_Incentive.Merge(m, src) } + func (m *Incentive) XXX_Size() int { return m.Size() } + func (m *Incentive) XXX_DiscardUnknown() { xxx_messageInfo_Incentive.DiscardUnknown(m) } @@ -128,9 +136,11 @@ func (*GasMeter) ProtoMessage() {} func (*GasMeter) Descriptor() ([]byte, []int) { return fileDescriptor_95b81e40854aec77, []int{1} } + func (m *GasMeter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *GasMeter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GasMeter.Marshal(b, m, deterministic) @@ -143,12 +153,15 @@ func (m *GasMeter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *GasMeter) XXX_Merge(src proto.Message) { xxx_messageInfo_GasMeter.Merge(m, src) } + func (m *GasMeter) XXX_Size() int { return m.Size() } + func (m *GasMeter) XXX_DiscardUnknown() { xxx_messageInfo_GasMeter.DiscardUnknown(m) } @@ -196,9 +209,11 @@ func (*RegisterIncentiveProposal) ProtoMessage() {} func (*RegisterIncentiveProposal) Descriptor() ([]byte, []int) { return fileDescriptor_95b81e40854aec77, []int{2} } + func (m *RegisterIncentiveProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *RegisterIncentiveProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_RegisterIncentiveProposal.Marshal(b, m, deterministic) @@ -211,12 +226,15 @@ func (m *RegisterIncentiveProposal) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } + func (m *RegisterIncentiveProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_RegisterIncentiveProposal.Merge(m, src) } + func (m *RegisterIncentiveProposal) XXX_Size() int { return m.Size() } + func (m *RegisterIncentiveProposal) XXX_DiscardUnknown() { xxx_messageInfo_RegisterIncentiveProposal.DiscardUnknown(m) } @@ -274,9 +292,11 @@ func (*CancelIncentiveProposal) ProtoMessage() {} func (*CancelIncentiveProposal) Descriptor() ([]byte, []int) { return fileDescriptor_95b81e40854aec77, []int{3} } + func (m *CancelIncentiveProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *CancelIncentiveProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CancelIncentiveProposal.Marshal(b, m, deterministic) @@ -289,12 +309,15 @@ func (m *CancelIncentiveProposal) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *CancelIncentiveProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_CancelIncentiveProposal.Merge(m, src) } + func (m *CancelIncentiveProposal) XXX_Size() int { return m.Size() } + func (m *CancelIncentiveProposal) XXX_DiscardUnknown() { xxx_messageInfo_CancelIncentiveProposal.DiscardUnknown(m) } @@ -590,6 +613,7 @@ func encodeVarintIncentives(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *Incentive) Size() (n int) { if m == nil { return 0 @@ -691,9 +715,11 @@ func (m *CancelIncentiveProposal) Size() (n int) { func sovIncentives(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozIncentives(x uint64) (n int) { return sovIncentives(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *Incentive) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -881,6 +907,7 @@ func (m *Incentive) Unmarshal(dAtA []byte) error { } return nil } + func (m *GasMeter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1014,6 +1041,7 @@ func (m *GasMeter) Unmarshal(dAtA []byte) error { } return nil } + func (m *RegisterIncentiveProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1213,6 +1241,7 @@ func (m *RegisterIncentiveProposal) Unmarshal(dAtA []byte) error { } return nil } + func (m *CancelIncentiveProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1359,6 +1388,7 @@ func (m *CancelIncentiveProposal) Unmarshal(dAtA []byte) error { } return nil } + func skipIncentives(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/incentives/types/query.pb.go b/x/incentives/types/query.pb.go index 136575ddd4..340886655d 100644 --- a/x/incentives/types/query.pb.go +++ b/x/incentives/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" query "github.com/cosmos/cosmos-sdk/types/query" @@ -16,15 +20,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -45,9 +48,11 @@ func (*QueryIncentivesRequest) ProtoMessage() {} func (*QueryIncentivesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_ee5d2766935e7631, []int{0} } + func (m *QueryIncentivesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryIncentivesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryIncentivesRequest.Marshal(b, m, deterministic) @@ -60,12 +65,15 @@ func (m *QueryIncentivesRequest) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *QueryIncentivesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryIncentivesRequest.Merge(m, src) } + func (m *QueryIncentivesRequest) XXX_Size() int { return m.Size() } + func (m *QueryIncentivesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryIncentivesRequest.DiscardUnknown(m) } @@ -94,9 +102,11 @@ func (*QueryIncentivesResponse) ProtoMessage() {} func (*QueryIncentivesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_ee5d2766935e7631, []int{1} } + func (m *QueryIncentivesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryIncentivesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryIncentivesResponse.Marshal(b, m, deterministic) @@ -109,12 +119,15 @@ func (m *QueryIncentivesResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *QueryIncentivesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryIncentivesResponse.Merge(m, src) } + func (m *QueryIncentivesResponse) XXX_Size() int { return m.Size() } + func (m *QueryIncentivesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryIncentivesResponse.DiscardUnknown(m) } @@ -147,9 +160,11 @@ func (*QueryIncentiveRequest) ProtoMessage() {} func (*QueryIncentiveRequest) Descriptor() ([]byte, []int) { return fileDescriptor_ee5d2766935e7631, []int{2} } + func (m *QueryIncentiveRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryIncentiveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryIncentiveRequest.Marshal(b, m, deterministic) @@ -162,12 +177,15 @@ func (m *QueryIncentiveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } + func (m *QueryIncentiveRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryIncentiveRequest.Merge(m, src) } + func (m *QueryIncentiveRequest) XXX_Size() int { return m.Size() } + func (m *QueryIncentiveRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryIncentiveRequest.DiscardUnknown(m) } @@ -194,9 +212,11 @@ func (*QueryIncentiveResponse) ProtoMessage() {} func (*QueryIncentiveResponse) Descriptor() ([]byte, []int) { return fileDescriptor_ee5d2766935e7631, []int{3} } + func (m *QueryIncentiveResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryIncentiveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryIncentiveResponse.Marshal(b, m, deterministic) @@ -209,12 +229,15 @@ func (m *QueryIncentiveResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *QueryIncentiveResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryIncentiveResponse.Merge(m, src) } + func (m *QueryIncentiveResponse) XXX_Size() int { return m.Size() } + func (m *QueryIncentiveResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryIncentiveResponse.DiscardUnknown(m) } @@ -243,9 +266,11 @@ func (*QueryGasMetersRequest) ProtoMessage() {} func (*QueryGasMetersRequest) Descriptor() ([]byte, []int) { return fileDescriptor_ee5d2766935e7631, []int{4} } + func (m *QueryGasMetersRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryGasMetersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryGasMetersRequest.Marshal(b, m, deterministic) @@ -258,12 +283,15 @@ func (m *QueryGasMetersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } + func (m *QueryGasMetersRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryGasMetersRequest.Merge(m, src) } + func (m *QueryGasMetersRequest) XXX_Size() int { return m.Size() } + func (m *QueryGasMetersRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryGasMetersRequest.DiscardUnknown(m) } @@ -299,9 +327,11 @@ func (*QueryGasMetersResponse) ProtoMessage() {} func (*QueryGasMetersResponse) Descriptor() ([]byte, []int) { return fileDescriptor_ee5d2766935e7631, []int{5} } + func (m *QueryGasMetersResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryGasMetersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryGasMetersResponse.Marshal(b, m, deterministic) @@ -314,12 +344,15 @@ func (m *QueryGasMetersResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *QueryGasMetersResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryGasMetersResponse.Merge(m, src) } + func (m *QueryGasMetersResponse) XXX_Size() int { return m.Size() } + func (m *QueryGasMetersResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryGasMetersResponse.DiscardUnknown(m) } @@ -354,9 +387,11 @@ func (*QueryGasMeterRequest) ProtoMessage() {} func (*QueryGasMeterRequest) Descriptor() ([]byte, []int) { return fileDescriptor_ee5d2766935e7631, []int{6} } + func (m *QueryGasMeterRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryGasMeterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryGasMeterRequest.Marshal(b, m, deterministic) @@ -369,12 +404,15 @@ func (m *QueryGasMeterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } + func (m *QueryGasMeterRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryGasMeterRequest.Merge(m, src) } + func (m *QueryGasMeterRequest) XXX_Size() int { return m.Size() } + func (m *QueryGasMeterRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryGasMeterRequest.DiscardUnknown(m) } @@ -408,9 +446,11 @@ func (*QueryGasMeterResponse) ProtoMessage() {} func (*QueryGasMeterResponse) Descriptor() ([]byte, []int) { return fileDescriptor_ee5d2766935e7631, []int{7} } + func (m *QueryGasMeterResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryGasMeterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryGasMeterResponse.Marshal(b, m, deterministic) @@ -423,12 +463,15 @@ func (m *QueryGasMeterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } + func (m *QueryGasMeterResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryGasMeterResponse.Merge(m, src) } + func (m *QueryGasMeterResponse) XXX_Size() int { return m.Size() } + func (m *QueryGasMeterResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryGasMeterResponse.DiscardUnknown(m) } @@ -455,9 +498,11 @@ func (*QueryAllocationMetersRequest) ProtoMessage() {} func (*QueryAllocationMetersRequest) Descriptor() ([]byte, []int) { return fileDescriptor_ee5d2766935e7631, []int{8} } + func (m *QueryAllocationMetersRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryAllocationMetersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryAllocationMetersRequest.Marshal(b, m, deterministic) @@ -470,12 +515,15 @@ func (m *QueryAllocationMetersRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryAllocationMetersRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryAllocationMetersRequest.Merge(m, src) } + func (m *QueryAllocationMetersRequest) XXX_Size() int { return m.Size() } + func (m *QueryAllocationMetersRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryAllocationMetersRequest.DiscardUnknown(m) } @@ -504,9 +552,11 @@ func (*QueryAllocationMetersResponse) ProtoMessage() {} func (*QueryAllocationMetersResponse) Descriptor() ([]byte, []int) { return fileDescriptor_ee5d2766935e7631, []int{9} } + func (m *QueryAllocationMetersResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryAllocationMetersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryAllocationMetersResponse.Marshal(b, m, deterministic) @@ -519,12 +569,15 @@ func (m *QueryAllocationMetersResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } + func (m *QueryAllocationMetersResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryAllocationMetersResponse.Merge(m, src) } + func (m *QueryAllocationMetersResponse) XXX_Size() int { return m.Size() } + func (m *QueryAllocationMetersResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryAllocationMetersResponse.DiscardUnknown(m) } @@ -558,9 +611,11 @@ func (*QueryAllocationMeterRequest) ProtoMessage() {} func (*QueryAllocationMeterRequest) Descriptor() ([]byte, []int) { return fileDescriptor_ee5d2766935e7631, []int{10} } + func (m *QueryAllocationMeterRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryAllocationMeterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryAllocationMeterRequest.Marshal(b, m, deterministic) @@ -573,12 +628,15 @@ func (m *QueryAllocationMeterRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryAllocationMeterRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryAllocationMeterRequest.Merge(m, src) } + func (m *QueryAllocationMeterRequest) XXX_Size() int { return m.Size() } + func (m *QueryAllocationMeterRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryAllocationMeterRequest.DiscardUnknown(m) } @@ -605,9 +663,11 @@ func (*QueryAllocationMeterResponse) ProtoMessage() {} func (*QueryAllocationMeterResponse) Descriptor() ([]byte, []int) { return fileDescriptor_ee5d2766935e7631, []int{11} } + func (m *QueryAllocationMeterResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryAllocationMeterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryAllocationMeterResponse.Marshal(b, m, deterministic) @@ -620,12 +680,15 @@ func (m *QueryAllocationMeterResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryAllocationMeterResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryAllocationMeterResponse.Merge(m, src) } + func (m *QueryAllocationMeterResponse) XXX_Size() int { return m.Size() } + func (m *QueryAllocationMeterResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryAllocationMeterResponse.DiscardUnknown(m) } @@ -640,8 +703,7 @@ func (m *QueryAllocationMeterResponse) GetAllocationMeter() types.DecCoin { } // QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} +type QueryParamsRequest struct{} func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } @@ -649,9 +711,11 @@ func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_ee5d2766935e7631, []int{12} } + func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) @@ -664,12 +728,15 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsRequest.Merge(m, src) } + func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } + func (m *QueryParamsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } @@ -689,9 +756,11 @@ func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_ee5d2766935e7631, []int{13} } + func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) @@ -704,12 +773,15 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsResponse.Merge(m, src) } + func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } + func (m *QueryParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } @@ -800,8 +872,10 @@ var fileDescriptor_ee5d2766935e7631 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -919,27 +993,32 @@ type QueryServer interface { } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +type UnimplementedQueryServer struct{} func (*UnimplementedQueryServer) Incentives(ctx context.Context, req *QueryIncentivesRequest) (*QueryIncentivesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Incentives not implemented") } + func (*UnimplementedQueryServer) Incentive(ctx context.Context, req *QueryIncentiveRequest) (*QueryIncentiveResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Incentive not implemented") } + func (*UnimplementedQueryServer) GasMeters(ctx context.Context, req *QueryGasMetersRequest) (*QueryGasMetersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GasMeters not implemented") } + func (*UnimplementedQueryServer) GasMeter(ctx context.Context, req *QueryGasMeterRequest) (*QueryGasMeterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GasMeter not implemented") } + func (*UnimplementedQueryServer) AllocationMeters(ctx context.Context, req *QueryAllocationMetersRequest) (*QueryAllocationMetersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AllocationMeters not implemented") } + func (*UnimplementedQueryServer) AllocationMeter(ctx context.Context, req *QueryAllocationMeterRequest) (*QueryAllocationMeterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AllocationMeter not implemented") } + func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } @@ -1628,6 +1707,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *QueryIncentivesRequest) Size() (n int) { if m == nil { return 0 @@ -1828,9 +1908,11 @@ func (m *QueryParamsResponse) Size() (n int) { func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *QueryIncentivesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1917,6 +1999,7 @@ func (m *QueryIncentivesRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryIncentivesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2037,6 +2120,7 @@ func (m *QueryIncentivesResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryIncentiveRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2119,6 +2203,7 @@ func (m *QueryIncentiveRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryIncentiveResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2202,6 +2287,7 @@ func (m *QueryIncentiveResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryGasMetersRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2320,6 +2406,7 @@ func (m *QueryGasMetersRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryGasMetersResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2440,6 +2527,7 @@ func (m *QueryGasMetersResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryGasMeterRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2554,6 +2642,7 @@ func (m *QueryGasMeterRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryGasMeterResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2623,6 +2712,7 @@ func (m *QueryGasMeterResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryAllocationMetersRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2709,6 +2799,7 @@ func (m *QueryAllocationMetersRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryAllocationMetersResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2829,6 +2920,7 @@ func (m *QueryAllocationMetersResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryAllocationMeterRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2911,6 +3003,7 @@ func (m *QueryAllocationMeterRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryAllocationMeterResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2994,6 +3087,7 @@ func (m *QueryAllocationMeterResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3044,6 +3138,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3127,6 +3222,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/incentives/types/query.pb.gw.go b/x/incentives/types/query.pb.gw.go index 5f07d8dcb1..efe8c6e884 100644 --- a/x/incentives/types/query.pb.gw.go +++ b/x/incentives/types/query.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - var ( - filter_Query_Incentives_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join ) +var filter_Query_Incentives_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + func request_Query_Incentives_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryIncentivesRequest var metadata runtime.ServerMetadata @@ -50,7 +50,6 @@ func request_Query_Incentives_0(ctx context.Context, marshaler runtime.Marshaler msg, err := client.Incentives(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Incentives_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,7 +65,6 @@ func local_request_Query_Incentives_0(ctx context.Context, marshaler runtime.Mar msg, err := server.Incentives(ctx, &protoReq) return msg, metadata, err - } func request_Query_Incentive_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -93,7 +91,6 @@ func request_Query_Incentive_0(ctx context.Context, marshaler runtime.Marshaler, msg, err := client.Incentive(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Incentive_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -120,12 +117,9 @@ func local_request_Query_Incentive_0(ctx context.Context, marshaler runtime.Mars msg, err := server.Incentive(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_GasMeters_0 = &utilities.DoubleArray{Encoding: map[string]int{"contract": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) +var filter_Query_GasMeters_0 = &utilities.DoubleArray{Encoding: map[string]int{"contract": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_Query_GasMeters_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryGasMetersRequest @@ -158,7 +152,6 @@ func request_Query_GasMeters_0(ctx context.Context, marshaler runtime.Marshaler, msg, err := client.GasMeters(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_GasMeters_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -192,7 +185,6 @@ func local_request_Query_GasMeters_0(ctx context.Context, marshaler runtime.Mars msg, err := server.GasMeters(ctx, &protoReq) return msg, metadata, err - } func request_Query_GasMeter_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -230,7 +222,6 @@ func request_Query_GasMeter_0(ctx context.Context, marshaler runtime.Marshaler, msg, err := client.GasMeter(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_GasMeter_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -268,12 +259,9 @@ func local_request_Query_GasMeter_0(ctx context.Context, marshaler runtime.Marsh msg, err := server.GasMeter(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_AllocationMeters_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Query_AllocationMeters_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Query_AllocationMeters_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryAllocationMetersRequest @@ -288,7 +276,6 @@ func request_Query_AllocationMeters_0(ctx context.Context, marshaler runtime.Mar msg, err := client.AllocationMeters(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_AllocationMeters_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -304,7 +291,6 @@ func local_request_Query_AllocationMeters_0(ctx context.Context, marshaler runti msg, err := server.AllocationMeters(ctx, &protoReq) return msg, metadata, err - } func request_Query_AllocationMeter_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -331,7 +317,6 @@ func request_Query_AllocationMeter_0(ctx context.Context, marshaler runtime.Mars msg, err := client.AllocationMeter(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_AllocationMeter_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -358,7 +343,6 @@ func local_request_Query_AllocationMeter_0(ctx context.Context, marshaler runtim msg, err := server.AllocationMeter(ctx, &protoReq) return msg, metadata, err - } func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -367,7 +351,6 @@ func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -376,7 +359,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Params(ctx, &protoReq) return msg, metadata, err - } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -384,7 +366,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Incentives_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -405,7 +386,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Incentives_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Incentive_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -428,7 +408,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Incentive_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_GasMeters_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -451,7 +430,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_GasMeters_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_GasMeter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -474,7 +452,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_GasMeter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_AllocationMeters_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -497,7 +474,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_AllocationMeters_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_AllocationMeter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -520,7 +496,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_AllocationMeter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -543,7 +518,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -586,7 +560,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Incentives_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -604,7 +577,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Incentives_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Incentive_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -624,7 +596,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Incentive_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_GasMeters_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -644,7 +615,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_GasMeters_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_GasMeter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -664,7 +634,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_GasMeter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_AllocationMeters_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -684,7 +653,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_AllocationMeters_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_AllocationMeter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -704,7 +672,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_AllocationMeter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -724,7 +691,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil diff --git a/x/incentives/types/tx.pb.go b/x/incentives/types/tx.pb.go index e823a62b31..8a7c658431 100644 --- a/x/incentives/types/tx.pb.go +++ b/x/incentives/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" @@ -14,15 +18,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -45,9 +48,11 @@ func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_8acb8c4fd5b75ea3, []int{0} } + func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) @@ -60,12 +65,15 @@ func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } + func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParams.Merge(m, src) } + func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParams) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } @@ -88,8 +96,7 @@ func (m *MsgUpdateParams) GetParams() Params { // MsgUpdateParamsResponse defines the response structure for executing a // MsgUpdateParams message. -type MsgUpdateParamsResponse struct { -} +type MsgUpdateParamsResponse struct{} func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } @@ -97,9 +104,11 @@ func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_8acb8c4fd5b75ea3, []int{1} } + func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) @@ -112,12 +121,15 @@ func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } + func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } @@ -156,8 +168,10 @@ var fileDescriptor_8acb8c4fd5b75ea3 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -197,8 +211,7 @@ type MsgServer interface { } // UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} +type UnimplementedMsgServer struct{} func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") @@ -313,6 +326,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *MsgUpdateParams) Size() (n int) { if m == nil { return 0 @@ -340,9 +354,11 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -458,6 +474,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -508,6 +525,7 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/incentives/types/tx.pb.gw.go b/x/incentives/types/tx.pb.gw.go index 384219b5ff..8144da98e8 100644 --- a/x/incentives/types/tx.pb.gw.go +++ b/x/incentives/types/tx.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - var ( - filter_Msg_UpdateParams_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join ) +var filter_Msg_UpdateParams_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + func request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateParams var metadata runtime.ServerMetadata @@ -50,7 +50,6 @@ func request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler msg, err := client.UpdateParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,7 +65,6 @@ func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Mar msg, err := server.UpdateParams(ctx, &protoReq) return msg, metadata, err - } // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". @@ -74,7 +72,6 @@ func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Mar // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { - mux.Handle("POST", pattern_Msg_UpdateParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -95,7 +92,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_UpdateParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -138,7 +134,6 @@ func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.C // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "MsgClient" to call the correct interceptors. func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { - mux.Handle("POST", pattern_Msg_UpdateParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -156,16 +151,11 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_UpdateParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil } -var ( - pattern_Msg_UpdateParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"evmos", "incentives", "v1", "tx", "update_params"}, "", runtime.AssumeColonVerbOpt(false))) -) +var pattern_Msg_UpdateParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"evmos", "incentives", "v1", "tx", "update_params"}, "", runtime.AssumeColonVerbOpt(false))) -var ( - forward_Msg_UpdateParams_0 = runtime.ForwardResponseMessage -) +var forward_Msg_UpdateParams_0 = runtime.ForwardResponseMessage diff --git a/x/inflation/keeper/setup_test.go b/x/inflation/keeper/setup_test.go new file mode 100644 index 0000000000..1a9bea4dd3 --- /dev/null +++ b/x/inflation/keeper/setup_test.go @@ -0,0 +1,43 @@ +package keeper_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + + evm "github.com/evmos/evmos/v11/x/evm/types" + + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/x/inflation/types" +) + +var denomMint = types.DefaultInflationDenom + +type KeeperTestSuite struct { + suite.Suite + + ctx sdk.Context + app *app.Evmos + queryClientEvm evm.QueryClient + queryClient types.QueryClient + consAddress sdk.ConsAddress +} + +var s *KeeperTestSuite + +func TestKeeperTestSuite(t *testing.T) { + s = new(KeeperTestSuite) + suite.Run(t, s) + + // Run Ginkgo integration tests + RegisterFailHandler(Fail) + RunSpecs(t, "Keeper Suite") +} + +func (suite *KeeperTestSuite) SetupTest() { + suite.DoSetupTest(suite.T()) +} diff --git a/x/inflation/keeper/keeper_test.go b/x/inflation/keeper/utils_test.go similarity index 81% rename from x/inflation/keeper/keeper_test.go rename to x/inflation/keeper/utils_test.go index ff8a2a7620..329926d89c 100644 --- a/x/inflation/keeper/keeper_test.go +++ b/x/inflation/keeper/utils_test.go @@ -1,56 +1,21 @@ package keeper_test import ( - "testing" "time" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/evmos/evmos/v11/app" + epochstypes "github.com/evmos/evmos/v11/x/epochs/types" + evm "github.com/evmos/evmos/v11/x/evm/types" + "github.com/evmos/evmos/v11/x/inflation/types" "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/tmhash" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmversion "github.com/tendermint/tendermint/proto/tendermint/version" "github.com/tendermint/tendermint/version" - - evm "github.com/evmos/evmos/v11/x/evm/types" - - "github.com/evmos/evmos/v11/app" - epochstypes "github.com/evmos/evmos/v11/x/epochs/types" - "github.com/evmos/evmos/v11/x/inflation/types" ) -var denomMint = types.DefaultInflationDenom - -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.Evmos - queryClientEvm evm.QueryClient - queryClient types.QueryClient - consAddress sdk.ConsAddress -} - -var s *KeeperTestSuite - -func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) - suite.Run(t, s) - - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") -} - -func (suite *KeeperTestSuite) SetupTest() { - suite.DoSetupTest(suite.T()) -} - // Test helpers func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { checkTx := false diff --git a/x/inflation/migrations/v2/types/genesis.pb.go b/x/inflation/migrations/v2/types/genesis.pb.go index 77df21579d..7fe39b6296 100644 --- a/x/inflation/migrations/v2/types/genesis.pb.go +++ b/x/inflation/migrations/v2/types/genesis.pb.go @@ -5,17 +5,20 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -43,9 +46,11 @@ func (*V2GenesisState) ProtoMessage() {} func (*V2GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_1cb8eee530db1235, []int{0} } + func (m *V2GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V2GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V2GenesisState.Marshal(b, m, deterministic) @@ -58,12 +63,15 @@ func (m *V2GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } + func (m *V2GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_V2GenesisState.Merge(m, src) } + func (m *V2GenesisState) XXX_Size() int { return m.Size() } + func (m *V2GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_V2GenesisState.DiscardUnknown(m) } @@ -123,9 +131,11 @@ func (*V2Params) ProtoMessage() {} func (*V2Params) Descriptor() ([]byte, []int) { return fileDescriptor_1cb8eee530db1235, []int{1} } + func (m *V2Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V2Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V2Params.Marshal(b, m, deterministic) @@ -138,12 +148,15 @@ func (m *V2Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *V2Params) XXX_Merge(src proto.Message) { xxx_messageInfo_V2Params.Merge(m, src) } + func (m *V2Params) XXX_Size() int { return m.Size() } + func (m *V2Params) XXX_DiscardUnknown() { xxx_messageInfo_V2Params.DiscardUnknown(m) } @@ -341,6 +354,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *V2GenesisState) Size() (n int) { if m == nil { return 0 @@ -388,9 +402,11 @@ func (m *V2Params) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *V2GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -563,6 +579,7 @@ func (m *V2GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func (m *V2Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -731,6 +748,7 @@ func (m *V2Params) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/inflation/migrations/v2/types/inflation.pb.go b/x/inflation/migrations/v2/types/inflation.pb.go index 578ba59e09..3e36abeafc 100644 --- a/x/inflation/migrations/v2/types/inflation.pb.go +++ b/x/inflation/migrations/v2/types/inflation.pb.go @@ -5,18 +5,21 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -49,9 +52,11 @@ func (*V2InflationDistribution) ProtoMessage() {} func (*V2InflationDistribution) Descriptor() ([]byte, []int) { return fileDescriptor_d064cb35c3ff7df8, []int{0} } + func (m *V2InflationDistribution) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V2InflationDistribution) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V2InflationDistribution.Marshal(b, m, deterministic) @@ -64,12 +69,15 @@ func (m *V2InflationDistribution) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *V2InflationDistribution) XXX_Merge(src proto.Message) { xxx_messageInfo_V2InflationDistribution.Merge(m, src) } + func (m *V2InflationDistribution) XXX_Size() int { return m.Size() } + func (m *V2InflationDistribution) XXX_DiscardUnknown() { xxx_messageInfo_V2InflationDistribution.DiscardUnknown(m) } @@ -100,9 +108,11 @@ func (*V2ExponentialCalculation) ProtoMessage() {} func (*V2ExponentialCalculation) Descriptor() ([]byte, []int) { return fileDescriptor_d064cb35c3ff7df8, []int{1} } + func (m *V2ExponentialCalculation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V2ExponentialCalculation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V2ExponentialCalculation.Marshal(b, m, deterministic) @@ -115,12 +125,15 @@ func (m *V2ExponentialCalculation) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } + func (m *V2ExponentialCalculation) XXX_Merge(src proto.Message) { xxx_messageInfo_V2ExponentialCalculation.Merge(m, src) } + func (m *V2ExponentialCalculation) XXX_Size() int { return m.Size() } + func (m *V2ExponentialCalculation) XXX_DiscardUnknown() { xxx_messageInfo_V2ExponentialCalculation.DiscardUnknown(m) } @@ -301,6 +314,7 @@ func encodeVarintInflation(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *V2InflationDistribution) Size() (n int) { if m == nil { return 0 @@ -338,9 +352,11 @@ func (m *V2ExponentialCalculation) Size() (n int) { func sovInflation(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozInflation(x uint64) (n int) { return sovInflation(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *V2InflationDistribution) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -493,6 +509,7 @@ func (m *V2InflationDistribution) Unmarshal(dAtA []byte) error { } return nil } + func (m *V2ExponentialCalculation) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -713,6 +730,7 @@ func (m *V2ExponentialCalculation) Unmarshal(dAtA []byte) error { } return nil } + func skipInflation(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/inflation/types/genesis.pb.go b/x/inflation/types/genesis.pb.go index cb3934ca90..2b29482385 100644 --- a/x/inflation/types/genesis.pb.go +++ b/x/inflation/types/genesis.pb.go @@ -5,17 +5,20 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -43,9 +46,11 @@ func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_1cb8eee530db1235, []int{0} } + func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) @@ -58,12 +63,15 @@ func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState.Merge(m, src) } + func (m *GenesisState) XXX_Size() int { return m.Size() } + func (m *GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState.DiscardUnknown(m) } @@ -123,9 +131,11 @@ func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_1cb8eee530db1235, []int{1} } + func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Params.Marshal(b, m, deterministic) @@ -138,12 +148,15 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Params) XXX_Merge(src proto.Message) { xxx_messageInfo_Params.Merge(m, src) } + func (m *Params) XXX_Size() int { return m.Size() } + func (m *Params) XXX_DiscardUnknown() { xxx_messageInfo_Params.DiscardUnknown(m) } @@ -341,6 +354,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -388,9 +402,11 @@ func (m *Params) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -563,6 +579,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -731,6 +748,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/inflation/types/inflation.pb.go b/x/inflation/types/inflation.pb.go index 3539016592..a0978aae30 100644 --- a/x/inflation/types/inflation.pb.go +++ b/x/inflation/types/inflation.pb.go @@ -5,18 +5,21 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -49,9 +52,11 @@ func (*InflationDistribution) ProtoMessage() {} func (*InflationDistribution) Descriptor() ([]byte, []int) { return fileDescriptor_d064cb35c3ff7df8, []int{0} } + func (m *InflationDistribution) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *InflationDistribution) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_InflationDistribution.Marshal(b, m, deterministic) @@ -64,12 +69,15 @@ func (m *InflationDistribution) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } + func (m *InflationDistribution) XXX_Merge(src proto.Message) { xxx_messageInfo_InflationDistribution.Merge(m, src) } + func (m *InflationDistribution) XXX_Size() int { return m.Size() } + func (m *InflationDistribution) XXX_DiscardUnknown() { xxx_messageInfo_InflationDistribution.DiscardUnknown(m) } @@ -100,9 +108,11 @@ func (*ExponentialCalculation) ProtoMessage() {} func (*ExponentialCalculation) Descriptor() ([]byte, []int) { return fileDescriptor_d064cb35c3ff7df8, []int{1} } + func (m *ExponentialCalculation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ExponentialCalculation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ExponentialCalculation.Marshal(b, m, deterministic) @@ -115,12 +125,15 @@ func (m *ExponentialCalculation) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *ExponentialCalculation) XXX_Merge(src proto.Message) { xxx_messageInfo_ExponentialCalculation.Merge(m, src) } + func (m *ExponentialCalculation) XXX_Size() int { return m.Size() } + func (m *ExponentialCalculation) XXX_DiscardUnknown() { xxx_messageInfo_ExponentialCalculation.DiscardUnknown(m) } @@ -301,6 +314,7 @@ func encodeVarintInflation(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *InflationDistribution) Size() (n int) { if m == nil { return 0 @@ -338,9 +352,11 @@ func (m *ExponentialCalculation) Size() (n int) { func sovInflation(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozInflation(x uint64) (n int) { return sovInflation(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *InflationDistribution) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -493,6 +509,7 @@ func (m *InflationDistribution) Unmarshal(dAtA []byte) error { } return nil } + func (m *ExponentialCalculation) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -713,6 +730,7 @@ func (m *ExponentialCalculation) Unmarshal(dAtA []byte) error { } return nil } + func skipInflation(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/inflation/types/query.pb.go b/x/inflation/types/query.pb.go index e6ee956e19..6b4ad2e81a 100644 --- a/x/inflation/types/query.pb.go +++ b/x/inflation/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" @@ -15,15 +19,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -32,8 +35,7 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryPeriodRequest is the request type for the Query/Period RPC method. -type QueryPeriodRequest struct { -} +type QueryPeriodRequest struct{} func (m *QueryPeriodRequest) Reset() { *m = QueryPeriodRequest{} } func (m *QueryPeriodRequest) String() string { return proto.CompactTextString(m) } @@ -41,9 +43,11 @@ func (*QueryPeriodRequest) ProtoMessage() {} func (*QueryPeriodRequest) Descriptor() ([]byte, []int) { return fileDescriptor_91b9f1b5d47c7fd7, []int{0} } + func (m *QueryPeriodRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryPeriodRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryPeriodRequest.Marshal(b, m, deterministic) @@ -56,12 +60,15 @@ func (m *QueryPeriodRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryPeriodRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryPeriodRequest.Merge(m, src) } + func (m *QueryPeriodRequest) XXX_Size() int { return m.Size() } + func (m *QueryPeriodRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryPeriodRequest.DiscardUnknown(m) } @@ -80,9 +87,11 @@ func (*QueryPeriodResponse) ProtoMessage() {} func (*QueryPeriodResponse) Descriptor() ([]byte, []int) { return fileDescriptor_91b9f1b5d47c7fd7, []int{1} } + func (m *QueryPeriodResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryPeriodResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryPeriodResponse.Marshal(b, m, deterministic) @@ -95,12 +104,15 @@ func (m *QueryPeriodResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryPeriodResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryPeriodResponse.Merge(m, src) } + func (m *QueryPeriodResponse) XXX_Size() int { return m.Size() } + func (m *QueryPeriodResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryPeriodResponse.DiscardUnknown(m) } @@ -116,8 +128,7 @@ func (m *QueryPeriodResponse) GetPeriod() uint64 { // QueryEpochMintProvisionRequest is the request type for the // Query/EpochMintProvision RPC method. -type QueryEpochMintProvisionRequest struct { -} +type QueryEpochMintProvisionRequest struct{} func (m *QueryEpochMintProvisionRequest) Reset() { *m = QueryEpochMintProvisionRequest{} } func (m *QueryEpochMintProvisionRequest) String() string { return proto.CompactTextString(m) } @@ -125,9 +136,11 @@ func (*QueryEpochMintProvisionRequest) ProtoMessage() {} func (*QueryEpochMintProvisionRequest) Descriptor() ([]byte, []int) { return fileDescriptor_91b9f1b5d47c7fd7, []int{2} } + func (m *QueryEpochMintProvisionRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryEpochMintProvisionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryEpochMintProvisionRequest.Marshal(b, m, deterministic) @@ -140,12 +153,15 @@ func (m *QueryEpochMintProvisionRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } + func (m *QueryEpochMintProvisionRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryEpochMintProvisionRequest.Merge(m, src) } + func (m *QueryEpochMintProvisionRequest) XXX_Size() int { return m.Size() } + func (m *QueryEpochMintProvisionRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryEpochMintProvisionRequest.DiscardUnknown(m) } @@ -165,9 +181,11 @@ func (*QueryEpochMintProvisionResponse) ProtoMessage() {} func (*QueryEpochMintProvisionResponse) Descriptor() ([]byte, []int) { return fileDescriptor_91b9f1b5d47c7fd7, []int{3} } + func (m *QueryEpochMintProvisionResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryEpochMintProvisionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryEpochMintProvisionResponse.Marshal(b, m, deterministic) @@ -180,12 +198,15 @@ func (m *QueryEpochMintProvisionResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } + func (m *QueryEpochMintProvisionResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryEpochMintProvisionResponse.Merge(m, src) } + func (m *QueryEpochMintProvisionResponse) XXX_Size() int { return m.Size() } + func (m *QueryEpochMintProvisionResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryEpochMintProvisionResponse.DiscardUnknown(m) } @@ -201,8 +222,7 @@ func (m *QueryEpochMintProvisionResponse) GetEpochMintProvision() types.DecCoin // QuerySkippedEpochsRequest is the request type for the Query/SkippedEpochs RPC // method. -type QuerySkippedEpochsRequest struct { -} +type QuerySkippedEpochsRequest struct{} func (m *QuerySkippedEpochsRequest) Reset() { *m = QuerySkippedEpochsRequest{} } func (m *QuerySkippedEpochsRequest) String() string { return proto.CompactTextString(m) } @@ -210,9 +230,11 @@ func (*QuerySkippedEpochsRequest) ProtoMessage() {} func (*QuerySkippedEpochsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_91b9f1b5d47c7fd7, []int{4} } + func (m *QuerySkippedEpochsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QuerySkippedEpochsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QuerySkippedEpochsRequest.Marshal(b, m, deterministic) @@ -225,12 +247,15 @@ func (m *QuerySkippedEpochsRequest) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } + func (m *QuerySkippedEpochsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QuerySkippedEpochsRequest.Merge(m, src) } + func (m *QuerySkippedEpochsRequest) XXX_Size() int { return m.Size() } + func (m *QuerySkippedEpochsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QuerySkippedEpochsRequest.DiscardUnknown(m) } @@ -250,9 +275,11 @@ func (*QuerySkippedEpochsResponse) ProtoMessage() {} func (*QuerySkippedEpochsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_91b9f1b5d47c7fd7, []int{5} } + func (m *QuerySkippedEpochsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QuerySkippedEpochsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QuerySkippedEpochsResponse.Marshal(b, m, deterministic) @@ -265,12 +292,15 @@ func (m *QuerySkippedEpochsResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } + func (m *QuerySkippedEpochsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QuerySkippedEpochsResponse.Merge(m, src) } + func (m *QuerySkippedEpochsResponse) XXX_Size() int { return m.Size() } + func (m *QuerySkippedEpochsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QuerySkippedEpochsResponse.DiscardUnknown(m) } @@ -286,8 +316,7 @@ func (m *QuerySkippedEpochsResponse) GetSkippedEpochs() uint64 { // QueryCirculatingSupplyRequest is the request type for the // Query/CirculatingSupply RPC method. -type QueryCirculatingSupplyRequest struct { -} +type QueryCirculatingSupplyRequest struct{} func (m *QueryCirculatingSupplyRequest) Reset() { *m = QueryCirculatingSupplyRequest{} } func (m *QueryCirculatingSupplyRequest) String() string { return proto.CompactTextString(m) } @@ -295,9 +324,11 @@ func (*QueryCirculatingSupplyRequest) ProtoMessage() {} func (*QueryCirculatingSupplyRequest) Descriptor() ([]byte, []int) { return fileDescriptor_91b9f1b5d47c7fd7, []int{6} } + func (m *QueryCirculatingSupplyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCirculatingSupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCirculatingSupplyRequest.Marshal(b, m, deterministic) @@ -310,12 +341,15 @@ func (m *QueryCirculatingSupplyRequest) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } + func (m *QueryCirculatingSupplyRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCirculatingSupplyRequest.Merge(m, src) } + func (m *QueryCirculatingSupplyRequest) XXX_Size() int { return m.Size() } + func (m *QueryCirculatingSupplyRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryCirculatingSupplyRequest.DiscardUnknown(m) } @@ -335,9 +369,11 @@ func (*QueryCirculatingSupplyResponse) ProtoMessage() {} func (*QueryCirculatingSupplyResponse) Descriptor() ([]byte, []int) { return fileDescriptor_91b9f1b5d47c7fd7, []int{7} } + func (m *QueryCirculatingSupplyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCirculatingSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCirculatingSupplyResponse.Marshal(b, m, deterministic) @@ -350,12 +386,15 @@ func (m *QueryCirculatingSupplyResponse) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } + func (m *QueryCirculatingSupplyResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCirculatingSupplyResponse.Merge(m, src) } + func (m *QueryCirculatingSupplyResponse) XXX_Size() int { return m.Size() } + func (m *QueryCirculatingSupplyResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryCirculatingSupplyResponse.DiscardUnknown(m) } @@ -371,8 +410,7 @@ func (m *QueryCirculatingSupplyResponse) GetCirculatingSupply() types.DecCoin { // QueryInflationRateRequest is the request type for the Query/InflationRate RPC // method. -type QueryInflationRateRequest struct { -} +type QueryInflationRateRequest struct{} func (m *QueryInflationRateRequest) Reset() { *m = QueryInflationRateRequest{} } func (m *QueryInflationRateRequest) String() string { return proto.CompactTextString(m) } @@ -380,9 +418,11 @@ func (*QueryInflationRateRequest) ProtoMessage() {} func (*QueryInflationRateRequest) Descriptor() ([]byte, []int) { return fileDescriptor_91b9f1b5d47c7fd7, []int{8} } + func (m *QueryInflationRateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryInflationRateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryInflationRateRequest.Marshal(b, m, deterministic) @@ -395,12 +435,15 @@ func (m *QueryInflationRateRequest) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } + func (m *QueryInflationRateRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryInflationRateRequest.Merge(m, src) } + func (m *QueryInflationRateRequest) XXX_Size() int { return m.Size() } + func (m *QueryInflationRateRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryInflationRateRequest.DiscardUnknown(m) } @@ -420,9 +463,11 @@ func (*QueryInflationRateResponse) ProtoMessage() {} func (*QueryInflationRateResponse) Descriptor() ([]byte, []int) { return fileDescriptor_91b9f1b5d47c7fd7, []int{9} } + func (m *QueryInflationRateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryInflationRateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryInflationRateResponse.Marshal(b, m, deterministic) @@ -435,12 +480,15 @@ func (m *QueryInflationRateResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } + func (m *QueryInflationRateResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryInflationRateResponse.Merge(m, src) } + func (m *QueryInflationRateResponse) XXX_Size() int { return m.Size() } + func (m *QueryInflationRateResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryInflationRateResponse.DiscardUnknown(m) } @@ -448,8 +496,7 @@ func (m *QueryInflationRateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryInflationRateResponse proto.InternalMessageInfo // QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} +type QueryParamsRequest struct{} func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } @@ -457,9 +504,11 @@ func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_91b9f1b5d47c7fd7, []int{10} } + func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) @@ -472,12 +521,15 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsRequest.Merge(m, src) } + func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } + func (m *QueryParamsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } @@ -496,9 +548,11 @@ func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_91b9f1b5d47c7fd7, []int{11} } + func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) @@ -511,12 +565,15 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsResponse.Merge(m, src) } + func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } + func (m *QueryParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } @@ -595,8 +652,10 @@ var fileDescriptor_91b9f1b5d47c7fd7 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -701,24 +760,28 @@ type QueryServer interface { } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +type UnimplementedQueryServer struct{} func (*UnimplementedQueryServer) Period(ctx context.Context, req *QueryPeriodRequest) (*QueryPeriodResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Period not implemented") } + func (*UnimplementedQueryServer) EpochMintProvision(ctx context.Context, req *QueryEpochMintProvisionRequest) (*QueryEpochMintProvisionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EpochMintProvision not implemented") } + func (*UnimplementedQueryServer) SkippedEpochs(ctx context.Context, req *QuerySkippedEpochsRequest) (*QuerySkippedEpochsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SkippedEpochs not implemented") } + func (*UnimplementedQueryServer) CirculatingSupply(ctx context.Context, req *QueryCirculatingSupplyRequest) (*QueryCirculatingSupplyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CirculatingSupply not implemented") } + func (*UnimplementedQueryServer) InflationRate(ctx context.Context, req *QueryInflationRateRequest) (*QueryInflationRateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method InflationRate not implemented") } + func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } @@ -1205,6 +1268,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *QueryPeriodRequest) Size() (n int) { if m == nil { return 0 @@ -1330,9 +1394,11 @@ func (m *QueryParamsResponse) Size() (n int) { func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *QueryPeriodRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1383,6 +1449,7 @@ func (m *QueryPeriodRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryPeriodResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1452,6 +1519,7 @@ func (m *QueryPeriodResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryEpochMintProvisionRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1502,6 +1570,7 @@ func (m *QueryEpochMintProvisionRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryEpochMintProvisionResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1585,6 +1654,7 @@ func (m *QueryEpochMintProvisionResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QuerySkippedEpochsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1635,6 +1705,7 @@ func (m *QuerySkippedEpochsRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QuerySkippedEpochsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1704,6 +1775,7 @@ func (m *QuerySkippedEpochsResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCirculatingSupplyRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1754,6 +1826,7 @@ func (m *QueryCirculatingSupplyRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCirculatingSupplyResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1837,6 +1910,7 @@ func (m *QueryCirculatingSupplyResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryInflationRateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1887,6 +1961,7 @@ func (m *QueryInflationRateRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryInflationRateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1971,6 +2046,7 @@ func (m *QueryInflationRateResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2021,6 +2097,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2104,6 +2181,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/inflation/types/query.pb.gw.go b/x/inflation/types/query.pb.gw.go index 5caf12bf07..27e24e00f3 100644 --- a/x/inflation/types/query.pb.gw.go +++ b/x/inflation/types/query.pb.gw.go @@ -25,13 +25,15 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join +var ( + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join +) func request_Query_Period_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryPeriodRequest @@ -39,7 +41,6 @@ func request_Query_Period_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Period(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Period_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -48,7 +49,6 @@ func local_request_Query_Period_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Period(ctx, &protoReq) return msg, metadata, err - } func request_Query_EpochMintProvision_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -57,7 +57,6 @@ func request_Query_EpochMintProvision_0(ctx context.Context, marshaler runtime.M msg, err := client.EpochMintProvision(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_EpochMintProvision_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,7 +65,6 @@ func local_request_Query_EpochMintProvision_0(ctx context.Context, marshaler run msg, err := server.EpochMintProvision(ctx, &protoReq) return msg, metadata, err - } func request_Query_SkippedEpochs_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -75,7 +73,6 @@ func request_Query_SkippedEpochs_0(ctx context.Context, marshaler runtime.Marsha msg, err := client.SkippedEpochs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_SkippedEpochs_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -84,7 +81,6 @@ func local_request_Query_SkippedEpochs_0(ctx context.Context, marshaler runtime. msg, err := server.SkippedEpochs(ctx, &protoReq) return msg, metadata, err - } func request_Query_CirculatingSupply_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -93,7 +89,6 @@ func request_Query_CirculatingSupply_0(ctx context.Context, marshaler runtime.Ma msg, err := client.CirculatingSupply(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_CirculatingSupply_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -102,7 +97,6 @@ func local_request_Query_CirculatingSupply_0(ctx context.Context, marshaler runt msg, err := server.CirculatingSupply(ctx, &protoReq) return msg, metadata, err - } func request_Query_InflationRate_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -111,7 +105,6 @@ func request_Query_InflationRate_0(ctx context.Context, marshaler runtime.Marsha msg, err := client.InflationRate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_InflationRate_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -120,7 +113,6 @@ func local_request_Query_InflationRate_0(ctx context.Context, marshaler runtime. msg, err := server.InflationRate(ctx, &protoReq) return msg, metadata, err - } func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -129,7 +121,6 @@ func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -138,7 +129,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Params(ctx, &protoReq) return msg, metadata, err - } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -146,7 +136,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Period_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -167,7 +156,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Period_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_EpochMintProvision_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -190,7 +178,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_EpochMintProvision_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_SkippedEpochs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -213,7 +200,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_SkippedEpochs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_CirculatingSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -236,7 +222,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_CirculatingSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_InflationRate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -259,7 +244,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_InflationRate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -282,7 +266,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -325,7 +308,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Period_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -343,7 +325,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Period_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_EpochMintProvision_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -363,7 +344,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_EpochMintProvision_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_SkippedEpochs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -383,7 +363,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_SkippedEpochs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_CirculatingSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -403,7 +382,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_CirculatingSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_InflationRate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -423,7 +401,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_InflationRate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -443,7 +420,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil diff --git a/x/inflation/types/tx.pb.go b/x/inflation/types/tx.pb.go index d618db44ef..68b14613b6 100644 --- a/x/inflation/types/tx.pb.go +++ b/x/inflation/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" @@ -14,15 +18,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -45,9 +48,11 @@ func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_2f254d33a26438a9, []int{0} } + func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) @@ -60,12 +65,15 @@ func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } + func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParams.Merge(m, src) } + func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParams) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } @@ -88,8 +96,7 @@ func (m *MsgUpdateParams) GetParams() Params { // MsgUpdateParamsResponse defines the response structure for executing a // MsgUpdateParams message. -type MsgUpdateParamsResponse struct { -} +type MsgUpdateParamsResponse struct{} func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } @@ -97,9 +104,11 @@ func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_2f254d33a26438a9, []int{1} } + func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) @@ -112,12 +121,15 @@ func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } + func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } @@ -156,8 +168,10 @@ var fileDescriptor_2f254d33a26438a9 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -197,8 +211,7 @@ type MsgServer interface { } // UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} +type UnimplementedMsgServer struct{} func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") @@ -313,6 +326,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *MsgUpdateParams) Size() (n int) { if m == nil { return 0 @@ -340,9 +354,11 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -458,6 +474,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -508,6 +525,7 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/inflation/types/tx.pb.gw.go b/x/inflation/types/tx.pb.gw.go index 322287dfcd..ba6c1dc8f9 100644 --- a/x/inflation/types/tx.pb.gw.go +++ b/x/inflation/types/tx.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - var ( - filter_Msg_UpdateParams_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join ) +var filter_Msg_UpdateParams_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + func request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateParams var metadata runtime.ServerMetadata @@ -50,7 +50,6 @@ func request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler msg, err := client.UpdateParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,7 +65,6 @@ func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Mar msg, err := server.UpdateParams(ctx, &protoReq) return msg, metadata, err - } // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". @@ -74,7 +72,6 @@ func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Mar // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { - mux.Handle("POST", pattern_Msg_UpdateParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -95,7 +92,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_UpdateParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -138,7 +134,6 @@ func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.C // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "MsgClient" to call the correct interceptors. func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { - mux.Handle("POST", pattern_Msg_UpdateParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -156,16 +151,11 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_UpdateParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil } -var ( - pattern_Msg_UpdateParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"evmos", "inflation", "v1", "tx", "update_params"}, "", runtime.AssumeColonVerbOpt(false))) -) +var pattern_Msg_UpdateParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"evmos", "inflation", "v1", "tx", "update_params"}, "", runtime.AssumeColonVerbOpt(false))) -var ( - forward_Msg_UpdateParams_0 = runtime.ForwardResponseMessage -) +var forward_Msg_UpdateParams_0 = runtime.ForwardResponseMessage diff --git a/x/recovery/keeper/ibc_callbacks_integration_suite_test.go b/x/recovery/keeper/ibc_callbacks_integration_suite_test.go deleted file mode 100644 index a2076d46cd..0000000000 --- a/x/recovery/keeper/ibc_callbacks_integration_suite_test.go +++ /dev/null @@ -1,170 +0,0 @@ -package keeper_test - -import ( - "strconv" - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "github.com/stretchr/testify/suite" - - sdk "github.com/cosmos/cosmos-sdk/types" - transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" - ibcgotesting "github.com/cosmos/ibc-go/v6/testing" - - ibctesting "github.com/evmos/evmos/v11/ibc/testing" - - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/evmos/evmos/v11/app" - "github.com/evmos/evmos/v11/utils" - claimstypes "github.com/evmos/evmos/v11/x/claims/types" - inflationtypes "github.com/evmos/evmos/v11/x/inflation/types" - "github.com/evmos/evmos/v11/x/recovery/types" -) - -type IBCTestingSuite struct { - suite.Suite - coordinator *ibcgotesting.Coordinator - - // testing chains used for convenience and readability - EvmosChain *ibcgotesting.TestChain - IBCOsmosisChain *ibcgotesting.TestChain - IBCCosmosChain *ibcgotesting.TestChain - - pathOsmosisEvmos *ibctesting.Path - pathCosmosEvmos *ibctesting.Path - pathOsmosisCosmos *ibctesting.Path -} - -var s *IBCTestingSuite - -func TestIBCTestingSuite(t *testing.T) { - s = new(IBCTestingSuite) - suite.Run(t, s) - - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") -} - -func (suite *IBCTestingSuite) SetupTest() { - // initializes 3 test chains - suite.coordinator = ibctesting.NewCoordinator(suite.T(), 1, 2) - suite.EvmosChain = suite.coordinator.GetChain(ibcgotesting.GetChainID(1)) - suite.IBCOsmosisChain = suite.coordinator.GetChain(ibcgotesting.GetChainID(2)) - suite.IBCCosmosChain = suite.coordinator.GetChain(ibcgotesting.GetChainID(3)) - suite.coordinator.CommitNBlocks(suite.EvmosChain, 2) - suite.coordinator.CommitNBlocks(suite.IBCOsmosisChain, 2) - suite.coordinator.CommitNBlocks(suite.IBCCosmosChain, 2) - - // Mint coins locked on the evmos account generated with secp. - amt, ok := sdk.NewIntFromString("1000000000000000000000") - suite.Require().True(ok) - coinEvmos := sdk.NewCoin(utils.BaseDenom, amt) - coins := sdk.NewCoins(coinEvmos) - err := suite.EvmosChain.App.(*app.Evmos).BankKeeper.MintCoins(suite.EvmosChain.GetContext(), inflationtypes.ModuleName, coins) - suite.Require().NoError(err) - - // Fund sender address to pay fees - err = suite.EvmosChain.App.(*app.Evmos).BankKeeper.SendCoinsFromModuleToAccount(suite.EvmosChain.GetContext(), inflationtypes.ModuleName, suite.EvmosChain.SenderAccount.GetAddress(), coins) - suite.Require().NoError(err) - - coinEvmos = sdk.NewCoin(utils.BaseDenom, sdk.NewInt(10000)) - coins = sdk.NewCoins(coinEvmos) - err = suite.EvmosChain.App.(*app.Evmos).BankKeeper.MintCoins(suite.EvmosChain.GetContext(), inflationtypes.ModuleName, coins) - suite.Require().NoError(err) - err = suite.EvmosChain.App.(*app.Evmos).BankKeeper.SendCoinsFromModuleToAccount(suite.EvmosChain.GetContext(), inflationtypes.ModuleName, suite.IBCOsmosisChain.SenderAccount.GetAddress(), coins) - suite.Require().NoError(err) - - // Mint coins on the osmosis side which we'll use to unlock our aevmos - coinOsmo := sdk.NewCoin("uosmo", sdk.NewInt(10)) - coins = sdk.NewCoins(coinOsmo) - err = suite.IBCOsmosisChain.GetSimApp().BankKeeper.MintCoins(suite.IBCOsmosisChain.GetContext(), minttypes.ModuleName, coins) - suite.Require().NoError(err) - err = suite.IBCOsmosisChain.GetSimApp().BankKeeper.SendCoinsFromModuleToAccount(suite.IBCOsmosisChain.GetContext(), minttypes.ModuleName, suite.IBCOsmosisChain.SenderAccount.GetAddress(), coins) - suite.Require().NoError(err) - - // Mint coins on the cosmos side which we'll use to unlock our aevmos - coinAtom := sdk.NewCoin("uatom", sdk.NewInt(10)) - coins = sdk.NewCoins(coinAtom) - err = suite.IBCCosmosChain.GetSimApp().BankKeeper.MintCoins(suite.IBCCosmosChain.GetContext(), minttypes.ModuleName, coins) - suite.Require().NoError(err) - err = suite.IBCCosmosChain.GetSimApp().BankKeeper.SendCoinsFromModuleToAccount(suite.IBCCosmosChain.GetContext(), minttypes.ModuleName, suite.IBCCosmosChain.SenderAccount.GetAddress(), coins) - suite.Require().NoError(err) - - // Mint coins for IBC tx fee on Osmosis and Cosmos chains - stkCoin := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, amt)) - - err = suite.IBCOsmosisChain.GetSimApp().BankKeeper.MintCoins(suite.IBCOsmosisChain.GetContext(), minttypes.ModuleName, stkCoin) - suite.Require().NoError(err) - err = suite.IBCOsmosisChain.GetSimApp().BankKeeper.SendCoinsFromModuleToAccount(suite.IBCOsmosisChain.GetContext(), minttypes.ModuleName, suite.IBCOsmosisChain.SenderAccount.GetAddress(), stkCoin) - suite.Require().NoError(err) - - err = suite.IBCCosmosChain.GetSimApp().BankKeeper.MintCoins(suite.IBCCosmosChain.GetContext(), minttypes.ModuleName, stkCoin) - suite.Require().NoError(err) - err = suite.IBCCosmosChain.GetSimApp().BankKeeper.SendCoinsFromModuleToAccount(suite.IBCCosmosChain.GetContext(), minttypes.ModuleName, suite.IBCCosmosChain.SenderAccount.GetAddress(), stkCoin) - suite.Require().NoError(err) - - claimparams := claimstypes.DefaultParams() - claimparams.AirdropStartTime = suite.EvmosChain.GetContext().BlockTime() - claimparams.EnableClaims = true - err = suite.EvmosChain.App.(*app.Evmos).ClaimsKeeper.SetParams(suite.EvmosChain.GetContext(), claimparams) - suite.Require().NoError(err) - - params := types.DefaultParams() - params.EnableRecovery = true - err = suite.EvmosChain.App.(*app.Evmos).RecoveryKeeper.SetParams(suite.EvmosChain.GetContext(), params) - suite.Require().NoError(err) - - evmParams := suite.EvmosChain.App.(*app.Evmos).EvmKeeper.GetParams(s.EvmosChain.GetContext()) - evmParams.EvmDenom = utils.BaseDenom - err = suite.EvmosChain.App.(*app.Evmos).EvmKeeper.SetParams(s.EvmosChain.GetContext(), evmParams) - suite.Require().NoError(err) - - suite.pathOsmosisEvmos = ibctesting.NewTransferPath(suite.IBCOsmosisChain, suite.EvmosChain) // clientID, connectionID, channelID empty - suite.pathCosmosEvmos = ibctesting.NewTransferPath(suite.IBCCosmosChain, suite.EvmosChain) - suite.pathOsmosisCosmos = ibctesting.NewTransferPath(suite.IBCCosmosChain, suite.IBCOsmosisChain) - ibctesting.SetupPath(suite.coordinator, suite.pathOsmosisEvmos) // clientID, connectionID, channelID filled - ibctesting.SetupPath(suite.coordinator, suite.pathCosmosEvmos) - ibctesting.SetupPath(suite.coordinator, suite.pathOsmosisCosmos) - suite.Require().Equal("07-tendermint-0", suite.pathOsmosisEvmos.EndpointA.ClientID) - suite.Require().Equal("connection-0", suite.pathOsmosisEvmos.EndpointA.ConnectionID) - suite.Require().Equal("channel-0", suite.pathOsmosisEvmos.EndpointA.ChannelID) -} - -var timeoutHeight = clienttypes.NewHeight(1000, 1000) - -func (suite *IBCTestingSuite) SendAndReceiveMessage(path *ibctesting.Path, origin *ibcgotesting.TestChain, coin string, amount int64, sender string, receiver string, seq uint64) { - // Send coin from A to B - transferMsg := transfertypes.NewMsgTransfer(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, sdk.NewCoin(coin, sdk.NewInt(amount)), sender, receiver, timeoutHeight, 0, "") - _, err := ibctesting.SendMsgs(origin, ibctesting.DefaultFeeAmt, transferMsg) - suite.Require().NoError(err) // message committed - // Recreate the packet that was sent - transfer := transfertypes.NewFungibleTokenPacketData(coin, strconv.Itoa(int(amount)), sender, receiver, "") - packet := channeltypes.NewPacket(transfer.GetBytes(), seq, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, 0) - // Receive message on the counterparty side, and send ack - err = path.RelayPacket(packet) - suite.Require().NoError(err) -} - -func CreatePacket(amount, denom, sender, receiver, srcPort, srcChannel, dstPort, dstChannel string, seq, timeout uint64) channeltypes.Packet { - transfer := transfertypes.FungibleTokenPacketData{ - Amount: amount, - Denom: denom, - Receiver: sender, - Sender: receiver, - } - return channeltypes.NewPacket( - transfer.GetBytes(), - seq, - srcPort, - srcChannel, - dstPort, - dstChannel, - clienttypes.ZeroHeight(), // timeout height disabled - timeout, - ) -} diff --git a/x/recovery/keeper/mock_test.go b/x/recovery/keeper/mock_test.go new file mode 100644 index 0000000000..17d037168e --- /dev/null +++ b/x/recovery/keeper/mock_test.go @@ -0,0 +1,51 @@ +package keeper_test + +import ( + "context" + + "github.com/stretchr/testify/mock" + + tmbytes "github.com/tendermint/tendermint/libs/bytes" + + sdk "github.com/cosmos/cosmos-sdk/types" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + + transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" + + "github.com/evmos/evmos/v11/x/recovery/types" +) + +var _ types.TransferKeeper = &MockTransferKeeper{} + +// MockTransferKeeper defines a mocked object that implements the TransferKeeper +// interface. It's used on tests to abstract the complexity of IBC transfers. +// NOTE: Bank keeper logic is not mocked since we want to test that balance has +// been updated for sender and recipient. +type MockTransferKeeper struct { + mock.Mock + bankkeeper.Keeper +} + +func (m *MockTransferKeeper) GetDenomTrace(ctx sdk.Context, denomTraceHash tmbytes.HexBytes) (transfertypes.DenomTrace, bool) { + args := m.Called(mock.Anything, denomTraceHash) + return args.Get(0).(transfertypes.DenomTrace), args.Bool(1) +} + +func (m *MockTransferKeeper) Transfer(goCtx context.Context, msg *transfertypes.MsgTransfer) (*transfertypes.MsgTransferResponse, error) { + args := m.Called( + mock.Anything, + mock.Anything, + ) + ctx := sdk.UnwrapSDKContext(goCtx) + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + + err = m.SendCoinsFromAccountToModule(ctx, sender, transfertypes.ModuleName, sdk.Coins{msg.Token}) + if err != nil { + return nil, err + } + + return nil, args.Error(1) +} diff --git a/x/recovery/keeper/keeper_test.go b/x/recovery/keeper/setup_test.go similarity index 78% rename from x/recovery/keeper/keeper_test.go rename to x/recovery/keeper/setup_test.go index 2524d4d482..3c1480103b 100644 --- a/x/recovery/keeper/keeper_test.go +++ b/x/recovery/keeper/setup_test.go @@ -4,6 +4,9 @@ import ( "testing" "time" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + "github.com/stretchr/testify/suite" "github.com/tendermint/tendermint/crypto/tmhash" @@ -11,12 +14,14 @@ import ( tmversion "github.com/tendermint/tendermint/proto/tendermint/version" "github.com/tendermint/tendermint/version" + ibctesting "github.com/evmos/evmos/v11/ibc/testing" "github.com/evmos/evmos/v11/tests" "github.com/evmos/evmos/v11/utils" feemarkettypes "github.com/evmos/evmos/v11/x/feemarket/types" "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" + ibcgotesting "github.com/cosmos/ibc-go/v6/testing" "github.com/evmos/evmos/v11/app" claimstypes "github.com/evmos/evmos/v11/x/claims/types" @@ -85,3 +90,28 @@ func (suite *KeeperTestSuite) SetupTest() { func TestKeeperTestSuite(t *testing.T) { suite.Run(t, new(KeeperTestSuite)) } + +type IBCTestingSuite struct { + suite.Suite + coordinator *ibcgotesting.Coordinator + + // testing chains used for convenience and readability + EvmosChain *ibcgotesting.TestChain + IBCOsmosisChain *ibcgotesting.TestChain + IBCCosmosChain *ibcgotesting.TestChain + + pathOsmosisEvmos *ibctesting.Path + pathCosmosEvmos *ibctesting.Path + pathOsmosisCosmos *ibctesting.Path +} + +var s *IBCTestingSuite + +func TestIBCTestingSuite(t *testing.T) { + s = new(IBCTestingSuite) + suite.Run(t, s) + + // Run Ginkgo integration tests + RegisterFailHandler(Fail) + RunSpecs(t, "Keeper Suite") +} diff --git a/x/recovery/keeper/utils_test.go b/x/recovery/keeper/utils_test.go index 17d037168e..61699567ce 100644 --- a/x/recovery/keeper/utils_test.go +++ b/x/recovery/keeper/utils_test.go @@ -1,51 +1,137 @@ package keeper_test import ( - "context" - - "github.com/stretchr/testify/mock" - - tmbytes "github.com/tendermint/tendermint/libs/bytes" + "strconv" sdk "github.com/cosmos/cosmos-sdk/types" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" - + clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types" + ibcgotesting "github.com/cosmos/ibc-go/v6/testing" + "github.com/evmos/evmos/v11/app" + ibctesting "github.com/evmos/evmos/v11/ibc/testing" + "github.com/evmos/evmos/v11/utils" + claimstypes "github.com/evmos/evmos/v11/x/claims/types" + inflationtypes "github.com/evmos/evmos/v11/x/inflation/types" "github.com/evmos/evmos/v11/x/recovery/types" ) -var _ types.TransferKeeper = &MockTransferKeeper{} - -// MockTransferKeeper defines a mocked object that implements the TransferKeeper -// interface. It's used on tests to abstract the complexity of IBC transfers. -// NOTE: Bank keeper logic is not mocked since we want to test that balance has -// been updated for sender and recipient. -type MockTransferKeeper struct { - mock.Mock - bankkeeper.Keeper +func CreatePacket(amount, denom, sender, receiver, srcPort, srcChannel, dstPort, dstChannel string, seq, timeout uint64) channeltypes.Packet { + transfer := transfertypes.FungibleTokenPacketData{ + Amount: amount, + Denom: denom, + Receiver: sender, + Sender: receiver, + } + return channeltypes.NewPacket( + transfer.GetBytes(), + seq, + srcPort, + srcChannel, + dstPort, + dstChannel, + clienttypes.ZeroHeight(), // timeout height disabled + timeout, + ) } -func (m *MockTransferKeeper) GetDenomTrace(ctx sdk.Context, denomTraceHash tmbytes.HexBytes) (transfertypes.DenomTrace, bool) { - args := m.Called(mock.Anything, denomTraceHash) - return args.Get(0).(transfertypes.DenomTrace), args.Bool(1) -} +func (suite *IBCTestingSuite) SetupTest() { + // initializes 3 test chains + suite.coordinator = ibctesting.NewCoordinator(suite.T(), 1, 2) + suite.EvmosChain = suite.coordinator.GetChain(ibcgotesting.GetChainID(1)) + suite.IBCOsmosisChain = suite.coordinator.GetChain(ibcgotesting.GetChainID(2)) + suite.IBCCosmosChain = suite.coordinator.GetChain(ibcgotesting.GetChainID(3)) + suite.coordinator.CommitNBlocks(suite.EvmosChain, 2) + suite.coordinator.CommitNBlocks(suite.IBCOsmosisChain, 2) + suite.coordinator.CommitNBlocks(suite.IBCCosmosChain, 2) -func (m *MockTransferKeeper) Transfer(goCtx context.Context, msg *transfertypes.MsgTransfer) (*transfertypes.MsgTransferResponse, error) { - args := m.Called( - mock.Anything, - mock.Anything, - ) - ctx := sdk.UnwrapSDKContext(goCtx) - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return nil, err - } + // Mint coins locked on the evmos account generated with secp. + amt, ok := sdk.NewIntFromString("1000000000000000000000") + suite.Require().True(ok) + coinEvmos := sdk.NewCoin(utils.BaseDenom, amt) + coins := sdk.NewCoins(coinEvmos) + err := suite.EvmosChain.App.(*app.Evmos).BankKeeper.MintCoins(suite.EvmosChain.GetContext(), inflationtypes.ModuleName, coins) + suite.Require().NoError(err) - err = m.SendCoinsFromAccountToModule(ctx, sender, transfertypes.ModuleName, sdk.Coins{msg.Token}) - if err != nil { - return nil, err - } + // Fund sender address to pay fees + err = suite.EvmosChain.App.(*app.Evmos).BankKeeper.SendCoinsFromModuleToAccount(suite.EvmosChain.GetContext(), inflationtypes.ModuleName, suite.EvmosChain.SenderAccount.GetAddress(), coins) + suite.Require().NoError(err) + + coinEvmos = sdk.NewCoin(utils.BaseDenom, sdk.NewInt(10000)) + coins = sdk.NewCoins(coinEvmos) + err = suite.EvmosChain.App.(*app.Evmos).BankKeeper.MintCoins(suite.EvmosChain.GetContext(), inflationtypes.ModuleName, coins) + suite.Require().NoError(err) + err = suite.EvmosChain.App.(*app.Evmos).BankKeeper.SendCoinsFromModuleToAccount(suite.EvmosChain.GetContext(), inflationtypes.ModuleName, suite.IBCOsmosisChain.SenderAccount.GetAddress(), coins) + suite.Require().NoError(err) + + // Mint coins on the osmosis side which we'll use to unlock our aevmos + coinOsmo := sdk.NewCoin("uosmo", sdk.NewInt(10)) + coins = sdk.NewCoins(coinOsmo) + err = suite.IBCOsmosisChain.GetSimApp().BankKeeper.MintCoins(suite.IBCOsmosisChain.GetContext(), minttypes.ModuleName, coins) + suite.Require().NoError(err) + err = suite.IBCOsmosisChain.GetSimApp().BankKeeper.SendCoinsFromModuleToAccount(suite.IBCOsmosisChain.GetContext(), minttypes.ModuleName, suite.IBCOsmosisChain.SenderAccount.GetAddress(), coins) + suite.Require().NoError(err) + + // Mint coins on the cosmos side which we'll use to unlock our aevmos + coinAtom := sdk.NewCoin("uatom", sdk.NewInt(10)) + coins = sdk.NewCoins(coinAtom) + err = suite.IBCCosmosChain.GetSimApp().BankKeeper.MintCoins(suite.IBCCosmosChain.GetContext(), minttypes.ModuleName, coins) + suite.Require().NoError(err) + err = suite.IBCCosmosChain.GetSimApp().BankKeeper.SendCoinsFromModuleToAccount(suite.IBCCosmosChain.GetContext(), minttypes.ModuleName, suite.IBCCosmosChain.SenderAccount.GetAddress(), coins) + suite.Require().NoError(err) + + // Mint coins for IBC tx fee on Osmosis and Cosmos chains + stkCoin := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, amt)) + + err = suite.IBCOsmosisChain.GetSimApp().BankKeeper.MintCoins(suite.IBCOsmosisChain.GetContext(), minttypes.ModuleName, stkCoin) + suite.Require().NoError(err) + err = suite.IBCOsmosisChain.GetSimApp().BankKeeper.SendCoinsFromModuleToAccount(suite.IBCOsmosisChain.GetContext(), minttypes.ModuleName, suite.IBCOsmosisChain.SenderAccount.GetAddress(), stkCoin) + suite.Require().NoError(err) + + err = suite.IBCCosmosChain.GetSimApp().BankKeeper.MintCoins(suite.IBCCosmosChain.GetContext(), minttypes.ModuleName, stkCoin) + suite.Require().NoError(err) + err = suite.IBCCosmosChain.GetSimApp().BankKeeper.SendCoinsFromModuleToAccount(suite.IBCCosmosChain.GetContext(), minttypes.ModuleName, suite.IBCCosmosChain.SenderAccount.GetAddress(), stkCoin) + suite.Require().NoError(err) + + claimparams := claimstypes.DefaultParams() + claimparams.AirdropStartTime = suite.EvmosChain.GetContext().BlockTime() + claimparams.EnableClaims = true + err = suite.EvmosChain.App.(*app.Evmos).ClaimsKeeper.SetParams(suite.EvmosChain.GetContext(), claimparams) + suite.Require().NoError(err) + + params := types.DefaultParams() + params.EnableRecovery = true + err = suite.EvmosChain.App.(*app.Evmos).RecoveryKeeper.SetParams(suite.EvmosChain.GetContext(), params) + suite.Require().NoError(err) + + evmParams := suite.EvmosChain.App.(*app.Evmos).EvmKeeper.GetParams(s.EvmosChain.GetContext()) + evmParams.EvmDenom = utils.BaseDenom + err = suite.EvmosChain.App.(*app.Evmos).EvmKeeper.SetParams(s.EvmosChain.GetContext(), evmParams) + suite.Require().NoError(err) + + suite.pathOsmosisEvmos = ibctesting.NewTransferPath(suite.IBCOsmosisChain, suite.EvmosChain) // clientID, connectionID, channelID empty + suite.pathCosmosEvmos = ibctesting.NewTransferPath(suite.IBCCosmosChain, suite.EvmosChain) + suite.pathOsmosisCosmos = ibctesting.NewTransferPath(suite.IBCCosmosChain, suite.IBCOsmosisChain) + ibctesting.SetupPath(suite.coordinator, suite.pathOsmosisEvmos) // clientID, connectionID, channelID filled + ibctesting.SetupPath(suite.coordinator, suite.pathCosmosEvmos) + ibctesting.SetupPath(suite.coordinator, suite.pathOsmosisCosmos) + suite.Require().Equal("07-tendermint-0", suite.pathOsmosisEvmos.EndpointA.ClientID) + suite.Require().Equal("connection-0", suite.pathOsmosisEvmos.EndpointA.ConnectionID) + suite.Require().Equal("channel-0", suite.pathOsmosisEvmos.EndpointA.ChannelID) +} + +var timeoutHeight = clienttypes.NewHeight(1000, 1000) - return nil, args.Error(1) +func (suite *IBCTestingSuite) SendAndReceiveMessage(path *ibctesting.Path, origin *ibcgotesting.TestChain, coin string, amount int64, sender string, receiver string, seq uint64) { + // Send coin from A to B + transferMsg := transfertypes.NewMsgTransfer(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, sdk.NewCoin(coin, sdk.NewInt(amount)), sender, receiver, timeoutHeight, 0, "") + _, err := ibctesting.SendMsgs(origin, ibctesting.DefaultFeeAmt, transferMsg) + suite.Require().NoError(err) // message committed + // Recreate the packet that was sent + transfer := transfertypes.NewFungibleTokenPacketData(coin, strconv.Itoa(int(amount)), sender, receiver, "") + packet := channeltypes.NewPacket(transfer.GetBytes(), seq, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, 0) + // Receive message on the counterparty side, and send ack + err = path.RelayPacket(packet) + suite.Require().NoError(err) } diff --git a/x/recovery/migrations/v2/types/genesis.pb.go b/x/recovery/migrations/v2/types/genesis.pb.go index 6fcdf887f5..49a20a399d 100644 --- a/x/recovery/migrations/v2/types/genesis.pb.go +++ b/x/recovery/migrations/v2/types/genesis.pb.go @@ -5,21 +5,24 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/protobuf/types/known/durationpb" io "io" math "math" math_bits "math/bits" time "time" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "google.golang.org/protobuf/types/known/durationpb" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf + _ = time.Kitchen +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -39,9 +42,11 @@ func (*V2GenesisState) ProtoMessage() {} func (*V2GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_8a3e70cb61e26f25, []int{0} } + func (m *V2GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V2GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V2GenesisState.Marshal(b, m, deterministic) @@ -54,12 +59,15 @@ func (m *V2GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } + func (m *V2GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_V2GenesisState.Merge(m, src) } + func (m *V2GenesisState) XXX_Size() int { return m.Size() } + func (m *V2GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_V2GenesisState.DiscardUnknown(m) } @@ -87,9 +95,11 @@ func (*V2Params) ProtoMessage() {} func (*V2Params) Descriptor() ([]byte, []int) { return fileDescriptor_8a3e70cb61e26f25, []int{1} } + func (m *V2Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V2Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V2Params.Marshal(b, m, deterministic) @@ -102,12 +112,15 @@ func (m *V2Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *V2Params) XXX_Merge(src proto.Message) { xxx_messageInfo_V2Params.Merge(m, src) } + func (m *V2Params) XXX_Size() int { return m.Size() } + func (m *V2Params) XXX_DiscardUnknown() { xxx_messageInfo_V2Params.DiscardUnknown(m) } @@ -243,6 +256,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *V2GenesisState) Size() (n int) { if m == nil { return 0 @@ -271,9 +285,11 @@ func (m *V2Params) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *V2GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -357,6 +373,7 @@ func (m *V2GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func (m *V2Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -460,6 +477,7 @@ func (m *V2Params) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/recovery/types/genesis.pb.go b/x/recovery/types/genesis.pb.go index 2a98d37167..5e0a397a91 100644 --- a/x/recovery/types/genesis.pb.go +++ b/x/recovery/types/genesis.pb.go @@ -5,21 +5,24 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "google.golang.org/protobuf/types/known/durationpb" io "io" math "math" math_bits "math/bits" time "time" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "google.golang.org/protobuf/types/known/durationpb" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf + _ = time.Kitchen +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -39,9 +42,11 @@ func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_8a3e70cb61e26f25, []int{0} } + func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) @@ -54,12 +59,15 @@ func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState.Merge(m, src) } + func (m *GenesisState) XXX_Size() int { return m.Size() } + func (m *GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState.DiscardUnknown(m) } @@ -87,9 +95,11 @@ func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_8a3e70cb61e26f25, []int{1} } + func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Params.Marshal(b, m, deterministic) @@ -102,12 +112,15 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Params) XXX_Merge(src proto.Message) { xxx_messageInfo_Params.Merge(m, src) } + func (m *Params) XXX_Size() int { return m.Size() } + func (m *Params) XXX_DiscardUnknown() { xxx_messageInfo_Params.DiscardUnknown(m) } @@ -243,6 +256,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -271,9 +285,11 @@ func (m *Params) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -357,6 +373,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -460,6 +477,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/recovery/types/query.pb.go b/x/recovery/types/query.pb.go index a9cd58fe6a..8080537c1f 100644 --- a/x/recovery/types/query.pb.go +++ b/x/recovery/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" @@ -13,15 +17,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -30,8 +33,7 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} +type QueryParamsRequest struct{} func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } @@ -39,9 +41,11 @@ func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_2d6fffa62670b057, []int{0} } + func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) @@ -54,12 +58,15 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsRequest.Merge(m, src) } + func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } + func (m *QueryParamsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } @@ -78,9 +85,11 @@ func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_2d6fffa62670b057, []int{1} } + func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) @@ -93,12 +102,15 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsResponse.Merge(m, src) } + func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } + func (m *QueryParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } @@ -142,8 +154,10 @@ var fileDescriptor_2d6fffa62670b057 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -181,8 +195,7 @@ type QueryServer interface { } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +type UnimplementedQueryServer struct{} func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") @@ -290,6 +303,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *QueryParamsRequest) Size() (n int) { if m == nil { return 0 @@ -313,9 +327,11 @@ func (m *QueryParamsResponse) Size() (n int) { func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -366,6 +382,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -449,6 +466,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/recovery/types/query.pb.gw.go b/x/recovery/types/query.pb.gw.go index 93771f6f97..52820d8d07 100644 --- a/x/recovery/types/query.pb.gw.go +++ b/x/recovery/types/query.pb.gw.go @@ -25,13 +25,15 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join +var ( + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join +) func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -39,7 +41,6 @@ func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -48,7 +49,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Params(ctx, &protoReq) return msg, metadata, err - } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -56,7 +56,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -77,7 +76,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -120,7 +118,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -138,16 +135,11 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil } -var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"evmos", "recovery", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) -) +var pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"evmos", "recovery", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage -) +var forward_Query_Params_0 = runtime.ForwardResponseMessage diff --git a/x/recovery/types/tx.pb.go b/x/recovery/types/tx.pb.go index e50d18ef87..3edd01e250 100644 --- a/x/recovery/types/tx.pb.go +++ b/x/recovery/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" @@ -14,15 +18,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -45,9 +48,11 @@ func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_d25d0e60b916986f, []int{0} } + func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) @@ -60,12 +65,15 @@ func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } + func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParams.Merge(m, src) } + func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParams) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } @@ -88,8 +96,7 @@ func (m *MsgUpdateParams) GetParams() Params { // MsgUpdateParamsResponse defines the response structure for executing a // MsgUpdateParams message. -type MsgUpdateParamsResponse struct { -} +type MsgUpdateParamsResponse struct{} func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } @@ -97,9 +104,11 @@ func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_d25d0e60b916986f, []int{1} } + func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) @@ -112,12 +121,15 @@ func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } + func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } @@ -156,8 +168,10 @@ var fileDescriptor_d25d0e60b916986f = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -197,8 +211,7 @@ type MsgServer interface { } // UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} +type UnimplementedMsgServer struct{} func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") @@ -313,6 +326,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *MsgUpdateParams) Size() (n int) { if m == nil { return 0 @@ -340,9 +354,11 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -458,6 +474,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -508,6 +525,7 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/recovery/types/tx.pb.gw.go b/x/recovery/types/tx.pb.gw.go index c6a88f829f..d7b55c5aad 100644 --- a/x/recovery/types/tx.pb.gw.go +++ b/x/recovery/types/tx.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - var ( - filter_Msg_UpdateParams_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join ) +var filter_Msg_UpdateParams_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + func request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateParams var metadata runtime.ServerMetadata @@ -50,7 +50,6 @@ func request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler msg, err := client.UpdateParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,7 +65,6 @@ func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Mar msg, err := server.UpdateParams(ctx, &protoReq) return msg, metadata, err - } // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". @@ -74,7 +72,6 @@ func local_request_Msg_UpdateParams_0(ctx context.Context, marshaler runtime.Mar // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { - mux.Handle("POST", pattern_Msg_UpdateParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -95,7 +92,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_UpdateParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -138,7 +134,6 @@ func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.C // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "MsgClient" to call the correct interceptors. func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { - mux.Handle("POST", pattern_Msg_UpdateParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -156,16 +151,11 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_UpdateParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil } -var ( - pattern_Msg_UpdateParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"evmos", "recovery", "v1", "tx", "update_params"}, "", runtime.AssumeColonVerbOpt(false))) -) +var pattern_Msg_UpdateParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"evmos", "recovery", "v1", "tx", "update_params"}, "", runtime.AssumeColonVerbOpt(false))) -var ( - forward_Msg_UpdateParams_0 = runtime.ForwardResponseMessage -) +var forward_Msg_UpdateParams_0 = runtime.ForwardResponseMessage diff --git a/x/revenue/keeper/integration_test.go b/x/revenue/keeper/integration_test.go index b3f281cbc3..04bf1fd736 100644 --- a/x/revenue/keeper/integration_test.go +++ b/x/revenue/keeper/integration_test.go @@ -5,30 +5,18 @@ import ( "math/big" "strings" - sdkmath "cosmossdk.io/math" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/tx/signing" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/evmos/evmos/v11/app" "github.com/evmos/evmos/v11/crypto/ethsecp256k1" - "github.com/evmos/evmos/v11/encoding" "github.com/evmos/evmos/v11/tests" "github.com/evmos/evmos/v11/testutil" - "github.com/evmos/evmos/v11/utils" - evmtypes "github.com/evmos/evmos/v11/x/evm/types" "github.com/evmos/evmos/v11/x/revenue/types" - authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - abci "github.com/tendermint/tendermint/abci/types" ) var contractCode = "600661000e60003960066000f300612222600055" @@ -723,258 +711,3 @@ var _ = Describe("Fee distribution:", Ordered, func() { }) }) }) - -func calculateFees( - denom string, - params types.Params, - res abci.ResponseDeliverTx, - gasPrice *big.Int, -) (sdk.Coin, sdk.Coin) { - feeDistribution := sdk.NewInt(res.GasUsed).Mul(sdk.NewIntFromBigInt(gasPrice)) - developerFee := sdk.NewDecFromInt(feeDistribution).Mul(params.DeveloperShares) - developerCoins := sdk.NewCoin(denom, developerFee.TruncateInt()) - validatorShares := sdk.OneDec().Sub(params.DeveloperShares) - validatorFee := sdk.NewDecFromInt(feeDistribution).Mul(validatorShares) - validatorCoins := sdk.NewCoin(denom, validatorFee.TruncateInt()) - return developerCoins, validatorCoins -} - -func getNonce(addressBytes []byte) uint64 { - return s.app.EvmKeeper.GetNonce( - s.ctx, - common.BytesToAddress(addressBytes), - ) -} - -func registerFee( - priv *ethsecp256k1.PrivKey, - contractAddress *common.Address, - withdrawerAddress sdk.AccAddress, - nonces []uint64, -) abci.ResponseDeliverTx { - deployerAddress := sdk.AccAddress(priv.PubKey().Address()) - msg := types.NewMsgRegisterRevenue(*contractAddress, deployerAddress, withdrawerAddress, nonces) - - res := deliverTx(priv, nil, msg) - s.Commit() - - if res.IsOK() { - registerEvent := res.GetEvents()[8] - Expect(registerEvent.Type).To(Equal(types.EventTypeRegisterRevenue)) - Expect(string(registerEvent.Attributes[0].Key)).To(Equal(sdk.AttributeKeySender)) - Expect(string(registerEvent.Attributes[1].Key)).To(Equal(types.AttributeKeyContract)) - Expect(string(registerEvent.Attributes[2].Key)).To(Equal(types.AttributeKeyWithdrawerAddress)) - } - return res -} - -func deployContractWithFactory(priv *ethsecp256k1.PrivKey, factoryAddress *common.Address) common.Address { - factoryNonce := getNonce(factoryAddress.Bytes()) - chainID := s.app.EvmKeeper.ChainID() - from := common.BytesToAddress(priv.PubKey().Address().Bytes()) - nonce := getNonce(from.Bytes()) - data := make([]byte, 0) - msgEthereumTx := evmtypes.NewTx( - chainID, - nonce, - factoryAddress, - nil, - uint64(100000), - big.NewInt(1000000000), - nil, - nil, - data, - nil, - ) - msgEthereumTx.From = from.String() - - res := deliverEthTx(priv, msgEthereumTx) - Expect(res.IsOK()).To(Equal(true), res.GetLog()) - s.Commit() - - ethereumTx := res.GetEvents()[12] - Expect(ethereumTx.Type).To(Equal("tx_log")) - Expect(string(ethereumTx.Attributes[0].Key)).To(Equal("txLog")) - txLog := string(ethereumTx.Attributes[0].Value) - - contractAddress := crypto.CreateAddress(*factoryAddress, factoryNonce) - Expect( - strings.Contains(txLog, strings.ToLower(contractAddress.String()[2:])), - ).To(BeTrue(), "log topic does not match created contract address") - - acc := s.app.EvmKeeper.GetAccountWithoutBalance(s.ctx, contractAddress) - s.Require().NotEmpty(acc, "contract not created") - s.Require().True(acc.IsContract(), "not a contract") - return contractAddress -} - -func deployContract(priv *ethsecp256k1.PrivKey, contractCode string) common.Address { - chainID := s.app.EvmKeeper.ChainID() - from := common.BytesToAddress(priv.PubKey().Address().Bytes()) - nonce := getNonce(from.Bytes()) - - data := common.Hex2Bytes(contractCode) - gasLimit := uint64(100000) - msgEthereumTx := evmtypes.NewTxContract( - chainID, - nonce, - nil, - gasLimit, - nil, - s.app.FeeMarketKeeper.GetBaseFee(s.ctx), - big.NewInt(1), - data, - ðtypes.AccessList{}, - ) - msgEthereumTx.From = from.String() - - res := deliverEthTx(priv, msgEthereumTx) - s.Commit() - - ethereumTx := res.GetEvents()[11] - Expect(ethereumTx.Type).To(Equal("ethereum_tx")) - Expect(string(ethereumTx.Attributes[1].Key)).To(Equal("ethereumTxHash")) - - contractAddress := crypto.CreateAddress(from, nonce) - acc := s.app.EvmKeeper.GetAccountWithoutBalance(s.ctx, contractAddress) - s.Require().NotEmpty(acc) - s.Require().True(acc.IsContract()) - return contractAddress -} - -func contractInteract( - priv *ethsecp256k1.PrivKey, - contractAddr *common.Address, - gasPrice *big.Int, - gasFeeCap *big.Int, - gasTipCap *big.Int, - accesses *ethtypes.AccessList, -) abci.ResponseDeliverTx { - msgEthereumTx := buildEthTx(priv, contractAddr, gasPrice, gasFeeCap, gasTipCap, accesses) - res := deliverEthTx(priv, msgEthereumTx) - Expect(res.IsOK()).To(Equal(true), res.GetLog()) - return res -} - -func buildEthTx( - priv *ethsecp256k1.PrivKey, - to *common.Address, - gasPrice *big.Int, - gasFeeCap *big.Int, - gasTipCap *big.Int, - accesses *ethtypes.AccessList, -) *evmtypes.MsgEthereumTx { - chainID := s.app.EvmKeeper.ChainID() - from := common.BytesToAddress(priv.PubKey().Address().Bytes()) - nonce := getNonce(from.Bytes()) - data := make([]byte, 0) - gasLimit := uint64(100000) - msgEthereumTx := evmtypes.NewTx( - chainID, - nonce, - to, - nil, - gasLimit, - gasPrice, - gasFeeCap, - gasTipCap, - data, - accesses, - ) - msgEthereumTx.From = from.String() - return msgEthereumTx -} - -func prepareEthTx(priv *ethsecp256k1.PrivKey, msgEthereumTx *evmtypes.MsgEthereumTx) []byte { - // Sign transaction - err := msgEthereumTx.Sign(s.ethSigner, tests.NewSigner(priv)) - s.Require().NoError(err) - - // Assemble transaction from fields - encodingConfig := encoding.MakeConfig(app.ModuleBasics) - txBuilder := encodingConfig.TxConfig.NewTxBuilder() - tx, err := msgEthereumTx.BuildTx(txBuilder, s.app.EvmKeeper.GetParams(s.ctx).EvmDenom) - s.Require().NoError(err) - - // Encode transaction by default Tx encoder and broadcasted over the network - txEncoder := encodingConfig.TxConfig.TxEncoder() - bz, err := txEncoder(tx) - s.Require().NoError(err) - - return bz -} - -func deliverEthTx(priv *ethsecp256k1.PrivKey, msgEthereumTx *evmtypes.MsgEthereumTx) abci.ResponseDeliverTx { - bz := prepareEthTx(priv, msgEthereumTx) - req := abci.RequestDeliverTx{Tx: bz} - res := s.app.BaseApp.DeliverTx(req) - return res -} - -func prepareCosmosTx(priv *ethsecp256k1.PrivKey, gasPrice *sdkmath.Int, msgs ...sdk.Msg) []byte { - encodingConfig := encoding.MakeConfig(app.ModuleBasics) - accountAddress := sdk.AccAddress(priv.PubKey().Address().Bytes()) - denom := utils.BaseDenom - - txBuilder := encodingConfig.TxConfig.NewTxBuilder() - - txBuilder.SetGasLimit(1000000) - if gasPrice == nil { - _gasPrice := sdk.NewInt(1) - gasPrice = &_gasPrice - } - amt, _ := sdk.NewIntFromString("1000000000000000") - fees := &sdk.Coins{{Denom: denom, Amount: gasPrice.Mul(amt)}} - txBuilder.SetFeeAmount(*fees) - err := txBuilder.SetMsgs(msgs...) - s.Require().NoError(err) - - seq, err := s.app.AccountKeeper.GetSequence(s.ctx, accountAddress) - s.Require().NoError(err) - - // First round: we gather all the signer infos. We use the "set empty - // signature" hack to do that. - sigV2 := signing.SignatureV2{ - PubKey: priv.PubKey(), - Data: &signing.SingleSignatureData{ - SignMode: encodingConfig.TxConfig.SignModeHandler().DefaultMode(), - Signature: nil, - }, - Sequence: seq, - } - - sigsV2 := []signing.SignatureV2{sigV2} - - err = txBuilder.SetSignatures(sigsV2...) - s.Require().NoError(err) - - // Second round: all signer infos are set, so each signer can sign. - accNumber := s.app.AccountKeeper.GetAccount(s.ctx, accountAddress).GetAccountNumber() - signerData := authsigning.SignerData{ - ChainID: s.ctx.ChainID(), - AccountNumber: accNumber, - Sequence: seq, - } - sigV2, err = tx.SignWithPrivKey( - encodingConfig.TxConfig.SignModeHandler().DefaultMode(), signerData, - txBuilder, priv, encodingConfig.TxConfig, - seq, - ) - s.Require().NoError(err) - - sigsV2 = []signing.SignatureV2{sigV2} - err = txBuilder.SetSignatures(sigsV2...) - s.Require().NoError(err) - - // bz are bytes to be broadcasted over the network - bz, err := encodingConfig.TxConfig.TxEncoder()(txBuilder.GetTx()) - s.Require().NoError(err) - return bz -} - -func deliverTx(priv *ethsecp256k1.PrivKey, gasPrice *sdkmath.Int, msgs ...sdk.Msg) abci.ResponseDeliverTx { //nolint:unparam - bz := prepareCosmosTx(priv, gasPrice, msgs...) - req := abci.RequestDeliverTx{Tx: bz} - res := s.app.BaseApp.DeliverTx(req) - return res -} diff --git a/x/revenue/keeper/keeper_test.go b/x/revenue/keeper/keeper_test.go deleted file mode 100644 index 68ef37bc1a..0000000000 --- a/x/revenue/keeper/keeper_test.go +++ /dev/null @@ -1,179 +0,0 @@ -package keeper_test - -import ( - "testing" - "time" - - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "github.com/evmos/evmos/v11/crypto/ethsecp256k1" - "github.com/evmos/evmos/v11/tests" - "github.com/evmos/evmos/v11/utils" - feemarkettypes "github.com/evmos/evmos/v11/x/feemarket/types" - - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/evmos/evmos/v11/app" - evm "github.com/evmos/evmos/v11/x/evm/types" - "github.com/evmos/evmos/v11/x/revenue/types" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/tmhash" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmversion "github.com/tendermint/tendermint/proto/tendermint/version" - "github.com/tendermint/tendermint/version" -) - -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - - app *app.Evmos - queryClient types.QueryClient - queryClientEvm evm.QueryClient - address common.Address - signer keyring.Signer - ethSigner ethtypes.Signer - consAddress sdk.ConsAddress - validator stakingtypes.Validator - denom string -} - -var s *KeeperTestSuite - -var ( - contract = tests.GenerateAddress() - deployer = sdk.AccAddress(tests.GenerateAddress().Bytes()) - withdraw = sdk.AccAddress(tests.GenerateAddress().Bytes()) -) - -func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) - suite.Run(t, s) - - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") -} - -func (suite *KeeperTestSuite) SetupTest() { - suite.app = app.Setup(false, feemarkettypes.DefaultGenesisState()) - suite.SetupApp() -} - -func (suite *KeeperTestSuite) SetupApp() { - t := suite.T() - // account key - priv, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) - suite.signer = tests.NewSigner(priv) - - suite.denom = utils.BaseDenom - - // consensus key - privCons, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - suite.consAddress = sdk.ConsAddress(privCons.PubKey().Address()) - suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{ - Height: 1, - ChainID: "evmos_9001-1", - Time: time.Now().UTC(), - ProposerAddress: suite.consAddress.Bytes(), - - Version: tmversion.Consensus{ - Block: version.BlockProtocol, - }, - LastBlockId: tmproto.BlockID{ - Hash: tmhash.Sum([]byte("block_id")), - PartSetHeader: tmproto.PartSetHeader{ - Total: 11, - Hash: tmhash.Sum([]byte("partset_header")), - }, - }, - AppHash: tmhash.Sum([]byte("app")), - DataHash: tmhash.Sum([]byte("data")), - EvidenceHash: tmhash.Sum([]byte("evidence")), - ValidatorsHash: tmhash.Sum([]byte("validators")), - NextValidatorsHash: tmhash.Sum([]byte("next_validators")), - ConsensusHash: tmhash.Sum([]byte("consensus")), - LastResultsHash: tmhash.Sum([]byte("last_result")), - }) - queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, suite.app.RevenueKeeper) - suite.queryClient = types.NewQueryClient(queryHelper) - - queryHelperEvm := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - evm.RegisterQueryServer(queryHelperEvm, suite.app.EvmKeeper) - suite.queryClientEvm = evm.NewQueryClient(queryHelperEvm) - - params := types.DefaultParams() - params.EnableRevenue = true - err = suite.app.RevenueKeeper.SetParams(suite.ctx, params) - require.NoError(t, err) - - stakingParams := suite.app.StakingKeeper.GetParams(suite.ctx) - stakingParams.BondDenom = suite.denom - suite.app.StakingKeeper.SetParams(suite.ctx, stakingParams) - - evmParams := suite.app.EvmKeeper.GetParams(suite.ctx) - evmParams.EvmDenom = suite.denom - err = suite.app.EvmKeeper.SetParams(suite.ctx, evmParams) - require.NoError(t, err) - - inflationParams := suite.app.InflationKeeper.GetParams(suite.ctx) - inflationParams.EnableInflation = false - err = suite.app.InflationKeeper.SetParams(suite.ctx, inflationParams) - require.NoError(t, err) - - // Set Validator - valAddr := sdk.ValAddress(suite.address.Bytes()) - validator, err := stakingtypes.NewValidator(valAddr, privCons.PubKey(), stakingtypes.Description{}) - require.NoError(t, err) - validator = stakingkeeper.TestingUpdateValidator(suite.app.StakingKeeper, suite.ctx, validator, true) - err = suite.app.StakingKeeper.AfterValidatorCreated(suite.ctx, validator.GetOperator()) - require.NoError(t, err) - err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) - require.NoError(t, err) - validators := s.app.StakingKeeper.GetValidators(s.ctx, 1) - suite.validator = validators[0] - - suite.ethSigner = ethtypes.LatestSignerForChainID(s.app.EvmKeeper.ChainID()) -} - -// Commit commits and starts a new block with an updated context. -func (suite *KeeperTestSuite) Commit() { - suite.CommitAfter(time.Second * 0) -} - -// Commit commits a block at a given time. -func (suite *KeeperTestSuite) CommitAfter(t time.Duration) { - header := suite.ctx.BlockHeader() - suite.app.EndBlock(abci.RequestEndBlock{Height: header.Height}) - _ = suite.app.Commit() - - header.Height++ - header.Time = header.Time.Add(t) - suite.app.BeginBlock(abci.RequestBeginBlock{ - Header: header, - }) - - // update ctx - suite.ctx = suite.app.BaseApp.NewContext(false, header) - - queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, suite.app.RevenueKeeper) - suite.queryClient = types.NewQueryClient(queryHelper) - - queryHelperEvm := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - evm.RegisterQueryServer(queryHelperEvm, suite.app.EvmKeeper) - suite.queryClientEvm = evm.NewQueryClient(queryHelperEvm) -} diff --git a/x/revenue/keeper/setup_test.go b/x/revenue/keeper/setup_test.go new file mode 100644 index 0000000000..d3abc49b18 --- /dev/null +++ b/x/revenue/keeper/setup_test.go @@ -0,0 +1,59 @@ +package keeper_test + +import ( + "testing" + + "github.com/ethereum/go-ethereum/common" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/evmos/evmos/v11/tests" + feemarkettypes "github.com/evmos/evmos/v11/x/feemarket/types" + + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/evmos/evmos/v11/app" + evm "github.com/evmos/evmos/v11/x/evm/types" + "github.com/evmos/evmos/v11/x/revenue/types" + "github.com/stretchr/testify/suite" +) + +type KeeperTestSuite struct { + suite.Suite + + ctx sdk.Context + + app *app.Evmos + queryClient types.QueryClient + queryClientEvm evm.QueryClient + address common.Address + signer keyring.Signer + ethSigner ethtypes.Signer + consAddress sdk.ConsAddress + validator stakingtypes.Validator + denom string +} + +var s *KeeperTestSuite + +var ( + contract = tests.GenerateAddress() + deployer = sdk.AccAddress(tests.GenerateAddress().Bytes()) + withdraw = sdk.AccAddress(tests.GenerateAddress().Bytes()) +) + +func TestKeeperTestSuite(t *testing.T) { + s = new(KeeperTestSuite) + suite.Run(t, s) + + // Run Ginkgo integration tests + RegisterFailHandler(Fail) + RunSpecs(t, "Keeper Suite") +} + +func (suite *KeeperTestSuite) SetupTest() { + suite.app = app.Setup(false, feemarkettypes.DefaultGenesisState()) + suite.SetupApp() +} diff --git a/x/revenue/keeper/utils_test.go b/x/revenue/keeper/utils_test.go new file mode 100644 index 0000000000..ea81052f6c --- /dev/null +++ b/x/revenue/keeper/utils_test.go @@ -0,0 +1,398 @@ +package keeper_test + +import ( + "math/big" + "strings" + "time" + + . "github.com/onsi/gomega" + + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/crypto/ethsecp256k1" + "github.com/evmos/evmos/v11/encoding" + "github.com/evmos/evmos/v11/tests" + "github.com/evmos/evmos/v11/utils" + evmtypes "github.com/evmos/evmos/v11/x/evm/types" + "github.com/evmos/evmos/v11/x/revenue/types" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/crypto/tmhash" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmversion "github.com/tendermint/tendermint/proto/tendermint/version" + "github.com/tendermint/tendermint/version" +) + +func (suite *KeeperTestSuite) SetupApp() { + t := suite.T() + // account key + priv, err := ethsecp256k1.GenerateKey() + require.NoError(t, err) + suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) + suite.signer = tests.NewSigner(priv) + + suite.denom = utils.BaseDenom + + // consensus key + privCons, err := ethsecp256k1.GenerateKey() + require.NoError(t, err) + suite.consAddress = sdk.ConsAddress(privCons.PubKey().Address()) + suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{ + Height: 1, + ChainID: "evmos_9001-1", + Time: time.Now().UTC(), + ProposerAddress: suite.consAddress.Bytes(), + + Version: tmversion.Consensus{ + Block: version.BlockProtocol, + }, + LastBlockId: tmproto.BlockID{ + Hash: tmhash.Sum([]byte("block_id")), + PartSetHeader: tmproto.PartSetHeader{ + Total: 11, + Hash: tmhash.Sum([]byte("partset_header")), + }, + }, + AppHash: tmhash.Sum([]byte("app")), + DataHash: tmhash.Sum([]byte("data")), + EvidenceHash: tmhash.Sum([]byte("evidence")), + ValidatorsHash: tmhash.Sum([]byte("validators")), + NextValidatorsHash: tmhash.Sum([]byte("next_validators")), + ConsensusHash: tmhash.Sum([]byte("consensus")), + LastResultsHash: tmhash.Sum([]byte("last_result")), + }) + queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, suite.app.RevenueKeeper) + suite.queryClient = types.NewQueryClient(queryHelper) + + queryHelperEvm := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + evmtypes.RegisterQueryServer(queryHelperEvm, suite.app.EvmKeeper) + suite.queryClientEvm = evmtypes.NewQueryClient(queryHelperEvm) + + params := types.DefaultParams() + params.EnableRevenue = true + err = suite.app.RevenueKeeper.SetParams(suite.ctx, params) + require.NoError(t, err) + + stakingParams := suite.app.StakingKeeper.GetParams(suite.ctx) + stakingParams.BondDenom = suite.denom + suite.app.StakingKeeper.SetParams(suite.ctx, stakingParams) + + evmParams := suite.app.EvmKeeper.GetParams(suite.ctx) + evmParams.EvmDenom = suite.denom + err = suite.app.EvmKeeper.SetParams(suite.ctx, evmParams) + require.NoError(t, err) + + inflationParams := suite.app.InflationKeeper.GetParams(suite.ctx) + inflationParams.EnableInflation = false + err = suite.app.InflationKeeper.SetParams(suite.ctx, inflationParams) + require.NoError(t, err) + + // Set Validator + valAddr := sdk.ValAddress(suite.address.Bytes()) + validator, err := stakingtypes.NewValidator(valAddr, privCons.PubKey(), stakingtypes.Description{}) + require.NoError(t, err) + validator = stakingkeeper.TestingUpdateValidator(suite.app.StakingKeeper, suite.ctx, validator, true) + err = suite.app.StakingKeeper.AfterValidatorCreated(suite.ctx, validator.GetOperator()) + require.NoError(t, err) + err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) + require.NoError(t, err) + validators := s.app.StakingKeeper.GetValidators(s.ctx, 1) + suite.validator = validators[0] + + suite.ethSigner = ethtypes.LatestSignerForChainID(s.app.EvmKeeper.ChainID()) +} + +// Commit commits and starts a new block with an updated context. +func (suite *KeeperTestSuite) Commit() { + suite.CommitAfter(time.Second * 0) +} + +// Commit commits a block at a given time. +func (suite *KeeperTestSuite) CommitAfter(t time.Duration) { + header := suite.ctx.BlockHeader() + suite.app.EndBlock(abci.RequestEndBlock{Height: header.Height}) + _ = suite.app.Commit() + + header.Height++ + header.Time = header.Time.Add(t) + suite.app.BeginBlock(abci.RequestBeginBlock{ + Header: header, + }) + + // update ctx + suite.ctx = suite.app.BaseApp.NewContext(false, header) + + queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, suite.app.RevenueKeeper) + suite.queryClient = types.NewQueryClient(queryHelper) + + queryHelperEvm := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + evmtypes.RegisterQueryServer(queryHelperEvm, suite.app.EvmKeeper) + suite.queryClientEvm = evmtypes.NewQueryClient(queryHelperEvm) +} + +func calculateFees( + denom string, + params types.Params, + res abci.ResponseDeliverTx, + gasPrice *big.Int, +) (sdk.Coin, sdk.Coin) { + feeDistribution := sdk.NewInt(res.GasUsed).Mul(sdk.NewIntFromBigInt(gasPrice)) + developerFee := sdk.NewDecFromInt(feeDistribution).Mul(params.DeveloperShares) + developerCoins := sdk.NewCoin(denom, developerFee.TruncateInt()) + validatorShares := sdk.OneDec().Sub(params.DeveloperShares) + validatorFee := sdk.NewDecFromInt(feeDistribution).Mul(validatorShares) + validatorCoins := sdk.NewCoin(denom, validatorFee.TruncateInt()) + return developerCoins, validatorCoins +} + +func getNonce(addressBytes []byte) uint64 { + return s.app.EvmKeeper.GetNonce( + s.ctx, + common.BytesToAddress(addressBytes), + ) +} + +func registerFee( + priv *ethsecp256k1.PrivKey, + contractAddress *common.Address, + withdrawerAddress sdk.AccAddress, + nonces []uint64, +) abci.ResponseDeliverTx { + deployerAddress := sdk.AccAddress(priv.PubKey().Address()) + msg := types.NewMsgRegisterRevenue(*contractAddress, deployerAddress, withdrawerAddress, nonces) + + res := deliverTx(priv, nil, msg) + s.Commit() + + if res.IsOK() { + registerEvent := res.GetEvents()[8] + Expect(registerEvent.Type).To(Equal(types.EventTypeRegisterRevenue)) + Expect(string(registerEvent.Attributes[0].Key)).To(Equal(sdk.AttributeKeySender)) + Expect(string(registerEvent.Attributes[1].Key)).To(Equal(types.AttributeKeyContract)) + Expect(string(registerEvent.Attributes[2].Key)).To(Equal(types.AttributeKeyWithdrawerAddress)) + } + return res +} + +func deployContractWithFactory(priv *ethsecp256k1.PrivKey, factoryAddress *common.Address) common.Address { + factoryNonce := getNonce(factoryAddress.Bytes()) + chainID := s.app.EvmKeeper.ChainID() + from := common.BytesToAddress(priv.PubKey().Address().Bytes()) + nonce := getNonce(from.Bytes()) + data := make([]byte, 0) + msgEthereumTx := evmtypes.NewTx( + chainID, + nonce, + factoryAddress, + nil, + uint64(100000), + big.NewInt(1000000000), + nil, + nil, + data, + nil, + ) + msgEthereumTx.From = from.String() + + res := deliverEthTx(priv, msgEthereumTx) + Expect(res.IsOK()).To(Equal(true), res.GetLog()) + s.Commit() + + ethereumTx := res.GetEvents()[12] + Expect(ethereumTx.Type).To(Equal("tx_log")) + Expect(string(ethereumTx.Attributes[0].Key)).To(Equal("txLog")) + txLog := string(ethereumTx.Attributes[0].Value) + + contractAddress := crypto.CreateAddress(*factoryAddress, factoryNonce) + Expect( + strings.Contains(txLog, strings.ToLower(contractAddress.String()[2:])), + ).To(BeTrue(), "log topic does not match created contract address") + + acc := s.app.EvmKeeper.GetAccountWithoutBalance(s.ctx, contractAddress) + s.Require().NotEmpty(acc, "contract not created") + s.Require().True(acc.IsContract(), "not a contract") + return contractAddress +} + +func deployContract(priv *ethsecp256k1.PrivKey, contractCode string) common.Address { + chainID := s.app.EvmKeeper.ChainID() + from := common.BytesToAddress(priv.PubKey().Address().Bytes()) + nonce := getNonce(from.Bytes()) + + data := common.Hex2Bytes(contractCode) + gasLimit := uint64(100000) + msgEthereumTx := evmtypes.NewTxContract( + chainID, + nonce, + nil, + gasLimit, + nil, + s.app.FeeMarketKeeper.GetBaseFee(s.ctx), + big.NewInt(1), + data, + ðtypes.AccessList{}, + ) + msgEthereumTx.From = from.String() + + res := deliverEthTx(priv, msgEthereumTx) + s.Commit() + + ethereumTx := res.GetEvents()[11] + Expect(ethereumTx.Type).To(Equal("ethereum_tx")) + Expect(string(ethereumTx.Attributes[1].Key)).To(Equal("ethereumTxHash")) + + contractAddress := crypto.CreateAddress(from, nonce) + acc := s.app.EvmKeeper.GetAccountWithoutBalance(s.ctx, contractAddress) + s.Require().NotEmpty(acc) + s.Require().True(acc.IsContract()) + return contractAddress +} + +func contractInteract( + priv *ethsecp256k1.PrivKey, + contractAddr *common.Address, + gasPrice *big.Int, + gasFeeCap *big.Int, + gasTipCap *big.Int, + accesses *ethtypes.AccessList, +) abci.ResponseDeliverTx { + msgEthereumTx := buildEthTx(priv, contractAddr, gasPrice, gasFeeCap, gasTipCap, accesses) + res := deliverEthTx(priv, msgEthereumTx) + Expect(res.IsOK()).To(Equal(true), res.GetLog()) + return res +} + +func buildEthTx( + priv *ethsecp256k1.PrivKey, + to *common.Address, + gasPrice *big.Int, + gasFeeCap *big.Int, + gasTipCap *big.Int, + accesses *ethtypes.AccessList, +) *evmtypes.MsgEthereumTx { + chainID := s.app.EvmKeeper.ChainID() + from := common.BytesToAddress(priv.PubKey().Address().Bytes()) + nonce := getNonce(from.Bytes()) + data := make([]byte, 0) + gasLimit := uint64(100000) + msgEthereumTx := evmtypes.NewTx( + chainID, + nonce, + to, + nil, + gasLimit, + gasPrice, + gasFeeCap, + gasTipCap, + data, + accesses, + ) + msgEthereumTx.From = from.String() + return msgEthereumTx +} + +func prepareEthTx(priv *ethsecp256k1.PrivKey, msgEthereumTx *evmtypes.MsgEthereumTx) []byte { + // Sign transaction + err := msgEthereumTx.Sign(s.ethSigner, tests.NewSigner(priv)) + s.Require().NoError(err) + + // Assemble transaction from fields + encodingConfig := encoding.MakeConfig(app.ModuleBasics) + txBuilder := encodingConfig.TxConfig.NewTxBuilder() + tx, err := msgEthereumTx.BuildTx(txBuilder, s.app.EvmKeeper.GetParams(s.ctx).EvmDenom) + s.Require().NoError(err) + + // Encode transaction by default Tx encoder and broadcasted over the network + txEncoder := encodingConfig.TxConfig.TxEncoder() + bz, err := txEncoder(tx) + s.Require().NoError(err) + + return bz +} + +func deliverEthTx(priv *ethsecp256k1.PrivKey, msgEthereumTx *evmtypes.MsgEthereumTx) abci.ResponseDeliverTx { + bz := prepareEthTx(priv, msgEthereumTx) + req := abci.RequestDeliverTx{Tx: bz} + res := s.app.BaseApp.DeliverTx(req) + return res +} + +func prepareCosmosTx(priv *ethsecp256k1.PrivKey, gasPrice *sdkmath.Int, msgs ...sdk.Msg) []byte { + encodingConfig := encoding.MakeConfig(app.ModuleBasics) + accountAddress := sdk.AccAddress(priv.PubKey().Address().Bytes()) + denom := utils.BaseDenom + + txBuilder := encodingConfig.TxConfig.NewTxBuilder() + + txBuilder.SetGasLimit(1000000) + if gasPrice == nil { + _gasPrice := sdk.NewInt(1) + gasPrice = &_gasPrice + } + amt, _ := sdk.NewIntFromString("1000000000000000") + fees := &sdk.Coins{{Denom: denom, Amount: gasPrice.Mul(amt)}} + txBuilder.SetFeeAmount(*fees) + err := txBuilder.SetMsgs(msgs...) + s.Require().NoError(err) + + seq, err := s.app.AccountKeeper.GetSequence(s.ctx, accountAddress) + s.Require().NoError(err) + + // First round: we gather all the signer infos. We use the "set empty + // signature" hack to do that. + sigV2 := signing.SignatureV2{ + PubKey: priv.PubKey(), + Data: &signing.SingleSignatureData{ + SignMode: encodingConfig.TxConfig.SignModeHandler().DefaultMode(), + Signature: nil, + }, + Sequence: seq, + } + + sigsV2 := []signing.SignatureV2{sigV2} + + err = txBuilder.SetSignatures(sigsV2...) + s.Require().NoError(err) + + // Second round: all signer infos are set, so each signer can sign. + accNumber := s.app.AccountKeeper.GetAccount(s.ctx, accountAddress).GetAccountNumber() + signerData := authsigning.SignerData{ + ChainID: s.ctx.ChainID(), + AccountNumber: accNumber, + Sequence: seq, + } + sigV2, err = tx.SignWithPrivKey( + encodingConfig.TxConfig.SignModeHandler().DefaultMode(), signerData, + txBuilder, priv, encodingConfig.TxConfig, + seq, + ) + s.Require().NoError(err) + + sigsV2 = []signing.SignatureV2{sigV2} + err = txBuilder.SetSignatures(sigsV2...) + s.Require().NoError(err) + + // bz are bytes to be broadcasted over the network + bz, err := encodingConfig.TxConfig.TxEncoder()(txBuilder.GetTx()) + s.Require().NoError(err) + return bz +} + +func deliverTx(priv *ethsecp256k1.PrivKey, gasPrice *sdkmath.Int, msgs ...sdk.Msg) abci.ResponseDeliverTx { //nolint:unparam + bz := prepareCosmosTx(priv, gasPrice, msgs...) + req := abci.RequestDeliverTx{Tx: bz} + res := s.app.BaseApp.DeliverTx(req) + return res +} diff --git a/x/revenue/migrations/v2/types/genesis.pb.go b/x/revenue/migrations/v2/types/genesis.pb.go index 2c8351a72a..cd7aff6d74 100644 --- a/x/revenue/migrations/v2/types/genesis.pb.go +++ b/x/revenue/migrations/v2/types/genesis.pb.go @@ -5,19 +5,22 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" "github.com/evmos/evmos/v11/x/revenue/types" proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -39,9 +42,11 @@ func (*V2GenesisState) ProtoMessage() {} func (*V2GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_649d64d9c3438055, []int{0} } + func (m *V2GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V2GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V2GenesisState.Marshal(b, m, deterministic) @@ -54,12 +59,15 @@ func (m *V2GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } + func (m *V2GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_V2GenesisState.Merge(m, src) } + func (m *V2GenesisState) XXX_Size() int { return m.Size() } + func (m *V2GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_V2GenesisState.DiscardUnknown(m) } @@ -98,9 +106,11 @@ func (*V2Params) ProtoMessage() {} func (*V2Params) Descriptor() ([]byte, []int) { return fileDescriptor_649d64d9c3438055, []int{1} } + func (m *V2Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *V2Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_V2Params.Marshal(b, m, deterministic) @@ -113,12 +123,15 @@ func (m *V2Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *V2Params) XXX_Merge(src proto.Message) { xxx_messageInfo_V2Params.Merge(m, src) } + func (m *V2Params) XXX_Size() int { return m.Size() } + func (m *V2Params) XXX_DiscardUnknown() { xxx_messageInfo_V2Params.DiscardUnknown(m) } @@ -278,6 +291,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *V2GenesisState) Size() (n int) { if m == nil { return 0 @@ -315,9 +329,11 @@ func (m *V2Params) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *V2GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -435,6 +451,7 @@ func (m *V2GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func (m *V2Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -558,6 +575,7 @@ func (m *V2Params) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/revenue/types/events.pb.go b/x/revenue/types/events.pb.go index 1a40493bf5..b7bf7d5978 100644 --- a/x/revenue/types/events.pb.go +++ b/x/revenue/types/events.pb.go @@ -5,16 +5,19 @@ package types import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -42,9 +45,11 @@ func (*EventRegisterRevenue) ProtoMessage() {} func (*EventRegisterRevenue) Descriptor() ([]byte, []int) { return fileDescriptor_56d63fc43f5946c2, []int{0} } + func (m *EventRegisterRevenue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EventRegisterRevenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EventRegisterRevenue.Marshal(b, m, deterministic) @@ -57,12 +62,15 @@ func (m *EventRegisterRevenue) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } + func (m *EventRegisterRevenue) XXX_Merge(src proto.Message) { xxx_messageInfo_EventRegisterRevenue.Merge(m, src) } + func (m *EventRegisterRevenue) XXX_Size() int { return m.Size() } + func (m *EventRegisterRevenue) XXX_DiscardUnknown() { xxx_messageInfo_EventRegisterRevenue.DiscardUnknown(m) } @@ -107,9 +115,11 @@ func (*EventUpdateRevenue) ProtoMessage() {} func (*EventUpdateRevenue) Descriptor() ([]byte, []int) { return fileDescriptor_56d63fc43f5946c2, []int{1} } + func (m *EventUpdateRevenue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EventUpdateRevenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EventUpdateRevenue.Marshal(b, m, deterministic) @@ -122,12 +132,15 @@ func (m *EventUpdateRevenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *EventUpdateRevenue) XXX_Merge(src proto.Message) { xxx_messageInfo_EventUpdateRevenue.Merge(m, src) } + func (m *EventUpdateRevenue) XXX_Size() int { return m.Size() } + func (m *EventUpdateRevenue) XXX_DiscardUnknown() { xxx_messageInfo_EventUpdateRevenue.DiscardUnknown(m) } @@ -170,9 +183,11 @@ func (*EventCancelRevenue) ProtoMessage() {} func (*EventCancelRevenue) Descriptor() ([]byte, []int) { return fileDescriptor_56d63fc43f5946c2, []int{2} } + func (m *EventCancelRevenue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EventCancelRevenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EventCancelRevenue.Marshal(b, m, deterministic) @@ -185,12 +200,15 @@ func (m *EventCancelRevenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *EventCancelRevenue) XXX_Merge(src proto.Message) { xxx_messageInfo_EventCancelRevenue.Merge(m, src) } + func (m *EventCancelRevenue) XXX_Size() int { return m.Size() } + func (m *EventCancelRevenue) XXX_DiscardUnknown() { xxx_messageInfo_EventCancelRevenue.DiscardUnknown(m) } @@ -229,9 +247,11 @@ func (*EventDistributeRevenue) ProtoMessage() {} func (*EventDistributeRevenue) Descriptor() ([]byte, []int) { return fileDescriptor_56d63fc43f5946c2, []int{3} } + func (m *EventDistributeRevenue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EventDistributeRevenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EventDistributeRevenue.Marshal(b, m, deterministic) @@ -244,12 +264,15 @@ func (m *EventDistributeRevenue) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *EventDistributeRevenue) XXX_Merge(src proto.Message) { xxx_messageInfo_EventDistributeRevenue.Merge(m, src) } + func (m *EventDistributeRevenue) XXX_Size() int { return m.Size() } + func (m *EventDistributeRevenue) XXX_DiscardUnknown() { xxx_messageInfo_EventDistributeRevenue.DiscardUnknown(m) } @@ -505,6 +528,7 @@ func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *EventRegisterRevenue) Size() (n int) { if m == nil { return 0 @@ -592,9 +616,11 @@ func (m *EventDistributeRevenue) Size() (n int) { func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozEvents(x uint64) (n int) { return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *EventRegisterRevenue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -741,6 +767,7 @@ func (m *EventRegisterRevenue) Unmarshal(dAtA []byte) error { } return nil } + func (m *EventUpdateRevenue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -887,6 +914,7 @@ func (m *EventUpdateRevenue) Unmarshal(dAtA []byte) error { } return nil } + func (m *EventCancelRevenue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1001,6 +1029,7 @@ func (m *EventCancelRevenue) Unmarshal(dAtA []byte) error { } return nil } + func (m *EventDistributeRevenue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1179,6 +1208,7 @@ func (m *EventDistributeRevenue) Unmarshal(dAtA []byte) error { } return nil } + func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/revenue/types/genesis.pb.go b/x/revenue/types/genesis.pb.go index 620baeee63..655d5e1593 100644 --- a/x/revenue/types/genesis.pb.go +++ b/x/revenue/types/genesis.pb.go @@ -5,18 +5,21 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -38,9 +41,11 @@ func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_649d64d9c3438055, []int{0} } + func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) @@ -53,12 +58,15 @@ func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState.Merge(m, src) } + func (m *GenesisState) XXX_Size() int { return m.Size() } + func (m *GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState.DiscardUnknown(m) } @@ -97,9 +105,11 @@ func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_649d64d9c3438055, []int{1} } + func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Params.Marshal(b, m, deterministic) @@ -112,12 +122,15 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Params) XXX_Merge(src proto.Message) { xxx_messageInfo_Params.Merge(m, src) } + func (m *Params) XXX_Size() int { return m.Size() } + func (m *Params) XXX_DiscardUnknown() { xxx_messageInfo_Params.DiscardUnknown(m) } @@ -277,6 +290,7 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -314,9 +328,11 @@ func (m *Params) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -434,6 +450,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } + func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -557,6 +574,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } + func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/revenue/types/query.pb.go b/x/revenue/types/query.pb.go index abab3eacaf..4d92ced34d 100644 --- a/x/revenue/types/query.pb.go +++ b/x/revenue/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" @@ -14,15 +18,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -42,9 +45,11 @@ func (*QueryRevenuesRequest) ProtoMessage() {} func (*QueryRevenuesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5e4b17cda6e8e927, []int{0} } + func (m *QueryRevenuesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryRevenuesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryRevenuesRequest.Marshal(b, m, deterministic) @@ -57,12 +62,15 @@ func (m *QueryRevenuesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } + func (m *QueryRevenuesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryRevenuesRequest.Merge(m, src) } + func (m *QueryRevenuesRequest) XXX_Size() int { return m.Size() } + func (m *QueryRevenuesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryRevenuesRequest.DiscardUnknown(m) } @@ -90,9 +98,11 @@ func (*QueryRevenuesResponse) ProtoMessage() {} func (*QueryRevenuesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5e4b17cda6e8e927, []int{1} } + func (m *QueryRevenuesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryRevenuesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryRevenuesResponse.Marshal(b, m, deterministic) @@ -105,12 +115,15 @@ func (m *QueryRevenuesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } + func (m *QueryRevenuesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryRevenuesResponse.Merge(m, src) } + func (m *QueryRevenuesResponse) XXX_Size() int { return m.Size() } + func (m *QueryRevenuesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryRevenuesResponse.DiscardUnknown(m) } @@ -143,9 +156,11 @@ func (*QueryRevenueRequest) ProtoMessage() {} func (*QueryRevenueRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5e4b17cda6e8e927, []int{2} } + func (m *QueryRevenueRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryRevenueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryRevenueRequest.Marshal(b, m, deterministic) @@ -158,12 +173,15 @@ func (m *QueryRevenueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryRevenueRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryRevenueRequest.Merge(m, src) } + func (m *QueryRevenueRequest) XXX_Size() int { return m.Size() } + func (m *QueryRevenueRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryRevenueRequest.DiscardUnknown(m) } @@ -189,9 +207,11 @@ func (*QueryRevenueResponse) ProtoMessage() {} func (*QueryRevenueResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5e4b17cda6e8e927, []int{3} } + func (m *QueryRevenueResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryRevenueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryRevenueResponse.Marshal(b, m, deterministic) @@ -204,12 +224,15 @@ func (m *QueryRevenueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } + func (m *QueryRevenueResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryRevenueResponse.Merge(m, src) } + func (m *QueryRevenueResponse) XXX_Size() int { return m.Size() } + func (m *QueryRevenueResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryRevenueResponse.DiscardUnknown(m) } @@ -224,8 +247,7 @@ func (m *QueryRevenueResponse) GetRevenue() Revenue { } // QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} +type QueryParamsRequest struct{} func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } @@ -233,9 +255,11 @@ func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5e4b17cda6e8e927, []int{4} } + func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) @@ -248,12 +272,15 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsRequest.Merge(m, src) } + func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } + func (m *QueryParamsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } @@ -272,9 +299,11 @@ func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5e4b17cda6e8e927, []int{5} } + func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) @@ -287,12 +316,15 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsResponse.Merge(m, src) } + func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } + func (m *QueryParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } @@ -321,9 +353,11 @@ func (*QueryDeployerRevenuesRequest) ProtoMessage() {} func (*QueryDeployerRevenuesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5e4b17cda6e8e927, []int{6} } + func (m *QueryDeployerRevenuesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryDeployerRevenuesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryDeployerRevenuesRequest.Marshal(b, m, deterministic) @@ -336,12 +370,15 @@ func (m *QueryDeployerRevenuesRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryDeployerRevenuesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryDeployerRevenuesRequest.Merge(m, src) } + func (m *QueryDeployerRevenuesRequest) XXX_Size() int { return m.Size() } + func (m *QueryDeployerRevenuesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryDeployerRevenuesRequest.DiscardUnknown(m) } @@ -377,9 +414,11 @@ func (*QueryDeployerRevenuesResponse) ProtoMessage() {} func (*QueryDeployerRevenuesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5e4b17cda6e8e927, []int{7} } + func (m *QueryDeployerRevenuesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryDeployerRevenuesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryDeployerRevenuesResponse.Marshal(b, m, deterministic) @@ -392,12 +431,15 @@ func (m *QueryDeployerRevenuesResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } + func (m *QueryDeployerRevenuesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryDeployerRevenuesResponse.Merge(m, src) } + func (m *QueryDeployerRevenuesResponse) XXX_Size() int { return m.Size() } + func (m *QueryDeployerRevenuesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryDeployerRevenuesResponse.DiscardUnknown(m) } @@ -433,9 +475,11 @@ func (*QueryWithdrawerRevenuesRequest) ProtoMessage() {} func (*QueryWithdrawerRevenuesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5e4b17cda6e8e927, []int{8} } + func (m *QueryWithdrawerRevenuesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryWithdrawerRevenuesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryWithdrawerRevenuesRequest.Marshal(b, m, deterministic) @@ -448,12 +492,15 @@ func (m *QueryWithdrawerRevenuesRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } + func (m *QueryWithdrawerRevenuesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryWithdrawerRevenuesRequest.Merge(m, src) } + func (m *QueryWithdrawerRevenuesRequest) XXX_Size() int { return m.Size() } + func (m *QueryWithdrawerRevenuesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryWithdrawerRevenuesRequest.DiscardUnknown(m) } @@ -489,9 +536,11 @@ func (*QueryWithdrawerRevenuesResponse) ProtoMessage() {} func (*QueryWithdrawerRevenuesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5e4b17cda6e8e927, []int{9} } + func (m *QueryWithdrawerRevenuesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryWithdrawerRevenuesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryWithdrawerRevenuesResponse.Marshal(b, m, deterministic) @@ -504,12 +553,15 @@ func (m *QueryWithdrawerRevenuesResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } + func (m *QueryWithdrawerRevenuesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryWithdrawerRevenuesResponse.Merge(m, src) } + func (m *QueryWithdrawerRevenuesResponse) XXX_Size() int { return m.Size() } + func (m *QueryWithdrawerRevenuesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryWithdrawerRevenuesResponse.DiscardUnknown(m) } @@ -592,8 +644,10 @@ var fileDescriptor_5e4b17cda6e8e927 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -687,21 +741,24 @@ type QueryServer interface { } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +type UnimplementedQueryServer struct{} func (*UnimplementedQueryServer) Revenues(ctx context.Context, req *QueryRevenuesRequest) (*QueryRevenuesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Revenues not implemented") } + func (*UnimplementedQueryServer) Revenue(ctx context.Context, req *QueryRevenueRequest) (*QueryRevenueResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Revenue not implemented") } + func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } + func (*UnimplementedQueryServer) DeployerRevenues(ctx context.Context, req *QueryDeployerRevenuesRequest) (*QueryDeployerRevenuesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DeployerRevenues not implemented") } + func (*UnimplementedQueryServer) WithdrawerRevenues(ctx context.Context, req *QueryWithdrawerRevenuesRequest) (*QueryWithdrawerRevenuesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method WithdrawerRevenues not implemented") } @@ -1215,6 +1272,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *QueryRevenuesRequest) Size() (n int) { if m == nil { return 0 @@ -1366,9 +1424,11 @@ func (m *QueryWithdrawerRevenuesResponse) Size() (n int) { func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *QueryRevenuesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1455,6 +1515,7 @@ func (m *QueryRevenuesRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryRevenuesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1575,6 +1636,7 @@ func (m *QueryRevenuesResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryRevenueRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1657,6 +1719,7 @@ func (m *QueryRevenueRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryRevenueResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1740,6 +1803,7 @@ func (m *QueryRevenueResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1790,6 +1854,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1873,6 +1938,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryDeployerRevenuesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1991,6 +2057,7 @@ func (m *QueryDeployerRevenuesRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryDeployerRevenuesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2109,6 +2176,7 @@ func (m *QueryDeployerRevenuesResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryWithdrawerRevenuesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2227,6 +2295,7 @@ func (m *QueryWithdrawerRevenuesRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryWithdrawerRevenuesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2345,6 +2414,7 @@ func (m *QueryWithdrawerRevenuesResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/revenue/types/query.pb.gw.go b/x/revenue/types/query.pb.gw.go index c4a0769202..e9fbcffe94 100644 --- a/x/revenue/types/query.pb.gw.go +++ b/x/revenue/types/query.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - var ( - filter_Query_Revenues_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join ) +var filter_Query_Revenues_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + func request_Query_Revenues_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryRevenuesRequest var metadata runtime.ServerMetadata @@ -50,7 +50,6 @@ func request_Query_Revenues_0(ctx context.Context, marshaler runtime.Marshaler, msg, err := client.Revenues(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Revenues_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,7 +65,6 @@ func local_request_Query_Revenues_0(ctx context.Context, marshaler runtime.Marsh msg, err := server.Revenues(ctx, &protoReq) return msg, metadata, err - } func request_Query_Revenue_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -93,7 +91,6 @@ func request_Query_Revenue_0(ctx context.Context, marshaler runtime.Marshaler, c msg, err := client.Revenue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Revenue_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -120,7 +117,6 @@ func local_request_Query_Revenue_0(ctx context.Context, marshaler runtime.Marsha msg, err := server.Revenue(ctx, &protoReq) return msg, metadata, err - } func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -129,7 +125,6 @@ func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -138,12 +133,9 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Params(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_DeployerRevenues_0 = &utilities.DoubleArray{Encoding: map[string]int{"deployer_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) +var filter_Query_DeployerRevenues_0 = &utilities.DoubleArray{Encoding: map[string]int{"deployer_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_Query_DeployerRevenues_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryDeployerRevenuesRequest @@ -176,7 +168,6 @@ func request_Query_DeployerRevenues_0(ctx context.Context, marshaler runtime.Mar msg, err := client.DeployerRevenues(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_DeployerRevenues_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -210,12 +201,9 @@ func local_request_Query_DeployerRevenues_0(ctx context.Context, marshaler runti msg, err := server.DeployerRevenues(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_WithdrawerRevenues_0 = &utilities.DoubleArray{Encoding: map[string]int{"withdrawer_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) +var filter_Query_WithdrawerRevenues_0 = &utilities.DoubleArray{Encoding: map[string]int{"withdrawer_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_Query_WithdrawerRevenues_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryWithdrawerRevenuesRequest @@ -248,7 +236,6 @@ func request_Query_WithdrawerRevenues_0(ctx context.Context, marshaler runtime.M msg, err := client.WithdrawerRevenues(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_WithdrawerRevenues_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -282,7 +269,6 @@ func local_request_Query_WithdrawerRevenues_0(ctx context.Context, marshaler run msg, err := server.WithdrawerRevenues(ctx, &protoReq) return msg, metadata, err - } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -290,7 +276,6 @@ func local_request_Query_WithdrawerRevenues_0(ctx context.Context, marshaler run // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Revenues_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -311,7 +296,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Revenues_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Revenue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -334,7 +318,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Revenue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -357,7 +340,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_DeployerRevenues_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -380,7 +362,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_DeployerRevenues_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_WithdrawerRevenues_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -403,7 +384,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_WithdrawerRevenues_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -446,7 +426,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Revenues_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -464,7 +443,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Revenues_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Revenue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -484,7 +462,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Revenue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -504,7 +481,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_DeployerRevenues_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -524,7 +500,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_DeployerRevenues_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_WithdrawerRevenues_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -544,7 +519,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_WithdrawerRevenues_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil diff --git a/x/revenue/types/revenue.pb.go b/x/revenue/types/revenue.pb.go index abe3ab4623..a7ab611182 100644 --- a/x/revenue/types/revenue.pb.go +++ b/x/revenue/types/revenue.pb.go @@ -5,16 +5,19 @@ package types import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -41,9 +44,11 @@ func (*Revenue) ProtoMessage() {} func (*Revenue) Descriptor() ([]byte, []int) { return fileDescriptor_33d087165192e447, []int{0} } + func (m *Revenue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *Revenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Revenue.Marshal(b, m, deterministic) @@ -56,12 +61,15 @@ func (m *Revenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } + func (m *Revenue) XXX_Merge(src proto.Message) { xxx_messageInfo_Revenue.Merge(m, src) } + func (m *Revenue) XXX_Size() int { return m.Size() } + func (m *Revenue) XXX_DiscardUnknown() { xxx_messageInfo_Revenue.DiscardUnknown(m) } @@ -167,6 +175,7 @@ func encodeVarintRevenue(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *Revenue) Size() (n int) { if m == nil { return 0 @@ -191,9 +200,11 @@ func (m *Revenue) Size() (n int) { func sovRevenue(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozRevenue(x uint64) (n int) { return sovRevenue(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *Revenue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -340,6 +351,7 @@ func (m *Revenue) Unmarshal(dAtA []byte) error { } return nil } + func skipRevenue(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/revenue/types/tx.pb.go b/x/revenue/types/tx.pb.go index 144065193b..c92b32a1fc 100644 --- a/x/revenue/types/tx.pb.go +++ b/x/revenue/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" @@ -15,15 +19,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -52,9 +55,11 @@ func (*MsgRegisterRevenue) ProtoMessage() {} func (*MsgRegisterRevenue) Descriptor() ([]byte, []int) { return fileDescriptor_2a6d23524264890a, []int{0} } + func (m *MsgRegisterRevenue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgRegisterRevenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgRegisterRevenue.Marshal(b, m, deterministic) @@ -67,12 +72,15 @@ func (m *MsgRegisterRevenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *MsgRegisterRevenue) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgRegisterRevenue.Merge(m, src) } + func (m *MsgRegisterRevenue) XXX_Size() int { return m.Size() } + func (m *MsgRegisterRevenue) XXX_DiscardUnknown() { xxx_messageInfo_MsgRegisterRevenue.DiscardUnknown(m) } @@ -108,8 +116,7 @@ func (m *MsgRegisterRevenue) GetNonces() []uint64 { } // MsgRegisterRevenueResponse defines the MsgRegisterRevenue response type -type MsgRegisterRevenueResponse struct { -} +type MsgRegisterRevenueResponse struct{} func (m *MsgRegisterRevenueResponse) Reset() { *m = MsgRegisterRevenueResponse{} } func (m *MsgRegisterRevenueResponse) String() string { return proto.CompactTextString(m) } @@ -117,9 +124,11 @@ func (*MsgRegisterRevenueResponse) ProtoMessage() {} func (*MsgRegisterRevenueResponse) Descriptor() ([]byte, []int) { return fileDescriptor_2a6d23524264890a, []int{1} } + func (m *MsgRegisterRevenueResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgRegisterRevenueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgRegisterRevenueResponse.Marshal(b, m, deterministic) @@ -132,12 +141,15 @@ func (m *MsgRegisterRevenueResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } + func (m *MsgRegisterRevenueResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgRegisterRevenueResponse.Merge(m, src) } + func (m *MsgRegisterRevenueResponse) XXX_Size() int { return m.Size() } + func (m *MsgRegisterRevenueResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgRegisterRevenueResponse.DiscardUnknown(m) } @@ -162,9 +174,11 @@ func (*MsgUpdateRevenue) ProtoMessage() {} func (*MsgUpdateRevenue) Descriptor() ([]byte, []int) { return fileDescriptor_2a6d23524264890a, []int{2} } + func (m *MsgUpdateRevenue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateRevenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateRevenue.Marshal(b, m, deterministic) @@ -177,12 +191,15 @@ func (m *MsgUpdateRevenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } + func (m *MsgUpdateRevenue) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateRevenue.Merge(m, src) } + func (m *MsgUpdateRevenue) XXX_Size() int { return m.Size() } + func (m *MsgUpdateRevenue) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateRevenue.DiscardUnknown(m) } @@ -211,8 +228,7 @@ func (m *MsgUpdateRevenue) GetWithdrawerAddress() string { } // MsgUpdateRevenueResponse defines the MsgUpdateRevenue response type -type MsgUpdateRevenueResponse struct { -} +type MsgUpdateRevenueResponse struct{} func (m *MsgUpdateRevenueResponse) Reset() { *m = MsgUpdateRevenueResponse{} } func (m *MsgUpdateRevenueResponse) String() string { return proto.CompactTextString(m) } @@ -220,9 +236,11 @@ func (*MsgUpdateRevenueResponse) ProtoMessage() {} func (*MsgUpdateRevenueResponse) Descriptor() ([]byte, []int) { return fileDescriptor_2a6d23524264890a, []int{3} } + func (m *MsgUpdateRevenueResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateRevenueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateRevenueResponse.Marshal(b, m, deterministic) @@ -235,12 +253,15 @@ func (m *MsgUpdateRevenueResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } + func (m *MsgUpdateRevenueResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateRevenueResponse.Merge(m, src) } + func (m *MsgUpdateRevenueResponse) XXX_Size() int { return m.Size() } + func (m *MsgUpdateRevenueResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateRevenueResponse.DiscardUnknown(m) } @@ -262,9 +283,11 @@ func (*MsgCancelRevenue) ProtoMessage() {} func (*MsgCancelRevenue) Descriptor() ([]byte, []int) { return fileDescriptor_2a6d23524264890a, []int{4} } + func (m *MsgCancelRevenue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgCancelRevenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgCancelRevenue.Marshal(b, m, deterministic) @@ -277,12 +300,15 @@ func (m *MsgCancelRevenue) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } + func (m *MsgCancelRevenue) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgCancelRevenue.Merge(m, src) } + func (m *MsgCancelRevenue) XXX_Size() int { return m.Size() } + func (m *MsgCancelRevenue) XXX_DiscardUnknown() { xxx_messageInfo_MsgCancelRevenue.DiscardUnknown(m) } @@ -304,8 +330,7 @@ func (m *MsgCancelRevenue) GetDeployerAddress() string { } // MsgCancelRevenueResponse defines the MsgCancelRevenue response type -type MsgCancelRevenueResponse struct { -} +type MsgCancelRevenueResponse struct{} func (m *MsgCancelRevenueResponse) Reset() { *m = MsgCancelRevenueResponse{} } func (m *MsgCancelRevenueResponse) String() string { return proto.CompactTextString(m) } @@ -313,9 +338,11 @@ func (*MsgCancelRevenueResponse) ProtoMessage() {} func (*MsgCancelRevenueResponse) Descriptor() ([]byte, []int) { return fileDescriptor_2a6d23524264890a, []int{5} } + func (m *MsgCancelRevenueResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgCancelRevenueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgCancelRevenueResponse.Marshal(b, m, deterministic) @@ -328,12 +355,15 @@ func (m *MsgCancelRevenueResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } + func (m *MsgCancelRevenueResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgCancelRevenueResponse.Merge(m, src) } + func (m *MsgCancelRevenueResponse) XXX_Size() int { return m.Size() } + func (m *MsgCancelRevenueResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgCancelRevenueResponse.DiscardUnknown(m) } @@ -355,9 +385,11 @@ func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_2a6d23524264890a, []int{6} } + func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) @@ -370,12 +402,15 @@ func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } + func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParams.Merge(m, src) } + func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParams) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } @@ -398,8 +433,7 @@ func (m *MsgUpdateParams) GetParams() Params { // MsgUpdateParamsResponse defines the response structure for executing a // MsgUpdateParams message. -type MsgUpdateParamsResponse struct { -} +type MsgUpdateParamsResponse struct{} func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } @@ -407,9 +441,11 @@ func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_2a6d23524264890a, []int{7} } + func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) @@ -422,12 +458,15 @@ func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } + func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } + func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } @@ -488,8 +527,10 @@ var fileDescriptor_2a6d23524264890a = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -570,18 +611,20 @@ type MsgServer interface { } // UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} +type UnimplementedMsgServer struct{} func (*UnimplementedMsgServer) RegisterRevenue(ctx context.Context, req *MsgRegisterRevenue) (*MsgRegisterRevenueResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterRevenue not implemented") } + func (*UnimplementedMsgServer) UpdateRevenue(ctx context.Context, req *MsgUpdateRevenue) (*MsgUpdateRevenueResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateRevenue not implemented") } + func (*UnimplementedMsgServer) CancelRevenue(ctx context.Context, req *MsgCancelRevenue) (*MsgCancelRevenueResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CancelRevenue not implemented") } + func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } @@ -973,6 +1016,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *MsgRegisterRevenue) Size() (n int) { if m == nil { return 0 @@ -1093,9 +1137,11 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *MsgRegisterRevenue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1318,6 +1364,7 @@ func (m *MsgRegisterRevenue) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgRegisterRevenueResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1368,6 +1415,7 @@ func (m *MsgRegisterRevenueResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateRevenue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1514,6 +1562,7 @@ func (m *MsgUpdateRevenue) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateRevenueResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1564,6 +1613,7 @@ func (m *MsgUpdateRevenueResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgCancelRevenue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1678,6 +1728,7 @@ func (m *MsgCancelRevenue) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgCancelRevenueResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1728,6 +1779,7 @@ func (m *MsgCancelRevenueResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1843,6 +1895,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1893,6 +1946,7 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/revenue/types/tx.pb.gw.go b/x/revenue/types/tx.pb.gw.go index 179a239b45..5c5b33cd88 100644 --- a/x/revenue/types/tx.pb.gw.go +++ b/x/revenue/types/tx.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - var ( - filter_Msg_RegisterRevenue_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join ) +var filter_Msg_RegisterRevenue_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + func request_Msg_RegisterRevenue_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgRegisterRevenue var metadata runtime.ServerMetadata @@ -50,7 +50,6 @@ func request_Msg_RegisterRevenue_0(ctx context.Context, marshaler runtime.Marsha msg, err := client.RegisterRevenue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Msg_RegisterRevenue_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,12 +65,9 @@ func local_request_Msg_RegisterRevenue_0(ctx context.Context, marshaler runtime. msg, err := server.RegisterRevenue(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Msg_UpdateRevenue_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Msg_UpdateRevenue_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Msg_UpdateRevenue_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateRevenue @@ -86,7 +82,6 @@ func request_Msg_UpdateRevenue_0(ctx context.Context, marshaler runtime.Marshale msg, err := client.UpdateRevenue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Msg_UpdateRevenue_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -102,12 +97,9 @@ func local_request_Msg_UpdateRevenue_0(ctx context.Context, marshaler runtime.Ma msg, err := server.UpdateRevenue(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Msg_CancelRevenue_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Msg_CancelRevenue_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Msg_CancelRevenue_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgCancelRevenue @@ -122,7 +114,6 @@ func request_Msg_CancelRevenue_0(ctx context.Context, marshaler runtime.Marshale msg, err := client.CancelRevenue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Msg_CancelRevenue_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -138,7 +129,6 @@ func local_request_Msg_CancelRevenue_0(ctx context.Context, marshaler runtime.Ma msg, err := server.CancelRevenue(ctx, &protoReq) return msg, metadata, err - } // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". @@ -146,7 +136,6 @@ func local_request_Msg_CancelRevenue_0(ctx context.Context, marshaler runtime.Ma // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { - mux.Handle("POST", pattern_Msg_RegisterRevenue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -167,7 +156,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_RegisterRevenue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("POST", pattern_Msg_UpdateRevenue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -190,7 +178,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_UpdateRevenue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("POST", pattern_Msg_CancelRevenue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -213,7 +200,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_CancelRevenue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -256,7 +242,6 @@ func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.C // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "MsgClient" to call the correct interceptors. func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { - mux.Handle("POST", pattern_Msg_RegisterRevenue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -274,7 +259,6 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_RegisterRevenue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("POST", pattern_Msg_UpdateRevenue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -294,7 +278,6 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_UpdateRevenue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("POST", pattern_Msg_CancelRevenue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -314,7 +297,6 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_CancelRevenue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil diff --git a/x/vesting/keeper/keeper_test.go b/x/vesting/keeper/keeper_test.go deleted file mode 100644 index 43bf4745cb..0000000000 --- a/x/vesting/keeper/keeper_test.go +++ /dev/null @@ -1,270 +0,0 @@ -package keeper_test - -import ( - "encoding/json" - "math/big" - "testing" - "time" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/tmhash" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmversion "github.com/tendermint/tendermint/proto/tendermint/version" - "github.com/tendermint/tendermint/version" - - ethtypes "github.com/ethereum/go-ethereum/core/types" - - "github.com/evmos/evmos/v11/app" - "github.com/evmos/evmos/v11/contracts" - "github.com/evmos/evmos/v11/crypto/ethsecp256k1" - "github.com/evmos/evmos/v11/encoding" - "github.com/evmos/evmos/v11/server/config" - "github.com/evmos/evmos/v11/tests" - evmostypes "github.com/evmos/evmos/v11/types" - epochstypes "github.com/evmos/evmos/v11/x/epochs/types" - evm "github.com/evmos/evmos/v11/x/evm/types" - "github.com/evmos/evmos/v11/x/vesting/types" -) - -var ( - contract common.Address - contract2 common.Address -) - -var ( - erc20Name = "Coin Token" - erc20Symbol = "CTKN" - erc20Name2 = "Coin Token 2" - erc20Symbol2 = "CTKN2" - erc20Decimals = uint8(18) -) - -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - app *app.Evmos - queryClientEvm evm.QueryClient - queryClient types.QueryClient - address common.Address - consAddress sdk.ConsAddress - validator stakingtypes.Validator - clientCtx client.Context - ethSigner ethtypes.Signer - signer keyring.Signer -} - -var s *KeeperTestSuite - -func TestKeeperTestSuite(t *testing.T) { - s = new(KeeperTestSuite) - suite.Run(t, s) - - // Run Ginkgo integration tests - RegisterFailHandler(Fail) - RunSpecs(t, "Keeper Suite") -} - -func (suite *KeeperTestSuite) SetupTest() { - suite.DoSetupTest(suite.T()) -} - -// Test helpers -func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { - checkTx := false - - // account key - priv, err := ethsecp256k1.GenerateKey() - require.NoError(t, err) - suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) - suite.signer = tests.NewSigner(priv) - - // consensus key - priv, err = ethsecp256k1.GenerateKey() - require.NoError(t, err) - suite.consAddress = sdk.ConsAddress(priv.PubKey().Address()) - - // Init app - suite.app = app.Setup(checkTx, nil) - - // Set Context - suite.ctx = suite.app.BaseApp.NewContext(checkTx, tmproto.Header{ - Height: 1, - ChainID: "evmos_9001-1", - Time: time.Now().UTC(), - ProposerAddress: suite.consAddress.Bytes(), - - Version: tmversion.Consensus{ - Block: version.BlockProtocol, - }, - LastBlockId: tmproto.BlockID{ - Hash: tmhash.Sum([]byte("block_id")), - PartSetHeader: tmproto.PartSetHeader{ - Total: 11, - Hash: tmhash.Sum([]byte("partset_header")), - }, - }, - AppHash: tmhash.Sum([]byte("app")), - DataHash: tmhash.Sum([]byte("data")), - EvidenceHash: tmhash.Sum([]byte("evidence")), - ValidatorsHash: tmhash.Sum([]byte("validators")), - NextValidatorsHash: tmhash.Sum([]byte("next_validators")), - ConsensusHash: tmhash.Sum([]byte("consensus")), - LastResultsHash: tmhash.Sum([]byte("last_result")), - }) - - // Setup query helpers - queryHelperEvm := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - evm.RegisterQueryServer(queryHelperEvm, suite.app.EvmKeeper) - suite.queryClientEvm = evm.NewQueryClient(queryHelperEvm) - - queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, suite.app.VestingKeeper) - suite.queryClient = types.NewQueryClient(queryHelper) - - // Set epoch start time and height for all epoch identifiers from the epoch - // module - identifiers := []string{epochstypes.WeekEpochID, epochstypes.DayEpochID} - for _, identifier := range identifiers { - epoch, found := suite.app.EpochsKeeper.GetEpochInfo(suite.ctx, identifier) - suite.Require().True(found) - epoch.StartTime = suite.ctx.BlockTime() - epoch.CurrentEpochStartHeight = suite.ctx.BlockHeight() - suite.app.EpochsKeeper.SetEpochInfo(suite.ctx, epoch) - } - - acc := &evmostypes.EthAccount{ - BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(suite.address.Bytes()), nil, 0, 0), - CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(), - } - - suite.app.AccountKeeper.SetAccount(suite.ctx, acc) - - // Set Validator - valAddr := sdk.ValAddress(suite.address.Bytes()) - validator, err := stakingtypes.NewValidator(valAddr, priv.PubKey(), stakingtypes.Description{}) - require.NoError(t, err) - validator = stakingkeeper.TestingUpdateValidator(suite.app.StakingKeeper, suite.ctx, validator, true) - err = suite.app.StakingKeeper.AfterValidatorCreated(suite.ctx, validator.GetOperator()) - require.NoError(t, err) - err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) - require.NoError(t, err) - validators := s.app.StakingKeeper.GetValidators(s.ctx, 1) - suite.validator = validators[0] - - encodingConfig := encoding.MakeConfig(app.ModuleBasics) - suite.clientCtx = client.Context{}.WithTxConfig(encodingConfig.TxConfig) - suite.ethSigner = ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID()) - - // Deploy contracts - contract, err = suite.DeployContract(erc20Name, erc20Symbol, erc20Decimals) - require.NoError(t, err) - contract2, err = suite.DeployContract(erc20Name2, erc20Symbol2, erc20Decimals) - require.NoError(t, err) -} - -// Commit commits and starts a new block with an updated context. -func (suite *KeeperTestSuite) Commit() { - suite.CommitAfter(time.Second * 0) -} - -// Commit commits a block at a given time. -func (suite *KeeperTestSuite) CommitAfter(t time.Duration) { - _ = suite.app.Commit() - header := suite.ctx.BlockHeader() - header.Height++ - header.Time = header.Time.Add(t) - suite.app.BeginBlock(abci.RequestBeginBlock{ - Header: header, - }) - - // update ctx - suite.ctx = suite.app.BaseApp.NewContext(false, header) - - queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - evm.RegisterQueryServer(queryHelper, suite.app.EvmKeeper) - suite.queryClientEvm = evm.NewQueryClient(queryHelper) -} - -// MintFeeCollector mints coins with the bank modules and sends them to the fee -// collector. -func (suite *KeeperTestSuite) MintFeeCollector(coins sdk.Coins) { - err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, coins) - suite.Require().NoError(err) - err = suite.app.BankKeeper.SendCoinsFromModuleToModule(suite.ctx, types.ModuleName, authtypes.FeeCollectorName, coins) - suite.Require().NoError(err) -} - -// DeployContract deploys the ERC20MinterBurnerDecimalsContract. -func (suite *KeeperTestSuite) DeployContract( - name, symbol string, - decimals uint8, -) (common.Address, error) { - ctx := sdk.WrapSDKContext(suite.ctx) - chainID := suite.app.EvmKeeper.ChainID() - - ctorArgs, err := contracts.ERC20MinterBurnerDecimalsContract.ABI.Pack("", name, symbol, decimals) - if err != nil { - return common.Address{}, err - } - - data := append(contracts.ERC20MinterBurnerDecimalsContract.Bin, ctorArgs...) //nolint:gocritic - args, err := json.Marshal(&evm.TransactionArgs{ - From: &suite.address, - Data: (*hexutil.Bytes)(&data), - }) - if err != nil { - return common.Address{}, err - } - - res, err := suite.queryClientEvm.EstimateGas(ctx, &evm.EthCallRequest{ - Args: args, - GasCap: config.DefaultGasCap, - }) - if err != nil { - return common.Address{}, err - } - - nonce := suite.app.EvmKeeper.GetNonce(suite.ctx, suite.address) - - erc20DeployTx := evm.NewTxContract( - chainID, - nonce, - nil, // amount - res.Gas, // gasLimit - nil, // gasPrice - suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx), - big.NewInt(1), - data, // input - ðtypes.AccessList{}, // accesses - ) - - erc20DeployTx.From = suite.address.Hex() - err = erc20DeployTx.Sign(ethtypes.LatestSignerForChainID(chainID), suite.signer) - if err != nil { - return common.Address{}, err - } - - rsp, err := suite.app.EvmKeeper.EthereumTx(ctx, erc20DeployTx) - if err != nil { - return common.Address{}, err - } - - suite.Require().Empty(rsp.VmError) - return crypto.CreateAddress(suite.address, nonce), nil -} diff --git a/x/vesting/keeper/setup_test.go b/x/vesting/keeper/setup_test.go new file mode 100644 index 0000000000..65b536af92 --- /dev/null +++ b/x/vesting/keeper/setup_test.go @@ -0,0 +1,64 @@ +package keeper_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/suite" + + ethtypes "github.com/ethereum/go-ethereum/core/types" + evm "github.com/evmos/evmos/v11/x/evm/types" + + "github.com/evmos/evmos/v11/app" + "github.com/evmos/evmos/v11/x/vesting/types" +) + +var ( + contract common.Address + contract2 common.Address +) + +var ( + erc20Name = "Coin Token" + erc20Symbol = "CTKN" + erc20Name2 = "Coin Token 2" + erc20Symbol2 = "CTKN2" + erc20Decimals = uint8(18) +) + +type KeeperTestSuite struct { + suite.Suite + + ctx sdk.Context + app *app.Evmos + queryClientEvm evm.QueryClient + queryClient types.QueryClient + address common.Address + consAddress sdk.ConsAddress + validator stakingtypes.Validator + clientCtx client.Context + ethSigner ethtypes.Signer + signer keyring.Signer +} + +var s *KeeperTestSuite + +func TestKeeperTestSuite(t *testing.T) { + s = new(KeeperTestSuite) + suite.Run(t, s) + + // Run Ginkgo integration tests + RegisterFailHandler(Fail) + RunSpecs(t, "Keeper Suite") +} + +func (suite *KeeperTestSuite) SetupTest() { + suite.DoSetupTest(suite.T()) +} diff --git a/x/vesting/keeper/utils_test.go b/x/vesting/keeper/utils_test.go index 88bfc78ce5..e375046cca 100644 --- a/x/vesting/keeper/utils_test.go +++ b/x/vesting/keeper/utils_test.go @@ -1,21 +1,234 @@ package keeper_test import ( + "encoding/json" + "math/big" "strings" + "time" . "github.com/onsi/gomega" "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/evmos/evmos/v11/testutil" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + + "github.com/evmos/evmos/v11/app" cosmosante "github.com/evmos/evmos/v11/app/ante/cosmos" evmante "github.com/evmos/evmos/v11/app/ante/evm" + "github.com/evmos/evmos/v11/contracts" + "github.com/evmos/evmos/v11/crypto/ethsecp256k1" + "github.com/evmos/evmos/v11/encoding" + "github.com/evmos/evmos/v11/server/config" + "github.com/evmos/evmos/v11/tests" + "github.com/evmos/evmos/v11/testutil" + evmostypes "github.com/evmos/evmos/v11/types" "github.com/evmos/evmos/v11/utils" + epochstypes "github.com/evmos/evmos/v11/x/epochs/types" + evmtypes "github.com/evmos/evmos/v11/x/evm/types" "github.com/evmos/evmos/v11/x/vesting/types" + + "github.com/stretchr/testify/require" + + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/crypto/tmhash" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmversion "github.com/tendermint/tendermint/proto/tendermint/version" + "github.com/tendermint/tendermint/version" ) +func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) { + checkTx := false + + // account key + priv, err := ethsecp256k1.GenerateKey() + require.NoError(t, err) + suite.address = common.BytesToAddress(priv.PubKey().Address().Bytes()) + suite.signer = tests.NewSigner(priv) + + // consensus key + priv, err = ethsecp256k1.GenerateKey() + require.NoError(t, err) + suite.consAddress = sdk.ConsAddress(priv.PubKey().Address()) + + // Init app + suite.app = app.Setup(checkTx, nil) + + // Set Context + suite.ctx = suite.app.BaseApp.NewContext(checkTx, tmproto.Header{ + Height: 1, + ChainID: "evmos_9001-1", + Time: time.Now().UTC(), + ProposerAddress: suite.consAddress.Bytes(), + + Version: tmversion.Consensus{ + Block: version.BlockProtocol, + }, + LastBlockId: tmproto.BlockID{ + Hash: tmhash.Sum([]byte("block_id")), + PartSetHeader: tmproto.PartSetHeader{ + Total: 11, + Hash: tmhash.Sum([]byte("partset_header")), + }, + }, + AppHash: tmhash.Sum([]byte("app")), + DataHash: tmhash.Sum([]byte("data")), + EvidenceHash: tmhash.Sum([]byte("evidence")), + ValidatorsHash: tmhash.Sum([]byte("validators")), + NextValidatorsHash: tmhash.Sum([]byte("next_validators")), + ConsensusHash: tmhash.Sum([]byte("consensus")), + LastResultsHash: tmhash.Sum([]byte("last_result")), + }) + + // Setup query helpers + queryHelperEvm := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + evmtypes.RegisterQueryServer(queryHelperEvm, suite.app.EvmKeeper) + suite.queryClientEvm = evmtypes.NewQueryClient(queryHelperEvm) + + queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, suite.app.VestingKeeper) + suite.queryClient = types.NewQueryClient(queryHelper) + + // Set epoch start time and height for all epoch identifiers from the epoch + // module + identifiers := []string{epochstypes.WeekEpochID, epochstypes.DayEpochID} + for _, identifier := range identifiers { + epoch, found := suite.app.EpochsKeeper.GetEpochInfo(suite.ctx, identifier) + suite.Require().True(found) + epoch.StartTime = suite.ctx.BlockTime() + epoch.CurrentEpochStartHeight = suite.ctx.BlockHeight() + suite.app.EpochsKeeper.SetEpochInfo(suite.ctx, epoch) + } + + acc := &evmostypes.EthAccount{ + BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(suite.address.Bytes()), nil, 0, 0), + CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(), + } + + suite.app.AccountKeeper.SetAccount(suite.ctx, acc) + + // Set Validator + valAddr := sdk.ValAddress(suite.address.Bytes()) + validator, err := stakingtypes.NewValidator(valAddr, priv.PubKey(), stakingtypes.Description{}) + require.NoError(t, err) + validator = stakingkeeper.TestingUpdateValidator(suite.app.StakingKeeper, suite.ctx, validator, true) + err = suite.app.StakingKeeper.AfterValidatorCreated(suite.ctx, validator.GetOperator()) + require.NoError(t, err) + err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) + require.NoError(t, err) + validators := s.app.StakingKeeper.GetValidators(s.ctx, 1) + suite.validator = validators[0] + + encodingConfig := encoding.MakeConfig(app.ModuleBasics) + suite.clientCtx = client.Context{}.WithTxConfig(encodingConfig.TxConfig) + suite.ethSigner = ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID()) + + // Deploy contracts + contract, err = suite.DeployContract(erc20Name, erc20Symbol, erc20Decimals) + require.NoError(t, err) + contract2, err = suite.DeployContract(erc20Name2, erc20Symbol2, erc20Decimals) + require.NoError(t, err) +} + +// Commit commits and starts a new block with an updated context. +func (suite *KeeperTestSuite) Commit() { + suite.CommitAfter(time.Second * 0) +} + +// Commit commits a block at a given time. +func (suite *KeeperTestSuite) CommitAfter(t time.Duration) { + _ = suite.app.Commit() + header := suite.ctx.BlockHeader() + header.Height++ + header.Time = header.Time.Add(t) + suite.app.BeginBlock(abci.RequestBeginBlock{ + Header: header, + }) + + // update ctx + suite.ctx = suite.app.BaseApp.NewContext(false, header) + + queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) + evmtypes.RegisterQueryServer(queryHelper, suite.app.EvmKeeper) + suite.queryClientEvm = evmtypes.NewQueryClient(queryHelper) +} + +// MintFeeCollector mints coins with the bank modules and sends them to the fee +// collector. +func (suite *KeeperTestSuite) MintFeeCollector(coins sdk.Coins) { + err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, coins) + suite.Require().NoError(err) + err = suite.app.BankKeeper.SendCoinsFromModuleToModule(suite.ctx, types.ModuleName, authtypes.FeeCollectorName, coins) + suite.Require().NoError(err) +} + +// DeployContract deploys the ERC20MinterBurnerDecimalsContract. +func (suite *KeeperTestSuite) DeployContract( + name, symbol string, + decimals uint8, +) (common.Address, error) { + ctx := sdk.WrapSDKContext(suite.ctx) + chainID := suite.app.EvmKeeper.ChainID() + + ctorArgs, err := contracts.ERC20MinterBurnerDecimalsContract.ABI.Pack("", name, symbol, decimals) + if err != nil { + return common.Address{}, err + } + + data := append(contracts.ERC20MinterBurnerDecimalsContract.Bin, ctorArgs...) //nolint:gocritic + args, err := json.Marshal(&evmtypes.TransactionArgs{ + From: &suite.address, + Data: (*hexutil.Bytes)(&data), + }) + if err != nil { + return common.Address{}, err + } + + res, err := suite.queryClientEvm.EstimateGas(ctx, &evmtypes.EthCallRequest{ + Args: args, + GasCap: config.DefaultGasCap, + }) + if err != nil { + return common.Address{}, err + } + + nonce := suite.app.EvmKeeper.GetNonce(suite.ctx, suite.address) + + erc20DeployTx := evmtypes.NewTxContract( + chainID, + nonce, + nil, // amount + res.Gas, // gasLimit + nil, // gasPrice + suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx), + big.NewInt(1), + data, // input + ðtypes.AccessList{}, // accesses + ) + + erc20DeployTx.From = suite.address.Hex() + err = erc20DeployTx.Sign(ethtypes.LatestSignerForChainID(chainID), suite.signer) + if err != nil { + return common.Address{}, err + } + + rsp, err := suite.app.EvmKeeper.EthereumTx(ctx, erc20DeployTx) + if err != nil { + return common.Address{}, err + } + + suite.Require().Empty(rsp.VmError) + return crypto.CreateAddress(suite.address, nonce), nil +} + // assertEthFails is a helper function that takes in 1 or more messages and checks // that they can neither be validated nor delivered using the EthVesting. func assertEthFails(msgs ...sdk.Msg) { diff --git a/x/vesting/types/events.pb.go b/x/vesting/types/events.pb.go index a8022661cf..3a5f7e0eef 100644 --- a/x/vesting/types/events.pb.go +++ b/x/vesting/types/events.pb.go @@ -5,16 +5,19 @@ package types import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -43,9 +46,11 @@ func (*EventCreateClawbackVestingAccount) ProtoMessage() {} func (*EventCreateClawbackVestingAccount) Descriptor() ([]byte, []int) { return fileDescriptor_48ea095c8e21d4cd, []int{0} } + func (m *EventCreateClawbackVestingAccount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EventCreateClawbackVestingAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EventCreateClawbackVestingAccount.Marshal(b, m, deterministic) @@ -58,12 +63,15 @@ func (m *EventCreateClawbackVestingAccount) XXX_Marshal(b []byte, deterministic return b[:n], nil } } + func (m *EventCreateClawbackVestingAccount) XXX_Merge(src proto.Message) { xxx_messageInfo_EventCreateClawbackVestingAccount.Merge(m, src) } + func (m *EventCreateClawbackVestingAccount) XXX_Size() int { return m.Size() } + func (m *EventCreateClawbackVestingAccount) XXX_DiscardUnknown() { xxx_messageInfo_EventCreateClawbackVestingAccount.DiscardUnknown(m) } @@ -121,9 +129,11 @@ func (*EventClawback) ProtoMessage() {} func (*EventClawback) Descriptor() ([]byte, []int) { return fileDescriptor_48ea095c8e21d4cd, []int{1} } + func (m *EventClawback) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EventClawback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EventClawback.Marshal(b, m, deterministic) @@ -136,12 +146,15 @@ func (m *EventClawback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } + func (m *EventClawback) XXX_Merge(src proto.Message) { xxx_messageInfo_EventClawback.Merge(m, src) } + func (m *EventClawback) XXX_Size() int { return m.Size() } + func (m *EventClawback) XXX_DiscardUnknown() { xxx_messageInfo_EventClawback.DiscardUnknown(m) } @@ -185,9 +198,11 @@ func (*EventUpdateVestingFunder) ProtoMessage() {} func (*EventUpdateVestingFunder) Descriptor() ([]byte, []int) { return fileDescriptor_48ea095c8e21d4cd, []int{2} } + func (m *EventUpdateVestingFunder) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *EventUpdateVestingFunder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EventUpdateVestingFunder.Marshal(b, m, deterministic) @@ -200,12 +215,15 @@ func (m *EventUpdateVestingFunder) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } + func (m *EventUpdateVestingFunder) XXX_Merge(src proto.Message) { xxx_messageInfo_EventUpdateVestingFunder.Merge(m, src) } + func (m *EventUpdateVestingFunder) XXX_Size() int { return m.Size() } + func (m *EventUpdateVestingFunder) XXX_DiscardUnknown() { xxx_messageInfo_EventUpdateVestingFunder.DiscardUnknown(m) } @@ -422,6 +440,7 @@ func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *EventCreateClawbackVestingAccount) Size() (n int) { if m == nil { return 0 @@ -496,9 +515,11 @@ func (m *EventUpdateVestingFunder) Size() (n int) { func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozEvents(x uint64) (n int) { return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *EventCreateClawbackVestingAccount) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -709,6 +730,7 @@ func (m *EventCreateClawbackVestingAccount) Unmarshal(dAtA []byte) error { } return nil } + func (m *EventClawback) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -855,6 +877,7 @@ func (m *EventClawback) Unmarshal(dAtA []byte) error { } return nil } + func (m *EventUpdateVestingFunder) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1001,6 +1024,7 @@ func (m *EventUpdateVestingFunder) Unmarshal(dAtA []byte) error { } return nil } + func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/vesting/types/query.pb.go b/x/vesting/types/query.pb.go index 0d863bf645..aafce1ff87 100644 --- a/x/vesting/types/query.pb.go +++ b/x/vesting/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" @@ -15,15 +19,14 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -43,9 +46,11 @@ func (*QueryBalancesRequest) ProtoMessage() {} func (*QueryBalancesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_ff0457b141ab5d28, []int{0} } + func (m *QueryBalancesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryBalancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryBalancesRequest.Marshal(b, m, deterministic) @@ -58,12 +63,15 @@ func (m *QueryBalancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } + func (m *QueryBalancesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryBalancesRequest.Merge(m, src) } + func (m *QueryBalancesRequest) XXX_Size() int { return m.Size() } + func (m *QueryBalancesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryBalancesRequest.DiscardUnknown(m) } @@ -94,9 +102,11 @@ func (*QueryBalancesResponse) ProtoMessage() {} func (*QueryBalancesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_ff0457b141ab5d28, []int{1} } + func (m *QueryBalancesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryBalancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryBalancesResponse.Marshal(b, m, deterministic) @@ -109,12 +119,15 @@ func (m *QueryBalancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } + func (m *QueryBalancesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryBalancesResponse.Merge(m, src) } + func (m *QueryBalancesResponse) XXX_Size() int { return m.Size() } + func (m *QueryBalancesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryBalancesResponse.DiscardUnknown(m) } @@ -178,8 +191,10 @@ var fileDescriptor_ff0457b141ab5d28 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -217,8 +232,7 @@ type QueryServer interface { } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +type UnimplementedQueryServer struct{} func (*UnimplementedQueryServer) Balances(ctx context.Context, req *QueryBalancesRequest) (*QueryBalancesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Balances not implemented") @@ -365,6 +379,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *QueryBalancesRequest) Size() (n int) { if m == nil { return 0 @@ -408,9 +423,11 @@ func (m *QueryBalancesResponse) Size() (n int) { func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *QueryBalancesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -493,6 +510,7 @@ func (m *QueryBalancesRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryBalancesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -645,6 +663,7 @@ func (m *QueryBalancesResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/vesting/types/query.pb.gw.go b/x/vesting/types/query.pb.gw.go index 97bc5fb828..30654f8426 100644 --- a/x/vesting/types/query.pb.gw.go +++ b/x/vesting/types/query.pb.gw.go @@ -25,13 +25,15 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join +var ( + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join +) func request_Query_Balances_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryBalancesRequest @@ -57,7 +59,6 @@ func request_Query_Balances_0(ctx context.Context, marshaler runtime.Marshaler, msg, err := client.Balances(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Balances_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -84,7 +85,6 @@ func local_request_Query_Balances_0(ctx context.Context, marshaler runtime.Marsh msg, err := server.Balances(ctx, &protoReq) return msg, metadata, err - } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -92,7 +92,6 @@ func local_request_Query_Balances_0(ctx context.Context, marshaler runtime.Marsh // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Balances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -113,7 +112,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Balances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -156,7 +154,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Balances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -174,16 +171,11 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Balances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil } -var ( - pattern_Query_Balances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"evmos", "vesting", "v1", "balances", "address"}, "", runtime.AssumeColonVerbOpt(false))) -) +var pattern_Query_Balances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"evmos", "vesting", "v1", "balances", "address"}, "", runtime.AssumeColonVerbOpt(false))) -var ( - forward_Query_Balances_0 = runtime.ForwardResponseMessage -) +var forward_Query_Balances_0 = runtime.ForwardResponseMessage diff --git a/x/vesting/types/tx.pb.go b/x/vesting/types/tx.pb.go index db0c50dd1a..4ef1e3ea70 100644 --- a/x/vesting/types/tx.pb.go +++ b/x/vesting/types/tx.pb.go @@ -6,6 +6,11 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + time "time" + github_com_cosmos_cosmos_sdk_x_auth_vesting_types "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" types "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" _ "github.com/cosmos/gogoproto/gogoproto" @@ -17,17 +22,15 @@ import ( codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf + _ = time.Kitchen +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -63,9 +66,11 @@ func (*MsgCreateClawbackVestingAccount) ProtoMessage() {} func (*MsgCreateClawbackVestingAccount) Descriptor() ([]byte, []int) { return fileDescriptor_d5db113bc0c7240c, []int{0} } + func (m *MsgCreateClawbackVestingAccount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgCreateClawbackVestingAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgCreateClawbackVestingAccount.Marshal(b, m, deterministic) @@ -78,12 +83,15 @@ func (m *MsgCreateClawbackVestingAccount) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } + func (m *MsgCreateClawbackVestingAccount) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgCreateClawbackVestingAccount.Merge(m, src) } + func (m *MsgCreateClawbackVestingAccount) XXX_Size() int { return m.Size() } + func (m *MsgCreateClawbackVestingAccount) XXX_DiscardUnknown() { xxx_messageInfo_MsgCreateClawbackVestingAccount.DiscardUnknown(m) } @@ -134,8 +142,7 @@ func (m *MsgCreateClawbackVestingAccount) GetMerge() bool { // MsgCreateClawbackVestingAccountResponse defines the // MsgCreateClawbackVestingAccount response type. -type MsgCreateClawbackVestingAccountResponse struct { -} +type MsgCreateClawbackVestingAccountResponse struct{} func (m *MsgCreateClawbackVestingAccountResponse) Reset() { *m = MsgCreateClawbackVestingAccountResponse{} @@ -145,9 +152,11 @@ func (*MsgCreateClawbackVestingAccountResponse) ProtoMessage() {} func (*MsgCreateClawbackVestingAccountResponse) Descriptor() ([]byte, []int) { return fileDescriptor_d5db113bc0c7240c, []int{1} } + func (m *MsgCreateClawbackVestingAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgCreateClawbackVestingAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgCreateClawbackVestingAccountResponse.Marshal(b, m, deterministic) @@ -160,12 +169,15 @@ func (m *MsgCreateClawbackVestingAccountResponse) XXX_Marshal(b []byte, determin return b[:n], nil } } + func (m *MsgCreateClawbackVestingAccountResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgCreateClawbackVestingAccountResponse.Merge(m, src) } + func (m *MsgCreateClawbackVestingAccountResponse) XXX_Size() int { return m.Size() } + func (m *MsgCreateClawbackVestingAccountResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgCreateClawbackVestingAccountResponse.DiscardUnknown(m) } @@ -192,9 +204,11 @@ func (*MsgClawback) ProtoMessage() {} func (*MsgClawback) Descriptor() ([]byte, []int) { return fileDescriptor_d5db113bc0c7240c, []int{2} } + func (m *MsgClawback) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgClawback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgClawback.Marshal(b, m, deterministic) @@ -207,12 +221,15 @@ func (m *MsgClawback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } + func (m *MsgClawback) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgClawback.Merge(m, src) } + func (m *MsgClawback) XXX_Size() int { return m.Size() } + func (m *MsgClawback) XXX_DiscardUnknown() { xxx_messageInfo_MsgClawback.DiscardUnknown(m) } @@ -241,8 +258,7 @@ func (m *MsgClawback) GetDestAddress() string { } // MsgClawbackResponse defines the MsgClawback response type. -type MsgClawbackResponse struct { -} +type MsgClawbackResponse struct{} func (m *MsgClawbackResponse) Reset() { *m = MsgClawbackResponse{} } func (m *MsgClawbackResponse) String() string { return proto.CompactTextString(m) } @@ -250,9 +266,11 @@ func (*MsgClawbackResponse) ProtoMessage() {} func (*MsgClawbackResponse) Descriptor() ([]byte, []int) { return fileDescriptor_d5db113bc0c7240c, []int{3} } + func (m *MsgClawbackResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgClawbackResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgClawbackResponse.Marshal(b, m, deterministic) @@ -265,12 +283,15 @@ func (m *MsgClawbackResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *MsgClawbackResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgClawbackResponse.Merge(m, src) } + func (m *MsgClawbackResponse) XXX_Size() int { return m.Size() } + func (m *MsgClawbackResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgClawbackResponse.DiscardUnknown(m) } @@ -294,9 +315,11 @@ func (*MsgUpdateVestingFunder) ProtoMessage() {} func (*MsgUpdateVestingFunder) Descriptor() ([]byte, []int) { return fileDescriptor_d5db113bc0c7240c, []int{4} } + func (m *MsgUpdateVestingFunder) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateVestingFunder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateVestingFunder.Marshal(b, m, deterministic) @@ -309,12 +332,15 @@ func (m *MsgUpdateVestingFunder) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *MsgUpdateVestingFunder) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateVestingFunder.Merge(m, src) } + func (m *MsgUpdateVestingFunder) XXX_Size() int { return m.Size() } + func (m *MsgUpdateVestingFunder) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateVestingFunder.DiscardUnknown(m) } @@ -344,8 +370,7 @@ func (m *MsgUpdateVestingFunder) GetVestingAddress() string { // MsgUpdateVestingFunderResponse defines the MsgUpdateVestingFunder response // type. -type MsgUpdateVestingFunderResponse struct { -} +type MsgUpdateVestingFunderResponse struct{} func (m *MsgUpdateVestingFunderResponse) Reset() { *m = MsgUpdateVestingFunderResponse{} } func (m *MsgUpdateVestingFunderResponse) String() string { return proto.CompactTextString(m) } @@ -353,9 +378,11 @@ func (*MsgUpdateVestingFunderResponse) ProtoMessage() {} func (*MsgUpdateVestingFunderResponse) Descriptor() ([]byte, []int) { return fileDescriptor_d5db113bc0c7240c, []int{5} } + func (m *MsgUpdateVestingFunderResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *MsgUpdateVestingFunderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateVestingFunderResponse.Marshal(b, m, deterministic) @@ -368,12 +395,15 @@ func (m *MsgUpdateVestingFunderResponse) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } + func (m *MsgUpdateVestingFunderResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateVestingFunderResponse.Merge(m, src) } + func (m *MsgUpdateVestingFunderResponse) XXX_Size() int { return m.Size() } + func (m *MsgUpdateVestingFunderResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateVestingFunderResponse.DiscardUnknown(m) } @@ -438,8 +468,10 @@ var fileDescriptor_d5db113bc0c7240c = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +var ( + _ context.Context + _ grpc.ClientConn +) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -507,15 +539,16 @@ type MsgServer interface { } // UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} +type UnimplementedMsgServer struct{} func (*UnimplementedMsgServer) CreateClawbackVestingAccount(ctx context.Context, req *MsgCreateClawbackVestingAccount) (*MsgCreateClawbackVestingAccountResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateClawbackVestingAccount not implemented") } + func (*UnimplementedMsgServer) Clawback(ctx context.Context, req *MsgClawback) (*MsgClawbackResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Clawback not implemented") } + func (*UnimplementedMsgServer) UpdateVestingFunder(ctx context.Context, req *MsgUpdateVestingFunder) (*MsgUpdateVestingFunderResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateVestingFunder not implemented") } @@ -850,6 +883,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *MsgCreateClawbackVestingAccount) Size() (n int) { if m == nil { return 0 @@ -956,9 +990,11 @@ func (m *MsgUpdateVestingFunderResponse) Size() (n int) { func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *MsgCreateClawbackVestingAccount) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1194,6 +1230,7 @@ func (m *MsgCreateClawbackVestingAccount) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgCreateClawbackVestingAccountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1244,6 +1281,7 @@ func (m *MsgCreateClawbackVestingAccountResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgClawback) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1390,6 +1428,7 @@ func (m *MsgClawback) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgClawbackResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1440,6 +1479,7 @@ func (m *MsgClawbackResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateVestingFunder) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1586,6 +1626,7 @@ func (m *MsgUpdateVestingFunder) Unmarshal(dAtA []byte) error { } return nil } + func (m *MsgUpdateVestingFunderResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1636,6 +1677,7 @@ func (m *MsgUpdateVestingFunderResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/vesting/types/tx.pb.gw.go b/x/vesting/types/tx.pb.gw.go index 4cf19d50b8..fb5bb66087 100644 --- a/x/vesting/types/tx.pb.gw.go +++ b/x/vesting/types/tx.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - var ( - filter_Msg_CreateClawbackVestingAccount_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + _ codes.Code + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage + _ = metadata.Join ) +var filter_Msg_CreateClawbackVestingAccount_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + func request_Msg_CreateClawbackVestingAccount_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgCreateClawbackVestingAccount var metadata runtime.ServerMetadata @@ -50,7 +50,6 @@ func request_Msg_CreateClawbackVestingAccount_0(ctx context.Context, marshaler r msg, err := client.CreateClawbackVestingAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Msg_CreateClawbackVestingAccount_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -66,12 +65,9 @@ func local_request_Msg_CreateClawbackVestingAccount_0(ctx context.Context, marsh msg, err := server.CreateClawbackVestingAccount(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Msg_Clawback_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Msg_Clawback_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Msg_Clawback_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgClawback @@ -86,7 +82,6 @@ func request_Msg_Clawback_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Clawback(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Msg_Clawback_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -102,12 +97,9 @@ func local_request_Msg_Clawback_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Clawback(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Msg_UpdateVestingFunder_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Msg_UpdateVestingFunder_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Msg_UpdateVestingFunder_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateVestingFunder @@ -122,7 +114,6 @@ func request_Msg_UpdateVestingFunder_0(ctx context.Context, marshaler runtime.Ma msg, err := client.UpdateVestingFunder(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Msg_UpdateVestingFunder_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -138,7 +129,6 @@ func local_request_Msg_UpdateVestingFunder_0(ctx context.Context, marshaler runt msg, err := server.UpdateVestingFunder(ctx, &protoReq) return msg, metadata, err - } // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". @@ -146,7 +136,6 @@ func local_request_Msg_UpdateVestingFunder_0(ctx context.Context, marshaler runt // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { - mux.Handle("GET", pattern_Msg_CreateClawbackVestingAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -167,7 +156,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_CreateClawbackVestingAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Msg_Clawback_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -190,7 +178,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_Clawback_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Msg_UpdateVestingFunder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -213,7 +200,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_UpdateVestingFunder_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -256,7 +242,6 @@ func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.C // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "MsgClient" to call the correct interceptors. func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { - mux.Handle("GET", pattern_Msg_CreateClawbackVestingAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -274,7 +259,6 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_CreateClawbackVestingAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Msg_Clawback_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -294,7 +278,6 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_Clawback_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Msg_UpdateVestingFunder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -314,7 +297,6 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_UpdateVestingFunder_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil diff --git a/x/vesting/types/vesting.pb.go b/x/vesting/types/vesting.pb.go index db9f32c842..5ab0ca7c18 100644 --- a/x/vesting/types/vesting.pb.go +++ b/x/vesting/types/vesting.pb.go @@ -5,23 +5,26 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + time "time" + github_com_cosmos_cosmos_sdk_x_auth_vesting_types "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" types "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen +var ( + _ = proto.Marshal + _ = fmt.Errorf + _ = math.Inf + _ = time.Kitchen +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -52,9 +55,11 @@ func (*ClawbackVestingAccount) ProtoMessage() {} func (*ClawbackVestingAccount) Descriptor() ([]byte, []int) { return fileDescriptor_5f1a3c86c0cebe5f, []int{0} } + func (m *ClawbackVestingAccount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *ClawbackVestingAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ClawbackVestingAccount.Marshal(b, m, deterministic) @@ -67,12 +72,15 @@ func (m *ClawbackVestingAccount) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } + func (m *ClawbackVestingAccount) XXX_Merge(src proto.Message) { xxx_messageInfo_ClawbackVestingAccount.Merge(m, src) } + func (m *ClawbackVestingAccount) XXX_Size() int { return m.Size() } + func (m *ClawbackVestingAccount) XXX_DiscardUnknown() { xxx_messageInfo_ClawbackVestingAccount.DiscardUnknown(m) } @@ -204,6 +212,7 @@ func encodeVarintVesting(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *ClawbackVestingAccount) Size() (n int) { if m == nil { return 0 @@ -238,9 +247,11 @@ func (m *ClawbackVestingAccount) Size() (n int) { func sovVesting(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozVesting(x uint64) (n int) { return sovVesting(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *ClawbackVestingAccount) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -460,6 +471,7 @@ func (m *ClawbackVestingAccount) Unmarshal(dAtA []byte) error { } return nil } + func skipVesting(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0