Skip to content

Commit f231afc

Browse files
cli: Inform users to rebuild their programs after running keys sync (otter-sec#3299)
1 parent 5c379aa commit f231afc

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

cli/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4502,6 +4502,7 @@ fn keys_sync(cfg_override: &ConfigOverride, program_name: Option<String>) -> Res
45024502
.build()
45034503
.unwrap();
45044504

4505+
let mut changed_src = false;
45054506
for program in cfg.get_programs(program_name)? {
45064507
// Get the pubkey from the keypair file
45074508
let actual_program_id = program.pubkey()?.to_string();
@@ -4527,6 +4528,7 @@ fn keys_sync(cfg_override: &ConfigOverride, program_name: Option<String>) -> Res
45274528
content.replace_range(program_id_match.range(), &actual_program_id);
45284529
fs::write(&path, content)?;
45294530

4531+
changed_src = true;
45304532
println!("Updated to {actual_program_id}\n");
45314533
break;
45324534
}
@@ -4555,6 +4557,9 @@ fn keys_sync(cfg_override: &ConfigOverride, program_name: Option<String>) -> Res
45554557
}
45564558

45574559
println!("All program id declarations are synced.");
4560+
if changed_src {
4561+
println!("Please rebuild the program to update the generated artifacts.")
4562+
}
45584563

45594564
Ok(())
45604565
})

0 commit comments

Comments
 (0)