Skip to content

Commit c64747e

Browse files
author
lukacan
committed
🐛 Rebase changes
1 parent bbb2ceb commit c64747e

6 files changed

Lines changed: 36 additions & 61 deletions

File tree

trident-tests/common/futarchy.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ pub fn stake_to_proposal(
146146
staker,
147147
payer,
148148
TOKEN_PROGRAM_ID,
149-
ASSOCIATED_TOKEN_PROGRAM_ID,
150149
solana_sdk::system_program::ID,
151150
event_authority,
152151
futarchy::program_id(),
@@ -155,7 +154,12 @@ pub fn stake_to_proposal(
155154

156155
let res = trident.process_transaction(&[stake_to_proposal_ix], message);
157156

158-
invariant!(res.is_success());
157+
invariant!(
158+
res.is_success(),
159+
"Stake to proposal failed: {:#?},log: {}",
160+
res.status(),
161+
res.logs()
162+
);
159163
}
160164

161165
#[allow(clippy::too_many_arguments)]

trident-tests/common/types.rs

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4708,6 +4708,8 @@ pub mod launchpad_v_7 {
47084708
pub additionalTokensAmount: u64,
47094709

47104710
pub accumulatorActivationDelaySeconds: u32,
4711+
4712+
pub hasBidWall: bool,
47114713
}
47124714

47134715
impl InitializeLaunchArgs {
@@ -4737,6 +4739,8 @@ pub mod launchpad_v_7 {
47374739
additionalTokensAmount: u64,
47384740

47394741
accumulatorActivationDelaySeconds: u32,
4742+
4743+
hasBidWall: bool,
47404744
) -> Self {
47414745
Self {
47424746
minimumRaiseAmount,
@@ -4764,6 +4768,8 @@ pub mod launchpad_v_7 {
47644768
additionalTokensAmount,
47654769

47664770
accumulatorActivationDelaySeconds,
4771+
4772+
hasBidWall,
47674773
}
47684774
}
47694775
}
@@ -5874,8 +5880,6 @@ pub mod futarchy {
58745880

58755881
pub tokenProgram: Pubkey,
58765882

5877-
pub associatedTokenProgram: Pubkey,
5878-
58795883
pub systemProgram: Pubkey,
58805884

58815885
pub eventAuthority: Pubkey,
@@ -5901,8 +5905,6 @@ pub mod futarchy {
59015905

59025906
tokenProgram: Pubkey,
59035907

5904-
associatedTokenProgram: Pubkey,
5905-
59065908
systemProgram: Pubkey,
59075909

59085910
eventAuthority: Pubkey,
@@ -5926,8 +5928,6 @@ pub mod futarchy {
59265928

59275929
tokenProgram,
59285930

5929-
associatedTokenProgram,
5930-
59315931
systemProgram,
59325932

59335933
eventAuthority,
@@ -5981,9 +5981,6 @@ pub mod futarchy {
59815981

59825982
self.accounts.tokenProgram = AccountMeta::new_readonly(accounts.tokenProgram, false);
59835983

5984-
self.accounts.associatedTokenProgram =
5985-
AccountMeta::new_readonly(accounts.associatedTokenProgram, false);
5986-
59875984
self.accounts.systemProgram = AccountMeta::new_readonly(accounts.systemProgram, false);
59885985

59895986
self.accounts.eventAuthority =
@@ -6018,8 +6015,6 @@ pub mod futarchy {
60186015

60196016
metas.push(self.accounts.tokenProgram.clone());
60206017

6021-
metas.push(self.accounts.associatedTokenProgram.clone());
6022-
60236018
metas.push(self.accounts.systemProgram.clone());
60246019

60256020
metas.push(self.accounts.eventAuthority.clone());
@@ -14341,7 +14336,6 @@ pub mod performance_package_v_2 {
1434114336
pub recipientAta: Pubkey,
1434214337
pub signer: Pubkey,
1434314338
pub tokenProgram: Pubkey,
14344-
pub associatedTokenProgram: Pubkey,
1434514339
pub mintGovernorProgram: Pubkey,
1434614340
pub mintGovernorEventAuthority: Pubkey,
1434714341
pub eventAuthority: Pubkey,
@@ -14357,7 +14351,6 @@ pub mod performance_package_v_2 {
1435714351
recipientAta: Pubkey,
1435814352
signer: Pubkey,
1435914353
tokenProgram: Pubkey,
14360-
associatedTokenProgram: Pubkey,
1436114354
mintGovernorProgram: Pubkey,
1436214355
mintGovernorEventAuthority: Pubkey,
1436314356
eventAuthority: Pubkey,
@@ -14371,7 +14364,6 @@ pub mod performance_package_v_2 {
1437114364
recipientAta,
1437214365
signer,
1437314366
tokenProgram,
14374-
associatedTokenProgram,
1437514367
mintGovernorProgram,
1437614368
mintGovernorEventAuthority,
1437714369
eventAuthority,
@@ -14412,8 +14404,6 @@ pub mod performance_package_v_2 {
1441214404
self.accounts.recipientAta = AccountMeta::new(accounts.recipientAta, false);
1441314405
self.accounts.signer = AccountMeta::new_readonly(accounts.signer, true);
1441414406
self.accounts.tokenProgram = AccountMeta::new_readonly(accounts.tokenProgram, false);
14415-
self.accounts.associatedTokenProgram =
14416-
AccountMeta::new_readonly(accounts.associatedTokenProgram, false);
1441714407
self.accounts.mintGovernorProgram =
1441814408
AccountMeta::new_readonly(accounts.mintGovernorProgram, false);
1441914409
self.accounts.mintGovernorEventAuthority =
@@ -14438,7 +14428,6 @@ pub mod performance_package_v_2 {
1443814428
metas.push(self.accounts.recipientAta.clone());
1443914429
metas.push(self.accounts.signer.clone());
1444014430
metas.push(self.accounts.tokenProgram.clone());
14441-
metas.push(self.accounts.associatedTokenProgram.clone());
1444214431
metas.push(self.accounts.mintGovernorProgram.clone());
1444314432
metas.push(self.accounts.mintGovernorEventAuthority.clone());
1444414433
metas.push(self.accounts.eventAuthority.clone());
@@ -15080,12 +15069,6 @@ pub mod performance_package_v_2 {
1508015069
}
1508115070
}
1508215071

15083-
#[derive(Debug, BorshDeserialize, BorshSerialize, Clone, PartialEq)]
15084-
pub enum ProposerType {
15085-
Authority,
15086-
Recipient,
15087-
}
15088-
1508915072
#[derive(Debug, BorshDeserialize, BorshSerialize, Clone, PartialEq)]
1509015073
pub enum PackageStatus {
1509115074
Locked,
@@ -15122,7 +15105,8 @@ pub mod performance_package_v_2 {
1512215105
#[derive(Debug, BorshDeserialize, BorshSerialize, Clone, PartialEq)]
1512315106
pub struct ChangeRequest {
1512415107
pub performancePackage: Pubkey,
15125-
pub proposerType: ProposerType,
15108+
pub proposer: Pubkey,
15109+
pub ppCreatedAtTimestamp: i64,
1512615110
pub proposedAt: i64,
1512715111
pub pdaNonce: u32,
1512815112
pub bump: u8,
@@ -15134,7 +15118,8 @@ pub mod performance_package_v_2 {
1513415118
impl ChangeRequest {
1513515119
pub fn new(
1513615120
performancePackage: Pubkey,
15137-
proposerType: ProposerType,
15121+
proposer: Pubkey,
15122+
ppCreatedAtTimestamp: i64,
1513815123
proposedAt: i64,
1513915124
pdaNonce: u32,
1514015125
bump: u8,
@@ -15144,7 +15129,8 @@ pub mod performance_package_v_2 {
1514415129
) -> Self {
1514515130
Self {
1514615131
performancePackage,
15147-
proposerType,
15132+
proposer,
15133+
ppCreatedAtTimestamp,
1514815134
proposedAt,
1514915135
pdaNonce,
1515015136
bump,
@@ -15166,6 +15152,7 @@ pub mod performance_package_v_2 {
1516615152
pub rewardFunction: RewardFunction,
1516715153
pub status: PackageStatus,
1516815154
pub minUnlockTimestamp: i64,
15155+
pub createdAtTimestamp: i64,
1516915156
pub totalRewardsPaidOut: u64,
1517015157
pub seqNum: u64,
1517115158
pub createKey: Pubkey,
@@ -15183,6 +15170,7 @@ pub mod performance_package_v_2 {
1518315170
rewardFunction: RewardFunction,
1518415171
status: PackageStatus,
1518515172
minUnlockTimestamp: i64,
15173+
createdAtTimestamp: i64,
1518615174
totalRewardsPaidOut: u64,
1518715175
seqNum: u64,
1518815176
createKey: Pubkey,
@@ -15198,6 +15186,7 @@ pub mod performance_package_v_2 {
1519815186
rewardFunction,
1519915187
status,
1520015188
minUnlockTimestamp,
15189+
createdAtTimestamp,
1520115190
totalRewardsPaidOut,
1520215191
seqNum,
1520315192
createKey,

trident-tests/fuzz_launchpad/methods/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ impl FuzzTest {
206206
team_address,
207207
additional_tokens_amount,
208208
accumulator_activation_delay_seconds,
209+
false,
209210
)
210211
}
211212

trident-tests/fuzz_ppv2/invariants/execute_change.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::common::types::performance_package_v_2::ChangeRequest;
22
use crate::common::types::performance_package_v_2::PackageStatus;
33
use crate::common::types::performance_package_v_2::PerformancePackage;
4-
use crate::common::types::performance_package_v_2::ProposerType;
54
use crate::FuzzTest;
65

76
use trident_fuzz::fuzzing::Pubkey;
@@ -24,21 +23,20 @@ impl FuzzTest {
2423

2524
// Invariant 1: executor must be the opposite party of the proposerType stored in
2625
// ChangeRequest.
27-
match pre_cr.proposerType {
28-
ProposerType::Recipient => {
29-
invariant_eq!(
30-
executor,
31-
pre_pp.authority,
32-
"If recipient proposed, authority must execute"
33-
);
34-
}
35-
ProposerType::Authority => {
36-
invariant_eq!(
37-
executor,
38-
pre_pp.recipient,
39-
"If authority proposed, recipient must execute"
40-
);
41-
}
26+
if pre_cr.proposer == pre_pp.authority {
27+
invariant_eq!(
28+
executor,
29+
pre_pp.recipient,
30+
"If authority proposed, recipient must execute"
31+
);
32+
} else if pre_cr.proposer == pre_pp.recipient {
33+
invariant_eq!(
34+
executor,
35+
pre_pp.authority,
36+
"If recipient proposed, authority must execute"
37+
);
38+
} else {
39+
invariant!(false, "Invalid proposer");
4240
}
4341

4442
// Invariant 2: change_request must belong to the supplied performance_package.

trident-tests/fuzz_ppv2/invariants/propose_change.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use crate::common::types::performance_package_v_2;
33
use crate::common::types::performance_package_v_2::ChangeRequest;
44
use crate::common::types::performance_package_v_2::PerformancePackage;
55
use crate::common::types::performance_package_v_2::ProposeChangeArgs;
6-
use crate::common::types::performance_package_v_2::ProposerType;
76
use crate::FuzzTest;
87
use trident_fuzz::fuzzing::Pubkey;
98

@@ -57,21 +56,6 @@ impl FuzzTest {
5756
"ChangeRequest.performancePackage must equal the provided performance_package"
5857
);
5958

60-
// Invariant 3: proposerType must reflect whether proposer is recipient or authority in the
61-
// pre-state performance package.
62-
let expected_proposer_type = if proposer == pre_pp.recipient {
63-
ProposerType::Recipient
64-
} else if proposer == pre_pp.authority {
65-
ProposerType::Authority
66-
} else {
67-
panic!("proposer must be recipient or authority if tx succeeded");
68-
};
69-
match (&post_cr.proposerType, expected_proposer_type) {
70-
(ProposerType::Recipient, ProposerType::Recipient)
71-
| (ProposerType::Authority, ProposerType::Authority) => {}
72-
_ => panic!("ChangeRequest.proposerType must match expected proposer type"),
73-
}
74-
7559
// Invariant 4: pdaNonce must be stored exactly as provided.
7660
invariant_eq!(
7761
post_cr.pdaNonce,

trident-tests/fuzz_ppv2/methods/ppv2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ impl FuzzTest {
303303
recipient_token_account,
304304
signer,
305305
TOKEN_PROGRAM_ID,
306-
ASSOCIATED_TOKEN_PROGRAM_ID,
307306
mint_governor::program_id(),
308307
mint_governor_event_authority,
309308
event_authority,

0 commit comments

Comments
 (0)