Skip to content

Commit

Permalink
Merge branch 'canto-v8/develop' into patch/codec
Browse files Browse the repository at this point in the history
  • Loading branch information
dudong2 committed Jul 12, 2024
2 parents c05db69 + ec14414 commit 4e65c26
Show file tree
Hide file tree
Showing 8 changed files with 204 additions and 218 deletions.
222 changes: 113 additions & 109 deletions api/ethermint/evm/v1/tx.pulsar.go

Large diffs are not rendered by default.

32 changes: 0 additions & 32 deletions app/ante/utils_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package ante_test

import (
"encoding/json"
"fmt"
"math"
"math/big"
"time"
Expand All @@ -11,7 +9,6 @@ import (
protov2 "google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
Expand Down Expand Up @@ -39,7 +36,6 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/types/multisig"
"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"
Expand Down Expand Up @@ -471,34 +467,6 @@ func (suite *AnteTestSuite) CreateTestEIP712MultipleSignerMsgs(from sdk.AccAddre
return suite.CreateTestEIP712CosmosTxBuilder(priv, chainId, gas, gasAmount, []sdk.Msg{msgSend1, msgSend2})
}

// StdSignBytes returns the bytes to sign for a transaction.
func StdSignBytes(cdc *codec.LegacyAmino, chainID string, accnum uint64, sequence uint64, timeout uint64, fee legacytx.StdFee, msgs []sdk.Msg, memo string, tip *txtypes.Tip) []byte {
msgsBytes := make([]json.RawMessage, 0, len(msgs))
for _, msg := range msgs {
legacyMsg, ok := msg.(legacytx.LegacyMsg)
if !ok {
panic(fmt.Errorf("expected %T when using amino JSON", (*legacytx.LegacyMsg)(nil)))
}

msgsBytes = append(msgsBytes, json.RawMessage(legacyMsg.GetSignBytes()))
}

bz, err := cdc.MarshalJSON(legacytx.StdSignDoc{
AccountNumber: accnum,
ChainID: chainID,
Fee: json.RawMessage(fee.Bytes()),
Memo: memo,
Msgs: msgsBytes,
Sequence: sequence,
TimeoutHeight: timeout,
})
if err != nil {
panic(err)
}

return sdk.MustSortJSON(bz)
}

func (suite *AnteTestSuite) CreateTestEIP712SingleMessageTxBuilder(
priv cryptotypes.PrivKey, chainID string, gas uint64, gasAmount sdk.Coins, msg sdk.Msg,
) client.TxBuilder {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ethermintd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
initRootCmd(tempApp, encodingConfig, rootCmd, encodingConfig.TxConfig, tempApp.BasicModuleManager)

autoCliOpts := tempApp.AutoCliOpts()
initClientCtx, _ = config.ReadFromClientConfig(initClientCtx)
initClientCtx, _ = config.ReadDefaultValuesFromDefaultClientConfig(initClientCtx)
autoCliOpts.Keyring, _ = keyring.NewAutoCLIKeyring(initClientCtx.Keyring)
autoCliOpts.ClientCtx = initClientCtx

Expand Down
6 changes: 3 additions & 3 deletions proto/ethermint/evm/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ message MsgEthereumTx {
// AllowUnprotectedTxs parameter is disabled.
message LegacyTx {
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) = "TxData";
option (cosmos_proto.implements_interface) = "ethermint.evm.v1.TxData";

// nonce corresponds to the account nonce (transaction sequence).
uint64 nonce = 1;
Expand Down Expand Up @@ -81,7 +81,7 @@ message LegacyTx {
// AccessListTx is the data of EIP-2930 access list transactions.
message AccessListTx {
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) = "TxData";
option (cosmos_proto.implements_interface) = "ethermint.evm.v1.TxData";

// chain_id of the destination EVM chain
string chain_id = 1 [
Expand Down Expand Up @@ -116,7 +116,7 @@ message AccessListTx {
// DynamicFeeTx is the data of EIP-1559 dinamic fee transactions.
message DynamicFeeTx {
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) = "TxData";
option (cosmos_proto.implements_interface) = "ethermint.evm.v1.TxData";

// chain_id of the destination EVM chain
string chain_id = 1 [
Expand Down
8 changes: 3 additions & 5 deletions x/evm/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/evmos/ethermint/x/evm/keeper"

sdkmath "cosmossdk.io/math"
"github.com/gogo/protobuf/proto"
"github.com/cosmos/gogoproto/proto"

abci "github.com/cometbft/cometbft/abci/types"
tmjson "github.com/cometbft/cometbft/libs/json"
Expand All @@ -30,7 +30,6 @@ import (
"github.com/stretchr/testify/suite"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"

Expand All @@ -54,7 +53,6 @@ type EvmTestSuite struct {
ctx sdk.Context
handler baseapp.MsgServiceHandler
app *app.EthermintApp
codec codec.Codec
chainID *big.Int

signer keyring.Signer
Expand Down Expand Up @@ -613,7 +611,7 @@ func (suite *EvmTestSuite) TestERC20TransferReverted() {
err = k.DeductTxCostsFromUserBalance(suite.ctx, fees, common.HexToAddress(tx.From))
suite.Require().NoError(err)

res, err := k.EthereumTx(sdk.WrapSDKContext(suite.ctx), tx)
res, err := k.EthereumTx(suite.ctx, tx)
suite.Require().NoError(err)

suite.Require().True(res.Failed())
Expand Down Expand Up @@ -686,7 +684,7 @@ func (suite *EvmTestSuite) TestContractDeploymentRevert() {
db.SetNonce(suite.from, nonce+1)
suite.Require().NoError(db.Commit())

rsp, err := k.EthereumTx(sdk.WrapSDKContext(suite.ctx), tx)
rsp, err := k.EthereumTx(suite.ctx, tx)
suite.Require().NoError(err)
suite.Require().True(rsp.Failed())

Expand Down
10 changes: 9 additions & 1 deletion x/evm/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

abci "github.com/cometbft/cometbft/abci/types"

"cosmossdk.io/core/appmodule"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
Expand All @@ -38,8 +39,15 @@ import (
)

var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.HasInvariants = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasABCIGenesis = AppModule{}

_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
_ appmodule.HasEndBlocker = AppModule{}
)

// AppModuleBasic defines the basic application module used by the evm module.
Expand Down
132 changes: 66 additions & 66 deletions x/evm/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion x/feemarket/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

abci "github.com/cometbft/cometbft/abci/types"

"cosmossdk.io/core/appmodule"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
Expand All @@ -36,8 +37,15 @@ import (
)

var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.HasInvariants = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasABCIGenesis = AppModule{}

_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
_ appmodule.HasEndBlocker = AppModule{}
)

// AppModuleBasic defines the basic application module used by the fee market module.
Expand Down

0 comments on commit 4e65c26

Please sign in to comment.