Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup after separation from rust code #3

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,6 @@
name: CI
on: [push, pull_request]
jobs:
rust-check:
name: Rust Checks
env:
CARGO_TERM_COLOR: always
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- uses: actions-rs/cargo@v1
name: Build
with:
command: build
args: --tests
# todo: enable this action once Step trait no longer causes release build failures
# - uses: actions-rs/cargo@v1
# name: Release Build
# with:
# command: build
# args: --release

- uses: actions-rs/cargo@v1
name: Check formatting
if: ${{ success() || failure() }}
with:
command: fmt
args: --all -- --check

- uses: actions-rs/cargo@v1
name: Clippy
if: ${{ success() || failure() }}
with:
command: clippy
args: --tests -- -D warnings -D clippy::pedantic

- uses: actions-rs/cargo@v1
name: Run Tests
with:
command: test

python-check:
name: Python Checks
runs-on: ubuntu-latest
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
*.code-workspace
*.swp
*~
/.venv/
/.vscode/
Player-Data/
Programs/Public-Input/
Programs/Bytecode/
Programs/Public-Input/
Programs/Schedules/
__pycache__/
dist/
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To run the prototype, you will need to clone the MP-SPDZ repo so that it neighbo
From the current directory (i.e. `raw-ipa/research-prototype`)

```bash
cd ../..
cd ..
gh repo clone data61/MP-SPDZ
cd MP-SPDZ

Expand Down Expand Up @@ -38,7 +38,7 @@ make clean -B -j 8 replicated-ring-party.x
Finally, you'll need to setup SSL for the parties. From the `raw-ipa/research-prototype` directory, run:

```bash
../../MP-SPDZ/Scripts/setup-ssl.sh 3
../MP-SPDZ/Scripts/setup-ssl.sh 3
```

## Running the Prototype
Expand All @@ -50,20 +50,20 @@ Make sure you are now back in this directory, `raw-ipa/research-prototype`.
You'll need to create a python virtual environment, and install the requirements.

```bash
python3 virtualenv ../.venv
source ../.venv/bin/activate
python3 virtualenv .venv
source .venv/bin/activate
pip install -r ../requirements.txt
```

Note that this will also install a version of the MP-SPDZ compiler. You can also install that directly with your local copy with

```
pip install -e ../../MP-SPDZ
pip install -e ../MP-SPDZ
```

### Running IPA scripts

From this `raw-ipa/research-prototype` repository, you can now run the IPA scripts with:
From this `research-prototype` repository, you can now run the IPA scripts with:

```bash
python ipa
Expand Down Expand Up @@ -97,7 +97,7 @@ You can use the same arguments with both `compile` and `generate_input` (though
To simulate the MPC locally, run:

```bash
../../MP-SPDZ/Scripts/ring.sh -R 32 ipae2e
../MP-SPDZ/Scripts/ring.sh -R 32 ipae2e
```

### Running the MPC on multiple hosts
Expand All @@ -124,17 +124,17 @@ COORDINATOR=<host IP or DNS>
Run this command on the coordinator host

```bash
../../MP-SPDZ/replicated-ring-party.x --player 0 ipae2e --hostname $COORDINATOR
../MP-SPDZ/replicated-ring-party.x --player 0 ipae2e --hostname $COORDINATOR
```

Start two other MPC parties:

host 1:
```bash
../../MP-SPDZ/replicated-ring-party.x --player 1 ipae2e --hostname $COORDINATOR
../MP-SPDZ/replicated-ring-party.x --player 1 ipae2e --hostname $COORDINATOR
```

host 2:
```bash
../../MP-SPDZ/replicated-ring-party.x --player 1 ipae2e --hostname $COORDINATOR
../MP-SPDZ/replicated-ring-party.x --player 1 ipae2e --hostname $COORDINATOR
```
13 changes: 0 additions & 13 deletions pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ root="$(git rev-parse --show-toplevel 2>/dev/null)"
set -e

# Some sanity checking.
hash cargo
[[ -n "$root" ]]

# Installation.
Expand All @@ -29,25 +28,13 @@ fi
stashfile=$(mktemp .pre-commit.stashXXXXXX)
trap 'set +e;git stash pop -q; rm -f "$stashfile"' EXIT
git stash push -k -u -q -m "pre-commit stash"
if ! errors=($(cargo fmt -- --check -l)); then
echo "Formatting errors found."
echo "Run \`cargo fmt\` to fix the following files:"
for err in "${errors[@]}"; do
echo " $err"
done
exit 1
fi

error() {
echo "-----------------------"
echo "$@"
exit 1
}

cargo clippy --tests -- -D warnings --D clippy::pedantic || error "Clippy errors"

cargo test || error "Test failures"

VENV="$root/.venv/bin"
pyrun() {
x="$1"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ flake518
isort
docopt
schema
-e git+ssh://git@github.com/eriktaubeneck/MP-SPDZ.git@39b6d7e22dedc5798823d306741d33ff6635bc25#egg=mp_spdz_compiler
-e git+https://github.com/eriktaubeneck/MP-SPDZ@39b6d7e22dedc5798823d306741d33ff6635bc25#egg=mp_spdz_compiler