Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: use separate program id for dev env #87

Merged
merged 15 commits into from
Feb 27, 2025
Merged

feat: use separate program id for dev env #87

merged 15 commits into from
Feb 27, 2025

Conversation

skosito
Copy link
Contributor

@skosito skosito commented Feb 26, 2025

Using features it is possible to toggle between different program ids.

However, in latest anchor 0.30.1 there is a bug preventing that coral-xyz/anchor#3465

It is stated in issue that fixed commit can be used. Normally it is not ok to use non-released version like this, but this is just couple of commits after 0.30.1, and all those commits are not breaking or anything that would have impact.

With this, anchor build would work like currently, and anchor build -- --features="dev" would create IDL with dev program id we use for development in localnet, node etc.

@skosito skosito requested a review from a team as a code owner February 26, 2025 14:58
@codecov-commenter
Copy link

codecov-commenter commented Feb 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.74%. Comparing base (72c0780) to head (b9e3ea6).

Additional details and impacted files
@@          Coverage Diff          @@
##            main     #87   +/-   ##
=====================================
  Coverage   0.74%   0.74%           
=====================================
  Files          1       1           
  Lines        667     667           
=====================================
  Hits           5       5           
  Misses       662     662           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@skosito skosito marked this pull request as draft February 26, 2025 16:09
@fadeev
Copy link
Member

fadeev commented Feb 26, 2025

@skosito when I run:

anchor build -- --features="dev"

I get:

error: none of the selected packages contains these features: dev, did you mean: cpi?

@skosito
Copy link
Contributor Author

skosito commented Feb 26, 2025

@skosito when I run:

anchor build -- --features="dev"

I get:

error: none of the selected packages contains these features: dev, did you mean: cpi?

sorry forgot to mention, can you please try running from gateway folder?

@skosito skosito marked this pull request as ready for review February 27, 2025 01:28
@fadeev
Copy link
Member

fadeev commented Feb 27, 2025

Running build from the gateway dir works!

@skosito gateway keypair that is generated:

[129,137,210,227,249,110,205,33,44,42,112,15,204,173,41,17,7,155...

differs from the one being used in localnet:

https://github.com/zeta-chain/localnet/blob/2282ca00d82075c84c7b16ffe6e455b665042f26/packages/localnet/src/solana/deploy/gateway-keypair.json

Is this important?

@skosito
Copy link
Contributor Author

skosito commented Feb 27, 2025

Running build from the gateway dir works!

@skosito gateway keypair that is generated:

[129,137,210,227,249,110,205,33,44,42,112,15,204,173,41,17,7,155...

differs from the one being used in localnet:

https://github.com/zeta-chain/localnet/blob/2282ca00d82075c84c7b16ffe6e455b665042f26/packages/localnet/src/solana/deploy/gateway-keypair.json

Is this important?

i think we just need to use correct key pair when we deploy program (it is deployment key pair), for IDL generation it doesn't matter
so in places where we deploy with dev program id, we need proper keypair, but here we don't
keypair for dev gateway is public anyways in node repo

@fadeev
Copy link
Member

fadeev commented Feb 27, 2025

Ok, so I suppose we can copy this file:

https://github.com/zeta-chain/node/blob/4e5c732c4d6980f8e1599928a87ef8408225481c/contrib/localnet/solana/gateway-keypair.json

From the node repo into protocol-contracts-solana so that it's published on npm alongside the gateway IDL.

@skosito
Copy link
Contributor Author

skosito commented Feb 27, 2025

Ok, so I suppose we can copy this file:

https://github.com/zeta-chain/node/blob/4e5c732c4d6980f8e1599928a87ef8408225481c/contrib/localnet/solana/gateway-keypair.json

From the node repo into protocol-contracts-solana so that it's published on npm alongside the gateway IDL.

lets do that in separate PR, i also have 1 more question, since our prod program id starts with Zeta prefix, do we want to generate dev program id with specific prefix so it is better from UI/UX perspective, or keeping this random one is ok?

@skosito skosito merged commit 3296159 into main Feb 27, 2025
14 checks passed
@skosito skosito deleted the dev-program-id branch February 27, 2025 16:10
@fadeev
Copy link
Member

fadeev commented Mar 3, 2025

@skosito I think a random program ID for dev purposes is fine.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants