From a5b80ffc01821becffbe4f36d937f778c911af5f Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Tue, 6 Oct 2020 16:12:56 -0400 Subject: Add semantic verification tests for import tx --- plugin/evm/export_tx_test.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'plugin/evm/export_tx_test.go') diff --git a/plugin/evm/export_tx_test.go b/plugin/evm/export_tx_test.go index 40670ff..319c6dd 100644 --- a/plugin/evm/export_tx_test.go +++ b/plugin/evm/export_tx_test.go @@ -13,7 +13,7 @@ import ( ) func TestExportTxVerifyNil(t *testing.T) { - var exportTx UnsignedExportTx + var exportTx *UnsignedExportTx if err := exportTx.Verify(testXChainID, NewContext(), testTxFee, testAvaxAssetID); err == nil { t.Fatal("Verify should have failed due to nil transaction") } @@ -116,6 +116,17 @@ func TestExportTxVerify(t *testing.T) { exportTx.ExportedOutputs = []*avax.TransferableOutput{exportedOuts[1], exportedOuts[0]} // Test Unsorted outputs Errors if err := exportTx.Verify(testXChainID, ctx, testTxFee, testAvaxAssetID); err == nil { - t.Fatal("ExportTx should have failed verification due to no exported outputs") + t.Fatal("ExportTx should have failed verification due to no unsorted exported outputs") + } + + exportTx.syntacticallyVerified = false + exportTx.ExportedOutputs = []*avax.TransferableOutput{exportedOuts[0], nil} + // Test invalid exported output + if err := exportTx.Verify(testXChainID, ctx, testTxFee, testAvaxAssetID); err == nil { + t.Fatal("ExportTx should have failed verification due to invalid output") } } + +func TestExportTxSemanticVerify(t *testing.T) { + +} -- cgit v1.2.3-70-g09d2