@@ -5,7 +5,7 @@ use integration_test_tools::IntegrationTestContext;
55use log:: * ;
66use program_schedulecommit:: api:: {
77 delegate_account_cpi_instruction, init_account_instruction,
8- init_order_book_instruction, init_payer_escrow,
8+ init_order_book_instruction, init_payer_escrow, UserSeeds ,
99} ;
1010use solana_rpc_client:: rpc_client:: { RpcClient , SerializableTransaction } ;
1111use solana_rpc_client_api:: config:: RpcSendTransactionConfig ;
@@ -31,7 +31,7 @@ pub struct ScheduleCommitTestContext {
3131 pub payer_ephem : Keypair ,
3232 // The Payer keypairs along with its PDA pubkey which we'll commit
3333 pub committees : Vec < ( Keypair , Pubkey ) > ,
34- user_seed : Vec < u8 > ,
34+ user_seed : UserSeeds ,
3535
3636 common_ctx : IntegrationTestContext ,
3737}
@@ -65,18 +65,18 @@ impl ScheduleCommitTestContext {
6565 // -----------------
6666 pub fn try_new_random_keys (
6767 ncommittees : usize ,
68- user_seed : & [ u8 ] ,
68+ user_seed : UserSeeds ,
6969 ) -> Result < Self > {
7070 Self :: try_new_internal ( ncommittees, true , user_seed)
7171 }
72- pub fn try_new ( ncommittees : usize , user_seed : & [ u8 ] ) -> Result < Self > {
72+ pub fn try_new ( ncommittees : usize , user_seed : UserSeeds ) -> Result < Self > {
7373 Self :: try_new_internal ( ncommittees, false , user_seed)
7474 }
7575
7676 fn try_new_internal (
7777 ncommittees : usize ,
7878 random_keys : bool ,
79- user_seed : & [ u8 ] ,
79+ user_seed : UserSeeds ,
8080 ) -> Result < Self > {
8181 let ictx = IntegrationTestContext :: try_new ( ) ?;
8282
@@ -113,7 +113,7 @@ impl ScheduleCommitTestContext {
113113 )
114114 . unwrap ( ) ;
115115 let ( pda, _bump) = Pubkey :: find_program_address (
116- & [ user_seed, payer_ephem. pubkey ( ) . as_ref ( ) ] ,
116+ & [ user_seed. bytes ( ) , payer_ephem. pubkey ( ) . as_ref ( ) ] ,
117117 & program_schedulecommit:: ID ,
118118 ) ;
119119 ( payer_ephem, pda)
@@ -155,7 +155,7 @@ impl ScheduleCommitTestContext {
155155 payer_ephem,
156156 committees,
157157 common_ctx : ictx,
158- user_seed : user_seed . to_vec ( ) ,
158+ user_seed,
159159 } )
160160 }
161161
@@ -167,8 +167,8 @@ impl ScheduleCommitTestContext {
167167 ComputeBudgetInstruction :: set_compute_unit_limit( 1_400_000 ) ,
168168 ComputeBudgetInstruction :: set_compute_unit_price( 10_000 ) ,
169169 ] ;
170- match self . user_seed . as_slice ( ) {
171- b"magic_schedule_commit" => {
170+ match self . user_seed {
171+ UserSeeds :: MagicScheduleCommit => {
172172 ixs. extend ( self . committees . iter ( ) . map (
173173 |( player, committee) | {
174174 init_account_instruction (
@@ -179,7 +179,7 @@ impl ScheduleCommitTestContext {
179179 } ,
180180 ) ) ;
181181 }
182- b"order_book" => {
182+ UserSeeds :: OrderBook => {
183183 ixs. extend ( self . committees . iter ( ) . map (
184184 |( book_manager, committee) | {
185185 init_order_book_instruction (
@@ -205,9 +205,6 @@ impl ScheduleCommitTestContext {
205205 // },
206206 // ));
207207 }
208- _ => {
209- return Err ( anyhow:: anyhow!( "Unsupported user_seed: {:?} ; expected b\" magic_schedule_commit\" or b\" order_book\" " , self . user_seed) ) ;
210- }
211208 } ;
212209
213210 let mut signers = self
@@ -272,7 +269,7 @@ impl ScheduleCommitTestContext {
272269 self . payer_chain . pubkey ( ) ,
273270 self . ephem_validator_identity ,
274271 player. pubkey ( ) ,
275- & self . user_seed ,
272+ self . user_seed ,
276273 ) ;
277274 ixs. push ( ix) ;
278275 }
0 commit comments