Skip to content

Commit 0a9a4c0

Browse files
Merge branch 'develop' into 'master'
Develop See merge request in3/c/in3-core!291
2 parents c198bc5 + bb33036 commit 0a9a4c0

File tree

466 files changed

+259732
-26567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

466 files changed

+259732
-26567
lines changed

Diff for: .gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ test/bindings/wasm/node_modules/
33
**/node_modules/
44
**/package-lock.json
55
Testing*
6+
wasm/test/in3
67
.in3
78
build*/
89
_build
@@ -17,6 +18,9 @@ cmake-build-debug/
1718
.idea/
1819
.settings/
1920
# Vim
21+
python/htmlcov
22+
wasm/test/.nyc_output
23+
wasm/test/coverage
2024
[._]*.s[a-v][a-z]
2125
[._]*.sw[a-p]
2226
[._]s[a-rt-v][a-z]
@@ -29,4 +33,6 @@ bin/
2933
*.class
3034
target/
3135
.cproject
32-
Cargo.lock
36+
rust/in3-sys/in3-core/*
37+
rust/Cargo.lock
38+
.overcommit.yml

Diff for: .gitlab-ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
variables:
1212
COMMIT_IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
1313
RELEASE_IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
14+
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
1415

1516
# Done to fix this bug: https://gitlab.com/gitlab-org/gitlab/issues/30111#note_275012413
1617
workflow:

Diff for: .vscode/c_cpp_properties.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"name": "Mac",
55
"includePath": [
66
"${workspaceFolder}/**",
7-
"/home/ef/sysroots/armv5-zephyr-eabi/usr/include/**",
8-
"${workspaceFolder}/src/**"
7+
"${workspaceFolder}/c/src/**"
98
],
109
"defines": [
1110
"DEBUG_OFF",
@@ -15,7 +14,7 @@
1514
"IN3_EXIT_SYSTEMRESET"
1615
],
1716
"compilerPath": "~/sysroots/x86_64-pokysdk-linux/usr/bin/arm-zephyr-eabi/arm-zephyr-eabi-gcc",
18-
"cStandard":"c99",
17+
"cStandard": "c99",
1918
"cppStandard": "c++17",
2019
"intelliSenseMode": "clang-x64",
2120
"configurationProvider": "vector-of-bool.cmake-tools",

Diff for: .vscode/settings.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,13 @@
100100
"PAY",
101101
"ETH_PAY"
102102
],
103-
103+
"mocha.subdirectory": "wasm/test",
104+
"mocha.files.glob": "test*.js",
105+
"mocha.options": {
106+
"timeout": 9999999
107+
},
108+
"mocha.requires": [],
109+
"mocha.env": {
110+
"CI": true
111+
}
104112
}

Diff for: CMakeLists.txt

+39-25
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# with this program. If not, see <https://www.gnu.org/licenses/>.
3333
###############################################################################
3434

35-
cmake_minimum_required(VERSION 3.6.1)
35+
cmake_minimum_required(VERSION 3.5.1)
3636
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/scripts/cmake_modules/")
3737

3838
# project name
@@ -70,24 +70,23 @@ option(USE_SCRYPT "integrate scrypt into the build in order to allow decrypt_key
7070
option(USE_CURL "if true the curl transport will be built (with a dependency to libcurl)" ON)
7171
option(DEV_NO_INTRN_PTR "(*dev option*) if true the client will NOT include a void pointer (named internal) for use by devs)" ON)
7272
option(LEDGER_NANO "include support for nano ledger" OFF)
73+
option(ESP_IDF "include support for ESP-IDF microcontroller framework" OFF)
74+
option(ASSERTIONS "includes assertions into the code, which help track errors but may cost time during runtime" OFF)
75+
OPTION(TRANSPORTS "builds transports, which may require extra libraries." ON)
76+
OPTION(IN3_SERVER "support for proxy server as part of the cmd-tool, which allows to start the cmd-tool with the -p option and listens to the given port for rpc-requests" OFF)
77+
OPTION(CMD "build the comandline utils" ON)
78+
OPTION(POA "support POA verification including validatorlist updates" OFF)
79+
80+
IF (POA)
81+
ADD_DEFINITIONS(-DPOA)
82+
ENDIF (POA)
7383

7484
if (USE_PRECOMPUTED_EC)
7585
ADD_DEFINITIONS(-DUSE_PRECOMPUTED_CP=1)
7686
else()
7787
ADD_DEFINITIONS(-DUSE_PRECOMPUTED_CP=0)
7888
endif()
7989

80-
if (USE_CURL AND NOT (JAVA OR WASM OR ASMJS))
81-
ADD_DEFINITIONS(-DUSE_CURL)
82-
set(IN3_TRANSPORT ${IN3_TRANSPORT} transport_curl)
83-
if (CURL_BLOCKING)
84-
ADD_DEFINITIONS(-DCURL_BLOCKING)
85-
endif()
86-
else()
87-
set(USE_CURL 0)
88-
endif()
89-
90-
9190
if (ERR_MSG)
9291
ADD_DEFINITIONS(-DERR_MSG)
9392
endif()
@@ -111,6 +110,10 @@ if(IN3API)
111110
set(IN3_API eth_api)
112111
endif()
113112

113+
if (ESP_IDF)
114+
ADD_DEFINITIONS(-DESP_IDF)
115+
endif()
116+
114117
if(PAY_ETH)
115118
ADD_DEFINITIONS(-DPAY_ETH -DPAY)
116119
set(IN3_API ${IN3_API} pay_eth)
@@ -119,13 +122,23 @@ endif()
119122
if(IPFS)
120123
ADD_DEFINITIONS(-DIPFS)
121124
set(IN3_VERIFIER ${IN3_VERIFIER} ipfs)
125+
if(IN3API)
126+
set(IN3_API ${IN3_API} ipfs_api)
127+
endif()
128+
endif()
129+
130+
if(BTC)
131+
ADD_DEFINITIONS(-DBTC)
132+
set(IN3_VERIFIER ${IN3_VERIFIER} btc)
133+
if(IN3API)
134+
set(IN3_API ${IN3_API} btc_api)
135+
endif()
122136
endif()
123137

124138
if(LEDGER_NANO AND ( NOT (WIN32 OR MSVC OR MSYS OR MINGW )))
125139
add_definitions(-DLEDGER_NANO)
126-
set(HIDAPI true)
127140
else()
128-
set(HIDAPI false)
141+
set(LEDGER_NANO false)
129142
endif()
130143

131144
if(COLOR AND NOT (MSVC OR MSYS OR MINGW))
@@ -138,25 +151,20 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
138151
endif(CMAKE_BUILD_TYPE MATCHES Debug)
139152

140153
if(EVM_GAS)
141-
MESSAGE(STATUS "Enable GAS in EVM")
142154
ADD_DEFINITIONS(-DEVM_GAS)
143155
endif(EVM_GAS)
144156

145157
if(FAST_MATH)
146-
MESSAGE(STATUS "Enable math optimizations (excutable size may increase)")
147158
ADD_DEFINITIONS(-DIN3_MATH_FAST)
148159
else()
149-
MESSAGE(STATUS "Disable math optimizations (optimised for executable size)")
150160
ADD_DEFINITIONS(-DIN3_MATH_LITE)
151161
endif(FAST_MATH)
152162

153163
if(SEGGER_RTT)
154-
MESSAGE(STATUS "Enable segger RTT for logging")
155164
ADD_DEFINITIONS(-DSEGGER_RTT)
156165
endif(SEGGER_RTT)
157166

158167
if (DEV_NO_INTRN_PTR)
159-
MESSAGE(STATUS "Disable dev opt (internal ptr)")
160168
ADD_DEFINITIONS(-DDEV_NO_INTRN_PTR)
161169
endif()
162170

@@ -185,9 +193,20 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
185193
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
186194
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
187195

196+
197+
IF (WASM)
198+
set(TEST false)
199+
set(TRANSPORTS false)
200+
set(BUILD_DOC false)
201+
set(IN3_LIB false)
202+
set(CMD false)
203+
set(USE_CURL false)
204+
add_subdirectory(wasm/src)
205+
ENDIF (WASM)
206+
207+
188208
# build tests
189209
if(TEST)
190-
MESSAGE(STATUS "Build Tests and add debug infos")
191210
ADD_DEFINITIONS(-DTEST)
192211
ADD_DEFINITIONS(-DIN3_DONT_HASH_KEYS)
193212
ADD_DEFINITIONS(-DIN3_EXPORT_TEST=)
@@ -206,8 +225,3 @@ add_subdirectory(c)
206225
IF (JAVA)
207226
add_subdirectory(java)
208227
ENDIF (JAVA)
209-
210-
IF (WASM)
211-
add_subdirectory(wasm/src)
212-
ENDIF (WASM)
213-

Diff for: c/CMakeLists.txt

+29-73
Original file line numberDiff line numberDiff line change
@@ -32,105 +32,60 @@
3232
# with this program. If not, see <https://www.gnu.org/licenses/>.
3333
###############################################################################
3434

35-
include("${PROJECT_SOURCE_DIR}/c/compiler.cmake")
35+
include("macro.cmake")
36+
include("compiler.cmake")
3637

3738
# build modules
3839
add_subdirectory(src/third-party)
3940

4041

4142
if (GCC_ANALYZER)
42-
add_compile_options(-fanalyzer -Werror)
43+
ADD_DEFINITIONS(-DGCC_ANALYZER=1)
44+
add_compile_options(-fanalyzer -Werror -Wno-nonnull-compare)
4345
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fanalyzer -Werror")
4446
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fanalyzer -Werror")
4547
endif()
46-
48+
49+
IF (TRANSPORTS)
50+
ADD_DEFINITIONS(-DTRANSPORTS)
51+
if (USE_CURL)
52+
ADD_DEFINITIONS(-DUSE_CURL)
53+
set(IN3_TRANSPORT ${IN3_TRANSPORT} transport_curl)
54+
if (CURL_BLOCKING)
55+
ADD_DEFINITIONS(-DCURL_BLOCKING)
56+
endif (CURL_BLOCKING)
57+
else ()
58+
set(IN3_TRANSPORT ${IN3_TRANSPORT} transport_http)
59+
endif (USE_CURL)
60+
add_subdirectory(src/transport)
61+
ENDIF (TRANSPORTS)
62+
4763
add_subdirectory(src/core)
48-
add_subdirectory(src/transport)
4964
add_subdirectory(src/verifier)
50-
51-
if( LEDGER_NANO AND HIDAPI )
52-
add_subdirectory(src/signer/ledger-nano/signer)
53-
endif()
65+
add_subdirectory(src/signer/pk-signer)
66+
add_subdirectory(src/signer/ledger-nano/signer)
5467

5568
add_subdirectory(src/pay)
5669
add_subdirectory(src/api)
57-
IF (ETH_FULL)
58-
add_subdirectory(src/cmd)
59-
endif()
70+
add_subdirectory(src/cmd)
6071
add_subdirectory(docs)
61-
link_directories(${CMAKE_BINARY_DIR}/lib/)
6272

73+
link_directories(${CMAKE_BINARY_DIR}/lib/)
6374

6475
# create the library
6576
if (IN3_LIB)
66-
set(IN3_LIBS
67-
$<TARGET_OBJECTS:core_o>
68-
$<TARGET_OBJECTS:init_o>
69-
$<TARGET_OBJECTS:crypto_o>
70-
)
71-
72-
if (ETH_FULL)
73-
set(IN3_LIBS ${IN3_LIBS}
74-
$<TARGET_OBJECTS:tommath_o>
75-
$<TARGET_OBJECTS:evm_o>
76-
$<TARGET_OBJECTS:eth_full_o>
77-
)
78-
endif()
79-
80-
if (ETH_BASIC)
81-
set(IN3_LIBS ${IN3_LIBS}
82-
$<TARGET_OBJECTS:eth_basic_o>
83-
)
84-
endif()
85-
86-
if (ETH_NANO)
87-
set(IN3_LIBS ${IN3_LIBS}
88-
$<TARGET_OBJECTS:eth_nano_o>
89-
)
90-
endif()
91-
92-
if (IPFS)
93-
set(IN3_LIBS ${IN3_LIBS}
94-
$<TARGET_OBJECTS:b64_o>
95-
$<TARGET_OBJECTS:ipfs_o>
96-
)
97-
if (IN3API)
98-
set(IN3_LIBS ${IN3_LIBS}
99-
$<TARGET_OBJECTS:ipfs_api_o>
100-
)
101-
endif()
102-
endif()
103-
104-
if (IN3API)
105-
set(IN3_LIBS ${IN3_LIBS}
106-
$<TARGET_OBJECTS:eth_api_o>
107-
$<TARGET_OBJECTS:usn_api_o>
108-
$<TARGET_OBJECTS:api_utils_o>
109-
)
110-
endif()
111-
112-
if (PAY_ETH)
113-
set(IN3_LIBS ${IN3_LIBS} $<TARGET_OBJECTS:pay_eth_o>)
114-
endif()
115-
116-
if (USE_SCRYPT)
117-
set(IN3_LIBS ${IN3_LIBS} $<TARGET_OBJECTS:scrypt_o>)
118-
endif()
119-
120-
77+
get_property(IN3_LIBS GLOBAL PROPERTY IN3_OBJECTS)
12178

12279
# create the libraries
12380
add_library(in3_bundle STATIC ${IN3_LIBS} )
12481
add_library(in3_lib SHARED ${IN3_LIBS} )
12582
set_target_properties(in3_bundle PROPERTIES OUTPUT_NAME "in3")
12683
set_target_properties(in3_lib PROPERTIES OUTPUT_NAME "in3")
127-
128-
if( LEDGER_NANO AND HIDAPI )
129-
target_link_libraries(in3_lib ${IN3_TRANSPORT} ledger_signer)
84+
if( LEDGER_NANO)
85+
target_link_libraries(in3_lib ${IN3_TRANSPORT} ledger_signer)
13086
else()
131-
target_link_libraries(in3_lib ${IN3_TRANSPORT} )
87+
target_link_libraries(in3_lib ${IN3_TRANSPORT} )
13288
endif()
133-
13489

13590
# install
13691
INSTALL(TARGETS in3_bundle
@@ -143,8 +98,9 @@ if (IN3_LIB)
14398
GROUP_READ GROUP_EXECUTE
14499
WORLD_READ WORLD_EXECUTE)
145100
INSTALL (
146-
DIRECTORY ${CMAKE_SOURCE_DIR}/include/
101+
DIRECTORY ${CMAKE_SOURCE_DIR}/c/include/in3
147102
DESTINATION include
148103
FILES_MATCHING PATTERN "*.h*")
149104

150105
endif()
106+

Diff for: c/ci-analyse.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,17 @@ valgrind:
7878
# allow_failure: true
7979
needs: []
8080
tags:
81-
- short-jobs
81+
- long-jobs
8282
variables:
83-
VALGRIND_OPTS: "-v -q --error-exitcode=1 --leak-check=full --show-leak-kinds=definite --suppressions=suppress.valgrind"
83+
VALGRIND_OPTS: "-v -q --num-callers=50 --main-stacksize=4000 --error-exitcode=1 --leak-check=full --show-leak-kinds=definite --suppressions=suppress.valgrind"
8484
script:
8585
- mkdir _build
8686
- cd _build
8787
- cmake -DCMAKE_BUILD_TYPE=Release -DTEST=true -DDEBUG=false ..
8888
- make
8989
- printf "{\n ignore_libcrypto_conditional_jump_errors\n Memcheck:Leak\n ...\n obj:*/libcrypto.so.*\n}\n" > suppress.valgrind
9090
- for f in test/test*; do valgrind $VALGRIND_OPTS $(pwd)/$f; done
91+
- for f in ../c/test/testdata/requests/*.json; do valgrind $VALGRIND_OPTS test/runner $(pwd)/$f; done
9192

9293
code_quality:
9394
rules:

0 commit comments

Comments
 (0)