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

Commit 4bc8ca1

Browse files
ETatuzovankaskov
authored andcommitted
Transpiler tests initialization #21
1 parent 6c5eb50 commit 4bc8ca1

28 files changed

+590
-35
lines changed

CMakeLists.txt

+19-35
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#---------------------------------------------------------------------------#
2+
# Copyright (c) 2018-2020 Mikhail Komarov <[email protected]>
3+
#
4+
# Distributed under the Boost Software License, Version 1.0
5+
# See accompanying file LICENSE_1_0.txt or copy at
6+
# http://www.boost.org/LICENSE_1_0.txt
7+
#---------------------------------------------------------------------------#
8+
19
cmake_minimum_required(VERSION 2.8.12)
210

311
cmake_policy(SET CMP0028 NEW)
@@ -28,31 +36,14 @@ macro(cm_find_package NAME)
2836
endforeach()
2937
endmacro()
3038

31-
cm_project(transpiler WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES C CXX)
39+
cm_project(transpiler WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES ASM C CXX)
3240

3341
cm_find_package(CM)
3442
include(CMDeploy)
35-
include(FindPkgConfig)
3643

37-
option(BUILD_WITH_CCACHE "Build with ccache usage" TRUE)
3844
option(BUILD_TESTS "Build unit tests" FALSE)
39-
option(BUILD_EXAMPLES "Build examples" FALSE)
40-
41-
if(UNIX AND BUILD_WITH_CCACHE)
42-
find_program(CCACHE_FOUND ccache)
43-
if(CCACHE_FOUND)
44-
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
45-
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
46-
endif(CCACHE_FOUND)
47-
endif()
48-
49-
if(UNIX AND BUILD_WITH_PROCPS)
50-
find_package(Procps)
51-
endif()
5245

53-
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
54-
include/nil/crypto3/zk/blueprint/transpiler/profiling_plonk_circuit.hpp
55-
include/nil/crypto3/zk/blueprint/transpiler/table_profiling.hpp)
46+
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS)
5647

5748
list(APPEND ${CURRENT_PROJECT_NAME}_UNGROUPED_SOURCES)
5849

@@ -67,31 +58,24 @@ add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE)
6758
set_target_properties(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} PROPERTIES
6859
EXPORT_NAME ${CURRENT_PROJECT_NAME})
6960

61+
7062
target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
7163
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
7264
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>"
7365

7466
${Boost_INCLUDE_DIRS})
7567

7668
target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
77-
crypto3::algebra
78-
crypto3::block
79-
crypto3::blueprint
80-
crypto3::codec
81-
crypto3::math
82-
crypto3::multiprecision
83-
crypto3::pkpad
84-
crypto3::pubkey
85-
crypto3::random
86-
crypto3::zk
87-
88-
marshalling::core
89-
marshalling::crypto3_algebra
90-
marshalling::crypto3_multiprecision
91-
marshalling::crypto3_zk
69+
${CMAKE_WORKSPACE_NAME}::algebra
70+
${CMAKE_WORKSPACE_NAME}::multiprecision
71+
${CMAKE_WORKSPACE_NAME}::zk
9272

9373
${Boost_LIBRARIES})
9474

9575
cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
9676
INCLUDE include
97-
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)
77+
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)
78+
79+
if(BUILD_TESTS)
80+
add_subdirectory(test)
81+
endif()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef __MODULAR_CONTRACT_TEMPLATE_HPP__
2+
#define __MODULAR_CONTRACT_TEMPLATE_HPP__
3+
4+
#include <string>
5+
6+
namespace nil {
7+
namespace blueprint {
8+
}
9+
}
10+
11+
#endif //__MODULAR_CONTRACT_TEMPLATE_HPP__

test/CMakeLists.txt

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#---------------------------------------------------------------------------#
2+
# Copyright (c) 2018-2020 Mikhail Komarov <[email protected]>
3+
#
4+
# Distributed under the Boost Software License, Version 1.0
5+
# See accompanying file LICENSE_1_0.txt or copy at
6+
# http://www.boost.org/LICENSE_1_0.txt
7+
#---------------------------------------------------------------------------#
8+
9+
include(CMTest)
10+
11+
if(NOT Boost_UNIT_TEST_FRAMEWORK_FOUND)
12+
cm_find_package(Boost REQUIRED COMPONENTS unit_test_framework)
13+
endif()
14+
15+
cm_test_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
16+
17+
${CMAKE_WORKSPACE_NAME}::algebra
18+
${CMAKE_WORKSPACE_NAME}::math
19+
${CMAKE_WORKSPACE_NAME}::multiprecision
20+
${CMAKE_WORKSPACE_NAME}::zk
21+
22+
marshalling::core
23+
marshalling::crypto3_multiprecision
24+
marshalling::crypto3_algebra
25+
marshalling::crypto3_zk
26+
${Boost_LIBRARIES})
27+
28+
29+
macro(define_transpiler_test name)
30+
cm_test(NAME transpiler_${name}_test SOURCES ${name}.cpp)
31+
32+
target_include_directories(transpiler_${name}_test PRIVATE
33+
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
34+
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>"
35+
36+
${Boost_INCLUDE_DIRS})
37+
38+
set_target_properties(transpiler_${name}_test PROPERTIES CXX_STANDARD 17)
39+
40+
get_target_property(target_type Boost::unit_test_framework TYPE)
41+
if(target_type STREQUAL "SHARED_LIB")
42+
target_compile_definitions(transpiler_${name}_test PRIVATE BOOST_TEST_DYN_LINK)
43+
elseif(target_type STREQUAL "STATIC_LIB")
44+
45+
endif()
46+
endmacro()
47+
48+
set(TESTS_NAMES
49+
"transpiler"
50+
)
51+
52+
foreach(TEST_NAME ${TESTS_NAMES})
53+
define_transpiler_test(${TEST_NAME})
54+
endforeach()

test/data/circuit1/circuit.crct

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0x00000000000000020000000000000000000000000000000100000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000000000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000010000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000020000000001000000000000000000000000000000000200000000000000000000010102000000000000000002020000000100000000000000010000000000000001000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000002000000000000000000000000010000000000000000010000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000020000000001000000000000000000000000000000000101000000000000000000010200000000000000000000000000000000000000000000000000000000

test/data/circuit1/common.dat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0x0000000000000040bea601d8897e06b13f8470f971cf03d6006d3a0833e3636ae438072b65bf33b1c7421282886d44eb624379f5c1d45cbc6b650306a148330e8b46aaecdb880e3500000000000000060000000000000001000000000000000000000001000000000000000000000001000000000000000000000001000000000000000000000001000000000000000000000001000000000000000000000010000000000000000d0000000000000002000000000000004030df292e6ed63678aef145e3dfb85f8f6be459c5edc66275edaa39b3db947a9b5145cb9cb3d5fe40e6365e6cc2d1749a850bf23a48ff0cc9a614875732eb7eb0

test/data/circuit1/params.json

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"test_name": "circuit1",
3+
"modulus": "28948022309329048855892746252171976963363056481941560715954676764349967630337",
4+
"rows_amount": "16",
5+
"usable_rows_amount": "13",
6+
"omega": "14450201850503471296781915119640920297985789873634237091629829669980153907901",
7+
"verification_key": "d01dad89947ad38adc7e68ae52f8fb2a1c430fd535887b78fd3ac57a2cbc5f09 f347e1a5c5bec69f49b12f482b4eb2ba2687d9270cb998f29ba4ead18a440703",
8+
"ar_params": [
9+
"3",
10+
"1",
11+
"0",
12+
"3"
13+
],
14+
"columns_rotations_node": [
15+
[
16+
"0"
17+
],
18+
[
19+
"0"
20+
],
21+
[
22+
"0"
23+
],
24+
[
25+
"0"
26+
],
27+
[
28+
"0"
29+
],
30+
[
31+
"0"
32+
]
33+
],
34+
"commitment_params_node": {
35+
"type": "LPC",
36+
"r": "3",
37+
"m": "2",
38+
"lambda": "40",
39+
"max_degree": "15",
40+
"step_list": [
41+
"1",
42+
"1",
43+
"1"
44+
],
45+
"D_omegas": [
46+
"23692685744005816481424929253249866475360293751445976741406164118468705843520",
47+
"7356716530956153652314774863381845254278968224778478050456563329565810467774",
48+
"17166126583027276163107155648953851600645935739886150467584901586847365754678"
49+
],
50+
"grinding_params": {
51+
"mask": "4294901760"
52+
}
53+
}
54+
}

test/data/circuit1/proof.bin

+1
Large diffs are not rendered by default.

test/data/circuit2/circuit.crct

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0x0000000000000002000000000000000000000000000000010000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000010000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000010000000000000001000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000010000000000000002000000000100000000000000000000000000000000020000000000000000000001010200000000000000000202000000010000000000000001000000000000000100000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000200000000000000000000000001000000000000000001000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000010000000000000002000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000010000000000000000ffffffff010000000000000000000000000000000002010000000000000000000100020000000000000000020200000001000000000000000c00000000000000010000000100000000000000000002000000000000000000000000000100000002000000000000000000020000000100000000000000000001000000030000000000000000000200000002000000000000000000010000000400000000000000000002000000030000000000000000000100000005000000000000000000020000000400000000000000000001000000060000000000000000000200000005000000000000000000010000000700000000000000000002000000060000000000000000000100000008000000000000000000020000000700000000000000000001000000090000000000000000000200000008000000000000000000010000000a0000000000000000000200000009000000000000000000010000000b0000000000000000000000000000000100000000000000010000000c0000000000000000000000000000000100000000000000000000000000000000

test/data/circuit2/common.dat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0x0000000000000040a48bc0876fbe3cfb7d13c143526a04a7f6f4a9af3e89806e16ff0f2023257f46afecfe2313f28db1bb10b0701b924c46862a11be571818f24a43d8851678f25d00000000000000060000000000000002ffffffff000000000000000000000001000000000000000000000001000000000000000000000001000000000000000000000001000000000000000000000001000000000000000000000010000000000000000d000000000000000200000000000000405cd744cc775e25bf40b076c87b728ac013d7ff28e61f432e12f44822c0f8874e589e753c2aaf4016424273d4769377146921b50be8c4427a12979685eb3cbcf0

test/data/circuit2/params.json

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"test_name": "circuit2",
3+
"modulus": "52435875175126190479447740508185965837690552500527637822603658699938581184513",
4+
"rows_amount": "16",
5+
"usable_rows_amount": "13",
6+
"omega": "14788168760825820622209131888203028446852016562542525606630160374691593895118",
7+
"verification_key": "5cd744cc775e25bf40b076c87b728ac013d7ff28e61f432e12f44822c0f8874e589e753c2aaf4016424273d4769377146921b50be8c4427a12979685eb3cbcf0 a48bc0876fbe3cfb7d13c143526a04a7f6f4a9af3e89806e16ff0f2023257f46afecfe2313f28db1bb10b0701b924c46862a11be571818f24a43d8851678f25d",
8+
"ar_params": [
9+
"3",
10+
"1",
11+
"0",
12+
"3"
13+
],
14+
"columns_rotations_node": [
15+
[
16+
"-1",
17+
"0"
18+
],
19+
[
20+
"0"
21+
],
22+
[
23+
"0"
24+
],
25+
[
26+
"0"
27+
],
28+
[
29+
"0"
30+
],
31+
[
32+
"0"
33+
]
34+
],
35+
"commitment_params_node": {
36+
"type": "LPC",
37+
"r": "3",
38+
"m": "2",
39+
"lambda": "1",
40+
"max_degree": "15",
41+
"step_list": [
42+
"1",
43+
"1",
44+
"1"
45+
],
46+
"D_omegas": [
47+
"36007022166693598376559747923784822035233416720563672082740011604939309541707",
48+
"47309214877430199588914062438791732591241783999377560080318349803002842391998",
49+
"31519469946562159605140591558550197856588417350474800936898404023113662197331"
50+
]
51+
}
52+
}

test/data/circuit2/proof.bin

+1
Large diffs are not rendered by default.

test/data/circuit3/circuit.crct

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0x00000000000000000000000000000000000000000000000100000000000000000000000000000001000000000000000100000000000000030000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000010000000000000000000000000100000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000100000000010000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000020000000001000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000030000000000000003000000000000000000000000010200000000000000010000000001020000000000000002000000000102

test/data/circuit3/common.dat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0x0000000000000040876d8846b47354868325d301de56e30938195aadc75e8acbc52781eac1a4033c3922229de66e111b96b4f4809a733c4c8116b22748e143bf32e98c82724ef3b10000000000000008000000000000000100000000000000000000000100000000000000000000000100000000000000000000000200000000000000010000000000000002000000000000000100000000000000020000000000000001000000000000000100000000000000000000000200000000000000010000000000000008000000000000000400000000000000010000000000000040bc70edb193542befec2d56ae79e673d9c0bdc2ab7d7b5162357e6947f8f2e0f6da3c393f3ca3157288ecad18fb5c4501fdacaf829ef9733221d7a481e579bb5b

test/data/circuit3/params.json

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"test_name": "circuit3",
3+
"modulus": "28948022309329048855892746252171976963363056481941560715954676764349967630337",
4+
"rows_amount": "8",
5+
"usable_rows_amount": "4",
6+
"omega": "199455130043951077247265858823823987229570523056509026484192158816218200659",
7+
"verification_key": "bc70edb193542befec2d56ae79e673d9c0bdc2ab7d7b5162357e6947f8f2e0f6da3c393f3ca3157288ecad18fb5c4501fdacaf829ef9733221d7a481e579bb5b 876d8846b47354868325d301de56e30938195aadc75e8acbc52781eac1a4033c3922229de66e111b96b4f4809a733c4c8116b22748e143bf32e98c82724ef3b1",
8+
"ar_params": [
9+
"3",
10+
"0",
11+
"3",
12+
"3"
13+
],
14+
"columns_rotations_node": [
15+
[
16+
"0"
17+
],
18+
[
19+
"0"
20+
],
21+
[
22+
"0"
23+
],
24+
[
25+
"0",
26+
"1"
27+
],
28+
[
29+
"0",
30+
"1"
31+
],
32+
[
33+
"0",
34+
"1"
35+
],
36+
[
37+
"0"
38+
],
39+
[
40+
"0",
41+
"1"
42+
]
43+
],
44+
"commitment_params_node": {
45+
"type": "LPC",
46+
"r": "2",
47+
"m": "2",
48+
"lambda": "40",
49+
"max_degree": "7",
50+
"step_list": [
51+
"1",
52+
"1"
53+
],
54+
"D_omegas": [
55+
"7356716530956153652314774863381845254278968224778478050456563329565810467774",
56+
"17166126583027276163107155648953851600645935739886150467584901586847365754678"
57+
],
58+
"grinding_params": {
59+
"mask": "4294901760"
60+
}
61+
}
62+
}

test/data/circuit3/proof.bin

+1
Large diffs are not rendered by default.

test/data/circuit4/circuit.crct

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0x0000000000000001000000000000000100000000000000010000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000020000000000000000000000000100000000000000000100000000010000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000200000000010000000000000000000000000000000001010000000000000000000102000000000000000000000000000000000000000100000000000000000000000000000001000000000000000100000000000000030000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000010000000000000000000000000100000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000100000000010000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000020000000001000000000000000000000000000000000000000000000000000000000001000000000000000200000000000000030000000000000003000000000000000000000000010200000000000000010000000001020000000000000002000000000102

test/data/circuit4/common.dat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0x00000000000000406602da010bd10d4f2d8200779863f17766ab4ca5d79cfadce6efeaac81862daec3893c4ce563c7ee5f29b4cfd32203efe087c8de2d52c159d0b297538a9d391f000000000000000900000000000000010000000000000000000000010000000000000000000000010000000000000000000000020000000000000001000000000000000200000000000000010000000000000002000000000000000100000000000000010000000000000000000000010000000000000000000000020000000000000001000000000000000800000000000000050000000000000002000000000000004027be3d245034244d6f6b38564ce6a89cdb37236a7d7bf26407f9ea3ab70788f3d20e9cbd01072007f081112d0bfc721da7ecb4cd60169bd9a2d3f1fe2a77414d

0 commit comments

Comments
 (0)