From c69a11d771dc02f0c55f7f2e3279a68b84961dae Mon Sep 17 00:00:00 2001 From: Edoardo Ierina Date: Fri, 1 Dec 2023 21:22:21 +0000 Subject: [PATCH] update README files Signed-off-by: Edoardo Ierina --- src/r3/atomic-swap/corda/README.md | 78 ++++++++++++++++++------------ src/r3/atomic-swap/evm/README.md | 4 +- 2 files changed, 49 insertions(+), 33 deletions(-) diff --git a/src/r3/atomic-swap/corda/README.md b/src/r3/atomic-swap/corda/README.md index ec0cc55..7698de2 100644 --- a/src/r3/atomic-swap/corda/README.md +++ b/src/r3/atomic-swap/corda/README.md @@ -46,9 +46,25 @@ The EVM interface, implemented as a Corda service, has a very simplistic and inc ### Tests and Test Network Integration tests rely on a local Hardhat node instance running and initialized with a deployment script that deploys the required contracts. This implies that accounts, keys, and addresses used by the integration tests are hardcoded in a base class used by all the tests. -## Integration Tests +#### Manual Test Network Setup +Please refer to the EVM project's README.md for instructions in this regard before executing any Corda project test. +#### Docker Test Network Setup +The Corda project has Gradle tasks meant to start a Docker container with the test network ready for executing the integration tests included in the projects. -The integration tests in this project are currently hardcoded to a locally set up test EVM instance. Please refer to the EVM project's C for instructions in this regard before executing any Corda project test. +You can either start the docker instance by explicitly executing +``` +./gradlew startDockerContainer +``` +or passing the useDockerTestnet as a property to your gradle build or test commands, as +``` +./gradlew build -PuseDockerTestnet +``` +or +``` +./gradlew test -PuseDockerTestnet +``` + +You must have a recent Docker version installed on your machine. ## Build and Run ### Prerequisites @@ -56,51 +72,51 @@ The integration tests in this project are currently hardcoded to a locally set u This project requires and has been tested with the following tools: - gradle - version v5.6.4 -- node.js - version v16.19.0 (our recommended installer is NVM available [here](https://github.com/nvm-sh/nvm)) -- npm - version v9.7.1 (comes with node.js) -- npx - version v9.7.1 (to install npx enter `npm install -g npx`) - +- if planning to setup the test network manually + - node.js - version v16.19.0 (our recommended installer is NVM available [here](https://github.com/nvm-sh/nvm)) + - npm - version v9.7.1 (comes with node.js) + - npx - version v9.7.1 (to install npx enter `npm install -g npx`) +- if planning to use the docker container to run the dockerized test network + - Docker Desktop (tested with version 4.25.2) -### Building and Deploying the Project +### Building the Project #### Build To build the Corda project, enter the following command from the root folder: -``` -./gradlew build -x test -``` - -or - ``` +./gradlew build -x test +``` +or +``` ./gradlew build +``` +if you have manually prepared the EVM test environment, or ``` - -if you have manually prepared the EVM test environment. - -#### Deploy - -Plain and Dockerized deployment is under development +./gradlew build -PuseDockerTestnet +``` +if you want to use Docker and have Docker installed on your machine. ### Testing -To run the tests you need to set up the test environment first. +#### Manual Test Network Setup -To set up the test environment proceed as follows: -- change directory to ../evm and open two terminals to that directory -- on the first terminal run `npm install` and wait for the required packages to be installed - this step is required once. -- again on the first terminal run `npx hardhat node` - it will print a number of accounts and will start printing block numbers in the form `Mined empty block range #m to #n` -- on the second terminal, once the first the hardhat node is running, enter `npx hardhat run deploy.js --network localhost` and wait for the shell prompt to return (without errors) +To run the tests you need to set up the test environment first, refer to the [Integration Tests / Test Network Setup Section in the EVM Project's README.md](../evm/README.md#integration-tests--test-network-setup). Once you have setup the network manually, from the Corda project root enter: -If you followed the steps above correctly, on the second terminal you will see the following output: +``` +./gradlew test +``` -Gold Tethered (GLDT) Token deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
-Silver Tethered (SLVT) Token deployed to: 0xc6e7DF5E7b4f2A278906862b61205850344D4e7d
-SwapVault deployed to: 0x70e0bA845a1A0F2DA3359C97E0285013525FFC49
+#### Automated Test Network Setup -The test environment is now ready and you can enter the following command: +Start the tests using the Gradle property useDockerTestnet: +``` +./gradlew test -PuseDockerTestnet +``` -``` +Optionally start the network using Gradle and then run the tests: +``` +./gradlew startDockerContainer ./gradlew test ``` diff --git a/src/r3/atomic-swap/evm/README.md b/src/r3/atomic-swap/evm/README.md index 7ad8b84..4e277b0 100644 --- a/src/r3/atomic-swap/evm/README.md +++ b/src/r3/atomic-swap/evm/README.md @@ -50,8 +50,8 @@ To run the Corda integration tests you need to set up the EVM test environment f To set up the test environment proceed as follows: - open two terminals in the root directory of the EVM project -- on the first terminal run `npm install` and wait for the required packages to be installed - this step is required once. -- again on the first terminal run `npx hardhat node` - it will print a number of accounts and will start printing block numbers in the form `Mined empty block range #m to #n` +- on the first terminal run `forge install && npm install` and wait for the required packages to be installed - this step is required once. +- again on the first terminal run `npx hardhat node` - it will print a number of default accounts - on the second terminal, once the first the hardhat node is running, enter `npx hardhat run deploy.js --network localhost` and wait for the shell prompt to return (without errors) If you followed the steps above correctly, on the second terminal you will see the following output: