Skip to content

Commit

Permalink
Merge branch 'main' into factorize-compute-program-hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 authored Jan 21, 2025
2 parents a02df62 + 7b1b656 commit 67e1fc9
Show file tree
Hide file tree
Showing 43 changed files with 799 additions and 659 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ Thumbs.db
.git
.gitignore

Dockerfile
Dockerfile
29 changes: 21 additions & 8 deletions .github/workflows/cargo_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,28 @@ jobs:
- name: Run tests
run: cargo test --all

- name: Dry run
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: |
cargo publish --dry-run -p swiftness_transcript --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml
cargo publish --dry-run -p swiftness_pow --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml
cargo publish --dry-run -p swiftness_commitment --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml
cargo publish --dry-run -p swiftness_fri --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml
cargo publish --dry-run -p swiftness_air --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml
cargo publish --dry-run -p swiftness_stark --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml
cargo publish --dry-run -p swiftness_proof_parser --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR_PROOF_PARSER }}/Cargo.toml
cargo publish --dry-run -p swiftness --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR_CLI }}/Cargo.toml
- name: Publish crates to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: |
cargo publish -p swiftness_transcript --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml
cargo publish -p swiftness_pow --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml
cargo publish -p swiftness_commitment --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml
cargo publish -p swiftness_fri --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml
cargo publish -p swiftness_air --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml
cargo publish -p swiftness_stark --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml
cargo publish -p swiftness_proof_parser --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR_PROOF_PARSER }}/Cargo.toml
cargo publish -p swiftness --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR_CLI }}/Cargo.toml
cargo publish -p swiftness_transcript --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml || true
cargo publish -p swiftness_pow --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml || true
cargo publish -p swiftness_commitment --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml || true
cargo publish -p swiftness_fri --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml || true
cargo publish -p swiftness_air --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml || true
cargo publish -p swiftness_stark --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR }}/Cargo.toml || true
cargo publish -p swiftness_proof_parser --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR_PROOF_PARSER }}/Cargo.toml || true
cargo publish -p swiftness --token $CARGO_REGISTRY_TOKEN --manifest-path ${{ env.WORKING_DIR_CLI }}/Cargo.toml || true
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Run verification
run: cargo run -r --bin swiftness --features ${{ matrix.layout }},stone5,keccak_160_lsb --no-default-features -- --proof ${{ env.PROOFS_DIR }}/${{ matrix.layout }}/cairo0_stone5_example_proof.json
working-directory: ${{ env.WORKING_DIR }}

verify-proofs-stone6-blake2s-248-lsb:
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -143,7 +143,13 @@ jobs:
layout: ["dynamic"]
hash: ["blake2s_248_lsb"]
stone: ["stone5"]
target: ["armebv7r-none-eabi", "riscv64imac-unknown-none-elf", "aarch64-unknown-none-softfloat", "aarch64-unknown-none"]
target:
[
"armebv7r-none-eabi",
"riscv64imac-unknown-none-elf",
"aarch64-unknown-none-softfloat",
"aarch64-unknown-none",
]

env:
WORKING_DIR: ${{ github.workspace }}/examples/no_std_build
Expand Down Expand Up @@ -178,7 +184,7 @@ jobs:
working-directory: ${{ env.WORKING_DIR }}

- name: Build project
run: cargo build -r --features ${{ matrix.layout }},${{ matrix.hash }},${{ matrix.stone }} --no-default-features --target ${{ matrix.target }}
run: cargo build -Zbuild-std=core,alloc -r --features ${{ matrix.layout }},${{ matrix.hash }},${{ matrix.stone }} --no-default-features --target ${{ matrix.target }}
working-directory: ${{ env.WORKING_DIR }}

- name: Print binary metadata
Expand Down
75 changes: 36 additions & 39 deletions .github/workflows/npm_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,21 @@ name: Manual Publish to npm

on:
workflow_dispatch:
inputs:
dry_run:
description: "Run npm publish as a dry run (true) or publish directly (false)"
required: true
default: true

jobs:
publish:
runs-on: ubuntu-latest

env:
WORKING_DIR: ${{ github.workspace }}/wasm_bindings

strategy:
fail-fast: false
matrix:
layout:
[
"dex",
"dynamic",
"recursive",
"recursive_with_poseidon",
"small",
"starknet",
"starknet_with_keccak",
]
hash:
[
"keccak_160_lsb",
"keccak_248_lsb",
"blake2s_160_lsb",
"blake2s_248_lsb",
]
stone:
[
"stone5",
"stone6",
]

LAYOUTS: "dex dynamic recursive recursive_with_poseidon small starknet starknet_with_keccak"
HASHERS: "keccak_160_lsb keccak_248_lsb blake2s_160_lsb blake2s_248_lsb"
STONES: "stone5 stone6"

steps:
- name: Checkout repository
Expand All @@ -45,7 +26,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: "18"

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1

Expand Down Expand Up @@ -74,17 +55,33 @@ jobs:
- name: Install wasm-pack
run: cargo install wasm-pack

- name: Build package
run: wasm-pack build --out-dir pkg --target web --features ${{ matrix.layout }},${{ matrix.hash }},${{ matrix.stone }} --no-default-features
- name: Build WASM packages
run: |
for layout in $LAYOUTS; do
for hasher in $HASHERS; do
for stone in $STONES; do
output_dir="src/pkg/swiftness_${layout}_${hasher}_${stone}"
features="${layout},${hasher},${stone}"
echo "Building WASM package with layout=$layout, hasher=$hasher, stone=$stone"
wasm-pack build --out-dir "$output_dir" --target web --features "$features" --no-default-features
# Clean up unnecessary files
rm -f "$output_dir/.gitignore"
rm -f "$output_dir/README.md"
done
done
done
working-directory: ${{ env.WORKING_DIR }}

- name: Rename package
- name: Publish to npm (dry run or actual)
run: |
jq --arg layout "${{ matrix.layout }}" --arg hash "${{ matrix.hash }}" --arg stone "${{ matrix.stone }}" \
'.name = "swiftness-\($layout | gsub("_"; "-"))-\($hash | gsub("_"; "-"))-\($stone | gsub("_"; "-"))"' \
package.json > tmp.json && mv tmp.json package.json
working-directory: ${{ env.WORKING_DIR }}/pkg

- name: Publish to npm
run: npm publish
working-directory: ${{ env.WORKING_DIR }}/pkg
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
echo "Running npm publish in dry run mode"
npm publish --dry-run
else
echo "Publishing to npm"
npm publish
fi
working-directory: ${{ env.WORKING_DIR }}
Loading

0 comments on commit 67e1fc9

Please sign in to comment.