From 0322b8c6cec8a9774e7d55c8434f0b317e60c29a Mon Sep 17 00:00:00 2001 From: Adel El-Beik <48713346+adelel1@users.noreply.github.com> Date: Mon, 2 Dec 2024 21:48:50 +0000 Subject: [PATCH] =?UTF-8?q?ENT-12491:=20Commands=20were=20being=20deserial?= =?UTF-8?q?ized=20in=20captured=20serialisation=E2=80=A6=20(#7887)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ENT-12491: Commands were being deserialized in captured serialisation context which did not include the serialisation context with attachments class loader. Now make the deserialisation lazy. * ENT-12491: Disable carpenter in the external verifier. --- .../net/corda/core/transactions/WireTransaction.kt | 14 ++++++++++---- .../kotlin/net/corda/verifier/ExternalVerifier.kt | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/core/src/main/kotlin/net/corda/core/transactions/WireTransaction.kt b/core/src/main/kotlin/net/corda/core/transactions/WireTransaction.kt index 7b82683bc6..55c00d4a79 100644 --- a/core/src/main/kotlin/net/corda/core/transactions/WireTransaction.kt +++ b/core/src/main/kotlin/net/corda/core/transactions/WireTransaction.kt @@ -28,6 +28,7 @@ import net.corda.core.internal.SerializedStateAndRef import net.corda.core.internal.SerializedTransactionState import net.corda.core.internal.TransactionDeserialisationException import net.corda.core.internal.createComponentGroups +import net.corda.core.internal.deserialiseCommands import net.corda.core.internal.deserialiseComponentGroup import net.corda.core.internal.equivalent import net.corda.core.internal.getGroup @@ -196,10 +197,15 @@ class WireTransaction(componentGroups: List, val privacySalt: Pr verificationSupport.getParties(signersGroup.flatten().toSet()) } } - val authenticatedCommands = commands.lazyMapped { cmd, _ -> - val parties = verificationSupport.getParties(cmd.signers).filterNotNull() - CommandWithParties(cmd.signers, parties, cmd.value) - } + + val lazyCommands: List> by lazy { deserialiseCommands(componentGroups, digestService = digestService) } + val commandsComponentGroup = componentGroups.getGroup(COMMANDS_GROUP) + val commandComponents = commandsComponentGroup?.components ?: emptyList() + val authenticatedCommands = commandComponents.lazyMapped { _, index -> + val cmd = lazyCommands[index] + val parties = verificationSupport.getParties(cmd.signers).filterNotNull() + CommandWithParties(cmd.signers, parties, cmd.value) + } // Ensure that the lazy mappings will use the correct SerializationContext. val serializationFactory = SerializationFactory.defaultFactory diff --git a/verifier/src/main/kotlin/net/corda/verifier/ExternalVerifier.kt b/verifier/src/main/kotlin/net/corda/verifier/ExternalVerifier.kt index 94e2e009e0..9e4c5ce7bf 100644 --- a/verifier/src/main/kotlin/net/corda/verifier/ExternalVerifier.kt +++ b/verifier/src/main/kotlin/net/corda/verifier/ExternalVerifier.kt @@ -87,7 +87,7 @@ class ExternalVerifier(private val channel: SocketChannel) { // Use a preliminary serialization context to receive the initialisation message _contextSerializationEnv.set(SerializationEnvironment.with( verifierSerializationFactory(), - p2pContext = AMQP_P2P_CONTEXT + p2pContext = AMQP_P2P_CONTEXT.withoutCarpenter() )) log.info("Waiting for initialisation message from node...")