Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 4455c41

Browse files
committed
Fixed constants amount for sha256_process.
1 parent 3b6ebc1 commit 4455c41

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

include/nil/blueprint/components/hashes/sha2/plonk/decomposition.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ namespace nil {
203203
integral_type(var_value(assignment, instance_input.data[1]).data)};
204204
std::array<std::array<std::array<integral_type, 3>, 4>, 2> range_chunks;
205205
std::array<std::array<integral_type, 4>, 2> output_chunks;
206-
std::size_t shift = 0;
207206

208207
for (std::size_t data_idx = 0; data_idx < 2; data_idx++) {
209208
for (std::size_t chunk_idx = 0; chunk_idx < 4; chunk_idx++) {
@@ -275,15 +274,18 @@ namespace nil {
275274
}
276275

277276
template<typename BlueprintFieldType>
278-
std::size_t generate_gates(
277+
std::array<std::size_t, 2> generate_gates(
279278
const plonk_native_decomposition<BlueprintFieldType> &component,
280279
circuit<crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType>> &bp,
281280
assignment<crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType>>
282281
&assignment,
283282
const typename plonk_native_decomposition<BlueprintFieldType>::input_type
284-
&instance_input) {
283+
&instance_input,
284+
const typename lookup_library<BlueprintFieldType>::left_reserved_type &lookup_tables_indices) {
285285

286286
using var = typename plonk_native_decomposition<BlueprintFieldType>::var;
287+
using constraint = crypto3::zk::snark::plonk_constraint<BlueprintFieldType>;
288+
using lookup_constraint = crypto3::zk::snark::plonk_lookup_constraint<BlueprintFieldType>;
287289

288290
const typename BlueprintFieldType::integral_type one = 1;
289291
std::array<std::size_t, 2> selectors;

test/hashes/plonk/decomposition.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,29 +75,29 @@ void test_decomposition(std::vector<typename BlueprintFieldType::value_type> pub
7575

7676
auto result_check = [&expected_res](AssignmentType &assignment,
7777
typename component_type::result_type &real_res) {
78-
for (std::size_t i = 0; i < real_res.output.size(); i++){
79-
std::cout << var_value(assignment, real_res.output[i]).data << std::endl;
80-
}
81-
for (std::size_t i = 0; i < expected_res.size(); i++){
82-
std::cout << expected_res[i].data << std::endl;
83-
}
78+
// for (std::size_t i = 0; i < real_res.output.size(); i++){
79+
// std::cout << var_value(assignment, real_res.output[i]).data << std::endl;
80+
// }
81+
// for (std::size_t i = 0; i < expected_res.size(); i++){
82+
// std::cout << expected_res[i].data << std::endl;
83+
// }
8484
for (std::size_t i = 0; i < real_res.output.size(); i++){
8585
assert(expected_res[i] == var_value(assignment, real_res.output[i]));
8686
}
8787
};
88-
auto result_check_to_fail = [&expected_res](AssignmentType &assignment,
89-
typename component_type::result_type &real_res) { };
88+
auto result_check_to_fail = [](AssignmentType &assignment,
89+
typename component_type::result_type &real_res) {};
9090

9191
component_type component_instance({0, 1, 2, 3, 4, 5, 6, 7, 8},{},{});
9292

9393
if (expected_to_pass) {
94-
crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
94+
crypto3::test_component<component_type, BlueprintFieldType, hash_type, Lambda>(
9595
component_instance, desc, public_input, result_check, instance_input,
96-
nil::crypto3::detail::connectedness_check_type::WEAK);
96+
nil::blueprint::connectedness_check_type::type::WEAK);
9797
} else {
98-
crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
98+
crypto3::test_component_to_fail<component_type, BlueprintFieldType, hash_type, Lambda>(
9999
component_instance, desc, public_input, result_check_to_fail, instance_input,
100-
nil::crypto3::detail::connectedness_check_type::WEAK);
100+
nil::blueprint::connectedness_check_type::type::WEAK);
101101
}
102102
}
103103

test/hashes/plonk/sha256_process.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE(blueprint_plonk_sha256_process) {
5050
using BlueprintFieldType = typename curve_type::base_field_type;
5151
constexpr std::size_t WitnessColumns = 9;
5252
constexpr std::size_t PublicInputColumns = 1;
53-
constexpr std::size_t ConstantColumns = 20;
53+
constexpr std::size_t ConstantColumns = 33;
5454
constexpr std::size_t SelectorColumns = 30;
5555
using hash_type = nil::crypto3::hashes::keccak_1600<256>;
5656
constexpr std::size_t Lambda = 1;

0 commit comments

Comments
 (0)