mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-01-02 13:23:13 +00:00
configs: remove unwrap/expect from node configs
This commit is contained in:
parent
17180d8c37
commit
b150c584c0
@ -40,6 +40,13 @@ pub(crate) fn build_blend_service_config(
|
||||
BlendDeploymentSettings,
|
||||
NetworkDeploymentSettings,
|
||||
) {
|
||||
let message_frequency_per_round = match NonNegativeF64::try_from(MESSAGE_FREQUENCY_PER_ROUND) {
|
||||
Ok(value) => value,
|
||||
Err(_) => unsafe {
|
||||
// Safety: `MESSAGE_FREQUENCY_PER_ROUND` is a finite non-negative constant.
|
||||
std::hint::unreachable_unchecked()
|
||||
},
|
||||
};
|
||||
let zk_key_id = key_id_for_preload_backend(&Key::from(config.secret_zk_key.clone()));
|
||||
|
||||
let backend_core = &config.backend_core;
|
||||
@ -73,20 +80,21 @@ pub(crate) fn build_blend_service_config(
|
||||
|
||||
let deployment_settings = BlendDeploymentSettings {
|
||||
common: blend_deployment::CommonSettings {
|
||||
num_blend_layers: NonZeroU64::try_from(BLEND_LAYERS_COUNT).unwrap(),
|
||||
minimum_network_size: NonZeroU64::try_from(MINIMUM_NETWORK_SIZE).unwrap(),
|
||||
num_blend_layers: unsafe { NonZeroU64::new_unchecked(BLEND_LAYERS_COUNT) },
|
||||
minimum_network_size: unsafe { NonZeroU64::new_unchecked(MINIMUM_NETWORK_SIZE) },
|
||||
timing: TimingSettings {
|
||||
round_duration: Duration::from_secs(ROUND_DURATION_SECS),
|
||||
rounds_per_interval: NonZeroU64::try_from(ROUNDS_PER_INTERVAL).unwrap(),
|
||||
rounds_per_session: NonZeroU64::try_from(ROUNDS_PER_SESSION).unwrap(),
|
||||
rounds_per_observation_window: NonZeroU64::try_from(ROUNDS_PER_OBSERVATION_WINDOW)
|
||||
.unwrap(),
|
||||
rounds_per_session_transition_period: NonZeroU64::try_from(
|
||||
ROUNDS_PER_SESSION_TRANSITION,
|
||||
)
|
||||
.unwrap(),
|
||||
epoch_transition_period_in_slots: NonZeroU64::try_from(EPOCH_TRANSITION_SLOTS)
|
||||
.unwrap(),
|
||||
rounds_per_interval: unsafe { NonZeroU64::new_unchecked(ROUNDS_PER_INTERVAL) },
|
||||
rounds_per_session: unsafe { NonZeroU64::new_unchecked(ROUNDS_PER_SESSION) },
|
||||
rounds_per_observation_window: unsafe {
|
||||
NonZeroU64::new_unchecked(ROUNDS_PER_OBSERVATION_WINDOW)
|
||||
},
|
||||
rounds_per_session_transition_period: unsafe {
|
||||
NonZeroU64::new_unchecked(ROUNDS_PER_SESSION_TRANSITION)
|
||||
},
|
||||
epoch_transition_period_in_slots: unsafe {
|
||||
NonZeroU64::new_unchecked(EPOCH_TRANSITION_SLOTS)
|
||||
},
|
||||
},
|
||||
protocol_name: backend_core.protocol_name.clone(),
|
||||
},
|
||||
@ -94,14 +102,12 @@ pub(crate) fn build_blend_service_config(
|
||||
scheduler: SchedulerSettings {
|
||||
cover: CoverTrafficSettings {
|
||||
intervals_for_safety_buffer: SAFETY_BUFFER_INTERVALS,
|
||||
message_frequency_per_round: NonNegativeF64::try_from(
|
||||
MESSAGE_FREQUENCY_PER_ROUND,
|
||||
)
|
||||
.unwrap(),
|
||||
message_frequency_per_round,
|
||||
},
|
||||
delayer: MessageDelayerSettings {
|
||||
maximum_release_delay_in_rounds: NonZeroU64::try_from(MAX_RELEASE_DELAY_ROUNDS)
|
||||
.unwrap(),
|
||||
maximum_release_delay_in_rounds: unsafe {
|
||||
NonZeroU64::new_unchecked(MAX_RELEASE_DELAY_ROUNDS)
|
||||
},
|
||||
},
|
||||
},
|
||||
minimum_messages_coefficient: backend_core.minimum_messages_coefficient,
|
||||
|
||||
@ -39,7 +39,7 @@ const CRYPTARCHIA_GOSSIPSUB_PROTOCOL: &str = "/cryptarchia/proto";
|
||||
const MEMPOOL_PUBSUB_TOPIC: &str = "mantle";
|
||||
const STATE_RECORDING_INTERVAL_SECS: u64 = 60;
|
||||
const IBD_DOWNLOAD_DELAY_SECS: u64 = 10;
|
||||
const MAX_ORPHAN_CACHE_SIZE: usize = 5;
|
||||
const MAX_ORPHAN_CACHE_SIZE: NonZeroUsize = unsafe { NonZeroUsize::new_unchecked(5) };
|
||||
const DA_PUBLISH_THRESHOLD: f64 = 0.8;
|
||||
const API_RATE_LIMIT_PER_SECOND: u64 = 10000;
|
||||
const API_RATE_LIMIT_BURST: u32 = 10000;
|
||||
@ -103,8 +103,7 @@ pub(crate) fn cryptarchia_config(config: &GeneralConfig) -> CryptarchiaConfig {
|
||||
},
|
||||
sync: SyncConfig {
|
||||
orphan: OrphanConfig {
|
||||
max_orphan_cache_size: NonZeroUsize::new(MAX_ORPHAN_CACHE_SIZE)
|
||||
.expect("Max orphan cache size must be non-zero"),
|
||||
max_orphan_cache_size: MAX_ORPHAN_CACHE_SIZE,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -128,6 +127,13 @@ fn kzg_params_path(raw: &str) -> String {
|
||||
pub(crate) fn da_verifier_config(
|
||||
config: &GeneralConfig,
|
||||
) -> DaVerifierServiceSettings<KzgrsDaVerifierSettings, (), (), VerifierStorageAdapterSettings> {
|
||||
let publish_threshold = match NonNegativeF64::try_from(DA_PUBLISH_THRESHOLD) {
|
||||
Ok(value) => value,
|
||||
Err(_) => unsafe {
|
||||
// Safety: `DA_PUBLISH_THRESHOLD` is a finite non-negative constant.
|
||||
std::hint::unreachable_unchecked()
|
||||
},
|
||||
};
|
||||
DaVerifierServiceSettings {
|
||||
share_verifier_settings: KzgrsDaVerifierSettings {
|
||||
global_params_path: kzg_params_path(&config.da_config.global_params_path),
|
||||
@ -139,7 +145,7 @@ pub(crate) fn da_verifier_config(
|
||||
blob_storage_directory: BLOB_STORAGE_DIR.into(),
|
||||
},
|
||||
mempool_trigger_settings: MempoolPublishTriggerConfig {
|
||||
publish_threshold: NonNegativeF64::try_from(DA_PUBLISH_THRESHOLD).unwrap(),
|
||||
publish_threshold,
|
||||
share_duration: timeouts::share_duration(),
|
||||
prune_duration: timeouts::prune_duration(),
|
||||
prune_interval: timeouts::prune_interval(),
|
||||
|
||||
@ -50,7 +50,10 @@ impl GeneralTracingConfig {
|
||||
Self {
|
||||
tracing_settings: TracingSettings {
|
||||
logger: LoggerLayer::Loki(LokiConfig {
|
||||
endpoint: "http://localhost:3100".try_into().unwrap(),
|
||||
endpoint: "http://localhost:3100".parse().unwrap_or_else(|_| unsafe {
|
||||
// Safety: the URL is a valid constant.
|
||||
std::hint::unreachable_unchecked()
|
||||
}),
|
||||
host_identifier: host_identifier.clone(),
|
||||
}),
|
||||
tracing: otlp_tracing,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user