From 1ed5fce6a6ecfa7e647dd1eee5576cc261103f08 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Sun, 17 Feb 2019 12:47:38 +0100 Subject: [PATCH] Backwards compat: Put the confidential-identities module back in the node classpath by default. Separating it out into a standalone "app" needs more thought and design work, if we do it at all. --- confidential-identities/build.gradle | 17 ++------------ .../corda/confidential/SwapIdentitiesFlow.kt | 12 +--------- docs/source/changelog.rst | 3 --- docs/source/release-notes.rst | 6 ----- finance/workflows/build.gradle | 2 +- node/build.gradle | 4 ++++ .../node/internal/SwapIdentitiesHandler.kt | 22 +++++++++++++++++++ samples/bank-of-corda-demo/build.gradle | 2 -- samples/trader-demo/build.gradle | 2 -- tools/demobench/build.gradle | 5 ----- .../demobench/plugin/CordappController.kt | 3 +-- 11 files changed, 31 insertions(+), 47 deletions(-) create mode 100644 node/src/main/kotlin/net/corda/node/internal/SwapIdentitiesHandler.kt diff --git a/confidential-identities/build.gradle b/confidential-identities/build.gradle index 3e38d2a870..444b0098c5 100644 --- a/confidential-identities/build.gradle +++ b/confidential-identities/build.gradle @@ -1,7 +1,5 @@ -// Experimental Confidential Identities support for 1.0 -// This contains the prototype SwapIdentitiesFlow and SwapIdentitiesHandler, which can be used -// for exchanging confidential identities as part of a flow, until a permanent solution is prepared. -// Expect this module to be removed and merged into core in a later release. +// This contains the SwapIdentitiesFlow which can be used for exchanging confidential identities as part of a flow. +// TODO: Merge this into core: the original plan was to develop it independently but in practice it's too widely used to break compatibility now, as finance uses it. apply plugin: 'kotlin' apply plugin: CanonicalizerPlugin apply plugin: 'net.corda.plugins.publish-utils' @@ -27,17 +25,6 @@ dependencies { testCompile "org.assertj:assertj-core:$assertj_version" } -cordapp { - targetPlatformVersion corda_platform_version.toInteger() - minimumPlatformVersion 1 - workflow { - name "Corda Experimental Confidential Identities" - versionId 1 - vendor "R3" - licence "Open Source (Apache 2)" - } -} - jar { baseName 'corda-confidential-identities' } diff --git a/confidential-identities/src/main/kotlin/net/corda/confidential/SwapIdentitiesFlow.kt b/confidential-identities/src/main/kotlin/net/corda/confidential/SwapIdentitiesFlow.kt index 085aa22784..d2813f9e1e 100644 --- a/confidential-identities/src/main/kotlin/net/corda/confidential/SwapIdentitiesFlow.kt +++ b/confidential-identities/src/main/kotlin/net/corda/confidential/SwapIdentitiesFlow.kt @@ -124,14 +124,4 @@ private constructor(private val otherSideSession: FlowSession?, @CordaSerializable data class CertificateOwnershipAssertion(val x500Name: CordaX500Name, val publicKey: PublicKey) -open class SwapIdentitiesException @JvmOverloads constructor(message: String, cause: Throwable? = null) : FlowException(message, cause) - -// This only exists for backwards compatibility -@InitiatedBy(SwapIdentitiesFlow::class) -private class SwapIdentitiesHandler(private val otherSide: FlowSession) : FlowLogic() { - @Suspendable - override fun call() { - subFlow(SwapIdentitiesFlow(otherSide)) - logger.warnOnce("Insecure API to swap anonymous identities was used by ${otherSide.counterparty} (${otherSide.getCounterpartyFlowInfo()})") - } -} +open class SwapIdentitiesException @JvmOverloads constructor(message: String, cause: Throwable? = null) : FlowException(message, cause) \ No newline at end of file diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index a23a3d40e0..857a546215 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -74,9 +74,6 @@ Version 4.0 * Fixed a problem that was preventing `Cash.generateSpend` to be used more than once per transaction (https://github.com/corda/corda/issues/4110). -* The experimental confidential-identities is now a separate CorDapp and must now be loaded onto the node alongside any CorDapp that needs it. - This also means your gradle dependency for it should be ``cordapp`` and not ``cordaCompile``. - * Fixed a bug resulting in poor vault query performance and incorrect results when sorting. * Improved exception thrown by `AttachmentsClassLoader` when an attachment cannot be used because its uploader is not trusted. diff --git a/docs/source/release-notes.rst b/docs/source/release-notes.rst index f0a2641624..28849fe297 100644 --- a/docs/source/release-notes.rst +++ b/docs/source/release-notes.rst @@ -292,12 +292,6 @@ The TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 family of ciphers is retired from the li as it is a legacy cipher family not supported by all native SSL/TLS implementations. We anticipate that this will have no impact on any deployed configurations. -Confidential identities -+++++++++++++++++++++++ - -If any of your CorDapps use the experimental confidential-identities module then it also needs to be loaded as a separate CorDapp jar. This -includes the demo finance CorDapp. - Miscellaneous changes ~~~~~~~~~~~~~~~~~~~~~ diff --git a/finance/workflows/build.gradle b/finance/workflows/build.gradle index 9b479dbe7f..050c0122ec 100644 --- a/finance/workflows/build.gradle +++ b/finance/workflows/build.gradle @@ -28,8 +28,8 @@ dependencies { // cordapp project(':finance:workflows') // cordapp project(':finance:contracts') cordaCompile project(':core') + cordaCompile project(':confidential-identities') - cordapp project(':confidential-identities') cordapp project(':finance:contracts') // For JSON diff --git a/node/build.gradle b/node/build.gradle index f6f302bd03..a4088e80c2 100644 --- a/node/build.gradle +++ b/node/build.gradle @@ -73,6 +73,10 @@ dependencies { compile project(':tools:cliutils') compile project(':common-validation') compile project(':common-configuration-parsing') + + // Backwards compatibility goo: Apps expect confidential-identities to be loaded by default. + // We could eventually gate this on a target-version check. + compile project(':confidential-identities') // Log4J: logging framework (with SLF4J bindings) compile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}" diff --git a/node/src/main/kotlin/net/corda/node/internal/SwapIdentitiesHandler.kt b/node/src/main/kotlin/net/corda/node/internal/SwapIdentitiesHandler.kt new file mode 100644 index 0000000000..f1c8aff9f3 --- /dev/null +++ b/node/src/main/kotlin/net/corda/node/internal/SwapIdentitiesHandler.kt @@ -0,0 +1,22 @@ +package net.corda.node.internal + +import co.paralleluniverse.fibers.Suspendable +import net.corda.confidential.SwapIdentitiesFlow +import net.corda.core.flows.FlowLogic +import net.corda.core.flows.FlowSession +import net.corda.core.flows.InitiatedBy +import net.corda.core.internal.warnOnce + +/** + * Exists for backwards compatibility - the old confidential-identities API didn't use inlined flows. One day we'll need to disable this, + * but it is a complex versioning problem because we don't know which peers we might interact with. Disabling it will probably have to be + * gated on a minPlatformVersion bump. + */ +@InitiatedBy(SwapIdentitiesFlow::class) +class SwapIdentitiesHandler(private val otherSide: FlowSession) : FlowLogic() { + @Suspendable + override fun call() { + subFlow(SwapIdentitiesFlow(otherSide)) + logger.warnOnce("Insecure API to swap anonymous identities was used by ${otherSide.counterparty} (${otherSide.getCounterpartyFlowInfo()})") + } +} diff --git a/samples/bank-of-corda-demo/build.gradle b/samples/bank-of-corda-demo/build.gradle index dec78d082b..d586e8e2c7 100644 --- a/samples/bank-of-corda-demo/build.gradle +++ b/samples/bank-of-corda-demo/build.gradle @@ -11,7 +11,6 @@ dependencies { // The bank of corda CorDapp depends upon Cash CorDapp features cordapp project(':finance:contracts') cordapp project(':finance:workflows') - cordapp project(':confidential-identities') // Corda integration dependencies cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts') @@ -35,7 +34,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, nodeDefaults { cordapp project(':finance:workflows') cordapp project(':finance:contracts') - cordapp project(':confidential-identities') } node { name "O=Notary Service,L=Zurich,C=CH" diff --git a/samples/trader-demo/build.gradle b/samples/trader-demo/build.gradle index 4fa7d94e2d..590f0c0483 100644 --- a/samples/trader-demo/build.gradle +++ b/samples/trader-demo/build.gradle @@ -9,7 +9,6 @@ dependencies { // The trader demo CorDapp depends upon Cash CorDapp features cordapp project(':finance:contracts') cordapp project(':finance:workflows') - cordapp project(':confidential-identities') cordapp project(':samples:bank-of-corda-demo') cordapp project(':samples:trader-demo:workflows-trader') @@ -32,7 +31,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, } cordapp project(':finance:workflows') cordapp project(':finance:contracts') - cordapp project(':confidential-identities') cordapp project(':samples:trader-demo:workflows-trader') } directory "./build/nodes" diff --git a/tools/demobench/build.gradle b/tools/demobench/build.gradle index 950db72eec..f7e8190dc3 100644 --- a/tools/demobench/build.gradle +++ b/tools/demobench/build.gradle @@ -138,11 +138,6 @@ distributions { into 'cordapps' fileMode = 0444 } - from(project(':confidential-identities').tasks.jar) { - rename 'corda-confidential-identities(.*)', 'corda-confidential-identities.jar' - into 'cordapps' - fileMode = 0444 - } } } } diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/plugin/CordappController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/plugin/CordappController.kt index 187fa9374a..5748eb9e27 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/plugin/CordappController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/plugin/CordappController.kt @@ -22,8 +22,7 @@ class CordappController : Controller() { private val cordappDir: Path = jvm.applicationDir / NodeConfig.CORDAPP_DIR_NAME private val cordappJars = setOf( cordappDir / "$FINANCE_CONTRACTS_CORDAPP_FILENAME.jar", - cordappDir / "$FINANCE_WORKFLOWS_CORDAPP_FILENAME.jar", - cordappDir / "corda-confidential-identities.jar" + cordappDir / "$FINANCE_WORKFLOWS_CORDAPP_FILENAME.jar" ) /**