Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add notes on requirements to run example #13

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ miniSTARK allows you to prove the integrity of arbitrary computations to anyone

In this example the prover generates a proof that proves integrity of a brainf**k program that outputs "Hello World". The verifier uses the proof, brainf\*\*k source code and output to verify execution integrity without executing the program at all. To run this demo locally:

### Prerequisites to run example
- Ensure `echo $CC` returns `gcc` #prerequisites i.e apples gcc distributed with xcode and
- Ensure `which gcc` returns `/usr/bin/gcc` (MacOSX users)
Comment on lines +28 to +29
Copy link
Owner

Choose a reason for hiding this comment

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

Thanks. Damn. I had no idea $CC and gcc needed to be configured. Just thought xcrun would handle choosing the right stuff. Out of curiosity what happened when these were not configured?

Copy link
Author

Choose a reason for hiding this comment

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

I'm maybe a little odd :) running gcc-11 because I use some stuff with my neovim that needs it. I would imagine typically this might not be an issue. Afaik typically CC=gcc for standard macos install.

Here is the full trace

❯ $HOME/.cargo/bin/cargo +nightly run -r -F parallel,asm,gpu --example brainfuck -- prove ./examples/brainfuck/hello_world.bf --dst ./hello_world.proof
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /Users/admin/Git_Downloads/Web3/Projects/ministark/gpu-poly/Cargo.toml
workspace: /Users/admin/Git_Downloads/Web3/Projects/ministark/Cargo.toml
warning: /Users/admin/Git_Downloads/Web3/Projects/ministark/gpu-poly/Cargo.toml: unused manifest key: target.cfg(target_arch = "aarch64").bench
   Compiling serde v1.0.147
   Compiling objc_exception v0.1.2
   Compiling ark-ff v0.3.0 (https://github.com/arkworks-rs/algebra#a4362f92)
   Compiling thiserror v1.0.37
   Compiling textwrap v0.11.0
   Compiling plotters-svg v0.3.3
   Compiling clap_lex v0.2.4
   Compiling heck v0.3.3
   Compiling indexmap v1.9.1
   Compiling ciborium-ll v0.2.0
The following warnings were emitted during compilation:

warning: extern/exception.m: In function 'RustObjCExceptionThrow':
warning: extern/exception.m:5:5: error: '-fobjc-exceptions' is required to enable Objective-C exception syntax
warning:     5 |     @throw exception;
warning:       |     ^~~~~~
warning: extern/exception.m:4:32: warning: parameter 'exception' set but not used [-Wunused-but-set-parameter]
warning:     4 | void RustObjCExceptionThrow(id exception) {
warning:       |                             ~~~^~~~~~~~~

error: failed to run custom build command for `objc_exception v0.1.2`

Caused by:
  process didn't exit successfully: `/Users/admin/Git_Downloads/Web3/Projects/ministark/target/release/build/objc_exception-34f6154be5fcf3f7/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("aarch64-apple-darwin")
  OPT_LEVEL = Some("3")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_aarch64-apple-darwin
  CC_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CC_aarch64_apple_darwin
  CC_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("gcc-11")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-apple-darwin
  CFLAGS_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_apple_darwin
  CFLAGS_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,vh")
  running: "gcc-11" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-Wall" "-Wextra" "-o" "/Users/admin/Git_Downloads/Web3/Projects/ministark/target/release/build/objc_exception-ab1b56d750c21f1f/out/extern/exception.o" "-c" "extern/exception.m"
  cargo:warning=extern/exception.m: In function 'RustObjCExceptionThrow':
  cargo:warning=extern/exception.m:5:5: error: '-fobjc-exceptions' is required to enable Objective-C exception syntax
  cargo:warning=    5 |     @throw exception;
  cargo:warning=      |     ^~~~~~
  cargo:warning=extern/exception.m:4:32: warning: parameter 'exception' set but not used [-Wunused-but-set-parameter]
  cargo:warning=    4 | void RustObjCExceptionThrow(id exception) {
  cargo:warning=      |                             ~~~^~~~~~~~~
  exit status: 1

  --- stderr


  error occurred: Command "gcc-11" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-Wall" "-Wextra" "-o" "/Users/admin/Git_Downloads/Web3/Projects/ministark/target/release/build/objc_exception-ab1b56d750c21f1f/out/extern/exception.o" "-c" "extern/exception.m" with args "gcc-11" did not execute successfully (status code exit status: 1).


warning: build failed, waiting for other jobs to finish...
zsh: exit 101   $HOME/.cargo/bin/cargo +nightly run -r -F parallel,asm,gpu --example brainfuc

- Ensure `which cargo` in PATH is the rustup (i.e not homebrew rust install.. etc) version, should return $HOME/.cargo/bin/cargo

```bash

Ensure $CC = gcc `echo $CC` i.e apples gcc distributed with xcode and `which gcc` points to /usr/bin/gcc (MacOSX users)
Ensure cargo is the rustup (i.e not homebrew rust install.. etc) version `which cargo` should point to $HOME/.cargo/bin/cargo

# compile shaders (M1 Mac only)
# make sure the latest Xcode is installed
(cd gpu-poly && make)
Expand Down Expand Up @@ -99,4 +108,4 @@ The representation of constraints in miniSTARK is much closer to a representatio

- [StarkWare](https://starkware.co/) - The company started by the people who invented STARKs. There are so many great things to learn from the people at this company. It's great how public and open their educational material is. Check out: GOAT Eli Ben-Sasson's [STARK math thread](https://twitter.com/EliBenSasson/status/1578380154476208131), Cairo whitepaper ([Video](https://www.youtube.com/watch?v=DTVn0oYLVsE), [PDF](https://eprint.iacr.org/2021/1063.pdf)), [DEEP Method Medium article](https://medium.com/starkware/starkdex-deep-dive-the-stark-core-engine-497942d0f0ab).
- [Alan Szepieniec](https://twitter.com/aszepieniec?lang=en) - The [Anatomy of a STARK](https://aszepieniec.github.io/stark-anatomy/) tutorial is (IMHO) the best end-to-end practical resource to understand STARKs. Read through this and the magic of STARKs will start to make sense. [BrainSTARK](https://aszepieniec.github.io/stark-brainfuck/brainfuck) is a fantastic sequel to the STARK Anatomy tutorial and is a practical guide to creating an AIR that proves programs written in the Brainf**k programming language. Check out miniSTARK's [brainf\*\*k example](examples/brainfuck/) which is an implementation of the BrainSTARK AIR.
- [Winterfell](https://github.com/novifinancial/winterfell) - A STARK prover and verifier developed at Facebook by [Bobbin Threadbare](https://twitter.com/bobbinth) and others. This repo was heavily used as a reference for several components: fast Merkle Tree, DEEP composition polynomial, channels, and STARK component traits. Bobbin has some great HackMD articles: [Miden VM program decoder](https://hackmd.io/_aaDBzbWRz6EwQQRtK1pzw), [Memory in Miden VM](https://hackmd.io/@bobbinth/HJr56BKKt), [u32 operations in Miden VM](https://hackmd.io/NC-yRmmtRQSvToTHb96e8Q#u32-operations-in-Miden-VM).
- [Winterfell](https://github.com/novifinancial/winterfell) - A STARK prover and verifier developed at Facebook by [Bobbin Threadbare](https://twitter.com/bobbinth) and others. This repo was heavily used as a reference for several components: fast Merkle Tree, DEEP composition polynomial, channels, and STARK component traits. Bobbin has some great HackMD articles: [Miden VM program decoder](https://hackmd.io/_aaDBzbWRz6EwQQRtK1pzw), [Memory in Miden VM](https://hackmd.io/@bobbinth/HJr56BKKt), [u32 operations in Miden VM](https://hackmd.io/NC-yRmmtRQSvToTHb96e8Q#u32-operations-in-Miden-VM).