Skip to content

Commit 6456923

Browse files
authored
Add tally missing trustees feature (#202)
* style: remove unused imports * feat: add command to report missing trustees * feat: implement missing trustee for dummy scheme * feat: implement missing trustee for electionguard scheme * feat: add missing trustee to elections sandbox * feat: add missing trustees report to clients * fix : minor fixes and improvements * chore: bump versions * doc: update changelog * style: fix lint issues * chore: bump python and EG versions * fix: solve lint issues and broken tests * chore: upload test server log for e2e tests * test: don't use chrome for e2e tests * chore: increate e2e tests consistency * test: increase e2e timeout for compensation
1 parent e22d715 commit 6456923

File tree

78 files changed

+1455
-690
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1455
-690
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.8-electionguard-1.2.0
1+
FROM codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.11-electionguard-1.2.1
22
LABEL author="[email protected]"
33

44
# [Option] Install zsh
@@ -19,7 +19,7 @@ ARG USERNAME=automatic
1919
ARG USER_UID=1000
2020
ARG USER_GID=$USER_UID
2121
COPY library-scripts/*.sh /tmp/library-scripts/
22-
RUN apt-get update \
22+
RUN apt-get update --allow-releaseinfo-change \
2323
&& /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
2424
# Use Docker script from script library to set things up
2525
&& /bin/bash /tmp/library-scripts/docker-debian.sh "${ENABLE_NONROOT_DOCKER}" "/var/run/docker-host.sock" "/var/run/docker.sock" "${USERNAME}" \

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"forwardPorts": [8000],
2222

2323
// Use 'postCreateCommand' to run commands after the container is created.
24-
"postCreateCommand": "apt-get update && apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb && make install build"
24+
"postCreateCommand": "apt-get update --allow-releaseinfo-change && apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb && make install build install_test_e2e"
2525

2626
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
2727
// "remoteUser": "vscode"

.devcontainer/library-scripts/common-debian.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ apt-get-update-if-needed()
6262
{
6363
if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
6464
echo "Running apt-get update..."
65-
apt-get update
65+
apt-get update --allow-releaseinfo-change
6666
else
6767
echo "Skipping apt-get update."
6868
fi
@@ -113,7 +113,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
113113
if [[ ! -z $(apt-cache --names-only search ^libssl1.1$) ]]; then
114114
PACKAGE_LIST="${PACKAGE_LIST} libssl1.1"
115115
fi
116-
116+
117117
# Install appropriate version of libssl1.0.x if available
118118
LIBSSL=$(dpkg-query -f '${db:Status-Abbrev}\t${binary:Package}\n' -W 'libssl1\.0\.?' 2>&1 || echo '')
119119
if [ "$(echo "$LIBSSL" | grep -o 'libssl1\.0\.[0-9]:' | uniq | sort | wc -l)" -eq 0 ]; then
@@ -128,7 +128,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
128128

129129
echo "Packages to verify are installed: ${PACKAGE_LIST}"
130130
apt-get -y install --no-install-recommends ${PACKAGE_LIST} 2> >( grep -v 'debconf: delaying package configuration, since apt-utils is not installed' >&2 )
131-
131+
132132
PACKAGES_ALREADY_INSTALLED="true"
133133
fi
134134

@@ -142,19 +142,19 @@ fi
142142
# Ensure at least the en_US.UTF-8 UTF-8 locale is available.
143143
# Common need for both applications and things like the agnoster ZSH theme.
144144
if [ "${LOCALE_ALREADY_SET}" != "true" ] && ! grep -o -E '^\s*en_US.UTF-8\s+UTF-8' /etc/locale.gen > /dev/null; then
145-
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
145+
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
146146
locale-gen
147147
LOCALE_ALREADY_SET="true"
148148
fi
149149

150150
# Create or update a non-root user to match UID/GID.
151151
if id -u ${USERNAME} > /dev/null 2>&1; then
152152
# User exists, update if needed
153-
if [ "${USER_GID}" != "automatic" ] && [ "$USER_GID" != "$(id -G $USERNAME)" ]; then
154-
groupmod --gid $USER_GID $USERNAME
153+
if [ "${USER_GID}" != "automatic" ] && [ "$USER_GID" != "$(id -G $USERNAME)" ]; then
154+
groupmod --gid $USER_GID $USERNAME
155155
usermod --gid $USER_GID $USERNAME
156156
fi
157-
if [ "${USER_UID}" != "automatic" ] && [ "$USER_UID" != "$(id -u $USERNAME)" ]; then
157+
if [ "${USER_UID}" != "automatic" ] && [ "$USER_UID" != "$(id -u $USERNAME)" ]; then
158158
usermod --uid $USER_UID $USERNAME
159159
fi
160160
else
@@ -164,7 +164,7 @@ else
164164
else
165165
groupadd --gid $USER_GID $USERNAME
166166
fi
167-
if [ "${USER_UID}" = "automatic" ]; then
167+
if [ "${USER_UID}" = "automatic" ]; then
168168
useradd -s /bin/bash --gid $USERNAME -m $USERNAME
169169
else
170170
useradd -s /bin/bash --uid $USER_UID --gid $USERNAME -m $USERNAME
@@ -179,7 +179,7 @@ if [ "${USERNAME}" != "root" ] && [ "${EXISTING_NON_ROOT_USER}" != "${USERNAME}"
179179
fi
180180

181181
# ** Shell customization section **
182-
if [ "${USERNAME}" = "root" ]; then
182+
if [ "${USERNAME}" = "root" ]; then
183183
USER_RC_PATH="/root"
184184
else
185185
USER_RC_PATH="/home/${USERNAME}"
@@ -240,7 +240,7 @@ CODESPACES_ZSH="$(cat \
240240
<<'EOF'
241241
__zsh_prompt() {
242242
local prompt_username
243-
if [ ! -z "${GITHUB_USER}" ]; then
243+
if [ ! -z "${GITHUB_USER}" ]; then
244244
prompt_username="@${GITHUB_USER}"
245245
else
246246
prompt_username="%n"

.devcontainer/library-scripts/docker-debian.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ apt-get-update-if-needed()
4343
{
4444
if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
4545
echo "Running apt-get update..."
46-
apt-get update
46+
apt-get update --allow-releaseinfo-change
4747
else
4848
echo "Skipping apt-get update."
4949
fi
@@ -55,7 +55,7 @@ export DEBIAN_FRONTEND=noninteractive
5555
# Install apt-transport-https, curl, lsb-release, gpg if missing
5656
if ! dpkg -s apt-transport-https curl ca-certificates lsb-release > /dev/null 2>&1 || ! type gpg > /dev/null 2>&1; then
5757
apt-get-update-if-needed
58-
apt-get -y install --no-install-recommends apt-transport-https curl ca-certificates lsb-release gnupg2
58+
apt-get -y install --no-install-recommends apt-transport-https curl ca-certificates lsb-release gnupg2
5959
fi
6060

6161
# Install Docker / Moby CLI if not already installed
@@ -67,17 +67,17 @@ else
6767
CODENAME=$(lsb_release -cs)
6868
curl -s https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT)
6969
echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-${DISTRO}-${CODENAME}-prod ${CODENAME} main" > /etc/apt/sources.list.d/microsoft.list
70-
apt-get update
70+
apt-get update --allow-releaseinfo-change
7171
apt-get -y install --no-install-recommends moby-cli
7272
else
7373
curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | (OUT=$(apt-key add - 2>&1) || echo $OUT)
7474
echo "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list
75-
apt-get update
75+
apt-get update --allow-releaseinfo-change
7676
apt-get -y install --no-install-recommends docker-ce-cli
7777
fi
7878
fi
7979

80-
# Install Docker Compose if not already installed
80+
# Install Docker Compose if not already installed
8181
if type docker-compose > /dev/null 2>&1; then
8282
echo "Docker Compose already installed."
8383
else
@@ -105,13 +105,13 @@ if [ "${ENABLE_NONROOT_DOCKER}" = "false" ] || [ "${USERNAME}" = "root" ]; then
105105
fi
106106

107107
# If enabling non-root access and specified user is found, setup socat and add script
108-
chown -h "${USERNAME}":root "${TARGET_SOCKET}"
108+
chown -h "${USERNAME}":root "${TARGET_SOCKET}"
109109
if ! dpkg -s socat > /dev/null 2>&1; then
110110
apt-get-update-if-needed
111111
apt-get -y install socat
112112
fi
113113
tee /usr/local/share/docker-init.sh > /dev/null \
114-
<< EOF
114+
<< EOF
115115
#!/usr/bin/env bash
116116
#-------------------------------------------------------------------------------------------------------------
117117
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -143,8 +143,8 @@ log()
143143
echo -e "\n** \$(date) **" | sudoIf tee -a \${SOCAT_LOG} > /dev/null
144144
log "Ensuring ${USERNAME} has access to ${SOURCE_SOCKET} via ${TARGET_SOCKET}"
145145
146-
# If enabled, try to add a docker group with the right GID. If the group is root,
147-
# fall back on using socat to forward the docker socket to another unix socket so
146+
# If enabled, try to add a docker group with the right GID. If the group is root,
147+
# fall back on using socat to forward the docker socket to another unix socket so
148148
# that we can set permissions on it without affecting the host.
149149
if [ "${ENABLE_NONROOT_DOCKER}" = "true" ] && [ "${SOURCE_SOCKET}" != "${TARGET_SOCKET}" ] && [ "${USERNAME}" != "root" ] && [ "${USERNAME}" != "0" ]; then
150150
SOCKET_GID=\$(stat -c '%g' ${SOURCE_SOCKET})
@@ -171,7 +171,7 @@ if [ "${ENABLE_NONROOT_DOCKER}" = "true" ] && [ "${SOURCE_SOCKET}" != "${TARGET_
171171
log "Success"
172172
fi
173173
174-
# Execute whatever commands were passed in (if any). This allows us
174+
# Execute whatever commands were passed in (if any). This allows us
175175
# to set this script to ENTRYPOINT while still executing the default CMD.
176176
set +e
177177
exec "\$@"

.github/workflows/server-workflow.yml

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
name: Build electionguard
2020
runs-on: ubuntu-latest
2121
container:
22-
image: codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.8-electionguard-1.2.0
22+
image: codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.11-electionguard-1.2.1
2323
steps:
2424
- uses: actions/[email protected]
2525
with:
@@ -74,7 +74,7 @@ jobs:
7474
runs-on: ubuntu-latest
7575
if: ${{ needs.check_python_to_js_cache.outputs.cache-hit != 'true' }}
7676
container:
77-
image: codegram/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.0
77+
image: codegram/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.1
7878
steps:
7979
- uses: actions/[email protected]
8080
with:
@@ -121,7 +121,7 @@ jobs:
121121
needs: build_python_to_js
122122
runs-on: ubuntu-latest
123123
container:
124-
image: codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.8-electionguard-1.2.0
124+
image: codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.11-electionguard-1.2.1
125125
services:
126126
postgres:
127127
image: postgres:11
@@ -234,7 +234,7 @@ jobs:
234234
needs: [check_python_to_js_cache, build_python_to_js]
235235
runs-on: ubuntu-latest
236236
container:
237-
image: codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.8-electionguard-1.2.0
237+
image: codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.11-electionguard-1.2.1
238238
services:
239239
postgres:
240240
image: postgres:11
@@ -314,26 +314,20 @@ jobs:
314314
cd bulletin_board/server
315315
bundler exec rails db:create
316316
bundler exec rails db:migrate
317-
- name: Install Chrome
317+
- name: Install e2e tests dependencies
318318
run: |
319-
sudo apt-get update
320-
sudo apt-get install -y unzip xvfb libxi6 libgconf-2-4
321-
sudo curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
322-
sudo echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
323-
sudo apt-get -y update
324-
sudo apt-get -y install google-chrome-stable
325-
wget https://chromedriver.storage.googleapis.com/90.0.4430.24/chromedriver_linux64.zip
326-
unzip chromedriver_linux64.zip
327-
sudo mv chromedriver /usr/bin/chromedriver
328-
sudo chown root:root /usr/bin/chromedriver
329-
sudo chmod +x /usr/bin/chromedriver
319+
make install_test_e2e
330320
- name: Run e2e tests
331321
run: |
332-
cd bulletin_board/server
333-
npm run e2e:install
334-
bundle exec rails s -e test -p 5017 &
322+
make serve_test &
335323
sleep 5
336-
npm run e2e:tests -- --browser chrome --headless
324+
make test_e2e
325+
- name: Upload artifacts (server logs)
326+
if: ${{ always() }}
327+
uses: actions/upload-artifact@v2
328+
with:
329+
name: test server logs
330+
path: bulletin_board/server/log/
337331
- name: Upload artifacts (screenshots)
338332
if: ${{ always() }}
339333
uses: actions/upload-artifact@v2

.github/workflows/voting-scheme-electionguard-python-wrapper-workflow.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ env:
1313
CI: "true"
1414
SIMPLECOV: "true"
1515
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true"
16-
PYTHON_VERSION: "3.8.8"
1716

1817
defaults:
1918
run:
@@ -23,6 +22,8 @@ jobs:
2322
tests:
2423
name: Test code
2524
runs-on: ubuntu-latest
25+
container:
26+
image: codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.11-electionguard-1.2.1
2627
steps:
2728
- uses: rokroskar/[email protected]
2829
if: "github.ref != 'refs/heads/develop'"
@@ -32,9 +33,6 @@ jobs:
3233
with:
3334
fetch-depth: 1
3435
submodules: true
35-
- uses: actions/setup-python@v2
36-
with:
37-
python-version: ${{ env.PYTHON_VERSION }}
3836
- name: Add Poetry to path
3937
run: echo "$HOME/.poetry/bin" >> $GITHUB_PATH
4038
- name: Install dependencies

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
## Added
11+
12+
- The bulletin board client now includes a `report_missing_trustee` method to report the absence of a trustee during the Tally phase.
13+
1014
## [0.21.2] - 2021-05-28
1115

1216
## [0.21.1] - 2021-04-23

Dockerfile.release

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This stage builds the python-wrapper package
2-
FROM codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.8-electionguard-1.2.0 as python-wrapper-builder
2+
FROM codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.11-electionguard-1.2.1 as python-wrapper-builder
33
LABEL author="[email protected]"
44

55
# Add Makefiles
@@ -17,7 +17,7 @@ ADD voting_schemes/electionguard/python-wrapper /code/voting_schemes/electiongua
1717
RUN cd /code && make build_electionguard_python_wrapper
1818

1919
# This stage builds the pyodide packages for the previous python packages
20-
FROM codegram/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.0 as python-to-js-builder
20+
FROM codegram/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.1 as python-to-js-builder
2121
LABEL author="[email protected]"
2222

2323
ENV PYODIDE_PACKAGES "electionguard,bulletin_board-electionguard"
@@ -43,15 +43,15 @@ RUN make
4343
RUN cp -rf /code/voting_schemes/electionguard/python-to-js/override/* /src/pyodide/build/
4444

4545
# This stage builds the bulletin-board application
46-
FROM codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.8-electionguard-1.2.0
46+
FROM codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.11-electionguard-1.2.1
4747
LABEL author="[email protected]"
4848

4949
# Environment variables
5050
ENV SECRET_KEY_BASE 1234
5151
ENV RAILS_ENV production
5252

5353
# Install system dependencies
54-
RUN apt-get update && \
54+
RUN apt-get update --allow-releaseinfo-change && \
5555
apt-get install -y postgresql postgresql-client postgresql-contrib libpq-dev \
5656
redis-server memcached imagemagick ffmpeg mupdf mupdf-tools libxml2-dev && \
5757
rm -rf /var/lib/apt/lists/*

Dockerfile.web

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This stage builds the python-wrapper package
2-
FROM codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.8-electionguard-1.2.0 as python-wrapper-builder
2+
FROM codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.11-electionguard-1.2.1 as python-wrapper-builder
33
LABEL author="[email protected]"
44

55
# Add Makefiles
@@ -17,7 +17,7 @@ ADD voting_schemes/electionguard/python-wrapper /code/voting_schemes/electiongua
1717
RUN cd /code && make build_electionguard_python_wrapper
1818

1919
# This stage builds the pyodide packages for the previous python packages
20-
FROM codegram/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.0 as python-to-js-builder
20+
FROM codegram/pyodide-electionguard:pyodide-0.16.1-electionguard-1.2.1 as python-to-js-builder
2121
LABEL author="[email protected]"
2222

2323
ENV PYODIDE_PACKAGES "electionguard,bulletin_board-electionguard"
@@ -43,15 +43,15 @@ RUN make
4343
RUN cp -rf /code/voting_schemes/electionguard/python-to-js/override/* /src/pyodide/build/
4444

4545
# This stage builds the bulletin-board application
46-
FROM codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.8-electionguard-1.2.0
46+
FROM codegram/ruby-node-python-electionguard:ruby-2.6.6-node-15-python-3.8.11-electionguard-1.2.1
4747
LABEL author="[email protected]"
4848

4949
# Environment variables
5050
ENV SECRET_KEY_BASE 1234
5151
ENV RAILS_ENV production
5252

5353
# Install system dependencies
54-
RUN apt-get update && \
54+
RUN apt-get update --allow-releaseinfo-change && \
5555
apt-get install -y postgresql postgresql-client postgresql-contrib libpq-dev \
5656
redis-server memcached imagemagick ffmpeg mupdf mupdf-tools libxml2-dev && \
5757
rm -rf /var/lib/apt/lists/*

bulletin_board/js-client/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)