mirror of
https://github.com/logos-messaging/logos-messaging-rust-bindings.git
synced 2026-01-03 22:43:07 +00:00
feat: RLN Relay (#101)
This commit is contained in:
parent
1ed7dd48ed
commit
7a2e4d1d01
9
.github/workflows/main.yml
vendored
9
.github/workflows/main.yml
vendored
@ -27,9 +27,6 @@ jobs:
|
|||||||
submodules: true
|
submodules: true
|
||||||
- name: Checkout submodules
|
- name: Checkout submodules
|
||||||
run: git submodule update --init --recursive
|
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
|
- uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
profile: minimal
|
||||||
@ -59,9 +56,6 @@ jobs:
|
|||||||
submodules: true
|
submodules: true
|
||||||
- name: Checkout submodules
|
- name: Checkout submodules
|
||||||
run: git submodule update --init --recursive
|
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
|
- uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
profile: minimal
|
||||||
@ -86,9 +80,6 @@ jobs:
|
|||||||
submodules: true
|
submodules: true
|
||||||
- name: Checkout submodules
|
- name: Checkout submodules
|
||||||
run: git submodule update --init --recursive
|
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
|
- uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
profile: minimal
|
||||||
|
|||||||
@ -13,7 +13,7 @@ use rln;
|
|||||||
|
|
||||||
pub use node::{
|
pub use node::{
|
||||||
waku_create_content_topic, waku_destroy, waku_new, Event, Initialized, Key, Multiaddr,
|
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::{
|
pub use general::{
|
||||||
|
|||||||
@ -20,10 +20,54 @@ pub struct WakuNodeConfig {
|
|||||||
/// Secp256k1 private key in Hex format (`0x123...abc`). Default random
|
/// Secp256k1 private key in Hex format (`0x123...abc`). Default random
|
||||||
#[serde(with = "secret_key_serde", rename = "key")]
|
#[serde(with = "secret_key_serde", rename = "key")]
|
||||||
pub node_key: Option<SecretKey>,
|
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`
|
/// Enable relay protocol. Default `true`
|
||||||
#[default(Some(true))]
|
#[default(Some(true))]
|
||||||
pub relay: Option<bool>,
|
pub relay: Option<bool>,
|
||||||
pub relay_topics: Vec<String>,
|
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 {
|
mod secret_key_serde {
|
||||||
|
|||||||
@ -17,6 +17,7 @@ use std::time::Duration;
|
|||||||
use crate::general::{MessageHash, Result, WakuMessage};
|
use crate::general::{MessageHash, Result, WakuMessage};
|
||||||
use context::WakuNodeContext;
|
use context::WakuNodeContext;
|
||||||
|
|
||||||
|
pub use config::RLNConfig;
|
||||||
pub use config::WakuNodeConfig;
|
pub use config::WakuNodeConfig;
|
||||||
pub use events::{Event, WakuMessageEvent};
|
pub use events::{Event, WakuMessageEvent};
|
||||||
pub use relay::waku_create_content_topic;
|
pub use relay::waku_create_content_topic;
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit 7ef1293bc3f94660da0c80f2e2ea052ef6600742
|
Subproject commit 964d7ab7dc3dc38c9a05087b998a0cc7a1475cc0
|
||||||
Loading…
x
Reference in New Issue
Block a user