diff options
Diffstat (limited to 'plugin/evm')
-rw-r--r-- | plugin/evm/database.go | 2 | ||||
-rw-r--r-- | plugin/evm/export_tx.go | 4 | ||||
-rw-r--r-- | plugin/evm/import_tx_test.go | 18 | ||||
-rw-r--r-- | plugin/evm/vm.go | 2 | ||||
-rw-r--r-- | plugin/evm/vm_test.go | 8 |
5 files changed, 17 insertions, 17 deletions
diff --git a/plugin/evm/database.go b/plugin/evm/database.go index 18890fa..fff18cb 100644 --- a/plugin/evm/database.go +++ b/plugin/evm/database.go @@ -53,7 +53,7 @@ func (db Database) NewIterator(prefix []byte, start []byte) ethdb.Iterator { // NewIteratorWithStart implements ethdb.Database func (db Database) NewIteratorWithStart(start []byte) ethdb.Iterator { - return db.NewIteratorWithStart(start) + return db.Database.NewIteratorWithStart(start) } // Batch implements ethdb.Batch diff --git a/plugin/evm/export_tx.go b/plugin/evm/export_tx.go index 74e36b6..0778d0a 100644 --- a/plugin/evm/export_tx.go +++ b/plugin/evm/export_tx.go @@ -155,9 +155,9 @@ func (tx *UnsignedExportTx) Accept(ctx *snow.Context, _ database.Batch) error { if err != nil { return err } - + utxoID := utxo.InputID() elem := &atomic.Element{ - Key: utxo.InputID().Bytes(), + Key: utxoID[:], Value: utxoBytes, } if out, ok := utxo.Out.(avax.Addressable); ok { diff --git a/plugin/evm/import_tx_test.go b/plugin/evm/import_tx_test.go index fcd18ac..52a8fa7 100644 --- a/plugin/evm/import_tx_test.go +++ b/plugin/evm/import_tx_test.go @@ -22,7 +22,7 @@ func TestImportTxVerifyNil(t *testing.T) { func TestImportTxVerify(t *testing.T) { var importAmount uint64 = 10000000 - txID := ids.NewID([32]byte{0xff}) + txID := [32]byte{0xff} importTx := &UnsignedImportTx{ NetworkID: testNetworkID, BlockchainID: testCChainID, @@ -134,12 +134,12 @@ func TestImportTxSemanticVerify(t *testing.T) { importAmount := uint64(1000000) utxoID := avax.UTXOID{ - TxID: ids.NewID([32]byte{ + TxID: [32]byte{ 0x0f, 0x2f, 0x4f, 0x6f, 0x8e, 0xae, 0xce, 0xee, 0x0d, 0x2d, 0x4d, 0x6d, 0x8c, 0xac, 0xcc, 0xec, 0x0b, 0x2b, 0x4b, 0x6b, 0x8a, 0xaa, 0xca, 0xea, 0x09, 0x29, 0x49, 0x69, 0x88, 0xa8, 0xc8, 0xe8, - }), + }, } utxo := &avax.UTXO{ @@ -203,9 +203,9 @@ func TestImportTxSemanticVerify(t *testing.T) { if err := unsignedImportTx.SemanticVerify(vm, tx); err != nil { t.Fatal("Should have failed to import non-existent UTXO") } - + inputID := utxo.InputID() if err := xChainSharedMemory.Put(vm.ctx.ChainID, []*atomic.Element{{ - Key: utxo.InputID().Bytes(), + Key: inputID[:], Value: utxoBytes, Traits: [][]byte{ testKeys[0].PublicKey().Address().Bytes(), @@ -293,12 +293,12 @@ func TestNewImportTx(t *testing.T) { importAmount := uint64(1000000) utxoID := avax.UTXOID{ - TxID: ids.NewID([32]byte{ + TxID: [32]byte{ 0x0f, 0x2f, 0x4f, 0x6f, 0x8e, 0xae, 0xce, 0xee, 0x0d, 0x2d, 0x4d, 0x6d, 0x8c, 0xac, 0xcc, 0xec, 0x0b, 0x2b, 0x4b, 0x6b, 0x8a, 0xaa, 0xca, 0xea, 0x09, 0x29, 0x49, 0x69, 0x88, 0xa8, 0xc8, 0xe8, - }), + }, } utxo := &avax.UTXO{ @@ -318,9 +318,9 @@ func TestNewImportTx(t *testing.T) { } xChainSharedMemory := sharedMemory.NewSharedMemory(vm.ctx.XChainID) - + inputID := utxo.InputID() if err := xChainSharedMemory.Put(vm.ctx.ChainID, []*atomic.Element{{ - Key: utxo.InputID().Bytes(), + Key: inputID[:], Value: utxoBytes, Traits: [][]byte{ testKeys[0].PublicKey().Address().Bytes(), diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index 09e2ad5..2ab4028 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -851,7 +851,7 @@ func (vm *VM) GetAtomicUTXOs( chainID, addrsList, startAddr.Bytes(), - startUTXOID.Bytes(), + startUTXOID[:], limit, ) if err != nil { diff --git a/plugin/evm/vm_test.go b/plugin/evm/vm_test.go index 8ce7825..1117d0d 100644 --- a/plugin/evm/vm_test.go +++ b/plugin/evm/vm_test.go @@ -23,15 +23,15 @@ import ( var ( testNetworkID uint32 = 10 - testCChainID = ids.NewID([32]byte{'c', 'c', 'h', 'a', 'i', 'n', 't', 'e', 's', 't'}) - testXChainID = ids.NewID([32]byte{'t', 'e', 's', 't', 'x'}) - nonExistentID = ids.NewID([32]byte{'F'}) + testCChainID = ids.ID([32]byte{'c', 'c', 'h', 'a', 'i', 'n', 't', 'e', 's', 't'}) + testXChainID = ids.ID([32]byte{'t', 'e', 's', 't', 'x'}) + nonExistentID = ids.ID([32]byte{'F'}) testTxFee = uint64(1000) startBalance = uint64(50000) testKeys []*crypto.PrivateKeySECP256K1R testEthAddrs []common.Address // testEthAddrs[i] corresponds to testKeys[i] testShortIDAddrs []ids.ShortID - testAvaxAssetID = ids.NewID([32]byte{1, 2, 3}) + testAvaxAssetID = [32]byte{1, 2, 3} username = "Johns" password = "CjasdjhiPeirbSenfeI13" // #nosec G101 ethChainID uint32 = 43112 |