Skip to content
Merged
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
28 changes: 21 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@ concurrency:
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
unit-tests:
checks:
if: github.event.pull_request.draft == false
runs-on: ubuntu-24.04
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: "Install clang-format"
run: sudo apt install -y clang-format
- name: "Run formatting checks"
run: ./scripts/accli_wrapper.sh dev format-code

rust-unit-tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-24.04
steps:
Expand All @@ -26,16 +37,19 @@ jobs:
- name: "Run Rust unit tests"
run: |
source ./scripts/workon.sh
# TODO: move to accli dev test
cargo test

checks:
cpp-unit-tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-24.04
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: "Install clang-format"
run: sudo apt install -y clang-format
- name: "Run formatting checks"
run: ./scripts/accli_wrapper.sh dev format-code
- name: "Build C++ code"
shell: bash
run: |
./scripts/accli_wrapper.sh docker run --mount --cwd /code/accless/accless python3 build.py
- name: "Run C++ unit tests"
shell: bash
run: |
./scripts/accli_wrapper.sh docker run --mount --cwd /code/accless/accless/build-native ctest -- --output-on-failure
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Rust builds
target

workflows/build
# Python builds
venv
venv-bm

# C++ builds
build-native
build-wasm

ansible/inventory/vms.ini

datasets*

gemini-plans
31 changes: 18 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ members = [
]

[workspace.package]
version = "0.8.0"
version = "0.8.1"
license-file = "LICENSE"
authors = ["Large-Scale Data & Systems Group - Imperial College London"]
edition = "2024"
Expand All @@ -27,6 +27,7 @@ ark-bls12-381 = "0.4.0"
ark-mnt4-298 = "0.4.0"
ark-ec = "0.4.2"
ark-ff = "0.4.2"
ark-serialize = "0.4.2"
ark-std = "0.4.0"
axum = "0.7"
base64 = "^0.22"
Expand All @@ -49,7 +50,7 @@ once_cell = "^1.19.0"
p256 = "0.13.2"
plotters = "^0.3.7"
rabe = { git = "https://github.com/faasm/rabe.git", rev = "0dc7696a95eef44dd051e1d9c2e5c2c8c35211bf" }
rand = "0.9.2"
rand = "0.8.5"
regex = "1"
reqwest = "0.12.24"
ring = "0.17.14"
Expand All @@ -58,6 +59,7 @@ rustls = "0.23"
rustls-pemfile = "1"
serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
serde_with = "3.8.1"
serde_yaml = "0.9"
shellexpand = "^3.1"
sha2 = "0.10"
Expand Down
65 changes: 55 additions & 10 deletions GEMINI.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,66 @@ You can run the code formatting checks with:

```bash
# To format code.
accli dev format-code
./scripts/accli_wrapper.sh dev format-code

# To check formatting.
accli dev format-code --check
./scripts/accli_wrapper.sh dev format-code --check
```

after applying any changes, make sure they compile by running:
note that in order to set the right environment for your commands, we provide
the `./scripts/accli_wrapper.sh` that you should use whenever you want to
run a commadn in `accli`. All commands and subcommands in `accli` take an
optional `--help` flag: `./scrips/accli_wrapper.sh --help`.

```bash
cargo build
```

## Code Style
## Coding Guideleins
Comment on lines +70 to +73
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There are a few typos in this section. commadn should be command, scrips should be scripts, and Guideleins should be Guidelines.

Suggested change
run a commadn in `accli`. All commands and subcommands in `accli` take an
optional `--help` flag: `./scrips/accli_wrapper.sh --help`.
```bash
cargo build
```
## Code Style
## Coding Guideleins
run a commadn in `accli`. All commands and subcommands in `accli` take an
optional `--help` flag: `./scripts/accli_wrapper.sh --help`.
## Coding Guidelines


- Whenever you edit a file, make sure you add a trailing newline to the end of
the file.
- In rust code, do not allow the use of unwrap() or panic(). Instead, enforce
proper error handling.
- For each new function you add, make sure to add one or multiple unit tests.

### Rust Coding Guidelines

- Whenever you make changes to rust source code, make sure to build it and test
it with: `cargo build` and `cargo test` from the root of the directory.
- Do not allow the use of unwrap() or panic(). Instead, enforce proper error handling.
- For each new method, make sure to add extensive documentation in the following format:
```rust
///
/// # Description
///
/// <description>
///
/// # Arguments
///
/// - `arg1`: explanation
/// - `arg2`: explanation
///
/// # Returns
///
/// <explanation of return value>
///
/// # Example Usage
///
/// <code snippet if applicable
```

### C++ Coding Guidelines

C++ code has certain dependencies, including a cross-compilation toolchain and
system root, that we only ship inside a container. As a consequence, any
time you need to test some C++ feature, you need to run the command inside
the sysroot container. To do so, you may use `accli` as follows:

```
# <cwd> must be an absolute path!
./scripts/accli_wrapper.sh docker run [--cwd <cwd>] [--mount] "<your bash command here>"
```

After doing any C++ code modifications, make sure to format the code, and run
the tests:

```
./scripts/accli_wrapper.sh dev format-code
./scripts/accli_wrapper.sh docker run --cwd /code/accless/accless --mount python3 build.py
./scripts/accli_wrapper.sh docker run --cwd /code/accless/accless/build-native --mount ctest -- --output-on-failure
```
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.0
0.8.1
38 changes: 35 additions & 3 deletions accless/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,30 @@ set(CMAKE_PROJECT_TARGET accless)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Hints to find the custom libriares that we install in the docker container:
# ./config/docker/accless-experiments.dockerfile
if (NOT CMAKE_SYSTEM_NAME STREQUAL "WASI")
# Third-party deps for native builds.
include(cmake/NativeExternalProjects.cmake)

# Make custom prefixes visible to *all* find_package() calls in subdirs
list(PREPEND CMAKE_PREFIX_PATH
"/usr/local/attestationssl"
"/usr/local/attestationcurl"
)

# OpenSSL hints
set(OPENSSL_ROOT_DIR "/usr/local/attestationssl" CACHE PATH "")
set(OPENSSL_USE_STATIC_LIBS ON CACHE BOOL "")
set(OPENSSL_INCLUDE_DIR "/usr/local/attestationssl/include" CACHE PATH "")
set(OPENSSL_CRYPTO_LIBRARY "/usr/local/attestationssl/lib64/libcrypto.a" CACHE FILEPATH "")
set(OPENSSL_SSL_LIBRARY "/usr/local/attestationssl/lib64/libssl.a" CACHE FILEPATH "")

# Curl hints
set(CURL_INCLUDE_DIR "/usr/local/attestationcurl/include" CACHE PATH "")
set(CURL_LIBRARY "/usr/local/attestationcurl/lib/libcurl.a" CACHE FILEPATH "")
endif ()

add_library(${CMAKE_PROJECT_TARGET}
./src/accless.cpp
./src/dag.cpp
Expand All @@ -32,14 +56,16 @@ endif ()

# Common libraries and headers that support WASM and native compilation
add_subdirectory(./libs/jwt/cpp-bindings)
add_subdirectory(./libs/rabe/cpp-bindings)
add_subdirectory(./libs/abe4/cpp-bindings)
add_subdirectory(./libs/base64)

set(ACCLESS_COMMON_HEADERS
${CMAKE_CURRENT_LIST_DIR}/include
${CMAKE_CURRENT_LIST_DIR}/libs/jwt/cpp-bindings
${CMAKE_CURRENT_LIST_DIR}/libs/rabe/cpp-bindings
${CMAKE_CURRENT_LIST_DIR}/libs/abe4/cpp-bindings
${CMAKE_CURRENT_LIST_DIR}/libs/base64
)
set(ACCLESS_COMMON_LIBRARIES accless::jwt accless::rabe)
set(ACCLESS_COMMON_LIBRARIES accless::jwt accless::abe4 accless::base64)

if (CMAKE_SYSTEM_NAME STREQUAL "WASI")
# The WASM version of the library relies on a pre-populated sysroot as part
Expand All @@ -56,6 +82,8 @@ else ()
/usr/local/attestationssl/lib64
)

target_compile_options(${CMAKE_PROJECT_TARGET} PRIVATE -Wno-deprecated-declarations)

# The WASM version of the attestation and S3 libraries is part of Faasm
# because it needs to execute (partially) outside of the WASM module
# and outside of the enclave
Expand Down Expand Up @@ -91,3 +119,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "WASI")
endif ()

add_library(accless::accless ALIAS accless)

if (NOT CMAKE_SYSTEM_NAME STREQUAL "WASI")
add_subdirectory(tests)
endif()
13 changes: 13 additions & 0 deletions accless/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Accless Core Library

To build:

```bash
accli docker run --mount --cwd /code/accless/accless python3 build.py [-- --clean]
```

To test:

```bash
accli docker run --mount --cwd /code/accless/accless/build-native ctest -- --output-on-failure
```
Loading