Skip to content

Commit

Permalink
Merge PR: fix eth_call failed when enable innertx (#2095)
Browse files Browse the repository at this point in the history
  • Loading branch information
ylsGit authored May 25, 2022
1 parent 183579a commit 8c9e10b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
9 changes: 2 additions & 7 deletions x/evm/txs/base/base.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package base

import (
bam "github.com/okex/exchain/libs/system/trace"
"math/big"

ethtypes "github.com/ethereum/go-ethereum/core/types"

sdk "github.com/okex/exchain/libs/cosmos-sdk/types"
authexported "github.com/okex/exchain/libs/cosmos-sdk/x/auth/exported"
bam "github.com/okex/exchain/libs/system/trace"
tmtypes "github.com/okex/exchain/libs/tendermint/types"
"github.com/okex/exchain/x/evm/keeper"
"github.com/okex/exchain/x/evm/types"
Expand Down Expand Up @@ -55,12 +55,7 @@ func (tx *Tx) GetChainConfig() (types.ChainConfig, bool) {
// Transition execute evm tx
func (tx *Tx) Transition(config types.ChainConfig) (result Result, err error) {
result.ExecResult, result.ResultData, err, result.InnerTxs, result.Erc20Contracts = tx.StateTransition.TransitionDb(tx.Ctx, config)
if result.InnerTxs != nil {
tx.Keeper.AddInnerTx(tx.StateTransition.TxHash.Hex(), result.InnerTxs)
}
if result.Erc20Contracts != nil {
tx.Keeper.AddContract(result.Erc20Contracts)
}

// async mod goes immediately
if tx.Ctx.ParaMsg() != nil {
index := tx.Keeper.LogsManages.Set(keeper.TxResult{
Expand Down
16 changes: 14 additions & 2 deletions x/evm/txs/deliver/deliver.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package deliver

import (
bam "github.com/okex/exchain/libs/system/trace"
"github.com/okex/exchain/x/evm/watcher"
"math/big"

"github.com/ethereum/go-ethereum/common"

"github.com/okex/exchain/app/refund"
sdk "github.com/okex/exchain/libs/cosmos-sdk/types"
authexported "github.com/okex/exchain/libs/cosmos-sdk/x/auth/exported"
bam "github.com/okex/exchain/libs/system/trace"
"github.com/okex/exchain/x/evm/txs/base"
"github.com/okex/exchain/x/evm/types"
"github.com/okex/exchain/x/evm/watcher"
)

type Tx struct {
Expand Down Expand Up @@ -66,6 +67,17 @@ func (tx *Tx) RefundFeesWatcher(account authexported.Account, coin sdk.Coins, pr
pm.Watcher.SaveAccount(account, false)
}

func (tx *Tx) Transition(config types.ChainConfig) (result base.Result, err error) {
result, err = tx.Tx.Transition(config)

if result.InnerTxs != nil {
tx.Keeper.AddInnerTx(tx.StateTransition.TxHash.Hex(), result.InnerTxs)
}
if result.Erc20Contracts != nil {
tx.Keeper.AddContract(result.Erc20Contracts)
}
return
}
func (tx *Tx) Commit(msg *types.MsgEthereumTx, result *base.Result) {
// update block bloom filter
if tx.Ctx.ParaMsg() == nil {
Expand Down

0 comments on commit 8c9e10b

Please sign in to comment.