forked from jito-foundation/jito-solana
-
Notifications
You must be signed in to change notification settings - Fork 1
/
stake_accounts.rs
690 lines (627 loc) · 22.7 KB
/
stake_accounts.rs
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
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
use solana_sdk::{
clock::SECONDS_PER_DAY,
instruction::Instruction,
message::Message,
pubkey::Pubkey,
stake::{
self,
instruction::{self as stake_instruction, LockupArgs},
state::{Authorized, Lockup, StakeAuthorize},
},
};
const DAYS_PER_YEAR: f64 = 365.25;
const SECONDS_PER_YEAR: i64 = (SECONDS_PER_DAY as f64 * DAYS_PER_YEAR) as i64;
pub(crate) fn derive_stake_account_address(base_pubkey: &Pubkey, i: usize) -> Pubkey {
Pubkey::create_with_seed(base_pubkey, &i.to_string(), &stake::program::id()).unwrap()
}
// Return derived addresses
pub(crate) fn derive_stake_account_addresses(
base_pubkey: &Pubkey,
num_accounts: usize,
) -> Vec<Pubkey> {
(0..num_accounts)
.map(|i| derive_stake_account_address(base_pubkey, i))
.collect()
}
pub(crate) fn new_stake_account(
fee_payer_pubkey: &Pubkey,
funding_pubkey: &Pubkey,
base_pubkey: &Pubkey,
lamports: u64,
stake_authority_pubkey: &Pubkey,
withdraw_authority_pubkey: &Pubkey,
custodian_pubkey: &Pubkey,
index: usize,
) -> Message {
let stake_account_address = derive_stake_account_address(base_pubkey, index);
let authorized = Authorized {
staker: *stake_authority_pubkey,
withdrawer: *withdraw_authority_pubkey,
};
let lockup = Lockup {
custodian: *custodian_pubkey,
..Lockup::default()
};
let instructions = stake_instruction::create_account_with_seed(
funding_pubkey,
&stake_account_address,
base_pubkey,
&index.to_string(),
&authorized,
&lockup,
lamports,
);
Message::new(&instructions, Some(fee_payer_pubkey))
}
fn authorize_stake_accounts_instructions(
stake_account_address: &Pubkey,
stake_authority_pubkey: &Pubkey,
withdraw_authority_pubkey: &Pubkey,
new_stake_authority_pubkey: &Pubkey,
new_withdraw_authority_pubkey: &Pubkey,
) -> Vec<Instruction> {
let instruction0 = stake_instruction::authorize(
stake_account_address,
stake_authority_pubkey,
new_stake_authority_pubkey,
StakeAuthorize::Staker,
None,
);
let instruction1 = stake_instruction::authorize(
stake_account_address,
withdraw_authority_pubkey,
new_withdraw_authority_pubkey,
StakeAuthorize::Withdrawer,
None,
);
vec![instruction0, instruction1]
}
fn rebase_stake_account(
stake_account_address: &Pubkey,
new_base_pubkey: &Pubkey,
i: usize,
fee_payer_pubkey: &Pubkey,
stake_authority_pubkey: &Pubkey,
lamports: u64,
) -> Option<Message> {
if lamports == 0 {
return None;
}
let new_stake_account_address = derive_stake_account_address(new_base_pubkey, i);
let instructions = stake_instruction::split_with_seed(
stake_account_address,
stake_authority_pubkey,
lamports,
&new_stake_account_address,
new_base_pubkey,
&i.to_string(),
);
let message = Message::new(&instructions, Some(fee_payer_pubkey));
Some(message)
}
fn move_stake_account(
stake_account_address: &Pubkey,
new_base_pubkey: &Pubkey,
i: usize,
fee_payer_pubkey: &Pubkey,
stake_authority_pubkey: &Pubkey,
withdraw_authority_pubkey: &Pubkey,
new_stake_authority_pubkey: &Pubkey,
new_withdraw_authority_pubkey: &Pubkey,
lamports: u64,
) -> Option<Message> {
if lamports == 0 {
return None;
}
let new_stake_account_address = derive_stake_account_address(new_base_pubkey, i);
let mut instructions = stake_instruction::split_with_seed(
stake_account_address,
stake_authority_pubkey,
lamports,
&new_stake_account_address,
new_base_pubkey,
&i.to_string(),
);
let authorize_instructions = authorize_stake_accounts_instructions(
&new_stake_account_address,
stake_authority_pubkey,
withdraw_authority_pubkey,
new_stake_authority_pubkey,
new_withdraw_authority_pubkey,
);
instructions.extend(authorize_instructions);
let message = Message::new(&instructions, Some(fee_payer_pubkey));
Some(message)
}
pub(crate) fn authorize_stake_accounts(
fee_payer_pubkey: &Pubkey,
base_pubkey: &Pubkey,
stake_authority_pubkey: &Pubkey,
withdraw_authority_pubkey: &Pubkey,
new_stake_authority_pubkey: &Pubkey,
new_withdraw_authority_pubkey: &Pubkey,
num_accounts: usize,
) -> Vec<Message> {
let stake_account_addresses = derive_stake_account_addresses(base_pubkey, num_accounts);
stake_account_addresses
.iter()
.map(|stake_account_address| {
let instructions = authorize_stake_accounts_instructions(
stake_account_address,
stake_authority_pubkey,
withdraw_authority_pubkey,
new_stake_authority_pubkey,
new_withdraw_authority_pubkey,
);
Message::new(&instructions, Some(fee_payer_pubkey))
})
.collect::<Vec<_>>()
}
fn extend_lockup(lockup: &LockupArgs, years: f64) -> LockupArgs {
let offset = (SECONDS_PER_YEAR as f64 * years) as i64;
let unix_timestamp = lockup.unix_timestamp.map(|x| x + offset);
let epoch = lockup.epoch.map(|_| todo!());
LockupArgs {
unix_timestamp,
epoch,
custodian: lockup.custodian,
}
}
fn apply_lockup_changes(lockup: &LockupArgs, existing_lockup: &Lockup) -> LockupArgs {
let custodian = match lockup.custodian {
Some(x) if x == existing_lockup.custodian => None,
x => x,
};
let epoch = match lockup.epoch {
Some(x) if x == existing_lockup.epoch => None,
x => x,
};
let unix_timestamp = match lockup.unix_timestamp {
Some(x) if x == existing_lockup.unix_timestamp => None,
x => x,
};
LockupArgs {
unix_timestamp,
epoch,
custodian,
}
}
pub(crate) fn lockup_stake_accounts(
fee_payer_pubkey: &Pubkey,
custodian_pubkey: &Pubkey,
lockup: &LockupArgs,
existing_lockups: &[(Pubkey, Lockup)],
unlock_years: Option<f64>,
) -> Vec<Message> {
let default_lockup = LockupArgs::default();
existing_lockups
.iter()
.enumerate()
.filter_map(|(index, (address, existing_lockup))| {
let lockup = if let Some(unlock_years) = unlock_years {
let unlocks = existing_lockups.len() - 1;
let years = (unlock_years / unlocks as f64) * index as f64;
extend_lockup(lockup, years)
} else {
*lockup
};
let lockup = apply_lockup_changes(&lockup, existing_lockup);
if lockup == default_lockup {
return None;
}
let instruction = stake_instruction::set_lockup(address, &lockup, custodian_pubkey);
let message = Message::new(&[instruction], Some(fee_payer_pubkey));
Some(message)
})
.collect()
}
pub(crate) fn rebase_stake_accounts(
fee_payer_pubkey: &Pubkey,
new_base_pubkey: &Pubkey,
stake_authority_pubkey: &Pubkey,
balances: &[(Pubkey, u64)],
) -> Vec<Message> {
balances
.iter()
.enumerate()
.filter_map(|(i, (stake_account_address, lamports))| {
rebase_stake_account(
stake_account_address,
new_base_pubkey,
i,
fee_payer_pubkey,
stake_authority_pubkey,
*lamports,
)
})
.collect()
}
pub(crate) fn move_stake_accounts(
fee_payer_pubkey: &Pubkey,
new_base_pubkey: &Pubkey,
stake_authority_pubkey: &Pubkey,
withdraw_authority_pubkey: &Pubkey,
new_stake_authority_pubkey: &Pubkey,
new_withdraw_authority_pubkey: &Pubkey,
balances: &[(Pubkey, u64)],
) -> Vec<Message> {
balances
.iter()
.enumerate()
.filter_map(|(i, (stake_account_address, lamports))| {
move_stake_account(
stake_account_address,
new_base_pubkey,
i,
fee_payer_pubkey,
stake_authority_pubkey,
withdraw_authority_pubkey,
new_stake_authority_pubkey,
new_withdraw_authority_pubkey,
*lamports,
)
})
.collect()
}
#[cfg(test)]
mod tests {
use {
super::*,
solana_runtime::{bank::Bank, bank_client::BankClient},
solana_sdk::{
account::{AccountSharedData, ReadableAccount},
client::SyncClient,
genesis_config::create_genesis_config,
signature::{Keypair, Signer},
stake::state::StakeStateV2,
},
solana_stake_program::stake_state,
std::sync::Arc,
};
fn create_bank(lamports: u64) -> (Arc<Bank>, Keypair, u64, u64) {
let (mut genesis_config, mint_keypair) = create_genesis_config(lamports);
genesis_config.fee_rate_governor = solana_sdk::fee_calculator::FeeRateGovernor::new(0, 0);
let bank = Bank::new_with_bank_forks_for_tests(&genesis_config).0;
let stake_rent = bank.get_minimum_balance_for_rent_exemption(StakeStateV2::size_of());
let system_rent = bank.get_minimum_balance_for_rent_exemption(0);
(bank, mint_keypair, stake_rent, system_rent)
}
fn create_account<C: SyncClient>(
client: &C,
funding_keypair: &Keypair,
lamports: u64,
) -> Keypair {
let fee_payer_keypair = Keypair::new();
client
.transfer_and_confirm(lamports, funding_keypair, &fee_payer_keypair.pubkey())
.unwrap();
fee_payer_keypair
}
fn get_account_at<C: SyncClient>(
client: &C,
base_pubkey: &Pubkey,
i: usize,
) -> AccountSharedData {
let account_address = derive_stake_account_address(base_pubkey, i);
AccountSharedData::from(client.get_account(&account_address).unwrap().unwrap())
}
fn get_balances<C: SyncClient>(
client: &C,
base_pubkey: &Pubkey,
num_accounts: usize,
) -> Vec<(Pubkey, u64)> {
(0..num_accounts)
.map(|i| {
let address = derive_stake_account_address(base_pubkey, i);
(address, client.get_balance(&address).unwrap())
})
.collect()
}
fn get_lockups<C: SyncClient>(
client: &C,
base_pubkey: &Pubkey,
num_accounts: usize,
) -> Vec<(Pubkey, Lockup)> {
(0..num_accounts)
.map(|i| {
let address = derive_stake_account_address(base_pubkey, i);
let account =
AccountSharedData::from(client.get_account(&address).unwrap().unwrap());
(address, stake_state::lockup_from(&account).unwrap())
})
.collect()
}
#[test]
fn test_new_derived_stake_account() {
let (bank, funding_keypair, stake_rent, system_rent) = create_bank(10_000_000);
let funding_pubkey = funding_keypair.pubkey();
let bank_client = BankClient::new_shared(bank);
let fee_payer_keypair = create_account(&bank_client, &funding_keypair, system_rent);
let fee_payer_pubkey = fee_payer_keypair.pubkey();
let base_keypair = Keypair::new();
let base_pubkey = base_keypair.pubkey();
let lamports = stake_rent + 1;
let stake_authority_pubkey = solana_sdk::pubkey::new_rand();
let withdraw_authority_pubkey = solana_sdk::pubkey::new_rand();
let message = new_stake_account(
&fee_payer_pubkey,
&funding_pubkey,
&base_pubkey,
lamports,
&stake_authority_pubkey,
&withdraw_authority_pubkey,
&Pubkey::default(),
0,
);
let signers = [&funding_keypair, &fee_payer_keypair, &base_keypair];
bank_client
.send_and_confirm_message(&signers, message)
.unwrap();
let account = get_account_at(&bank_client, &base_pubkey, 0);
assert_eq!(account.lamports(), lamports);
let authorized = stake_state::authorized_from(&account).unwrap();
assert_eq!(authorized.staker, stake_authority_pubkey);
assert_eq!(authorized.withdrawer, withdraw_authority_pubkey);
}
#[test]
fn test_authorize_stake_accounts() {
let (bank, funding_keypair, stake_rent, system_rent) = create_bank(10_000_000);
let funding_pubkey = funding_keypair.pubkey();
let bank_client = BankClient::new_shared(bank);
let fee_payer_keypair = create_account(&bank_client, &funding_keypair, system_rent);
let fee_payer_pubkey = fee_payer_keypair.pubkey();
let base_keypair = Keypair::new();
let base_pubkey = base_keypair.pubkey();
let lamports = stake_rent + 1;
let stake_authority_keypair = Keypair::new();
let stake_authority_pubkey = stake_authority_keypair.pubkey();
let withdraw_authority_keypair = Keypair::new();
let withdraw_authority_pubkey = withdraw_authority_keypair.pubkey();
let message = new_stake_account(
&fee_payer_pubkey,
&funding_pubkey,
&base_pubkey,
lamports,
&stake_authority_pubkey,
&withdraw_authority_pubkey,
&Pubkey::default(),
0,
);
let signers = [&funding_keypair, &fee_payer_keypair, &base_keypair];
bank_client
.send_and_confirm_message(&signers, message)
.unwrap();
let new_stake_authority_pubkey = solana_sdk::pubkey::new_rand();
let new_withdraw_authority_pubkey = solana_sdk::pubkey::new_rand();
let messages = authorize_stake_accounts(
&fee_payer_pubkey,
&base_pubkey,
&stake_authority_pubkey,
&withdraw_authority_pubkey,
&new_stake_authority_pubkey,
&new_withdraw_authority_pubkey,
1,
);
let signers = [
&fee_payer_keypair,
&stake_authority_keypair,
&withdraw_authority_keypair,
];
for message in messages {
bank_client
.send_and_confirm_message(&signers, message)
.unwrap();
}
let account = get_account_at(&bank_client, &base_pubkey, 0);
let authorized = stake_state::authorized_from(&account).unwrap();
assert_eq!(authorized.staker, new_stake_authority_pubkey);
assert_eq!(authorized.withdrawer, new_withdraw_authority_pubkey);
}
#[test]
fn test_lockup_stake_accounts() {
let (bank, funding_keypair, stake_rent, system_rent) = create_bank(10_000_000);
let funding_pubkey = funding_keypair.pubkey();
let bank_client = BankClient::new_shared(bank);
let fee_payer_keypair = create_account(&bank_client, &funding_keypair, system_rent);
let fee_payer_pubkey = fee_payer_keypair.pubkey();
let base_keypair = Keypair::new();
let base_pubkey = base_keypair.pubkey();
let lamports = stake_rent + 1;
let custodian_keypair = Keypair::new();
let custodian_pubkey = custodian_keypair.pubkey();
let withdrawer_keypair = Keypair::new();
let withdrawer_pubkey = withdrawer_keypair.pubkey();
let message = new_stake_account(
&fee_payer_pubkey,
&funding_pubkey,
&base_pubkey,
lamports,
&Pubkey::default(),
&withdrawer_pubkey,
&custodian_pubkey,
0,
);
let signers = [&funding_keypair, &fee_payer_keypair, &base_keypair];
bank_client
.send_and_confirm_message(&signers, message)
.unwrap();
let lockups = get_lockups(&bank_client, &base_pubkey, 1);
let messages = lockup_stake_accounts(
&fee_payer_pubkey,
&withdrawer_pubkey,
&LockupArgs {
unix_timestamp: Some(1),
custodian: Some(custodian_pubkey),
..LockupArgs::default()
},
&lockups,
None,
);
let signers = [&fee_payer_keypair, &withdrawer_keypair];
for message in messages {
bank_client
.send_and_confirm_message(&signers, message)
.unwrap();
}
let account = get_account_at(&bank_client, &base_pubkey, 0);
let lockup = stake_state::lockup_from(&account).unwrap();
assert_eq!(lockup.custodian, custodian_pubkey);
assert_eq!(lockup.unix_timestamp, 1);
assert_eq!(lockup.epoch, 0);
// Assert no work left to do
let lockups = get_lockups(&bank_client, &base_pubkey, 1);
let messages = lockup_stake_accounts(
&fee_payer_pubkey,
&custodian_pubkey,
&LockupArgs {
unix_timestamp: Some(1),
..LockupArgs::default()
},
&lockups,
None,
);
assert_eq!(messages.len(), 0);
}
#[test]
fn test_rebase_empty_account() {
let pubkey = Pubkey::default();
let message = rebase_stake_account(&pubkey, &pubkey, 0, &pubkey, &pubkey, 0);
assert_eq!(message, None);
}
#[test]
fn test_move_empty_account() {
let pubkey = Pubkey::default();
let message = move_stake_account(
&pubkey, &pubkey, 0, &pubkey, &pubkey, &pubkey, &pubkey, &pubkey, 0,
);
assert_eq!(message, None);
}
#[test]
fn test_rebase_stake_accounts() {
let (bank, funding_keypair, stake_rent, system_rent) = create_bank(10_000_000);
let funding_pubkey = funding_keypair.pubkey();
let bank_client = BankClient::new_shared(bank);
let fee_payer_keypair = create_account(&bank_client, &funding_keypair, system_rent);
let fee_payer_pubkey = fee_payer_keypair.pubkey();
let base_keypair = Keypair::new();
let base_pubkey = base_keypair.pubkey();
let lamports = stake_rent + 1;
let stake_authority_keypair = Keypair::new();
let stake_authority_pubkey = stake_authority_keypair.pubkey();
let withdraw_authority_keypair = Keypair::new();
let withdraw_authority_pubkey = withdraw_authority_keypair.pubkey();
let num_accounts = 1;
let message = new_stake_account(
&fee_payer_pubkey,
&funding_pubkey,
&base_pubkey,
lamports,
&stake_authority_pubkey,
&withdraw_authority_pubkey,
&Pubkey::default(),
0,
);
let signers = [&funding_keypair, &fee_payer_keypair, &base_keypair];
bank_client
.send_and_confirm_message(&signers, message)
.unwrap();
let new_base_keypair = Keypair::new();
let new_base_pubkey = new_base_keypair.pubkey();
let balances = get_balances(&bank_client, &base_pubkey, num_accounts);
let messages = rebase_stake_accounts(
&fee_payer_pubkey,
&new_base_pubkey,
&stake_authority_pubkey,
&balances,
);
assert_eq!(messages.len(), num_accounts);
let signers = [
&fee_payer_keypair,
&new_base_keypair,
&stake_authority_keypair,
];
for message in messages {
bank_client
.send_and_confirm_message(&signers, message)
.unwrap();
}
// Ensure the new accounts are duplicates of the previous ones.
let account = get_account_at(&bank_client, &new_base_pubkey, 0);
let authorized = stake_state::authorized_from(&account).unwrap();
assert_eq!(authorized.staker, stake_authority_pubkey);
assert_eq!(authorized.withdrawer, withdraw_authority_pubkey);
}
#[test]
fn test_move_stake_accounts() {
let (bank, funding_keypair, stake_rent, system_rent) = create_bank(10_000_000);
let funding_pubkey = funding_keypair.pubkey();
let bank_client = BankClient::new_shared(bank);
let fee_payer_keypair = create_account(&bank_client, &funding_keypair, system_rent);
let fee_payer_pubkey = fee_payer_keypair.pubkey();
let base_keypair = Keypair::new();
let base_pubkey = base_keypair.pubkey();
let lamports = stake_rent + 1;
let stake_authority_keypair = Keypair::new();
let stake_authority_pubkey = stake_authority_keypair.pubkey();
let withdraw_authority_keypair = Keypair::new();
let withdraw_authority_pubkey = withdraw_authority_keypair.pubkey();
let num_accounts = 1;
let message = new_stake_account(
&fee_payer_pubkey,
&funding_pubkey,
&base_pubkey,
lamports,
&stake_authority_pubkey,
&withdraw_authority_pubkey,
&Pubkey::default(),
0,
);
let signers = [&funding_keypair, &fee_payer_keypair, &base_keypair];
bank_client
.send_and_confirm_message(&signers, message)
.unwrap();
let new_base_keypair = Keypair::new();
let new_base_pubkey = new_base_keypair.pubkey();
let new_stake_authority_pubkey = solana_sdk::pubkey::new_rand();
let new_withdraw_authority_pubkey = solana_sdk::pubkey::new_rand();
let balances = get_balances(&bank_client, &base_pubkey, num_accounts);
let messages = move_stake_accounts(
&fee_payer_pubkey,
&new_base_pubkey,
&stake_authority_pubkey,
&withdraw_authority_pubkey,
&new_stake_authority_pubkey,
&new_withdraw_authority_pubkey,
&balances,
);
assert_eq!(messages.len(), num_accounts);
let signers = [
&fee_payer_keypair,
&new_base_keypair,
&stake_authority_keypair,
&withdraw_authority_keypair,
];
for message in messages {
bank_client
.send_and_confirm_message(&signers, message)
.unwrap();
}
// Ensure the new accounts have the new authorities.
let account = get_account_at(&bank_client, &new_base_pubkey, 0);
let authorized = stake_state::authorized_from(&account).unwrap();
assert_eq!(authorized.staker, new_stake_authority_pubkey);
assert_eq!(authorized.withdrawer, new_withdraw_authority_pubkey);
}
#[test]
fn test_extend_lockup() {
let lockup = LockupArgs {
unix_timestamp: Some(1),
..LockupArgs::default()
};
let expected_lockup = LockupArgs {
unix_timestamp: Some(1 + SECONDS_PER_YEAR),
..LockupArgs::default()
};
assert_eq!(extend_lockup(&lockup, 1.0), expected_lockup);
}
}