From 1e05f27bae76c4af9c7639f73217dbc983a94558 Mon Sep 17 00:00:00 2001 From: Katelyn Baker Date: Thu, 19 Oct 2017 12:01:39 +0100 Subject: [PATCH 1/3] CORDA-725 - Change AMQP identifier to officially assigned value This does change our header format so pre-cached test files need regenerating --- .../internal/serialization/amqp/Schema.kt | 11 ++++-- .../serialization/amqp/EvolvabilityTests.kt | 34 +++++++++++++----- .../amqp/EvolvabilityTests.addAdditionalParam | Bin 261 -> 261 bytes ...bilityTests.addAdditionalParamNotMandatory | Bin 273 -> 273 bytes .../EvolvabilityTests.addAndRemoveParameters | Bin 390 -> 390 bytes ...yTests.addMandatoryFieldWithAltConstructor | Bin 285 -> 285 bytes ...andatoryFieldWithAltConstructorUnAnnotated | Bin 296 -> 296 bytes ...dMandatoryFieldWithAltReorderedConstructor | Bin 387 -> 387 bytes ...FieldWithAltReorderedConstructorAndRemoval | Bin 403 -> 403 bytes .../amqp/EvolvabilityTests.changeSubType | Bin 616 -> 616 bytes .../amqp/EvolvabilityTests.multiVersion.1 | Bin 294 -> 294 bytes .../amqp/EvolvabilityTests.multiVersion.2 | Bin 327 -> 327 bytes .../amqp/EvolvabilityTests.multiVersion.3 | Bin 372 -> 372 bytes ...volvabilityTests.multiVersionWithRemoval.1 | Bin 338 -> 338 bytes ...volvabilityTests.multiVersionWithRemoval.2 | Bin 392 -> 392 bytes ...volvabilityTests.multiVersionWithRemoval.3 | Bin 425 -> 425 bytes .../amqp/EvolvabilityTests.removeParameters | Bin 378 -> 378 bytes ...vabilityTests.simpleOrderSwapDifferentType | Bin 311 -> 311 bytes .../EvolvabilityTests.simpleOrderSwapSameType | Bin 302 -> 302 bytes 19 files changed, 35 insertions(+), 10 deletions(-) diff --git a/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/Schema.kt b/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/Schema.kt index adb0c44f0c..d3d767c4eb 100644 --- a/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/Schema.kt +++ b/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/Schema.kt @@ -18,8 +18,15 @@ import java.util.* import net.corda.nodeapi.internal.serialization.carpenter.Field as CarpenterField import net.corda.nodeapi.internal.serialization.carpenter.Schema as CarpenterSchema -// TODO: get an assigned number as per AMQP spec -const val DESCRIPTOR_TOP_32BITS: Long = 0xc0da0000 +/** + * R3 AMQP assigned enterprise number + * + * see [https://www.iana.org/assignments/enterprise-numbers/enterprise-numbers] + * + * Repeated here for brevity: + * 50530 - R3 - Mike Hearn - mike&r3.com + */ +const val DESCRIPTOR_TOP_32BITS: Long = 0xc5620000 const val DESCRIPTOR_DOMAIN: String = "net.corda" diff --git a/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.kt b/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.kt index cdf690029c..9c4a949384 100644 --- a/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.kt +++ b/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.kt @@ -30,6 +30,7 @@ class EvolvabilityTests { // data class C (val a: Int, val b: Int) // val sc = SerializationOutput(sf).serialize(C(A, B)) // f.writeBytes(sc.bytes) + // println (path) // new version of the class, in this case the order of the parameters has been swapped data class C(val b: Int, val a: Int) @@ -54,6 +55,7 @@ class EvolvabilityTests { // data class C (val a: Int, val b: String) // val sc = SerializationOutput(sf).serialize(C(A, B)) // f.writeBytes(sc.bytes) + // println (path) // new version of the class, in this case the order of the parameters has been swapped data class C(val b: String, val a: Int) @@ -78,7 +80,6 @@ class EvolvabilityTests { // val sc = SerializationOutput(sf).serialize(C(A)) // f.writeBytes(sc.bytes) // println ("Path = $path") - data class C(val a: Int, val b: Int?) val sc2 = f.readBytes() @@ -300,9 +301,6 @@ class EvolvabilityTests { val path2 = EvolvabilityTests::class.java.getResource("EvolvabilityTests.multiVersion.2") val path3 = EvolvabilityTests::class.java.getResource("EvolvabilityTests.multiVersion.3") - @Suppress("UNUSED_VARIABLE") - val f = File(path1.toURI()) - val a = 100 val b = 200 val c = 300 @@ -312,14 +310,24 @@ class EvolvabilityTests { // // Version 1: // data class C (val a: Int, val b: Int) + // + // val scc = SerializationOutput(sf).serialize(C(a, b)) + // File(path1.toURI()).writeBytes(scc.bytes) + // println ("Path = $path1") + // // Version 2 - add param c // data class C (val c: Int, val b: Int, val a: Int) + // + // val scc = SerializationOutput(sf).serialize(C(c, b, a)) + // File(path2.toURI()).writeBytes(scc.bytes) + // println ("Path = $path2") + // // Version 3 - add param d // data class C (val b: Int, val c: Int, val d: Int, val a: Int) // // val scc = SerializationOutput(sf).serialize(C(b, c, d, a)) - // f.writeBytes(scc.bytes) - // println ("Path = $path1") + // File(path3.toURI()).writeBytes(scc.bytes) + // println ("Path = $path3") @Suppress("UNUSED") data class C(val e: Int, val c: Int, val b: Int, val a: Int, val d: Int) { @@ -409,14 +417,24 @@ class EvolvabilityTests { // // Version 1: // data class C (val a: Int, val b: Int, val c: Int) + // + // val scc = SerializationOutput(sf).serialize(C(a, b, c)) + // File(path1.toURI()).writeBytes(scc.bytes) + // println ("Path = $path1") + // // Version 2 - add param c // data class C (val b: Int, val c: Int, val d: Int, val e: Int) + // + // val scc = SerializationOutput(sf).serialize(C(b, c, d, e)) + // File(path2.toURI()).writeBytes(scc.bytes) + // println ("Path = $path2") + // // Version 3 - add param d // data class C (val b: Int, val c: Int, val d: Int, val e: Int, val f: Int) // // val scc = SerializationOutput(sf).serialize(C(b, c, d, e, f)) - // File(path1.toURI()).writeBytes(scc.bytes) - // println ("Path = $path1") + // File(path3.toURI()).writeBytes(scc.bytes) + // println ("Path = $path3") @Suppress("UNUSED") data class C(val b: Int, val c: Int, val d: Int, val e: Int, val f: Int, val g: Int) { diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addAdditionalParam b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addAdditionalParam index 06c32d9eff45607d1bf17103d69f1d624f52ba21..e9accefe39961b96b51b5e54340ad82b03a92a81 100644 GIT binary patch delta 58 zcmZo=YGo2g&M!(yWMp7qXaHh{qe&A5OofgnF)$t2#du&lBV05*nF%Pj#~4I@6afI! C6A~@} delta 58 zcmZo=YGo2g&M!(yWMp7qXaHh{1Ggp$m4i!rP%V4oS9eRx{%QTs1X1JL?({_ delta 130 zcmZo;Zetcm&M!(yWMp7qXaHh{1Ggp$crpRWXekg`o(CeI8w1J7GK^9I2W~O291vt* q$e6T{t+=EpGcVoM!NJi9rWY!ij7w4gs550Db7o$N>q15Yphf^At12e| diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addMandatoryFieldWithAltConstructor b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addMandatoryFieldWithAltConstructor index 6daa3c7714a93d9bdc22deece8c77a0b0948c54f..a7e207ac7570921b04699d400c231783cff4597f 100644 GIT binary patch delta 83 zcmbQsG?z&rIlm|+k&%Icp#g{)jwVeMuogO+#K3gm4C8^5jBwG|Qg)yy^8q!ci83k^ d|8j`|c`OG6*cUP;E@aNkD{)=OXyD-J1OVqL7@hzC delta 83 zcmbQsG?z&rIlm|+k&%Icp#g{)4&0h3U@dgu76a3PGmHmLGQve;OWA><%m>t%Cd#Nx d{L3W<8r=W@ diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addMandatoryFieldWithAltConstructorUnAnnotated b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addMandatoryFieldWithAltConstructorUnAnnotated index e47d5270f863e3b84da683b9a81d3b5659d2938f..e712d58560a6edc527cc909c5da1b97046d640f0 100644 GIT binary patch delta 75 zcmZ3%w1P<>Ilm|+k&%Icp#g{)jwVeMuogO+#K3gmI^%&WjBwG|1}31~ePc189LoU# V_Jxdz3z;+XN?aE*8aOyQ0RT%g7asrs delta 75 zcmZ3%w1P<>Ilm|+k&%Icp#g{)4&0h3U@dgu76a3P>x>7kFv3M+8<>D{_l?DXax4b~ V*cUP;E@aNkD{)=OXyD-J1OT2j8D0PY diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addMandatoryFieldWithAltReorderedConstructor b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addMandatoryFieldWithAltReorderedConstructor index 290fad125aaea3e7124f33638b8fc97fc291de78..87506ae2030620b373c093466c52b7e777c09ea0 100644 GIT binary patch delta 145 zcmZo>Ze|up&M!(yWMp7qXaHh{qe&A5g5{1TF)&?VU|{r~MPnV)(WJ?Y zjK=;zg)9dI*cUP;E@aNkD{)=OXyD-J1XBo=OTr;12-KInkgd3+C^IkJ)d8px0Jlvf AbN~PV delta 145 zcmZo>Ze|up&M!(yWMp7qXaHh{1Ggp$1j`+`#lUodfq_vRD8dM0@PQa`6^(UF2X0Mf zWHj~%Dr7kzz`l?%aUpYNUWw~MMgs>&CzwL0ToMjBL7=|mg>1zoMVWc&t`0zr0Jldc AnE(I) diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addMandatoryFieldWithAltReorderedConstructorAndRemoval b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.addMandatoryFieldWithAltReorderedConstructorAndRemoval index 769ea67e2d69fd636d0493e3a9fa5ff08f793b3b..922eecc33539c7e8c483ad07ad2090138c8a0055 100644 GIT binary patch delta 145 zcmbQtJegS_Ilm|+k&%Icp#g{)jwVeM2$nmV#K3fcfq_vSD8dM0$blGe6^(sNN0TNC zG8+2>6|x)R|lX*0O4&U A)Bpeg delta 145 zcmbQtJegS_Ilm|+k&%Icp#g{)4&0h35G;4#76a1-1_nlTpa>&~AqQf>RW$Z79k?}F zkkQy5sF3A=0Q*A5#D&b6c_pq384Vm9onQ)~a!EMk1cCaJ7qS(X6lLb6yE*_h0s!G> BC;0#X diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.changeSubType b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.changeSubType index 1158e284fe5773c1747e0d43d496368a0d81793d..96e11c7f09fa2c31a82b92521617dbaca74dd69e 100644 GIT binary patch delta 121 zcmaFC@`6PmIlm|+k&%Icp#g{)jwVeM$Y27JRZ<{w8i+lK(OB+i5(CQt0rrKAi3^!C r^GaM7G8#BII>Gcz4rI(=11e!XuyW#pz{vtkyg+S}<(Z7du$hi{hldC diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.multiVersion.1 b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.multiVersion.1 index 46714457ecb568c3ca2adfa3b814dd0fedfc1797..2cca4802acc3dc849eea285c27201058c1b816fb 100644 GIT binary patch delta 103 zcmZ3+w2Vn0Ilm|+k&%Icp#g{)jwVeMa1c70#K3gm0^@t%Cd#Nx pe9y%MRQX%V2q?yKK!ANAW70zA%)AoUg^UIcj!rOLP`N~8IRFLPCVv0` diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.multiVersion.3 b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.multiVersion.3 index 6b3e9a3a37306afea3aae8325fb986fd638ef465..1e36577ca927ec4b8c0ad0f9d9a5a54794c47338 100644 GIT binary patch delta 112 zcmeyu^o2bjBwHP3?`u5MPomp9LoU# f_Jxdz3z;+XN?aE*8aOyQ!PG(JlJLkSBg+8*HR&dJ delta 131 zcmcb_bcsnIIlm|+k&%Icp#g{)4&0h3;3{iYx~J$zC7R delta 107 zcmeBR?qC*3&M!(yWMp7qXaHh{1Ggp$_%Z>>cqtHBod+Uc8w1J73XCA3$u^8qMh9*& fupAIzU&xrUkU2B2#C0K~frFzH%mk=hDzY2^s#GIu diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.multiVersionWithRemoval.3 b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.multiVersionWithRemoval.3 index f8a77054703c2a53b92506918766efe1f7c73876..c1dcb85ab809850fa86c4efbc57ab4bfcb907f05 100644 GIT binary patch delta 157 zcmZ3%2aGBp{ArE%K-pN3n_d6 delta 157 zcmZ3&~VG3fvRW#%=0o8pl y2B~8?Ai%zmF=-)lW?qTwLPi4zM<lXV!SL6j$> dwAj%k29^T?>9eqoqJ(c@l`cZ44wQ3owF&ChIUtgD6i% dX|V&h7+4MnurFjxS;(B3SK_*m(ZIpc2>?sl9=QMj diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.simpleOrderSwapDifferentType b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.simpleOrderSwapDifferentType index 2e6a7098f682d45036947aa23143678a6ab348b2..6d81269d3e1d392570390edef6cda5d01aa3b645 100644 GIT binary patch delta 104 zcmdnaw4F&HIlm|+k&%Icp#g{)jwVeMa1c70#K3gmA>)C2jBwGUTqdC0MPp;29LoU# o_Jxdz3z;+XN?aE*8aOyQ!PEie1c7o%3)zZGiZb)kT^)du0B1uVWB>pF delta 104 zcmdnaw4F&HIlm|+k&%Icp#g{)4&0h3;2?D176a3Phl~gAF~UWYa+!c~7mba9ax4b~ p*cUP;E@aNkD{)=OXyD-J1XBl;69md7Eo3V$Day=CcXa?t0ssY6A{GDu diff --git a/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.simpleOrderSwapSameType b/node-api/src/test/resources/net/corda/nodeapi/internal/serialization/amqp/EvolvabilityTests.simpleOrderSwapSameType index 6e04f4bdf329090688724dc39dab89427dbdae27..b96b0ce60ecd349703faf4b3e207ec9d54d41f87 100644 GIT binary patch delta 81 zcmZ3-w2nz2Ilm|+k&%Icp#g{)jwVeMuoXI*#K3gmHsgUCjBwHT3?`u5Nn;TCPf84^ Yg5`h!`$EQ~h0K|GC9Vq@4ICVu0QR;S+yDRo delta 81 zcmZ3-w2nz2Ilm|+k&%Icp#g{)4&0h3U@LUs76a3P+l&WpFv3OSGnjyKCyhbmKPfSw Z3YG%`> Date: Thu, 19 Oct 2017 12:06:00 +0100 Subject: [PATCH 2/3] CORDA-725 - update changelog --- docs/source/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index e043e0c398..c652b586a5 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -63,6 +63,8 @@ UNRELEASED * A new function ``checkCommandVisibility(publicKey: PublicKey)`` has been added to ``FilteredTransaction`` to check if every command that a signer should receive (e.g. an Oracle) is indeed visible. +* Change the AMQP serialiser to use the oficially assigned R3 identifier rather than a placeholder + .. _changelog_v1: Release 1.0 From e6de0aa406ce8399728bc1df0eac739ff4955478 Mon Sep 17 00:00:00 2001 From: Katelyn Baker Date: Thu, 19 Oct 2017 13:05:09 +0100 Subject: [PATCH 3/3] Review Comments --- docs/source/changelog.rst | 2 +- .../net/corda/nodeapi/internal/serialization/amqp/Schema.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index c652b586a5..bb2bce8461 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -63,7 +63,7 @@ UNRELEASED * A new function ``checkCommandVisibility(publicKey: PublicKey)`` has been added to ``FilteredTransaction`` to check if every command that a signer should receive (e.g. an Oracle) is indeed visible. -* Change the AMQP serialiser to use the oficially assigned R3 identifier rather than a placeholder +* Change the AMQP serialiser to use the oficially assigned R3 identifier rather than a placeholder. .. _changelog_v1: diff --git a/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/Schema.kt b/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/Schema.kt index d3d767c4eb..cfb505ab6c 100644 --- a/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/Schema.kt +++ b/node-api/src/main/kotlin/net/corda/nodeapi/internal/serialization/amqp/Schema.kt @@ -21,7 +21,7 @@ import net.corda.nodeapi.internal.serialization.carpenter.Schema as CarpenterSch /** * R3 AMQP assigned enterprise number * - * see [https://www.iana.org/assignments/enterprise-numbers/enterprise-numbers] + * see [here](https://www.iana.org/assignments/enterprise-numbers/enterprise-numbers) * * Repeated here for brevity: * 50530 - R3 - Mike Hearn - mike&r3.com