Skip to content

Commit a524776

Browse files
authored
Merge pull request #3414 from o1-labs/dw/no-std
feat: add no-std feature to mina-hasher, mina-poseidon, and mina-signer
2 parents 110fcbc + e749e97 commit a524776

File tree

20 files changed

+132
-68
lines changed

20 files changed

+132
-68
lines changed

.github/workflows/ci-lint.yml

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -63,30 +63,5 @@ jobs:
6363
run: |
6464
# Load OCaml environment
6565
eval $(opam env)
66-
67-
# List of crates to exclude (not yet fixed for this Rust version)
68-
# Remove crates from this list as they are fixed.
69-
# See https://github.com/o1-labs/mina-rust/issues/1926 for tracking.
70-
EXCLUDED_CRATES=(
71-
)
72-
73-
# Count workspace members
74-
WORKSPACE_MEMBERS=$(cargo metadata --no-deps --format-version 1 | jq '.packages | length')
75-
EXCLUDED_COUNT=${#EXCLUDED_CRATES[@]}
76-
7766
echo "Rust toolchain: ${{ matrix.rust_toolchain }}"
78-
echo "Workspace has $WORKSPACE_MEMBERS crates, excluding $EXCLUDED_COUNT"
79-
80-
if [ "$WORKSPACE_MEMBERS" -eq "$EXCLUDED_COUNT" ]; then
81-
echo "All crates are excluded, nothing to lint."
82-
exit 0
83-
fi
84-
85-
# Build the exclude arguments
86-
EXCLUDE_ARGS=""
87-
for crate in "${EXCLUDED_CRATES[@]}"; do
88-
EXCLUDE_ARGS="$EXCLUDE_ARGS --exclude $crate"
89-
done
90-
91-
# Run clippy with exclusions
92-
cargo clippy --workspace $EXCLUDE_ARGS --all-features --all-targets -- -W clippy::all -D warnings
67+
make lint

.github/workflows/ci.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ jobs:
168168
run: |
169169
eval $(opam env)
170170
make test-doc
171-
- name: generate docs
171+
172+
- name: Generate docs
172173
run: |
173174
eval $(opam env)
174175
make generate-doc
@@ -209,8 +210,35 @@ jobs:
209210
github_token: ${{ secrets.GITHUB_TOKEN }}
210211
publish_dir: ./book/book/html
211212

213+
# Tracking issue: https://github.com/o1-labs/mina-rust/issues/1984
214+
no-std-check:
215+
name: "no_std: ${{ matrix.crate.name }}"
216+
needs: ['refresh-cache']
217+
runs-on: ubuntu-latest
218+
strategy:
219+
fail-fast: false
220+
matrix:
221+
crate:
222+
# Crates with no-std feature
223+
- { name: "mina-hasher", path: "hasher" } # https://github.com/o1-labs/mina-rust/issues/1994
224+
- { name: "mina-poseidon", path: "poseidon" } # https://github.com/o1-labs/mina-rust/issues/1996
225+
- { name: "mina-signer", path: "signer" } # https://github.com/o1-labs/mina-rust/issues/1995
226+
steps:
227+
- name: Checkout repository
228+
uses: actions/checkout@v6
229+
230+
- name: Use shared Rust toolchain setting up steps
231+
uses: ./.github/actions/toolchain-shared
232+
with:
233+
rust_toolchain_version: stable
234+
235+
- name: Check ${{ matrix.crate.name }} (no_std)
236+
run: |
237+
cd ${{ matrix.crate.path }}
238+
cargo check --no-default-features
239+
212240
build:
213-
needs: ['define-matrix', 'refresh-cache']
241+
needs: ['define-matrix', 'refresh-cache', 'no-std-check']
214242
strategy:
215243
matrix:
216244
rust_and_os: ${{ fromJSON(needs.define-matrix.outputs.matrix).include }}

.github/workflows/test-export-vectors.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Build export_test_vectors binary
4040
run: |
4141
eval $(opam env)
42-
cargo build --bin export_test_vectors --all-features
42+
cargo build --bin export_test_vectors
4343
4444
- name: Test export_test_vectors commands
4545
run: |
@@ -55,16 +55,21 @@ jobs:
5555
for output_format in $OUTPUT_FORMATS; do
5656
echo "Testing $format $mode --format $output_format..."
5757
if [ "$output_format" = "json" ]; then
58-
cargo run --bin export_test_vectors --all-features -- $format $mode /tmp/test_${format}_${mode}.json --format $output_format
58+
cargo run --bin export_test_vectors -- \
59+
$format $mode /tmp/test_${format}_${mode}.json \
60+
--format $output_format
5961
else
60-
cargo run --bin export_test_vectors --all-features -- $format $mode /tmp/test_${format}_${mode}.js --format $output_format
62+
cargo run --bin export_test_vectors -- \
63+
$format $mode /tmp/test_${format}_${mode}.js \
64+
--format $output_format
6165
fi
6266
done
6367
done
6468
done
6569
6670
echo "Testing stdout output..."
67-
cargo run --bin export_test_vectors --all-features -- b10 legacy - > /tmp/test_stdout.json
71+
cargo run --bin export_test_vectors -- b10 legacy - \
72+
> /tmp/test_stdout.json
6873
6974
- name: Verify output files
7075
run: |

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Skip macOS tests and docs jobs on PRs to improve CI velocity; macOS runs on master only
1515
([#3429](https://github.com/o1-labs/proof-systems/pull/3429),
1616
[o1-labs/mina-rust#2024](https://github.com/o1-labs/mina-rust/issues/2024))
17-
- Flag `test_lazy_mode_benchmark` as a heavy test to skip on regular CI runs ([#3430](https://github.com/o1-labs/proof-systems/pull/3430))
17+
- Flag `test_lazy_mode_benchmark` as a heavy test to skip on regular CI runs
18+
([#3430](https://github.com/o1-labs/proof-systems/pull/3430))
19+
- Add no-std compatibility check workflow that verifies crates compile with `--no-default-features`
20+
([#3414](https://github.com/o1-labs/proof-systems/pull/3414))
1821

1922
### [arrabbiata](./arrabbiata)
2023

0 commit comments

Comments
 (0)