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/.claude/skills/gate-counts/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ still valid. Discard stderr (`2>/dev/null`) to keep output clean.
- `-t, --verifier_target` — hash/ZK settings. Relevant values:
`noir-recursive` (poseidon2, ZK; default-ish for recursive noir circuits),
`noir-rollup` (IPA + poseidon2, ZK — required for rollup circuits),
plus `evm`, `starknet`, and `-no-zk` variants of each.
plus `evm` and `-no-zk` variants of each.
- `--include_gates_per_opcode` — adds a per-opcode breakdown.

## Proof-Size Assertion Failures
Expand Down
2 changes: 0 additions & 2 deletions barretenberg/acir_tests/bbjs-test/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ async function generateProof({
const witness = await fs.readFile(witnessPath);
const proof = await backend.generateProof(new Uint8Array(witness), {
keccakZK: oracleHash === 'keccakZK',
starknetZK: oracleHash === 'starknetZK',
});

await fs.writeFile(proofPath(outputDirectory), Buffer.from(proof.proof));
Expand All @@ -53,7 +52,6 @@ async function generateProof({

const verificationKey = await backend.getVerificationKey({
keccakZK: oracleHash === 'keccakZK',
starknetZK: oracleHash === 'starknetZK',
});
await fs.writeFile(vkeyPath(outputDirectory), Buffer.from(verificationKey));
logger.debug('Verification key written to ' + vkeyPath(outputDirectory));
Expand Down
2 changes: 0 additions & 2 deletions barretenberg/acir_tests/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ function test_cmds {
echo "$tests_hash $scripts/bb_prove.sh double_verify_honk_zk_proof --disable_zk"

echo "$tests_hash $scripts/bb_prove.sh assert_statement --oracle_hash keccak"
# If starknet enabled:
#echo "$tests_hash $scripts/bb_prove.sh assert_statement --oracle_hash starknet"
# Test rollup verification (rollup uses --ipa_accumulation)
echo "$tests_hash $scripts/bb_prove.sh verify_rollup_honk_proof --ipa_accumulation"
# Test root-rollup verification: outer circuit verifies two RollupHonk proofs and closes the IPA
Expand Down
1 change: 0 additions & 1 deletion barretenberg/cpp/scripts/test_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ llvm-cov-20 show \
-format=html \
-output-dir=build-coverage/coverage-report \
--ignore-filename-regex=".*/_deps/.*" \
--ignore-filename-regex=".*/ext/starknet/.*" \
--ignore-filename-regex=".*/lmdblib/.*" \
--ignore-filename-regex=".*/vm2/.*" \
"${args[@]}"
Expand Down
3 changes: 0 additions & 3 deletions barretenberg/cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ add_subdirectory(barretenberg/eccvm)
add_subdirectory(barretenberg/hypernova)
add_subdirectory(barretenberg/honk)
add_subdirectory(barretenberg/trace_to_polynomials)
add_subdirectory(barretenberg/ext/starknet/crypto)
add_subdirectory(barretenberg/ext/starknet/transcript)
add_subdirectory(barretenberg/flavor)
add_subdirectory(barretenberg/goblin)
add_subdirectory(barretenberg/goblin_avm)
Expand Down Expand Up @@ -168,7 +166,6 @@ set(BARRETENBERG_TARGET_OBJECTS
$<TARGET_OBJECTS:dsl_objects>
$<TARGET_OBJECTS:ecc_objects>
$<TARGET_OBJECTS:eccvm_objects>
$<TARGET_OBJECTS:ext_starknet_crypto_poseidon_objects>
$<TARGET_OBJECTS:trace_to_polynomials_objects>
$<TARGET_OBJECTS:flavor_objects>
$<TARGET_OBJECTS:goblin_objects>
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/api/api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class API {
bool ipa_accumulation{ false }; // indicate whether the command is doing IPA proof aggregation
std::string scheme; // the proving system or IVC scheme
std::string oracle_hash_type; // which hash function does the prover use as a random oracle?
std::string verifier_target; // target verification environment (evm, noir-recursive, starknet, etc.)
std::string verifier_target; // target verification environment (evm, noir-recursive, etc.)
bool write_vk{ false }; // should we addditionally write the verification key when writing the proof
bool include_gates_per_opcode{ false }; // should we include gates_per_opcode in the gates command output
bool slow_low_memory{ false }; // use file backed memory for polynomials
Expand Down
42 changes: 11 additions & 31 deletions barretenberg/cpp/src/barretenberg/bb/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ int parse_and_run_cli_command(int argc, char* argv[])
name += "\nAVM Transpiler: enabled";
#else
name += "\nAVM Transpiler: disabled";
#endif
#ifdef STARKNET_GARAGA_FLAVORS
name += "\nStarknet Garaga Extensions: enabled";
#else
name += "\nStarknet Garaga Extensions: disabled";
#endif
CLI::App app{ name };
argv = app.ensure_utf8(argv);
Expand Down Expand Up @@ -218,16 +213,14 @@ int parse_and_run_cli_command(int argc, char* argv[])

const auto add_oracle_hash_option = [&](CLI::App* subcommand) {
return subcommand
->add_option(
"--oracle_hash",
flags.oracle_hash_type,
"The hash function used by the prover as random oracle standing in for a verifier's challenge "
"generation. Poseidon2 is to be used for proofs that are intended to be verified inside of a "
"circuit. Keccak is optimized for verification in an Ethereum smart contract, where Keccak "
"has a privileged position due to the existence of an EVM precompile. Starknet is optimized "
"for verification in a Starknet smart contract, which can be generated using the Garaga library. "
"Prefer using --verifier_target instead.")
->check(CLI::IsMember({ "poseidon2", "keccak", "starknet" }).name("is_member"))
->add_option("--oracle_hash",
flags.oracle_hash_type,
"The hash function used by the prover as random oracle standing in for a verifier's challenge "
"generation. Poseidon2 is to be used for proofs that are intended to be verified inside of a "
"circuit. Keccak is optimized for verification in an Ethereum smart contract, where Keccak "
"has a privileged position due to the existence of an EVM precompile. "
"Prefer using --verifier_target instead.")
->check(CLI::IsMember({ "poseidon2", "keccak" }).name("is_member"))
->group(advanced_group);
};

Expand All @@ -243,18 +236,10 @@ int parse_and_run_cli_command(int argc, char* argv[])
" noir-recursive Noir circuits (poseidon2, ZK)\n"
" noir-recursive-no-zk Noir circuits without ZK\n"
" noir-rollup Rollup with IPA (poseidon2, ZK)\n"
" noir-rollup-no-zk Rollup without ZK\n"
" starknet Starknet via Garaga (ZK)\n"
" starknet-no-zk Starknet without ZK")
" noir-rollup-no-zk Rollup without ZK")
->envname("BB_VERIFIER_TARGET")
->check(CLI::IsMember({ "evm",
"evm-no-zk",
"noir-recursive",
"noir-recursive-no-zk",
"noir-rollup",
"noir-rollup-no-zk",
"starknet",
"starknet-no-zk" }));
->check(CLI::IsMember(
{ "evm", "evm-no-zk", "noir-recursive", "noir-recursive-no-zk", "noir-rollup", "noir-rollup-no-zk" }));
};

const auto add_write_vk_flag = [&](CLI::App* subcommand) {
Expand Down Expand Up @@ -831,11 +816,6 @@ int parse_and_run_cli_command(int argc, char* argv[])
flags.oracle_hash_type = "poseidon2";
flags.ipa_accumulation = true;
flags.disable_zk = true;
} else if (flags.verifier_target == "starknet") {
flags.oracle_hash_type = "starknet";
} else if (flags.verifier_target == "starknet-no-zk") {
flags.oracle_hash_type = "starknet";
flags.disable_zk = true;
}
vinfo("verifier_target '",
flags.verifier_target,
Expand Down
31 changes: 1 addition & 30 deletions barretenberg/cpp/src/barretenberg/bbapi/bbapi_shared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
#include "barretenberg/honk/execution_trace/mega_execution_trace.hpp"
#include "barretenberg/stdlib/special_public_inputs/special_public_inputs.hpp"
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"
#ifdef STARKNET_GARAGA_FLAVORS
#include "barretenberg/flavor/ultra_starknet_flavor.hpp"
#include "barretenberg/flavor/ultra_starknet_zk_flavor.hpp"
#endif
#include <cstdint>
#include <string>
#include <vector>
Expand Down Expand Up @@ -128,7 +124,7 @@ struct ProofSystemSettings {
* @brief The oracle hash type to be used for the proof.
*
* This is used to determine the hash function used in the proof generation.
* Valid values are "poseidon2", "keccak", and "starknet".
* Valid values are "poseidon2" and "keccak".
*/
std::string oracle_hash_type = "poseidon2";

Expand All @@ -145,22 +141,6 @@ struct ProofSystemSettings {
bool operator==(const ProofSystemSettings& other) const = default;
};

/**
* @brief Convert oracle hash type string to enum for internal use
*/
enum class OracleHashType { POSEIDON2, KECCAK, STARKNET };

inline OracleHashType parse_oracle_hash_type(const std::string& type)
{
if (type == "keccak") {
return OracleHashType::KECCAK;
}
if (type == "starknet") {
return OracleHashType::STARKNET;
}
return OracleHashType::POSEIDON2; // default
}

/**
* @brief Convert VK policy string to enum for internal use
*/
Expand Down Expand Up @@ -344,15 +324,6 @@ template <typename Operation> auto dispatch_by_settings(const ProofSystemSetting
return operation.template operator()<UltraKeccakZKFlavor, DefaultIO>();
}

#ifdef STARKNET_GARAGA_FLAVORS
if (settings.oracle_hash_type == "starknet") {
if (settings.disable_zk) {
return operation.template operator()<UltraStarknetFlavor, DefaultIO>();
}
return operation.template operator()<UltraStarknetZKFlavor, DefaultIO>();
}
#endif

// Invalid configuration
throw_or_abort("Invalid proof system settings: oracle_hash_type='" + settings.oracle_hash_type +
"', disable_zk=" + std::to_string(settings.disable_zk) +
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
barretenberg_module(poseidon2_bench crypto_poseidon2 ext_starknet_crypto_poseidon)
barretenberg_module(poseidon2_bench crypto_poseidon2)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "barretenberg/eccvm/eccvm_flavor.hpp"
#include "barretenberg/eccvm/eccvm_short_monomial_flavor.hpp"
#include "barretenberg/eccvm/eccvm_translation_data.hpp"
#include "barretenberg/ext/starknet/flavor/ultra_starknet_zk_flavor.hpp"
#include "barretenberg/flavor/mega_zk_flavor.hpp"
#include "barretenberg/flavor/ultra_keccak_zk_flavor.hpp"
#include "barretenberg/flavor/ultra_zk_flavor.hpp"
Expand Down Expand Up @@ -460,9 +459,6 @@ template class SmallSubgroupIPAProver<TranslatorShortMonomialFlavor>;
template class SmallSubgroupIPAProver<MegaZKFlavor>;
template class SmallSubgroupIPAProver<UltraZKFlavor>;
template class SmallSubgroupIPAProver<UltraKeccakZKFlavor>;
#ifdef STARKNET_GARAGA_FLAVORS
template class SmallSubgroupIPAProver<UltraStarknetZKFlavor>;
#endif

// Instantiations used in tests
template class SmallSubgroupIPAProver<BN254Settings>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,8 @@ template <typename FF, size_t rate, size_t capacity, size_t t, typename Permutat
{
const size_t in_len = input.size();
const uint256_t iv = (static_cast<uint256_t>(in_len) << 64);
return hash_internal(input, iv);
}

/**
* @brief Use the sponge to hash an input vector with a custom IV.
*
* @param input Field elements (a_0, ..., a_{N-1})
* @param iv Initial value for domain separation
* @return Hash of the input, a single field element.
*/
static FF hash_internal(std::span<const FF> input, FF iv)
{
FieldSponge sponge(iv);

const size_t in_len = input.size();
for (size_t i = 0; i < in_len; ++i) {
sponge.absorb(input[i]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ template <class Params_> struct alignas(32) field {

BB_INLINE constexpr field pow(const uint256_t& exponent) const noexcept;
BB_INLINE constexpr field pow(uint64_t exponent) const noexcept;
// STARKNET: next line was commented as stark252 violates the assertion
// static_assert(Params::modulus_0 != 1);
static_assert(Params::modulus_0 != 1);
static constexpr uint256_t modulus_minus_two =
uint256_t(Params::modulus_0 - 2ULL, Params::modulus_1, Params::modulus_2, Params::modulus_3);
constexpr field invert() const noexcept;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading