upgrade to ethermint v0.21.0 #99
@ -13,8 +13,8 @@ import (
|
|||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
|
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
|
||||||
types2 "github.com/cosmos/cosmos-sdk/x/bank/types"
|
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||||
types3 "github.com/cosmos/cosmos-sdk/x/staking/types"
|
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/signer/core/apitypes"
|
"github.com/ethereum/go-ethereum/signer/core/apitypes"
|
||||||
"github.com/evmos/ethermint/ethereum/eip712"
|
"github.com/evmos/ethermint/ethereum/eip712"
|
||||||
@ -45,8 +45,8 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
|
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
|
||||||
evtypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
|
evtypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/feegrant"
|
"github.com/cosmos/cosmos-sdk/x/feegrant"
|
||||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
|
govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
|
||||||
types5 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
|
||||||
"github.com/evmos/ethermint/app"
|
"github.com/evmos/ethermint/app"
|
||||||
ante "github.com/evmos/ethermint/app/ante"
|
ante "github.com/evmos/ethermint/app/ante"
|
||||||
"github.com/evmos/ethermint/encoding"
|
"github.com/evmos/ethermint/encoding"
|
||||||
@ -271,7 +271,7 @@ func (suite *AnteTestSuite) CreateTestCosmosTxBuilder(gasPrice sdkmath.Int, deno
|
|||||||
func (suite *AnteTestSuite) CreateTestEIP712TxBuilderMsgSend(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder {
|
func (suite *AnteTestSuite) CreateTestEIP712TxBuilderMsgSend(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder {
|
||||||
// Build MsgSend
|
// Build MsgSend
|
||||||
recipient := sdk.AccAddress(common.Address{}.Bytes())
|
recipient := sdk.AccAddress(common.Address{}.Bytes())
|
||||||
msgSend := types2.NewMsgSend(from, recipient, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1))))
|
msgSend := banktypes.NewMsgSend(from, recipient, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1))))
|
||||||
return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainId, gas, gasAmount, msgSend)
|
return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainId, gas, gasAmount, msgSend)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ func (suite *AnteTestSuite) CreateTestEIP712TxBuilderMsgDelegate(from sdk.AccAdd
|
|||||||
// Build MsgSend
|
// Build MsgSend
|
||||||
valEthAddr := tests.GenerateAddress()
|
valEthAddr := tests.GenerateAddress()
|
||||||
valAddr := sdk.ValAddress(valEthAddr.Bytes())
|
valAddr := sdk.ValAddress(valEthAddr.Bytes())
|
||||||
msgSend := types3.NewMsgDelegate(from, valAddr, sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(20)))
|
msgSend := stakingtypes.NewMsgDelegate(from, valAddr, sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(20)))
|
||||||
return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainId, gas, gasAmount, msgSend)
|
return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainId, gas, gasAmount, msgSend)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,12 +287,12 @@ func (suite *AnteTestSuite) CreateTestEIP712MsgCreateValidator(from sdk.AccAddre
|
|||||||
// Build MsgCreateValidator
|
// Build MsgCreateValidator
|
||||||
valAddr := sdk.ValAddress(from.Bytes())
|
valAddr := sdk.ValAddress(from.Bytes())
|
||||||
privEd := ed25519.GenPrivKey()
|
privEd := ed25519.GenPrivKey()
|
||||||
msgCreate, err := types3.NewMsgCreateValidator(
|
msgCreate, err := stakingtypes.NewMsgCreateValidator(
|
||||||
valAddr,
|
valAddr,
|
||||||
privEd.PubKey(),
|
privEd.PubKey(),
|
||||||
sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)),
|
sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)),
|
||||||
types3.NewDescription("moniker", "indentity", "website", "security_contract", "details"),
|
stakingtypes.NewDescription("moniker", "indentity", "website", "security_contract", "details"),
|
||||||
types3.NewCommissionRates(sdk.OneDec(), sdk.OneDec(), sdk.OneDec()),
|
stakingtypes.NewCommissionRates(sdk.OneDec(), sdk.OneDec(), sdk.OneDec()),
|
||||||
sdk.OneInt(),
|
sdk.OneInt(),
|
||||||
)
|
)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
@ -303,13 +303,13 @@ func (suite *AnteTestSuite) CreateTestEIP712MsgCreateValidator2(from sdk.AccAddr
|
|||||||
// Build MsgCreateValidator
|
// Build MsgCreateValidator
|
||||||
valAddr := sdk.ValAddress(from.Bytes())
|
valAddr := sdk.ValAddress(from.Bytes())
|
||||||
privEd := ed25519.GenPrivKey()
|
privEd := ed25519.GenPrivKey()
|
||||||
msgCreate, err := types3.NewMsgCreateValidator(
|
msgCreate, err := stakingtypes.NewMsgCreateValidator(
|
||||||
valAddr,
|
valAddr,
|
||||||
privEd.PubKey(),
|
privEd.PubKey(),
|
||||||
sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)),
|
sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)),
|
||||||
// Ensure optional fields can be left blank
|
// Ensure optional fields can be left blank
|
||||||
types3.NewDescription("moniker", "indentity", "", "", ""),
|
stakingtypes.NewDescription("moniker", "indentity", "", "", ""),
|
||||||
types3.NewCommissionRates(sdk.OneDec(), sdk.OneDec(), sdk.OneDec()),
|
stakingtypes.NewCommissionRates(sdk.OneDec(), sdk.OneDec(), sdk.OneDec()),
|
||||||
sdk.OneInt(),
|
sdk.OneInt(),
|
||||||
)
|
)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
@ -317,9 +317,9 @@ func (suite *AnteTestSuite) CreateTestEIP712MsgCreateValidator2(from sdk.AccAddr
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (suite *AnteTestSuite) CreateTestEIP712SubmitProposal(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins, deposit sdk.Coins) client.TxBuilder {
|
func (suite *AnteTestSuite) CreateTestEIP712SubmitProposal(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins, deposit sdk.Coins) client.TxBuilder {
|
||||||
proposal, ok := types5.ContentFromProposalType("My proposal", "My description", types5.ProposalTypeText)
|
proposal, ok := govtypes.ContentFromProposalType("My proposal", "My description", govtypes.ProposalTypeText)
|
||||||
suite.Require().True(ok)
|
suite.Require().True(ok)
|
||||||
msgSubmit, err := types5.NewMsgSubmitProposal(proposal, deposit, from)
|
msgSubmit, err := govtypes.NewMsgSubmitProposal(proposal, deposit, from)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainId, gas, gasAmount, msgSubmit)
|
return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainId, gas, gasAmount, msgSubmit)
|
||||||
}
|
}
|
||||||
@ -340,9 +340,9 @@ func (suite *AnteTestSuite) CreateTestEIP712GrantAllowance(from sdk.AccAddress,
|
|||||||
|
|
||||||
func (suite *AnteTestSuite) CreateTestEIP712MsgEditValidator(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder {
|
func (suite *AnteTestSuite) CreateTestEIP712MsgEditValidator(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder {
|
||||||
valAddr := sdk.ValAddress(from.Bytes())
|
valAddr := sdk.ValAddress(from.Bytes())
|
||||||
msgEdit := types3.NewMsgEditValidator(
|
msgEdit := stakingtypes.NewMsgEditValidator(
|
||||||
valAddr,
|
valAddr,
|
||||||
types3.NewDescription("moniker", "identity", "website", "security_contract", "details"),
|
stakingtypes.NewDescription("moniker", "identity", "website", "security_contract", "details"),
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
@ -363,7 +363,7 @@ func (suite *AnteTestSuite) CreateTestEIP712MsgSubmitEvidence(from sdk.AccAddres
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (suite *AnteTestSuite) CreateTestEIP712MsgVoteV1(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder {
|
func (suite *AnteTestSuite) CreateTestEIP712MsgVoteV1(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder {
|
||||||
msgVote := govtypes.NewMsgVote(from, 1, govtypes.VoteOption_VOTE_OPTION_YES, "")
|
msgVote := govtypesv1.NewMsgVote(from, 1, govtypesv1.VoteOption_VOTE_OPTION_YES, "")
|
||||||
return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainId, gas, gasAmount, msgVote)
|
return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainId, gas, gasAmount, msgVote)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,17 +372,17 @@ func (suite *AnteTestSuite) CreateTestEIP712SubmitProposalV1(from sdk.AccAddress
|
|||||||
// does not support arrays of variable type.
|
// does not support arrays of variable type.
|
||||||
authAcc := suite.app.GovKeeper.GetGovernanceAccount(suite.ctx)
|
authAcc := suite.app.GovKeeper.GetGovernanceAccount(suite.ctx)
|
||||||
|
|
||||||
proposal1, ok := types5.ContentFromProposalType("My proposal 1", "My description 1", types5.ProposalTypeText)
|
proposal1, ok := govtypes.ContentFromProposalType("My proposal 1", "My description 1", govtypes.ProposalTypeText)
|
||||||
suite.Require().True(ok)
|
suite.Require().True(ok)
|
||||||
content1, err := govtypes.NewLegacyContent(
|
content1, err := govtypesv1.NewLegacyContent(
|
||||||
proposal1,
|
proposal1,
|
||||||
sdk.MustBech32ifyAddressBytes(sdk.GetConfig().GetBech32AccountAddrPrefix(), authAcc.GetAddress().Bytes()),
|
sdk.MustBech32ifyAddressBytes(sdk.GetConfig().GetBech32AccountAddrPrefix(), authAcc.GetAddress().Bytes()),
|
||||||
)
|
)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
proposal2, ok := types5.ContentFromProposalType("My proposal 2", "My description 2", types5.ProposalTypeText)
|
proposal2, ok := govtypes.ContentFromProposalType("My proposal 2", "My description 2", govtypes.ProposalTypeText)
|
||||||
suite.Require().True(ok)
|
suite.Require().True(ok)
|
||||||
content2, err := govtypes.NewLegacyContent(
|
content2, err := govtypesv1.NewLegacyContent(
|
||||||
proposal2,
|
proposal2,
|
||||||
sdk.MustBech32ifyAddressBytes(sdk.GetConfig().GetBech32AccountAddrPrefix(), authAcc.GetAddress().Bytes()),
|
sdk.MustBech32ifyAddressBytes(sdk.GetConfig().GetBech32AccountAddrPrefix(), authAcc.GetAddress().Bytes()),
|
||||||
)
|
)
|
||||||
@ -394,7 +394,7 @@ func (suite *AnteTestSuite) CreateTestEIP712SubmitProposalV1(from sdk.AccAddress
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build V1 proposal
|
// Build V1 proposal
|
||||||
msgProposal, err := govtypes.NewMsgSubmitProposal(
|
msgProposal, err := govtypesv1.NewMsgSubmitProposal(
|
||||||
proposalMsgs,
|
proposalMsgs,
|
||||||
sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100))),
|
sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100))),
|
||||||
sdk.MustBech32ifyAddressBytes(sdk.GetConfig().GetBech32AccountAddrPrefix(), from.Bytes()),
|
sdk.MustBech32ifyAddressBytes(sdk.GetConfig().GetBech32AccountAddrPrefix(), from.Bytes()),
|
||||||
@ -408,22 +408,22 @@ func (suite *AnteTestSuite) CreateTestEIP712SubmitProposalV1(from sdk.AccAddress
|
|||||||
|
|
||||||
func (suite *AnteTestSuite) CreateTestEIP712MsgExec(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder {
|
func (suite *AnteTestSuite) CreateTestEIP712MsgExec(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder {
|
||||||
recipient := sdk.AccAddress(common.Address{}.Bytes())
|
recipient := sdk.AccAddress(common.Address{}.Bytes())
|
||||||
msgSend := types2.NewMsgSend(from, recipient, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1))))
|
msgSend := banktypes.NewMsgSend(from, recipient, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1))))
|
||||||
msgExec := authz.NewMsgExec(from, []sdk.Msg{msgSend})
|
msgExec := authz.NewMsgExec(from, []sdk.Msg{msgSend})
|
||||||
return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainId, gas, gasAmount, &msgExec)
|
return suite.CreateTestEIP712SingleMessageTxBuilder(from, priv, chainId, gas, gasAmount, &msgExec)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *AnteTestSuite) CreateTestEIP712MultipleMsgSend(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder {
|
func (suite *AnteTestSuite) CreateTestEIP712MultipleMsgSend(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder {
|
||||||
recipient := sdk.AccAddress(common.Address{}.Bytes())
|
recipient := sdk.AccAddress(common.Address{}.Bytes())
|
||||||
msgSend := types2.NewMsgSend(from, recipient, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1))))
|
msgSend := banktypes.NewMsgSend(from, recipient, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1))))
|
||||||
return suite.CreateTestEIP712CosmosTxBuilder(from, priv, chainId, gas, gasAmount, []sdk.Msg{msgSend, msgSend, msgSend})
|
return suite.CreateTestEIP712CosmosTxBuilder(from, priv, chainId, gas, gasAmount, []sdk.Msg{msgSend, msgSend, msgSend})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fails
|
// Fails
|
||||||
func (suite *AnteTestSuite) CreateTestEIP712MultipleSignerMsgs(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder {
|
func (suite *AnteTestSuite) CreateTestEIP712MultipleSignerMsgs(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder {
|
||||||
recipient := sdk.AccAddress(common.Address{}.Bytes())
|
recipient := sdk.AccAddress(common.Address{}.Bytes())
|
||||||
msgSend1 := types2.NewMsgSend(from, recipient, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1))))
|
msgSend1 := banktypes.NewMsgSend(from, recipient, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1))))
|
||||||
msgSend2 := types2.NewMsgSend(recipient, from, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1))))
|
msgSend2 := banktypes.NewMsgSend(recipient, from, sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(1))))
|
||||||
return suite.CreateTestEIP712CosmosTxBuilder(from, priv, chainId, gas, gasAmount, []sdk.Msg{msgSend1, msgSend2})
|
return suite.CreateTestEIP712CosmosTxBuilder(from, priv, chainId, gas, gasAmount, []sdk.Msg{msgSend1, msgSend2})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user