diff --git a/CMakeLists.txt b/CMakeLists.txt index f12e26aac26e52bffdffcf5f3b6d3c50a8c413d0..5c53ae7b98e6be7e30f78c561172f0b6ed64e057 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,11 +4,11 @@ cmake_minimum_required(VERSION 3.10) include (cmake/OS_Detection.cmake) set(CMAKE_C_STANDARD 11) set(CELLFRAME_SDK_NATIVE_VERSION "3.0-15") -set(BUILD_CRYPTO_TESTS ON) +add_definitions ("-DCELLFRAME_SDK_VERSION=\"${CELLFRAME_SDK_NATIVE_VERSION}\"") set(DAPSDK_MODULES "") -add_definitions ("-DCELLFRAME_SDK_VERSION=\"${CELLFRAME_SDK_NATIVE_VERSION}\"") -if(NOT DEFINED ${CELLFRAME_MODULES}) +if(NOT DEFINED CELLFRAME_MODULES) + set(BUILD_CRYPTO_TESTS ON) include (cmake/OS_Detection.cmake) if (WIN32) set(CELLFRAME_MODULES "core chains mining network srv cs-dag-poa cs-block-poa cs-dag-pos cs-block-pos cs-none srv-app srv-app-db srv-datum srv-stake srv-xchange") diff --git a/dap-sdk/core/include/dap_common.h b/dap-sdk/core/include/dap_common.h index 641096894ded2889af8adec2eced6e15258473d1..56718ab9e927544abb0072bd2ce702ca819b4d45 100755 --- a/dap-sdk/core/include/dap_common.h +++ b/dap-sdk/core/include/dap_common.h @@ -59,15 +59,15 @@ typedef uint8_t byte_t; // Stuffs an integer into a pointer type -#define DAP_INT_TO_POINTER(i) ((void*) (long) (i)) +#define DAP_INT_TO_POINTER(i) ((void*) (ssize_t) (i)) // Extracts an integer from a pointer -#define DAP_POINTER_TO_INT(p) ((int) (long) (p)) +#define DAP_POINTER_TO_INT(p) ((int) (ssize_t) (p)) // Stuffs an unsigned integer into a pointer type -#define DAP_UINT_TO_POINTER(u) ((void*) (unsigned long) (u)) +#define DAP_UINT_TO_POINTER(u) ((void*) (size_t) (u)) // Extracts an unsigned integer from a pointer -#define DAP_POINTER_TO_UINT(p) ((unsigned int) (unsigned long) (p)) +#define DAP_POINTER_TO_UINT(p) ((unsigned int) (size_t) (p)) // Stuffs a size_t into a pointer type -#define DAP_SIZE_TO_POINTER(s) ((void*) (size_t) (s)) +#define DAP_SIZE_TO_POINTER(s) ((void*) (s)) // Extracts a size_t from a pointer #define DAP_POINTER_TO_SIZE(p) ((size_t) (p)) diff --git a/dap-sdk/crypto/src/dap_sign.c b/dap-sdk/crypto/src/dap_sign.c index d3de0d4a9dd5cdced24c9190ea51fe072a1a3471..f7f5febee73de9bae707fb982375294a0257d5cc 100755 --- a/dap-sdk/crypto/src/dap_sign.c +++ b/dap-sdk/crypto/src/dap_sign.c @@ -411,7 +411,7 @@ int dap_sign_verify(dap_sign_t * a_chain_sign, const void * a_data, const size_t case DAP_ENC_KEY_TYPE_SIG_TESLA: case DAP_ENC_KEY_TYPE_SIG_PICNIC: case DAP_ENC_KEY_TYPE_SIG_DILITHIUM: - if(l_key->dec_na(l_key, a_data, a_data_size, l_sign_data, l_sign_data_size) < 0) + if((ssize_t)l_key->dec_na(l_key, a_data, a_data_size, l_sign_data, l_sign_data_size) < 0) l_ret = 0; else l_ret = 1; diff --git a/modules/channel/chain/dap_stream_ch_chain.c b/modules/channel/chain/dap_stream_ch_chain.c index e794995c265077c977e96e17953c852a175bf6e4..daf067c1610538e7f43df8525e9d660bd245c372 100644 --- a/modules/channel/chain/dap_stream_ch_chain.c +++ b/modules/channel/chain/dap_stream_ch_chain.c @@ -683,7 +683,7 @@ static bool s_gdb_in_pkt_proc_callback(dap_proc_thread_t *a_thread, void *a_arg) //check whether to apply the received data into the database bool l_apply = false; // timestamp for exist obj - time_t l_timestamp_cur = 0; + uint64_t l_timestamp_cur = 0; if (dap_chain_global_db_driver_is(l_obj->group, l_obj->key)) { dap_store_obj_t *l_read_obj = dap_chain_global_db_driver_read(l_obj->group, l_obj->key, NULL); if (l_read_obj) { @@ -692,7 +692,7 @@ static bool s_gdb_in_pkt_proc_callback(dap_proc_thread_t *a_thread, void *a_arg) } } // check the applied object newer that we have stored or erased - if (l_obj->timestamp > global_db_gr_del_get_timestamp(l_obj->group, l_obj->key) && + if (l_obj->timestamp > (uint64_t)global_db_gr_del_get_timestamp(l_obj->group, l_obj->key) && l_obj->timestamp > l_timestamp_cur) { l_apply = true; } diff --git a/modules/global-db/dap_chain_global_db_hist.c b/modules/global-db/dap_chain_global_db_hist.c index 53d540f1ba6282bb1f4236231a2e9644cd35ec36..33124b34ca051dcce49f7935e9d5e0b998977c52 100644 --- a/modules/global-db/dap_chain_global_db_hist.c +++ b/modules/global-db/dap_chain_global_db_hist.c @@ -119,7 +119,7 @@ bool dap_db_history_add(char a_type, pdap_store_obj_t a_store_obj, size_t a_dap_ size_t i; for(i = 0; i < a_dap_store_count; i++) { // if it is marked, the data has not been saved - if(a_store_obj[i].timestamp == (time_t) -1) + if(a_store_obj[i].timestamp == (uint64_t) -1) continue; l_keys[i] = a_store_obj[i].key; } diff --git a/modules/global-db/include/dap_chain_global_db_driver.h b/modules/global-db/include/dap_chain_global_db_driver.h index af3174367a78d9829d843eb7398a8cbff2055337..32c93bed9b8df2cce1db3017939e57461bc67a3e 100644 --- a/modules/global-db/include/dap_chain_global_db_driver.h +++ b/modules/global-db/include/dap_chain_global_db_driver.h @@ -30,9 +30,9 @@ #include "dap_list.h" typedef struct dap_store_obj { - uint64_t id; + uint64_t id; uint64_t timestamp; - uint8_t type; + uint8_t type; char *group; char *key; const char *c_key; @@ -44,7 +44,7 @@ typedef struct dap_store_obj_pkt { uint64_t timestamp; uint64_t data_size; uint32_t obj_count; - uint8_t data[]; + uint8_t data[]; }__attribute__((packed)) dap_store_obj_pkt_t; typedef int (*dap_db_driver_write_callback_t)(dap_store_obj_t*); diff --git a/modules/modules_dynamic/cdb/dap_modules_dynamic_cdb.c b/modules/modules_dynamic/cdb/dap_modules_dynamic_cdb.c index b4e8130de195b9c6cd04d81be978001d129ed71b..fa6a5c74c7160ff781fc9bb7f6c6e26f4512cd7a 100644 --- a/modules/modules_dynamic/cdb/dap_modules_dynamic_cdb.c +++ b/modules/modules_dynamic/cdb/dap_modules_dynamic_cdb.c @@ -24,6 +24,7 @@ #include "dap_modules_dynamic_cdb.h" #include "dap_common.h" +#include "dap_config.h" #ifdef DAP_OS_LINUX #include <dlfcn.h> @@ -78,14 +79,14 @@ void *dap_modules_dynamic_get_cdb_func(const char *a_func_name) int dap_modules_dynamic_load_cdb(dap_http_t * a_server) { s_cdb_was_init = true; - int (*dap_chain_net_srv_vpn_cdb_init)(dap_http_t *); + int (*dap_chain_net_srv_vpn_cdb_init)(dap_http_t *, dap_config_t *); dap_chain_net_srv_vpn_cdb_init = dap_modules_dynamic_get_cdb_func("dap_chain_net_srv_vpn_cdb_init"); if (!dap_chain_net_srv_vpn_cdb_init) { s_cdb_was_init = false; log_it(L_ERROR, "dap_modules_dynamic: dap_chain_net_srv_vpn_cdb_init not found"); return -2; } - int l_init_res = dap_chain_net_srv_vpn_cdb_init(a_server); + int l_init_res = dap_chain_net_srv_vpn_cdb_init(a_server, g_config); if (l_init_res) { s_cdb_was_init = false; log_it(L_ERROR, "dap_modules_dynamic: dap_chain_net_srv_vpn_cdb_init returns %d", l_init_res); diff --git a/modules/net/dap_chain_net_news.h b/modules/net/dap_chain_net_news.h deleted file mode 100644 index d3c82ce4658987c30e207472e51015d55c326c0f..0000000000000000000000000000000000000000 --- a/modules/net/dap_chain_net_news.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Authors: - * Alexander Lysikov <alexander.lysikov@demlabs.net> - * DeM Labs Inc. https://demlabs.net - * Kelvin Project https://github.com/kelvinblockchain - * Copyright (c) 2020 - * All rights reserved. - - This file is part of DAP (Deus Applications Prototypes) the open source project - - DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - DAP is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with any DAP based project. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "dap_http.h" - -int dap_chain_net_news_init(dap_http_t * a_http); -void dap_chain_net_srv_vpn_cdb_news_cache_reset(void); diff --git a/modules/net/dap_chain_node_cli_cmd.c b/modules/net/dap_chain_node_cli_cmd.c index 9bc515534a8bbeb88fc53cef3252ae0de4e051c2..ae4fea9b086540f40209c5ef7dfcb018758feae2 100644 --- a/modules/net/dap_chain_node_cli_cmd.c +++ b/modules/net/dap_chain_node_cli_cmd.c @@ -76,9 +76,6 @@ #include "dap_chain_node_cli_cmd_tx.h" #include "dap_chain_node_ping.h" #include "dap_chain_net_srv.h" -#ifndef _WIN32 -#include "dap_chain_net_news.h" -#endif #include "dap_chain_cell.h" diff --git a/modules/net/include/dap_chain_net_bugreport.h b/modules/net/include/dap_chain_net_bugreport.h deleted file mode 100644 index c930015f0b79897ba7502452b74da80595b89872..0000000000000000000000000000000000000000 --- a/modules/net/include/dap_chain_net_bugreport.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Authors: - * Alexander Lysikov <alexander.lysikov@demlabs.net> - * DeM Labs Inc. https://demlabs.net - * Kelvin Project https://github.com/kelvinblockchain - * Copyright (c) 2020 - * All rights reserved. - - This file is part of DAP (Deus Applications Prototypes) the open source project - - DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - DAP is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with any DAP based project. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "dap_http.h" - -int dap_chain_net_bugreport_init(dap_http_t * a_http);