From d7f430c196e0856eaaeedbfe1fcc30c1c472cd43 Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Mon, 9 Nov 2020 13:46:28 -0500 Subject: Clean up usage of ids.ID --- plugin/evm/export_tx.go | 2 -- plugin/evm/factory.go | 2 +- plugin/evm/import_tx.go | 2 -- plugin/evm/import_tx_test.go | 6 +++--- plugin/evm/service.go | 2 +- plugin/evm/vm_test.go | 8 ++++---- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/plugin/evm/export_tx.go b/plugin/evm/export_tx.go index 0778d0a..ed069d4 100644 --- a/plugin/evm/export_tx.go +++ b/plugin/evm/export_tx.go @@ -53,8 +53,6 @@ func (tx *UnsignedExportTx) Verify( return errNilTx case tx.syntacticallyVerified: // already passed syntactic verification return nil - case tx.DestinationChain == ids.Empty: - return errWrongChainID case tx.DestinationChain != avmID: return errWrongChainID case len(tx.ExportedOutputs) == 0: diff --git a/plugin/evm/factory.go b/plugin/evm/factory.go index b977117..daedf39 100644 --- a/plugin/evm/factory.go +++ b/plugin/evm/factory.go @@ -7,7 +7,7 @@ import "github.com/ava-labs/avalanchego/ids" // ID this VM should be referenced by var ( - ID = ids.ID([32]byte{'e', 'v', 'm'}) + ID = ids.ID{'e', 'v', 'm'} ) // Factory ... diff --git a/plugin/evm/import_tx.go b/plugin/evm/import_tx.go index 2ce8f6f..23dbc5f 100644 --- a/plugin/evm/import_tx.go +++ b/plugin/evm/import_tx.go @@ -58,8 +58,6 @@ func (tx *UnsignedImportTx) Verify( return errNilTx case tx.syntacticallyVerified: // already passed syntactic verification return nil - case tx.SourceChain == ids.Empty: - return errWrongChainID case tx.SourceChain != avmID: return errWrongChainID case len(tx.ImportedInputs) == 0: diff --git a/plugin/evm/import_tx_test.go b/plugin/evm/import_tx_test.go index b0f2875..53b9494 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 := [32]byte{0xff} + txID := ids.ID{0xff} importTx := &UnsignedImportTx{ NetworkID: testNetworkID, BlockchainID: testCChainID, @@ -134,7 +134,7 @@ func TestImportTxSemanticVerify(t *testing.T) { importAmount := uint64(1000000) utxoID := avax.UTXOID{ - TxID: [32]byte{ + TxID: ids.ID{ 0x0f, 0x2f, 0x4f, 0x6f, 0x8e, 0xae, 0xce, 0xee, 0x0d, 0x2d, 0x4d, 0x6d, 0x8c, 0xac, 0xcc, 0xec, 0x0b, 0x2b, 0x4b, 0x6b, 0x8a, 0xaa, 0xca, 0xea, @@ -293,7 +293,7 @@ func TestNewImportTx(t *testing.T) { importAmount := uint64(1000000) utxoID := avax.UTXOID{ - TxID: [32]byte{ + TxID: ids.ID{ 0x0f, 0x2f, 0x4f, 0x6f, 0x8e, 0xae, 0xce, 0xee, 0x0d, 0x2d, 0x4d, 0x6d, 0x8c, 0xac, 0xcc, 0xec, 0x0b, 0x2b, 0x4b, 0x6b, 0x8a, 0xaa, 0xca, 0xea, diff --git a/plugin/evm/service.go b/plugin/evm/service.go index c0106ab..65ef3a2 100644 --- a/plugin/evm/service.go +++ b/plugin/evm/service.go @@ -24,7 +24,7 @@ import ( ) const ( - version = "coreth" + version = "coreth-v0.3.14" ) // test constants diff --git a/plugin/evm/vm_test.go b/plugin/evm/vm_test.go index d58fdda..020b663 100644 --- a/plugin/evm/vm_test.go +++ b/plugin/evm/vm_test.go @@ -23,14 +23,14 @@ import ( var ( testNetworkID uint32 = 10 - 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'}) + testCChainID = ids.ID{'c', 'c', 'h', 'a', 'i', 'n', 't', 'e', 's', 't'} + testXChainID = ids.ID{'t', 'e', 's', 't', 'x'} + nonExistentID = ids.ID{'F'} testTxFee = uint64(1000) testKeys []*crypto.PrivateKeySECP256K1R testEthAddrs []common.Address // testEthAddrs[i] corresponds to testKeys[i] testShortIDAddrs []ids.ShortID - testAvaxAssetID = [32]byte{1, 2, 3} + testAvaxAssetID = ids.ID{1, 2, 3} username = "Johns" password = "CjasdjhiPeirbSenfeI13" // #nosec G101 ) -- cgit v1.2.3