Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit cad1702

Browse files
authored
Added a resource system for sha lookup tables. (#279)
* Added a resource system for sha lookup tables. * Changed the path exporting mechanism.
1 parent 93b6463 commit cad1702

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
157157
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)
158158

159159

160+
set(BLUEPRINT_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
161+
target_compile_definitions(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE BLUEPRINT_PATH="${BLUEPRINT_PATH}")
162+
160163
if(BUILD_TESTS)
161164
add_subdirectory(test)
162165
endif()

include/nil/blueprint/lookup_library.hpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,9 @@ namespace nil {
137137
};
138138

139139
virtual void generate() {
140+
std::string blueprint_path = BLUEPRINT_PATH;
140141
this->_table = components::detail::load_sha_table<BlueprintFieldType>(
141-
{"8_split_4.txt",
142-
"./../libs/crypto3/libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/detail/8_split_4.txt",
143-
"./../libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/detail/8_split_4.txt",
144-
"./../../../../libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/detail/8_split_4.txt"});
142+
{blueprint_path + "/include/nil/blueprint/components/hashes/sha2/plonk/detail/8_split_4.txt"});
145143
if (this->_table.size() == 0 || this->_table[0].size() == 0) {
146144
std::cerr << "Failed to load table 8_split_4.txt!"
147145
" Please check the paths and generate the table."
@@ -188,11 +186,9 @@ namespace nil {
188186
this->subtables["full"] = {{0,1}, 0, 43903};
189187
};
190188
virtual void generate() {
189+
std::string blueprint_path = BLUEPRINT_PATH;
191190
this->_table = components::detail::load_sha_table<BlueprintFieldType>(
192-
{"8_split_7.txt",
193-
"./../libs/crypto3/libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/detail/8_split_7.txt",
194-
"./../libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/detail/8_split_7.txt",
195-
"./../../../../libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/detail/8_split_7.txt"});
191+
{blueprint_path + "/include/nil/blueprint/components/hashes/sha2/plonk/detail/8_split_7.txt"});
196192
if (this->_table.size() == 0 || this->_table[0].size() == 0) {
197193
std::cerr << "Failed to load table 8_split_7.txt!"
198194
" Please check the paths and generate the table."

0 commit comments

Comments
 (0)