-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Refactor Cli interface to be more unix-like (#1833)
resolves #1828 # Checklist: Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge. - [ ] If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag. - [ ] I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code. - [ ] Every change is related to the PR description. - [ ] I have [linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) this pull request to relevant issues (if any exist).
- Loading branch information
1 parent
88940be
commit 28d722e
Showing
6 changed files
with
174 additions
and
62 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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