Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion barretenberg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ bb write_vk --scheme ultra_honk -b ./target/hello_world.json -o ./target/vk
You can now use the verification key to generate a Solidity verifier contract:

```bash
bb write_contract --scheme ultra_honk -k ./target/vk -c $CRS_PATH -b ./target/hello_world.json -o ./target/Verifier.sol
bb write_solidity_verifier --scheme ultra_honk -k ./target/vk -c $CRS_PATH -b ./target/hello_world.json -o ./target/Verifier.sol
```

> [!CAUTION]
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/acir_tests/flows/sol_honk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export VERIFIER_CONTRACT="$outdir/Verifier.sol"
# Create a proof, write the solidity contract, write the proof as fields in order to extract the public inputs
$BIN prove $PROVE_FLAGS -o $outdir
$BIN verify $VERIFY_FLAGS -k $VK -p $PROOF
$BIN write_contract $FLAGS -k $VK -o $VERIFIER_CONTRACT
$BIN write_solidity_verifier $FLAGS -k $VK -o $VERIFIER_CONTRACT

# Export the paths to the environment variables for the js test runner
export VERIFIER_PATH="$outdir/Verifier.sol"
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/acir_tests/flows/sol_honk_zk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export VERIFIER_CONTRACT="$outdir/Verifier.sol"
# Create a proof, write the solidity contract, write the proof as fields in order to extract the public inputs
$BIN prove -o $outdir $FLAGS $BFLAG $PROTOCOL_FLAGS --output_format bytes_and_fields --write_vk
$BIN verify -k $VK -p $PROOF $FLAGS $PROTOCOL_FLAGS
$BIN write_contract $FLAGS -k $VK -o $VERIFIER_CONTRACT --zk
$BIN write_solidity_verifier $FLAGS -k $VK -o $VERIFIER_CONTRACT --zk

# Export the paths to the environment variables for the js test runner
export VERIFIER_PATH="$outdir/Verifier.sol"
Expand Down
6 changes: 3 additions & 3 deletions barretenberg/cpp/src/barretenberg/api/api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ class API {

virtual void gates(const Flags& flags, const std::filesystem::path& bytecode_path) = 0;

virtual void write_contract(const Flags& flags,
const std::filesystem::path& output_path,
const std::filesystem::path& vk_path) = 0;
virtual void write_solidity_verifier(const Flags& flags,
const std::filesystem::path& output_path,
const std::filesystem::path& vk_path) = 0;
};
} // namespace bb
6 changes: 3 additions & 3 deletions barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ void ClientIVCAPI::gates([[maybe_unused]] const Flags& flags,
gate_count_for_ivc(bytecode_path);
}

void ClientIVCAPI::write_contract([[maybe_unused]] const Flags& flags,
[[maybe_unused]] const std::filesystem::path& output_path,
[[maybe_unused]] const std::filesystem::path& vk_path)
void ClientIVCAPI::write_solidity_verifier([[maybe_unused]] const Flags& flags,
[[maybe_unused]] const std::filesystem::path& output_path,
[[maybe_unused]] const std::filesystem::path& vk_path)
{
throw_or_abort("API function contract not implemented");
}
Expand Down
6 changes: 3 additions & 3 deletions barretenberg/cpp/src/barretenberg/api/api_client_ivc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class ClientIVCAPI : public API {

void gates(const Flags& flags, const std::filesystem::path& bytecode_path) override;

void write_contract(const Flags& flags,
const std::filesystem::path& output_path,
const std::filesystem::path& vk_path) override;
void write_solidity_verifier(const Flags& flags,
const std::filesystem::path& output_path,
const std::filesystem::path& vk_path) override;

void write_vk(const Flags& flags,
const std::filesystem::path& bytecode_path,
Expand Down
6 changes: 3 additions & 3 deletions barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ void UltraHonkAPI::gates([[maybe_unused]] const Flags& flags,
gate_count(bytecode_path, flags.recursive, flags.honk_recursion);
}

void UltraHonkAPI::write_contract(const Flags& flags,
const std::filesystem::path& output_path,
const std::filesystem::path& vk_path)
void UltraHonkAPI::write_solidity_verifier(const Flags& flags,
const std::filesystem::path& output_path,
const std::filesystem::path& vk_path)
{
using VK = UltraKeccakFlavor::VerificationKey;
auto vk = std::make_shared<VK>(from_buffer<VK>(read_file(vk_path)));
Expand Down
6 changes: 3 additions & 3 deletions barretenberg/cpp/src/barretenberg/api/api_ultra_honk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class UltraHonkAPI : public API {

void gates(const Flags& flags, const std::filesystem::path& bytecode_path) override;

void write_contract(const Flags& flags,
const std::filesystem::path& output_path,
const std::filesystem::path& vk_path) override;
void write_solidity_verifier(const Flags& flags,
const std::filesystem::path& output_path,
const std::filesystem::path& vk_path) override;
};

template <typename Flavor>
Expand Down
24 changes: 12 additions & 12 deletions barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,21 +319,21 @@ int main(int argc, char* argv[])
add_recursive_flag(verify);

/***************************************************************************************************************
* Subcommand: write_contract
* Subcommand: write_solidity_verifier
***************************************************************************************************************/
CLI::App* write_contract =
app.add_subcommand("write_contract",
"Write a smart contract suitable for verifying proofs of circuit "
CLI::App* write_solidity_verifier =
app.add_subcommand("write_solidity_verifier",
"Write a Solidity smart contract suitable for verifying proofs of circuit "
"satisfiability for the circuit with verification key at vk_path. Not all "
"hash types are implemented due to efficiency concerns.");

add_scheme_option(write_contract);
add_vk_path_option(write_contract);
add_output_path_option(write_contract, output_path);
add_scheme_option(write_solidity_verifier);
add_vk_path_option(write_solidity_verifier);
add_output_path_option(write_solidity_verifier, output_path);

add_verbose_flag(write_contract);
add_zk_option(write_contract);
add_crs_path_option(write_contract);
add_verbose_flag(write_solidity_verifier);
add_zk_option(write_solidity_verifier);
add_crs_path_option(write_solidity_verifier);

/***************************************************************************************************************
* Subcommand: OLD_API
Expand Down Expand Up @@ -669,8 +669,8 @@ int main(int argc, char* argv[])
if (verify->parsed()) {
return api.verify(flags, proof_path, vk_path) ? 0 : 1;
}
if (write_contract->parsed()) {
api.write_contract(flags, output_path, vk_path);
if (write_solidity_verifier->parsed()) {
api.write_solidity_verifier(flags, output_path, vk_path);
return 0;
}
auto subcommands = app.get_subcommands();
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/bb/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Barretenberg UltraHonk comes with the capability to verify proofs in Solidity, i
**WARNING:** Contract incomplete, do not use in production!

```bash
bb write_contract --scheme ultra_honk -k ./target/vk -b ./target/hello_world.json -o ./target/Verifier.sol
bb write_solidity_verifier --scheme ultra_honk -k ./target/vk -b ./target/hello_world.json -o ./target/Verifier.sol
```

#### Usage with MegaHonk
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/noir-protocol-circuits/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function compile {
local verifier_path="$key_dir/${name}_verifier.sol"
SECONDS=0
# Generate solidity verifier for this contract.
echo "$vk_bytes" | xxd -r -p | $BB write_contract --scheme ultra_honk -k - -o $verifier_path
echo "$vk_bytes" | xxd -r -p | $BB write_solidity_verifier --scheme ultra_honk -k - -o $verifier_path
echo_stderr "VK output at: $verifier_path (${SECONDS}s)"
# Include the verifier path if we create it.
cache_upload vk-$hash.tar.gz $key_path $verifier_path &> /dev/null
Expand Down
Loading