Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed namespace for marshalling core #197

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ namespace nil {
typename BlueprintFieldType::integral_type(scalar.data);
std::vector<bool> bits_msb(component.scalar_size);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
assert(component.scalar_size <= BlueprintFieldType::modulus_bits);

std::array<bool, BlueprintFieldType::modulus_bits> bits_msb_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_scalar, status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_scalar, status);

THROW_IF_ERROR_STATUS(status, "plonk_endo_scalar::generate_assignments");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ namespace nil {
std::size_t component_start_row) {

std::array<bool, CurveType::scalar_field_type::modulus_bits> b =
nil::marshalling::pack<nil::marshalling::option::big_endian>(params.s);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(params.s);

private_assignment.witness(W1)[j] = b[0];
private_assignment.witness(W2)[j] = b[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ namespace nil {

std::array<bool, 128> bits = {false};
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::array<bool, 255> bits_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_b, status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_b, status);
THROW_IF_ERROR_STATUS(status, "curve_element_variable_base_endo_scalar_mul::generate_assignments");
std::copy(bits_all.end() - 128, bits_all.end(), bits.begin());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ namespace nil {
typename CurveType::scalar_field_type::integral_type integral_b =
typename CurveType::scalar_field_type::integral_type(b.data);
const std::size_t scalar_size = 255;
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::array<bool, scalar_size> bits =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_b, status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_b, status);
THROW_IF_ERROR_STATUS(status, "curve_element_variable_base_scalar_mul::generate_assignments");

typename BlueprintFieldType::value_type z_n2;
Expand All @@ -267,7 +267,7 @@ namespace nil {
typename CurveType::scalar_field_type::integral_type(aux.data);
const std::size_t base_size = 255;
std::array<bool, base_size> aux_bits =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_aux, status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_aux, status);
THROW_IF_ERROR_STATUS(status, "curve_element_variable_base_scalar_mul::generate_assignments");

typename BlueprintFieldType::value_type n = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ namespace nil {
};
std::vector<bool> bits(bits_amount);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::array<bool, BlueprintFieldType::modulus_bits> bytes_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(input, status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(input, status);
THROW_IF_ERROR_STATUS(status, "bit_decomposition::calculate");
std::copy(bytes_all.end() - bits_amount, bytes_all.end(), bits.begin());
}
Expand Down Expand Up @@ -221,9 +221,9 @@ namespace nil {

std::vector<bool> input_bits(component.bits_amount);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::array<bool, BlueprintFieldType::modulus_bits> bytes_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(
var_value(assignment, instance_input.input), status);
THROW_IF_ERROR_STATUS(status, "bit_decomposition::generate_assignments");
std::copy(bytes_all.end() - component.bits_amount, bytes_all.end(), input_bits.begin());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,9 @@ namespace nil {
bits[i].resize(component.bits_amount + component.padding_bits);
std::fill(bits[i].begin(), bits[i].end(), false);

nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::array<bool, BlueprintFieldType::modulus_bits> bytes_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integrals[i], status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integrals[i], status);
THROW_IF_ERROR_STATUS(status, "comparison_checked::generate_assignments");
std::copy(bytes_all.end() - component.bits_amount, bytes_all.end(),
bits[i].begin() + component.padding_bits);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,9 @@ namespace nil {
std::fill(bits[i].begin(), bits[i].end(), false);
bits[i].resize(arg_bits_amount + padding_bits);

nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::array<bool, BlueprintFieldType::modulus_bits> bytes_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integrals[i], status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integrals[i], status);
THROW_IF_ERROR_STATUS(status, "comparison_flag::calculate");

std::copy(bytes_all.end() - arg_bits_amount, bytes_all.end(),
Expand Down Expand Up @@ -468,9 +468,9 @@ namespace nil {
std::fill(bits[i].begin(), bits[i].end(), false);
bits[i].resize(component.bits_amount + component.padding_bits);

nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::array<bool, BlueprintFieldType::modulus_bits> bytes_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integrals[i], status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integrals[i], status);
THROW_IF_ERROR_STATUS(status, "comparison_flag::generate_assignments");
std::copy(bytes_all.end() - component.bits_amount, bytes_all.end(),
bits[i].begin() + component.padding_bits);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ namespace nil {
std::vector<bool> bits(component.bits_amount + component.padding_bits);
std::fill(bits.begin(), bits.end(), false);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::array<bool, BlueprintFieldType::modulus_bits> bytes_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(x_integral, status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(x_integral, status);
THROW_IF_ERROR_STATUS(status, "range_check::generate_assignments");
std::copy(bytes_all.end() - component.bits_amount, bytes_all.end(),
bits.begin() + component.padding_bits);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ namespace nil {
SumHash<BlueprintFieldType, 15>> &input,
std::ostream &stream) {
using value_type = typename BlueprintFieldType::value_type;
using Endianness = nil::marshalling::option::big_endian;
using TTypeBase = nil::marshalling::field_type<Endianness>;
using Endianness = nil::crypto3::marshalling::option::big_endian;
using TTypeBase = nil::crypto3::marshalling::field_type<Endianness>;
using marshalling_value_type = crypto3::marshalling::types::field_element<TTypeBase, value_type>;
stream << input.size() << std::endl;
for (const auto &[preimage, image] : input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ namespace nil {
typename BlueprintFieldType::integral_type(input_state[i].data);
std::vector<bool> input_state_sparse(32);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::vector<bool> input_state_sparse_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_input_state_sparse,
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_input_state_sparse,
status);
std::copy(input_state_sparse_all.end() - 32, input_state_sparse_all.end(),
input_state_sparse.begin());
Expand All @@ -230,9 +230,9 @@ namespace nil {
typename BlueprintFieldType::integral_type(input_state[i].data);
std::vector<bool> input_state_sparse(32);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::vector<bool> input_state_sparse_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_input_state_sparse,
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_input_state_sparse,
status);
std::copy(input_state_sparse_all.end() - 32, input_state_sparse_all.end(),
input_state_sparse.begin());
Expand All @@ -254,9 +254,9 @@ namespace nil {
typename BlueprintFieldType::integral_type(message_scheduling_words[(i - row) / 5 + 1].data);
std::vector<bool> a(32);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::vector<bool> a_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_a, status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_a, status);
std::copy(a_all.end() - 32, a_all.end(), a.begin());
}

Expand All @@ -276,9 +276,9 @@ namespace nil {
typename BlueprintFieldType::integral_type(message_scheduling_words[(i - row) / 5 + 14].data);
std::vector<bool> b(32);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::vector<bool> b_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_b, status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_b, status);
std::copy(b_all.end() - 32, b_all.end(), b.begin());
}

Expand Down Expand Up @@ -313,9 +313,9 @@ namespace nil {
typename BlueprintFieldType::integral_type(e.data);
std::vector<bool> e_bits(32);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::vector<bool> e_bits_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_e, status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_e, status);
std::copy(e_bits_all.end() - 32, e_bits_all.end(), e_bits.begin());
}

Expand Down Expand Up @@ -370,9 +370,9 @@ namespace nil {
typename BlueprintFieldType::integral_type(a.data);
std::vector<bool> a_bits(32);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::vector<bool> a_bits_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_a, status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_a, status);
std::copy(a_bits_all.end() - 32, a_bits_all.end(), a_bits.begin());
}

Expand Down Expand Up @@ -1393,9 +1393,9 @@ namespace nil {
typename BlueprintFieldType::integral_type(input_state[i].data);
std::vector<bool> input_state_sparse(32);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::vector<bool> input_state_sparse_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_input_state_sparse,
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_input_state_sparse,
status);
std::copy(input_state_sparse_all.end() - 32, input_state_sparse_all.end(),
input_state_sparse.begin());
Expand All @@ -1415,9 +1415,9 @@ namespace nil {
typename BlueprintFieldType::integral_type(input_state[i].data);
std::vector<bool> input_state_sparse(32);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::vector<bool> input_state_sparse_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_input_state_sparse,
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_input_state_sparse,
status);
std::copy(input_state_sparse_all.end() - 32, input_state_sparse_all.end(),
input_state_sparse.begin());
Expand All @@ -1444,9 +1444,9 @@ namespace nil {
assignment.witness(component.W(0), i) = message_scheduling_words[(i - row) / 5 + 1];
std::vector<bool> a(32);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::vector<bool> a_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_a, status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_a, status);
std::copy(a_all.end() - 32, a_all.end(), a.begin());
}

Expand Down Expand Up @@ -1486,9 +1486,9 @@ namespace nil {
typename BlueprintFieldType::integral_type(message_scheduling_words[(i - row) / 5 + 14].data);
std::vector<bool> b(32);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::vector<bool> b_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_b, status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_b, status);
std::copy(b_all.end() - 32, b_all.end(), b.begin());
}

Expand Down Expand Up @@ -1555,9 +1555,9 @@ namespace nil {
typename BlueprintFieldType::integral_type(e.data);
std::vector<bool> e_bits(32);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::vector<bool> e_bits_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_e, status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_e, status);
std::copy(e_bits_all.end() - 32, e_bits_all.end(), e_bits.begin());
}

Expand Down Expand Up @@ -1655,9 +1655,9 @@ namespace nil {
typename BlueprintFieldType::integral_type(a.data);
std::vector<bool> a_bits(32);
{
nil::marshalling::status_type status;
nil::crypto3::marshalling::status_type status;
std::vector<bool> a_bits_all =
nil::marshalling::pack<nil::marshalling::option::big_endian>(integral_a, status);
nil::crypto3::marshalling::pack<nil::crypto3::marshalling::option::big_endian>(integral_a, status);
std::copy(a_bits_all.end() - 32, a_bits_all.end(), a_bits.begin());
}

Expand Down
Loading
Loading