de-mls 2.1.0

Decentralized MLS — end-to-end encrypted group messaging with consensus-based membership management over gossipsub-like networks
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
//! Integration tests for `process_inbound` and `dispatch_result`.

use std::sync::{Arc, Mutex};

use async_trait::async_trait;
use prost::Message;

use de_mls::core::{
    CoreError, DefaultProvider, DispatchAction, GroupEventHandler, GroupHandle, ProcessResult,
    build_key_package_message, build_message, create_batch_proposals, create_group,
    dispatch_result, prepare_to_join, process_inbound,
};
use de_mls::ds::{APP_MSG_SUBTOPIC, OutboundPacket, WELCOME_SUBTOPIC};
use de_mls::mls_crypto::{MemoryDeMlsStorage, MlsService, parse_wallet_address};
use de_mls::protos::de_mls::messages::v1::{
    AppMessage, BatchProposalsMessage, ConversationMessage, GroupUpdateRequest, app_message,
};

// ─────────────────────────── Mock Handler ───────────────────────────

#[derive(Debug, Clone)]
#[allow(dead_code)]
enum Event {
    Outbound {
        group: String,
        packet: OutboundPacket,
    },
    AppMessage {
        group: String,
        msg: AppMessage,
    },
    LeaveGroup {
        group: String,
    },
    JoinedGroup {
        group: String,
    },
    Error {
        group: String,
        op: String,
        err: String,
    },
}

#[derive(Clone)]
struct MockHandler {
    events: Arc<Mutex<Vec<Event>>>,
}

impl MockHandler {
    fn new() -> Self {
        Self {
            events: Arc::new(Mutex::new(Vec::new())),
        }
    }

    fn events(&self) -> Vec<Event> {
        self.events.lock().unwrap().clone()
    }
}

#[async_trait]
impl GroupEventHandler for MockHandler {
    async fn on_outbound(
        &self,
        group_name: &str,
        packet: OutboundPacket,
    ) -> Result<String, CoreError> {
        self.events.lock().unwrap().push(Event::Outbound {
            group: group_name.to_string(),
            packet,
        });
        Ok("mock-id".to_string())
    }

    async fn on_app_message(&self, group_name: &str, message: AppMessage) -> Result<(), CoreError> {
        self.events.lock().unwrap().push(Event::AppMessage {
            group: group_name.to_string(),
            msg: message,
        });
        Ok(())
    }

    async fn on_leave_group(&self, group_name: &str) -> Result<(), CoreError> {
        self.events.lock().unwrap().push(Event::LeaveGroup {
            group: group_name.to_string(),
        });
        Ok(())
    }

    async fn on_joined_group(&self, group_name: &str) -> Result<(), CoreError> {
        self.events.lock().unwrap().push(Event::JoinedGroup {
            group: group_name.to_string(),
        });
        Ok(())
    }

    async fn on_error(&self, group_name: &str, operation: &str, error: &str) {
        self.events.lock().unwrap().push(Event::Error {
            group: group_name.to_string(),
            op: operation.to_string(),
            err: error.to_string(),
        });
    }
}

// ─────────────────────────── Helpers ───────────────────────────

fn setup_mls(wallet_hex: &str) -> MlsService<MemoryDeMlsStorage> {
    let storage = MemoryDeMlsStorage::new();
    let mls = MlsService::new(storage);
    let wallet = parse_wallet_address(wallet_hex).unwrap();
    mls.init(wallet).unwrap();
    mls
}

/// Create group as steward, return (mls, handle).
fn setup_steward(
    group_name: &str,
    wallet_hex: &str,
) -> (MlsService<MemoryDeMlsStorage>, GroupHandle) {
    let mls = setup_mls(wallet_hex);
    let handle = create_group(group_name, &mls).unwrap();
    (mls, handle)
}

/// Prepare a joiner: create MlsService, prepare handle, build key-package packet.
fn setup_joiner(
    group_name: &str,
    wallet_hex: &str,
) -> (MlsService<MemoryDeMlsStorage>, GroupHandle, OutboundPacket) {
    let mls = setup_mls(wallet_hex);
    let handle = prepare_to_join(group_name);
    let kp_packet = build_key_package_message(&handle, &mls).unwrap();
    (mls, handle, kp_packet)
}

// Full join flow: steward adds joiner, returns welcome packet for joiner.
fn steward_add_joiner(
    steward_mls: &MlsService<MemoryDeMlsStorage>,
    steward_handle: &mut GroupHandle,
    joiner_kp_packet: &OutboundPacket,
) -> OutboundPacket {
    use std::sync::atomic::{AtomicU32, Ordering};
    static PROPOSAL_COUNTER: AtomicU32 = AtomicU32::new(1);

    // 1. Steward processes key package → GetUpdateRequest
    let result = process_inbound(
        steward_handle,
        &joiner_kp_packet.payload,
        WELCOME_SUBTOPIC,
        steward_mls,
    )
    .unwrap();

    let gur = match result {
        ProcessResult::GetUpdateRequest(gur) => gur,
        other => panic!("Expected GetUpdateRequest, got {:?}", other),
    };

    // 2. Insert as approved (skip voting in tests) and create batch
    let proposal_id = PROPOSAL_COUNTER.fetch_add(1, Ordering::Relaxed);
    steward_handle.insert_approved_proposal(proposal_id, gur);
    let packets = create_batch_proposals(steward_handle, steward_mls).unwrap();

    // Find the welcome packet
    packets
        .into_iter()
        .find(|p| p.subtopic == WELCOME_SUBTOPIC)
        .expect("Expected a welcome packet from create_batch_proposals")
}

// ─────────────────────────── process_inbound tests ───────────────────────────

#[test]
fn test_process_inbound_invalid_subtopic() {
    let (mls, mut handle) =
        setup_steward("test-group", "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");

    let result = process_inbound(&mut handle, b"some payload", "invalid", &mls);
    assert!(result.is_err());
    match result.unwrap_err() {
        CoreError::InvalidSubtopic(s) => assert_eq!(s, "invalid"),
        e => panic!("Expected InvalidSubtopic, got {:?}", e),
    }
}

#[test]
fn test_process_inbound_app_msg_before_mls_init() {
    let mls = setup_mls("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
    let mut handle = prepare_to_join("test-group");

    // handle.is_mls_initialized() == false
    let result = process_inbound(&mut handle, b"some payload", APP_MSG_SUBTOPIC, &mls).unwrap();
    assert!(matches!(result, ProcessResult::Noop));
}

#[test]
fn test_process_inbound_conversation_message_roundtrip() {
    let group_name = "roundtrip-group";

    // Steward creates group
    let (steward_mls, mut steward_handle) =
        setup_steward(group_name, "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");

    // Joiner prepares
    let (joiner_mls, mut joiner_handle, kp_packet) =
        setup_joiner(group_name, "0x70997970C51812dc3A010C7d01b50e0d17dc79C8");

    // Steward adds joiner
    let welcome_packet = steward_add_joiner(&steward_mls, &mut steward_handle, &kp_packet);

    // Joiner processes welcome → JoinedGroup
    let join_result = process_inbound(
        &mut joiner_handle,
        &welcome_packet.payload,
        WELCOME_SUBTOPIC,
        &joiner_mls,
    )
    .unwrap();
    assert!(
        matches!(join_result, ProcessResult::JoinedGroup(_)),
        "Expected JoinedGroup, got {:?}",
        join_result
    );

    // Steward encrypts a conversation message
    let conv = ConversationMessage {
        message: b"Hello from steward!".to_vec(),
        sender: "steward".to_string(),
        group_name: group_name.to_string(),
    };
    let app_msg: AppMessage = conv.into();
    let outbound = build_message(&steward_handle, &steward_mls, &app_msg).unwrap();

    // Joiner decrypts
    let result = process_inbound(
        &mut joiner_handle,
        &outbound.payload,
        APP_MSG_SUBTOPIC,
        &joiner_mls,
    )
    .unwrap();

    match result {
        ProcessResult::AppMessage(msg) => {
            let payload = msg.payload.expect("Expected payload");
            match payload {
                app_message::Payload::ConversationMessage(cm) => {
                    assert_eq!(cm.message, b"Hello from steward!");
                    assert_eq!(cm.sender, "steward");
                }
                _ => panic!("Expected ConversationMessage payload"),
            }
        }
        other => panic!("Expected AppMessage, got {:?}", other),
    }
}

#[test]
fn test_process_inbound_welcome_steward_receives_key_package() {
    let group_name = "steward-kp-group";

    let (_steward_mls, mut steward_handle) =
        setup_steward(group_name, "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
    let (_joiner_mls, _joiner_handle, kp_packet) =
        setup_joiner(group_name, "0x70997970C51812dc3A010C7d01b50e0d17dc79C8");

    let result = process_inbound(
        &mut steward_handle,
        &kp_packet.payload,
        WELCOME_SUBTOPIC,
        &_steward_mls,
    )
    .unwrap();

    match result {
        ProcessResult::GetUpdateRequest(gur) => {
            assert!(gur.payload.is_some(), "Expected InviteMember payload");
        }
        other => panic!("Expected GetUpdateRequest, got {:?}", other),
    }
}

#[test]
fn test_process_inbound_welcome_non_steward_ignores_key_package() {
    let group_name = "non-steward-kp";

    // Create a non-steward handle (just prepare_to_join but with mls_initialized)
    let mls = setup_mls("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
    let mut handle = prepare_to_join(group_name);
    // handle is not steward

    let (_joiner_mls, _joiner_handle, kp_packet) =
        setup_joiner(group_name, "0x70997970C51812dc3A010C7d01b50e0d17dc79C8");

    let result = process_inbound(&mut handle, &kp_packet.payload, WELCOME_SUBTOPIC, &mls).unwrap();

    assert!(
        matches!(result, ProcessResult::Noop),
        "Expected Noop, got {:?}",
        result
    );
}

#[test]
fn test_process_inbound_welcome_invitation_joins_group() {
    let group_name = "join-group";

    let (steward_mls, mut steward_handle) =
        setup_steward(group_name, "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
    let (joiner_mls, mut joiner_handle, kp_packet) =
        setup_joiner(group_name, "0x70997970C51812dc3A010C7d01b50e0d17dc79C8");

    let welcome_packet = steward_add_joiner(&steward_mls, &mut steward_handle, &kp_packet);

    let result = process_inbound(
        &mut joiner_handle,
        &welcome_packet.payload,
        WELCOME_SUBTOPIC,
        &joiner_mls,
    )
    .unwrap();

    match result {
        ProcessResult::JoinedGroup(name) => {
            assert_eq!(name, group_name);
            assert!(joiner_handle.is_mls_initialized());
        }
        other => panic!("Expected JoinedGroup, got {:?}", other),
    }
}

#[test]
fn test_process_inbound_welcome_already_joined_ignores() {
    let group_name = "already-joined";

    let (steward_mls, mut steward_handle) =
        setup_steward(group_name, "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
    let (joiner_mls, mut joiner_handle, kp_packet) =
        setup_joiner(group_name, "0x70997970C51812dc3A010C7d01b50e0d17dc79C8");

    // Join first
    let welcome_packet = steward_add_joiner(&steward_mls, &mut steward_handle, &kp_packet);
    let result = process_inbound(
        &mut joiner_handle,
        &welcome_packet.payload,
        WELCOME_SUBTOPIC,
        &joiner_mls,
    )
    .unwrap();
    assert!(matches!(result, ProcessResult::JoinedGroup(_)));

    // Now generate a second joiner key package & welcome to send to the already-joined user
    let (_joiner2_mls, _joiner2_handle, kp2_packet) =
        setup_joiner(group_name, "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC");
    let welcome_packet2 = steward_add_joiner(&steward_mls, &mut steward_handle, &kp2_packet);

    // The already-joined handle receives invitation → Noop
    let result2 = process_inbound(
        &mut joiner_handle,
        &welcome_packet2.payload,
        WELCOME_SUBTOPIC,
        &joiner_mls,
    )
    .unwrap();
    assert!(
        matches!(result2, ProcessResult::Noop),
        "Expected Noop for already joined, got {:?}",
        result2
    );
}

#[test]
fn test_process_inbound_leave_group() {
    let group_name = "leave-group";

    let (steward_mls, mut steward_handle) =
        setup_steward(group_name, "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
    let (joiner_mls, mut joiner_handle, kp_packet) =
        setup_joiner(group_name, "0x70997970C51812dc3A010C7d01b50e0d17dc79C8");

    // Join the group
    let welcome_packet = steward_add_joiner(&steward_mls, &mut steward_handle, &kp_packet);
    let result = process_inbound(
        &mut joiner_handle,
        &welcome_packet.payload,
        WELCOME_SUBTOPIC,
        &joiner_mls,
    )
    .unwrap();
    assert!(matches!(result, ProcessResult::JoinedGroup(_)));

    // Steward removes joiner via proposal + commit
    let joiner_wallet = parse_wallet_address("0x70997970C51812dc3A010C7d01b50e0d17dc79C8").unwrap();
    let remove_req = GroupUpdateRequest {
        payload: Some(
            de_mls::protos::de_mls::messages::v1::group_update_request::Payload::RemoveMember(
                de_mls::protos::de_mls::messages::v1::RemoveMember {
                    identity: joiner_wallet.as_slice().to_vec(),
                },
            ),
        ),
    };
    steward_handle.insert_approved_proposal(2, remove_req);
    let packets = create_batch_proposals(&mut steward_handle, &steward_mls).unwrap();

    // Find the batch proposals packet (app subtopic)
    let batch_packet = packets
        .iter()
        .find(|p| p.subtopic == APP_MSG_SUBTOPIC)
        .expect("Expected batch proposals packet");

    // Joiner processes the batch → first needs to have matching approved proposals
    // Since joiner has no approved proposals, the batch_proposals check will fail.
    // The batch goes through as an AppMessage containing BatchProposalsMessage.
    // With no matching proposals, this returns Noop.
    // Instead, let's process the MLS proposals and commit directly.
    // We need to extract them from the BatchProposalsMessage.
    let app_msg = AppMessage::decode(batch_packet.payload.as_slice()).unwrap();
    let batch = match app_msg.payload {
        Some(app_message::Payload::BatchProposalsMessage(b)) => b,
        _ => panic!("Expected BatchProposalsMessage"),
    };

    // Process each proposal
    for proposal_bytes in &batch.mls_proposals {
        let _r = joiner_mls.decrypt(group_name, proposal_bytes).unwrap();
    }

    // Process the commit
    let remove_result = process_inbound(
        &mut joiner_handle,
        &batch.commit_message,
        APP_MSG_SUBTOPIC,
        &joiner_mls,
    )
    .unwrap();

    assert!(
        matches!(remove_result, ProcessResult::LeaveGroup),
        "Expected LeaveGroup, got {:?}",
        remove_result
    );
}

#[test]
fn test_process_inbound_batch_proposals_proposal_set_mismatch() {
    let group_name = "batch-mismatch";

    let (steward_mls, mut steward_handle) =
        setup_steward(group_name, "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
    let (joiner_mls, mut joiner_handle, kp_packet) =
        setup_joiner(group_name, "0x70997970C51812dc3A010C7d01b50e0d17dc79C8");

    // Join the group
    let welcome_packet = steward_add_joiner(&steward_mls, &mut steward_handle, &kp_packet);
    let join_result = process_inbound(
        &mut joiner_handle,
        &welcome_packet.payload,
        WELCOME_SUBTOPIC,
        &joiner_mls,
    )
    .unwrap();
    assert!(matches!(join_result, ProcessResult::JoinedGroup(_)));

    // Create a batch proposals message with proposal IDs that don't match
    let batch_msg = BatchProposalsMessage {
        group_name: group_name.as_bytes().to_vec(),
        mls_proposals: vec![],
        commit_message: vec![],
        proposal_ids: vec![99, 100], // IDs joiner doesn't have
        proposals_digest: vec![],
    };
    let app_msg: AppMessage = batch_msg.into();
    let payload = app_msg.encode_to_vec();

    let result =
        process_inbound(&mut joiner_handle, &payload, APP_MSG_SUBTOPIC, &joiner_mls).unwrap();

    assert!(
        matches!(result, ProcessResult::Noop),
        "Expected Noop for mismatched proposals, got {:?}",
        result
    );
}

// ─────────────────────────── dispatch_result tests ───────────────────────────

// Mock consensus service for dispatch_result tests.
// dispatch_result only uses consensus for Proposal/Vote variants, which we don't test here.
use hashgraph_like_consensus::{
    events::BroadcastEventBus, service::ConsensusService, storage::InMemoryConsensusStorage,
};

type TestConsensus =
    ConsensusService<String, InMemoryConsensusStorage<String>, BroadcastEventBus<String>>;

fn make_consensus() -> TestConsensus {
    let storage = InMemoryConsensusStorage::new();
    let event_bus = BroadcastEventBus::default();
    TestConsensus::new_with_components(storage, event_bus, 10)
}

#[tokio::test]
async fn test_dispatch_app_message_calls_handler() {
    let group_name = "dispatch-app";
    let (mls, handle) = setup_steward(group_name, "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
    let handler = MockHandler::new();
    let consensus = make_consensus();

    let conv = ConversationMessage {
        message: b"test message".to_vec(),
        sender: "alice".to_string(),
        group_name: group_name.to_string(),
    };
    let app_msg: AppMessage = conv.into();
    let result = ProcessResult::AppMessage(app_msg.clone());

    let action = dispatch_result::<DefaultProvider, _>(
        &handle, group_name, result, &consensus, &handler, &mls,
    )
    .await
    .unwrap();

    assert!(matches!(action, DispatchAction::Done));

    let events = handler.events();
    assert_eq!(events.len(), 1);
    assert!(matches!(&events[0], Event::AppMessage { group, .. } if group == group_name));
}

#[tokio::test]
async fn test_dispatch_leave_group() {
    let group_name = "dispatch-leave";
    let (mls, handle) = setup_steward(group_name, "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
    let handler = MockHandler::new();
    let consensus = make_consensus();

    let action = dispatch_result::<DefaultProvider, _>(
        &handle,
        group_name,
        ProcessResult::LeaveGroup,
        &consensus,
        &handler,
        &mls,
    )
    .await
    .unwrap();

    assert!(matches!(action, DispatchAction::LeaveGroup));
    assert!(handler.events().is_empty());
}

#[tokio::test]
async fn test_dispatch_get_update_request() {
    let group_name = "dispatch-gur";
    let (mls, handle) = setup_steward(group_name, "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
    let handler = MockHandler::new();
    let consensus = make_consensus();

    let gur = GroupUpdateRequest {
        payload: Some(
            de_mls::protos::de_mls::messages::v1::group_update_request::Payload::InviteMember(
                de_mls::protos::de_mls::messages::v1::InviteMember {
                    key_package_bytes: vec![1, 2, 3],
                    identity: vec![4, 5, 6],
                },
            ),
        ),
    };

    let action = dispatch_result::<DefaultProvider, _>(
        &handle,
        group_name,
        ProcessResult::GetUpdateRequest(gur),
        &consensus,
        &handler,
        &mls,
    )
    .await
    .unwrap();

    match action {
        DispatchAction::StartVoting(_req) => {}
        other => panic!("Expected StartVoting, got {:?}", other),
    }
}

#[tokio::test]
async fn test_dispatch_joined_group() {
    let group_name = "dispatch-joined";
    let (mls, handle) = setup_steward(group_name, "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
    let handler = MockHandler::new();
    let consensus = make_consensus();

    let action = dispatch_result::<DefaultProvider, _>(
        &handle,
        group_name,
        ProcessResult::JoinedGroup(group_name.to_string()),
        &consensus,
        &handler,
        &mls,
    )
    .await
    .unwrap();

    assert!(matches!(action, DispatchAction::JoinedGroup));

    let events = handler.events();
    assert_eq!(events.len(), 2);
    assert!(matches!(&events[0], Event::Outbound { group, .. } if group == group_name));
    assert!(matches!(&events[1], Event::JoinedGroup { group } if group == group_name));
}

#[tokio::test]
async fn test_dispatch_group_updated() {
    let group_name = "dispatch-updated";
    let (mls, handle) = setup_steward(group_name, "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
    let handler = MockHandler::new();
    let consensus = make_consensus();

    let action = dispatch_result::<DefaultProvider, _>(
        &handle,
        group_name,
        ProcessResult::GroupUpdated,
        &consensus,
        &handler,
        &mls,
    )
    .await
    .unwrap();

    assert!(matches!(action, DispatchAction::GroupUpdated));
    assert!(handler.events().is_empty());
}

#[tokio::test]
async fn test_dispatch_noop() {
    let group_name = "dispatch-noop";
    let (mls, handle) = setup_steward(group_name, "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
    let handler = MockHandler::new();
    let consensus = make_consensus();

    let action = dispatch_result::<DefaultProvider, _>(
        &handle,
        group_name,
        ProcessResult::Noop,
        &consensus,
        &handler,
        &mls,
    )
    .await
    .unwrap();

    assert!(matches!(action, DispatchAction::Done));
    assert!(handler.events().is_empty());
}