From 8ba6400e885420a75922e49f826a2ae0dd113ff1 Mon Sep 17 00:00:00 2001 From: noot <36753753+noot@users.noreply.github.com> Date: Wed, 24 Jun 2020 05:38:53 -0400 Subject: [PATCH] fix value transfer (#341) * debugging balance and gas * add prints * remove gas consumption in ante handler * cleanup * fix test --- app/ante/ante_test.go | 2 +- app/ante/eth.go | 2 -- x/evm/handler_test.go | 2 +- x/evm/types/statedb.go | 4 ++-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/ante/ante_test.go b/app/ante/ante_test.go index c01bf1d5..a283cb7d 100644 --- a/app/ante/ante_test.go +++ b/app/ante/ante_test.go @@ -256,7 +256,7 @@ func (suite *AnteTestSuite) TestEthInvalidIntrinsicGas() { tx, err := newTestEthTx(suite.ctx, ethMsg, priv1) suite.Require().NoError(err) - requireInvalidTx(suite.T(), suite.anteHandler, suite.ctx, tx, false) + requireInvalidTx(suite.T(), suite.anteHandler, suite.ctx.WithIsCheckTx(true), tx, false) } func (suite *AnteTestSuite) TestEthInvalidMempoolFees() { diff --git a/app/ante/eth.go b/app/ante/eth.go index f5a18de9..156e134d 100644 --- a/app/ante/eth.go +++ b/app/ante/eth.go @@ -319,8 +319,6 @@ func (egcd EthGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula // Set gas meter after ante handler to ignore gaskv costs newCtx = auth.SetGasMeter(simulate, ctx, gasLimit) - newCtx.GasMeter().ConsumeGas(gas, "eth intrinsic gas") - return next(newCtx, tx, simulate) } diff --git a/x/evm/handler_test.go b/x/evm/handler_test.go index 5cd5c6e9..9d1feae6 100644 --- a/x/evm/handler_test.go +++ b/x/evm/handler_test.go @@ -293,7 +293,7 @@ func (suite *EvmTestSuite) TestQueryTxLogs() { func (suite *EvmTestSuite) TestSendTransaction() { gasLimit := uint64(21000) - gasPrice := big.NewInt(1) + gasPrice := big.NewInt(0x55ae82600) priv, err := crypto.GenerateKey() suite.Require().NoError(err, "failed to create key") diff --git a/x/evm/types/statedb.go b/x/evm/types/statedb.go index 9f78b1ce..4f3f745e 100644 --- a/x/evm/types/statedb.go +++ b/x/evm/types/statedb.go @@ -794,9 +794,9 @@ func (csdb *CommitStateDB) getStateObject(addr ethcmn.Address) (stateObject *sta } // otherwise, attempt to fetch the account from the account mapper - acc := csdb.accountKeeper.GetAccount(csdb.ctx, addr.Bytes()) + acc := csdb.accountKeeper.GetAccount(csdb.ctx, sdk.AccAddress(addr.Bytes())) if acc == nil { - csdb.setError(fmt.Errorf("no account found for address: %X", addr.Bytes())) + csdb.setError(fmt.Errorf("no account found for address: %s", addr.String())) return nil }