Skip to content

Commit a26c0ec

Browse files
authored
EVMStateTransfer accepts statedb as interface (#11)
1 parent 754db22 commit a26c0ec

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

plugin/evm/export_tx.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77
"context"
88
"errors"
99
"fmt"
10+
"github.com/ava-labs/coreth/core/vm"
1011
"math/big"
1112

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

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

371371
// EVMStateTransfer executes the state update from the atomic export transaction
372-
func (utx *UnsignedExportTx) EVMStateTransfer(ctx *snow.Context, state *state.StateDB) error {
372+
func (utx *UnsignedExportTx) EVMStateTransfer(ctx *snow.Context, state vm.StateDB) error {
373373
addrs := map[[20]byte]uint64{}
374374
for _, from := range utx.Ins {
375375
if from.AssetID == ctx.AVAXAssetID {

plugin/evm/import_tx.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import (
77
"context"
88
"errors"
99
"fmt"
10+
"github.com/ava-labs/coreth/core/vm"
1011
"math/big"
1112
"slices"
1213

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

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

429429
// EVMStateTransfer performs the state transfer to increase the balances of
430430
// accounts accordingly with the imported EVMOutputs
431-
func (utx *UnsignedImportTx) EVMStateTransfer(ctx *snow.Context, state *state.StateDB) error {
431+
func (utx *UnsignedImportTx) EVMStateTransfer(ctx *snow.Context, state vm.StateDB) error {
432432
for _, to := range utx.Outs {
433433
if to.AssetID == ctx.AVAXAssetID {
434434
log.Debug("crosschain", "src", utx.SourceChain, "addr", to.Address, "amount", to.Amount, "assetID", "AVAX")

plugin/evm/test_tx.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package evm
55

66
import (
7+
"github.com/ava-labs/coreth/core/vm"
78
"math/big"
89
"math/rand"
910

@@ -16,7 +17,6 @@ import (
1617
"github.com/ava-labs/avalanchego/snow"
1718
"github.com/ava-labs/avalanchego/utils/set"
1819
"github.com/ava-labs/avalanchego/utils/wrappers"
19-
"github.com/ava-labs/coreth/core/state"
2020
"github.com/ava-labs/coreth/params"
2121
)
2222

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

7373
// EVMStateTransfer implements the UnsignedAtomicTx interface
74-
func (t *TestUnsignedTx) EVMStateTransfer(ctx *snow.Context, state *state.StateDB) error {
74+
func (t *TestUnsignedTx) EVMStateTransfer(ctx *snow.Context, state vm.StateDB) error {
7575
return t.EVMStateTransferV
7676
}
7777

plugin/evm/tx.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import (
77
"bytes"
88
"errors"
99
"fmt"
10+
"github.com/ava-labs/coreth/core/vm"
1011
"math/big"
1112
"sort"
1213

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

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

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

133-
EVMStateTransfer(ctx *snow.Context, state *state.StateDB) error
133+
EVMStateTransfer(ctx *snow.Context, state vm.StateDB) error
134134
}
135135

136136
// Tx is a signed transaction

0 commit comments

Comments
 (0)