diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml index 664356a5..2ca4bff2 100644 --- a/.github/workflows/ghcr.yml +++ b/.github/workflows/ghcr.yml @@ -37,7 +37,8 @@ jobs: id: meta-all uses: docker/metadata-action@v3 with: - images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }} + images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}/stone-prover + - name: Prover&Verifier image build & push uses: docker/build-push-action@v3 with: @@ -56,7 +57,7 @@ jobs: id: meta uses: docker/metadata-action@v3 with: - images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}-prover + images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}/cpu_air_prover - name: Prover image build & push uses: docker/build-push-action@v3 with: @@ -74,7 +75,7 @@ jobs: id: meta-ver uses: docker/metadata-action@v3 with: - images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}-verifier + images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}/cpu_air_verifier - name: Verifier image build & push uses: docker/build-push-action@v3 with: @@ -85,27 +86,3 @@ jobs: cache-to: type=gha,mode=max tags: ${{ steps.meta-ver.outputs.tags }} labels: ${{ steps.meta-ver.coutputs.labels }} - - #Release files - - - name: Extract binary from Docker image - run: | - container_id=$(docker create ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}:pr-3) - docker cp $container_id:/usr/bin/cpu_air_prover . - docker cp $container_id:/usr/bin/cpu_air_verifier . - docker rm $container_id - - - name: Verify file existence#1 - run: pwd - - - name: Verify file existence#2 - run: ls -l - - - name: Upload files to a GitHub release - uses: svenstaro/upload-release-action@2.4.0 - with: - file_glob: true - overwrite: true - tag: ${{ github.ref }} - file: /home/runner/work/stone-packaging/stone-packaging/cpu_air* - repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..1ce21fc7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,62 @@ +name: release + +on: + push: + tags: + - 'v*.*.*' + +jobs: + build: + name: Docker images for ghcr.io + runs-on: ubuntu-latest + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + DOCKER_REGISTRY: ghcr.io + DOCKER_IMAGE_BASE: ${{ github.repository }} + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the registry + uses: docker/login-action@v2 + with: + registry: ${{ env.DOCKER_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Prover and Verifier + + - name: Prover&Verifier image tags & labels + id: meta-all + uses: docker/metadata-action@v3 + with: + images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }} + - name: Prover&Verifier image build & push + uses: docker/build-push-action@v3 + with: + context: . + file: Dockerfile + push: true + cache-from: type=gha + cache-to: type=gha,mode=max + tags: ${{ steps.meta-all.outputs.tags }} + labels: ${{ steps.meta-all.coutputs.labels }} + + - name: Extract binary from Docker image + run: | + container_id=$(docker create ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}:pr-3) + docker cp $container_id:/usr/bin/cpu_air_prover /tmp/cpu_air_prover + docker cp $container_id:/usr/bin/cpu_air_verifier /tmp/cpu_air_verifier + docker rm $container_id + + - name: Verify file existence#2 + run: ls -l /tmp/cpu* + + - name: Upload files to a GitHub release + id: create_release + uses: softprops/action-gh-release@v2 + with: + files: /tmp/cpu_air* diff --git a/README.md b/README.md index 873ad35d..a9e93e4e 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,95 @@ Follow-up work: - Integrated proof decomposition (related to https://github.com/zksecurity/stark-evm-adapter) - Observability suite (metrics, dashboard, configurable logging) - Stwo support + +# Instructions for use + +## Download binaries for x86_64 + +1) Find the latest release version. +2) Download the necessary binaries. For example: + +```bash +wget https://github.com/dipdup-io/stone-packaging/releases/download/v2.0.1/cpu_air_prover +wget https://github.com/dipdup-io/stone-packaging/releases/download/v2.0.1/cpu_air_verifier +``` + +Make the downloaded file executable. + +```bash +chmod +x cpu_air_prover +``` + +### Creating and verifying a test proof using binaries + +Clone the repository: + +```bash +git clone https://github.com/dipdup-io/stone-packaging.git +``` + +Navigate to the example test directory (`test_files/`): + +```bash +cd test_files/ +``` + +Copy or download from latest release the binary files to this directory. + +Run the prover: +```bash +./cpu_air_prover \ + --out_file=fibonacci_proof.json \ + --private_input_file=fibonacci_private_input.json \ + --public_input_file=fibonacci_public_input.json \ + --prover_config_file=cpu_air_prover_config.json \ + --parameter_file=cpu_air_params.json +``` + +The proof is now available in the file `fibonacci_proof.json`. + +Finally, run the verifier to verify the proof: +```bash +./cpu_air_verifier --in_file=fibonacci_proof.json && echo "Successfully verified example proof." +``` + +## Download minimal docker images for x86_64 + +Download the necessary package. Package stone-prover contains cpu_air_prover and cpu_air_verifier. For example: + +```bash +docker pull ghcr.io/dipdup-io/stone-packaging/stone-prover:latest +``` + +### Creating and verifying a test proof using docker images + +Clone the repository: + +```bash +git clone https://github.com/dipdup-io/stone-packaging.git +``` + +Navigate to the example test directory (`test_files/`): + +```bash +cd test_files/ +``` + +Run docker images with volume: + +```bash +docker run --entrypoint /bin/bash -v /your_directory/stone-packaging/test_files:/app/prover ghcr.io/dipdup-io/stone-packaging/stone-prover -c "cd /app/prover && exec cpu_air_prover \ + --out_file=fibonacci_proof.json \ + --private_input_file=fibonacci_private_input.json \ + --public_input_file=fibonacci_public_input.json \ + --prover_config_file=cpu_air_prover_config.json \ + --parameter_file=cpu_air_params.json" +``` + +The proof is now available in the file test_files/fibonacci_proof.json + +Run the verifier to verify the proof: + +```bash +docker run --entrypoint /bin/bash -v /your_directory/stone-packaging/test_files:/app/prover ghcr.io/dipdup-io/stone-packaging/stone-prover -c "cd /app/prover && exec cpu_air_verifier --in_file=fibonacci_proof.json && echo 'Successfully verified example proof.'" +``` diff --git a/test_files/fibonacci_private_input.json b/test_files/fibonacci_private_input.json index 15a9eddf..90f8549a 100644 --- a/test_files/fibonacci_private_input.json +++ b/test_files/fibonacci_private_input.json @@ -1,6 +1,6 @@ { - "trace_path": "/home/zaariel/stone-prover/test_files/fibonacci_trace.json", - "memory_path": "/home/zaariel/stone-prover/test_files/fibonacci_memory.json", + "trace_path": "./fibonacci_trace.json", + "memory_path": "./fibonacci_memory.json", "pedersen": [], "range_check": [], "ecdsa": []