@@ -1772,8 +1772,18 @@ fn test_program_sbf_invoke_in_same_tx_as_redeployment() {
1772
1772
] ,
1773
1773
) ;
1774
1774
1775
- // Redeployment causes programs to be unavailable to both top-level-instructions and CPI instructions
1776
- for invoke_instruction in [ invoke_instruction, indirect_invoke_instruction] {
1775
+ // Redeployment fails when top-level-instructions invoke the program because of write lock demotion
1776
+ // and the program becomes unavailable to CPI instructions
1777
+ for ( invoke_instruction, expected_error) in [
1778
+ (
1779
+ invoke_instruction,
1780
+ TransactionError :: InstructionError ( 0 , InstructionError :: InvalidArgument ) ,
1781
+ ) ,
1782
+ (
1783
+ indirect_invoke_instruction,
1784
+ TransactionError :: InstructionError ( 2 , InstructionError :: UnsupportedProgramId ) ,
1785
+ ) ,
1786
+ ] {
1777
1787
// Call upgradeable program
1778
1788
let result =
1779
1789
bank_client. send_and_confirm_instruction ( & mint_keypair, invoke_instruction. clone ( ) ) ;
@@ -1794,10 +1804,7 @@ fn test_program_sbf_invoke_in_same_tx_as_redeployment() {
1794
1804
bank. last_blockhash ( ) ,
1795
1805
) ;
1796
1806
let ( result, _, _, _) = process_transaction_and_record_inner ( & bank, tx) ;
1797
- assert_eq ! (
1798
- result. unwrap_err( ) ,
1799
- TransactionError :: InstructionError ( 2 , InstructionError :: UnsupportedProgramId ) ,
1800
- ) ;
1807
+ assert_eq ! ( result. unwrap_err( ) , expected_error, ) ;
1801
1808
}
1802
1809
}
1803
1810
@@ -1848,8 +1855,18 @@ fn test_program_sbf_invoke_in_same_tx_as_undeployment() {
1848
1855
// Prepare undeployment
1849
1856
let undeployment_instruction = loader_v4:: retract ( & program_id, & authority_keypair. pubkey ( ) ) ;
1850
1857
1851
- // Undeployment is visible to both top-level-instructions and CPI instructions
1852
- for invoke_instruction in [ invoke_instruction, indirect_invoke_instruction] {
1858
+ // Undeployment fails when top-level-instructions invoke the program because of write lock demotion
1859
+ // and the program becomes unavailable to CPI instructions
1860
+ for ( invoke_instruction, expected_error) in [
1861
+ (
1862
+ invoke_instruction,
1863
+ TransactionError :: InstructionError ( 0 , InstructionError :: InvalidArgument ) ,
1864
+ ) ,
1865
+ (
1866
+ indirect_invoke_instruction,
1867
+ TransactionError :: InstructionError ( 1 , InstructionError :: UnsupportedProgramId ) ,
1868
+ ) ,
1869
+ ] {
1853
1870
// Call upgradeable program
1854
1871
let result =
1855
1872
bank_client. send_and_confirm_instruction ( & mint_keypair, invoke_instruction. clone ( ) ) ;
@@ -1866,10 +1883,7 @@ fn test_program_sbf_invoke_in_same_tx_as_undeployment() {
1866
1883
bank. last_blockhash ( ) ,
1867
1884
) ;
1868
1885
let ( result, _, _, _) = process_transaction_and_record_inner ( & bank, tx) ;
1869
- assert_eq ! (
1870
- result. unwrap_err( ) ,
1871
- TransactionError :: InstructionError ( 1 , InstructionError :: UnsupportedProgramId ) ,
1872
- ) ;
1886
+ assert_eq ! ( result. unwrap_err( ) , expected_error, ) ;
1873
1887
}
1874
1888
}
1875
1889
0 commit comments