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/import_tx.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'plugin/evm/import_tx.go') diff --git a/plugin/evm/import_tx.go b/plugin/evm/import_tx.go index b848e61..ae6b540 100644 --- a/plugin/evm/import_tx.go +++ b/plugin/evm/import_tx.go @@ -98,6 +98,10 @@ func (tx *UnsignedImportTx) SemanticVerify( return permError{err} } + if len(stx.Creds) != len(tx.ImportedInputs) { + return permError{errSignatureInputsMismatch} + } + // do flow-checking fc := avax.NewFlowChecker() //fc.Produce(vm.ctx.AVAXAssetID, vm.txFee) @@ -122,6 +126,7 @@ func (tx *UnsignedImportTx) SemanticVerify( for i, in := range tx.ImportedInputs { utxoIDs[i] = in.UTXOID.InputID().Bytes() } + // allUTXOBytes is guaranteed to be the same length as utxoIDs allUTXOBytes, err := vm.ctx.SharedMemory.Get(tx.SourceChain, utxoIDs) if err != nil { return tempError{err} -- cgit v1.2.3