Compare commits
10 Commits
3a9fb9b286
...
fc3092622c
Author | SHA1 | Date | |
---|---|---|---|
|
fc3092622c | ||
|
15f1043a39 | ||
|
bb380544d6 | ||
|
0adc8292d5 | ||
|
20e3dd38b3 | ||
|
7b3144001d | ||
|
98a12b2825 | ||
|
a7592dde96 | ||
|
dce1f36199 | ||
|
abe04744df |
2
.ci/Jenkinsfile
vendored
2
.ci/Jenkinsfile
vendored
@ -1,4 +1,4 @@
|
|||||||
@Library('corda-shared-build-pipeline-steps@5.0') _
|
@Library('corda-shared-build-pipeline-steps@5.1') _
|
||||||
|
|
||||||
cordaPipeline(
|
cordaPipeline(
|
||||||
nexusAppId: 'com.corda.CSDE-Java.5.0',
|
nexusAppId: 'com.corda.CSDE-Java.5.0',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
@Library('corda-shared-build-pipeline-steps@5.0') _
|
@Library('corda-shared-build-pipeline-steps@5.1') _
|
||||||
|
|
||||||
cordaSnykScanPipeline (
|
cordaSnykScanPipeline (
|
||||||
snykTokenId: 'r3-snyk-corda5',
|
snykTokenId: 'r3-snyk-corda5',
|
||||||
|
2
.github/workflows/check-pr-title.yaml
vendored
2
.github/workflows/check-pr-title.yaml
vendored
@ -9,6 +9,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: morrisoncole/pr-lint-action@v1.6.1
|
- uses: morrisoncole/pr-lint-action@v1.6.1
|
||||||
with:
|
with:
|
||||||
title-regex: '^((CORDA|EG|ENT|INFRA|CORE)-\d+)(.*)'
|
title-regex: '^((CORDA|EG|ENT|INFRA|CORE|ES)-\d+)(.*)'
|
||||||
on-failed-regex-comment: "PR title failed to match regex -> `%regex%`"
|
on-failed-regex-comment: "PR title failed to match regex -> `%regex%`"
|
||||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
10
.snyk
10
.snyk
@ -9,14 +9,6 @@ ignore:
|
|||||||
temporary files (via Kotlin functions) with insecure permissions.
|
temporary files (via Kotlin functions) with insecure permissions.
|
||||||
Corda does not use any of the vulnerable functions so it is not
|
Corda does not use any of the vulnerable functions so it is not
|
||||||
susceptible to this vulnerability
|
susceptible to this vulnerability
|
||||||
expires: 2023-06-19T17:15:26.836Z
|
expires: 2023-10-19T17:15:26.836Z
|
||||||
created: 2023-02-02T17:15:26.839Z
|
created: 2023-02-02T17:15:26.839Z
|
||||||
SNYK-JAVA-ORGJETBRAINSKOTLIN-2628385:
|
|
||||||
- '*':
|
|
||||||
reason: >-
|
|
||||||
corda-simulator-runtime is a testRuntimeOnly dependency, as such this
|
|
||||||
dependency will not be included in any cordaApp produced by the CSDE
|
|
||||||
project Template
|
|
||||||
expires: 2023-06-19T17:16:00.009Z
|
|
||||||
created: 2023-02-02T17:16:00.016Z
|
|
||||||
patch: {}
|
patch: {}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
To help make the process of prototyping CorDapps on Corda 5 more straight forward we have developed the Cordapp Standard Development Environment (CSDE).
|
To help make the process of prototyping CorDapps on Corda 5 more straight forward we have developed the Cordapp Standard Development Environment (CSDE).
|
||||||
|
|
||||||
The CSDE is obtained by cloning this CSDE-Cordapp-Template-Java to your local machine. The CSDE provides:
|
The CSDE is obtained by cloning this CSDE-Cordapp-Template-Java repository to your local machine. The CSDE provides:
|
||||||
|
|
||||||
- A pre-setup Cordapp Project which you can use as a starting point to develop your own prototypes.
|
- A pre-setup Cordapp Project which you can use as a starting point to develop your own prototypes.
|
||||||
|
|
||||||
@ -19,10 +19,7 @@ The CSDE is obtained by cloning this CSDE-Cordapp-Template-Java to your local ma
|
|||||||
|
|
||||||
- Ability to configure the Members of the Local Corda Network.
|
- Ability to configure the Members of the Local Corda Network.
|
||||||
|
|
||||||
Note, the CSDE is experimental, we may or may not release it as part of Corda 5.0, in part based on developer feedback using it.
|
To find out how to use the CSDE, please refer to the *Getting Started Using the CSDE* subsection within the *Developing Applications* section in the latest Corda 5 documentation at https://docs.r3.com/
|
||||||
|
|
||||||
To find out how to use the CSDE please refer to the getting started section in the Corda 5 Beta 2 documentation at https://docs.r3.com/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Chat app
|
## Chat app
|
||||||
|
17
build.gradle
17
build.gradle
@ -24,6 +24,7 @@ allprojects {
|
|||||||
notaryCpiName = "NotaryServer"
|
notaryCpiName = "NotaryServer"
|
||||||
cordaRpcUser = "admin"
|
cordaRpcUser = "admin"
|
||||||
cordaRpcPasswd ="admin"
|
cordaRpcPasswd ="admin"
|
||||||
|
workflowsModuleName = workflowsModule
|
||||||
csdeWorkspaceDir = "workspace"
|
csdeWorkspaceDir = "workspace"
|
||||||
notaryVersion = cordaNotaryPluginsVersion
|
notaryVersion = cordaNotaryPluginsVersion
|
||||||
combinedWorkerVersion = combinedWorkerJarVersion
|
combinedWorkerVersion = combinedWorkerJarVersion
|
||||||
@ -45,22 +46,6 @@ allprojects {
|
|||||||
// All dependencies are held in Maven Central
|
// All dependencies are held in Maven Central
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
||||||
// R3 Internal repositories for dev
|
|
||||||
// Repository provides Corda 5 binaries that implement Corda-API.
|
|
||||||
// These will be made publicly available.
|
|
||||||
// Final location to be decided.
|
|
||||||
// Repository subject to change
|
|
||||||
maven {
|
|
||||||
url = "$artifactoryContextUrl/corda-os-maven"
|
|
||||||
authentication {
|
|
||||||
basic(BasicAuthentication)
|
|
||||||
}
|
|
||||||
credentials {
|
|
||||||
username = findProperty('cordaArtifactoryUsername') ?: System.getenv('CORDA_ARTIFACTORY_USERNAME')
|
|
||||||
password = findProperty('cordaArtifactoryPassword') ?: System.getenv('CORDA_ARTIFACTORY_PASSWORD')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(Test).configureEach {
|
tasks.withType(Test).configureEach {
|
||||||
|
@ -39,19 +39,13 @@ dependencies {
|
|||||||
// The CorDapp uses the slf4j logging framework. Corda-API provides this so we need a 'cordaProvided' declaration.
|
// The CorDapp uses the slf4j logging framework. Corda-API provides this so we need a 'cordaProvided' declaration.
|
||||||
cordaProvided 'org.slf4j:slf4j-api'
|
cordaProvided 'org.slf4j:slf4j-api'
|
||||||
|
|
||||||
// This are shared so should be here.
|
|
||||||
// Dependencies Required By Test Tooling
|
|
||||||
// Todo: these are commented out as the simulator UTXO work has not been merged into Gecko yet.
|
|
||||||
// testImplementation "net.corda:corda-simulator-api:$simulatorVersion"
|
|
||||||
// testRuntimeOnly "net.corda:corda-simulator-runtime:$simulatorVersion"
|
|
||||||
|
|
||||||
// 3rd party libraries
|
// 3rd party libraries
|
||||||
// Required
|
// Required
|
||||||
testImplementation "org.slf4j:slf4j-simple:2.0.0"
|
testImplementation "org.slf4j:slf4j-simple:2.0.0"
|
||||||
testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion"
|
testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion"
|
||||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
||||||
|
|
||||||
// Optional but used by exmaple tests.
|
// Optional but used by example tests.
|
||||||
testImplementation "org.mockito:mockito-core:$mockitoVersion"
|
testImplementation "org.mockito:mockito-core:$mockitoVersion"
|
||||||
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
||||||
testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion"
|
testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion"
|
||||||
|
@ -13,37 +13,54 @@ public class ChatContract implements Contract {
|
|||||||
|
|
||||||
private final static Logger log = LoggerFactory.getLogger(ChatContract.class);
|
private final static Logger log = LoggerFactory.getLogger(ChatContract.class);
|
||||||
|
|
||||||
|
// Use constants to hold the error messages
|
||||||
|
// This allows the tests to use them, meaning if they are updated you won't need to fix tests just because the wording was updated
|
||||||
|
static final String REQUIRE_SINGLE_COMMAND = "Require a single command.";
|
||||||
|
static final String UNKNOWN_COMMAND = "Unsupported command";
|
||||||
|
static final String OUTPUT_STATE_SHOULD_ONLY_HAVE_TWO_PARTICIPANTS = "The output state should have two and only two participants.";
|
||||||
|
static final String TRANSACTION_SHOULD_BE_SIGNED_BY_ALL_PARTICIPANTS = "The transaction should have been signed by both participants.";
|
||||||
|
|
||||||
|
static final String CREATE_COMMAND_SHOULD_HAVE_NO_INPUT_STATES = "When command is Create there should be no input states.";
|
||||||
|
static final String CREATE_COMMAND_SHOULD_HAVE_ONLY_ONE_OUTPUT_STATE = "When command is Create there should be one and only one output state.";
|
||||||
|
|
||||||
|
static final String UPDATE_COMMAND_SHOULD_HAVE_ONLY_ONE_INPUT_STATE = "When command is Update there should be one and only one input state.";
|
||||||
|
static final String UPDATE_COMMAND_SHOULD_HAVE_ONLY_ONE_OUTPUT_STATE = "When command is Update there should be one and only one output state.";
|
||||||
|
static final String UPDATE_COMMAND_ID_SHOULD_NOT_CHANGE = "When command is Update id must not change.";
|
||||||
|
static final String UPDATE_COMMAND_CHATNAME_SHOULD_NOT_CHANGE = "When command is Update chatName must not change.";
|
||||||
|
static final String UPDATE_COMMAND_PARTICIPANTS_SHOULD_NOT_CHANGE = "When command is Update participants must not change.";
|
||||||
|
|
||||||
public static class Create implements Command { }
|
public static class Create implements Command { }
|
||||||
public static class Update implements Command { }
|
public static class Update implements Command { }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void verify(UtxoLedgerTransaction transaction) {
|
public void verify(UtxoLedgerTransaction transaction) {
|
||||||
|
|
||||||
requireThat( transaction.getCommands().size() == 1, "Require a single command.");
|
requireThat( transaction.getCommands().size() == 1, REQUIRE_SINGLE_COMMAND);
|
||||||
Command command = transaction.getCommands().get(0);
|
Command command = transaction.getCommands().get(0);
|
||||||
|
|
||||||
ChatState output = transaction.getOutputStates(ChatState.class).get(0);
|
ChatState output = transaction.getOutputStates(ChatState.class).get(0);
|
||||||
|
|
||||||
requireThat(output.getParticipants().size() == 2, "The output state should have two and only two participants.");
|
requireThat(output.getParticipants().size() == 2, OUTPUT_STATE_SHOULD_ONLY_HAVE_TWO_PARTICIPANTS);
|
||||||
|
requireThat(transaction.getSignatories().containsAll(output.getParticipants()), TRANSACTION_SHOULD_BE_SIGNED_BY_ALL_PARTICIPANTS);
|
||||||
|
|
||||||
if(command.getClass() == Create.class) {
|
if(command.getClass() == Create.class) {
|
||||||
requireThat(transaction.getInputContractStates().isEmpty(), "When command is Create there should be no input states.");
|
requireThat(transaction.getInputContractStates().isEmpty(), CREATE_COMMAND_SHOULD_HAVE_NO_INPUT_STATES);
|
||||||
requireThat(transaction.getOutputContractStates().size() == 1, "When command is Create there should be one and only one output state.");
|
requireThat(transaction.getOutputContractStates().size() == 1, CREATE_COMMAND_SHOULD_HAVE_ONLY_ONE_OUTPUT_STATE);
|
||||||
}
|
}
|
||||||
else if(command.getClass() == Update.class) {
|
else if(command.getClass() == Update.class) {
|
||||||
requireThat(transaction.getInputContractStates().size() == 1, "When command is Update there should be one and only one input state.");
|
requireThat(transaction.getInputContractStates().size() == 1, UPDATE_COMMAND_SHOULD_HAVE_ONLY_ONE_INPUT_STATE);
|
||||||
requireThat(transaction.getOutputContractStates().size() == 1, "When command is Update there should be one and only one output state.");
|
requireThat(transaction.getOutputContractStates().size() == 1, UPDATE_COMMAND_SHOULD_HAVE_ONLY_ONE_OUTPUT_STATE);
|
||||||
|
|
||||||
ChatState input = transaction.getInputStates(ChatState.class).get(0);
|
ChatState input = transaction.getInputStates(ChatState.class).get(0);
|
||||||
requireThat(input.getId().equals(output.getId()), "When command is Update id must not change.");
|
requireThat(input.getId().equals(output.getId()), UPDATE_COMMAND_ID_SHOULD_NOT_CHANGE);
|
||||||
requireThat(input.getChatName().equals(output.getChatName()), "When command is Update chatName must not change.");
|
requireThat(input.getChatName().equals(output.getChatName()), UPDATE_COMMAND_CHATNAME_SHOULD_NOT_CHANGE);
|
||||||
requireThat(
|
requireThat(
|
||||||
input.getParticipants().containsAll(output.getParticipants()) &&
|
input.getParticipants().containsAll(output.getParticipants()) &&
|
||||||
output.getParticipants().containsAll(input.getParticipants()),
|
output.getParticipants().containsAll(input.getParticipants()),
|
||||||
"When command is Update participants must not change.");
|
UPDATE_COMMAND_PARTICIPANTS_SHOULD_NOT_CHANGE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new CordaRuntimeException("Unsupported command");
|
throw new CordaRuntimeException(UNKNOWN_COMMAND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,20 +2,23 @@ kotlin.code.style=official
|
|||||||
|
|
||||||
# Specify the version of the Corda-API to use.
|
# Specify the version of the Corda-API to use.
|
||||||
# This needs to match the version supported by the Corda Cluster the CorDapp will run on.
|
# This needs to match the version supported by the Corda Cluster the CorDapp will run on.
|
||||||
cordaApiVersion=5.0.0.763-GA-RC04
|
cordaApiVersion=5.0.0.765
|
||||||
|
|
||||||
# Specify the version of the notary plugins to use.
|
# Specify the version of the notary plugins to use.
|
||||||
# Currently packaged as part of corda-runtime-os, so should be set to a corda-runtime-os version.
|
# Currently packaged as part of corda-runtime-os, so should be set to a corda-runtime-os version.
|
||||||
cordaNotaryPluginsVersion=5.0.0.0-GA-RC04
|
cordaNotaryPluginsVersion=5.0.0.0
|
||||||
|
|
||||||
# Specify the version of the Combined Worker to use
|
# Specify the version of the Combined Worker to use
|
||||||
combinedWorkerJarVersion=5.0.0.0-GA-RC04
|
combinedWorkerJarVersion=5.0.0.0
|
||||||
|
|
||||||
# Specify the version of the cordapp-cpb and cordapp-cpk plugins
|
# Specify the version of the cordapp-cpb and cordapp-cpk plugins
|
||||||
cordaPluginsVersion=7.0.3
|
cordaPluginsVersion=7.0.3
|
||||||
|
|
||||||
# Specify the version of the CSDE gradle plugin to use
|
# Specify the version of the CSDE gradle plugin to use
|
||||||
csdePluginVersion=1.0.0-alpha-+
|
csdePluginVersion=1.1.0
|
||||||
|
|
||||||
|
# Specify the name of the workflows module
|
||||||
|
workflowsModule=workflows
|
||||||
|
|
||||||
# For the time being this just needs to be set to a dummy value.
|
# For the time being this just needs to be set to a dummy value.
|
||||||
platformVersion = 999
|
platformVersion = 999
|
||||||
@ -32,8 +35,3 @@ junitVersion = 5.8.2
|
|||||||
mockitoKotlinVersion=4.0.0
|
mockitoKotlinVersion=4.0.0
|
||||||
mockitoVersion=4.6.1
|
mockitoVersion=4.6.1
|
||||||
hamcrestVersion=2.2
|
hamcrestVersion=2.2
|
||||||
|
|
||||||
|
|
||||||
# R3 internal repository
|
|
||||||
# Use this version when pointing to artefacts in artifactory that have not been published to S3
|
|
||||||
artifactoryContextUrl=https://software.r3.com/artifactory
|
|
||||||
|
@ -4,16 +4,6 @@ pluginManagement {
|
|||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
maven {
|
|
||||||
url = "$artifactoryContextUrl/corda-os-maven"
|
|
||||||
authentication {
|
|
||||||
basic(BasicAuthentication)
|
|
||||||
}
|
|
||||||
credentials {
|
|
||||||
username = settings.ext.find('cordaArtifactoryUsername') ?: System.getenv('CORDA_ARTIFACTORY_USERNAME')
|
|
||||||
password = settings.ext.find('cordaArtifactoryPassword') ?: System.getenv('CORDA_ARTIFACTORY_PASSWORD')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The plugin dependencies with versions of the plugins congruent with the specified CorDapp plugin version,
|
// The plugin dependencies with versions of the plugins congruent with the specified CorDapp plugin version,
|
||||||
|
@ -40,12 +40,6 @@ dependencies {
|
|||||||
// The CorDapp uses the slf4j logging framework. Corda-API provides this so we need a 'cordaProvided' declaration.
|
// The CorDapp uses the slf4j logging framework. Corda-API provides this so we need a 'cordaProvided' declaration.
|
||||||
cordaProvided 'org.slf4j:slf4j-api'
|
cordaProvided 'org.slf4j:slf4j-api'
|
||||||
|
|
||||||
// This are shared so should be here.
|
|
||||||
// Dependencies Required By Test Tooling
|
|
||||||
// Todo: these are commented out as the simulator UTXO work has not been merged into Gecko yet.
|
|
||||||
// testImplementation "net.corda:corda-simulator-api:$simulatorVersion"
|
|
||||||
// testRuntimeOnly "net.corda:corda-simulator-runtime:$simulatorVersion"
|
|
||||||
|
|
||||||
// 3rd party libraries
|
// 3rd party libraries
|
||||||
// Required
|
// Required
|
||||||
testImplementation "org.slf4j:slf4j-simple:2.0.0"
|
testImplementation "org.slf4j:slf4j-simple:2.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user