diff --git a/nodes/nomos-node/src/bridges/waku.rs b/nodes/nomos-node/src/bridges/waku.rs index af740d79..e1b9b599 100644 --- a/nodes/nomos-node/src/bridges/waku.rs +++ b/nodes/nomos-node/src/bridges/waku.rs @@ -70,7 +70,9 @@ pub(super) async fn waku_send_transaction( payload, WAKU_CARNOT_TX_CONTENT_TOPIC.clone(), 1, - chrono::Utc::now().timestamp_nanos() as usize, + chrono::Utc::now() + .timestamp_nanos_opt() + .expect("timestamp should be in valid range") as usize, [], false, ), diff --git a/nomos-services/consensus/src/network/adapters/mock.rs b/nomos-services/consensus/src/network/adapters/mock.rs index 2ff75c2f..9bb56b46 100644 --- a/nomos-services/consensus/src/network/adapters/mock.rs +++ b/nomos-services/consensus/src/network/adapters/mock.rs @@ -131,7 +131,9 @@ impl NetworkAdapter for MockAdapter { String::from_utf8_lossy(&message.as_bytes()).to_string(), MOCK_APPROVAL_CONTENT_TOPIC, 1, - chrono::Utc::now().timestamp_nanos() as usize, + chrono::Utc::now() + .timestamp_nanos_opt() + .expect("timestamp should be in valid range") as usize, ); if let Err((e, _e)) = self .network_relay diff --git a/nomos-services/consensus/src/network/adapters/waku.rs b/nomos-services/consensus/src/network/adapters/waku.rs index bc75e945..31987221 100644 --- a/nomos-services/consensus/src/network/adapters/waku.rs +++ b/nomos-services/consensus/src/network/adapters/waku.rs @@ -134,7 +134,9 @@ impl WakuAdapter { payload, content_topic, 1, - chrono::Utc::now().timestamp_nanos() as usize, + chrono::Utc::now() + .timestamp_nanos_opt() + .expect("timestamp should be in valid range") as usize, [], false, ); diff --git a/nomos-services/network/src/backends/mock.rs b/nomos-services/network/src/backends/mock.rs index 4189cb60..42e1ff47 100644 --- a/nomos-services/network/src/backends/mock.rs +++ b/nomos-services/network/src/backends/mock.rs @@ -359,7 +359,10 @@ mod tests { content_topic_name: "foo content".into(), }, version: 1, - timestamp: chrono::Utc::now().timestamp_nanos() as usize, + timestamp: chrono::Utc::now() + .timestamp_nanos_opt() + .expect("timestamp should be in valid range") + as usize, }, }) .await; @@ -376,7 +379,10 @@ mod tests { content_topic_name: "bar content".into(), }, version: 1, - timestamp: chrono::Utc::now().timestamp_nanos() as usize, + timestamp: chrono::Utc::now() + .timestamp_nanos_opt() + .expect("timestamp should be in valid range") + as usize, }, }) .await;