Skip to content

Commit

Permalink
Merge pull request #30 from CMTA/prepare-release
Browse files Browse the repository at this point in the history
Prepare release
  • Loading branch information
rya-sge authored May 23, 2023
2 parents 4ad3cc7 + 691ae6a commit 53d1ffd
Show file tree
Hide file tree
Showing 59 changed files with 13,959 additions and 5,282 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ lib/
out/
cache/
.~lock.test.odt#
nethereum-gen.settings
nethereum-gen.settings
#hardhat
artifacts/
cache_hardhat/
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,43 @@

Please follow [https://changelog.md/](https://changelog.md/) conventions.

## 1.0.2 - 20230523

The release 1.0.2 contains mainly the different fixes and improvements related to the audit performed on the version 1.0.1.

**Documentation**

- Update the documentation for the release
- Add slither report
- Install hardhat in order to generic docgen documentation

**General modifications**

- Upgrade the library CMTAT to the latest version [2.3-Beta](https://github.com/CMTA/CMTAT/releases/tag/2.3-Beta) ([pull/28](https://github.com/CMTA/RuleEngine/pull/28))
- In RuleEngine, `ruleLength` is changed to `rulesCount()`
- Add the gasless suport / MetaTx module ([pull/27](https://github.com/CMTA/RuleEngine/pull/27))
- RuleWhitelist: update RuleWhitelist to use code from IEIP1404Wrapper ([pull/29](https://github.com/CMTA/RuleEngine/pull/29))

**Audit report**

This version also includes improvements suggested by the audit report, addressing the following findings:

General

- CVF-10: use a floating pragma for the version ([pull/25](https://github.com/CMTA/RuleEngine/pull/25))
- CVF2, CVF-6: remove the function kill for the contracts RuleEngine and Whitelist ([pull/17](https://github.com/CMTA/RuleEngine/pull/17))

RuleEngine

- CVF-1 / removeRule: add an additional argument with the rule index hint ([pull/23](https://github.com/CMTA/RuleEngine/pull/23))
- CVF-7, CVF-8, CVF-9: check for duplicate rule ([pull/20](https://github.com/CMTA/RuleEngine/pull/20))

Whitelist

- CVF-3: use a local variable for iterate inside a loop ([pull/18/](https://github.com/CMTA/RuleEngine/pull/18/))
- CVF-4, CVF-5: remove useless conditional statement ([pull/19/](https://github.com/CMTA/RuleEngine/pull/19/))
- CVF-15, CVF-16, CVF-17: improve readibility ([pull/24](https://github.com/CMTA/RuleEngine/pull/24))

## 1.0.1 - 20230122

- Update the library CMTAT to the version [2.2](https://github.com/CMTA/CMTAT/releases/tag/2.2)
Expand Down
85 changes: 52 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,45 @@ This repository includes the RuleEngine contract for the [CMTAT](https://github.

The CMTAT contracts and the OpenZeppelin library are included as a submodule of the present repository.

## Audit

The contracts have been audited by [ABDKConsulting](https://www.abdk.consulting/), a globally recognized firm specialized in smart contracts' security.

#### First Audit - March 2022

The first audit was performed by ABDK on the version [1.0.1](https://github.com/CMTA/RuleEngine/releases/tag/1.0.1).

The release 1.1 contains the different fixes and improvements related to this audit.

The temporary report is available in [Taurus. Audit 3.3. Collected Issues.ods](doc/audits/Taurus. Audit 3.3. Collected Issues.ods)

### Tools

You will find the report performed with [Slither](https://github.com/crytic/slither) in [slither-report.md](doc/audits/tools/slither-report.md)

## Documentation

Here a summary of the main documentation

| Document | Link/Files |
| ----------------------------------- | ---------------------------------------------------- |
| Solidity API Documentation (docgen) | [doc/solidityAPI](./doc/solidityAPI) |
| Technical documentation | [doc/technical.md](./doc/technical.md) |
| Toolchain | [doc/TOOLCHAIN.md](./doc/TOOLCHAIN.md) |
| Functionalities | [doc/functionalities.pdf](./doc/functionalities.pdf) |
| Surya report | [doc/surya](./doc/surya) |
| Test | [doc/test/test.pdf](./doc/test/test.pdf) |



## Usage

*Explain how it works.*


## Toolchain installation
The contracts are developed and tested with [Foundry](https://book.getfoundry.sh), a smart contract development toolchain.

To install the Foundry suite, please refer to the official instructions in the [Foundry book](https://book.getfoundry.sh/getting-started/installation).

## Initialization
Expand All @@ -34,7 +67,7 @@ See also the command's [documentation](https://book.getfoundry.sh/reference/forg


## Compilation
The official documentation is available here : [website](https://book.getfoundry.sh/reference/forge/build-commands)
The official documentation is available in the Foundry [website](https://book.getfoundry.sh/reference/forge/build-commands)
```
forge build --contracts src/RuleEngine.sol
```
Expand All @@ -60,7 +93,7 @@ See also the test framework's [official documentation](https://book.getfoundry.s
### Coverage
* Perform a code coverage
```
forge coverage --report lcov
forge coverage
```

* Generate LCOV report
Expand All @@ -71,7 +104,7 @@ forge coverage --report lcov
See [Solidity Coverage in VS Code with Foundry](https://mirror.xyz/devanon.eth/RrDvKPnlD-pmpuW7hQeR5wWdVjklrpOgPCOA-PJkWFU)

## Deployment
The official documentation is available here : [website](https://book.getfoundry.sh/reference/forge/deploy-commands)
The official documentation is available in the Foundry [website](https://book.getfoundry.sh/reference/forge/deploy-commands)
### Script
To run the script for deployment, you need to create a .env file. The value for CMTAT.ADDRESS is require only to use the script **RuleEngine.s.sol**
Warning : put your private key in a .env file is not the best secure way.
Expand All @@ -82,48 +115,34 @@ PRIVATE_KEY=<YOUR_PRIVATE_KEY>
CMTAT_ADDRESS=<CMTAT ADDDRESS
```
* Command

CMTAT with RuleEngine

```bash
forge script script/CMTATWithRuleEngineScript.s.sol:CMTATWithRuleEngineScript --rpc-url=$RPC_URL --broadcast --verify -vvv
```
forge script script/CMTATWithRuleEngine.s.sol:MyScript --rpc-url=<YOUR_RPC_URL> --broadcast --verify -vvv
Value of YOUR_RPC_URL with a local instance of anvil : [http://127.0.0.1:8545](http://127.0.0.1:8545)

Only RuleEngine with a Whitelist contract

```bash
forge script script/RuleEngineScript.s.sol:RuleEngineScript --rpc-url=$RPC_URL --broadcast --verify -vvv
```
Value of YOUR_RPC_URL with a local instance of anvil : http://127.0.0.1:8545

### Local
With Foundry, you [can create a local testnet](https://book.getfoundry.sh/reference/anvil/) node for deploying and testing smart contracts, based on the [Anvil](https://anvil.works/) framework.

On Linux, using the default RPC URL, and Anvil's test private key, run:

```
export RPC_URL=http://127.0.0.1:8545`
Example - Deploy the CMTAT, standalone version

``` bash
export RPC_URL=http://127.0.0.1:8545
export PRIVATE_KEY=<Local Private Key>
forge create CMTAT --rpc-url=$RPC_URL --private-key=$PRIVATE_KEY
forge create CMTAT_BASE --rpc-url=$RPC_URL --private-key=$PRIVATE_KEY --constructor-args 0x0000000000000000000000000000000000000000,ADMIN,"CMTA Token","CMTAT","CMTAT_ISIN","https://cmta.ch",0x0000000000000000000000000000000000000000,"CMTAT_info",5
```

See also the command's [documentation](https://book.getfoundry.sh/reference/forge/deploy-command).

## Code style guidelines
We use the following tools to ensure consistent coding style:

[Prettier](https://github.com/prettier-solidity/prettier-plugin-solidity)
```
npm run-script lint:sol:prettier
```

[Ethlint / Solium](https://github.com/duaraghav8/Ethlint)

```
npm run-script lint:sol
npm run-script lint:sol:fix
npm run-script lint:sol:test
npm run-script lint:sol:test:fix
```
The related components can be installed with `npm install` (see [package.json](./package.json)).

## UML
We use [sol2uml](https://github.com/naddison36/sol2uml) to generate UML for smart contracts.
```
npm run-script uml
npm run-script uml:test
```

The related component can be installed with `npm install` (see [package.json](./package.json)).

Loading

0 comments on commit 53d1ffd

Please sign in to comment.