CORDA-2375 Ensure node has unique attachment contract classname/version from signed JARs (#4535)

Corda Node ensures a given contract class and version can be sourced from only one signed and trusted Attachment (JAR).
An attempt to import a signed JAR as a trusted uploader (or promote to be trusted) with a class and version already present in the other trusted Attachment will raise DuplicateContractClassException.

Minor fixes to Hibernate Attachment Query parser (original query to select attachment without signers would always return no attachments)
This commit is contained in:
szymonsztuka
2019-01-10 14:13:00 +00:00
committed by GitHub
parent e87a8ed496
commit 9b8fda0d6d
9 changed files with 246 additions and 31 deletions

View File

@ -11,6 +11,12 @@ import net.corda.core.serialization.CordaSerializable
*/
class DuplicateAttachmentException(attachmentHash: String) : java.nio.file.FileAlreadyExistsException(attachmentHash), ClientRelevantError
/**
* Thrown to indicate that a contract class name of the same version was already uploaded to a Corda node.
*/
class DuplicateContractClassException(contractClassName: String, version: Int, attachmentHashes: List<String>) :
Exception("Contract $contractClassName version '$version' already present in the attachments $attachmentHashes"), ClientRelevantError
/**
* Thrown to indicate that a flow was not designed for RPC and should be started from an RPC client.
*/