Skip to content

Commit

Permalink
Merge branch 'main' into feat-switch-to-f10-vitss
Browse files Browse the repository at this point in the history
  • Loading branch information
kukkok3 committed Oct 4, 2023
2 parents a667ac7 + 83748f0 commit 3e06690
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ result*
.vscode
**/.idea/
.temp/
tests/tmp/

# std
.std
Expand Down
8 changes: 8 additions & 0 deletions scripts/tally/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# How to use tally script
### Offline
To run the offline tally script we need the committe key and the `active_plans.json` (voteplans encrypted file) to be in the folder where the script is executed. The committee key is generated by the vitup tool together with the other backend artifacts, the `active_plans.json` can be retrived from the api with `curl https://{url}/api/v0/vote/active/plans > active_plans.json` after vote ended. Also we need the jcli tool to be installed. We can then run the script passing the voteplan id of the voteplan we want to decrypt `./private_offline.sh 9a278b6f788278e5cd8dfd6de8b8b8699a7f6b4847c680843de6c02d5b3169b2`


### Online
To run the online tally script we need the committe key to be in the folder where the script is executed. We need to set the env variable `JORMUNGANDR_RESTAPI_URL` in the script. Also we need the jcli tool to be installed. We can then run the script passing the voteplan index of the voteplan we want to decrypt and the expiry block date. The expiry block date is obtained taking the field `"lastBlockDate"` from the response of `https://{url}/api/v0/node/stats` and rounding that up. So if `"lastBlockDate": "25.779"` the script would be called like `./private.sh 0 26.0`
The online tally script needs to be runned after voting ends and before tally time ends. The script will post the decrypted result back to the node as a transaction and it will appear in the `https://{url}/api/v0/vote/active/plans`
27 changes: 27 additions & 0 deletions tests/Earthfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
VERSION 0.7

FROM debian:stable-slim

# BASH, CURL, GPG, NODEJS, NPM, JRE
dependencies:
RUN apt-get update
RUN apt-get install bash
RUN apt-get install curl -y
RUN apt-get install gpg -y
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN apt-get install nodejs -y
RUN apt-get install npm -y
RUN apt-get install default-jre -y

generate-client:
FROM +dependencies

# TODO(@nicopado): Get the correct file from openapi doc generation target - https://github.com/input-output-hk/catalyst-core/issues/589
ARG openapispec_file="./petstore.yaml"
COPY $openapispec_file .

RUN npm install @openapitools/openapi-generator-cli -g

RUN openapi-generator-cli validate -i $openapispec_file

RUN openapi-generator-cli generate -i $openapispec_file -g rust -o ./tmp/client/ --package-name cat-data-service-client

0 comments on commit 3e06690

Please sign in to comment.