@@ -126,6 +126,72 @@ fn test_multiple_transfers_with_persistent_state() {
126126 ) ;
127127}
128128
129+ #[ test]
130+ fn test_account_store_sysvar_account ( ) {
131+ let mollusk = Mollusk :: default ( ) ;
132+ let context = mollusk. with_context ( HashMap :: new ( ) ) ;
133+
134+ // Use Clock sysvar as an example.
135+ let clock_pubkey = solana_sdk_ids:: sysvar:: clock:: id ( ) ;
136+ let recipient = Pubkey :: new_unique ( ) ;
137+
138+ // Create an instruction that references the Clock sysvar.
139+ let instruction = solana_instruction:: Instruction :: new_with_bytes (
140+ solana_sdk_ids:: system_program:: id ( ) ,
141+ & [ ] ,
142+ vec ! [
143+ solana_instruction:: AccountMeta :: new_readonly( clock_pubkey, false ) ,
144+ solana_instruction:: AccountMeta :: new( recipient, false ) ,
145+ ] ,
146+ ) ;
147+
148+ // Process the instruction - this should load the Clock sysvar account.
149+ context. process_instruction ( & instruction) ;
150+
151+ // Verify the Clock sysvar was loaded correctly.
152+ let store = context. account_store . borrow ( ) ;
153+ let clock_account = store. get ( & clock_pubkey) . expect ( "Clock sysvar should exist" ) ;
154+
155+ // Verify it has the expected owner.
156+ assert_eq ! ( clock_account. owner, solana_sdk_ids:: sysvar:: id( ) ) ;
157+ // Verify it has data (Clock sysvar should have serialized Clock data).
158+ assert ! ( !clock_account. data. is_empty( ) ) ;
159+ }
160+
161+ #[ test]
162+ fn test_account_store_program_account ( ) {
163+ // Use the System Program as an example.
164+ let program_id = solana_sdk_ids:: system_program:: id ( ) ;
165+ let mollusk = Mollusk :: default ( ) ;
166+
167+ let context = mollusk. with_context ( HashMap :: new ( ) ) ;
168+ let recipient = Pubkey :: new_unique ( ) ;
169+
170+ // Create an instruction that references the program account.
171+ let instruction = solana_instruction:: Instruction :: new_with_bytes (
172+ solana_sdk_ids:: bpf_loader_upgradeable:: id ( ) ,
173+ & [ ] ,
174+ vec ! [
175+ solana_instruction:: AccountMeta :: new_readonly( program_id, false ) ,
176+ solana_instruction:: AccountMeta :: new( recipient, false ) ,
177+ ] ,
178+ ) ;
179+
180+ // Process the instruction - this should load the program account.
181+ context. process_instruction ( & instruction) ;
182+
183+ // Verify the program account was loaded correctly
184+ let store = context. account_store . borrow ( ) ;
185+ let program_account = store
186+ . get ( & program_id)
187+ . expect ( "Program account should exist" ) ;
188+
189+ // Verify it has the expected owner (native loader for builtins).
190+ assert_eq ! ( program_account. owner, solana_sdk_ids:: native_loader:: id( ) ) ;
191+ // Verify it's marked as executable.
192+ assert ! ( program_account. executable) ;
193+ }
194+
129195#[ test]
130196fn test_account_store_default_account ( ) {
131197 let mollusk = Mollusk :: default ( ) ;
0 commit comments