NilFoundation / zkLLVM

Zero-Knowledge Proof Systems Circuit Compiler
https://docs.nil.foundation/zkllvm
284 stars 48 forks source link

[Possible bug] pallas::base_field_type::value_type operations ==, != #458

Closed ETatuzova closed 8 months ago

ETatuzova commented 9 months ago

Compiler has segfault on this example:

#include <nil/crypto3/hash/algorithm/hash.hpp>
#include <nil/crypto3/hash/poseidon.hpp>
#include <nil/crypto3/algebra/curves/pallas.hpp>

using namespace nil::crypto3;
using namespace nil::crypto3::algebra::curves;

[[circuit]] bool test(
    std::array<pallas::base_field_type::value_type, 2> vk
) {
    pallas::base_field_type::value_type test_var(0xa0);
    bool b = (test_var == pallas::base_field_type::value_type(0x1));

    return b;
}

Example with another constant compiled well,

#include <nil/crypto3/hash/algorithm/hash.hpp>
#include <nil/crypto3/hash/poseidon.hpp>
#include <nil/crypto3/algebra/curves/pallas.hpp>

using namespace nil::crypto3;
using namespace nil::crypto3::algebra::curves;

[[circuit]] bool test(
    std::array<pallas::base_field_type::value_type, 2> vk
) {
    pallas::base_field_type::value_type test_var(0xa0);
    bool b = (test_var == pallas::base_field_type::value_type(0xa0));

    return b;
}
makxenov commented 8 months ago

Fixed in https://github.com/NilFoundation/zkllvm-circifier/pull/103