Skip to content

Commit

Permalink
Merge PR: fix innertx (#2094)
Browse files Browse the repository at this point in the history
  • Loading branch information
ylsGit authored May 24, 2022
1 parent 69ba9e1 commit 28b120c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
10 changes: 3 additions & 7 deletions x/evm/txs/base/base.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package base

import (
"math/big"

bam "github.com/okex/exchain/libs/cosmos-sdk/baseapp"
sdk "github.com/okex/exchain/libs/cosmos-sdk/types"
authexported "github.com/okex/exchain/libs/cosmos-sdk/x/auth/exported"
"github.com/okex/exchain/x/common/analyzer"
"github.com/okex/exchain/x/evm/keeper"
"github.com/okex/exchain/x/evm/types"
"math/big"
)

// Keeper alias of keeper.Keeper, to solve import circle. also evm.Keeper is alias keeper.Keeper
Expand Down Expand Up @@ -52,12 +53,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.IsAsync() {
tx.Keeper.LogsManages.Set(string(tx.Ctx.TxBytes()), keeper.TxResult{
Expand Down
16 changes: 15 additions & 1 deletion x/evm/txs/deliver/deliver.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package deliver

import (
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/okex/exchain/app/refund"
bam "github.com/okex/exchain/libs/cosmos-sdk/baseapp"
Expand All @@ -9,7 +11,6 @@ import (
"github.com/okex/exchain/x/evm/txs/base"
"github.com/okex/exchain/x/evm/types"
"github.com/okex/exchain/x/evm/watcher"
"math/big"
)

type Tx struct {
Expand Down Expand Up @@ -74,6 +75,19 @@ func (tx *Tx) RestoreWatcherTransactionReceipt(msg *types.MsgEthereumTx) {
&types.ResultData{}, tx.Ctx.GasMeter().GasConsumed())
}

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.IsAsync() {
Expand Down

0 comments on commit 28b120c

Please sign in to comment.