diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 400718c9..92e8d510 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,9 +8,6 @@ on: env: CARGO_TERM_COLOR: always - ABY_SOURCE: "./../ABY" - KAHIP_SOURCE: "./../KaHIP" - KAHYPAR_SOURCE: "./../kahypar" jobs: build: @@ -27,15 +24,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Set all features on run: python3 driver.py --all_features - - name: Cache third_party libraries - uses: actions/cache@v3 - with: - path: | - /home/runner/work/circ/ABY - /home/runner/work/circ/KaHIP - /home/runner/work/circ/kahypar - key: ${{ runner.os }}-third_party - - name: Install third_party libraries + - name: Install python reqs run: python3 driver.py --install - name: Check run: python3 driver.py --check diff --git a/Cargo.toml b/Cargo.toml index f5d9f578..c797487b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,8 +68,6 @@ datalog = ["pest", "pest-ast", "pest_derive", "from-pest", "lazy_static"] smt = ["rsmt2", "ieee754"] lp = ["good_lp", "lp-solvers"] aby = ["lp"] -kahip = ["aby"] -kahypar = ["aby"] r1cs = ["bincode"] poly = ["rug-polynomial"] spartan = ["r1cs", "dep:spartan", "merlin", "curve25519-dalek", "bincode", "gmp-mpfr-sys"] diff --git a/driver.py b/driver.py index ba2eb198..d9ed839a 100755 --- a/driver.py +++ b/driver.py @@ -27,30 +27,6 @@ def install(features): set of features required """ - def verify_path_empty(path) -> bool: - return not os.path.isdir(path) or (os.path.isdir(path) and not os.listdir(path)) - - for f in features: - if f == "aby": - if verify_path_empty(ABY_SOURCE): - subprocess.run( - ["git", "clone", "https://github.com/edwjchen/ABY.git", ABY_SOURCE] - ) - subprocess.run(["./scripts/build_aby.zsh"]) - if f == "kahip": - if verify_path_empty(KAHIP_SOURCE): - subprocess.run( - ["git", "clone", "https://github.com/KaHIP/KaHIP.git", KAHIP_SOURCE] - ) - subprocess.run(["./scripts/build_kahip.zsh"]) - if f == "kahypar": - if verify_path_empty(KAHYPAR_SOURCE): - subprocess.run( - ["git", "clone", "--depth=1", "--recursive", - "https://github.com/SebastianSchlag/kahypar.git", KAHYPAR_SOURCE] - ) - subprocess.run(["./scripts/build_kahypar.zsh"]) - # install python requirements subprocess.run(["pip3", "install", "-r", "requirements.txt"]) @@ -116,7 +92,6 @@ def build(features): log_run_check(["./scripts/build_mpc_c_test.zsh"]) if "smt" in features and "zok" in features: log_run_check(["./scripts/build_mpc_zokrates_test.zsh"]) - log_run_check(["./scripts/build_aby.zsh"]) def test(features, extra_args): @@ -368,7 +343,6 @@ if __name__ == "__main__": verify_extra_implies_flamegraph_or_test(args) features = load_features() - set_env(features) if args.flamegraph: if len(args.extra) > 0 and args.extra[0] == "--": diff --git a/scripts/aby_tests/c_bench_aby.py b/scripts/aby_tests/c_bench_aby.py deleted file mode 100755 index 4614f417..00000000 --- a/scripts/aby_tests/c_bench_aby.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python - -import os -from util import run_tests -from test_suite import * - -ABY_SOURCE = os.getenv("ABY_SOURCE") - -if __name__ == "__main__": - tests = [[ - "loop add", - 3, - ABY_SOURCE+"/build/bin/2pc_loop_add", - {"a": 1, "b": 0}, - {"a": 0, "b": 2}, - ]] - - run_tests('c', tests) diff --git a/scripts/aby_tests/util.py b/scripts/aby_tests/util.py index 3386519c..25c2e0c5 100644 --- a/scripts/aby_tests/util.py +++ b/scripts/aby_tests/util.py @@ -11,7 +11,7 @@ def rename_test(name: str, lang: str) -> str: def build_cmd(name: str, test_file: str, role: int) -> List[str]: path = f"./scripts/aby_tests/tests/{name}" - return [os.getenv("ABY_SOURCE") + "/build/bin/aby_interpreter", "-m", "mpc", "-f", path, "-t", test_file, "-r", str(role)] + return ["./third_party/bin/ABY/aby_interpreter", "-m", "mpc", "-f", path, "-t", test_file, "-r", str(role)] def get_result(file_path): diff --git a/scripts/build_aby.zsh b/scripts/build_aby.zsh deleted file mode 100755 index dd4ae1a3..00000000 --- a/scripts/build_aby.zsh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env zsh - -if [[ ! -z ${ABY_SOURCE} ]]; then - cd ${ABY_SOURCE} - git checkout functions - mkdir -p -- build - cd build - cmake .. -DABY_BUILD_EXE=On - make -else - echo "Missing ABY_SOURCE environment variable." -fi \ No newline at end of file diff --git a/scripts/build_kahip.zsh b/scripts/build_kahip.zsh deleted file mode 100755 index bd7a72b6..00000000 --- a/scripts/build_kahip.zsh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env zsh - -if [[ ! -z ${KAHIP_SOURCE} ]]; then - cd ${KAHIP_SOURCE} - ./compile_withcmake.sh -DCMAKE_BUILD_TYPE=Release -DPARHIP=off -else - echo "Missing KAHIP_SOURCE environment variable." -fi \ No newline at end of file diff --git a/scripts/build_kahypar.zsh b/scripts/build_kahypar.zsh deleted file mode 100755 index 99717ec4..00000000 --- a/scripts/build_kahypar.zsh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env zsh - -if [[ ! -z ${KAHYPAR_SOURCE} ]]; then - cd ${KAHYPAR_SOURCE} - mkdir build && cd build - cmake .. -DCMAKE_BUILD_TYPE=RELEASE - make -else - echo "Missing KAHYPAR_SOURCE environment variable." -fi \ No newline at end of file diff --git a/src/target/aby/utils.rs b/src/target/aby/utils.rs index 83ac4a08..6fcf4261 100644 --- a/src/target/aby/utils.rs +++ b/src/target/aby/utils.rs @@ -1,19 +1,9 @@ //! Utility functions to write compiler output to ABY -use std::env; use std::fs::{self, File, OpenOptions}; use std::io::Write; use std::path::Path; -/// Get ABY source directory -pub fn get_aby_source() -> String { - let key = "ABY_SOURCE"; - match env::var(key) { - Ok(val) => val, - Err(e) => panic!("Missing env variable: ABY_SOURCE, {}", e), - } -} - /// Given Path `path` and String denominator `lang`, return the filename of the path pub fn get_path(path: &Path, lang: &str, t: &str, create: bool) -> String { let filename = Path::new(&path.iter().last().unwrap()) diff --git a/third_party/bin/ABY/aby_interpreter b/third_party/bin/ABY/aby_interpreter new file mode 100755 index 00000000..3a7039a4 Binary files /dev/null and b/third_party/bin/ABY/aby_interpreter differ diff --git a/util.py b/util.py index 353c7d20..01272e8a 100644 --- a/util.py +++ b/util.py @@ -4,26 +4,10 @@ from os import path # Gloable variables feature_path = ".features.txt" mode_path = ".mode.txt" -cargo_features = {"aby", "c", "lp", "r1cs", "kahip", "kahypar", - "smt", "zok", "datalog", "bellman", "spartan", "poly"} -# Environment variables -ABY_SOURCE = "./../ABY" -KAHIP_SOURCE = "./../KaHIP" -KAHYPAR_SOURCE = "./../kahypar" - - -def set_env(features): - for f in features: - if f == 'aby': - if not os.getenv("ABY_SOURCE"): - os.environ["ABY_SOURCE"] = ABY_SOURCE - if f == 'kahip': - if not os.getenv("KAHIP_SOURCE"): - os.environ["KAHIP_SOURCE"] = KAHIP_SOURCE - if f == 'kahypar': - if not os.getenv("KAHYPAR_SOURCE"): - os.environ["KAHYPAR_SOURCE"] = KAHYPAR_SOURCE +# TODO: add in "kahip", "kahypar" binaries dependencies when adding new MPC changes +cargo_features = {"aby", "c", "lp", "r1cs", "smt", + "zok", "datalog", "bellman", "spartan", "poly"} def save_mode(mode):