@@ -169,7 +169,7 @@ pub enum ProgramCliCommand {
169
169
use_lamports_unit : bool ,
170
170
bypass_warning : bool ,
171
171
} ,
172
- ExtendProgram {
172
+ ExtendProgramChecked {
173
173
program_pubkey : Pubkey ,
174
174
additional_bytes : u32 ,
175
175
} ,
@@ -1018,7 +1018,7 @@ pub fn parse_program_subcommand(
1018
1018
) ?;
1019
1019
1020
1020
CliCommandInfo {
1021
- command : CliCommand :: Program ( ProgramCliCommand :: ExtendProgram {
1021
+ command : CliCommand :: Program ( ProgramCliCommand :: ExtendProgramChecked {
1022
1022
program_pubkey,
1023
1023
additional_bytes,
1024
1024
} ) ,
@@ -1231,7 +1231,7 @@ pub fn process_program_subcommand(
1231
1231
* use_lamports_unit,
1232
1232
* bypass_warning,
1233
1233
) ,
1234
- ProgramCliCommand :: ExtendProgram {
1234
+ ProgramCliCommand :: ExtendProgramChecked {
1235
1235
program_pubkey,
1236
1236
additional_bytes,
1237
1237
} => process_extend_program ( & rpc_client, config, * program_pubkey, * additional_bytes) ,
@@ -2411,21 +2411,28 @@ fn process_extend_program(
2411
2411
_ => Err ( format ! ( "Program {program_pubkey} is closed" ) ) ,
2412
2412
} ?;
2413
2413
2414
- match upgrade_authority_address {
2415
- None => Err ( format ! ( "Program {program_pubkey} is not upgradeable" ) ) ,
2416
- _ => Ok ( ( ) ) ,
2417
- } ?;
2414
+ let upgrade_authority_address = upgrade_authority_address
2415
+ . ok_or_else ( || format ! ( "Program {program_pubkey} is not upgradeable" ) ) ?;
2418
2416
2419
2417
let blockhash = rpc_client. get_latest_blockhash ( ) ?;
2420
-
2421
- let mut tx = Transaction :: new_unsigned ( Message :: new (
2422
- & [ loader_v3_instruction:: extend_program (
2423
- & program_pubkey,
2424
- Some ( & payer_pubkey) ,
2425
- additional_bytes,
2426
- ) ] ,
2427
- Some ( & payer_pubkey) ,
2428
- ) ) ;
2418
+ let feature_set = fetch_feature_set ( rpc_client) ?;
2419
+
2420
+ let instruction =
2421
+ if feature_set. is_active ( & agave_feature_set:: enable_extend_program_checked:: id ( ) ) {
2422
+ loader_v3_instruction:: extend_program_checked (
2423
+ & program_pubkey,
2424
+ & upgrade_authority_address,
2425
+ Some ( & payer_pubkey) ,
2426
+ additional_bytes,
2427
+ )
2428
+ } else {
2429
+ loader_v3_instruction:: extend_program (
2430
+ & program_pubkey,
2431
+ Some ( & payer_pubkey) ,
2432
+ additional_bytes,
2433
+ )
2434
+ } ;
2435
+ let mut tx = Transaction :: new_unsigned ( Message :: new ( & [ instruction] , Some ( & payer_pubkey) ) ) ;
2429
2436
2430
2437
tx. try_sign ( & [ config. signers [ 0 ] ] , blockhash) ?;
2431
2438
let result = rpc_client. send_and_confirm_transaction_with_spinner_and_config (
@@ -4406,7 +4413,7 @@ mod tests {
4406
4413
assert_eq ! (
4407
4414
parse_command( & test_command, & default_signer, & mut None ) . unwrap( ) ,
4408
4415
CliCommandInfo {
4409
- command: CliCommand :: Program ( ProgramCliCommand :: ExtendProgram {
4416
+ command: CliCommand :: Program ( ProgramCliCommand :: ExtendProgramChecked {
4410
4417
program_pubkey,
4411
4418
additional_bytes
4412
4419
} ) ,
0 commit comments