Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable anchor keys sync auto-replacement by removing program_id_from_env! #1282

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

nazreen
Copy link
Contributor

@nazreen nazreen commented Feb 14, 2025

Context

  • Currently, we require developers to manually replace the program ID in the OFT's lib.rs. This creates an opportunity for human error. We have encountered cases where the developer has forgotten to do this. This will not result in an error during program deployment, but will come up when running the init-config/wire commands.
    • Impact: re-building and re-deployment would be required
  • We already ask developers to run anchor keys sync, which normally would remove the need for the above manual programId replacement. However, it won't auto replace the value since we use Pubkey::new_from_array(program_id_from_env!(XXX))

Motivation

If we remove the usage of program_id_from_env!, then we can remove the need for manual replacement of programId, thereby removing once opportunity for human error during development. Replacement is handled by the existing anchor keys sync command. Improved DevEx unlocked.

Changes

  • Removed program_id_from_env! from declare_id!

@nazreen nazreen changed the title remove env var usage in declare_id! feat: enable anchor keys sync auto-replacement by removing program_id_from_env! Feb 14, 2025
@nazreen nazreen requested review from St0rmBr3w, DanL0 and ryandgoulding and removed request for St0rmBr3w and DanL0 February 18, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants