-
Notifications
You must be signed in to change notification settings - Fork 103
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
feat: Initial native version of bb binary. #524
Conversation
inline std::vector<uint8_t> get_bytecode(const std::string& jsonPath) | ||
{ | ||
std::string command = | ||
"awk -F'\"bytecode\":' '{print $2}' " + jsonPath + " | awk -F'\"' '{print $2}' | base64 -d | gunzip"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This essentially stops us executing on Windows ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not on WSL? Current thinking is on windows we just target WSL, but yes I suppose if we want full native builds we need a mingw cross-compile and to rethink the above. Not sure if worth it if most devs have WSL installed.
size_t g1_start = 28; | ||
size_t g1_end = g1_start + num_points * 64 - 1; | ||
std::string command = "curl -s -H \"Range: bytes=" + std::to_string(g1_start) + "-" + std::to_string(g1_end) + | ||
"\" 'https://aztec-ignition.s3.amazonaws.com/MAIN%20IGNITION/monomial/transcript00.dat'"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we need to consider transcript01.dat..transcript02.dat as well ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, this won't work beyond 2^19 for now, but we've set max circuit size for now even for this binary as 2^19. Just a first pass at getting something in.
if (command == "prove_and_verify") { | ||
proveAndVerify(json_path, witness_path, recursive); | ||
} else if (command == "prove") { | ||
std::string output_path = getOption(args, "-o", "./proofs/proof"); | ||
prove(json_path, witness_path, recursive, output_path); | ||
} else if (command == "gates") { | ||
gateCount(json_path); | ||
} else if (command == "verify") { | ||
verify(proof_path, recursive, vk_path); | ||
} else if (command == "contract") { | ||
std::string output_path = getOption(args, "-o", "./target/contract.sol"); | ||
contract(output_path, vk_path); | ||
} else if (command == "write_vk") { | ||
std::string output_path = getOption(args, "-o", "./target/vk"); | ||
writeVk(json_path, output_path); | ||
} else if (command == "proof_as_fields") { | ||
std::string output_path = getOption(args, "-o", proof_path + "_fields.json"); | ||
proofAsFields(proof_path, vk_path, output_path); | ||
} else if (command == "vk_as_fields") { | ||
std::string output_path = getOption(args, "-o", vk_path + "_fields.json"); | ||
vkAsFields(vk_path, output_path); | ||
} else { | ||
std::cerr << "Unknown command: " << command << "\n"; | ||
return -1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are essentially public API's wonder if they could get abstracted away so they would be callable from wasm ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean by callable from wasm. This binary is not meant to be used in/from any wasm context?
Description
Just as bb.js provides an architecture agnostic cli prover/verifier, we probably want a native build that follows the same cli args for when we can target the native arch. This overcomes the 512k gate limit and is probably about 5x faster.
This is an initial implementation of the native
bb
executable.Todo:
.bb.js
and.bb
folder where they store their backend specific info.awk
gunzip
base64
andcurl
. This should serve linux and mac fine, and probably WSL.usage
info.