Skip to content

Commit

Permalink
Fixed some of the warnings. (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
Iluvmagick authored Feb 7, 2024
1 parent 1d6c8d2 commit 2360406
Show file tree
Hide file tree
Showing 34 changed files with 128 additions and 200 deletions.
26 changes: 13 additions & 13 deletions include/nil/crypto3/marshalling/math/types/expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace nil {
// Marshalling struct for flat_pow_operation.
template<typename TTypeBase>
struct flat_pow_operation {
using type =
using type =
nil::marshalling::types::bundle<
TTypeBase,
std::tuple<
Expand All @@ -64,7 +64,7 @@ namespace nil {
// Marshalling struct for flat_binary_arithmetic_operation.
template<typename TTypeBase>
struct flat_binary_arithmetic_operation {
using type =
using type =
nil::marshalling::types::bundle<
TTypeBase,
std::tuple<
Expand All @@ -86,7 +86,7 @@ namespace nil {
template<typename TTypeBase, typename ExpressionType>
struct expression
{
using type =
using type =
nil::marshalling::types::bundle<
TTypeBase,
std::tuple<
Expand All @@ -104,7 +104,7 @@ namespace nil {
nil::marshalling::option::sequence_size_field_prefix<
nil::marshalling::types::integral<TTypeBase, std::size_t>>
>,
// std::vector<flat_binary_arithmetic_operation> binary_operations
// std::vector<flat_binary_arithmetic_operation> binary_operations
nil::marshalling::types::array_list<
TTypeBase,
typename flat_binary_arithmetic_operation<TTypeBase>::type,
Expand Down Expand Up @@ -138,7 +138,7 @@ namespace nil {
std::make_tuple(
nil::marshalling::types::integral<TTypeBase, std::uint8_t>((std::uint8_t)bin_op.op),
nil::marshalling::types::integral<TTypeBase, std::uint8_t>((std::uint8_t)bin_op.left_type),
nil::marshalling::types::integral<TTypeBase, std::uint32_t>(bin_op.left_index),
nil::marshalling::types::integral<TTypeBase, std::uint32_t>(bin_op.left_index),
nil::marshalling::types::integral<TTypeBase, std::uint8_t>((std::uint8_t)bin_op.right_type),
nil::marshalling::types::integral<TTypeBase, std::uint32_t>(bin_op.right_index)));
}
Expand All @@ -153,7 +153,7 @@ namespace nil {

using TTypeBase = nil::marshalling::field_type<Endianness>;
using size_t_marshalling_type = nil::marshalling::types::integral<TTypeBase, std::size_t>;
// Fill the terms.
// Fill the terms.
using term_marshalling_type =
typename term<TTypeBase, typename ExpressionType::term_type>::type;
using term_vector_marshalling_type = nil::marshalling::types::array_list<
Expand All @@ -165,7 +165,7 @@ namespace nil {
fill_term<Endianness, typename ExpressionType::term_type>(term));
}

// Fill the power operations.
// Fill the power operations.
using pow_operation_type = typename flat_pow_operation<TTypeBase>::type;
using pow_vector_marshalling_type = nil::marshalling::types::array_list<
TTypeBase, pow_operation_type, nil::marshalling::option::sequence_size_field_prefix<
Expand All @@ -175,7 +175,7 @@ namespace nil {
filled_powers.value().push_back(fill_power_operation<Endianness>(power));
}

// Fill the binary operations.
// Fill the binary operations.
using binary_operation_type = typename flat_binary_arithmetic_operation<TTypeBase>::type;
using binary_operation_vector_marshalling_type = nil::marshalling::types::array_list<
TTypeBase, binary_operation_type,
Expand All @@ -193,11 +193,11 @@ namespace nil {
filled_binary_opeations,
nil::marshalling::types::integral<TTypeBase, std::uint8_t>((std::uint8_t)flat_expr.root_type),
nil::marshalling::types::integral<TTypeBase, std::uint32_t>(flat_expr.root_index)));

}

template<typename Endianness>
math::flat_pow_operation
math::flat_pow_operation
make_power_operation(const typename flat_pow_operation<nil::marshalling::field_type<Endianness>>::type& filled_power_op) {
math::flat_pow_operation power_op;
power_op.power = std::get<0>(filled_power_op.value()).value();
Expand Down Expand Up @@ -228,21 +228,21 @@ namespace nil {

// Get the terms.
const auto& terms = std::get<0>(filled_expr.value()).value();
for (auto i = 0; i < terms.size(); i++) {
for (std::size_t i = 0; i < terms.size(); i++) {
flat_expr.terms.emplace_back(
make_term<Endianness, typename ExpressionType::term_type>(terms.at(i)));
}

// Get the power operations.
const auto& powers = std::get<1>(filled_expr.value()).value();
for (auto i = 0; i < powers.size(); i++) {
for (std::size_t i = 0; i < powers.size(); i++) {
flat_expr.pow_operations.emplace_back(
make_power_operation<Endianness>(powers.at(i)));
}

// Get the binary arithmetic operations.
const auto& bin_ops = std::get<2>(filled_expr.value()).value();
for (auto i = 0; i < bin_ops.size(); i++) {
for (std::size_t i = 0; i < bin_ops.size(); i++) {
flat_expr.binary_operations.emplace_back(
make_binary_operation<Endianness, ArithmeticOperatorType>(bin_ops.at(i)));
}
Expand Down
2 changes: 1 addition & 1 deletion include/nil/crypto3/marshalling/math/types/term.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace nil {
std::vector<typename NonLinearTerm::variable_type> vars;
auto coeff = std::get<0>(filled_term.value()).value();
vars.reserve(std::get<1>(filled_term.value()).value().size());
for (auto i = 0; i < std::get<1>(filled_term.value()).value().size(); i++) {
for (std::size_t i = 0; i < std::get<1>(filled_term.value()).value().size(); i++) {
vars.emplace_back(make_variable<Endianness, typename NonLinearTerm::variable_type>(
std::get<1>(filled_term.value()).value().at(i)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ namespace nil {
struct is_fri_commitment {
template <typename U>
static std::true_type test(typename U::precommitment_type*);

template <typename>
static std::false_type test(...);

// A constexpr boolean indicating if the field exists in T
static constexpr bool value = decltype(test<CommitmentType>(nullptr))::value;
};
Expand All @@ -62,10 +62,10 @@ namespace nil {
struct is_kzg_commitment {
template <typename U>
static std::true_type test(typename U::verification_key_type*);

template <typename>
static std::false_type test(...);

// A constexpr boolean indicating if the field exists in T
static constexpr bool value = decltype(test<CommitmentType>(nullptr))::value;
};
Expand Down Expand Up @@ -122,7 +122,7 @@ namespace nil {

// Define commitment_params marshalling type for FRI.
template<typename Endianness, typename CommitmentParamsType>
struct commitment_params<Endianness, CommitmentParamsType,
struct commitment_params<Endianness, CommitmentParamsType,
typename std::enable_if_t<is_fri_commitment<CommitmentParamsType>::value>> {
using TTypeBase = typename nil::marshalling::field_type<Endianness>;
using integral_type = nil::marshalling::types::integral<TTypeBase, std::size_t>;
Expand Down Expand Up @@ -162,7 +162,6 @@ namespace nil {
using TTypeBase = typename nil::marshalling::field_type<Endianness>;
using FieldType = typename CommitmentParamsType::field_type;
using result_type = typename commitment_params<Endianness, CommitmentParamsType>::type;
using integral_type = nil::marshalling::types::integral<TTypeBase, std::size_t>;

std::vector<typename FieldType::value_type> D_unity_roots;
for (const auto& domain : fri_params.D) {
Expand Down Expand Up @@ -194,7 +193,7 @@ namespace nil {
std::tuple<
// std::vector<typename curve_type::template g1_type<>::value_type> commitment_key;
field_element_vector_type<TTypeBase, typename CommitmentParamsType::field_type::value_type>,
// verification_key_type verification_key;
// verification_key_type verification_key;
field_element<TTypeBase, typename CommitmentParamsType::field_type::value_type>
>
>;
Expand All @@ -206,7 +205,6 @@ namespace nil {
typename commitment_params<Endianness, CommitmentParamsType>::type
fill_commitment_params(const CommitmentParamsType &kzg_params) {
using TTypeBase = typename nil::marshalling::field_type<Endianness>;
using FieldType = typename CommitmentParamsType::field_type;
using result_type = typename commitment_params<Endianness, CommitmentParamsType>::type;

return result_type(std::make_tuple(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace nil {
using eval_storage = nil::marshalling::types::bundle<
TTypeBase,
std::tuple<
// batch_info.
// batch_info.
// We'll check is it good for current EVM instance
// All z-s are placed into plain array
nil::marshalling::types::array_list<
Expand All @@ -67,7 +67,7 @@ namespace nil {
nil::marshalling::option::sequence_size_field_prefix<nil::marshalling::types::integral<TTypeBase, std::size_t>>
>,

// evaluation_points_num.
// evaluation_points_num.
nil::marshalling::types::array_list<
TTypeBase,
nil::marshalling::types::integral<TTypeBase, uint8_t>,
Expand All @@ -77,7 +77,7 @@ namespace nil {
>;

template<typename Endianness, typename EvalStorage>
eval_storage<nil::marshalling::field_type<Endianness>, EvalStorage>
eval_storage<nil::marshalling::field_type<Endianness>, EvalStorage>
fill_eval_storage( const EvalStorage &z ){
using TTypeBase = nil::marshalling::field_type<Endianness>;

Expand Down Expand Up @@ -131,8 +131,6 @@ namespace nil {
EvalStorage make_eval_storage(
const eval_storage<nil::marshalling::field_type<Endianness>, EvalStorage> &filled_storage
){
using TTypeBase = nil::marshalling::field_type<Endianness>;

EvalStorage z;
typename nil::crypto3::marshalling::types::batch_info_type batch_info;
std::vector<std::uint8_t> eval_points_num;
Expand Down
6 changes: 2 additions & 4 deletions include/nil/crypto3/marshalling/zk/types/commitments/fri.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ namespace nil {
initial_val.push_back(initial_proof.values[j][k][l]);
}
}
BOOST_ASSERT((1 << (params.step_list[0] - 1)) == initial_proof.values[j].size());
BOOST_ASSERT(std::size_t(1 << (params.step_list[0] - 1)) == initial_proof.values[j].size());
}
}
}
Expand Down Expand Up @@ -377,8 +377,6 @@ namespace nil {
make_fri_proof(
const typename fri_proof<nil::marshalling::field_type<Endianness>, FRI>::type &filled_proof, const batch_info_type &batch_info
){
using TTypeBase = nil::marshalling::field_type<Endianness>;
using field_marhsalling_type = field_element<TTypeBase, typename FRI::field_type::value_type>;
typename FRI::proof_type proof;
// merkle roots
for( std::size_t i = 0; i < std::get<0>(filled_proof.value()).value().size(); i++){
Expand All @@ -394,7 +392,7 @@ namespace nil {
}

// initial_polynomials values
auto coset_size = 1 << (step_list[0] - 1);
std::size_t coset_size = 1 << (step_list[0] - 1);
std::size_t cur = 0;
for( std::size_t i = 0; i < FRI::lambda; i++ ){
for( const auto &it:batch_info){
Expand Down
7 changes: 3 additions & 4 deletions include/nil/crypto3/marshalling/zk/types/commitments/lpc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ namespace nil {
fill_commitment(typename CommitmentSchemeType::commitment_type commitment){
return fill_merkle_node_value<typename CommitmentSchemeType::commitment_type, Endianness>( commitment );
}

template <typename Endianness, typename CommitmentSchemeType >
typename CommitmentSchemeType::commitment_type
make_commitment(const typename commitment<nil::marshalling::field_type<Endianness>, CommitmentSchemeType>::type &filled_commitment){
return make_merkle_node_value<typename CommitmentSchemeType::commitment_type, Endianness>( filled_commitment );
}

// FOR LPC only because of basic_fri field
template <typename TTypeBase, typename LPC >
template <typename TTypeBase, typename LPC >
struct eval_proof{
using type = nil::marshalling::types::bundle<
TTypeBase,
Expand All @@ -84,7 +84,7 @@ namespace nil {
};

template<typename Endianness, typename LPC>
typename eval_proof<nil::marshalling::field_type<Endianness>, LPC>::type
typename eval_proof<nil::marshalling::field_type<Endianness>, LPC>::type
fill_eval_proof( const typename LPC::proof_type &proof, const typename LPC::fri_type::params_type& fri_params){
using TTypeBase = nil::marshalling::field_type<Endianness>;

Expand All @@ -103,7 +103,6 @@ namespace nil {

template<typename Endianness, typename LPC>
typename LPC::proof_type make_eval_proof(const typename eval_proof<nil::marshalling::field_type<Endianness>, LPC>::type &filled_proof){
using TTypeBase = nil::marshalling::field_type<Endianness>;
typename LPC::proof_type proof;

proof.z = make_eval_storage<Endianness, typename LPC::eval_storage_type>(std::get<0>(filled_proof.value()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ namespace nil {
fill_powers_of_tau_accumulator(const Accumulator &accumulator) {

using TTypeBase = nil::marshalling::field_type<Endianness>;
using curve_g1_element_type =
fast_curve_element<TTypeBase, typename Accumulator::curve_type::template g1_type<>>;
using curve_g2_element_type =
fast_curve_element<TTypeBase, typename Accumulator::curve_type::template g2_type<>>;

return powers_of_tau_accumulator<TTypeBase, Accumulator>(std::make_tuple(
std::move(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ namespace nil {
element_pok<nil::marshalling::field_type<Endianness>, POK>
fill_element_pok(const POK &pok) {

using TTypeBase = nil::marshalling::field_type<Endianness>;

return element_pok<nil::marshalling::field_type<Endianness>, POK>(
std::make_tuple(
std::move(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ namespace nil {
r1cs_gg_ppzksnark_mpc_public_key<nil::marshalling::field_type<Endianness>, PublicKey>
fill_r1cs_gg_ppzksnark_mpc_public_key(const PublicKey &public_key) {

using TTypeBase = nil::marshalling::field_type<Endianness>;

return r1cs_gg_ppzksnark_mpc_public_key<nil::marshalling::field_type<Endianness>, PublicKey>(
std::make_tuple(
std::move(
Expand Down
Loading

0 comments on commit 2360406

Please sign in to comment.