Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop

See merge request in3/c/in3-core!291
  • Loading branch information
simon-jentzsch committed Jun 25, 2020
2 parents c198bc5 + bb33036 commit 0a9a4c0
Show file tree
Hide file tree
Showing 466 changed files with 259,732 additions and 26,567 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ test/bindings/wasm/node_modules/
**/node_modules/
**/package-lock.json
Testing*
wasm/test/in3
.in3
build*/
_build
Expand All @@ -17,6 +18,9 @@ cmake-build-debug/
.idea/
.settings/
# Vim
python/htmlcov
wasm/test/.nyc_output
wasm/test/coverage
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
Expand All @@ -29,4 +33,6 @@ bin/
*.class
target/
.cproject
Cargo.lock
rust/in3-sys/in3-core/*
rust/Cargo.lock
.overcommit.yml
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
variables:
COMMIT_IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
RELEASE_IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

# Done to fix this bug: https://gitlab.com/gitlab-org/gitlab/issues/30111#note_275012413
workflow:
Expand Down
5 changes: 2 additions & 3 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/home/ef/sysroots/armv5-zephyr-eabi/usr/include/**",
"${workspaceFolder}/src/**"
"${workspaceFolder}/c/src/**"
],
"defines": [
"DEBUG_OFF",
Expand All @@ -15,7 +14,7 @@
"IN3_EXIT_SYSTEMRESET"
],
"compilerPath": "~/sysroots/x86_64-pokysdk-linux/usr/bin/arm-zephyr-eabi/arm-zephyr-eabi-gcc",
"cStandard":"c99",
"cStandard": "c99",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64",
"configurationProvider": "vector-of-bool.cmake-tools",
Expand Down
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,13 @@
"PAY",
"ETH_PAY"
],

"mocha.subdirectory": "wasm/test",
"mocha.files.glob": "test*.js",
"mocha.options": {
"timeout": 9999999
},
"mocha.requires": [],
"mocha.env": {
"CI": true
}
}
64 changes: 39 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# with this program. If not, see <https://www.gnu.org/licenses/>.
###############################################################################

cmake_minimum_required(VERSION 3.6.1)
cmake_minimum_required(VERSION 3.5.1)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/scripts/cmake_modules/")

# project name
Expand Down Expand Up @@ -70,24 +70,23 @@ option(USE_SCRYPT "integrate scrypt into the build in order to allow decrypt_key
option(USE_CURL "if true the curl transport will be built (with a dependency to libcurl)" ON)
option(DEV_NO_INTRN_PTR "(*dev option*) if true the client will NOT include a void pointer (named internal) for use by devs)" ON)
option(LEDGER_NANO "include support for nano ledger" OFF)
option(ESP_IDF "include support for ESP-IDF microcontroller framework" OFF)
option(ASSERTIONS "includes assertions into the code, which help track errors but may cost time during runtime" OFF)
OPTION(TRANSPORTS "builds transports, which may require extra libraries." ON)
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)
OPTION(CMD "build the comandline utils" ON)
OPTION(POA "support POA verification including validatorlist updates" OFF)

IF (POA)
ADD_DEFINITIONS(-DPOA)
ENDIF (POA)

if (USE_PRECOMPUTED_EC)
ADD_DEFINITIONS(-DUSE_PRECOMPUTED_CP=1)
else()
ADD_DEFINITIONS(-DUSE_PRECOMPUTED_CP=0)
endif()

if (USE_CURL AND NOT (JAVA OR WASM OR ASMJS))
ADD_DEFINITIONS(-DUSE_CURL)
set(IN3_TRANSPORT ${IN3_TRANSPORT} transport_curl)
if (CURL_BLOCKING)
ADD_DEFINITIONS(-DCURL_BLOCKING)
endif()
else()
set(USE_CURL 0)
endif()


if (ERR_MSG)
ADD_DEFINITIONS(-DERR_MSG)
endif()
Expand All @@ -111,6 +110,10 @@ if(IN3API)
set(IN3_API eth_api)
endif()

if (ESP_IDF)
ADD_DEFINITIONS(-DESP_IDF)
endif()

if(PAY_ETH)
ADD_DEFINITIONS(-DPAY_ETH -DPAY)
set(IN3_API ${IN3_API} pay_eth)
Expand All @@ -119,13 +122,23 @@ endif()
if(IPFS)
ADD_DEFINITIONS(-DIPFS)
set(IN3_VERIFIER ${IN3_VERIFIER} ipfs)
if(IN3API)
set(IN3_API ${IN3_API} ipfs_api)
endif()
endif()

if(BTC)
ADD_DEFINITIONS(-DBTC)
set(IN3_VERIFIER ${IN3_VERIFIER} btc)
if(IN3API)
set(IN3_API ${IN3_API} btc_api)
endif()
endif()

if(LEDGER_NANO AND ( NOT (WIN32 OR MSVC OR MSYS OR MINGW )))
add_definitions(-DLEDGER_NANO)
set(HIDAPI true)
else()
set(HIDAPI false)
set(LEDGER_NANO false)
endif()

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

if(EVM_GAS)
MESSAGE(STATUS "Enable GAS in EVM")
ADD_DEFINITIONS(-DEVM_GAS)
endif(EVM_GAS)

if(FAST_MATH)
MESSAGE(STATUS "Enable math optimizations (excutable size may increase)")
ADD_DEFINITIONS(-DIN3_MATH_FAST)
else()
MESSAGE(STATUS "Disable math optimizations (optimised for executable size)")
ADD_DEFINITIONS(-DIN3_MATH_LITE)
endif(FAST_MATH)

if(SEGGER_RTT)
MESSAGE(STATUS "Enable segger RTT for logging")
ADD_DEFINITIONS(-DSEGGER_RTT)
endif(SEGGER_RTT)

if (DEV_NO_INTRN_PTR)
MESSAGE(STATUS "Disable dev opt (internal ptr)")
ADD_DEFINITIONS(-DDEV_NO_INTRN_PTR)
endif()

Expand Down Expand Up @@ -185,9 +193,20 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)


IF (WASM)
set(TEST false)
set(TRANSPORTS false)
set(BUILD_DOC false)
set(IN3_LIB false)
set(CMD false)
set(USE_CURL false)
add_subdirectory(wasm/src)
ENDIF (WASM)


# build tests
if(TEST)
MESSAGE(STATUS "Build Tests and add debug infos")
ADD_DEFINITIONS(-DTEST)
ADD_DEFINITIONS(-DIN3_DONT_HASH_KEYS)
ADD_DEFINITIONS(-DIN3_EXPORT_TEST=)
Expand All @@ -206,8 +225,3 @@ add_subdirectory(c)
IF (JAVA)
add_subdirectory(java)
ENDIF (JAVA)

IF (WASM)
add_subdirectory(wasm/src)
ENDIF (WASM)

102 changes: 29 additions & 73 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,105 +32,60 @@
# with this program. If not, see <https://www.gnu.org/licenses/>.
###############################################################################

include("${PROJECT_SOURCE_DIR}/c/compiler.cmake")
include("macro.cmake")
include("compiler.cmake")

# build modules
add_subdirectory(src/third-party)


if (GCC_ANALYZER)
add_compile_options(-fanalyzer -Werror)
ADD_DEFINITIONS(-DGCC_ANALYZER=1)
add_compile_options(-fanalyzer -Werror -Wno-nonnull-compare)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fanalyzer -Werror")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fanalyzer -Werror")
endif()


IF (TRANSPORTS)
ADD_DEFINITIONS(-DTRANSPORTS)
if (USE_CURL)
ADD_DEFINITIONS(-DUSE_CURL)
set(IN3_TRANSPORT ${IN3_TRANSPORT} transport_curl)
if (CURL_BLOCKING)
ADD_DEFINITIONS(-DCURL_BLOCKING)
endif (CURL_BLOCKING)
else ()
set(IN3_TRANSPORT ${IN3_TRANSPORT} transport_http)
endif (USE_CURL)
add_subdirectory(src/transport)
ENDIF (TRANSPORTS)

add_subdirectory(src/core)
add_subdirectory(src/transport)
add_subdirectory(src/verifier)

if( LEDGER_NANO AND HIDAPI )
add_subdirectory(src/signer/ledger-nano/signer)
endif()
add_subdirectory(src/signer/pk-signer)
add_subdirectory(src/signer/ledger-nano/signer)

add_subdirectory(src/pay)
add_subdirectory(src/api)
IF (ETH_FULL)
add_subdirectory(src/cmd)
endif()
add_subdirectory(src/cmd)
add_subdirectory(docs)
link_directories(${CMAKE_BINARY_DIR}/lib/)

link_directories(${CMAKE_BINARY_DIR}/lib/)

# create the library
if (IN3_LIB)
set(IN3_LIBS
$<TARGET_OBJECTS:core_o>
$<TARGET_OBJECTS:init_o>
$<TARGET_OBJECTS:crypto_o>
)

if (ETH_FULL)
set(IN3_LIBS ${IN3_LIBS}
$<TARGET_OBJECTS:tommath_o>
$<TARGET_OBJECTS:evm_o>
$<TARGET_OBJECTS:eth_full_o>
)
endif()

if (ETH_BASIC)
set(IN3_LIBS ${IN3_LIBS}
$<TARGET_OBJECTS:eth_basic_o>
)
endif()

if (ETH_NANO)
set(IN3_LIBS ${IN3_LIBS}
$<TARGET_OBJECTS:eth_nano_o>
)
endif()

if (IPFS)
set(IN3_LIBS ${IN3_LIBS}
$<TARGET_OBJECTS:b64_o>
$<TARGET_OBJECTS:ipfs_o>
)
if (IN3API)
set(IN3_LIBS ${IN3_LIBS}
$<TARGET_OBJECTS:ipfs_api_o>
)
endif()
endif()

if (IN3API)
set(IN3_LIBS ${IN3_LIBS}
$<TARGET_OBJECTS:eth_api_o>
$<TARGET_OBJECTS:usn_api_o>
$<TARGET_OBJECTS:api_utils_o>
)
endif()

if (PAY_ETH)
set(IN3_LIBS ${IN3_LIBS} $<TARGET_OBJECTS:pay_eth_o>)
endif()

if (USE_SCRYPT)
set(IN3_LIBS ${IN3_LIBS} $<TARGET_OBJECTS:scrypt_o>)
endif()


get_property(IN3_LIBS GLOBAL PROPERTY IN3_OBJECTS)

# create the libraries
add_library(in3_bundle STATIC ${IN3_LIBS} )
add_library(in3_lib SHARED ${IN3_LIBS} )
set_target_properties(in3_bundle PROPERTIES OUTPUT_NAME "in3")
set_target_properties(in3_lib PROPERTIES OUTPUT_NAME "in3")

if( LEDGER_NANO AND HIDAPI )
target_link_libraries(in3_lib ${IN3_TRANSPORT} ledger_signer)
if( LEDGER_NANO)
target_link_libraries(in3_lib ${IN3_TRANSPORT} ledger_signer)
else()
target_link_libraries(in3_lib ${IN3_TRANSPORT} )
target_link_libraries(in3_lib ${IN3_TRANSPORT} )
endif()


# install
INSTALL(TARGETS in3_bundle
Expand All @@ -143,8 +98,9 @@ if (IN3_LIB)
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
INSTALL (
DIRECTORY ${CMAKE_SOURCE_DIR}/include/
DIRECTORY ${CMAKE_SOURCE_DIR}/c/include/in3
DESTINATION include
FILES_MATCHING PATTERN "*.h*")

endif()

5 changes: 3 additions & 2 deletions c/ci-analyse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,17 @@ valgrind:
# allow_failure: true
needs: []
tags:
- short-jobs
- long-jobs
variables:
VALGRIND_OPTS: "-v -q --error-exitcode=1 --leak-check=full --show-leak-kinds=definite --suppressions=suppress.valgrind"
VALGRIND_OPTS: "-v -q --num-callers=50 --main-stacksize=4000 --error-exitcode=1 --leak-check=full --show-leak-kinds=definite --suppressions=suppress.valgrind"
script:
- mkdir _build
- cd _build
- cmake -DCMAKE_BUILD_TYPE=Release -DTEST=true -DDEBUG=false ..
- make
- printf "{\n ignore_libcrypto_conditional_jump_errors\n Memcheck:Leak\n ...\n obj:*/libcrypto.so.*\n}\n" > suppress.valgrind
- for f in test/test*; do valgrind $VALGRIND_OPTS $(pwd)/$f; done
- for f in ../c/test/testdata/requests/*.json; do valgrind $VALGRIND_OPTS test/runner $(pwd)/$f; done

code_quality:
rules:
Expand Down
Loading

0 comments on commit 0a9a4c0

Please sign in to comment.