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

feat: RLN Relay #101

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ jobs:
submodules: true
- name: Checkout submodules
run: git submodule update --init --recursive
- uses: actions/setup-go@v3 # we need go to build go-waku
with:
go-version: '1.20'
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand Down Expand Up @@ -59,9 +56,6 @@ jobs:
submodules: true
- name: Checkout submodules
run: git submodule update --init --recursive
- uses: actions/setup-go@v3 # we need go to build go-waku
with:
go-version: '1.20'
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -86,9 +80,6 @@ jobs:
submodules: true
- name: Checkout submodules
run: git submodule update --init --recursive
- uses: actions/setup-go@v3 # we need go to build go-waku
with:
go-version: '1.20'
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand Down
2 changes: 1 addition & 1 deletion waku-bindings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use rln;

pub use node::{
waku_create_content_topic, waku_destroy, waku_new, Event, Initialized, Key, Multiaddr,
PublicKey, Running, SecretKey, WakuMessageEvent, WakuNodeConfig, WakuNodeHandle,
PublicKey, RLNConfig, Running, SecretKey, WakuMessageEvent, WakuNodeConfig, WakuNodeHandle,
};

pub use general::{
Expand Down
44 changes: 44 additions & 0 deletions waku-bindings/src/node/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,54 @@ pub struct WakuNodeConfig {
/// Secp256k1 private key in Hex format (`0x123...abc`). Default random
#[serde(with = "secret_key_serde", rename = "key")]
pub node_key: Option<SecretKey>,
/// Cluster id that the node is running in
#[default(Some(0))]
pub cluster_id: Option<usize>,
/// Enable relay protocol. Default `true`
#[default(Some(true))]
pub relay: Option<bool>,
pub relay_topics: Vec<String>,
/// RLN configuration
#[serde(skip_serializing_if = "Option::is_none")]
pub rln_relay: Option<RLNConfig>,
}

/// RLN Relay configuration
#[derive(Clone, SmartDefault, Serialize, Deserialize, Debug)]
Copy link

Choose a reason for hiding this comment

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

Default value for RLN conf don't really make sense IMO. We may want to force the user to input a config instead by not impl. any default for it.

#[serde(rename_all = "kebab-case")]
pub struct RLNConfig {
/// Indicates if RLN support will be enabled.
pub enabled: bool,
/// Index of the onchain commitment to use
#[serde(skip_serializing_if = "Option::is_none", rename = "membership-index")]
pub membership_index: Option<usize>,
/// On-chain dynamic group management
#[serde(skip_serializing_if = "Option::is_none")]
pub dynamic: Option<bool>,
/// Path to the RLN merkle tree sled db (https://github.com/spacejam/sled)
#[serde(skip_serializing_if = "Option::is_none")]
pub tree_path: Option<String>,
/// Message rate in bytes/sec after which verification of proofs should happen
#[serde(skip_serializing_if = "Option::is_none")]
pub bandwidth_threshold: Option<usize>,
/// Path for persisting rln-relay credential
#[serde(skip_serializing_if = "Option::is_none")]
pub cred_path: Option<String>,
/// HTTP address of an Ethereum testnet client e.g., http://localhost:8540/
#[serde(skip_serializing_if = "Option::is_none")]
pub eth_client_address: Option<String>,
/// Address of membership contract on an Ethereum testnet
#[serde(skip_serializing_if = "Option::is_none")]
pub eth_contract_address: Option<String>,
/// Password for encrypting RLN credentials
#[serde(skip_serializing_if = "Option::is_none")]
pub cred_password: Option<String>,
/// Set a user message limit for the rln membership registration
#[serde(skip_serializing_if = "Option::is_none")]
pub user_message_limit: Option<u64>,
/// Epoch size in seconds used to rate limit RLN memberships
#[serde(skip_serializing_if = "Option::is_none")]
pub epoch_sec: Option<u64>,
}

mod secret_key_serde {
Expand Down
1 change: 1 addition & 0 deletions waku-bindings/src/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use std::time::Duration;
use crate::general::{MessageHash, Result, WakuMessage};
use context::WakuNodeContext;

pub use config::RLNConfig;
pub use config::WakuNodeConfig;
pub use events::{Event, WakuMessageEvent};
pub use relay::waku_create_content_topic;
Expand Down
2 changes: 1 addition & 1 deletion waku-sys/vendor
Submodule vendor updated 378 files
Loading