Skip to content

Commit

Permalink
EVMStateTransfer accepts statedb as interface
Browse files Browse the repository at this point in the history
  • Loading branch information
g4zyn committed May 29, 2024
1 parent 754db22 commit 7f783c1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions plugin/evm/export_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"context"
"errors"
"fmt"
"github.com/ava-labs/coreth/core/vm"

Check failure on line 10 in plugin/evm/export_tx.go

View workflow job for this annotation

GitHub Actions / Lint

File is not `goimports`-ed (goimports)
"math/big"

"github.com/ava-labs/coreth/core/state"
"github.com/ava-labs/coreth/params"

"github.com/ava-labs/avalanchego/chains/atomic"
Expand Down Expand Up @@ -369,7 +369,7 @@ func (vm *VM) newExportTx(
}

// EVMStateTransfer executes the state update from the atomic export transaction
func (utx *UnsignedExportTx) EVMStateTransfer(ctx *snow.Context, state *state.StateDB) error {
func (utx *UnsignedExportTx) EVMStateTransfer(ctx *snow.Context, state vm.StateDB) error {
addrs := map[[20]byte]uint64{}
for _, from := range utx.Ins {
if from.AssetID == ctx.AVAXAssetID {
Expand Down
4 changes: 2 additions & 2 deletions plugin/evm/import_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"context"
"errors"
"fmt"
"github.com/ava-labs/coreth/core/vm"

Check failure on line 10 in plugin/evm/import_tx.go

View workflow job for this annotation

GitHub Actions / Lint

File is not `goimports`-ed (goimports)
"math/big"
"slices"

"github.com/ava-labs/coreth/core/state"
"github.com/ava-labs/coreth/params"

"github.com/ava-labs/avalanchego/chains/atomic"
Expand Down Expand Up @@ -428,7 +428,7 @@ func (vm *VM) newImportTxWithUTXOs(

// EVMStateTransfer performs the state transfer to increase the balances of
// accounts accordingly with the imported EVMOutputs
func (utx *UnsignedImportTx) EVMStateTransfer(ctx *snow.Context, state *state.StateDB) error {
func (utx *UnsignedImportTx) EVMStateTransfer(ctx *snow.Context, state vm.StateDB) error {
for _, to := range utx.Outs {
if to.AssetID == ctx.AVAXAssetID {
log.Debug("crosschain", "src", utx.SourceChain, "addr", to.Address, "amount", to.Amount, "assetID", "AVAX")
Expand Down
4 changes: 2 additions & 2 deletions plugin/evm/test_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package evm

import (
"github.com/ava-labs/coreth/core/vm"

Check failure on line 7 in plugin/evm/test_tx.go

View workflow job for this annotation

GitHub Actions / Lint

File is not `goimports`-ed (goimports)
"math/big"
"math/rand"

Expand All @@ -16,7 +17,6 @@ import (
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/utils/set"
"github.com/ava-labs/avalanchego/utils/wrappers"
"github.com/ava-labs/coreth/core/state"
"github.com/ava-labs/coreth/params"
)

Expand Down Expand Up @@ -71,7 +71,7 @@ func (t *TestUnsignedTx) SemanticVerify(vm *VM, stx *Tx, parent *Block, baseFee
}

// EVMStateTransfer implements the UnsignedAtomicTx interface
func (t *TestUnsignedTx) EVMStateTransfer(ctx *snow.Context, state *state.StateDB) error {
func (t *TestUnsignedTx) EVMStateTransfer(ctx *snow.Context, state vm.StateDB) error {
return t.EVMStateTransferV
}

Expand Down
4 changes: 2 additions & 2 deletions plugin/evm/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"bytes"
"errors"
"fmt"
"github.com/ava-labs/coreth/core/vm"
"math/big"
"sort"

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

"github.com/ava-labs/coreth/core/state"
"github.com/ava-labs/coreth/params"

"github.com/ava-labs/avalanchego/chains/atomic"
Expand Down Expand Up @@ -130,7 +130,7 @@ type UnsignedAtomicTx interface {
// The set of atomic requests must be returned in a consistent order.
AtomicOps() (ids.ID, *atomic.Requests, error)

EVMStateTransfer(ctx *snow.Context, state *state.StateDB) error
EVMStateTransfer(ctx *snow.Context, state vm.StateDB) error
}

// Tx is a signed transaction
Expand Down

0 comments on commit 7f783c1

Please sign in to comment.