-
Notifications
You must be signed in to change notification settings - Fork 607
chore: Refactor Cli interface to be more unix-like #1833
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
cb98db7
communication:
kevaundray e564651
restore deleted file -- This adds the methods for writing to stdout
kevaundray 9730257
rename vinfo.hpp to log.hpp
kevaundray ba6626d
fix imports
kevaundray 1de1484
info -> vinfo
kevaundray 533d52a
Update circuits/cpp/barretenberg/cpp/src/barretenberg/bb/log.hpp
kevaundray b3c079c
Update circuits/cpp/barretenberg/cpp/src/barretenberg/bb/log.hpp
kevaundray 830399c
formatting
kevaundray 90e7995
document proc_exit for prove_and_verify
kevaundray 4bcfd77
Merge branch 'master' into kw/fix-print-to-stdout
kevaundray 9a467c0
add small readme
kevaundray 6fb93c5
modify ts code to match cpp code
kevaundray c60029f
prettier
kevaundray 7ab8ffa
Merge branch 'master' into kw/fix-print-to-stdout
kevaundray b5d06a7
Update circuits/cpp/barretenberg/cpp/src/barretenberg/bb/readme.md
kevaundray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| #pragma once | ||
| #include <barretenberg/common/log.hpp> | ||
| #include <iostream> | ||
|
|
||
| extern bool verbose; | ||
|
|
||
| template <typename... Args> inline void vinfo(Args... args) | ||
| { | ||
| if (verbose) { | ||
| info(args...); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @brief Writes raw bytes of the vector to stdout | ||
| * | ||
| * Note: std::cout << byte is not being used here because that always prints the numerical value. | ||
| * << can also apply formatting and seems is not the appropriate way to write raw bytes to stdout. | ||
| * | ||
| * Example: | ||
| * | ||
| * uint8_t byte = 'A' | ||
| * std::cout << byte; // prints 65 | ||
| * std::cout.put(byte); // prints 'A' | ||
| * | ||
| * @param data The raw bytes that we want to write to stdout | ||
| */ | ||
| inline void writeRawBytesToStdout(const std::vector<uint8_t>& data) | ||
| { | ||
| for (auto byte : data) { | ||
| // Safety: a byte and a char occupy one byte | ||
| std::cout.put(static_cast<char>(byte)); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @brief Writes a uint64_t to stdout in little endian format | ||
| * | ||
| * @param value The value to be written to stdout | ||
| */ | ||
| inline void writeUint64AsRawBytesToStdout(uint64_t value) | ||
| { | ||
| // Convert the uint64_t to a vector of bytes, since std::cout.put | ||
| // only accepts a single byte. | ||
| std::vector<uint8_t> bytes; | ||
| bytes.reserve(sizeof(uint64_t)); | ||
|
|
||
| for (size_t i = 0; i < sizeof(uint64_t); ++i) { | ||
| bytes.push_back(static_cast<uint8_t>(value & 0xFF)); | ||
| value >>= 8; | ||
| } | ||
|
|
||
| writeRawBytesToStdout(bytes); | ||
| } | ||
|
|
||
| /** | ||
| * @brief Writes a sting to stdout | ||
| * | ||
| * @param str The raw string to write to stdout | ||
| */ | ||
| inline void writeStringToStdout(const std::string& str) | ||
| { | ||
| for (char ch : str) { | ||
| std::cout.put(ch); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
circuits/cpp/barretenberg/cpp/src/barretenberg/bb/readme.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # BB | ||
|
|
||
| ## Why is this needed? | ||
|
|
||
| Barretenberg is a library that allows one to create and verify proofs. One way to specify the circuit that one will use to create and verify | ||
| proofs over is to use the Barretenberg standard library. Another way, which pertains to this module is to supply the circuit description using | ||
| an IR called [ACIR](https://github.com/noir-lang/acvm). This binary will take as input ACIR and witness values described in the IR to create proofs. | ||
|
|
||
|
|
||
| ## FilePath vs Stdout | ||
|
|
||
| For commands which allow you to send the output to a file using `-o {filePath}`, there is also the option to send the output to stdout by using `-o -`. | ||
|
|
||
| ## Maximum Circuit Size | ||
|
|
||
| Currently the binary downloads an SRS that can be used to prove the maximum circuit size. This maximum circuit size parameter is a constant in the code and has been set to $2^{23}$ as of writing. This maximum circuit size differs from the maximum circuit size that one can prove in the browser, due to WASM limits. |
11 changes: 0 additions & 11 deletions
11
circuits/cpp/barretenberg/cpp/src/barretenberg/bb/vinfo.hpp
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.