Module constants

Module constants 

Source
Expand description

DEFAULT VALUES USED TO INITIALIZE DIVERS CONFIGURATIONS STRUCTURES

§Default hard-coded

Each crates may contains a settings.rs or a config.rs the Default implementation of each object take the default Values from the following file.

These values are the hard-coded values that make sens to never be modified by a user. Generally, this values are passed with dependency injection in a cfg parameter for each worker, that is convenient for unit tests.

A parallel file with the same constant definitions exist for the testing case. (default_testing.rs) But as for the current file you shouldn’t modify it.

Structs§

CHAINID
node chain id (to avoid replay attacks)
END_TIMESTAMP
TESTNET: time when the blockclique is ended.
GENESIS_KEY
KeyPair to sign genesis blocks.
GENESIS_TIMESTAMP
Time in milliseconds when the blockclique started. In sandbox mode, the value depends on starting time and on the –restart-from-snapshot-at-period argument in CLI, so that the network starts or restarts 10 seconds after launch
POS_MISS_RATE_DEACTIVATION_THRESHOLD
number of cycle misses (strictly) above which stakers are deactivated
VERSION
node version

Constants§

ASYNC_MSG_CST_GAS_COST
Constant cost applied to asynchronous messages (to take into account some costs related to snapshot)
BASE_OPERATION_GAS_COST
Gas used by a base operation (transaction, roll buy, roll sell)
BLOCK_REWARD
Block reward is given for each block creation
BOOTSTRAP_BATCH_ENTRY_OVERHEAD
Rough in-memory cost of one (key, value) entry of a received bootstrap batch, on top of the bytes it carries: the BTreeMap node slot it occupies, the two Vec headers, and allocator rounding. Deliberately an over-estimate, so that the budget below is reached before the allocator actually is.
BOOTSTRAP_MESSAGE_LEN_PREFIX_MAX
Bound the bootstrap message length prefix is encoded against, in both directions.
BOOTSTRAP_MESSAGE_LEN_PREFIX_SIZE_BYTES
The number of bytes needed to encode BOOTSTRAP_MESSAGE_LEN_PREFIX_MAX
BOOTSTRAP_RANDOMNESS_SIZE_BYTES
Size of the random bytes array used for the bootstrap, safe to import
CHANNEL_SIZE
Consensus static parameters (defined by protocol used) Changing one of the following values is considered as a breaking change Values differ in test flavor building for faster CI and simpler scenarios
COMMUNITY_CHARTER_CONTENT
Massa Community charter content
CONSENSUS_BOOTSTRAP_PART_SIZE
Maximum number of consensus blocks in a bootstrap batch
DEFERRED_CALL_BASE_FEE_MAX_CHANGE_DENOMINATOR
max change denominator
DEFERRED_CALL_CST_GAS_COST
deferred call call gas cost
DEFERRED_CALL_GLOBAL_OVERBOOKING_PENALTY
deferred call global overbooking penalty
DEFERRED_CALL_MAX_ASYNC_GAS
maximum gas for deferred call
DEFERRED_CALL_MAX_FUTURE_SLOTS
Maximum size of deferred call future slots (1 week)
DEFERRED_CALL_MAX_POOL_CHANGES
Maximum size of deferred call pool changes
DEFERRED_CALL_MIN_GAS_COST
deferred call min gas cost (10 nanomassa)
DEFERRED_CALL_MIN_GAS_INCREMENT
deferred call min gas increment (1 nanomassa)
DEFERRED_CALL_SLOT_OVERBOOKING_PENALTY
deferred call slot overbooking penalty
DELTA_F0
Threshold for fitness.
DENUNCIATION_EXPIRE_PERIODS
denunciation expiration delta
ENDORSEMENT_COUNT
Number of endorsement
HANDSHAKE_RANDOMNESS_SIZE_BYTES
Length of the handshake random signature
INITIAL_DRAW_SEED
Proof of stake seed for the initial draw
IP_LIST_MAX_SIZE
Max size of the IP list
KEEP_EXECUTED_HISTORY_EXTRA_PERIODS
Number of periods of executed operation and denunciation history to keep
LEDGER_COST_PER_BYTE
Cost to store one byte in the ledger
LEDGER_ENTRY_BASE_COST
Cost for a base entry default 0.01 MASSA
LEDGER_ENTRY_DATASTORE_BASE_SIZE
Base size of a empty datastore entry (not counting the key nor the value)
MAX_ADVERTISE_LENGTH
Limit on the number of peers we advertise to others.
MAX_ASYNC_GAS
Base GAS budget for asynchronous messages execution on one slot. This is not a strict per-slot cap: since MIP-0001, execute_slot tops this budget up with the gas left unused by the block at that slot (and subtracts the gas booked by deferred calls), so async execution can exceed this value on underfilled slots. The bound that always holds is MAX_GAS_PER_BLOCK + MAX_ASYNC_GAS for the whole slot.
MAX_ASYNC_POOL_LENGTH
Maximum capacity of the asynchronous messages pool
MAX_BLOCK_SIZE
Maximum block size in bytes
MAX_BOOTSTRAP_ASYNC_POOL_CHANGES
Max async pool changes
MAX_BOOTSTRAP_BLOCKS
Max number of blocks we provide/ take into account while bootstrapping
MAX_BOOTSTRAP_CHILDREN
Max number of child nodes
MAX_BOOTSTRAP_CLIQUES
max bootstrapped cliques
MAX_BOOTSTRAP_DEPS
max bootstrapped dependencies
MAX_BOOTSTRAP_ERROR_LENGTH
Max size of the printed error
MAX_BOOTSTRAP_FINAL_STATE_PARTS_SIZE
Max bytes in final states parts
MAX_BOOTSTRAP_MESSAGE_FROM_CLIENT_SIZE
Max message size for bootstrap coming from client The worst case is a AskBootstrapPart with mostly 2 keys and MAX_CONSENSUS_BLOCKS_IDS blocks_ids.
MAX_BOOTSTRAP_MESSAGE_FROM_SERVER_SIZE
Max message size for bootstrap Note: Update sizes are not limited, the 190Mb constant is to take them into account.
MAX_BOOTSTRAP_MESSAGE_FROM_SERVER_SIZE_BYTES
The number of bytes needed to encode MAX_BOOTSTRAP_MESSAGE_FROM_SERVER_SIZE
MAX_BOOTSTRAP_POS_CYCLES
Max number of cycles in PoS bootstrap
MAX_BOOTSTRAP_VERSIONING_ELEMENTS_SIZE
Max bytes in final states parts
MAX_BYTECODE_LENGTH
Maximum length of a smart contract bytecode
MAX_CONSENSUS_BLOCKS_IDS
Max block ids in the client consensus reconnect ask. Larger local graphs are fine in-session; only the ask is capped (newest finals), and the graph is pruned to match on reconnect.
MAX_DATASTORE_ENTRY_COUNT
Maximum number of key/values in the datastore of a ledger entry
MAX_DATASTORE_KEY_LENGTH
Maximum length of a datastore key
MAX_DATASTORE_VALUE_LENGTH
Maximum length of a datastore value
MAX_DEFERRED_CREDITS_LENGTH
Maximum size proof-of-stake deferred credits
MAX_DENUNCIATIONS_PER_BLOCK_HEADER
Max number of denunciations that can be included in a block header
MAX_DENUNCIATION_CHANGES_LENGTH
Maximum size of executed denunciations
MAX_DUPLEX_BUFFER_SIZE
max duplex buffer size
MAX_ENDORSEMENTS_PER_MESSAGE
Max number of endorsements per message
MAX_ENDORSEMENTS_PER_SLOT_INDEX
Maximum number of endorsements kept for a given (slot, index) draw, whatever the endorsed block is. Enforced both by the endorsement pool and by the protocol propagation path, which share this bound so that neither becomes the tighter of the two.
MAX_EVENT_DATA_SIZE
Maximum event size in bytes
MAX_EVENT_DATA_SIZE_V0
Maximum event size in bytes
MAX_EVENT_PER_OPERATION
Maximum event number that can be emitted for an operation
MAX_EXECUTED_OPS_CHANGES_LENGTH
Maximum size of executed ops changes
MAX_EXECUTED_OPS_LENGTH
Maximum size of executed ops
MAX_FUNCTION_NAME_LENGTH
Maximum length function name in call SC
MAX_GAS_PER_BLOCK
Maximum of GAS allowed for a block
MAX_LEDGER_CHANGES_COUNT
Maximum ledger changes count
MAX_LEDGER_CHANGES_PER_SLOT
Maximum ledger changes in a block
MAX_LISTENERS_PER_PEER
Maximum number of listeners for a peer
MAX_MESSAGE_SIZE
Maximum message length in bytes
MAX_OPERATIONS_COUNT_PREFIX_SIZE
Maximum size in bytes of the varint prefix holding the number of operations of a serialized operation list. That count is a u32 varint, and a varint carries 7 bits of payload per byte, hence ceil(32 / 7) = 5 bytes at most.
MAX_OPERATIONS_PER_BLOCK
Maximum number of operations per block
MAX_OPERATIONS_PER_MESSAGE
Max number of operations per message
MAX_OPERATION_DATASTORE_ENTRY_COUNT
Maximum number of key/values in the datastore of a ExecuteSC operation
MAX_OPERATION_DATASTORE_KEY_LENGTH
Maximum length of an operation datastore key
MAX_OPERATION_DATASTORE_VALUE_LENGTH
Maximum length of an operation datastore value
MAX_OPERATION_STORAGE_TIME
Maximum of time we keep the operations in the storage of the propagation thread
MAX_PARAMETERS_SIZE
Maximum size of parameters in call SC
MAX_PEERS_IN_ANNOUNCEMENT_LIST
Maximum number of peer in a announcement list of peer
MAX_PRODUCTION_EVENTS_PER_BLOCK
Maximum production events in a block
MAX_PRODUCTION_STATS_LENGTH
Maximum size of proof-of-stake production stats
MAX_RECURSIVE_CALLS_DEPTH
Maximum number of recursion for calls
MAX_RNG_SEED_LENGTH
Maximum length of rng_seed in thread cycle
MAX_ROLLS_COUNT_LENGTH
Maximum size of proof-of-stake rolls
MAX_RUNTIME_MODULE_CUSTOM_SECTION_DATA_LEN
Maximum length for the custom section data
MAX_RUNTIME_MODULE_CUSTOM_SECTION_LEN
Maximum number of custom section data
MAX_RUNTIME_MODULE_DEFINED_FUNCTIONS 🔒
CondomMiddleware limits see test_condom_middleware_calibrate in massa-sc-runtime for origin of values. Maximum number of function defined in a smart contract
MAX_RUNTIME_MODULE_EXPORTS
Maximum number of exports for a smart contract module (function and globals)
MAX_RUNTIME_MODULE_FUNCTIONS
Maximum number of function used by a smart contract
MAX_RUNTIME_MODULE_FUNCTION_ARGS 🔒
Maximum number of arguments to a function
MAX_RUNTIME_MODULE_FUNCTION_IMPORTS 🔒
Maximum number of functions a module can import
MAX_RUNTIME_MODULE_FUNCTION_NAME_LEN
Maximum length for the name of a function defined in a smart contract
MAX_RUNTIME_MODULE_FUNCTION_RETURN_VALUES 🔒
Maximum number of value a function can return
MAX_RUNTIME_MODULE_GLOBAL_INITIALIZER
Maximum number of global initializer in a smart contract
MAX_RUNTIME_MODULE_IMPORTS
Maximum number of elements a module can import
MAX_RUNTIME_MODULE_MEMORIES
Maximum number of memories in a smart contract
MAX_RUNTIME_MODULE_MEMORY_IMPORTS 🔒
Maximum number of memory a module can import
MAX_RUNTIME_MODULE_NAME_LEN
Maximum length for the name of a smart contract
MAX_RUNTIME_MODULE_PASSIVE_DATA
Maximum number of passive data in a smart contract
MAX_RUNTIME_MODULE_PASSIVE_ELEMENT
Maximum number of passive element in a smart contract
MAX_RUNTIME_MODULE_SIGNATURE_LEN
Maximum signature length (total number of arguments and return values) for a function of a smart contract module
MAX_RUNTIME_MODULE_TABLE
Maximum number of table in a smart contract
MAX_RUNTIME_MODULE_TABLE_INITIALIZER
Maximum number of table initializer in a smart contract
MAX_SIZE_CHANNEL_COMMANDS_CONNECTIVITY
Maximum size of channel used for commands in connectivity thread
MAX_SIZE_CHANNEL_COMMANDS_PEERS
Maximum size of channel used for commands in peers management thread
MAX_SIZE_CHANNEL_COMMANDS_PEER_TESTERS
Maximum size of channel used for commands in peer testers thread
MAX_SIZE_CHANNEL_COMMANDS_PROPAGATION_BLOCKS
Maximum size of channel used for commands in propagation thread of block
MAX_SIZE_CHANNEL_COMMANDS_PROPAGATION_ENDORSEMENTS
Maximum size of channel used for commands in propagation thread of endorsements
MAX_SIZE_CHANNEL_COMMANDS_PROPAGATION_OPERATIONS
Maximum size of channel used for commands in propagation thread of operations
MAX_SIZE_CHANNEL_COMMANDS_RETRIEVAL_BLOCKS
Maximum size of channel used for commands in retrieval thread of block
MAX_SIZE_CHANNEL_COMMANDS_RETRIEVAL_ENDORSEMENTS
Maximum size of channel used for commands in retrieval thread of endorsements
MAX_SIZE_CHANNEL_COMMANDS_RETRIEVAL_OPERATIONS
Maximum size of channel used for commands in retrieval thread of operations
MAX_SIZE_CHANNEL_NETWORK_TO_BLOCK_HANDLER
Maximum size of channel used to send network events to the block handler
MAX_SIZE_CHANNEL_NETWORK_TO_ENDORSEMENT_HANDLER
Maximum size of channel used to send network events to the endorsement handler
MAX_SIZE_CHANNEL_NETWORK_TO_OPERATION_HANDLER
Maximum size of channel used to send network events to the operation handler
MAX_SIZE_CHANNEL_NETWORK_TO_PEER_HANDLER
Maximum size of channel used to send network events to the peer handler
MIN_EXPECTED_BOOTSTRAP_ELEMENT_WIRE_SIZE
Smallest wire size a real (key, value) entry of a bootstrap batch is expected to have.
MIP_STORE_STATS_BLOCK_CONSIDERED
Block count to process in MipStoreStats (for state change threshold)
NETWORK_CONTROLLER_CHANNEL_SIZE
network controller communication channel size
NETWORK_EVENT_CHANNEL_SIZE
network event channel size
NETWORK_NODE_COMMAND_CHANNEL_SIZE
network node command channel size
NETWORK_NODE_EVENT_CHANNEL_SIZE
network node event channel size
NODE_SEND_CHANNEL_SIZE
node send channel size
OPERATION_VALIDITY_PERIODS
Maximum operation validity period count
PERIODS_PER_CYCLE
cycle duration in periods
POS_SAVED_CYCLES
Number of cycles saved in PoSFinalState
PROTOCOL_CONTROLLER_CHANNEL_SIZE
Protocol controller channel size
PROTOCOL_EVENT_CHANNEL_SIZE
Protocol event channel size
ROLL_COUNT_TO_SLASH_ON_DENUNCIATION
Number of roll to remove per denunciation
ROLL_PRICE
Price of a roll in the network
SELECTOR_DRAW_CACHE_SIZE
Number of cycle draws saved in the selector cache
SIGNATURE_DESER_SIZE
IMPORTANNT TODO: should be removed after the bootstrap messages refacto
T0
Time between the periods in the same thread.
THREAD_COUNT
Number of threads
VERSIONING_ACTIVATION_DELAY_MIN
Minimum value allowed for activation delay (in MIP info)
VERSIONING_THRESHOLD_TRANSITION_ACCEPTED
Threshold to accept a new versioning

Functions§

bootstrap_batch_allocation_budget
Budget for the in-memory footprint of one received bootstrap batch section, derived from the wire size that section is already bounded by.
get_period_from_args
Helper function to parse args for lazy_static evaluations
operations_payload_size
Size of the serialized operation list holding operations of aggregate size operations_size: the operations themselves, plus the varint prefix holding their count. Use it to turn an operations size budget (such as max_serialized_operations_size_per_block) into the payload size a peer is allowed to send us.