evm: support legacy tx (#109)

* evm: support legacy tx

* lint and minor fix

* tx data constructor

* tx data tests

* ante handler tests

* fill msg sender

* c++
This commit is contained in:
Federico Kunze
2021-06-11 09:38:51 -04:00
committed by GitHub
parent 0c423e8fa1
commit e8f6f7838e
7 changed files with 393 additions and 205 deletions
+6 -5
View File
@@ -310,13 +310,16 @@ func (suite AnteTestSuite) TestEthGasConsumeDecorator() {
func (suite AnteTestSuite) TestCanTransferDecorator() {
dec := ante.NewCanTransferDecorator(suite.app.EvmKeeper)
addr, _ := newTestAddrKey()
addr, privKey := newTestAddrKey()
tx := evmtypes.NewMsgEthereumTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), 1000, big.NewInt(1), nil, nil)
tx2 := evmtypes.NewMsgEthereumTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), 1000, big.NewInt(1), nil, nil)
tx := evmtypes.NewMsgEthereumTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), 1000, big.NewInt(1), nil, &ethtypes.AccessList{})
tx2 := evmtypes.NewMsgEthereumTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), 1000, big.NewInt(1), nil, &ethtypes.AccessList{})
tx.From = addr.Hex()
err := tx.Sign(suite.ethSigner, tests.NewSigner(privKey))
suite.Require().NoError(err)
testCases := []struct {
name string
tx sdk.Tx
@@ -376,7 +379,6 @@ func (suite AnteTestSuite) TestAccessListDecorator() {
tx := evmtypes.NewMsgEthereumTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), 1000, big.NewInt(1), nil, nil)
tx2 := evmtypes.NewMsgEthereumTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), 1000, big.NewInt(1), nil, al)
tx3 := evmtypes.NewMsgEthereumTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), 1000, big.NewInt(1), nil, nil)
tx.From = addr.Hex()
tx2.From = addr.Hex()
@@ -388,7 +390,6 @@ func (suite AnteTestSuite) TestAccessListDecorator() {
expPass bool
}{
{"invalid transaction type", &invalidTx{}, func() {}, false},
{"AsMessage failed", tx3, func() {}, false},
{
"success - no access list",
tx,