corda/samples/irs-demo
Arshad Mahmood 6dd33fb8f7 Upgrade to gradle 7.6, kotlin 1.8 and jdk 17
Major changes due to JDK 17:
1. JDK17 JCE Provider now has built-in support for eddsas, corda uses
   the bouncycastle (i2p) implementation. This PR removes the conflicting
   algorithms from the built-in JCE provider.

2. JavaScript scripting has been removed from the JDK, the corda log4j config was using
   scripting to conditionally output additional diagnostic info if the MDC
   was populated. This PR has removed the scripting.

3. The artifactory plug-ins used are now deprecated, this PR has removed them
   and uses the same code as Corda 5 for publishing to artifactory.

4. Javadoc generation has been modified to use the latest dokka plug-ins.

5. Gradle 7.6 has implemented an incredibly annoying change where transitive
   dependencies are not put on the compile classpath, so that they have to be
   explicitly added as dependencies to projects.

6. Mockito has been updated, which sadly meant that quite a few source files
   have to changes to use the new (org.mockito.kotlin) package name. This makes
   this PR appear much larger than it is.

7. A number of tests have been marked as ignored to get a green, broadly they fall
   into 3 classes.

   The first is related to crypto keypair tests, it appears some logic
   in the JDK prefers to use the SunJCE implementation and we prefer to use
   bouncycastle. I believe this issue can be fixed with better test setup.

   The second group is related to our use of a method called "uncheckedCast(..)",
   the purpose of this method was to get rid of the annoying unchecked cast compiler
   warning that would otherwise exist. It looks like the Kotlin 1.9 compiler type
   inference differs and at runtime sometimes the type it infers is "Void" which causes
   an exception at runtime. The simplest solution is to use an explicit cast instead of
   unchecked cast, Corda 5 have removed unchecked cast from their codebase.

   The third class are a number of ActiveMQ tests which appear to have a memory leak somewhere.
2023-11-06 10:24:17 +00:00
..
cordapp Upgrade to gradle 7.6, kotlin 1.8 and jdk 17 2023-11-06 10:24:17 +00:00
src NOTICK: Merging forward updates from OS 4.5 to OS 4.6 (2021/07/19) 2021-07-19 22:07:31 +02:00
web Upgrade to gradle 7.6, kotlin 1.8 and jdk 17 2023-11-06 10:24:17 +00:00
build.gradle Upgrade to gradle 7.6, kotlin 1.8 and jdk 17 2023-11-06 10:24:17 +00:00
README.md Minor docs fix (#4675) 2019-01-29 13:10:07 +00:00

IRS Demo

This demo brings up three nodes: Bank A, Bank B and a node that simultaneously runs a notary, a network map and an interest rates oracle. The two banks agree on an interest rate swap, and then do regular fixings of the deal as the time on a simulated clock passes.

Functionality is split into two parts - CordApp which provides actual distributed ledger backend and Spring Boot webapp which provides REST API and web frontend. Application communicate using Corda RPC protocol.

To run from the command line in Unix:

  1. Run ./gradlew samples:irs-demo:cordapp:deployNodes to install configs and a command line tool under samples/irs-demo/cordapp/build
  2. Run ./gradlew samples:irs-demo:web:deployWebapps to install configs and tools for running webservers
  3. Move to the samples/irs-demo/ directory
  4. Run ./cordapp/build/nodes/runnodes to open up three new terminals with the three nodes (you may have to install xterm)
  5. On Linux, run ./web/build/webapps/runwebapps.sh to open three more terminals for associated webservers. On macOS, use the following command instead: osascript ./web/build/webapps/runwebapps.scpt

To run from the command line in Windows:

  1. Run gradlew.bat samples:irs-demo:cordapp:deployNodes to install configs and a command line tool under samples\irs-demo\build
  2. Run gradlew.bat samples:irs-demo:web:deployWebapps to install configs and tools for running webservers
  3. Run cd samples\irs-demo to change current working directory
  4. Run cordapp\build\nodes\runnodes.bat to open up several 3 terminals for each nodes
  5. Run web\build\webapps\runwebapps.bat to open up several 3 terminals for each nodes' webservers

This demo also has a web app. To use this, run nodes and then navigate to http://localhost:10007/ and http://localhost:10010/ to see each node's view of the ledger.

To use the web app, click the "Create Deal" button, fill in the form, then click the "Submit" button. You can then use the time controls at the top left of the home page to run the fixings. Click any individual trade in the blotter to view it.

Note: The IRS web UI currently has a bug when changing the clock time where it may show no numbers or apply fixings inconsistently. The issues will be addressed in a future release. Meanwhile, you can take a look at a simpler oracle example here: https://github.com/corda/oracle-example.

Running the system test

The system test utilizes Docker. The amount of RAM required to run the IRS system test is around 2.5GB, so it is important to make sure the appropriate system resources are allocated (On MacOS/Windows this may require explicit changes to your Docker configuration).

Gradle

The system test is designed to exercise the entire stack, including Corda nodes and the web frontend. It uses Docker, docker-compose, and PhantomJS. Docker and docker-compose need to be installed and configured to on the system path (which happens by default). The PhantomJs binary has to be put in a known location and needs execution permissions enabled (chmod a+x phantomjs on *nix) and the full path to the binary needs to be available as system property named phantomjs.binary.path or an environment variable named PHANTOMJS_BINARY_PATH.

To start the test, run :samples:irs-demo:systemTest.

Other

In order to run the test by other means than the Gradle task - two more environment variables are expected - CORDAPP_DOCKER_COMPOSE and WEB_DOCKER_COMPOSE which should specify the full path for the docker-compose files for the IRS cordapp and web frontend respectively. Those can be obtained by running the :samples:irs-demo:cordapp:prepareDockerNodes and web:generateDockerCompose Gradle tasks. The :samples:irs-demo:systemTest Gradle task simply executes these two tasks and sets up the correct environment variables.