Skip to content

Commit ca42628

Browse files
committed
feat(rln): update examples to support multi-message-id feature and adjust README instructions
1 parent c960297 commit ca42628

File tree

4 files changed

+36
-4
lines changed

4 files changed

+36
-4
lines changed

rln/Cargo.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ document-features = { version = "0.2.12", optional = true }
6363
criterion = { version = "0.8.0", features = ["html_reports"] }
6464

6565
[features]
66-
default = ["parallel", "pmtree-ft", "multi-message-id"]
66+
default = ["parallel", "pmtree-ft"]
6767
stateless = []
6868
parallel = [
6969
"rayon",
@@ -90,6 +90,16 @@ required-features = ["pmtree-ft"]
9090
name = "poseidon_tree_benchmark"
9191
harness = false
9292

93+
94+
[[example]]
95+
name = "multi_message_id"
96+
path = "examples/multi_message_id.rs"
97+
required-features = ["multi-message-id"]
98+
99+
[[example]]
100+
name = "standard"
101+
path = "examples/standard.rs"
102+
93103
[package.metadata.docs.rs]
94104
all-features = true
95105

rln/examples/Readme.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,23 @@
22

33
This example demonstrates how to use RLN .
44

5-
## Standard rln example
5+
## Standard example with default features
66

77
```bash
88
cd rln/examples
99
cargo run --example standard
1010
```
1111

12-
## Multi-message-id feature enable example
12+
## Standard example with multi-message-id feature enabled for backward compatibility
1313

1414
```bash
1515
cd rln/examples
16-
cargo run --example multi_message_id
16+
cargo run --example standard --features multi-message-id
17+
```
18+
19+
## Example with multi-message-id feature enabled
20+
21+
```bash
22+
cd rln/examples
23+
cargo run --example multi_message_id --features multi-message-id
1724
```

rln/examples/multi_message_id.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg(feature = "multi-message-id")]
2+
13
use std::{
24
fs::File,
35
io::Read,

rln/examples/standard.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ fn main() {
3838
let x = hash_to_field_le(signal).unwrap();
3939

4040
// 8. Create witness input for RLN proof generation
41+
#[cfg(not(feature = "multi-message-id"))]
42+
let witness = RLNWitnessInput::new(
43+
identity_secret,
44+
user_message_limit,
45+
message_id,
46+
path_elements,
47+
identity_path_index,
48+
x,
49+
external_nullifier,
50+
)
51+
.unwrap();
52+
53+
#[cfg(feature = "multi-message-id")]
4154
let witness = RLNWitnessInput::new(
4255
identity_secret,
4356
user_message_limit,

0 commit comments

Comments
 (0)