Skip to content

Commit 5d4d3c6

Browse files
authored
Merge pull request #11 from mvdbos/cleanup/zkflow-publish
Always publish ZKFlow locally for sample
2 parents f176a59 + 8861b9c commit 5d4d3c6

File tree

12 files changed

+52
-136
lines changed

12 files changed

+52
-136
lines changed

.ci/azure-pipelines-scheduled.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ steps:
4747
publishJUnitResults: true
4848
testResultsFiles: '**/TEST-*.xml'
4949
# codeCoverageToolOption: JaCoCo # Broken because it expects hardcoded 'build.gradle' instead of 'build.gradle.kts'
50-
tasks: 'clean cleanTest check test testReport jacocoRootReport checkLicense'
50+
tasks: 'clean cleanTest check test testReport jacocoRootReport checkLicense spotBugsMain'
5151
options: '--no-build-cache --rerun-tasks --no-daemon --no-parallel'
5252
env:
5353
GITHUB_USERNAME: $(github.username)

.ci/azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ steps:
5555
jdkArchitectureOption: 'x64'
5656
publishJUnitResults: true
5757
testResultsFiles: '**/TEST-*.xml'
58-
tasks: 'clean cleanTest check test testReport jacocoRootReport checkLicense'
58+
tasks: 'clean cleanTest check test testReport jacocoRootReport checkLicense spotBugsMain'
5959
# options: '--stacktrace --info --build-cache'
6060
options: '--no-build-cache --rerun-tasks --no-daemon --no-parallel --stacktrace --info '
6161
env:

.github/workflows/on-push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
echo "$GITHUB_WORKSPACE/zinc-linux/" >> $GITHUB_PATH
5656
5757
- name: Build with Gradle
58-
run: ./gradlew clean cleanTest check test testReport jacocoRootReport checkLicense spotBugsMain publishToMavenLocal --no-build-cache --rerun-tasks --no-daemon --no-parallel --stacktrace --info
58+
run: ./gradlew clean cleanTest check test testReport jacocoRootReport checkLicense spotBugsMain --no-build-cache --rerun-tasks --no-daemon --no-parallel --stacktrace --info
5959
env:
6060
GITHUB_USERNAME: ${{ github.actor }}
6161
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/on-tag-publish.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/scheduled-all.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
echo "$GITHUB_WORKSPACE/zinc-linux/" >> $GITHUB_PATH
5656
5757
- name: Build with Gradle
58-
run: ./gradlew clean cleanTest check test testReport jacocoRootReport checkLicense spotBugsMain publishToMavenLocal --no-build-cache --rerun-tasks --no-daemon --no-parallel --stacktrace --info
58+
run: ./gradlew clean cleanTest check test testReport jacocoRootReport checkLicense spotBugsMain --no-build-cache --rerun-tasks --no-daemon --no-parallel --stacktrace --info
5959
env:
6060
GITHUB_USERNAME: ${{ github.actor }}
6161
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,47 @@ Features:
1919

2020
To learn more about ZKFlow internals, there is a [docs](docs) directory in this repo. In addition to the [ZKFLow white paper](docs/ZKFlow_whitepaper.pdf), it contains technical documentation in Markdown and PDF format. There is also plenty of documentation throughout the code itself, explaining logic or rationale. Finally, the many test cases will also explain a lot about expected behaviour.
2121

22-
## Testing ZKFlow with the sample CorDapp or with your own CorDapp
22+
## Running the sample ZKDapp
2323

24-
The ZKFlow jars are currently not deployed to one of the Maven/Gradle repositories. This means it can not be used directly by CorDapps. Instead, run the tests for ZKFlow and the `sample-zkdapp` to see it in action.
24+
The sample ZKDapp demonstrates how a basic token contract can be adapted to work with ZKFlow. The contract tests and flow tests show the expected behaviour.
2525

2626
Please make sure you have satisfied all [prerequisites](#prerequisites) before you execute the following:
2727

2828
```bash
29-
$ cd sample-zkdapp
29+
$ cd zkflow/sample-zkdapp
3030
$ ./gradlew test
3131
```
3232

33-
If you want to test ZKFlow with your own CorDapp, please do the following:
33+
## Running your own CorDapp with ZKFlow
3434

35-
* Copy you CorDapp to the zkflow project, similar to `sample-zkdapp`
36-
* Add `includeBuild("..")` to your `settings.gradle`. This will give your CorDapp access to undeployed ZKFlow artifacts
37-
* Enable the ZKFlow Gradle plugin on your CorDapp in your `build.gradle.kts`. Note that it needs no version because of `includeBuild("..")`:
35+
> [i] This assumes you use the Kotlin DSL for your Gradle build files. If you do not, change accordingly for the Groovy DSL. The changes should be identical except for syntax.
36+
37+
The ZKFlow jars are currently not deployed to one of the public Maven/Gradle repositories. If you want to test ZKFlow with your own CorDapp, please make the following changes to your build file:
38+
39+
* Make sure that ZKFlow is published to your local Maven repository by running `./gradlew publishToMavenLocal` in the ZKFlow directory.
40+
* Add the `mavenLocal()` repository to your repositories for Gradle plugins (probably in the `pluginManagement` block in your `settings.gradle.kts`) and to your repositories for normal Gradle dependencies in your `build.gradle.kts`.
41+
* Enable the ZKFlow Gradle plugin on your CorDapp in your `build.gradle.kts`.
3842

3943
```kotlin
4044
plugins {
41-
id("com.ing.zkflow.gradle-plugin")
45+
id("com.ing.zkflow.gradle-plugin") version "1.0-SNAPSHOT"
4246
}
4347
```
4448
* To be able to use ZKFlow's contract test DSL and other convenience functions, add `testImplementation("com.ing.zkflow:test-utils:1.0-SNAPSHOT")` to your `dependencies` block in `build.gradle.kts`.
45-
* Finally, adapt your contracts, states, commands, contract tests and flow tests to work with ZKFlow. You can inspect `sample-zkdapp` to see how you can make those adaptations. Please note that some significant changes to your state class definitions may be required.
49+
50+
Not you are ready to adapt your contracts, states, commands, contract tests and flow tests to work with ZKFlow. You can inspect `sample-zkdapp` to see how you can make those adaptations. Please note that some significant changes to your state class definitions may be required.
51+
52+
Not recommended, but feel free to run it immediately as-is and let ZKFlow tell you what should be added to your classes.
53+
54+
## Troubleshooting the sample ZKDapp or your own ZKDapp
55+
56+
Build issues:
57+
- `java.lang.IllegalArgumentException: Cannot find circuit manifest`: This should not happen during normal development flow, but it can be solved by running `./gradlew generateZincCircuits --rerun-tasks` in your ZKDapp.
4658
4759
## Running ZKFlow tests
4860
4961
If you want to make changes to ZKFlow itself, you need to be able to run its tests.
50-
This is as simple as running `./gradlew test` in the ZKFlow root directlty. It will run all tests, including integration tests.
62+
This is as simple as running `./gradlew test` in the ZKFlow root directly. It will run all tests, including integration tests.
5163
Please make sure you have satisfied all [prerequisites](#prerequisites) before running the tests.
5264
5365
## Prerequisites for running ZKFlow
@@ -71,26 +83,6 @@ $ cargo b --release
7183
7284
Built binaries will be stored in `./target/release`. Move the `zargo`, `znc` and `zvm` binaries to a directory you prefer and add it to your systems PATH. `/usr/local/bin` has been known to work. Then you can delete sources.
7385
74-
#### Zinc on internal Azure Pipelines
75-
76-
If you make changes to Zinc and create a new tag, please ensure that the [copy of the binaries](./.ci/lib/zinc-linux.tar.gz) in for Azure Pipelines is updated to be that version. Please note that these binaries should be compiled on/for linux, so they can run on the Azure Pipelines agents.
77-
78-
For GitHub Actions, this is not required, as that build automatically downloads and installs the correct Zinc binaries.
79-
80-
### Gradle
81-
82-
Typically, Gradle does not require any specific changes, but you might encounter the following error during the build (path can be different):
83-
84-
```bash
85-
Caused by: java.io.IOException: Cannot run program "zargo" (in directory "/Users/mq23re/Developer/zk-notary/prover/circuits/create"): error=2, No such file or directory
86-
```
87-
88-
To fix it, run the command below from the project directory. It will stop daemon, thus it will clear cache, which can help to resolve the issue.
89-
90-
```bash
91-
./gradlew --stop
92-
```
93-
9486
## Contributing to ZKFlow
9587
9688
If you want to make changes to ZKFlow, great! We welcome pull requests at any time. If you decide to create a PR, please keep the [contributing guidelines](CONTRIBUTING.md) in mind.

bin/pre-push-checks

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fi
3636

3737
fail_all_if_failed \
3838
"Build with Gradle" \
39-
"./gradlew $clean check test testReport jacocoRootReport checkLicense spotBugsMain publishToMavenLocal --stacktrace"
39+
"./gradlew $clean check test testReport jacocoRootReport checkLicense spotBugsMain --stacktrace --info"
4040

4141
fail_all_if_failed \
4242
"sample-zkdapp - Build with Gradle" \

sample-zkdapp/bin/run_issuer_for_rpc.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This script assumes that ./gradlew deployNodes was run first.
2+
13
cd build/nodes/Issuer || exit
24

35
nohup java -Dexperimental.corda.customSerializationScheme=com.ing.zkflow.common.serialization.BFLSerializationScheme \

sample-zkdapp/bin/run_notary_for_rpc.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This script assumes that ./gradlew deployNodes was run first.
2+
13
cd build/nodes/ZKNotary || exit
24

35
nohup java -Dexperimental.corda.customSerializationScheme=com.ing.zkflow.common.serialization.BFLSerializationScheme \

sample-zkdapp/build.gradle.kts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
buildscript {
2+
// Please note that this is only required because the ZKFlow artifacts are currently not published to a public maven repository.
3+
// For that reason, we always ensure that the latest version of ZKFlow is published locally before running the CorDapp build.
4+
println("ENSURING LATEST ZKFLOW IS PUBLISHED TO LOCAL MAVEN REPOSITORY...")
5+
exec {
6+
workingDir = projectDir.parentFile
7+
executable = "./gradlew"
8+
args("publishToMavenLocal")
9+
}
10+
211
extra.apply{
312
set("corda_release_version", "4.8.5")
413
}
@@ -113,4 +122,15 @@ tasks.register<net.corda.plugins.Cordform>("deployNodes") {
113122
}
114123
rpcUsers = listOf(mapOf( Pair("user", "user1"), Pair("password", "test"), Pair("permissions", listOf("ALL"))))
115124
}
116-
}
125+
}
126+
127+
// tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>() {
128+
// doFirst {
129+
// println("ENSURING LATEST ZKFLOW IS PUBLISHED TO LOCAL MAVEN REPOSITORY...")
130+
// exec {
131+
// workingDir = projectDir.parentFile
132+
// executable = "./gradlew"
133+
// args("publishToMavenLocal")
134+
// }
135+
// }
136+
// }

sample-zkdapp/config/test/log4j2.xml

Lines changed: 0 additions & 42 deletions
This file was deleted.

sample-zkdapp/config/test/logging-test.properties

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)