Compare commits
No commits in common. "fc3092622c4c187373668b8834988e0b0aee5db9" and "3a9fb9b286f1f20ba233ebf65866642ba3337f0f" have entirely different histories.
fc3092622c
...
3a9fb9b286
4
.ci/Jenkinsfile
vendored
4
.ci/Jenkinsfile
vendored
@ -1,5 +1,5 @@
|
||||
@Library('corda-shared-build-pipeline-steps@5.1') _
|
||||
|
||||
@Library('corda-shared-build-pipeline-steps@5.0') _
|
||||
|
||||
cordaPipeline(
|
||||
nexusAppId: 'com.corda.CSDE-Java.5.0',
|
||||
publishRepoPrefix: '',
|
||||
|
@ -1,4 +1,4 @@
|
||||
@Library('corda-shared-build-pipeline-steps@5.1') _
|
||||
@Library('corda-shared-build-pipeline-steps@5.0') _
|
||||
|
||||
cordaSnykScanPipeline (
|
||||
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:
|
||||
- uses: morrisoncole/pr-lint-action@v1.6.1
|
||||
with:
|
||||
title-regex: '^((CORDA|EG|ENT|INFRA|CORE|ES)-\d+)(.*)'
|
||||
title-regex: '^((CORDA|EG|ENT|INFRA|CORE)-\d+)(.*)'
|
||||
on-failed-regex-comment: "PR title failed to match regex -> `%regex%`"
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
10
.snyk
10
.snyk
@ -9,6 +9,14 @@ ignore:
|
||||
temporary files (via Kotlin functions) with insecure permissions.
|
||||
Corda does not use any of the vulnerable functions so it is not
|
||||
susceptible to this vulnerability
|
||||
expires: 2023-10-19T17:15:26.836Z
|
||||
expires: 2023-06-19T17:15:26.836Z
|
||||
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: {}
|
||||
|
@ -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).
|
||||
|
||||
The CSDE is obtained by cloning this CSDE-Cordapp-Template-Java repository to your local machine. The CSDE provides:
|
||||
The CSDE is obtained by cloning this CSDE-Cordapp-Template-Java 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.
|
||||
|
||||
@ -19,7 +19,10 @@ The CSDE is obtained by cloning this CSDE-Cordapp-Template-Java repository to yo
|
||||
|
||||
- Ability to configure the Members of the Local Corda Network.
|
||||
|
||||
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/
|
||||
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 section in the Corda 5 Beta 2 documentation at https://docs.r3.com/
|
||||
|
||||
|
||||
|
||||
## Chat app
|
||||
|
17
build.gradle
17
build.gradle
@ -24,7 +24,6 @@ allprojects {
|
||||
notaryCpiName = "NotaryServer"
|
||||
cordaRpcUser = "admin"
|
||||
cordaRpcPasswd ="admin"
|
||||
workflowsModuleName = workflowsModule
|
||||
csdeWorkspaceDir = "workspace"
|
||||
notaryVersion = cordaNotaryPluginsVersion
|
||||
combinedWorkerVersion = combinedWorkerJarVersion
|
||||
@ -46,6 +45,22 @@ allprojects {
|
||||
// All dependencies are held in Maven Central
|
||||
mavenLocal()
|
||||
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 {
|
||||
|
@ -39,13 +39,19 @@ dependencies {
|
||||
// The CorDapp uses the slf4j logging framework. Corda-API provides this so we need a 'cordaProvided' declaration.
|
||||
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
|
||||
// Required
|
||||
testImplementation "org.slf4j:slf4j-simple:2.0.0"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
||||
|
||||
// Optional but used by example tests.
|
||||
// Optional but used by exmaple tests.
|
||||
testImplementation "org.mockito:mockito-core:$mockitoVersion"
|
||||
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
||||
testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion"
|
||||
|
@ -13,54 +13,37 @@ public class ChatContract implements Contract {
|
||||
|
||||
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 Update implements Command { }
|
||||
|
||||
@Override
|
||||
public void verify(UtxoLedgerTransaction transaction) {
|
||||
|
||||
requireThat( transaction.getCommands().size() == 1, REQUIRE_SINGLE_COMMAND);
|
||||
requireThat( transaction.getCommands().size() == 1, "Require a single command.");
|
||||
Command command = transaction.getCommands().get(0);
|
||||
|
||||
ChatState output = transaction.getOutputStates(ChatState.class).get(0);
|
||||
|
||||
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);
|
||||
requireThat(output.getParticipants().size() == 2, "The output state should have two and only two participants.");
|
||||
|
||||
if(command.getClass() == Create.class) {
|
||||
requireThat(transaction.getInputContractStates().isEmpty(), CREATE_COMMAND_SHOULD_HAVE_NO_INPUT_STATES);
|
||||
requireThat(transaction.getOutputContractStates().size() == 1, CREATE_COMMAND_SHOULD_HAVE_ONLY_ONE_OUTPUT_STATE);
|
||||
requireThat(transaction.getInputContractStates().isEmpty(), "When command is Create there should be no input states.");
|
||||
requireThat(transaction.getOutputContractStates().size() == 1, "When command is Create there should be one and only one output state.");
|
||||
}
|
||||
else if(command.getClass() == Update.class) {
|
||||
requireThat(transaction.getInputContractStates().size() == 1, UPDATE_COMMAND_SHOULD_HAVE_ONLY_ONE_INPUT_STATE);
|
||||
requireThat(transaction.getOutputContractStates().size() == 1, UPDATE_COMMAND_SHOULD_HAVE_ONLY_ONE_OUTPUT_STATE);
|
||||
requireThat(transaction.getInputContractStates().size() == 1, "When command is Update there should be one and only one input state.");
|
||||
requireThat(transaction.getOutputContractStates().size() == 1, "When command is Update there should be one and only one output state.");
|
||||
|
||||
ChatState input = transaction.getInputStates(ChatState.class).get(0);
|
||||
requireThat(input.getId().equals(output.getId()), UPDATE_COMMAND_ID_SHOULD_NOT_CHANGE);
|
||||
requireThat(input.getChatName().equals(output.getChatName()), UPDATE_COMMAND_CHATNAME_SHOULD_NOT_CHANGE);
|
||||
requireThat(input.getId().equals(output.getId()), "When command is Update id must not change.");
|
||||
requireThat(input.getChatName().equals(output.getChatName()), "When command is Update chatName must not change.");
|
||||
requireThat(
|
||||
input.getParticipants().containsAll(output.getParticipants()) &&
|
||||
output.getParticipants().containsAll(input.getParticipants()),
|
||||
UPDATE_COMMAND_PARTICIPANTS_SHOULD_NOT_CHANGE);
|
||||
"When command is Update participants must not change.");
|
||||
}
|
||||
else {
|
||||
throw new CordaRuntimeException(UNKNOWN_COMMAND);
|
||||
throw new CordaRuntimeException("Unsupported command");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,23 +2,20 @@ kotlin.code.style=official
|
||||
|
||||
# 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.
|
||||
cordaApiVersion=5.0.0.765
|
||||
cordaApiVersion=5.0.0.763-GA-RC04
|
||||
|
||||
# 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.
|
||||
cordaNotaryPluginsVersion=5.0.0.0
|
||||
cordaNotaryPluginsVersion=5.0.0.0-GA-RC04
|
||||
|
||||
# Specify the version of the Combined Worker to use
|
||||
combinedWorkerJarVersion=5.0.0.0
|
||||
combinedWorkerJarVersion=5.0.0.0-GA-RC04
|
||||
|
||||
# Specify the version of the cordapp-cpb and cordapp-cpk plugins
|
||||
cordaPluginsVersion=7.0.3
|
||||
|
||||
# Specify the version of the CSDE gradle plugin to use
|
||||
csdePluginVersion=1.1.0
|
||||
|
||||
# Specify the name of the workflows module
|
||||
workflowsModule=workflows
|
||||
csdePluginVersion=1.0.0-alpha-+
|
||||
|
||||
# For the time being this just needs to be set to a dummy value.
|
||||
platformVersion = 999
|
||||
@ -34,4 +31,9 @@ kotlin.stdlib.default.dependency=false
|
||||
junitVersion = 5.8.2
|
||||
mockitoKotlinVersion=4.0.0
|
||||
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,6 +4,16 @@ pluginManagement {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
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,
|
||||
|
@ -40,6 +40,12 @@ dependencies {
|
||||
// The CorDapp uses the slf4j logging framework. Corda-API provides this so we need a 'cordaProvided' declaration.
|
||||
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
|
||||
// Required
|
||||
testImplementation "org.slf4j:slf4j-simple:2.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user