chore: upgrade to V0.36.0 (#123)

This commit is contained in:
Darshan K 2025-11-13 00:12:21 +05:30 committed by GitHub
parent 57505a1c06
commit 4ec20e2ebe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 35 additions and 30 deletions

View File

@ -51,6 +51,7 @@ impl TicTacToeApp<Initialized> {
async fn start(self) -> TicTacToeApp<Running> {
let tx_clone = self.tx.clone();
let game_content_topic = WakuContentTopic::new("waku", "2", "tictactoegame", Encoding::Proto);
let my_closure = move |response| {
if let LibwakuResponse::Success(v) = response {
@ -59,8 +60,11 @@ impl TicTacToeApp<Initialized> {
match event {
WakuEvent::WakuMessage(evt) => {
// println!("WakuMessage event received: {:?}", evt.waku_message);
let message = evt.waku_message;
// Filter: only process messages for our game content topic
if message.content_topic != game_content_topic {
return; // Skip messages from other apps
}
let payload = message.payload.to_vec();
match from_utf8(&payload) {
Ok(msg) => {
@ -254,9 +258,8 @@ impl eframe::App for TicTacToeApp<Running> {
if ui.button("Play as O").clicked() {
self.player_role = Some(Player::O);
if let Ok(mut game_state) = self.game_state.try_lock() {
game_state.current_turn = Player::X; // player X should start
}
// Player O waits for Player X to make the first move
// No need to change current_turn as it's already X
}
return; // Exit early until a role is selected

View File

@ -18,38 +18,38 @@ use crate::node::context::WakuNodeContext;
use multiaddr::Multiaddr;
use serde::{Deserialize, Serialize};
#[derive(Clone, Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct PagingOptions {
pub page_size: usize,
pub cursor: Option<MessageHash>,
pub forward: bool,
}
// #[derive(Clone, Serialize, Deserialize, Debug)]
// #[serde(rename_all = "camelCase")]
// pub struct PagingOptions {
// pub page_size: usize,
// pub cursor: Option<MessageHash>,
// pub forward: bool,
// }
/// Criteria used to retrieve historical messages
#[derive(Clone, Serialize, Debug)]
pub struct StoreQueryRequest {
/// if true, the store-response will include the full message content. If false,
/// the store-response will only include a list of message hashes.
#[serde(rename = "requestId")]
#[serde(rename = "request_id")]
request_id: String,
#[serde(rename = "includeData")]
#[serde(rename = "include_data")]
include_data: bool,
#[serde(rename = "pubsubTopic", skip_serializing_if = "Option::is_none")]
#[serde(rename = "pubsub_topic", skip_serializing_if = "Option::is_none")]
pubsub_topic: Option<PubsubTopic>,
#[serde(rename = "contentTopics")]
#[serde(rename = "content_topics")]
content_topics: Vec<WakuContentTopic>,
#[serde(rename = "timeStart", skip_serializing_if = "Option::is_none")]
#[serde(rename = "time_start", skip_serializing_if = "Option::is_none")]
time_start: Option<u64>,
#[serde(rename = "timeEnd", skip_serializing_if = "Option::is_none")]
#[serde(rename = "time_end", skip_serializing_if = "Option::is_none")]
time_end: Option<u64>,
#[serde(rename = "messageHashes", skip_serializing_if = "Option::is_none")]
#[serde(rename = "message_hashes", skip_serializing_if = "Option::is_none")]
message_hashes: Option<Vec<MessageHash>>,
#[serde(rename = "paginationCursor", skip_serializing_if = "Option::is_none")]
#[serde(rename = "pagination_cursor", skip_serializing_if = "Option::is_none")]
pagination_cursor: Option<MessageHash>, // Message hash (key) from where to start query (exclusive)
#[serde(rename = "paginationForward")]
#[serde(rename = "pagination_forward")]
pagination_forward: bool,
#[serde(rename = "paginationLimit", skip_serializing_if = "Option::is_none")]
#[serde(rename = "pagination_limit", skip_serializing_if = "Option::is_none")]
pagination_limit: Option<u64>,
}

View File

@ -35,7 +35,7 @@ async fn test_echo_messages(
) -> Result<(), String> {
// setting a naïve event handler to avoid appearing ERR messages in logs
node1
.set_event_callback(&|_| {})
.set_event_callback(|_| {})
.expect("set event call back working");
let rx_waku_message: Arc<Mutex<WakuMessage>> = Arc::new(Mutex::new(WakuMessage::default()));
@ -109,18 +109,20 @@ async fn test_echo_messages(
// Wait for the msg to arrive
let rx_waku_message_cloned = rx_waku_message.clone();
for _ in 0..50 {
if let Ok(msg) = rx_waku_message_cloned.lock() {
let message_received = if let Ok(msg) = rx_waku_message_cloned.lock() {
// dbg!("The waku message value is: {:?}", msg);
let payload = msg.payload.to_vec();
let payload_str = from_utf8(&payload).expect("should be valid message");
if payload_str == ECHO_MESSAGE {
node1.stop().await?;
node2.stop().await?;
return Ok(());
}
payload_str == ECHO_MESSAGE
} else {
sleep(Duration::from_millis(100)).await;
false
};
if message_received {
node1.stop().await?;
node2.stop().await?;
return Ok(());
}
sleep(Duration::from_millis(100)).await;
}
let node1 = node1.stop().await?;
@ -129,7 +131,7 @@ async fn test_echo_messages(
node1.waku_destroy().await?;
node2.waku_destroy().await?;
return Err("Unexpected test ending".to_string());
Err("Unexpected test ending".to_string())
}
#[tokio::test]