feat: RLN Relay (#101)

This commit is contained in:
richΛrd 2024-04-01 15:15:50 -04:00 committed by GitHub
parent 1ed7dd48ed
commit 7a2e4d1d01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 47 additions and 11 deletions

View File

@ -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
@ -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
@ -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

View File

@ -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::{

View File

@ -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)]
#[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 {

View File

@ -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;

@ -1 +1 @@
Subproject commit 7ef1293bc3f94660da0c80f2e2ea052ef6600742
Subproject commit 964d7ab7dc3dc38c9a05087b998a0cc7a1475cc0