updated constants depending on all 30 days expiration
This commit is contained in:
@@ -10,7 +10,7 @@ use nym_config::{
|
||||
must_get_home, read_config_from_toml_file, save_formatted_config_to_file, NymConfigTemplate,
|
||||
DEFAULT_CONFIG_DIR, DEFAULT_CONFIG_FILENAME, DEFAULT_DATA_DIR, NYM_DIR,
|
||||
};
|
||||
use nym_network_defaults::{mainnet, DEFAULT_NYM_NODE_HTTP_PORT};
|
||||
use nym_network_defaults::{mainnet, DEFAULT_NYM_NODE_HTTP_PORT, TICKETBOOK_VALIDITY_DAYS};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::io;
|
||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||
@@ -501,7 +501,7 @@ pub struct ZkNymTicketHandlerDebug {
|
||||
pub minimum_redemption_tickets: usize,
|
||||
|
||||
/// Specifies the maximum time between two subsequent tickets redemptions.
|
||||
/// That's required as nym-apis will purge all ticket information for tickets older than 30 days.
|
||||
/// That's required as nym-apis will purge all ticket information for tickets older than maximum validity.
|
||||
#[serde(with = "humantime_serde")]
|
||||
pub maximum_time_between_redemption: Duration,
|
||||
}
|
||||
@@ -511,7 +511,28 @@ impl ZkNymTicketHandlerDebug {
|
||||
pub const DEFAULT_PENDING_POLLER: Duration = Duration::from_secs(300);
|
||||
pub const DEFAULT_MINIMUM_API_QUORUM: f32 = 0.8;
|
||||
pub const DEFAULT_MINIMUM_REDEMPTION_TICKETS: usize = 100;
|
||||
pub const DEFAULT_MAXIMUM_TIME_BETWEEN_REDEMPTION: Duration = Duration::from_secs(86400 * 25);
|
||||
|
||||
// use min(4/5 of max validity, validity - 1), but making sure it's no greater than 1 day
|
||||
// ASSUMPTION: our validity period is AT LEAST 2 days
|
||||
//
|
||||
// this could have been a constant, but it's more readable as a function
|
||||
pub const fn default_maximum_time_between_redemption() -> Duration {
|
||||
let desired_secs = TICKETBOOK_VALIDITY_DAYS * (86400 * 4) / 5;
|
||||
let desired_secs_alt = (TICKETBOOK_VALIDITY_DAYS - 1) * 86400;
|
||||
|
||||
// can't use `min` in const context
|
||||
let target_secs = if desired_secs < desired_secs_alt {
|
||||
desired_secs
|
||||
} else {
|
||||
desired_secs_alt
|
||||
};
|
||||
|
||||
assert!(
|
||||
target_secs < 86400,
|
||||
"the maximum time between redemption can't be lower than 1 day!"
|
||||
);
|
||||
Duration::from_secs(target_secs as u64)
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ZkNymTicketHandlerDebug {
|
||||
@@ -521,7 +542,7 @@ impl Default for ZkNymTicketHandlerDebug {
|
||||
pending_poller: Self::DEFAULT_PENDING_POLLER,
|
||||
minimum_api_quorum: Self::DEFAULT_MINIMUM_API_QUORUM,
|
||||
minimum_redemption_tickets: Self::DEFAULT_MINIMUM_REDEMPTION_TICKETS,
|
||||
maximum_time_between_redemption: Self::DEFAULT_MAXIMUM_TIME_BETWEEN_REDEMPTION,
|
||||
maximum_time_between_redemption: Self::default_maximum_time_between_redemption(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ pub(crate) struct CredentialHandlerConfig {
|
||||
pub(crate) minimum_redemption_tickets: usize,
|
||||
|
||||
/// Specifies the maximum time between two subsequent tickets redemptions.
|
||||
/// That's required as nym-apis will purge all ticket information for tickets older than 30 days.
|
||||
/// That's required as nym-apis will purge all ticket information for tickets older than maximum validity.
|
||||
pub(crate) maximum_time_between_redemption: Duration,
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ pub(crate) async fn prepare_partial_bloomfilter_builder(
|
||||
.try_load_partial_bloomfilter_bitmap(date, params_id)
|
||||
.await?
|
||||
else {
|
||||
log::warn!("missing double spending bloomfilter bitmap for {date} (if this API hasn't been running for at least 30 days since 'ecash'-based zk-nyms were introduced this is expected)");
|
||||
log::warn!("missing double spending bloomfilter bitmap for {date} (if this API hasn't been running for at least {days} day(s) since 'ecash'-based zk-nyms were introduced this is expected)");
|
||||
continue;
|
||||
};
|
||||
if !filter_builder.add_bytes(&bitmap) {
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::config::helpers::ephemeral_gateway_config;
|
||||
use crate::config::persistence::EntryGatewayPaths;
|
||||
use crate::config::Config;
|
||||
use crate::error::EntryGatewayError;
|
||||
use nym_config::defaults::DEFAULT_CLIENT_LISTENING_PORT;
|
||||
use nym_config::defaults::{DEFAULT_CLIENT_LISTENING_PORT, TICKETBOOK_VALIDITY_DAYS};
|
||||
use nym_config::helpers::inaddr_any;
|
||||
use nym_config::serde_helpers::de_maybe_port;
|
||||
use nym_gateway::node::LocalAuthenticatorOpts;
|
||||
@@ -90,7 +90,7 @@ pub struct ZkNymTicketHandlerDebug {
|
||||
pub minimum_redemption_tickets: usize,
|
||||
|
||||
/// Specifies the maximum time between two subsequent tickets redemptions.
|
||||
/// That's required as nym-apis will purge all ticket information for tickets older than 30 days.
|
||||
/// That's required as nym-apis will purge all ticket information for tickets older than maximum validity.
|
||||
#[serde(with = "humantime_serde")]
|
||||
pub maximum_time_between_redemption: Duration,
|
||||
}
|
||||
@@ -100,7 +100,28 @@ impl ZkNymTicketHandlerDebug {
|
||||
pub const DEFAULT_PENDING_POLLER: Duration = Duration::from_secs(300);
|
||||
pub const DEFAULT_MINIMUM_API_QUORUM: f32 = 0.8;
|
||||
pub const DEFAULT_MINIMUM_REDEMPTION_TICKETS: usize = 100;
|
||||
pub const DEFAULT_MAXIMUM_TIME_BETWEEN_REDEMPTION: Duration = Duration::from_secs(86400 * 25);
|
||||
|
||||
// use min(4/5 of max validity, validity - 1), but making sure it's no greater than 1 day
|
||||
// ASSUMPTION: our validity period is AT LEAST 2 days
|
||||
//
|
||||
// this could have been a constant, but it's more readable as a function
|
||||
pub const fn default_maximum_time_between_redemption() -> Duration {
|
||||
let desired_secs = TICKETBOOK_VALIDITY_DAYS * (86400 * 4) / 5;
|
||||
let desired_secs_alt = (TICKETBOOK_VALIDITY_DAYS - 1) * 86400;
|
||||
|
||||
// can't use `min` in const context
|
||||
let target_secs = if desired_secs < desired_secs_alt {
|
||||
desired_secs
|
||||
} else {
|
||||
desired_secs_alt
|
||||
};
|
||||
|
||||
assert!(
|
||||
target_secs < 86400,
|
||||
"the maximum time between redemption can't be lower than 1 day!"
|
||||
);
|
||||
Duration::from_secs(target_secs as u64)
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ZkNymTicketHandlerDebug {
|
||||
@@ -110,7 +131,7 @@ impl Default for ZkNymTicketHandlerDebug {
|
||||
pending_poller: Self::DEFAULT_PENDING_POLLER,
|
||||
minimum_api_quorum: Self::DEFAULT_MINIMUM_API_QUORUM,
|
||||
minimum_redemption_tickets: Self::DEFAULT_MINIMUM_REDEMPTION_TICKETS,
|
||||
maximum_time_between_redemption: Self::DEFAULT_MAXIMUM_TIME_BETWEEN_REDEMPTION,
|
||||
maximum_time_between_redemption: Self::default_maximum_time_between_redemption(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user