ENT-12491: Commands were being deserialized in captured serialisation… (#7887)

* 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.
This commit is contained in:
Adel El-Beik 2024-12-02 21:48:50 +00:00 committed by GitHub
parent 8ebf4ad835
commit 0322b8c6ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 5 deletions

View File

@ -28,6 +28,7 @@ import net.corda.core.internal.SerializedStateAndRef
import net.corda.core.internal.SerializedTransactionState import net.corda.core.internal.SerializedTransactionState
import net.corda.core.internal.TransactionDeserialisationException import net.corda.core.internal.TransactionDeserialisationException
import net.corda.core.internal.createComponentGroups import net.corda.core.internal.createComponentGroups
import net.corda.core.internal.deserialiseCommands
import net.corda.core.internal.deserialiseComponentGroup import net.corda.core.internal.deserialiseComponentGroup
import net.corda.core.internal.equivalent import net.corda.core.internal.equivalent
import net.corda.core.internal.getGroup import net.corda.core.internal.getGroup
@ -196,10 +197,15 @@ class WireTransaction(componentGroups: List<ComponentGroup>, val privacySalt: Pr
verificationSupport.getParties(signersGroup.flatten().toSet()) verificationSupport.getParties(signersGroup.flatten().toSet())
} }
} }
val authenticatedCommands = commands.lazyMapped { cmd, _ ->
val parties = verificationSupport.getParties(cmd.signers).filterNotNull() val lazyCommands: List<Command<*>> by lazy { deserialiseCommands(componentGroups, digestService = digestService) }
CommandWithParties(cmd.signers, parties, cmd.value) 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. // Ensure that the lazy mappings will use the correct SerializationContext.
val serializationFactory = SerializationFactory.defaultFactory val serializationFactory = SerializationFactory.defaultFactory

View File

@ -87,7 +87,7 @@ class ExternalVerifier(private val channel: SocketChannel) {
// Use a preliminary serialization context to receive the initialisation message // Use a preliminary serialization context to receive the initialisation message
_contextSerializationEnv.set(SerializationEnvironment.with( _contextSerializationEnv.set(SerializationEnvironment.with(
verifierSerializationFactory(), verifierSerializationFactory(),
p2pContext = AMQP_P2P_CONTEXT p2pContext = AMQP_P2P_CONTEXT.withoutCarpenter()
)) ))
log.info("Waiting for initialisation message from node...") log.info("Waiting for initialisation message from node...")