@@ -21,7 +21,7 @@ use error_stack::{Result, ResultExt};
2121use iroha_config_base:: {
2222 attach:: ConfigValueAndOrigin ,
2323 env:: FromEnvStr ,
24- util:: { Emitter , EmitterResultExt , HumanBytes , HumanDuration } ,
24+ util:: { Bytes , DurationMs , Emitter , EmitterResultExt } ,
2525 ReadConfig , WithOrigin ,
2626} ;
2727use iroha_crypto:: { PrivateKey , PublicKey } ;
@@ -275,14 +275,14 @@ pub struct Network {
275275 #[ config( default = "defaults::network::BLOCK_GOSSIP_MAX_SIZE" ) ]
276276 pub block_gossip_max_size : NonZeroU32 ,
277277 #[ config( default = "defaults::network::BLOCK_GOSSIP_PERIOD.into()" ) ]
278- pub block_gossip_period : HumanDuration ,
278+ pub block_gossip_period_ms : DurationMs ,
279279 #[ config( default = "defaults::network::TRANSACTION_GOSSIP_MAX_SIZE" ) ]
280280 pub transaction_gossip_max_size : NonZeroU32 ,
281281 #[ config( default = "defaults::network::TRANSACTION_GOSSIP_PERIOD.into()" ) ]
282- pub transaction_gossip_period : HumanDuration ,
282+ pub transaction_gossip_period_ms : DurationMs ,
283283 /// Duration of time after which connection with peer is terminated if peer is idle
284284 #[ config( default = "defaults::network::IDLE_TIMEOUT.into()" ) ]
285- pub idle_timeout : HumanDuration ,
285+ pub idle_timeout_ms : DurationMs ,
286286}
287287
288288impl Network {
@@ -296,10 +296,10 @@ impl Network {
296296 let Self {
297297 address,
298298 block_gossip_max_size,
299- block_gossip_period,
299+ block_gossip_period_ms : block_gossip_period,
300300 transaction_gossip_max_size,
301- transaction_gossip_period,
302- idle_timeout,
301+ transaction_gossip_period_ms : transaction_gossip_period,
302+ idle_timeout_ms : idle_timeout,
303303 } = self ;
304304
305305 (
@@ -330,19 +330,19 @@ pub struct Queue {
330330 pub capacity_per_user : NonZeroUsize ,
331331 /// The transaction will be dropped after this time if it is still in the queue.
332332 #[ config( default = "defaults::queue::TRANSACTION_TIME_TO_LIVE.into()" ) ]
333- pub transaction_time_to_live : HumanDuration ,
333+ pub transaction_time_to_live_ms : DurationMs ,
334334 /// The threshold to determine if a transaction has been tampered to have a future timestamp.
335335 #[ config( default = "defaults::queue::FUTURE_THRESHOLD.into()" ) ]
336- pub future_threshold : HumanDuration ,
336+ pub future_threshold_ms : DurationMs ,
337337}
338338
339339impl Queue {
340340 pub fn parse ( self ) -> actual:: Queue {
341341 let Self {
342342 capacity,
343343 capacity_per_user,
344- transaction_time_to_live,
345- future_threshold,
344+ transaction_time_to_live_ms : transaction_time_to_live,
345+ future_threshold_ms : future_threshold,
346346 } = self ;
347347 actual:: Queue {
348348 capacity,
@@ -374,17 +374,17 @@ pub struct Telemetry {
374374 name : String ,
375375 url : Url ,
376376 #[ serde( default ) ]
377- min_retry_period : TelemetryMinRetryPeriod ,
377+ min_retry_period_ms : TelemetryMinRetryPeriod ,
378378 #[ serde( default ) ]
379379 max_retry_delay_exponent : TelemetryMaxRetryDelayExponent ,
380380}
381381
382382#[ derive( Deserialize , Debug , Copy , Clone ) ]
383- struct TelemetryMinRetryPeriod ( HumanDuration ) ;
383+ struct TelemetryMinRetryPeriod ( DurationMs ) ;
384384
385385impl Default for TelemetryMinRetryPeriod {
386386 fn default ( ) -> Self {
387- Self ( HumanDuration ( defaults:: telemetry:: MIN_RETRY_PERIOD ) )
387+ Self ( DurationMs ( defaults:: telemetry:: MIN_RETRY_PERIOD ) )
388388 }
389389}
390390
@@ -402,7 +402,7 @@ impl From<Telemetry> for actual::Telemetry {
402402 Telemetry {
403403 name,
404404 url,
405- min_retry_period : TelemetryMinRetryPeriod ( HumanDuration ( min_retry_period) ) ,
405+ min_retry_period_ms : TelemetryMinRetryPeriod ( DurationMs ( min_retry_period) ) ,
406406 max_retry_delay_exponent : TelemetryMaxRetryDelayExponent ( max_retry_delay_exponent) ,
407407 } : Telemetry ,
408408 ) -> Self {
@@ -425,7 +425,7 @@ pub struct Snapshot {
425425 #[ config( default , env = "SNAPSHOT_MODE" ) ]
426426 pub mode : SnapshotMode ,
427427 #[ config( default = "defaults::snapshot::CREATE_EVERY.into()" ) ]
428- pub create_every : HumanDuration ,
428+ pub create_every_ms : DurationMs ,
429429 #[ config(
430430 default = "PathBuf::from(defaults::snapshot::STORE_DIR)" ,
431431 env = "SNAPSHOT_STORE_DIR"
@@ -439,9 +439,9 @@ pub struct ChainWide {
439439 #[ config( default = "defaults::chain_wide::MAX_TXS" ) ]
440440 pub max_transactions_in_block : NonZeroU32 ,
441441 #[ config( default = "defaults::chain_wide::BLOCK_TIME.into()" ) ]
442- pub block_time : HumanDuration ,
442+ pub block_time_ms : DurationMs ,
443443 #[ config( default = "defaults::chain_wide::COMMIT_TIME.into()" ) ]
444- pub commit_time : HumanDuration ,
444+ pub commit_time_ms : DurationMs ,
445445 #[ config( default = "defaults::chain_wide::TRANSACTION_LIMITS" ) ]
446446 pub transaction_limits : TransactionLimits ,
447447 #[ config( default = "defaults::chain_wide::METADATA_LIMITS" ) ]
@@ -458,20 +458,20 @@ pub struct ChainWide {
458458 pub ident_length_limits : LengthLimits ,
459459 #[ config( default = "defaults::chain_wide::WASM_FUEL_LIMIT" ) ]
460460 pub executor_fuel_limit : u64 ,
461- #[ config( default = "defaults::chain_wide::WASM_MAX_MEMORY_BYTES " ) ]
462- pub executor_max_memory : u32 ,
461+ #[ config( default = "defaults::chain_wide::WASM_MAX_MEMORY " ) ]
462+ pub executor_max_memory : Bytes < u32 > ,
463463 #[ config( default = "defaults::chain_wide::WASM_FUEL_LIMIT" ) ]
464464 pub wasm_fuel_limit : u64 ,
465- #[ config( default = "defaults::chain_wide::WASM_MAX_MEMORY_BYTES " ) ]
466- pub wasm_max_memory : u32 ,
465+ #[ config( default = "defaults::chain_wide::WASM_MAX_MEMORY " ) ]
466+ pub wasm_max_memory : Bytes < u32 > ,
467467}
468468
469469impl ChainWide {
470470 fn parse ( self ) -> actual:: ChainWide {
471471 let Self {
472472 max_transactions_in_block,
473- block_time,
474- commit_time,
473+ block_time_ms : DurationMs ( block_time) ,
474+ commit_time_ms : DurationMs ( commit_time) ,
475475 transaction_limits,
476476 asset_metadata_limits,
477477 trigger_metadata_limits,
@@ -487,8 +487,8 @@ impl ChainWide {
487487
488488 actual:: ChainWide {
489489 max_transactions_in_block,
490- block_time : block_time . get ( ) ,
491- commit_time : commit_time . get ( ) ,
490+ block_time,
491+ commit_time,
492492 transaction_limits,
493493 asset_metadata_limits,
494494 trigger_metadata_limits,
@@ -498,11 +498,11 @@ impl ChainWide {
498498 ident_length_limits,
499499 executor_runtime : actual:: WasmRuntime {
500500 fuel_limit : executor_fuel_limit,
501- max_memory_bytes : executor_max_memory,
501+ max_memory : executor_max_memory,
502502 } ,
503503 wasm_runtime : actual:: WasmRuntime {
504504 fuel_limit : wasm_fuel_limit,
505- max_memory_bytes : wasm_max_memory,
505+ max_memory : wasm_max_memory,
506506 } ,
507507 }
508508 }
@@ -512,21 +512,21 @@ impl ChainWide {
512512pub struct Torii {
513513 #[ config( env = "API_ADDRESS" ) ]
514514 pub address : WithOrigin < SocketAddr > ,
515- #[ config( default = "defaults::torii::MAX_CONTENT_LENGTH.into() " ) ]
516- pub max_content_length : HumanBytes < u64 > ,
515+ #[ config( default = "defaults::torii::MAX_CONTENT_LEN " ) ]
516+ pub max_content_len : Bytes < u64 > ,
517517 #[ config( default = "defaults::torii::QUERY_IDLE_TIME.into()" ) ]
518- pub query_idle_time : HumanDuration ,
518+ pub query_idle_time_ms : DurationMs ,
519519}
520520
521521impl Torii {
522522 fn parse ( self ) -> ( actual:: Torii , actual:: LiveQueryStore ) {
523523 let torii = actual:: Torii {
524524 address : self . address ,
525- max_content_len_bytes : self . max_content_length . get ( ) ,
525+ max_content_len : self . max_content_len ,
526526 } ;
527527
528528 let query = actual:: LiveQueryStore {
529- idle_time : self . query_idle_time . get ( ) ,
529+ idle_time : self . query_idle_time_ms . get ( ) ,
530530 } ;
531531
532532 ( torii, query)
0 commit comments