Skip to content

Commit 62aa28e

Browse files
Move public inputs constants to their own file
1 parent 3f036f2 commit 62aa28e

File tree

3 files changed

+42
-29
lines changed

3 files changed

+42
-29
lines changed

barretenberg/cpp/src/barretenberg/constants.hpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,32 +50,4 @@ static constexpr uint32_t NUM_INTERLEAVING_CLAIMS = 2;
5050
// increase the `round_index` of the original transcript by `BRANCHING_JUMP`, so that there is a gap of `BRANCHING_JUMP`
5151
// round indices between what happened before and after the branching. This constant is arbitrary.
5252
static constexpr std::size_t BRANCHING_JUMP = 5;
53-
54-
// Number of bb::fr elements used to represent an element of bb::fr in the public inputs
55-
static constexpr std::size_t FR_PUBLIC_INPUTS_SIZE = 1;
56-
57-
// Number of bb::fr elements used to represent a bigfield element in the public inputs
58-
static constexpr std::size_t BIGFIELD_PUBLIC_INPUTS_SIZE = 4;
59-
60-
// Number of bb::fr elements used to represent a goblin bigfield element in the public inputs
61-
static constexpr std::size_t GOBLIN_FIELD_PUBLIC_INPUTS_SIZE = 4;
62-
63-
// Number of bb::fr elements used to represent a biggroup element in the public inputs
64-
static constexpr std::size_t BIGGROUP_PUBLIC_INPUTS_SIZE = 2 * BIGFIELD_PUBLIC_INPUTS_SIZE;
65-
66-
// Number of bb::fr elements used to represent a goblin biggroup element in the public inputs
67-
static constexpr std::size_t GOBLIN_GROUP_PUBLIC_INPUTS_SIZE = 2 * GOBLIN_FIELD_PUBLIC_INPUTS_SIZE;
68-
69-
// Number of bb::fr elements used to represent a pair {P0, P1} of points in the public inputs
70-
// Note that the formula assumes BIGGROUP_PUBLIC_INPUTS_SIZE == GOBLIN_GROUP_PUBLIC_INPUTS_SIZE
71-
static constexpr std::size_t PAIRING_POINTS_SIZE = 2 * BIGGROUP_PUBLIC_INPUTS_SIZE;
72-
73-
// Number of bb::fr elements used to represent a opening claim (C, (r, p(r))) over Grumpkin
74-
// Formula is: a point on Grumpkin (2 * FR_PUBLIC_INPUTS_SIZE) and two points on bb::fq (2 *
75-
// BIGFIELD_PUBLIC_INPUTS_SIZE)
76-
static constexpr std::size_t GRUMPKIN_OPENING_CLAIM_SIZE = 2 * FR_PUBLIC_INPUTS_SIZE + 2 * BIGFIELD_PUBLIC_INPUTS_SIZE;
77-
78-
// Invalid public input size, used in OpeningClaim<Curve> when Curve is not Grumpkin
79-
static constexpr std::size_t INVALID_PUBLIC_INPUTS_SIZE = 0;
80-
8153
} // namespace bb

barretenberg/cpp/src/barretenberg/ecc/curves/bn254/fr.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <ostream>
1212

1313
#include "../../fields/field.hpp"
14-
#include "barretenberg/constants.hpp"
14+
#include "barretenberg/honk/types/public_inputs_type.hpp"
1515

1616
// NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays)
1717

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#pragma once
2+
3+
#include <cstdint>
4+
5+
namespace bb {
6+
7+
/**
8+
* We collect the number of public inputs required to represent the various classes we use
9+
* Note that these constants should not be imported directly. They should be fetched from the respective structures in
10+
* the code. For example, instead of importing PAIRING_POINTS_SIZE, we should fetch this value from
11+
* PairingPoints::PUBLIC_INPUTS_SIZE
12+
*/
13+
14+
// Number of bb::fr elements used to represent an element of bb::fr in the public inputs
15+
static constexpr std::size_t FR_PUBLIC_INPUTS_SIZE = 1;
16+
17+
// Number of bb::fr elements used to represent a bigfield element in the public inputs
18+
static constexpr std::size_t BIGFIELD_PUBLIC_INPUTS_SIZE = 4;
19+
20+
// Number of bb::fr elements used to represent a goblin bigfield element in the public inputs
21+
static constexpr std::size_t GOBLIN_FIELD_PUBLIC_INPUTS_SIZE = 4;
22+
23+
// Number of bb::fr elements used to represent a biggroup element in the public inputs
24+
static constexpr std::size_t BIGGROUP_PUBLIC_INPUTS_SIZE = 2 * BIGFIELD_PUBLIC_INPUTS_SIZE;
25+
26+
// Number of bb::fr elements used to represent a goblin biggroup element in the public inputs
27+
static constexpr std::size_t GOBLIN_GROUP_PUBLIC_INPUTS_SIZE = 2 * GOBLIN_FIELD_PUBLIC_INPUTS_SIZE;
28+
29+
// Number of bb::fr elements used to represent a pair {P0, P1} of points in the public inputs
30+
// Note that the formula assumes BIGGROUP_PUBLIC_INPUTS_SIZE == GOBLIN_GROUP_PUBLIC_INPUTS_SIZE
31+
static constexpr std::size_t PAIRING_POINTS_SIZE = 2 * BIGGROUP_PUBLIC_INPUTS_SIZE;
32+
33+
// Number of bb::fr elements used to represent a opening claim (C, (r, p(r))) over Grumpkin
34+
// Formula is: a point on Grumpkin (2 * FR_PUBLIC_INPUTS_SIZE) and two points on bb::fq (2 *
35+
// BIGFIELD_PUBLIC_INPUTS_SIZE)
36+
static constexpr std::size_t GRUMPKIN_OPENING_CLAIM_SIZE = 2 * FR_PUBLIC_INPUTS_SIZE + 2 * BIGFIELD_PUBLIC_INPUTS_SIZE;
37+
38+
// Invalid public input size, used in OpeningClaim<Curve> when Curve is not Grumpkin
39+
static constexpr std::size_t INVALID_PUBLIC_INPUTS_SIZE = 0;
40+
41+
} // namespace bb

0 commit comments

Comments
 (0)