diff --git a/CMakeLists.txt b/CMakeLists.txt index c412cf6fe509565356a28e7a05b5f7f4ca893088..e1ba7ab918ff5dd25701c2a6bfc07ddde74b6769 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,11 +8,9 @@ set(DAP_CHAIN_SRCS dap_chain_datum_tx.c dap_chain_datum_coin.c dap_chain.c - dap_chain_ops.c ) set(DAP_CHAIN_HEADERS - dap_chain_ops.h dap_chain.h dap_chain_internal.h dap_chain_common.h @@ -28,7 +26,9 @@ set(DAP_CHAIN_HEADERS add_library(${PROJECT_NAME} STATIC ${DAP_CHAIN_SRCS} ${DAP_CHAIN_HEADERS}) -target_link_libraries(dap_chain dap_core ) +target_link_libraries(dap_chain dap_core dap_chain_block ) +target_include_directories(dap_chain INTERFACE .) + set(${PROJECT_NAME}_DEFINITIONS CACHE INTERNAL "${PROJECT_NAME}: Definitions" FORCE) diff --git a/dap_chain_datum.c b/dap_chain_datum.c index 015682c8e1bbfa66323c7bdc543aae096c606665..eee06a64c67e9a69809a03affe75fe95bbd8751c 100644 --- a/dap_chain_datum.c +++ b/dap_chain_datum.c @@ -23,9 +23,9 @@ */ #include "dap_common.h" -#include "dap_chain_section.h" -#include "dap_chain_section_tx.h" -#include "dap_chain_section_roots.h" -#include "dap_chain_section_coin.h" +#include "dap_chain_datum.h" +#include "dap_chain_datum_tx.h" +#include "dap_chain_datum_hashtree_roots.h" +#include "dap_chain_datum_coin.h" #define LOG_TAG "dap_chain_secion" diff --git a/dap_chain_datum.h b/dap_chain_datum.h index 2137d94f19dbf4610133dbd53e3eaf43af6530b4..e32c882a596798a482e98a7a02c74b342048de37 100644 --- a/dap_chain_datum.h +++ b/dap_chain_datum.h @@ -28,42 +28,42 @@ #include "dap_chain_common.h" /// End section, means all the rest of the block is empty -#define DAP_CHAIN_SECTION_END 0x0000 +#define dap_chain_datum_END 0x0000 /// Section with additional roots, for example transaction roots -#define DAP_CHAIN_SECTION_ROOTS 0x0001 +#define dap_chain_datum_hashtree_roots 0x0001 /// Transaction header section -#define DAP_CHAIN_SECTION_TX 0x0100 +#define dap_chain_datum_TX 0x0100 /// Transaction request section -#define DAP_CHAIN_SECTION_TX_REQUEST 0x0300 +#define dap_chain_datum_TX_REQUEST 0x0300 /// Smart contract: DVM code section -#define DAP_CHAIN_SECTION_DVM_CODE 0x0900 +#define dap_chain_datum_DVM_CODE 0x0900 /// Smart contract: DVM code section -#define DAP_CHAIN_SECTION_DVM_DATA 0x0901 +#define dap_chain_datum_DVM_DATA 0x0901 /// Smart contract: EVM code section -#define DAP_CHAIN_SECTION_EVM_CODE 0x0910 +#define dap_chain_datum_EVM_CODE 0x0910 /// Smart contract: EVM data section -#define DAP_CHAIN_SECTION_EVM_DATA 0x0911 +#define dap_chain_datum_EVM_DATA 0x0911 /// Pub key section, with sign and address -#define DAP_CHAIN_SECTION_PKEY 0x0c00 +#define dap_chain_datum_PKEY 0x0c00 /// Coin -#define DAP_CHAIN_SECTION_COIN 0xf000 +#define dap_chain_datum_COIN 0xf000 /** * @struct dap_chain_block_section * @brief section inside the block */ -typedef struct dap_chain_section{ +typedef struct dap_chain_datum{ uint16_t type; // Section type uint8_t data[]; // data -} DAP_ALIGN_PACKED dap_chain_section_t; +} DAP_ALIGN_PACKED dap_chain_datum_t; diff --git a/dap_chain_datum_coin.c b/dap_chain_datum_coin.c index 3ceff1d00e7b7a23b73083efb642fb3043479a53..9345691ca718028e84422d73cd7e8cb5da84fe55 100644 --- a/dap_chain_datum_coin.c +++ b/dap_chain_datum_coin.c @@ -21,4 +21,4 @@ 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_chain_coin.h" +#include "dap_chain_datum_coin.h" diff --git a/dap_chain_datum_hashtree_roots.c b/dap_chain_datum_hashtree_roots.c index fa093bf31c17f1217b20cd3d8704ac725db090b6..e31522d20815833d803763aaf9f1db9a2bfa56c5 100644 --- a/dap_chain_datum_hashtree_roots.c +++ b/dap_chain_datum_hashtree_roots.c @@ -24,6 +24,6 @@ #include "dap_common.h" -#include "dap_chain_section_roots.h" +#include "dap_chain_datum_hashtree_roots.h" -#define LOG_TAG "dap_chain_section_roots" +#define LOG_TAG "dap_chain_datum_hashtree_roots" diff --git a/dap_chain_datum_hashtree_roots.h b/dap_chain_datum_hashtree_roots.h index 491a069498880c1f2e5a0101438ce4defafc4d72..ad13c8d5ace4f02b9f6eb5e19daca4e0d27eeddf 100644 --- a/dap_chain_datum_hashtree_roots.h +++ b/dap_chain_datum_hashtree_roots.h @@ -27,21 +27,21 @@ #include "dap_chain_common.h" /** - * @struct dap_chain_section_roots_v1 + * @struct dap_chain_datum_hashtree_roots_v1 * @brief Hash tree roots for block, version 1 */ -typedef struct dap_chain_section_roots_v1{ +typedef struct dap_chain_datum_hashtree_roots_v1{ dap_chain_hash_t main; } DAP_ALIGN_PACKED dap_chain_block_roots_v1_t; /** - * @struct dap_chain_section_roots_v2 + * @struct dap_chain_datum_hashtree_roots_v2 * @brief Hash tree roots for block, version 2 */ -typedef struct dap_chain_section_roots_v2{ +typedef struct dap_chain_datum_hashtree_roots_v2{ dap_chain_hash_t main; dap_chain_hash_t txs; -} DAP_ALIGN_PACKED dap_chain_section_roots_v2_t; +} DAP_ALIGN_PACKED dap_chain_datum_hashtree_roots_v2_t; -typedef dap_chain_section_roots_v2_t dap_chain_section_roots_t; +typedef dap_chain_datum_hashtree_roots_v2_t dap_chain_datum_hashtree_roots_t; diff --git a/dap_chain_datum_tx.c b/dap_chain_datum_tx.c index 39e0e02582624a3ce42bc2d468530f07382f15cd..30ce5d8346ddc324aaf7ab2d1526a9d3bb31b567 100644 --- a/dap_chain_datum_tx.c +++ b/dap_chain_datum_tx.c @@ -23,6 +23,6 @@ */ #include "dap_common.h" -#include "dap_chain_section_tx.h" +#include "dap_chain_datum_tx.h" -#define LOG_TAG "dap_chain_section_tx" +#define LOG_TAG "dap_chain_datum_tx" diff --git a/dap_chain_datum_tx.h b/dap_chain_datum_tx.h index 3e4c27c441e5e5ef4876bd673430fc8c529e680d..081defdc19c761f09003e3cf4f42ddc546f56862 100644 --- a/dap_chain_datum_tx.h +++ b/dap_chain_datum_tx.h @@ -23,7 +23,7 @@ */ #pragma once #include "dap_chain_common.h" -#include "dap_chain_section.h" +#include "dap_chain_datum.h" typedef enum dap_chain_tx_item_type{ TX_ITEM_TYPE_IN = 0x00, /// @brief Transaction inputs @@ -33,14 +33,14 @@ typedef enum dap_chain_tx_item_type{ } dap_chain_tx_item_type_t; /** - * @struct dap_chain_section_tx + * @struct dap_chain_datum_tx * @brief Transaction section, consists from lot of tx_items */ -typedef struct dap_chain_section_tx{ +typedef struct dap_chain_datum_tx{ struct { uint64_t lock_time; uint32_t tx_items_size; // size of next sequencly lying tx_item sections would be decided to belong this transaction } DAP_ALIGN_PACKED header; uint8_t tx_items[]; -} DAP_ALIGN_PACKED dap_chain_section_tx_t; +} DAP_ALIGN_PACKED dap_chain_datum_tx_t; diff --git a/dap_chain_datum_tx_in.h b/dap_chain_datum_tx_in.h index 18f0ee9578e6ee3464e70acb27c241ce56468640..dc41c7760e7b7f92d6a00a7a0ec3d5756887e465 100644 --- a/dap_chain_datum_tx_in.h +++ b/dap_chain_datum_tx_in.h @@ -26,7 +26,7 @@ #include <stdint.h> #include "dap_common.h" #include "dap_chain_common.h" -#include "dap_chain_section_tx.h" +#include "dap_chain_datum_tx.h" /** * @struct dap_chain_tx_item * @brief Sections belongs to heading tx section, with inputs, outputs and others tx relatated items diff --git a/dap_chain_datum_tx_out.h b/dap_chain_datum_tx_out.h index c46b767005a473a944119e634b4ecac59be24d0e..24f8240a6fc37aaf163783b7700dc7d71323e00f 100644 --- a/dap_chain_datum_tx_out.h +++ b/dap_chain_datum_tx_out.h @@ -26,7 +26,7 @@ #include <stdint.h> #include "dap_common.h" #include "dap_chain_common.h" -#include "dap_chain_section_tx.h" +#include "dap_chain_datum_tx.h" /** * @struct dap_chain_tx_out diff --git a/dap_chain_datum_tx_pkey.h b/dap_chain_datum_tx_pkey.h index abf7ab628d49b8d6a0ba24ce0f53fb84290b970d..ad64cc6ec47fb98f7592bd1fc43b4abe33d80e82 100644 --- a/dap_chain_datum_tx_pkey.h +++ b/dap_chain_datum_tx_pkey.h @@ -26,7 +26,7 @@ #include <stdint.h> #include "dap_common.h" #include "dap_chain_common.h" -#include "dap_chain_section_tx.h" +#include "dap_chain_datum_tx.h" /** * @struct dap_chain_tx_pkey * @brief TX item with one of the transaction's public keys diff --git a/dap_chain_datum_tx_sig.h b/dap_chain_datum_tx_sig.h index cfeb8503f9c0efb750d5293cb18b3656d7237bf0..bb5aefd44d3e19a03739cb46348e5fb1b7f886d1 100644 --- a/dap_chain_datum_tx_sig.h +++ b/dap_chain_datum_tx_sig.h @@ -26,7 +26,7 @@ #include <stdint.h> #include "dap_common.h" #include "dap_chain_common.h" -#include "dap_chain_section_tx.h" +#include "dap_chain_datum_tx.h" /** diff --git a/dap_chain_ops.c b/dap_chain_ops.c deleted file mode 100644 index c31aba55d19e2570bb9933561aaaec9782b436a8..0000000000000000000000000000000000000000 --- a/dap_chain_ops.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "dap_chain_common.h" -#include "dap_chain_ops.h" -#include "dap_chain_block_txs.h" - -/** - * @brief dap_chain_op_tx_request - * @param a_wallet Sender's wallet - * @param a_wallet_key_idx Key index in the wallet - * @param a_chain_source Blockchain which token we send from - * @param a_value Amount of daptoshi's that we wish to send - * @param a_chain_tx_request Blockhain where we want to record our transaction request - * @param a_destination Destination address - */ -void dap_chain_op_tx_request(dap_chain_wallet_t * a_wallet, uint32_t a_wallet_key_idx, - dap_chain_t * a_chain_source, uint64_t a_value, /// Token source and daptoshi's value - dap_chain_t * a_chain_tx_request, dap_chain_addr_t a_destination ) /// TX blockchain where to create new block -{ - -} diff --git a/dap_chain_ops.h b/dap_chain_ops.h deleted file mode 100644 index d6e984f0b2312e0ac2ae69233d23e909adc2a22c..0000000000000000000000000000000000000000 --- a/dap_chain_ops.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include "dap_chain.h" -#include "dap_chain_wallet.h" - -void dap_chain_op_tx_request(dap_chain_wallet_t * a_wallet, uint32_t a_wallet_key_idx, /// Sender's wallet and key index in it - dap_chain_t * a_chain_source, uint64_t a_value, /// Token source and daptoshi's value - dap_chain_t * a_chain_tx_request, dap_chain_addr_t a_destination ); /// TX blockchain where to create new block