Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-chain
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
cellframe
libdap-chain
Commits
4eee10b3
Commit
4eee10b3
authored
6 years ago
by
Dmitriy A. Gerasimov
Browse files
Options
Downloads
Patches
Plain Diff
[+] New datum sructures
parent
5cd6e41a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dap_chain.h
+1
-0
1 addition, 0 deletions
dap_chain.h
dap_chain_common.h
+16
-0
16 additions, 0 deletions
dap_chain_common.h
dap_chain_datum.h
+29
-12
29 additions, 12 deletions
dap_chain_datum.h
with
46 additions
and
12 deletions
dap_chain.h
+
1
−
0
View file @
4eee10b3
...
...
@@ -28,6 +28,7 @@
#include
"dap_chain_block_cache.h"
typedef
struct
dap_chain
{
dap_chain_id_t
id
;
dap_chain_block_cache_t
*
block_first
;
// Mapped area start
dap_chain_block_cache_t
*
block_last
;
// Last block in mapped area
uint64_t
blocks_count
;
...
...
This diff is collapsed.
Click to expand it.
dap_chain_common.h
+
16
−
0
View file @
4eee10b3
...
...
@@ -29,13 +29,29 @@
#include
"dap_common.h"
#include
"dap_math_ops.h"
#define DAP_CHAIN_ID_SIZE 8
#define DAP_CHAIN_NET_ID_SIZE 8
#define DAP_CHAIN_HASH_SIZE 32
#define DAP_CHAIN_HASH_FAST_SIZE 64
#define DAP_CHAIN_ADDR_HASH_SIZE 32
// Chain ID of the whole system
typedef
union
dap_chain_id
{
uint8_t
data
[
DAP_CHAIN_ID_SIZE
];
}
DAP_ALIGN_PACKED
dap_chain_id_t
;
typedef
union
dap_chain_net_id
{
uint8_t
data
[
DAP_CHAIN_NET_ID_SIZE
];
}
DAP_ALIGN_PACKED
dap_chain_net_id_t
;
typedef
union
dap_chain_hash
{
uint8_t
data
[
DAP_CHAIN_HASH_SIZE
];
}
DAP_ALIGN_PACKED
dap_chain_hash_t
;
typedef
union
dap_chain_hash_fast
{
uint8_t
data
[
DAP_CHAIN_HASH_FAST_SIZE
];
}
DAP_ALIGN_PACKED
dap_chain_hash_fast_t
;
typedef
enum
dap_chain_hash_kind
{
HASH_GOLD
=
0
,
HASH_SILVER
,
HASH_COPPER
,
HASH_USELESS
=
-
1
}
dap_chain_hash_kind_t
;
...
...
This diff is collapsed.
Click to expand it.
dap_chain_datum.h
+
29
−
12
View file @
4eee10b3
...
...
@@ -28,43 +28,60 @@
#include
"dap_math_ops.h"
#include
"dap_chain_common.h"
/// End section, means all the rest of the block is empty
#define dap_chain_datum_END 0x0000
/// Section with additional roots, for example transaction roots
#define dap_chain_datum_hashtree_roots 0x0001
/// Transaction header section
#define
dap_chain_datum
_TX 0x0100
#define
DAP_CHAIN_DATUM
_TX 0x0100
/// Transaction request section
#define
dap_chain_datum
_TX_REQUEST 0x0300
#define
DAP_CHAIN_DATUM
_TX_REQUEST 0x0300
/// Smart contract: DVM code section
#define
dap_chain_datum
_DVM_CODE 0x0900
#define
DAP_CHAIN_DATUM
_DVM_CODE 0x0900
/// Smart contract: DVM code section
#define
dap_chain_datum
_DVM_DATA 0x0901
#define
DAP_CHAIN_DATUM
_DVM_DATA 0x0901
/// Smart contract: EVM code section
#define
dap_chain_datum
_EVM_CODE 0x0910
#define
DAP_CHAIN_DATUM
_EVM_CODE 0x0910
/// Smart contract: EVM data section
#define
dap_chain_datum
_EVM_DATA 0x0911
#define
DAP_CHAIN_DATUM
_EVM_DATA 0x0911
/// Pub key section, with sign and address
#define dap_chain_datum_PKEY 0x0c00
#define DAP_CHAIN_DATUM_PKEY 0x0c00
/// Token
#define DAP_CHAIN_DATUM_TOKEN 0xf000
/// Coin
#define dap_chain_datum_COIN 0xf000
#define DAP_CHAIN_DATUM_ID_SIZE 4
// Datum subchain type id
typedef
union
dap_chain_datum_typeid
{
uint8_t
data
[
DAP_CHAIN_DATUM_ID_SIZE
];
}
DAP_ALIGN_PACKED
dap_chain_datum_typeid_t
;
/**
* @struct dap_chain_block_section
* @brief section inside the block
*/
typedef
struct
dap_chain_datum
{
uint16_t
type
;
// Section type
uint8_t
data
[];
// data
uint8_t
version_id
;
// Datum version
uint8_t
hash_type_id
;
// Hash type id
uint16_t
type_id
;
// Section type id
uint16_t
hashes_count
;
// Hashes_number
uint8_t
hashes_n_signs_n_data
[];
// datum stored data goes after the last sign
// Sign block goes after the last hash, every sign type
// has its own predefined size or stores its inside.
// After signs goes data block and and till the end of datum.
}
DAP_ALIGN_PACKED
dap_chain_datum_t
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment