mirror of
https://github.com/corda/corda.git
synced 2024-12-29 09:18:58 +00:00
Fixes after rebase
This commit is contained in:
parent
f5fc4ceeb8
commit
890ef68523
@ -45,7 +45,7 @@ class NativeSgxApiTest {
|
|||||||
verifies()
|
verifies()
|
||||||
}
|
}
|
||||||
|
|
||||||
val req = TransactionVerificationRequest(wtx3.serialized, arrayOf(wtx1.serialized, wtx2.serialized), emptyArray())
|
val req = TransactionVerificationRequest(wtx3.serialize(), arrayOf(wtx1.serialize(), wtx2.serialize()), emptyArray())
|
||||||
val serialized = req.serialize()
|
val serialized = req.serialize()
|
||||||
assertNull(NativeSgxApi.verify(enclavePath, serialized.bytes))
|
assertNull(NativeSgxApi.verify(enclavePath, serialized.bytes))
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,17 @@
|
|||||||
package com.r3.enclaves.txverify
|
package com.r3.enclaves.txverify
|
||||||
|
|
||||||
import net.corda.core.serialization.SerializationContext
|
import net.corda.core.serialization.SerializationContext
|
||||||
import net.corda.core.serialization.SerializationDefaults
|
import net.corda.core.serialization.SerializationFactory
|
||||||
import net.corda.core.utilities.ByteSequence
|
import net.corda.core.utilities.ByteSequence
|
||||||
import net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme
|
import net.corda.nodeapi.internal.serialization.AbstractKryoSerializationScheme
|
||||||
import net.corda.nodeapi.internal.serialization.KRYO_P2P_CONTEXT
|
|
||||||
import net.corda.nodeapi.internal.serialization.KryoHeaderV0_1
|
import net.corda.nodeapi.internal.serialization.KryoHeaderV0_1
|
||||||
import net.corda.nodeapi.internal.serialization.SerializationFactoryImpl
|
|
||||||
|
|
||||||
@Suppress("UNUSED")
|
@Suppress("UNUSED")
|
||||||
private class KryoVerifierSerializationScheme : AbstractKryoSerializationScheme() {
|
private class KryoVerifierSerializationScheme(serializationFactory: SerializationFactory) : AbstractKryoSerializationScheme(serializationFactory) {
|
||||||
override fun canDeserializeVersion(byteSequence: ByteSequence, target: SerializationContext.UseCase): Boolean {
|
override fun canDeserializeVersion(byteSequence: ByteSequence, target: SerializationContext.UseCase): Boolean {
|
||||||
return byteSequence == KryoHeaderV0_1 && target == SerializationContext.UseCase.P2P
|
return byteSequence == KryoHeaderV0_1 && target == SerializationContext.UseCase.P2P
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun rpcClientKryoPool(context: SerializationContext) = throw UnsupportedOperationException()
|
override fun rpcClientKryoPool(context: SerializationContext) = throw UnsupportedOperationException()
|
||||||
override fun rpcServerKryoPool(context: SerializationContext) = throw UnsupportedOperationException()
|
override fun rpcServerKryoPool(context: SerializationContext) = throw UnsupportedOperationException()
|
||||||
|
|
||||||
private companion object {
|
|
||||||
init {
|
|
||||||
SerializationDefaults.SERIALIZATION_FACTORY = SerializationFactoryImpl().apply {
|
|
||||||
registerScheme(KryoVerifierSerializationScheme())
|
|
||||||
}
|
|
||||||
SerializationDefaults.P2P_CONTEXT = KRYO_P2P_CONTEXT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import net.corda.testing.MEGA_CORP_PUBKEY
|
|||||||
import net.corda.testing.MINI_CORP_PUBKEY
|
import net.corda.testing.MINI_CORP_PUBKEY
|
||||||
import net.corda.testing.ledger
|
import net.corda.testing.ledger
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import java.nio.file.Files
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import kotlin.test.assertFailsWith
|
import kotlin.test.assertFailsWith
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
@ -38,9 +39,9 @@ class EnclaveletTest {
|
|||||||
verifies()
|
verifies()
|
||||||
}
|
}
|
||||||
|
|
||||||
val req = TransactionVerificationRequest(wtx3.serialized, arrayOf(wtx1.serialized, wtx2.serialized), emptyArray())
|
val req = TransactionVerificationRequest(wtx3.serialize(), arrayOf(wtx1.serialize(), wtx2.serialize()), emptyArray())
|
||||||
val serialized = req.serialize()
|
val serialized = req.serialize()
|
||||||
serialized.writeToFile(Paths.get("/tmp/req"))
|
Files.write(Paths.get("/tmp/req"), serialized.bytes)
|
||||||
verifyInEnclave(serialized.bytes)
|
verifyInEnclave(serialized.bytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,11 +64,11 @@ class EnclaveletTest {
|
|||||||
input("c1")
|
input("c1")
|
||||||
input("c2")
|
input("c2")
|
||||||
output(Cash.State(3000.POUNDS `issued by` DUMMY_CASH_ISSUER, AnonymousParty(MINI_CORP_PUBKEY)))
|
output(Cash.State(3000.POUNDS `issued by` DUMMY_CASH_ISSUER, AnonymousParty(MINI_CORP_PUBKEY)))
|
||||||
failsWith("Required net.corda.core.contracts.FungibleAsset.Commands.Move command")
|
failsWith("Required ${Cash.Commands.Move::class.java.canonicalName} command")
|
||||||
}
|
}
|
||||||
val req = TransactionVerificationRequest(wtx3.serialized, arrayOf(wtx1.serialized, wtx2.serialized), emptyArray())
|
val req = TransactionVerificationRequest(wtx3.serialize(), arrayOf(wtx1.serialize(), wtx2.serialize()), emptyArray())
|
||||||
val e = assertFailsWith<Exception> { verifyInEnclave(req.serialize().bytes) }
|
val e = assertFailsWith<Exception> { verifyInEnclave(req.serialize().bytes) }
|
||||||
assertTrue(e.message!!.contains("Required net.corda.core.contracts.FungibleAsset.Commands.Move command"))
|
assertTrue(e.message!!.contains("Required ${Cash.Commands.Move::class.java.canonicalName} command"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user