Skip to content

Commit 6a118ca

Browse files
LHerskindAztecBotsuyash67johnathan79717ledwards2225
authored andcommitted
chore!: depositAmount and minimumStake naming (#16148)
Addressing feedback from @benesjan. Also using his prompt idea to see how well it works. --- This PR refactors validator staking terminology throughout the Aztec codebase to improve clarity and better reflect the purpose of key staking parameters. The main changes involve renaming `depositAmount` to `activationThreshold` and `minimumStake` to `ejectionThreshold`, along with related library and method renames. - **`depositAmount` → `activationThreshold`**: The amount of tokens required to activate a validator and join the validator set - **`minimumStake` → `ejectionThreshold`**: The minimum token balance below which a validator is ejected from the active set - **Solidity Contracts**: Updated all references in `Rollup.sol`, `IStaking.sol`, `GSE.sol`, and related contracts - **Libraries**: - `UserLib` → `CheckpointedUintLib` (more descriptive name for checkpoint management) - `DelegationLib` → `StakeDelegationLib` (clearer purpose indication) - **Methods**: `finaliseHelper()` → `finaliseWithdraw()` in GSE contract for better clarity - Updated environment variables: - `AZTEC_DEPOSIT_AMOUNT` → `AZTEC_ACTIVATION_THRESHOLD` - `AZTEC_MINIMUM_STAKE` → `AZTEC_EJECTION_THRESHOLD` - Updated all configuration files, test constants, and deployment scripts - Updated CLI reference documentation to reflect new parameter names - Updated all code comments to use the new terminology 1. **Improved Clarity**: The new names clearly indicate the purpose of each parameter - one for entering the validator set, one for being removed from it 2. **Better Developer Experience**: Developers can immediately understand what these thresholds represent without needing additional context 3. **Consistency**: Uniform terminology across the entire codebase reduces confusion 4. **Future-Proof**: The new names are more generic and adaptable to potential future staking mechanism changes ⚠️ **This is a breaking change** that affects: 1. **Environment Variables**: Any deployment or configuration using the old environment variable names (`AZTEC_DEPOSIT_AMOUNT`, `AZTEC_MINIMUM_STAKE`) must be updated 2. **Contract Interfaces**: External systems calling `getDepositAmount()`, `getMinimumStake()`, or `finaliseHelper()` must update to use the new method names 3. **Configuration Files**: Any JSON/YAML configuration files using the old parameter names need updates 4. **Deployment Scripts**: Custom deployment scripts referencing the old names will need modification - Replace `depositAmount` with `activationThreshold` in all configurations - Replace `minimumStake` with `ejectionThreshold` in all configurations - Update contract calls: - `getDepositAmount()` → `getActivationThreshold()` - `getMinimumStake()` → `getEjectionThreshold()` - `finaliseHelper()` → `finaliseWithdraw()` feat(sol): vk hashing (#16015) Perform vk hashing in the solidity verifier Takes a different approach to the traditional verifiers. As the vk is fixed ahead of time, we hash it and include it in the precompiled contract, therefore it is preprocessed and does not need to be recomputed by the verifier. chore: minor fixes and docs improvements in governance (#16039) When doing my internal review of governance contracts I stumbled upon plenty of small and uncontroversial issues with which it didn't really make sense to clutter my review document. --------- Co-authored-by: LHerskind <16536249+LHerskind@users.noreply.github.com> chore: updated fmt settings foundry.toml (#16155) Updated the `foundry.toml` to also wrap the comments and use the default line_length of 120 instead of the previous 100. Threw some thousands separators in there as well for constant values. ```toml [fmt] line_length = 120 tab_width = 2 variable_override_spacing=false wrap_comments = true number_underscore = "thousands" override_spacing = false ``` chore: address comments (#16175) Please read [contributing guidelines](CONTRIBUTING.md) and remove this line. For audit-related pull requests, please use the [audit PR template](?expand=1&template=audit.md). chore: invert check (#16181) Looks like this condition should have been inverted. [Nightly CI logs](https://github.com/AztecProtocol/aztec-packages/actions/runs/16712826743/job/47300588722) ``` 03:18:35 + case "$cmd" in 03:18:35 + release 03:18:35 + semver check v1.0.0-nightly.20250804 03:18:35 + echo_stderr 'Release tag must be a valid semver version. Found: v1.0.0-nightly.20250804' 03:18:35 + echo Release tag must be a valid semver version. Found: v1.0.0-nightly.20250804 03:18:35 Release tag must be a valid semver version. Found: v1.0.0-nightly.20250804 03:18:35 + exit 1 ``` chore: remove `uint` (#16062) Removed `uint` module from `stdlib`. Had to change two modules that used `uint`: 1. `edcsa`: an ecdsa signature contains a byte `v` and we were using `uint8` to represent it in circuits. Replaced that with `byte_array` (of size 1). 2. `keccak`: variable length keccak (i.e., the number of bytes being hashed is a circuit-variable) was using `uint32` to represent `num_bytes`. We are not using this version of keccak anywhere so its better to get rid of than to maintain/audit. feat(bb): allow for different transcript types depending on the flavor (#16017) This change changes the transcript type in the solidity verifier case to be a uint256 instead of serialising as field elements It should reduce the size of the proof by 2368 bytes. This significantly reduces hashing costs + calldata costs, and should amount to a gas savings in the region of 50k This pr just performs the plumbing into bb that makes these changes, and does not apply the changes - changing the TranscriptType to uint256_t and does not make the changes to solidity. Expect this in a follow on **Note: still needs a cleanup but leaving this here for review from others on the approach** chore: remove `decompose_into_bits()` function from `field_t` class (#15795) Since we're removing the merkle membership circuit implementation from cpp code, we no longer use the function `decompose_into_bits()` in the `field_t` class. Best to remove it instead of maintaining. chore: Standardise native public input handling (#16050) Public inputs in `stdlib` are handled via the special public input mechanisms: we have classes (`KernelIO`, `DefaultIO`, `HidingKernelIO`, `RollupIO`) that set public inputs, reconstruct them, create defaults, etc. Native public inputs have a similar mechanism, but the mechanism has many hacks built-in as native structures are used in more extensively than their `stdlib` counterparts (e.g., we use `field` also to construct the base/scalar field of `secp256k1`, which we never need to deserialise from public inputs). This PR standardises usage of native public inputs by creating a structure similar to the one used in `stdlib`: we define a `PublicInputComponent` class that works as a wrapper around classes that can be deserialised from the public inputs, and we use this wrapper class to reconstruct special public inputs (pairing points, IPA claims, etc.). To use the class, we make choices about how elements that are not currently used in circuit should be serialised. This pertains to base/scalar fields of `secp256k1` and `secp256r1` (and therefore to affine points on these curves). For consistency with the base field of `BN254`, we set `PUBLIC_INPUTS_SIZE = 4` for an element in each of these fields. This PR also cleans up the usage of the constants `PAIRING_POINTS_SIZE` and `IPA_CLAIM_SIZE`, as they can now be extracted from the respective classes `PairingPoints` and `OpeningClaim<Curve>` where `Curve` is `Grumpkin` (either native or `stdlib`) Closes AztecProtocol/barretenberg#1478 --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Suyash Bagad <suyash@aztecprotocol.com> Co-authored-by: Jonathan Hao <jonathan@aztec-labs.com> Co-authored-by: ledwards2225 <98505400+ledwards2225@users.noreply.github.com> Co-authored-by: sergei iakovenko <105737703+iakovenkos@users.noreply.github.com> Co-authored-by: ludamad <adam.domurad@gmail.com> Co-authored-by: Raju Krishnamoorthy <krishnamoorthy@gmail.com> Co-authored-by: notnotraju <raju@aztec-labs.com> Co-authored-by: Lucas Xia <lucasxia01@gmail.com> Co-authored-by: Khashayar Barooti <khashayar@aztecprotocol.com> Co-authored-by: Jean M <132435771+jeanmon@users.noreply.github.com> Co-authored-by: Alex Gherghisan <alexghr@users.noreply.github.com> Co-authored-by: Santiago Palladino <spalladino@users.noreply.github.com> Co-authored-by: Santiago Palladino <santiago@aztec-labs.com> Co-authored-by: ludamad <domuradical@gmail.com> Co-authored-by: maramihali <mara@aztecprotocol.com> Co-authored-by: Sarkoxed <75146596+Sarkoxed@users.noreply.github.com>
1 parent e2b45d5 commit 6a118ca

File tree

324 files changed

+3170
-9915
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

324 files changed

+3170
-9915
lines changed

barretenberg/cpp/src/barretenberg/acir_formal_proofs/helpers.test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "barretenberg/smt_verification/circuit/ultra_circuit.hpp"
44
#include "barretenberg/smt_verification/solver/solver.hpp"
55
#include "barretenberg/smt_verification/util/smt_util.hpp"
6-
#include "barretenberg/stdlib/primitives/uint/uint.hpp"
76
#include "barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp"
87

98
using namespace bb;

barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "barretenberg/dsl/acir_proofs/honk_contract.hpp"
1111
#include "barretenberg/dsl/acir_proofs/honk_zk_contract.hpp"
1212
#include "barretenberg/honk/proof_system/types/proof.hpp"
13-
#include "barretenberg/honk/types/aggregation_object_type.hpp"
13+
#include "barretenberg/special_public_inputs/special_public_inputs.hpp"
1414
#include "barretenberg/srs/global_crs.hpp"
1515

1616
namespace bb {
@@ -56,20 +56,24 @@ std::shared_ptr<DeciderProvingKey_<Flavor>> _compute_proving_key(const std::stri
5656
}
5757

5858
template <typename Flavor>
59-
PubInputsProofAndKey<typename Flavor::VerificationKey> _compute_vk(const std::filesystem::path& bytecode_path,
60-
const std::filesystem::path& witness_path)
59+
PubInputsProofAndKey<Flavor> _compute_vk(const std::filesystem::path& bytecode_path,
60+
const std::filesystem::path& witness_path)
6161
{
62+
using Proof = typename Flavor::Transcript::Proof;
63+
6264
auto proving_key = _compute_proving_key<Flavor>(bytecode_path.string(), witness_path.string());
6365
auto vk = std::make_shared<typename Flavor::VerificationKey>(proving_key->get_precomputed());
64-
return { PublicInputsVector{}, HonkProof{}, vk, vk->hash() };
66+
return { PublicInputsVector{}, Proof{}, vk, vk->hash() };
6567
}
6668

6769
template <typename Flavor>
68-
PubInputsProofAndKey<typename Flavor::VerificationKey> _prove(const bool compute_vk,
69-
const std::filesystem::path& bytecode_path,
70-
const std::filesystem::path& witness_path,
71-
const std::filesystem::path& vk_path)
70+
PubInputsProofAndKey<Flavor> _prove(const bool compute_vk,
71+
const std::filesystem::path& bytecode_path,
72+
const std::filesystem::path& witness_path,
73+
const std::filesystem::path& vk_path)
7274
{
75+
using Proof = typename Flavor::Transcript::Proof;
76+
7377
auto proving_key = _compute_proving_key<Flavor>(bytecode_path.string(), witness_path.string());
7478
std::shared_ptr<typename Flavor::VerificationKey> vk;
7579
if (compute_vk) {
@@ -82,24 +86,30 @@ PubInputsProofAndKey<typename Flavor::VerificationKey> _prove(const bool compute
8286

8387
UltraProver_<Flavor> prover{ proving_key, vk };
8488

85-
HonkProof concat_pi_and_proof = prover.construct_proof();
86-
size_t num_inner_public_inputs = prover.proving_key->num_public_inputs();
87-
// Loose check that the public inputs contain a pairing point accumulator, doesn't catch everything.
88-
BB_ASSERT_GTE(prover.proving_key->num_public_inputs(),
89-
PAIRING_POINTS_SIZE,
90-
"Public inputs should contain a pairing point accumulator.");
91-
num_inner_public_inputs -= PAIRING_POINTS_SIZE;
92-
if constexpr (HasIPAAccumulator<Flavor>) {
93-
BB_ASSERT_GTE(num_inner_public_inputs, IPA_CLAIM_SIZE, "Public inputs should contain an IPA claim.");
94-
num_inner_public_inputs -= IPA_CLAIM_SIZE;
95-
}
89+
Proof concat_pi_and_proof = prover.construct_proof();
90+
// Compute number of inner public inputs. Perform loose checks that the public inputs contain enough data.
91+
auto num_inner_public_inputs = [&]() {
92+
size_t num_public_inputs = prover.proving_key->num_public_inputs();
93+
if constexpr (HasIPAAccumulator<Flavor>) {
94+
BB_ASSERT_GTE(num_public_inputs,
95+
RollupIO::PUBLIC_INPUTS_SIZE,
96+
"Public inputs should contain a pairing point accumulator and an IPA claim.");
97+
return num_public_inputs - RollupIO::PUBLIC_INPUTS_SIZE;
98+
} else {
99+
BB_ASSERT_GTE(num_public_inputs,
100+
DefaultIO::PUBLIC_INPUTS_SIZE,
101+
"Public inputs should contain a pairing point accumulator.");
102+
return num_public_inputs - DefaultIO::PUBLIC_INPUTS_SIZE;
103+
}
104+
}();
105+
96106
// We split the inner public inputs, which are stored at the front of the proof, from the rest of the proof. Now,
97107
// the "proof" refers to everything except the inner public inputs.
98-
PublicInputsAndProof public_inputs_and_proof{
108+
PublicInputsAndProof<Proof> public_inputs_and_proof{
99109
PublicInputsVector(concat_pi_and_proof.begin(),
100110
concat_pi_and_proof.begin() + static_cast<std::ptrdiff_t>(num_inner_public_inputs)),
101-
HonkProof(concat_pi_and_proof.begin() + static_cast<std::ptrdiff_t>(num_inner_public_inputs),
102-
concat_pi_and_proof.end())
111+
Proof(concat_pi_and_proof.begin() + static_cast<std::ptrdiff_t>(num_inner_public_inputs),
112+
concat_pi_and_proof.end())
103113
};
104114
return { public_inputs_and_proof.public_inputs, public_inputs_and_proof.proof, vk, vk->hash() };
105115
}
@@ -112,12 +122,15 @@ bool _verify(const bool ipa_accumulation,
112122
{
113123
using VerificationKey = typename Flavor::VerificationKey;
114124
using Verifier = UltraVerifier_<Flavor>;
125+
using Transcript = typename Flavor::Transcript;
126+
using DataType = typename Transcript::DataType;
127+
using Proof = typename Transcript::Proof;
115128

116129
auto vk = std::make_shared<VerificationKey>(from_buffer<VerificationKey>(read_file(vk_path)));
117-
auto public_inputs = many_from_buffer<bb::fr>(read_file(public_inputs_path));
118-
auto proof = many_from_buffer<bb::fr>(read_file(proof_path));
130+
auto public_inputs = many_from_buffer<DataType>(read_file(public_inputs_path));
131+
auto proof = many_from_buffer<DataType>(read_file(proof_path));
119132
// concatenate public inputs and proof
120-
std::vector<fr> complete_proof = public_inputs;
133+
std::vector<DataType> complete_proof = public_inputs;
121134
complete_proof.insert(complete_proof.end(), proof.begin(), proof.end());
122135

123136
VerifierCommitmentKey<curve::Grumpkin> ipa_verification_key;
@@ -137,9 +150,9 @@ bool _verify(const bool ipa_accumulation,
137150
"Honk proof has incorrect length while verifying.");
138151
const std::ptrdiff_t honk_proof_with_pub_inputs_length =
139152
static_cast<std::ptrdiff_t>(HONK_PROOF_LENGTH + num_public_inputs);
140-
auto ipa_proof = HonkProof(complete_proof.begin() + honk_proof_with_pub_inputs_length, complete_proof.end());
153+
auto ipa_proof = Proof(complete_proof.begin() + honk_proof_with_pub_inputs_length, complete_proof.end());
141154
auto tube_honk_proof =
142-
HonkProof(complete_proof.begin(), complete_proof.begin() + honk_proof_with_pub_inputs_length);
155+
Proof(complete_proof.begin(), complete_proof.begin() + honk_proof_with_pub_inputs_length);
143156
verified = verifier.verify_proof(complete_proof, ipa_proof);
144157
} else {
145158
verified = verifier.verify_proof(complete_proof);

barretenberg/cpp/src/barretenberg/api/prove_tube.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "barretenberg/common/map.hpp"
44
#include "barretenberg/honk/proof_system/types/proof.hpp"
55
#include "barretenberg/stdlib/client_ivc_verifier/client_ivc_recursive_verifier.hpp"
6+
#include "barretenberg/stdlib/special_public_inputs/special_public_inputs.hpp"
67

78
namespace bb {
89
/**
@@ -17,6 +18,8 @@ void prove_tube(const std::string& output_path, const std::string& vk_path)
1718

1819
using Builder = UltraCircuitBuilder;
1920
using StdlibProof = ClientIVCRecursiveVerifier::StdlibProof;
21+
using HidingKernelIO = stdlib::recursion::honk::HidingKernelIO<Builder>;
22+
using RollupIO = stdlib::recursion::honk::RollupIO;
2023

2124
std::string proof_path = output_path + "/proof";
2225

@@ -34,7 +37,7 @@ void prove_tube(const std::string& output_path, const std::string& vk_path)
3437
// The public inputs in the proof are propagated to the base rollup by making them public inputs of this circuit.
3538
// Exclude the public inputs of the Hiding Kernel: the pairing points are handled separately, the ecc op tables are
3639
// not needed after this point
37-
auto num_inner_public_inputs = vk.mega->num_public_inputs - HidingKernelIO<Builder>::PUBLIC_INPUTS_SIZE;
40+
auto num_inner_public_inputs = vk.mega->num_public_inputs - HidingKernelIO::PUBLIC_INPUTS_SIZE;
3841
for (size_t i = 0; i < num_inner_public_inputs; i++) {
3942
stdlib_proof.mega_proof[i].set_public();
4043
}
@@ -54,14 +57,13 @@ void prove_tube(const std::string& output_path, const std::string& vk_path)
5457
auto proving_key = std::make_shared<DeciderProvingKey_<UltraRollupFlavor>>(*builder);
5558
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1201): Precompute tube vk and pass it in.
5659
info("WARNING: computing tube vk in prove_tube, but a precomputed vk should be passed in.");
57-
auto tube_verification_key =
58-
std::make_shared<typename UltraRollupFlavor::VerificationKey>(proving_key->get_precomputed());
60+
auto tube_verification_key = std::make_shared<UltraRollupFlavor::VerificationKey>(proving_key->get_precomputed());
5961

6062
Prover tube_prover{ proving_key, tube_verification_key };
6163
auto tube_proof = tube_prover.construct_proof();
6264
std::string tubePublicInputsPath = output_path + "/public_inputs";
6365
std::string tubeProofPath = output_path + "/proof";
64-
PublicInputsAndProof public_inputs_and_proof{
66+
PublicInputsAndProof<HonkProof> public_inputs_and_proof{
6567
PublicInputsVector(tube_proof.begin(),
6668
tube_proof.begin() + static_cast<std::ptrdiff_t>(num_inner_public_inputs)),
6769
HonkProof(tube_proof.begin() + static_cast<std::ptrdiff_t>(num_inner_public_inputs), tube_proof.end())

barretenberg/cpp/src/barretenberg/api/write_prover_output.hpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,21 @@ inline std::string field_elements_to_json(const std::vector<bb::fr>& fields)
2424
return ss.str();
2525
}
2626

27-
template <typename VK> struct PubInputsProofAndKey {
27+
template <typename Flavor> struct PubInputsProofAndKey {
2828
PublicInputsVector public_inputs;
29-
HonkProof proof;
30-
std::shared_ptr<VK> key;
29+
typename Flavor::Transcript::Proof proof;
30+
std::shared_ptr<typename Flavor::VerificationKey> key;
3131
fr vk_hash;
3232
};
3333

34+
template <typename T> std::string to_json(const std::vector<T>& data)
35+
{
36+
if (data.empty()) {
37+
return std::string("[]");
38+
}
39+
return format("[", join(transform::map(data, [](const T& el) { return format("\"", el, "\""); })), "]");
40+
}
41+
3442
template <typename ProverOutput>
3543
void write(const ProverOutput& prover_output,
3644
const std::string& output_format,
@@ -40,12 +48,6 @@ void write(const ProverOutput& prover_output,
4048
enum class ObjectToWrite : size_t { PUBLIC_INPUTS, PROOF, VK, VK_HASH };
4149
const bool output_to_stdout = output_dir == "-";
4250

43-
const auto to_json = [](const std::vector<bb::fr>& data) {
44-
if (data.empty()) {
45-
return std::string("[]");
46-
}
47-
return format("[", join(transform::map(data, [](auto fr) { return format("\"", fr, "\""); })), "]");
48-
};
4951
const auto to_json_fr = [](const bb::fr& fr) { return format("\"", fr, "\""); };
5052

5153
const auto write_bytes = [&](const ObjectToWrite& obj) {

barretenberg/cpp/src/barretenberg/bb/cli.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "barretenberg/bbapi/c_bind.hpp"
2626
#include "barretenberg/common/thread.hpp"
2727
#include "barretenberg/flavor/ultra_rollup_flavor.hpp"
28-
#include "barretenberg/honk/types/aggregation_object_type.hpp"
2928
#include "barretenberg/srs/factories/native_crs_factory.hpp"
3029
#include "barretenberg/srs/global_crs.hpp"
3130
#include <fstream>

barretenberg/cpp/src/barretenberg/bbapi/bbapi_ultra_honk.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp"
88
#include "barretenberg/dsl/acir_format/serde/witness_stack.hpp"
99
#include "barretenberg/flavor/mega_flavor.hpp"
10-
#include "barretenberg/honk/types/aggregation_object_type.hpp"
1110
#include "barretenberg/ultra_honk/decider_proving_key.hpp"
1211
#include "barretenberg/ultra_honk/ultra_prover.hpp"
1312
#include "barretenberg/ultra_honk/ultra_verifier.hpp"

barretenberg/cpp/src/barretenberg/commitment_schemes/claim.hpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#pragma once
88

99
#include "barretenberg/commitment_schemes/commitment_key.hpp"
10-
#include "barretenberg/honk/types/aggregation_object_type.hpp"
1110
#include "barretenberg/polynomials/polynomial.hpp"
1211
#include "barretenberg/stdlib/primitives/curves/grumpkin.hpp"
1312

@@ -64,8 +63,10 @@ template <typename Curve> class OpeningClaim {
6463
// commitment to univariate polynomial p(X)
6564
Commitment commitment;
6665

67-
// Size of public inputs representation of an opening claim over Grumpkin
68-
static constexpr size_t PUBLIC_INPUTS_SIZE = IPA_CLAIM_SIZE;
66+
static constexpr bool IS_GRUMPKIN =
67+
std::is_same_v<Curve, curve::Grumpkin> || std::is_same_v<Curve, stdlib::grumpkin<UltraCircuitBuilder>>;
68+
// Size of public inputs representation of an opening claim over Grumpkin: 2 * 4 + 2 = 10
69+
static constexpr size_t PUBLIC_INPUTS_SIZE = IS_GRUMPKIN ? GRUMPKIN_OPENING_CLAIM_SIZE : INVALID_PUBLIC_INPUTS_SIZE;
6970

7071
/**
7172
* @brief Set the witness indices for the opening claim to public
@@ -91,8 +92,6 @@ template <typename Curve> class OpeningClaim {
9192
const std::span<const stdlib::field_t<Builder>, PUBLIC_INPUTS_SIZE>& limbs)
9293
requires(std::is_same_v<Curve, stdlib::grumpkin<UltraCircuitBuilder>>)
9394
{
94-
BB_ASSERT_EQ(2 * Fr::PUBLIC_INPUTS_SIZE + Commitment::PUBLIC_INPUTS_SIZE, PUBLIC_INPUTS_SIZE);
95-
9695
const size_t FIELD_SIZE = Fr::PUBLIC_INPUTS_SIZE;
9796
const size_t COMMITMENT_SIZE = Commitment::PUBLIC_INPUTS_SIZE;
9897
std::span<const stdlib::field_t<Builder>, FIELD_SIZE> challenge_limbs{ limbs.data(), FIELD_SIZE };
@@ -111,19 +110,18 @@ template <typename Curve> class OpeningClaim {
111110
* @note Implemented for native curve::Grumpkin for use with IPA.
112111
*
113112
*/
114-
static OpeningClaim<Curve> reconstruct_from_public(const std::span<const bb::fr, IPA_CLAIM_SIZE>& ipa_claim_limbs)
113+
static OpeningClaim<Curve> reconstruct_from_public(const std::span<const bb::fr, PUBLIC_INPUTS_SIZE>& limbs)
115114
requires(std::is_same_v<Curve, curve::Grumpkin>)
116115
{
117-
size_t index = 0;
118-
std::span<const bb::fr> challenge_limbs = ipa_claim_limbs.subspan(index, FQ_PUBLIC_INPUT_SIZE);
119-
index += FQ_PUBLIC_INPUT_SIZE;
120-
std::span<const bb::fr> evaluation_limbs = ipa_claim_limbs.subspan(index, FQ_PUBLIC_INPUT_SIZE);
121-
index += FQ_PUBLIC_INPUT_SIZE;
122-
std::span<const bb::fr> point_limbs = ipa_claim_limbs.subspan(index, 2 * FR_PUBLIC_INPUTS_SIZE);
123-
124-
auto challenge = fq::reconstruct_from_public(challenge_limbs);
125-
auto evaluation = fq::reconstruct_from_public(evaluation_limbs);
126-
typename Curve::AffineElement commitment = Curve::AffineElement::reconstruct_from_public(point_limbs);
116+
const size_t FIELD_SIZE = Fr::PUBLIC_INPUTS_SIZE;
117+
const size_t COMMITMENT_SIZE = Commitment::PUBLIC_INPUTS_SIZE;
118+
std::span<const bb::fr, FIELD_SIZE> challenge_limbs{ limbs.data(), FIELD_SIZE };
119+
std::span<const bb::fr, FIELD_SIZE> evaluation_limbs{ limbs.data() + FIELD_SIZE, FIELD_SIZE };
120+
std::span<const bb::fr, COMMITMENT_SIZE> commitment_limbs{ limbs.data() + 2 * FIELD_SIZE, COMMITMENT_SIZE };
121+
122+
Fr challenge = Fr::reconstruct_from_public(challenge_limbs);
123+
Fr evaluation = Fr::reconstruct_from_public(evaluation_limbs);
124+
Commitment commitment = Commitment::reconstruct_from_public(commitment_limbs);
127125

128126
return OpeningClaim<Curve>{ { challenge, evaluation }, commitment };
129127
}

barretenberg/cpp/src/barretenberg/commitment_schemes/pairing_points.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#include "barretenberg/commitment_schemes/commitment_key.hpp"
1010
#include "barretenberg/commitment_schemes/verification_key.hpp"
11-
#include "barretenberg/honk/types/aggregation_object_type.hpp"
1211
#include "barretenberg/polynomials/polynomial.hpp"
1312
#include "barretenberg/stdlib/primitives/curves/grumpkin.hpp"
1413

@@ -30,6 +29,8 @@ class PairingPoints {
3029
using VerifierCK = VerifierCommitmentKey<curve::BN254>;
3130

3231
public:
32+
static constexpr size_t PUBLIC_INPUTS_SIZE = PAIRING_POINTS_SIZE;
33+
3334
Point P0 = Point::infinity();
3435
Point P1 = Point::infinity();
3536

@@ -43,10 +44,13 @@ class PairingPoints {
4344
* @brief Reconstruct the pairing points from limbs stored on the public inputs.
4445
*
4546
*/
46-
static PairingPoints reconstruct_from_public(const std::span<const Fr, PAIRING_POINTS_SIZE>& limbs_in)
47+
static PairingPoints reconstruct_from_public(const std::span<const Fr, PUBLIC_INPUTS_SIZE>& limbs_in)
4748
{
48-
Point P0 = Point::reconstruct_from_public(limbs_in.subspan(0, 2 * FQ_PUBLIC_INPUT_SIZE));
49-
Point P1 = Point::reconstruct_from_public(limbs_in.subspan(2 * FQ_PUBLIC_INPUT_SIZE, 2 * FQ_PUBLIC_INPUT_SIZE));
49+
const std::span<const bb::fr, Point::PUBLIC_INPUTS_SIZE> P0_limbs(limbs_in.data(), Point::PUBLIC_INPUTS_SIZE);
50+
const std::span<const bb::fr, Point::PUBLIC_INPUTS_SIZE> P1_limbs(limbs_in.data() + Point::PUBLIC_INPUTS_SIZE,
51+
Point::PUBLIC_INPUTS_SIZE);
52+
Point P0 = Point::reconstruct_from_public(P0_limbs);
53+
Point P1 = Point::reconstruct_from_public(P1_limbs);
5054

5155
return PairingPoints{ P0, P1 };
5256
}

barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ void create_ecdsa_k1_verify_constraints(Builder& builder,
6060

6161
std::vector<uint8_t> rr(new_sig.r.begin(), new_sig.r.end());
6262
std::vector<uint8_t> ss(new_sig.s.begin(), new_sig.s.end());
63-
uint8_t vv = new_sig.v;
63+
std::vector<uint8_t> vv = { new_sig.v };
6464

6565
stdlib::ecdsa_signature<Builder> sig{ stdlib::byte_array<Builder>(&builder, rr),
6666
stdlib::byte_array<Builder>(&builder, ss),
67-
stdlib::uint8<Builder>(&builder, vv) };
67+
stdlib::byte_array<Builder>(&builder, vv) };
6868

6969
pub_key_x_fq.assert_is_in_field();
7070
pub_key_y_fq.assert_is_in_field();

barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ void create_ecdsa_r1_verify_constraints(Builder& builder,
5858

5959
std::vector<uint8_t> rr(new_sig.r.begin(), new_sig.r.end());
6060
std::vector<uint8_t> ss(new_sig.s.begin(), new_sig.s.end());
61-
uint8_t vv = new_sig.v;
61+
std::vector<uint8_t> vv = { new_sig.v };
6262

6363
stdlib::ecdsa_signature<Builder> sig{ stdlib::byte_array<Builder>(&builder, rr),
6464
stdlib::byte_array<Builder>(&builder, ss),
65-
stdlib::uint8<Builder>(&builder, vv) };
65+
stdlib::byte_array<Builder>(&builder, vv) };
6666

6767
pub_key_x_fq.assert_is_in_field();
6868
pub_key_y_fq.assert_is_in_field();

0 commit comments

Comments
 (0)