Skip to content

Commit 2486402

Browse files
committed
extra test case(cpi_guard)
1 parent 4f29684 commit 2486402

File tree

1 file changed

+23
-1
lines changed
  • tokens/token-2022/cpi-guard/steel/program/tests

1 file changed

+23
-1
lines changed

tokens/token-2022/cpi-guard/steel/program/tests/test.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ use solana_sdk::{
55
transaction::Transaction,
66
};
77
use spl_token_2022::{
8-
extension::{cpi_guard::instruction::enable_cpi_guard, ExtensionType},
8+
extension::{
9+
cpi_guard::instruction::{disable_cpi_guard, enable_cpi_guard},
10+
ExtensionType,
11+
},
912
instruction::{initialize_account3, initialize_mint2},
1013
state::{Account, Mint},
1114
};
@@ -108,4 +111,23 @@ async fn run_test() {
108111
"Expected TokenError::CpiGuardBurnBlocked(43) , got: {}",
109112
err_string
110113
);
114+
115+
//Disable CPI Guard and try burn again, should pass
116+
let disable_cpi_ix = disable_cpi_guard(
117+
&spl_token_2022::ID,
118+
&token_acc.pubkey(),
119+
&payer.pubkey(),
120+
&[],
121+
)
122+
.unwrap();
123+
let cpi_burn_ix = cpi_burn(payer.pubkey(), mint.pubkey(), token_acc.pubkey());
124+
125+
let tx = Transaction::new_signed_with_payer(
126+
&[disable_cpi_ix, cpi_burn_ix],
127+
Some(&payer.pubkey()),
128+
&[&payer],
129+
blockhash,
130+
);
131+
let res = banks.process_transaction(tx).await;
132+
assert!(res.is_ok());
111133
}

0 commit comments

Comments
 (0)