From 6eb4cc7539636983e768561ea9c528d59486799d Mon Sep 17 00:00:00 2001 From: acheron <98934430+acheroncrypto@users.noreply.github.com> Date: Wed, 9 Oct 2024 00:04:35 +0200 Subject: [PATCH] cli: Inform users to rebuild their programs after running `keys sync` (#3299) --- cli/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cli/src/lib.rs b/cli/src/lib.rs index bb1058e991..808e43d4e2 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -4502,6 +4502,7 @@ fn keys_sync(cfg_override: &ConfigOverride, program_name: Option) -> Res .build() .unwrap(); + let mut changed_src = false; for program in cfg.get_programs(program_name)? { // Get the pubkey from the keypair file let actual_program_id = program.pubkey()?.to_string(); @@ -4527,6 +4528,7 @@ fn keys_sync(cfg_override: &ConfigOverride, program_name: Option) -> Res content.replace_range(program_id_match.range(), &actual_program_id); fs::write(&path, content)?; + changed_src = true; println!("Updated to {actual_program_id}\n"); break; } @@ -4555,6 +4557,9 @@ fn keys_sync(cfg_override: &ConfigOverride, program_name: Option) -> Res } println!("All program id declarations are synced."); + if changed_src { + println!("Please rebuild the program to update the generated artifacts.") + } Ok(()) })