Skip to content

Commit

Permalink
Version bump to Corda 4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMatthewLayton committed Apr 18, 2022
1 parent 2f76b53 commit c977bd0
Show file tree
Hide file tree
Showing 29 changed files with 747 additions and 112 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
max_line_length = 140
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {

corda_artifactory_url = 'https://software.r3.com/artifactory'
corda_group = 'net.corda'
corda_release_version = '4.8'
corda_release_version = '4.9'

corda_gradle_plugin_group = 'net.corda.plugins'
corda_gradle_plugin_version = '5.0.4'
Expand All @@ -14,10 +14,10 @@ buildscript {
junit_version = '5.3.1'

onixlabs_group = 'io.onixlabs'
onixlabs_corda_core_release_version = '4.0.0-rc3'
onixlabs_corda_idfx_release_version = '4.0.0-rc5'
onixlabs_corda_core_release_version = '4.0.1'
onixlabs_corda_idfx_release_version = '4.0.1'

cordapp_platform_version = 10
cordapp_platform_version = 11
cordapp_contract_name = 'ONIXLabs Corda BNMS Contract'
cordapp_workflow_name = 'ONIXLabs Corda BNMS Workflow'
cordapp_vendor_name = 'ONIXLabs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class ConfigurationBuilder(private val settings: MutableSet<Setting<*>>) {
*
* @return Returns a configuration containing the settings built by this configuration builder.
*/
fun toConfiguration(): Configuration {
internal fun toConfiguration(): Configuration {
return Configuration(settings)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,7 @@ data class Membership(
* @return Returns a persistent state entity.
*/
override fun generateMappedObject(schema: MappedSchema): PersistentState = when (schema) {
is MembershipSchemaV1 -> MembershipEntity(
linearId = linearId.id,
externalId = linearId.externalId,
holder = holder,
networkValue = network.value,
normalizedNetworkValue = network.normalizedValue,
networkOperator = network.operator,
networkHash = network.hash.toString(),
isNetworkOperator = isNetworkOperator,
hash = hash.toString()
)
is MembershipSchemaV1 -> MembershipEntity(this)
else -> throw IllegalArgumentException("Unrecognised schema: $schema.")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ class MembershipAttestation internal constructor(
previousStateRef
), NetworkState {

/**
* Represents a membership attestation; a proof that a particular [Membership] state has been witnessed.
*
* @param attestor The party who is attesting to the witnessed [Membership] state.
* @param membership The [Membership] state that is being witnessed and attested.
* @param status The status of the attestation.
* @param metadata Additional information about the attestation.
* @param linearId The unique identifier of the attestation.
* @param previousStateRef The state reference of the previous state in the chain.
*
* The primary constructor of the [MembershipAttestation] class is deliberately private
* to enforce static attestation pointers via the secondary constructor.
*/
constructor(
attestor: AbstractParty,
membership: StateAndRef<Membership>,
Expand All @@ -79,7 +92,7 @@ class MembershipAttestation internal constructor(
membership.state.data.network,
attestor,
setOf(membership.state.data.holder),
membership.toStaticAttestationPointer(identifier = membership.state.data.linearId.toString()),
membership.toStaticAttestationPointer(),
status,
metadata,
linearId,
Expand Down Expand Up @@ -126,22 +139,7 @@ class MembershipAttestation internal constructor(
* @return Returns a persistent state entity.
*/
override fun generateMappedObject(schema: MappedSchema): PersistentState = when (schema) {
is MembershipAttestationSchemaV1 -> MembershipAttestationEntity(
linearId = linearId.id,
externalId = linearId.externalId,
attestor = attestor,
holder = holder,
networkValue = network.value,
normalizedNetworkValue = network.normalizedValue,
networkOperator = network.operator,
networkHash = network.hash.toString(),
pointer = pointer.statePointer.toString(),
pointerStateType = pointer.stateType.canonicalName,
pointerHash = pointer.hash.toString(),
status = status,
previousStateRef = previousStateRef?.toString(),
hash = hash.toString()
)
is MembershipAttestationSchemaV1 -> MembershipAttestationEntity(this)
else -> super.generateMappedObject(schema)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,22 @@ object MembershipAttestationSchema {

@Column(name = "hash", nullable = false, unique = true)
val hash: String = ""
) : PersistentState()
) : PersistentState() {
constructor(attestation: MembershipAttestation) : this(
linearId = attestation.linearId.id,
externalId = attestation.linearId.externalId,
attestor = attestation.attestor,
holder = attestation.holder,
networkValue = attestation.network.value,
normalizedNetworkValue = attestation.network.normalizedValue,
networkOperator = attestation.network.operator,
networkHash = attestation.network.hash.toString(),
pointer = attestation.pointer.statePointer.toString(),
pointerStateType = attestation.pointer.stateType.canonicalName,
pointerHash = attestation.pointer.hash.toString(),
status = attestation.status,
previousStateRef = attestation.previousStateRef?.toString(),
hash = attestation.hash.toString()
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,17 @@ object MembershipSchema {

@Column(name = "hash", nullable = false, unique = true)
val hash: String = ""
) : PersistentState()
) : PersistentState() {
constructor(membership: Membership) : this(
linearId = membership.linearId.id,
externalId = membership.linearId.externalId,
holder = membership.holder,
networkValue = membership.network.value,
normalizedNetworkValue = membership.network.normalizedValue,
networkOperator = membership.network.operator,
networkHash = membership.network.hash.toString(),
isNetworkOperator = membership.isNetworkOperator,
hash = membership.hash.toString()
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,7 @@ data class Relationship(
* @return Returns a persistent state entity.
*/
override fun generateMappedObject(schema: MappedSchema): PersistentState = when (schema) {
is RelationshipSchemaV1 -> RelationshipEntity(
linearId = linearId.id,
externalId = linearId.externalId,
networkValue = network.value,
normalizedNetworkValue = network.normalizedValue,
networkOperator = network.operator,
networkHash = network.hash.toString(),
hash = hash.toString()
)
is RelationshipSchemaV1 -> RelationshipEntity(this)
else -> throw IllegalArgumentException("Unrecognised schema: $schema.")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package io.onixlabs.corda.bnms.contract.relationship

import io.onixlabs.corda.bnms.contract.Network
import io.onixlabs.corda.bnms.contract.NetworkState
import io.onixlabs.corda.bnms.contract.membership.Membership
import io.onixlabs.corda.bnms.contract.relationship.RelationshipAttestationSchema.RelationshipAttestationEntity
import io.onixlabs.corda.bnms.contract.relationship.RelationshipAttestationSchema.RelationshipAttestationSchemaV1
import io.onixlabs.corda.identityframework.contract.attestations.Attestation
Expand All @@ -32,6 +33,20 @@ import net.corda.core.identity.AbstractParty
import net.corda.core.schemas.MappedSchema
import net.corda.core.schemas.PersistentState

/**
* Represents a relationship attestation; a proof that a particular [Relationship] state has been witnessed.
*
* @property network The business network that this relationship attestation belongs to.
* @property attestor The party who is attesting to the witnessed [Relationship] state.
* @property attestees The parties of this attestation, usually the participants of the attested [Relationship] state.
* @property pointer The pointer to the attested [Relationship] state.
* @property status The status of the attestation.
* @property metadata Additional information about the attestation.
* @property linearId The unique identifier of the attestation.
* @property previousStateRef The state reference of the previous state in the chain.
* @property hash The unique hash which represents this attestation.
* @property participants The participants of this attestation; namely the attestor and attestees.
*/
@BelongsToContract(RelationshipAttestationContract::class)
class RelationshipAttestation internal constructor(
override val network: Network,
Expand Down Expand Up @@ -89,21 +104,7 @@ class RelationshipAttestation internal constructor(
}

override fun generateMappedObject(schema: MappedSchema): PersistentState = when (schema) {
is RelationshipAttestationSchemaV1 -> RelationshipAttestationEntity(
linearId = linearId.id,
externalId = linearId.externalId,
attestor = attestor,
networkValue = network.value,
normalizedNetworkValue = network.normalizedValue,
networkOperator = network.operator,
networkHash = network.hash.toString(),
pointer = pointer.statePointer.toString(),
pointerStateType = pointer.stateType.canonicalName,
pointerHash = pointer.hash.toString(),
status = status,
previousStateRef = previousStateRef?.toString(),
hash = hash.toString()
)
is RelationshipAttestationSchemaV1 -> RelationshipAttestationEntity(this)
else -> super.generateMappedObject(schema)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,21 @@ object RelationshipAttestationSchema {

@Column(name = "hash", nullable = false, unique = true)
val hash: String = ""
) : PersistentState()
) : PersistentState() {
constructor(attestation: RelationshipAttestation) : this(
linearId = attestation.linearId.id,
externalId = attestation.linearId.externalId,
attestor = attestation.attestor,
networkValue = attestation.network.value,
normalizedNetworkValue = attestation.network.normalizedValue,
networkOperator = attestation.network.operator,
networkHash = attestation.network.hash.toString(),
pointer = attestation.pointer.statePointer.toString(),
pointerStateType = attestation.pointer.stateType.canonicalName,
pointerHash = attestation.pointer.hash.toString(),
status = attestation.status,
previousStateRef = attestation.previousStateRef?.toString(),
hash = attestation.hash.toString()
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,7 @@ class RelationshipConfiguration private constructor(
get() = SecureHash.sha256("${configuration.hash}$relationshipLinearId")

override fun generateMappedObject(schema: MappedSchema) = when (schema) {
is RelationshipConfigurationSchemaV1 -> RelationshipConfigurationEntity(
linearId = linearId.id,
externalId = linearId.externalId,
relationshipLinearId = relationshipLinearId.id,
relationshipExternalId = relationshipLinearId.externalId,
networkValue = network.value,
networkOperator = network.operator,
networkHash = network.hash.toString(),
configurationHash = configuration.hash.toString(),
hash = hash.toString()
)
is RelationshipConfigurationSchemaV1 -> RelationshipConfigurationEntity(this)
else -> throw IllegalArgumentException("Unrecognised schema: $schema.")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ object RelationshipConfigurationSchema {
@Column(name = "network_value", nullable = false)
val networkValue: String = "",

@Column(name = "normalized_network_value", nullable = false)
val normalizedNetworkValue: String = "",

@Column(name = "network_operator", nullable = true)
val networkOperator: AbstractParty? = null,

Expand All @@ -60,5 +63,18 @@ object RelationshipConfigurationSchema {

@Column(name = "hash", nullable = false)
val hash: String = ""
) : PersistentState()
) : PersistentState() {
constructor(configuration: RelationshipConfiguration) : this(
linearId = configuration.linearId.id,
externalId = configuration.linearId.externalId,
relationshipLinearId = configuration.relationshipLinearId.id,
relationshipExternalId = configuration.relationshipLinearId.externalId,
networkValue = configuration.network.value,
normalizedNetworkValue = configuration.network.normalizedValue,
networkOperator = configuration.network.operator,
networkHash = configuration.network.hash.toString(),
configurationHash = configuration.configuration.hash.toString(),
hash = configuration.hash.toString()
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,15 @@ object RelationshipSchema {

@Column(name = "hash", nullable = false, unique = true)
val hash: String = ""
) : PersistentState()
) : PersistentState() {
constructor(relationship: Relationship) : this(
linearId = relationship.linearId.id,
externalId = relationship.linearId.externalId,
networkValue = relationship.network.value,
normalizedNetworkValue = relationship.network.normalizedValue,
networkOperator = relationship.network.operator,
networkHash = relationship.network.hash.toString(),
hash = relationship.hash.toString()
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ data class RevocationLock<T : LinearState>(
}

override fun generateMappedObject(schema: MappedSchema): PersistentState = when (schema) {
is RevocationLockSchemaV1 -> RevocationLockEntity(
owner = owner,
pointerStateLinearId = pointer.pointer.id,
pointerStateExternalId = pointer.pointer.externalId,
pointerStateClass = pointer.type.canonicalName
)
is RevocationLockSchemaV1 -> RevocationLockEntity(this)
else -> throw IllegalArgumentException("Unrecognised schema: $schema.")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,12 @@ object RevocationLockSchema {

@Column(name = "pointer_state_class", nullable = false)
val pointerStateClass: String = ""
) : PersistentState()
}
) : PersistentState() {
constructor(revocationLock: RevocationLock<*>) : this(
owner = revocationLock.owner,
pointerStateLinearId = revocationLock.pointer.pointer.id,
pointerStateExternalId = revocationLock.pointer.pointer.externalId,
pointerStateClass = revocationLock.pointer.type.canonicalName
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<column name="network_value" type="nvarchar(255)">
<constraints nullable="false"/>
</column>
<column name="normalized_network_value" type="nvarchar(255)">
<constraints nullable="false"/>
</column>
<column name="network_operator" type="nvarchar(255)"/>
<column name="network_hash" type="nvarchar(64)">
<constraints nullable="false"/>
Expand All @@ -36,4 +39,4 @@
constraintName="PK_relationship_configuration_states"
tableName="relationship_configuration_states"/>
</changeSet>
</databaseChangeLog>
</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ abstract class ContractTest {
@BeforeEach
private fun setup() {
val networkParameters = testNetworkParameters(
minimumPlatformVersion = 5,
minimumPlatformVersion = 11,
notaries = listOf(NotaryInfo(TestIdentity(DUMMY_NOTARY_NAME, 20).party, true))
)
_services = MockServices(cordapps, IDENTITY_A, networkParameters, IDENTITY_B, IDENTITY_C)
Expand Down
Loading

0 comments on commit c977bd0

Please sign in to comment.