Skip to content

Commit c977bd0

Browse files
Version bump to Corda 4.9
1 parent 2f76b53 commit c977bd0

29 files changed

+747
-112
lines changed

.editorconfig

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
max_line_length = 140

build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55

66
corda_artifactory_url = 'https://software.r3.com/artifactory'
77
corda_group = 'net.corda'
8-
corda_release_version = '4.8'
8+
corda_release_version = '4.9'
99

1010
corda_gradle_plugin_group = 'net.corda.plugins'
1111
corda_gradle_plugin_version = '5.0.4'
@@ -14,10 +14,10 @@ buildscript {
1414
junit_version = '5.3.1'
1515

1616
onixlabs_group = 'io.onixlabs'
17-
onixlabs_corda_core_release_version = '4.0.0-rc3'
18-
onixlabs_corda_idfx_release_version = '4.0.0-rc5'
17+
onixlabs_corda_core_release_version = '4.0.1'
18+
onixlabs_corda_idfx_release_version = '4.0.1'
1919

20-
cordapp_platform_version = 10
20+
cordapp_platform_version = 11
2121
cordapp_contract_name = 'ONIXLabs Corda BNMS Contract'
2222
cordapp_workflow_name = 'ONIXLabs Corda BNMS Workflow'
2323
cordapp_vendor_name = 'ONIXLabs'

onixlabs-corda-bnms-contract/src/main/kotlin/io/onixlabs/corda/bnms/contract/ConfigurationBuilder.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class ConfigurationBuilder(private val settings: MutableSet<Setting<*>>) {
196196
*
197197
* @return Returns a configuration containing the settings built by this configuration builder.
198198
*/
199-
fun toConfiguration(): Configuration {
199+
internal fun toConfiguration(): Configuration {
200200
return Configuration(settings)
201201
}
202202
}

onixlabs-corda-bnms-contract/src/main/kotlin/io/onixlabs/corda/bnms/contract/membership/Membership.kt

+1-11
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,7 @@ data class Membership(
9292
* @return Returns a persistent state entity.
9393
*/
9494
override fun generateMappedObject(schema: MappedSchema): PersistentState = when (schema) {
95-
is MembershipSchemaV1 -> MembershipEntity(
96-
linearId = linearId.id,
97-
externalId = linearId.externalId,
98-
holder = holder,
99-
networkValue = network.value,
100-
normalizedNetworkValue = network.normalizedValue,
101-
networkOperator = network.operator,
102-
networkHash = network.hash.toString(),
103-
isNetworkOperator = isNetworkOperator,
104-
hash = hash.toString()
105-
)
95+
is MembershipSchemaV1 -> MembershipEntity(this)
10696
else -> throw IllegalArgumentException("Unrecognised schema: $schema.")
10797
}
10898

onixlabs-corda-bnms-contract/src/main/kotlin/io/onixlabs/corda/bnms/contract/membership/MembershipAttestation.kt

+15-17
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,19 @@ class MembershipAttestation internal constructor(
6868
previousStateRef
6969
), NetworkState {
7070

71+
/**
72+
* Represents a membership attestation; a proof that a particular [Membership] state has been witnessed.
73+
*
74+
* @param attestor The party who is attesting to the witnessed [Membership] state.
75+
* @param membership The [Membership] state that is being witnessed and attested.
76+
* @param status The status of the attestation.
77+
* @param metadata Additional information about the attestation.
78+
* @param linearId The unique identifier of the attestation.
79+
* @param previousStateRef The state reference of the previous state in the chain.
80+
*
81+
* The primary constructor of the [MembershipAttestation] class is deliberately private
82+
* to enforce static attestation pointers via the secondary constructor.
83+
*/
7184
constructor(
7285
attestor: AbstractParty,
7386
membership: StateAndRef<Membership>,
@@ -79,7 +92,7 @@ class MembershipAttestation internal constructor(
7992
membership.state.data.network,
8093
attestor,
8194
setOf(membership.state.data.holder),
82-
membership.toStaticAttestationPointer(identifier = membership.state.data.linearId.toString()),
95+
membership.toStaticAttestationPointer(),
8396
status,
8497
metadata,
8598
linearId,
@@ -126,22 +139,7 @@ class MembershipAttestation internal constructor(
126139
* @return Returns a persistent state entity.
127140
*/
128141
override fun generateMappedObject(schema: MappedSchema): PersistentState = when (schema) {
129-
is MembershipAttestationSchemaV1 -> MembershipAttestationEntity(
130-
linearId = linearId.id,
131-
externalId = linearId.externalId,
132-
attestor = attestor,
133-
holder = holder,
134-
networkValue = network.value,
135-
normalizedNetworkValue = network.normalizedValue,
136-
networkOperator = network.operator,
137-
networkHash = network.hash.toString(),
138-
pointer = pointer.statePointer.toString(),
139-
pointerStateType = pointer.stateType.canonicalName,
140-
pointerHash = pointer.hash.toString(),
141-
status = status,
142-
previousStateRef = previousStateRef?.toString(),
143-
hash = hash.toString()
144-
)
142+
is MembershipAttestationSchemaV1 -> MembershipAttestationEntity(this)
145143
else -> super.generateMappedObject(schema)
146144
}
147145

onixlabs-corda-bnms-contract/src/main/kotlin/io/onixlabs/corda/bnms/contract/membership/MembershipAttestationSchema.kt

+18-1
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,22 @@ object MembershipAttestationSchema {
7676

7777
@Column(name = "hash", nullable = false, unique = true)
7878
val hash: String = ""
79-
) : PersistentState()
79+
) : PersistentState() {
80+
constructor(attestation: MembershipAttestation) : this(
81+
linearId = attestation.linearId.id,
82+
externalId = attestation.linearId.externalId,
83+
attestor = attestation.attestor,
84+
holder = attestation.holder,
85+
networkValue = attestation.network.value,
86+
normalizedNetworkValue = attestation.network.normalizedValue,
87+
networkOperator = attestation.network.operator,
88+
networkHash = attestation.network.hash.toString(),
89+
pointer = attestation.pointer.statePointer.toString(),
90+
pointerStateType = attestation.pointer.stateType.canonicalName,
91+
pointerHash = attestation.pointer.hash.toString(),
92+
status = attestation.status,
93+
previousStateRef = attestation.previousStateRef?.toString(),
94+
hash = attestation.hash.toString()
95+
)
96+
}
8097
}

onixlabs-corda-bnms-contract/src/main/kotlin/io/onixlabs/corda/bnms/contract/membership/MembershipSchema.kt

+13-1
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,17 @@ object MembershipSchema {
6161

6262
@Column(name = "hash", nullable = false, unique = true)
6363
val hash: String = ""
64-
) : PersistentState()
64+
) : PersistentState() {
65+
constructor(membership: Membership) : this(
66+
linearId = membership.linearId.id,
67+
externalId = membership.linearId.externalId,
68+
holder = membership.holder,
69+
networkValue = membership.network.value,
70+
normalizedNetworkValue = membership.network.normalizedValue,
71+
networkOperator = membership.network.operator,
72+
networkHash = membership.network.hash.toString(),
73+
isNetworkOperator = membership.isNetworkOperator,
74+
hash = membership.hash.toString()
75+
)
76+
}
6577
}

onixlabs-corda-bnms-contract/src/main/kotlin/io/onixlabs/corda/bnms/contract/relationship/Relationship.kt

+1-9
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,7 @@ data class Relationship(
9494
* @return Returns a persistent state entity.
9595
*/
9696
override fun generateMappedObject(schema: MappedSchema): PersistentState = when (schema) {
97-
is RelationshipSchemaV1 -> RelationshipEntity(
98-
linearId = linearId.id,
99-
externalId = linearId.externalId,
100-
networkValue = network.value,
101-
normalizedNetworkValue = network.normalizedValue,
102-
networkOperator = network.operator,
103-
networkHash = network.hash.toString(),
104-
hash = hash.toString()
105-
)
97+
is RelationshipSchemaV1 -> RelationshipEntity(this)
10698
else -> throw IllegalArgumentException("Unrecognised schema: $schema.")
10799
}
108100

onixlabs-corda-bnms-contract/src/main/kotlin/io/onixlabs/corda/bnms/contract/relationship/RelationshipAttestation.kt

+16-15
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package io.onixlabs.corda.bnms.contract.relationship
1818

1919
import io.onixlabs.corda.bnms.contract.Network
2020
import io.onixlabs.corda.bnms.contract.NetworkState
21+
import io.onixlabs.corda.bnms.contract.membership.Membership
2122
import io.onixlabs.corda.bnms.contract.relationship.RelationshipAttestationSchema.RelationshipAttestationEntity
2223
import io.onixlabs.corda.bnms.contract.relationship.RelationshipAttestationSchema.RelationshipAttestationSchemaV1
2324
import io.onixlabs.corda.identityframework.contract.attestations.Attestation
@@ -32,6 +33,20 @@ import net.corda.core.identity.AbstractParty
3233
import net.corda.core.schemas.MappedSchema
3334
import net.corda.core.schemas.PersistentState
3435

36+
/**
37+
* Represents a relationship attestation; a proof that a particular [Relationship] state has been witnessed.
38+
*
39+
* @property network The business network that this relationship attestation belongs to.
40+
* @property attestor The party who is attesting to the witnessed [Relationship] state.
41+
* @property attestees The parties of this attestation, usually the participants of the attested [Relationship] state.
42+
* @property pointer The pointer to the attested [Relationship] state.
43+
* @property status The status of the attestation.
44+
* @property metadata Additional information about the attestation.
45+
* @property linearId The unique identifier of the attestation.
46+
* @property previousStateRef The state reference of the previous state in the chain.
47+
* @property hash The unique hash which represents this attestation.
48+
* @property participants The participants of this attestation; namely the attestor and attestees.
49+
*/
3550
@BelongsToContract(RelationshipAttestationContract::class)
3651
class RelationshipAttestation internal constructor(
3752
override val network: Network,
@@ -89,21 +104,7 @@ class RelationshipAttestation internal constructor(
89104
}
90105

91106
override fun generateMappedObject(schema: MappedSchema): PersistentState = when (schema) {
92-
is RelationshipAttestationSchemaV1 -> RelationshipAttestationEntity(
93-
linearId = linearId.id,
94-
externalId = linearId.externalId,
95-
attestor = attestor,
96-
networkValue = network.value,
97-
normalizedNetworkValue = network.normalizedValue,
98-
networkOperator = network.operator,
99-
networkHash = network.hash.toString(),
100-
pointer = pointer.statePointer.toString(),
101-
pointerStateType = pointer.stateType.canonicalName,
102-
pointerHash = pointer.hash.toString(),
103-
status = status,
104-
previousStateRef = previousStateRef?.toString(),
105-
hash = hash.toString()
106-
)
107+
is RelationshipAttestationSchemaV1 -> RelationshipAttestationEntity(this)
107108
else -> super.generateMappedObject(schema)
108109
}
109110

onixlabs-corda-bnms-contract/src/main/kotlin/io/onixlabs/corda/bnms/contract/relationship/RelationshipAttestationSchema.kt

+17-1
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,21 @@ object RelationshipAttestationSchema {
7373

7474
@Column(name = "hash", nullable = false, unique = true)
7575
val hash: String = ""
76-
) : PersistentState()
76+
) : PersistentState() {
77+
constructor(attestation: RelationshipAttestation) : this(
78+
linearId = attestation.linearId.id,
79+
externalId = attestation.linearId.externalId,
80+
attestor = attestation.attestor,
81+
networkValue = attestation.network.value,
82+
normalizedNetworkValue = attestation.network.normalizedValue,
83+
networkOperator = attestation.network.operator,
84+
networkHash = attestation.network.hash.toString(),
85+
pointer = attestation.pointer.statePointer.toString(),
86+
pointerStateType = attestation.pointer.stateType.canonicalName,
87+
pointerHash = attestation.pointer.hash.toString(),
88+
status = attestation.status,
89+
previousStateRef = attestation.previousStateRef?.toString(),
90+
hash = attestation.hash.toString()
91+
)
92+
}
7793
}

onixlabs-corda-bnms-contract/src/main/kotlin/io/onixlabs/corda/bnms/contract/relationship/RelationshipConfiguration.kt

+1-11
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,7 @@ class RelationshipConfiguration private constructor(
5757
get() = SecureHash.sha256("${configuration.hash}$relationshipLinearId")
5858

5959
override fun generateMappedObject(schema: MappedSchema) = when (schema) {
60-
is RelationshipConfigurationSchemaV1 -> RelationshipConfigurationEntity(
61-
linearId = linearId.id,
62-
externalId = linearId.externalId,
63-
relationshipLinearId = relationshipLinearId.id,
64-
relationshipExternalId = relationshipLinearId.externalId,
65-
networkValue = network.value,
66-
networkOperator = network.operator,
67-
networkHash = network.hash.toString(),
68-
configurationHash = configuration.hash.toString(),
69-
hash = hash.toString()
70-
)
60+
is RelationshipConfigurationSchemaV1 -> RelationshipConfigurationEntity(this)
7161
else -> throw IllegalArgumentException("Unrecognised schema: $schema.")
7262
}
7363

onixlabs-corda-bnms-contract/src/main/kotlin/io/onixlabs/corda/bnms/contract/relationship/RelationshipConfigurationSchema.kt

+17-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ object RelationshipConfigurationSchema {
4949
@Column(name = "network_value", nullable = false)
5050
val networkValue: String = "",
5151

52+
@Column(name = "normalized_network_value", nullable = false)
53+
val normalizedNetworkValue: String = "",
54+
5255
@Column(name = "network_operator", nullable = true)
5356
val networkOperator: AbstractParty? = null,
5457

@@ -60,5 +63,18 @@ object RelationshipConfigurationSchema {
6063

6164
@Column(name = "hash", nullable = false)
6265
val hash: String = ""
63-
) : PersistentState()
66+
) : PersistentState() {
67+
constructor(configuration: RelationshipConfiguration) : this(
68+
linearId = configuration.linearId.id,
69+
externalId = configuration.linearId.externalId,
70+
relationshipLinearId = configuration.relationshipLinearId.id,
71+
relationshipExternalId = configuration.relationshipLinearId.externalId,
72+
networkValue = configuration.network.value,
73+
normalizedNetworkValue = configuration.network.normalizedValue,
74+
networkOperator = configuration.network.operator,
75+
networkHash = configuration.network.hash.toString(),
76+
configurationHash = configuration.configuration.hash.toString(),
77+
hash = configuration.hash.toString()
78+
)
79+
}
6480
}

onixlabs-corda-bnms-contract/src/main/kotlin/io/onixlabs/corda/bnms/contract/relationship/RelationshipSchema.kt

+11-1
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,15 @@ object RelationshipSchema {
5454

5555
@Column(name = "hash", nullable = false, unique = true)
5656
val hash: String = ""
57-
) : PersistentState()
57+
) : PersistentState() {
58+
constructor(relationship: Relationship) : this(
59+
linearId = relationship.linearId.id,
60+
externalId = relationship.linearId.externalId,
61+
networkValue = relationship.network.value,
62+
normalizedNetworkValue = relationship.network.normalizedValue,
63+
networkOperator = relationship.network.operator,
64+
networkHash = relationship.network.hash.toString(),
65+
hash = relationship.hash.toString()
66+
)
67+
}
5868
}

onixlabs-corda-bnms-contract/src/main/kotlin/io/onixlabs/corda/bnms/contract/revocation/RevocationLock.kt

+1-6
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ data class RevocationLock<T : LinearState>(
4040
}
4141

4242
override fun generateMappedObject(schema: MappedSchema): PersistentState = when (schema) {
43-
is RevocationLockSchemaV1 -> RevocationLockEntity(
44-
owner = owner,
45-
pointerStateLinearId = pointer.pointer.id,
46-
pointerStateExternalId = pointer.pointer.externalId,
47-
pointerStateClass = pointer.type.canonicalName
48-
)
43+
is RevocationLockSchemaV1 -> RevocationLockEntity(this)
4944
else -> throw IllegalArgumentException("Unrecognised schema: $schema.")
5045
}
5146

onixlabs-corda-bnms-contract/src/main/kotlin/io/onixlabs/corda/bnms/contract/revocation/RevocationLockSchema.kt

+9-2
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,12 @@ object RevocationLockSchema {
4646

4747
@Column(name = "pointer_state_class", nullable = false)
4848
val pointerStateClass: String = ""
49-
) : PersistentState()
50-
}
49+
) : PersistentState() {
50+
constructor(revocationLock: RevocationLock<*>) : this(
51+
owner = revocationLock.owner,
52+
pointerStateLinearId = revocationLock.pointer.pointer.id,
53+
pointerStateExternalId = revocationLock.pointer.pointer.externalId,
54+
pointerStateClass = revocationLock.pointer.type.canonicalName
55+
)
56+
}
57+
}

onixlabs-corda-bnms-contract/src/main/resources/migration/relationship-configuration-schema.changelog-v1.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
<column name="network_value" type="nvarchar(255)">
2222
<constraints nullable="false"/>
2323
</column>
24+
<column name="normalized_network_value" type="nvarchar(255)">
25+
<constraints nullable="false"/>
26+
</column>
2427
<column name="network_operator" type="nvarchar(255)"/>
2528
<column name="network_hash" type="nvarchar(64)">
2629
<constraints nullable="false"/>
@@ -36,4 +39,4 @@
3639
constraintName="PK_relationship_configuration_states"
3740
tableName="relationship_configuration_states"/>
3841
</changeSet>
39-
</databaseChangeLog>
42+
</databaseChangeLog>

onixlabs-corda-bnms-contract/src/test/kotlin/io/onixlabs/corda/bnms/contract/ContractTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ abstract class ContractTest {
5555
@BeforeEach
5656
private fun setup() {
5757
val networkParameters = testNetworkParameters(
58-
minimumPlatformVersion = 5,
58+
minimumPlatformVersion = 11,
5959
notaries = listOf(NotaryInfo(TestIdentity(DUMMY_NOTARY_NAME, 20).party, true))
6060
)
6161
_services = MockServices(cordapps, IDENTITY_A, networkParameters, IDENTITY_B, IDENTITY_C)

0 commit comments

Comments
 (0)