From 7f783c1624f9bed49b4020daad86cea206895f5e Mon Sep 17 00:00:00 2001 From: Marko Gajin <42877612+g4zyn@users.noreply.github.com> Date: Wed, 29 May 2024 17:11:16 +0200 Subject: [PATCH] EVMStateTransfer accepts statedb as interface --- plugin/evm/export_tx.go | 4 ++-- plugin/evm/import_tx.go | 4 ++-- plugin/evm/test_tx.go | 4 ++-- plugin/evm/tx.go | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugin/evm/export_tx.go b/plugin/evm/export_tx.go index 44da333b49..4f6828ec03 100644 --- a/plugin/evm/export_tx.go +++ b/plugin/evm/export_tx.go @@ -7,9 +7,9 @@ import ( "context" "errors" "fmt" + "github.com/ava-labs/coreth/core/vm" "math/big" - "github.com/ava-labs/coreth/core/state" "github.com/ava-labs/coreth/params" "github.com/ava-labs/avalanchego/chains/atomic" @@ -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 { diff --git a/plugin/evm/import_tx.go b/plugin/evm/import_tx.go index ee2eff0590..cd5d493368 100644 --- a/plugin/evm/import_tx.go +++ b/plugin/evm/import_tx.go @@ -7,10 +7,10 @@ import ( "context" "errors" "fmt" + "github.com/ava-labs/coreth/core/vm" "math/big" "slices" - "github.com/ava-labs/coreth/core/state" "github.com/ava-labs/coreth/params" "github.com/ava-labs/avalanchego/chains/atomic" @@ -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") diff --git a/plugin/evm/test_tx.go b/plugin/evm/test_tx.go index c057c874ad..96d8cd2b88 100644 --- a/plugin/evm/test_tx.go +++ b/plugin/evm/test_tx.go @@ -4,6 +4,7 @@ package evm import ( + "github.com/ava-labs/coreth/core/vm" "math/big" "math/rand" @@ -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" ) @@ -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 } diff --git a/plugin/evm/tx.go b/plugin/evm/tx.go index 5c8497a3a3..0dd6ce62cd 100644 --- a/plugin/evm/tx.go +++ b/plugin/evm/tx.go @@ -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" @@ -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