Skip to content

Commit

Permalink
cli: Inform users to rebuild their programs after running keys sync (
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto authored Oct 8, 2024
1 parent 8b67b67 commit 6eb4cc7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4502,6 +4502,7 @@ fn keys_sync(cfg_override: &ConfigOverride, program_name: Option<String>) -> 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();
Expand All @@ -4527,6 +4528,7 @@ fn keys_sync(cfg_override: &ConfigOverride, program_name: Option<String>) -> 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;
}
Expand Down Expand Up @@ -4555,6 +4557,9 @@ fn keys_sync(cfg_override: &ConfigOverride, program_name: Option<String>) -> Res
}

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

Ok(())
})
Expand Down

0 comments on commit 6eb4cc7

Please sign in to comment.