Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tic tac toe example #104

Merged
merged 35 commits into from
Nov 28, 2024
Merged

Tic tac toe example #104

merged 35 commits into from
Nov 28, 2024

Conversation

Ivansete-status
Copy link

Description

This PR adds a complete ui app example (tic tac toe) that interacts with waku nodes.

Special thanks to @richard-ramos and @SionoiS for the paramount help to achieve this complex milestone!

You will notice I'm removing an instance state approach (struct WakuNodeHandle<State: WakuNodeState>) that might sound more Rust-idiomatic. I'm happy to get it back if you consider it appropriate.

examples/Cargo.toml Outdated Show resolved Hide resolved
waku-sys/src/cmd.c Show resolved Hide resolved
waku-bindings/tests/node.rs Outdated Show resolved Hide resolved
waku-bindings/tests/node.rs Outdated Show resolved Hide resolved
waku-bindings/src/node/events.rs Outdated Show resolved Hide resolved
waku-bindings/src/node/events.rs Outdated Show resolved Hide resolved
Ivansete-status and others added 2 commits November 21, 2024 14:27
Co-authored-by: richΛrd <info@richardramos.me>
Co-authored-by: richΛrd <info@richardramos.me>
Copy link
Member

@richard-ramos richard-ramos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the removal of the state pattern for the WakuNodeHandle, did it cause trouble? @SionoiS seems to like it :) #98 (review) and it has the benefit of not allowing you to 're-initialize' a node by mistake.

Copy link

@SionoiS SionoiS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Maybe consider using a channel instead of a closure for handling LibwakuResponse.
Keeping the closure internal and only exposing the receiving end of a channel.

pub fn waku_filter_subscribe(
ctx: &WakuNodeContext,
pubsub_topic: &str,
content_topics: &str, // comma-separated list of content topics
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use a vector of strings to enforce the comment?

same below

pub fn waku_lightpush_publish_message(
ctx: &WakuNodeContext,
message: &WakuMessage,
pubsub_topic: &str,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we use string for topics in nwaku I would discourage this use in rust.

string bad mkay?

Copy link
Author

@Ivansete-status Ivansete-status Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we use string for topics in nwaku I would discourage this use in rust.

string bad mkay?

Sorry but I can't quite follow the suggestion :)

EDITED: Richard clarified it, I'll try that

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a type PubsubTopic and use it everywhere basically.

@codecov-commenter
Copy link

codecov-commenter commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 48.31683% with 261 lines in your changes missing coverage. Please review.

Please upload report for BASE (nwaku@7a2e4d1). Learn more about missing BASE report.

Files with missing lines Patch % Lines
waku-bindings/src/node/filter.rs 0.00% 87 Missing ⚠️
examples/basic/src/main.rs 0.00% 53 Missing ⚠️
waku-bindings/src/node/mod.rs 23.88% 51 Missing ⚠️
waku-bindings/src/node/lightpush.rs 0.00% 36 Missing ⚠️
waku-bindings/src/general/contenttopic.rs 75.00% 18 Missing ⚠️
waku-bindings/tests/node.rs 91.66% 7 Missing ⚠️
waku-bindings/src/node/context.rs 87.17% 5 Missing ⚠️
waku-bindings/src/node/relay.rs 60.00% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             nwaku     #104   +/-   ##
========================================
  Coverage         ?   60.66%           
========================================
  Files            ?       16           
  Lines            ?     1139           
  Branches         ?        0           
========================================
  Hits             ?      691           
  Misses           ?      448           
  Partials         ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Ivansete-status Ivansete-status merged commit fd7e73a into nwaku Nov 28, 2024
4 of 6 checks passed
@Ivansete-status Ivansete-status deleted the tic-tac-toe-example2 branch November 28, 2024 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants