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

Redundant Copy-Paste of Program IDs #2454

Closed
buffalojoec opened this issue Apr 10, 2023 · 3 comments
Closed

Redundant Copy-Paste of Program IDs #2454

buffalojoec opened this issue Apr 10, 2023 · 3 comments

Comments

@buffalojoec
Copy link
Contributor

How can we possibly make this process smoother or go away completely?

There's two spots that can drive a dev crazy whenever a fresh build is done, or if you're developing locally and do a cargo clean:

  • Anchor.toml
  • lib.rs : declare_id

Is there any way we can eliminate some of the redundancy of the process of updating your program's ID?

For context, I know the process most devs typically fall into is as follows:

  • cargo clean or anchor build for the first time
  • anchor deploy
    • Now, here the CLI will spit out the new Program ID, so you can either end up with this error below or go straight to step 3:
    • Try to hit your program and get the Incorrect program ID error
  • Update the program ID in declare_id and Anchor.toml
  • anchor build again
@acheroncrypto
Copy link
Collaborator

I agree Anchor should handle this internally. In the meantime, people can use watchso, a hot-reloading tool, that also updates the program id in the case of mismatch between the declared one and the created public key in target/deploy folder.

@ghost
Copy link

ghost commented Apr 12, 2023

I agree Anchor should handle this internally. In the meantime, people can use watchso, a hot-reloading tool, that also updates the program id in the case of mismatch between the declared one and the created public key in target/deploy folder.

My tool, create-solana-starter, also handles this, but only covers Anchor so far. I'll take a look at yours and see if it makes sense to integrate it.

@acheroncrypto
Copy link
Collaborator

Fixed in #2509.

Programs start with the correct program id and there is a new command anchor keys sync that has been added in #2505 to sync on demand.

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

No branches or pull requests

2 participants