Skip to content

Commit 41ae161

Browse files
fix e2e
1 parent 30d9c7a commit 41ae161

10 files changed

Lines changed: 69 additions & 48 deletions

smartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/create.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,20 @@ pub fn process_create_multicastgroup(
5858
let mgroup_account = next_account_info(accounts_iter)?;
5959
let globalstate_account = next_account_info(accounts_iter)?;
6060

61-
// Optional: ResourceExtension account for onchain allocation (before payer)
61+
// Optional: ResourceExtension account for onchain allocation
6262
// Account layout WITH ResourceExtension (use_onchain_allocation = true):
63-
// [mgroup, globalstate, multicast_group_block, payer, system]
63+
// [mgroup, globalstate, multicast_group_block, index, payer, system]
6464
// Account layout WITHOUT (legacy, use_onchain_allocation = false):
65-
// [mgroup, globalstate, payer, system]
65+
// [mgroup, globalstate, index, payer, system]
6666
let resource_extension_account = if value.use_onchain_allocation {
6767
Some(next_account_info(accounts_iter)?)
6868
} else {
6969
None
7070
};
7171

72+
let index_account = next_account_info(accounts_iter)?;
7273
let payer_account = next_account_info(accounts_iter)?;
7374
let system_program = next_account_info(accounts_iter)?;
74-
let index_account = next_account_info(accounts_iter)?;
7575

7676
#[cfg(test)]
7777
msg!("process_create_multicastgroup({:?})", value);

smartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/update.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,18 @@ pub fn process_update_multicastgroup(
6363
let multicastgroup_account = next_account_info(accounts_iter)?;
6464
let globalstate_account = next_account_info(accounts_iter)?;
6565

66-
// Optional: ResourceExtension account for onchain allocation (before payer)
66+
// Optional: ResourceExtension account for onchain allocation
6767
// Account layout WITH allocation (use_onchain_allocation = true):
68-
// [mgroup, globalstate, multicast_group_block, payer, system]
68+
// [mgroup, globalstate, multicast_group_block, (opt old_index, new_index), payer, system]
6969
// Account layout WITHOUT (legacy, use_onchain_allocation = false):
70-
// [mgroup, globalstate, payer, system]
70+
// [mgroup, globalstate, (opt old_index, new_index), payer, system]
7171
let resource_extension_account = if value.use_onchain_allocation {
7272
Some(next_account_info(accounts_iter)?)
7373
} else {
7474
None
7575
};
7676

77-
let payer_account = next_account_info(accounts_iter)?;
78-
let system_program = next_account_info(accounts_iter)?;
79-
80-
// Optional: Index accounts for code rename
81-
// Account layout when code changes:
82-
// [..., payer, system, old_index_account, new_index_account]
83-
// Account layout when code doesn't change:
84-
// [..., payer, system]
77+
// Optional: Index accounts for code rename (before payer/system)
8578
let index_accounts = if value.code.is_some() {
8679
let old_index_account = next_account_info(accounts_iter)?;
8780
let new_index_account = next_account_info(accounts_iter)?;
@@ -90,6 +83,9 @@ pub fn process_update_multicastgroup(
9083
None
9184
};
9285

86+
let payer_account = next_account_info(accounts_iter)?;
87+
let system_program = next_account_info(accounts_iter)?;
88+
9389
#[cfg(test)]
9490
msg!("process_update_multicastgroup({:?})", value);
9591

smartcontract/programs/doublezero-serviceability/tests/create_subscribe_user_test.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,10 @@ async fn setup_create_subscribe_fixture(client_ip: [u8; 4]) -> CreateSubscribeFi
301301
vec![
302302
AccountMeta::new(mgroup_pubkey, false),
303303
AccountMeta::new(globalstate_pubkey, false),
304+
AccountMeta::new(index_pda_group1, false),
304305
],
305306
&payer,
306-
&[AccountMeta::new(index_pda_group1, false)],
307+
&[],
307308
)
308309
.await;
309310

@@ -883,9 +884,10 @@ async fn test_create_subscribe_user_inactive_mgroup_fails() {
883884
vec![
884885
AccountMeta::new(pending_mgroup_pubkey, false),
885886
AccountMeta::new(globalstate_pubkey, false),
887+
AccountMeta::new(index_pda_pending, false),
886888
],
887889
&payer,
888-
&[AccountMeta::new(index_pda_pending, false)],
890+
&[],
889891
)
890892
.await;
891893

smartcontract/programs/doublezero-serviceability/tests/multicastgroup_allowlist_publisher_test.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ async fn test_multicast_publisher_allowlist() {
7979
vec![
8080
AccountMeta::new(multicastgroup_pubkey, false),
8181
AccountMeta::new(globalstate_pubkey, false),
82+
AccountMeta::new(index_pda_test, false),
8283
],
8384
&payer,
84-
&[AccountMeta::new(index_pda_test, false)],
85+
&[],
8586
)
8687
.await;
8788

@@ -293,9 +294,10 @@ async fn test_multicast_publisher_allowlist_sentinel_authority() {
293294
vec![
294295
AccountMeta::new(multicastgroup_pubkey, false),
295296
AccountMeta::new(globalstate_pubkey, false),
297+
AccountMeta::new(index_pda, false),
296298
],
297299
&payer,
298-
&[AccountMeta::new(index_pda, false)],
300+
&[],
299301
)
300302
.await;
301303

smartcontract/programs/doublezero-serviceability/tests/multicastgroup_allowlist_subcriber_test.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ async fn test_multicast_subscriber_allowlist() {
7979
vec![
8080
AccountMeta::new(multicastgroup_pubkey, false),
8181
AccountMeta::new(globalstate_pubkey, false),
82+
AccountMeta::new(index_pda_test, false),
8283
],
8384
&payer,
84-
&[AccountMeta::new(index_pda_test, false)],
85+
&[],
8586
)
8687
.await;
8788

@@ -293,9 +294,10 @@ async fn test_multicast_subscriber_allowlist_sentinel_authority() {
293294
vec![
294295
AccountMeta::new(multicastgroup_pubkey, false),
295296
AccountMeta::new(globalstate_pubkey, false),
297+
AccountMeta::new(index_pda, false),
296298
],
297299
&payer,
298-
&[AccountMeta::new(index_pda, false)],
300+
&[],
299301
)
300302
.await;
301303

smartcontract/programs/doublezero-serviceability/tests/multicastgroup_onchain_allocation_test.rs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ async fn test_create_multicastgroup_atomic_with_onchain_allocation() {
7272
AccountMeta::new(mgroup_pubkey, false),
7373
AccountMeta::new(globalstate_pubkey, false),
7474
AccountMeta::new(multicast_group_block_pda, false),
75+
AccountMeta::new(index_pda, false),
7576
],
7677
&payer,
77-
&[AccountMeta::new(index_pda, false)],
78+
&[],
7879
)
7980
.await;
8081

@@ -122,9 +123,10 @@ async fn test_create_multicastgroup_atomic_backward_compat() {
122123
vec![
123124
AccountMeta::new(mgroup_pubkey, false),
124125
AccountMeta::new(globalstate_pubkey, false),
126+
AccountMeta::new(index_pda, false),
125127
],
126128
&payer,
127-
&[AccountMeta::new(index_pda, false)],
129+
&[],
128130
)
129131
.await;
130132

@@ -173,9 +175,10 @@ async fn test_create_multicastgroup_atomic_feature_flag_disabled() {
173175
AccountMeta::new(mgroup_pubkey, false),
174176
AccountMeta::new(globalstate_pubkey, false),
175177
AccountMeta::new(multicast_group_block_pda, false),
178+
AccountMeta::new(index_pda, false),
176179
],
177180
&payer,
178-
&[AccountMeta::new(index_pda, false)],
181+
&[],
179182
)
180183
.await;
181184

@@ -237,9 +240,10 @@ async fn test_delete_multicastgroup_atomic_with_deallocation() {
237240
AccountMeta::new(mgroup_pubkey, false),
238241
AccountMeta::new(globalstate_pubkey, false),
239242
AccountMeta::new(multicast_group_block_pda, false),
243+
AccountMeta::new(index_pda, false),
240244
],
241245
&payer,
242-
&[AccountMeta::new(index_pda, false)],
246+
&[],
243247
)
244248
.await;
245249

@@ -325,9 +329,10 @@ async fn test_delete_multicastgroup_atomic_backward_compat() {
325329
AccountMeta::new(mgroup_pubkey, false),
326330
AccountMeta::new(globalstate_pubkey, false),
327331
AccountMeta::new(multicast_group_block_pda, false),
332+
AccountMeta::new(index_pda, false),
328333
],
329334
&payer,
330-
&[AccountMeta::new(index_pda, false)],
335+
&[],
331336
)
332337
.await;
333338

@@ -404,9 +409,10 @@ async fn test_update_multicastgroup_with_onchain_reallocation() {
404409
AccountMeta::new(mgroup_pubkey, false),
405410
AccountMeta::new(globalstate_pubkey, false),
406411
AccountMeta::new(multicast_group_block_pda, false),
412+
AccountMeta::new(index_pda, false),
407413
],
408414
&payer,
409-
&[AccountMeta::new(index_pda, false)],
415+
&[],
410416
)
411417
.await;
412418

@@ -496,9 +502,10 @@ async fn test_update_multicastgroup_backward_compat() {
496502
AccountMeta::new(mgroup_pubkey, false),
497503
AccountMeta::new(globalstate_pubkey, false),
498504
AccountMeta::new(multicast_group_block_pda, false),
505+
AccountMeta::new(index_pda_mg1, false),
499506
],
500507
&payer,
501-
&[AccountMeta::new(index_pda_mg1, false)],
508+
&[],
502509
)
503510
.await;
504511

@@ -521,12 +528,11 @@ async fn test_update_multicastgroup_backward_compat() {
521528
vec![
522529
AccountMeta::new(mgroup_pubkey, false),
523530
AccountMeta::new(globalstate_pubkey, false),
524-
],
525-
&payer,
526-
&[
527531
AccountMeta::new(old_index_pda, false),
528532
AccountMeta::new(new_index_pda, false),
529533
],
534+
&payer,
535+
&[],
530536
)
531537
.await;
532538

@@ -568,9 +574,10 @@ async fn test_update_multicastgroup_feature_flag_disabled() {
568574
vec![
569575
AccountMeta::new(mgroup_pubkey, false),
570576
AccountMeta::new(globalstate_pubkey, false),
577+
AccountMeta::new(index_pda, false),
571578
],
572579
&payer,
573-
&[AccountMeta::new(index_pda, false)],
580+
&[],
574581
)
575582
.await;
576583

smartcontract/programs/doublezero-serviceability/tests/multicastgroup_subscribe_test.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,10 @@ async fn setup_fixture() -> TestFixture {
277277
vec![
278278
AccountMeta::new(mgroup1_pubkey, false),
279279
AccountMeta::new(globalstate_pubkey, false),
280+
AccountMeta::new(index_pda_group1, false),
280281
],
281282
&payer,
282-
&[AccountMeta::new(index_pda_group1, false)],
283+
&[],
283284
)
284285
.await;
285286

@@ -315,9 +316,10 @@ async fn setup_fixture() -> TestFixture {
315316
vec![
316317
AccountMeta::new(mgroup2_pubkey, false),
317318
AccountMeta::new(globalstate_pubkey, false),
319+
AccountMeta::new(index_pda_group2, false),
318320
],
319321
&payer,
320-
&[AccountMeta::new(index_pda_group2, false)],
322+
&[],
321323
)
322324
.await;
323325

smartcontract/programs/doublezero-serviceability/tests/multicastgroup_test.rs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ async fn test_multicastgroup() {
6767
vec![
6868
AccountMeta::new(multicastgroup_pubkey, false),
6969
AccountMeta::new(globalstate_pubkey, false),
70+
AccountMeta::new(index_pda_la, false),
7071
],
7172
&payer,
72-
&[AccountMeta::new(index_pda_la, false)],
73+
&[],
7374
)
7475
.await;
7576

@@ -188,12 +189,11 @@ async fn test_multicastgroup() {
188189
vec![
189190
AccountMeta::new(multicastgroup_pubkey, false),
190191
AccountMeta::new(globalstate_pubkey, false),
191-
],
192-
&payer,
193-
&[
194192
AccountMeta::new(old_index_pda_la, false),
195193
AccountMeta::new(new_index_pda_lb, false),
196194
],
195+
&payer,
196+
&[],
197197
)
198198
.await;
199199

@@ -308,9 +308,10 @@ async fn test_multicastgroup_deactivate_fails_when_counts_nonzero() {
308308
vec![
309309
AccountMeta::new(multicastgroup_pubkey, false),
310310
AccountMeta::new(globalstate_pubkey, false),
311+
AccountMeta::new(index_pda_la, false),
311312
],
312313
&payer,
313-
&[AccountMeta::new(index_pda_la, false)],
314+
&[],
314315
)
315316
.await;
316317

@@ -434,9 +435,10 @@ async fn test_multicastgroup_deactivate_fails_when_not_deleting() {
434435
vec![
435436
AccountMeta::new(multicastgroup_pubkey, false),
436437
AccountMeta::new(globalstate_pubkey, false),
438+
AccountMeta::new(index_pda_la, false),
437439
],
438440
&payer,
439-
&[AccountMeta::new(index_pda_la, false)],
441+
&[],
440442
)
441443
.await;
442444

@@ -543,9 +545,10 @@ async fn test_multicastgroup_create_with_wrong_index_fails() {
543545
vec![
544546
AccountMeta::new(wrong_multicastgroup_pubkey, false),
545547
AccountMeta::new(globalstate_pubkey, false),
548+
AccountMeta::new(index_pda_test, false),
546549
],
547550
&payer,
548-
&[AccountMeta::new(index_pda_test, false)],
551+
&[],
549552
)
550553
.await;
551554

@@ -572,9 +575,10 @@ async fn test_multicastgroup_create_with_wrong_index_fails() {
572575
vec![
573576
AccountMeta::new(correct_multicastgroup_pubkey, false),
574577
AccountMeta::new(globalstate_pubkey, false),
578+
AccountMeta::new(index_pda_test, false),
575579
],
576580
&payer,
577-
&[AccountMeta::new(index_pda_test, false)],
581+
&[],
578582
)
579583
.await;
580584

@@ -633,9 +637,10 @@ async fn test_multicastgroup_reactivate_invalid_status_fails() {
633637
vec![
634638
AccountMeta::new(multicastgroup_pubkey, false),
635639
AccountMeta::new(globalstate_pubkey, false),
640+
AccountMeta::new(index_pda, false),
636641
],
637642
&payer,
638-
&[AccountMeta::new(index_pda, false)],
643+
&[],
639644
)
640645
.await;
641646

@@ -710,9 +715,10 @@ async fn test_suspend_multicastgroup_from_pending_fails() {
710715
vec![
711716
AccountMeta::new(multicastgroup_pubkey, false),
712717
AccountMeta::new(globalstate_pubkey, false),
718+
AccountMeta::new(index_pda, false),
713719
],
714720
&payer,
715-
&[AccountMeta::new(index_pda, false)],
721+
&[],
716722
)
717723
.await;
718724

@@ -791,9 +797,10 @@ async fn test_delete_multicastgroup_fails_with_active_publishers_or_subscribers(
791797
vec![
792798
AccountMeta::new(multicastgroup_pubkey, false),
793799
AccountMeta::new(globalstate_pubkey, false),
800+
AccountMeta::new(index_pda, false),
794801
],
795802
&payer,
796-
&[AccountMeta::new(index_pda, false)],
803+
&[],
797804
)
798805
.await;
799806

smartcontract/programs/doublezero-serviceability/tests/reservation_test.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,9 +862,10 @@ async fn setup_multicast_group(
862862
vec![
863863
AccountMeta::new(mgroup_pubkey, false),
864864
AccountMeta::new(globalstate_pubkey, false),
865+
AccountMeta::new(index_pda_group1, false),
865866
],
866867
payer,
867-
&[AccountMeta::new(index_pda_group1, false)],
868+
&[],
868869
)
869870
.await;
870871

0 commit comments

Comments
 (0)