Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
config.hpp
Go to the documentation of this file.
1#pragma once
3#include <fc/time.hpp>
4#include <fc/utility.hpp>
5
6namespace sysio { namespace chain { namespace config {
7
8typedef __uint128_t uint128_t;
9
10const static auto default_blocks_dir_name = "blocks";
11const static auto reversible_blocks_dir_name = "reversible";
12
13const static auto default_state_dir_name = "state";
14const static auto forkdb_filename = "fork_db.dat";
15const static auto default_state_size = 1*1024*1024*1024ll;
16const static auto default_state_guard_size = 128*1024*1024ll;
17
18
19const static name system_account_name { "sysio"_n };
20const static name null_account_name { "sysio.null"_n };
21const static name producers_account_name { "sysio.prods"_n };
22
23// Active permission of producers account requires greater than 2/3 of the producers to authorize
24const static name majority_producers_permission_name { "prod.major"_n }; // greater than 1/2 of producers needed to authorize
25const static name minority_producers_permission_name { "prod.minor"_n }; // greater than 1/3 of producers needed to authorize0
26
27const static name sysio_auth_scope { "sysio.auth"_n };
28const static name sysio_all_scope { "sysio.all"_n };
29
30const static name active_name { "active"_n };
31const static name owner_name { "owner"_n };
32const static name sysio_any_name { "sysio.any"_n };
33const static name sysio_code_name { "sysio.code"_n };
34
35const static int block_interval_ms = 500;
36const static int block_interval_us = block_interval_ms*1000;
37const static uint64_t block_timestamp_epoch = 946684800000ll; // epoch is year 2000.
38const static uint32_t genesis_num_supported_key_types = 2;
39
41const static int percent_100 = 10000;
42const static int percent_1 = 100;
43
44static const uint32_t account_cpu_usage_average_window_ms = 24*60*60*1000l;
45static const uint32_t account_net_usage_average_window_ms = 24*60*60*1000l;
46static const uint32_t block_cpu_usage_average_window_ms = 60*1000l;
47static const uint32_t block_size_average_window_ms = 60*1000l;
48static const uint32_t maximum_elastic_resource_multiplier = 1000;
49
50//const static uint64_t default_max_storage_size = 10 * 1024;
51//const static uint32_t default_max_trx_runtime = 10*1000;
52//const static uint32_t default_max_gen_trx_size = 64 * 1024;
53
54const static uint32_t rate_limiting_precision = 1000*1000;
55
56
57const static uint32_t default_max_block_net_usage = 1024 * 1024;
58const static uint32_t default_target_block_net_usage_pct = 10 * percent_1;
59const static uint32_t default_max_transaction_net_usage = default_max_block_net_usage / 2;
60const static uint32_t default_base_per_transaction_net_usage = 12; // 12 bytes (11 bytes for worst case of transaction_receipt_header + 1 byte for static_variant tag)
61const static uint32_t default_net_usage_leeway = 500; // TODO: is this reasonable?
62const static uint32_t default_context_free_discount_net_usage_num = 20; // TODO: is this reasonable?
63const static uint32_t default_context_free_discount_net_usage_den = 100;
64const static uint32_t transaction_id_net_usage = 32; // 32 bytes for the size of a transaction id
65
66const static uint32_t default_max_block_cpu_usage = 200'000;
67const static uint32_t default_target_block_cpu_usage_pct = 10 * percent_1;
68const static uint32_t default_max_transaction_cpu_usage = 3*default_max_block_cpu_usage/4;
69const static uint32_t default_min_transaction_cpu_usage = 100;
70const static uint32_t default_subjective_cpu_leeway_us = 31000;
71
72const static uint32_t default_max_trx_lifetime = 60*60; // 1 hour
73const static uint32_t default_deferred_trx_expiration_window = 10*60; // 10 minutes
74const static uint32_t default_max_trx_delay = 45*24*3600; // 45 days
75const static uint32_t default_max_inline_action_size = 512 * 1024; // 512 KB
76const static uint16_t default_max_inline_action_depth = 4;
77const static uint16_t default_max_auth_depth = 6;
78const static uint32_t default_sig_cpu_bill_pct = 50 * percent_1; // billable percentage of signature recovery
79const static uint32_t default_block_cpu_effort_pct = 80 * percent_1; // percentage of block time used for producing block
80const static uint16_t default_controller_thread_pool_size = 2;
81const static uint32_t default_max_variable_signature_length = 16384u;
82const static uint32_t default_max_nonprivileged_inline_action_size = 4 * 1024; // 4 KB
83const static uint32_t default_max_action_return_value_size = 256;
84
85const static uint32_t default_max_transaction_finality_status_success_duration_sec = 180;
86const static uint32_t default_max_transaction_finality_status_failure_duration_sec = 180;
87
88static_assert(MAX_SIZE_OF_BYTE_ARRAYS == 20*1024*1024, "Changing MAX_SIZE_OF_BYTE_ARRAYS breaks consensus. Make sure this is expected");
89
90const static uint32_t default_max_wasm_mutable_global_bytes = 1024;
91const static uint32_t default_max_wasm_table_elements = 1024;
92const static uint32_t default_max_wasm_section_elements = 8192;
93const static uint32_t default_max_wasm_linear_memory_init = 64*1024;
94const static uint32_t default_max_wasm_func_local_bytes = 8192;
95const static uint32_t default_max_wasm_nested_structures = 1024;
96const static uint32_t default_max_wasm_symbol_bytes = 8192;
97const static uint32_t default_max_wasm_module_bytes = 20*1024*1024;
98const static uint32_t default_max_wasm_code_bytes = 20*1024*1024;
99const static uint32_t default_max_wasm_pages = 528;
100const static uint32_t default_max_wasm_call_depth = 251;
101
102const static uint32_t min_net_usage_delta_between_base_and_max_for_trx = 10*1024;
103// Should be large enough to allow recovery from badly set blockchain parameters without a hard fork
104// (unless net_usage_leeway is set to 0 and so are the net limits of all accounts that can help with resetting blockchain parameters).
105
106const static uint32_t fixed_net_overhead_of_packed_trx = 16; // TODO: is this reasonable?
107
108const static uint32_t fixed_overhead_shared_vector_ram_bytes = 16;
109const static uint32_t overhead_per_row_per_index_ram_bytes = 32;
110const static uint32_t overhead_per_account_ram_bytes = 2*1024;
111const static uint32_t setcode_ram_bytes_multiplier = 10;
112
113const static uint32_t hashing_checktime_block_size = 10*1024;
114
115#ifdef SYSIO_SYS_VM_JIT_RUNTIME_ENABLED
116const static sysio::chain::wasm_interface::vm_type default_wasm_runtime = sysio::chain::wasm_interface::vm_type::eos_vm_jit;
117#else
118const static sysio::chain::wasm_interface::vm_type default_wasm_runtime = sysio::chain::wasm_interface::vm_type::eos_vm;
119#endif
120
121const static uint32_t default_abi_serializer_max_time_us = 15*1000;
122
126const static int producer_repetitions = 12;
127const static int max_producers = 125;
128
129const static size_t maximum_tracked_dpos_confirmations = 1024;
130static_assert(maximum_tracked_dpos_confirmations >= ((max_producers * 2 / 3) + 1) * producer_repetitions, "Settings never allow for DPOS irreversibility" );
131
132
137//const static int blocks_per_round = producer_count * producer_repetitions;
138
139const static int irreversible_threshold_percent= 70 * percent_1;
140
141const static uint64_t billable_alignment = 16;
142
143template<typename T>
145
146template<typename T>
147constexpr uint64_t billable_size_v = ((billable_size<T>::value + billable_alignment - 1) / billable_alignment) * billable_alignment;
148
149
150} } } // namespace sysio::chain::config
151
153 return (value * percentage) / sysio::chain::config::percent_100;
154}
155
156template<typename Number>
157Number SYS_PERCENT_CEIL(Number value, uint32_t percentage) {
158 return ((value * percentage) + sysio::chain::config::percent_100 - sysio::chain::config::percent_1) / sysio::chain::config::percent_100;
159}
std::string name
constexpr uint64_t SYS_PERCENT(uint64_t value, uint32_t percentage)
Definition config.hpp:152
Number SYS_PERCENT_CEIL(Number value, uint32_t percentage)
Definition config.hpp:157
constexpr uint64_t billable_size_v
Definition config.hpp:147
__uint128_t uint128_t
Definition config.hpp:8
#define value
Definition pkcs11.h:157
unsigned short uint16_t
Definition stdint.h:125
unsigned int uint32_t
Definition stdint.h:126
unsigned __int64 uint64_t
Definition stdint.h:136
Immutable except for fc::from_variant.
Definition name.hpp:43
#define MAX_SIZE_OF_BYTE_ARRAYS
Definition utility.hpp:19