diff --git a/tests/rpc_test.go b/tests/rpc_test.go index 9a08b535..032192ae 100644 --- a/tests/rpc_test.go +++ b/tests/rpc_test.go @@ -758,7 +758,7 @@ func TestEth_EstimateGas(t *testing.T) { err := json.Unmarshal(rpcRes.Result, &gas) require.NoError(t, err, string(rpcRes.Result)) - require.Equal(t, "0xf76c", gas) + require.Equal(t, "0xef7e", gas) } func TestEth_EstimateGas_ContractDeployment(t *testing.T) { @@ -777,7 +777,7 @@ func TestEth_EstimateGas_ContractDeployment(t *testing.T) { err := json.Unmarshal(rpcRes.Result, &gas) require.NoError(t, err, string(rpcRes.Result)) - require.Equal(t, "0x1cab2", gas.String()) + require.Equal(t, "0x1c2c4", gas.String()) } func TestEth_ExportAccount(t *testing.T) { diff --git a/x/evm/handler.go b/x/evm/handler.go index 36510d09..180f9e08 100644 --- a/x/evm/handler.go +++ b/x/evm/handler.go @@ -62,8 +62,10 @@ func handleMsgEthereumTx(ctx sdk.Context, k Keeper, msg types.MsgEthereumTx) (*s // Prepare db for logs // TODO: block hash - k.CommitStateDB.Prepare(ethHash, common.Hash{}, k.TxCount) - k.TxCount++ + if !st.Simulate { + k.CommitStateDB.Prepare(ethHash, common.Hash{}, k.TxCount) + k.TxCount++ + } config, found := k.GetChainConfig(ctx) if !found { @@ -75,13 +77,15 @@ func handleMsgEthereumTx(ctx sdk.Context, k Keeper, msg types.MsgEthereumTx) (*s return nil, err } - // update block bloom filter - k.Bloom.Or(k.Bloom, executionResult.Bloom) + if !st.Simulate { + // update block bloom filter + k.Bloom.Or(k.Bloom, executionResult.Bloom) - // update transaction logs in KVStore - err = k.SetLogs(ctx, common.BytesToHash(txHash), executionResult.Logs) - if err != nil { - panic(err) + // update transaction logs in KVStore + err = k.SetLogs(ctx, common.BytesToHash(txHash), executionResult.Logs) + if err != nil { + panic(err) + } } // log successful execution @@ -143,8 +147,10 @@ func handleMsgEthermint(ctx sdk.Context, k Keeper, msg types.MsgEthermint) (*sdk } // Prepare db for logs - k.CommitStateDB.Prepare(ethHash, common.Hash{}, k.TxCount) - k.TxCount++ + if !st.Simulate { + k.CommitStateDB.Prepare(ethHash, common.Hash{}, k.TxCount) + k.TxCount++ + } config, found := k.GetChainConfig(ctx) if !found { @@ -157,12 +163,14 @@ func handleMsgEthermint(ctx sdk.Context, k Keeper, msg types.MsgEthermint) (*sdk } // update block bloom filter - k.Bloom.Or(k.Bloom, executionResult.Bloom) + if !st.Simulate { + k.Bloom.Or(k.Bloom, executionResult.Bloom) - // update transaction logs in KVStore - err = k.SetLogs(ctx, common.BytesToHash(txHash), executionResult.Logs) - if err != nil { - panic(err) + // update transaction logs in KVStore + err = k.SetLogs(ctx, common.BytesToHash(txHash), executionResult.Logs) + if err != nil { + panic(err) + } } // log successful execution