validations.rs

Overview

This file defines additional validation and configuration adjustment methods for the Config struct, which is imported from the parent module. These methods ensure that the system configuration meets certain runtime requirements related to CPU core availability and execution timeouts. The primary functionalities provided are:

These validations are critical in maintaining the performance and correctness constraints of the system's runtime environment.


Config Implementation Extensions

ensure_min_cpu

pub fn ensure_min_cpu(mut self, min_number_of_cores: usize) -> Self
let config = Config::default()
    .ensure_min_cpu(4);

This example ensures that the runtime environment has at least 4 CPU cores and sets the parallelization level accordingly.


ensure_execution_timeouts

pub fn ensure_execution_timeouts(mut self) -> Self
let config = Config::default()
    .ensure_execution_timeouts();

This example verifies and sets the execution timeout parameters to consistent values based on the block and transaction timings.


Implementation Details and Algorithms


Interaction with Other System Components


Visual Diagram

classDiagram
class Config {
+ensure_min_cpu()
+ensure_execution_timeouts()
-local.parallelization_level
-global.time_to_produce_block_millis
-global.time_to_produce_transaction_millis
-global.time_to_verify_block_millis
-global.time_to_verify_transaction_millis
-global.time_to_verify_transaction_aborted_with_execution_timeout_millis
}
Config : uses num_cpus crate
Config : uses tracing crate