|
2 | 2 |
|
3 | 3 | This Dockerfile allows to quickly try solc-verify using [Docker](https://docs.docker.com/).
|
4 | 4 |
|
5 |
| -The Dockerfile can be built with the following command: |
| 5 | +The Dockerfile can be built with one of the following commands: |
| 6 | + |
| 7 | +## Build from Open Source |
| 8 | + |
| 9 | +The following Dockerfile will clone the latest solitidy version from GitHub. This is useful if you only have the solc-verify Dockerfile, but not the sourcecode itself. |
| 10 | + |
6 | 11 | ```
|
7 | 12 | docker build -t solc-verify -f Dockerfile-solcverify.src .
|
8 | 13 | ```
|
9 | 14 |
|
| 15 | +## Build locally |
| 16 | + |
| 17 | +Building locally is useful, if you are working on a local copy of solc-verify or in a CI pipeline. |
| 18 | + |
| 19 | +``` |
| 20 | +# go back to solidity root folder |
| 21 | +cd .. |
| 22 | +
|
| 23 | +# build docker image |
| 24 | +docker build -t solc-verify -f docker/Dockerfile-solcverify-local.src . |
| 25 | +``` |
| 26 | + |
| 27 | +# Verify Contracts |
| 28 | + |
| 29 | +## Use `runsv.sh` script |
| 30 | + |
10 | 31 | The included `runsv.sh` script can be used run the containerized solc-verify on programs residing on the host:
|
11 | 32 | ```
|
12 | 33 | ./runsv.sh Contract.sol [FLAGS]
|
13 | 34 | ```
|
14 | 35 |
|
| 36 | +> Example: `./runsv.sh ../test/solc-verify/examples/Annotations.sol` |
| 37 | +
|
| 38 | +## Directly use docker commands to verify contracts |
| 39 | + |
| 40 | +### Validate sample contract |
| 41 | + |
| 42 | +Verify that the docker image is functioning correctly by validating one of the built in contracts. The following command instantiates the SOLC-Verify image, verifies a contract and then shuts down again: |
| 43 | + |
| 44 | +```bash |
| 45 | +PATH_TO_SAMPLE_CONTRACT=/solidity/test/solc-verify/examples/Annotations.sol |
| 46 | +docker run --rm solc-verify:latest $PATH_TO_SAMPLE_CONTRACT |
| 47 | +``` |
| 48 | + |
| 49 | +The command should return following messages: |
| 50 | + |
| 51 | +``` |
| 52 | +C::add: OK |
| 53 | +C::[implicit_constructor]: OK |
| 54 | +C::[receive_ether_selfdestruct]: OK |
| 55 | +Use --show-warnings to see 1 warning. |
| 56 | +No errors found. |
| 57 | +``` |
| 58 | + |
| 59 | +### Validate your contracts |
| 60 | + |
| 61 | +To validate your own contracts place them in a directory that can be mounted into a running container of SOLC-Verify. All you need is the absolute path to the location, where the contracts are located. The following command will mount the contracts located in `$PATH_TO_CONTRACTS` into a running docker container of SOLC-verify and will then validate the contract with the name `$CONTRACT_NAME`. |
| 62 | + |
| 63 | + |
| 64 | +```bash |
| 65 | +PATH_TO_CONTRACTS= # path where the contracts are located on the machine running the docker image |
| 66 | +CONTRACT_NAME= # name of the contract to be validated |
| 67 | + |
| 68 | +docker run --rm -v $PATH_TO_CONTRACTS:/contracts solc-verify:latest /contracts/$CONTRACT_NAME |
| 69 | +``` |
| 70 | + |
15 | 71 | For more information on running solc-verify and examples, see [SOLC-VERIFY-README.md](../SOLC-VERIFY-README.md).
|
0 commit comments