diff --git a/.gitignore b/.gitignore index 17f53d8..a3f66c5 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ input.yml .vscode/ build/ migrations/ -test nodes/benchmark/ nodes/contracts-try/ log-container.txt \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4274629..43b4ddf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ FROM --platform=linux/amd64 ubuntu:20.04 WORKDIR / -ADD . / ENV PATH "$PATH:/new/path" @@ -14,6 +13,16 @@ RUN tar -xf node-v14.15.4-linux-x64.tar.xz RUN ln -s /node-v14.15.4-linux-x64/bin/node /usr/local/bin/node RUN ln -s /node-v14.15.4-linux-x64/bin/npm /usr/local/bin/npm RUN ln -s /node-v14.15.4-linux-x64/bin/npx /usr/local/bin/npx + RUN npm install -g ganache-cli RUN npm config set user 0 -RUN pip install -r ./requirements.txt \ No newline at end of file + + +WORKDIR /katena +ADD . /katena/ + +RUN pip install -r ./requirements.txt + +# to avoid: /bin/bash^M: bad interpreter: +# when creating scripts in Windows env and then porting over to run on a Unix environment. +RUN sed -i -e 's/\r$//' *.sh \ No newline at end of file diff --git a/README.md b/README.md index 54fefe3..0c557d6 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,7 @@ Operations on Blockchain with TOSCA. -This repo contains all the files needed to setup and run the experiments used in the evaluation of KATENA. -The prototype has been tested on Ubuntu 20.04. +This repo contains all the files needed to deploy compiled etherum aplications that are complietn with spacific deploy patterns. **NOTE**: to reproduce the experiments reported in the paper refer to [Experiments Reproducibility](#experiments-reproducibility) section. For each experiment, we provided the required step to run it. If you want further information on how to use KATENA to deploy your applications refer to [Development](DEVELOPMENT.md) file. For extra information on Number of Tokens computation see [here](./NUMBER_OF_TOKENS.md). @@ -26,93 +25,52 @@ The suggested way to reproduce the experiments is to use Docker (if not installe ## Experiments Reproducibility -The KATENA container allows to reproduce both the deployment of benchmark applications and the Number of Tokens analysis as described below. +The KATENA container allows automate the deployment of ethereum applications with different patterns: -**The following commands must be executed within KATENA containers (i.e., after the execution of step 3 of the previous section). The two experiments are independent, so there is no specific order to execute them.** +1. Diamond +2. Proxy (ERC1967) +3. upgradable Beacon -- ### Benchmark application deployment +Examples of this patterns and other apps more comples can be foind in the deploy-examples folder. - To deploy the benchmark applications execute within the KATENA container the following command. +- ### To deploy a custom application + + To deploy an applications execute within the KATENA container the following command. ``` - ./run-deploy.sh + ./deploy.sh -f -c ``` + Where the defines the architcture of the ethereum network being deployed. The script automatically: - Bootstraps a Ganache instance. - Retrieves the credentials of Account 0 (among the ones generated by Ganache) and uses them to pay for transactions on the local Ganache Blockchain. - Stores these credentials in KATENA - - Instructs KATENA to deploy ENS, Dark Forest, and dydx by providing the TOSCA models (stored in folder `benchmark`) and the smart contract ABIs (stored in folders `nodes/contracts-` where APP_NAME can be either ens, dydx or dark-forest). - -Note that depending on the hardware configuration this step could take a while (approximatively 10/20 minutes). - -The deployment succeeds if this output is printed in the console. - -``` -deploying ens... -ens deployed successfully -deploying dark-forest... -dark-forest deployed successfully -deploying dydx... -dydx deployed successfully -``` - -- ### Number of Tokens analysis - - To execute the analysis execute within the KATENA container the following command. - - ``` - ./run-not-evaluation-all.sh - ``` + - Instructs KATENA to deploy the input topology - This script compares the difference in Number of Tokens between KATENA specification files used to deploy the applications and the original deployment scripts. +## Run tests - The experiment succeeds if the output is: +Scripts can be used to test deployment. This scripts, must be listed in a `test` folder in the same directory as the contracts ABIs. An example can be found at `deploy-examples/beacon`: ``` - dark-forest - YAML: 304 - JS: 1765 - ens - YAML: 87 - JS: 95 - dydx - YAML: 559 - JS: 923 + python ./.katena/contracts/test/