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

replace _cppui255 with _cppui_modular255 #87

Merged
merged 2 commits into from
Jul 5, 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
26 changes: 2 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,10 @@ if(NOT CMAKE_WORKSPACE_NAME OR NOT ("${CMAKE_WORKSPACE_NAME}" STREQUAL "crypto3"
cm_workspace(crypto3)
endif()

macro(cm_find_package NAME)
foreach(ITERATOR ${CMAKE_WORKSPACE_LIST})
if(NOT "${NAME}" MATCHES "^${ITERATOR}_.*$" AND NOT "${NAME}" STREQUAL CM)
find_package(${ARGV})
else()
set(${ARGV0}_FOUND ON CACHE BOOL "")
endif()
endforeach()
endmacro()

cm_project(transpiler WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES ASM C CXX)

cm_find_package(CM)
include(CMDeploy)

option(BUILD_TESTS "Build unit tests" FALSE)

list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS)

list(APPEND ${CURRENT_PROJECT_NAME}_UNGROUPED_SOURCES)

list(APPEND ${CURRENT_PROJECT_NAME}_HEADERS ${${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS})

list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES ${${CURRENT_PROJECT_NAME}_UNGROUPED_SOURCES})

cm_setup_version(VERSION 0.1.0 PREFIX ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})

add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE)
Expand All @@ -73,6 +52,5 @@ cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
INCLUDE include
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)

if(BUILD_TESTS)
add_subdirectory(test)
endif()
include(CMTest)
cm_add_test_subdirectory(test)
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ namespace nil {
std::string result;
std::vector <std::string> v;
if( term.get_coeff() != field_type::value_type::one() || term.get_vars().size() == 0)
v.push_back("pallas::base_field_type::value_type(0x" + to_hex_string(term.get_coeff()) + "_cppui255)");
v.push_back("pallas::base_field_type::value_type(0x" + to_hex_string(term.get_coeff()) + "_cppui_modular255)");
for(auto& var: term.get_vars()){
v.push_back("z[" + to_string(_indices.at(var)) + "]");
}
Expand Down Expand Up @@ -662,7 +662,7 @@ namespace nil {
prepare_U_V_str << "\n";
}
for( std::size_t j = 0; j < placeholder_info.batches_sizes[0]; j++){
prepare_U_V_str << "\tU[unique_points] += theta_acc * pallas::base_field_type::value_type(0x"<< std::hex << common_data.commitment_scheme_data.at(0)[j] << std::dec << "_cppui255); theta_acc *= challenges.lpc_theta;\n";
prepare_U_V_str << "\tU[unique_points] += theta_acc * pallas::base_field_type::value_type(0x"<< std::hex << common_data.commitment_scheme_data.at(0)[j] << std::dec << "_cppui_modular255); theta_acc *= challenges.lpc_theta;\n";
}

std::stringstream lpc_y_computation;
Expand Down Expand Up @@ -716,7 +716,7 @@ namespace nil {
}
start_position += batches_sizes[i];
if( i == 0 )
initial_proof_check_str += "\t\t__builtin_assigner_exit_check(hash_state == pallas::base_field_type::value_type(0x$VK1$_cppui255));\n\n";
initial_proof_check_str += "\t\t__builtin_assigner_exit_check(hash_state == pallas::base_field_type::value_type(0x$VK1$_cppui_modular255));\n\n";
else
initial_proof_check_str += "\t\t__builtin_assigner_exit_check(hash_state == proof.commitments[" + to_string(i-1) + "]);\n\n";
}
Expand Down Expand Up @@ -1030,8 +1030,8 @@ namespace nil {
reps["$QUOTIENT_POLYS_AMOUNT$"] = to_string(quotient_polys);
reps["$D0_SIZE$"] = to_string(fri_params.D[0]->m);
reps["$D0_LOG$"] = to_string(log2(fri_params.D[0]->m));
reps["$D0_OMEGA$"] = "pallas::base_field_type::value_type(0x" + to_hex_string(fri_params.D[0]->get_domain_element(1)) + "_cppui255)";
reps["$OMEGA$"] = "pallas::base_field_type::value_type(0x" + to_hex_string(common_data.basic_domain->get_domain_element(1)) + "_cppui255)";
reps["$D0_OMEGA$"] = "pallas::base_field_type::value_type(0x" + to_hex_string(fri_params.D[0]->get_domain_element(1)) + "_cppui_modular255)";
reps["$OMEGA$"] = "pallas::base_field_type::value_type(0x" + to_hex_string(common_data.basic_domain->get_domain_element(1)) + "_cppui_modular255)";
reps["$FRI_ROUNDS$"] = to_string(fri_params.r);
reps["$UNIQUE_POINTS$"] = to_string(singles_strs.size());
reps["$SINGLES_AMOUNT$"] = to_string(singles_strs.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ const std::array<int, gates_amount> gates_sizes = {$GATES_SIZES$};
const size_t unique_points = $UNIQUE_POINTS$;
const size_t singles_amount = $SINGLES_AMOUNT$;
const std::array<std::size_t, batches_num> batches_amount_list = {$BATCHES_AMOUNT_LIST$};
pallas::base_field_type::value_type vk0 = pallas::base_field_type::value_type(0x$VK0$_cppui255);
pallas::base_field_type::value_type vk1 = pallas::base_field_type::value_type(0x$VK1$_cppui255);
pallas::base_field_type::value_type vk0 = pallas::base_field_type::value_type(0x$VK0$_cppui_modular255);
pallas::base_field_type::value_type vk1 = pallas::base_field_type::value_type(0x$VK1$_cppui_modular255);


$LOOKUP_VARS$
Expand Down