Remove signleto serialized as token from WireTx and ENC tx service, issues with core-deterministic

This commit is contained in:
vanjatomic 2022-04-07 12:08:02 +01:00
parent 8e596b0c4e
commit 7fa54b4cb9
3 changed files with 9 additions and 5 deletions

View File

@ -16,7 +16,7 @@ import java.util.*
* data to arrive in a single ByteArray
*/
abstract class CordaEnclaveClient(val x500: CordaX500Name, val keyManagementService: KeyManagementService? = null, val identityService: IdentityService? = null): SingletonSerializeAsToken() {
abstract class CordaEnclaveClient(val x500: CordaX500Name, val keyManagementService: KeyManagementService? = null, val identityService: IdentityService? = null) {
// Some exceptions we could throw [TBD - do we want this?]
class RemoteAttestationException(description: String) : FlowException(description)

View File

@ -15,7 +15,7 @@ import net.corda.core.transactions.EncryptedTransaction
import java.util.*
import java.util.concurrent.ConcurrentHashMap
class EncryptedTransactionService(val enclaveClient: CordaEnclaveClient = DummyCordaEnclaveClient(CordaX500Name("PartyDummy", "London", "GB" ))) : SingletonSerializeAsToken() {
class EncryptedTransactionService(val enclaveClient: CordaEnclaveClient = DummyCordaEnclaveClient(CordaX500Name("PartyDummy", "London", "GB" ))) {
private val attestationCache = ConcurrentHashMap<Party, ByteArray>()

View File

@ -22,6 +22,7 @@ import net.corda.core.serialization.deserialize
import net.corda.core.serialization.internal.AttachmentsClassLoaderCache
import net.corda.core.serialization.serialize
import net.corda.core.utilities.OpaqueBytes
import net.corda.core.utilities.SgxSupport
import java.security.PublicKey
import java.security.SignatureException
import java.util.function.Predicate
@ -425,6 +426,7 @@ constructor(componentGroups: List<ComponentGroup>, val privacySalt: PrivacySalt,
val paramsHash = coreTransaction?.networkParametersHash ?: services.networkParametersService.defaultHash
val params = services.networkParametersService.lookup(paramsHash)
?: throw IllegalStateException("Should have been able to fetch parameters by this point: $paramsHash")
@Suppress("UNCHECKED_CAST")
when (coreTransaction) {
is WireTransaction -> coreTransaction.componentGroups
@ -433,10 +435,12 @@ constructor(componentGroups: List<ComponentGroup>, val privacySalt: PrivacySalt,
?.get(stateRef.index) as SerializedBytes<TransactionState<ContractState>>?
is ContractUpgradeWireTransaction -> coreTransaction.resolveOutputComponent(services, stateRef, params)
is NotaryChangeWireTransaction -> coreTransaction.resolveOutputComponent(services, stateRef, params)
else -> {
else -> if(SgxSupport.isInsideEnclave) {
services.validatedTransactions.getEncryptedTransaction(stateRef.txhash)?.let { encryptedTx ->
services.encryptedTransactionService.decryptInputAndRefsForNode(encryptedTx).inputs.single { it.ref == stateRef }.serialize() as SerializedBytes<TransactionState<ContractState>>?
} ?: throw UnsupportedOperationException("Attempting to resolve input ${stateRef.index} of a ${coreTransaction?.let { it.javaClass } ?: null} transaction. This is not supported.")
services.encryptedTransactionService.decryptInputAndRefsForNode(encryptedTx).inputs.singleOrNull { it.ref == stateRef }?.state?.serialize()
} ?: throw UnsupportedOperationException("Attempting to resolve input ${stateRef.index} of a ${coreTransaction?.javaClass ?: "null"} transaction. This is not supported.")
} else {
throw UnsupportedOperationException("Attempting to resolve input ${stateRef.index} of a ${coreTransaction?.javaClass ?: "null"} transaction. This is not supported.")
}
}
} else {