-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
non native multiplication bbf
Antoine Cyr
committed
Dec 29, 2024
1 parent
3d24531
commit c1c2887
Showing
20 changed files
with
124 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
crypto3/libs/blueprint/include/nil/blueprint/bbf/check_proof.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#include <nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp> | ||
#include <nil/crypto3/zk/snark/systems/plonk/placeholder/verifier.hpp> | ||
#include <nil/crypto3/zk/snark/systems/plonk/placeholder/params.hpp> | ||
#include <nil/crypto3/zk/snark/systems/plonk/placeholder/preprocessor.hpp> | ||
|
||
#include <nil/crypto3/hash/algorithm/hash.hpp> | ||
#include <nil/crypto3/hash/sha2.hpp> | ||
#include <nil/crypto3/hash/keccak.hpp> | ||
|
||
#include <nil/crypto3/zk/snark/arithmetization/plonk/params.hpp> | ||
|
||
template<typename FieldType> | ||
bool check_proof( | ||
const nil::blueprint::circuit<zk::snark::plonk_constraint_system<FieldType>> &bp, | ||
const zk::snark::plonk_assignment_table<FieldType> &assignment, | ||
const zk::snark::plonk_table_description<FieldType> &desc) { | ||
|
||
std::size_t Lambda = 9; | ||
|
||
typedef nil::crypto3::zk::snark::placeholder_circuit_params<FieldType> circuit_params; | ||
using transcript_hash_type = nil::crypto3::hashes::keccak_1600<256>; | ||
using merkle_hash_type = nil::crypto3::hashes::keccak_1600<256>; | ||
using transcript_type = typename nil::crypto3::zk::transcript::fiat_shamir_heuristic_sequential<transcript_hash_type>; | ||
using lpc_params_type = nil::crypto3::zk::commitments::list_polynomial_commitment_params< | ||
merkle_hash_type, | ||
transcript_hash_type, | ||
2 //m | ||
>; | ||
|
||
using lpc_type = nil::crypto3::zk::commitments::list_polynomial_commitment<FieldType, lpc_params_type>; | ||
using lpc_scheme_type = typename nil::crypto3::zk::commitments::lpc_commitment_scheme<lpc_type>; | ||
using lpc_placeholder_params_type = nil::crypto3::zk::snark::placeholder_params<circuit_params, lpc_scheme_type>; | ||
typename lpc_type::fri_type::params_type fri_params(1, std::ceil(log2(assignment.rows_amount())), Lambda, 2); | ||
lpc_scheme_type lpc_scheme(fri_params); | ||
|
||
std::cout << "Public preprocessor" << std::endl; | ||
typename nil::crypto3::zk::snark::placeholder_public_preprocessor<FieldType, | ||
lpc_placeholder_params_type>::preprocessed_data_type lpc_preprocessed_public_data = | ||
nil::crypto3::zk::snark::placeholder_public_preprocessor<FieldType, lpc_placeholder_params_type>::process( | ||
bp, assignment.public_table(), desc, lpc_scheme, 10); | ||
|
||
std::cout << "Private preprocessor" << std::endl; | ||
typename nil::crypto3::zk::snark::placeholder_private_preprocessor<FieldType, | ||
lpc_placeholder_params_type>::preprocessed_data_type lpc_preprocessed_private_data = | ||
nil::crypto3::zk::snark::placeholder_private_preprocessor<FieldType, lpc_placeholder_params_type>::process( | ||
bp, assignment.private_table(), desc); | ||
|
||
std::cout << "Prover" << std::endl; | ||
auto lpc_proof = nil::crypto3::zk::snark::placeholder_prover<FieldType, lpc_placeholder_params_type>::process( | ||
lpc_preprocessed_public_data, std::move(lpc_preprocessed_private_data), desc, bp, | ||
lpc_scheme); | ||
|
||
// We must not use the same instance of lpc_scheme. | ||
lpc_scheme_type verifier_lpc_scheme(fri_params); | ||
|
||
std::cout << "Verifier" << std::endl; | ||
bool verifier_res = nil::crypto3::zk::snark::placeholder_verifier<FieldType, lpc_placeholder_params_type>::process( | ||
lpc_preprocessed_public_data.common_data, lpc_proof, desc, bp, verifier_lpc_scheme); | ||
return verifier_res; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.