Skip to content

Commit

Permalink
update README files
Browse files Browse the repository at this point in the history
Signed-off-by: Edoardo Ierina <edoardo.ierina@r3.com>
  • Loading branch information
Edoardo Ierina committed Dec 1, 2023
1 parent 90bc91f commit c69a11d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 33 deletions.
78 changes: 47 additions & 31 deletions src/r3/atomic-swap/corda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,61 +46,77 @@ 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

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</br>
Silver Tethered (SLVT) Token deployed to: 0xc6e7DF5E7b4f2A278906862b61205850344D4e7d</br>
SwapVault deployed to: 0x70e0bA845a1A0F2DA3359C97E0285013525FFC49</br>
#### 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
```
4 changes: 2 additions & 2 deletions src/r3/atomic-swap/evm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c69a11d

Please sign in to comment.