diff --git a/serialization/src/test/kotlin/net/corda/serialization/internal/amqp/EvolvabilityTests.kt b/serialization/src/test/kotlin/net/corda/serialization/internal/amqp/EvolvabilityTests.kt index 4c4d4c43a1..9514a65626 100644 --- a/serialization/src/test/kotlin/net/corda/serialization/internal/amqp/EvolvabilityTests.kt +++ b/serialization/src/test/kotlin/net/corda/serialization/internal/amqp/EvolvabilityTests.kt @@ -637,6 +637,45 @@ class EvolvabilityTests { assertEquals(DUMMY_NOTARY_PARTY, networkParams.notaries.firstOrNull()?.identity) } + // + // This test uses a NetworkParameters signed set of bytes generated by a Corda 4.11 build and + // is here to ensure we can still read them. This test exists because Corda 4.11 Adds in new + // network parameters that should be backwards compatible with older corda versions + // + // The file itself was generated from a corda-os 4.11 build at commit + // 58ecce1 Ent-9875: New Network Parameters + // + // To regenerate the file un-ignore the test below this one (regenerate broken network parameters), + // to regenerate at a specific version add that test to a checkout at the desired sha then take + // the resulting file and add to the repo, changing the filename as appropriate + // + @Test(timeout=300_000) + fun `read corda 4-11 network parameters`() { + val sf = testDefaultFactory() + sf.register(net.corda.serialization.internal.amqp.custom.InstantSerializer(sf)) + sf.register(net.corda.serialization.internal.amqp.custom.PublicKeySerializer) + sf.register(net.corda.serialization.internal.amqp.custom.DurationSerializer(sf)) + + // + // filename breakdown + // networkParams - because this is a serialised set of network parameters + // r3corda - generated by Corda Enterprise instead of Corda + // 6a6b6f256 - Commit sha of the build that generated the file we're testing against + // + val resource = "networkParams.4.11.58ecce1" + + val url = EvolvabilityTests::class.java.getResource(resource) + val sc2 = url.readBytes() + val deserializedC = DeserializationInput(sf).deserialize(SerializedBytes>(sc2)) + val networkParams = DeserializationInput(sf).deserialize(deserializedC.raw) + + assertEquals(1000, networkParams.maxMessageSize) + assertEquals(1000, networkParams.maxTransactionSize) + assertEquals(3, networkParams.minimumPlatformVersion) + assertEquals(1, networkParams.notaries.size) + assertEquals(DUMMY_NOTARY_PARTY, networkParams.notaries.firstOrNull()?.identity) + } + // // This test created a serialized and signed set of Network Parameters to test whether we // can still deserialize them diff --git a/serialization/src/test/resources/net/corda/serialization/internal/amqp/networkParams.4.11.58ecce1 b/serialization/src/test/resources/net/corda/serialization/internal/amqp/networkParams.4.11.58ecce1 new file mode 100644 index 0000000000..fa7ea435df Binary files /dev/null and b/serialization/src/test/resources/net/corda/serialization/internal/amqp/networkParams.4.11.58ecce1 differ