Skip to content

Commit 30eff2a

Browse files
committed
passing bulk_test
1 parent e624cb5 commit 30eff2a

File tree

3 files changed

+465
-0
lines changed

3 files changed

+465
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include "barretenberg/flavor/relation_definitions.hpp"
2+
#include "barretenberg/vm2/constraining/flavor.hpp"
3+
#include "barretenberg/vm2/constraining/full_row.hpp"
4+
#include "barretenberg/vm2/constraining/recursion/recursive_flavor.hpp"
5+
#include "barretenberg/vm2/optimized/relations/poseidon2_perm_impl.hpp"
6+
7+
#define AvmCheckCircuitEdge(Flavor) Flavor::PolynomialEntitiesAtFixedRow<Flavor::ProverPolynomials>
8+
#define AvmCheckRelationEdge(Flavor) ::bb::avm2::AvmFullRowProxy
9+
10+
namespace bb::avm2 {
11+
12+
template class optimized_poseidon2_permImpl<AvmFlavorSettings::FF>;
13+
ACCUMULATE(optimized_poseidon2_permImpl,
14+
AvmFlavor,
15+
SumcheckTupleOfUnivariatesOverSubrelations,
16+
ExtendedEdge); // Prover.
17+
ACCUMULATE(optimized_poseidon2_permImpl, AvmFlavor, SumcheckArrayOfValuesOverSubrelations, EvaluationEdge); // Verifier.
18+
ACCUMULATE(optimized_poseidon2_permImpl,
19+
AvmFlavor,
20+
SumcheckArrayOfValuesOverSubrelations,
21+
AvmCheckCircuitEdge); // Check circuit.
22+
ACCUMULATE(optimized_poseidon2_permImpl,
23+
AvmFlavor,
24+
SumcheckArrayOfValuesOverSubrelations,
25+
AvmCheckRelationEdge); // Check relation (tests).
26+
27+
template class optimized_poseidon2_permImpl<AvmRecursiveFlavor::FF>;
28+
ACCUMULATE(optimized_poseidon2_permImpl,
29+
AvmRecursiveFlavor,
30+
SumcheckArrayOfValuesOverSubrelations,
31+
EvaluationEdge); // Verifier.
32+
33+
} // namespace bb::avm2
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#pragma once
2+
3+
#include <string_view>
4+
5+
#include "barretenberg/common/op_count.hpp"
6+
#include "barretenberg/relations/relation_parameters.hpp"
7+
#include "barretenberg/relations/relation_types.hpp"
8+
#include "barretenberg/vm2/generated/columns.hpp"
9+
10+
namespace bb::avm2 {
11+
12+
template <typename FF_> class optimized_poseidon2_permImpl {
13+
public:
14+
using FF = FF_;
15+
16+
static constexpr std::array<size_t, 265> SUBRELATION_PARTIAL_LENGTHS = {
17+
3, 3, 3, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
18+
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
19+
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
20+
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
21+
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
22+
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
23+
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
24+
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 3, 3
25+
};
26+
27+
template <typename AllEntities> inline static bool skip(const AllEntities& in)
28+
{
29+
using C = ColumnAndShifts;
30+
31+
return (in.get(C::poseidon2_perm_sel)).is_zero();
32+
}
33+
34+
template <typename ContainerOverSubrelations, typename AllEntities>
35+
void static accumulate(ContainerOverSubrelations& evals,
36+
const AllEntities& in,
37+
[[maybe_unused]] const RelationParameters<FF>&,
38+
[[maybe_unused]] const FF& scaling_factor);
39+
};
40+
41+
template <typename FF> class optimized_poseidon2_perm : public Relation<optimized_poseidon2_permImpl<FF>> {
42+
public:
43+
static constexpr const std::string_view NAME = "poseidon2_perm";
44+
45+
static std::string get_subrelation_label(size_t index)
46+
{
47+
switch (index) {}
48+
return std::to_string(index);
49+
}
50+
};
51+
52+
} // namespace bb::avm2

0 commit comments

Comments
 (0)