Skip to content

lang: add AnchorProgram trait to make declare_id! optional#4293

Open
AvhiMaz wants to merge 10 commits intosolana-foundation:masterfrom
AvhiMaz:feat/anchor-program-trait
Open

lang: add AnchorProgram trait to make declare_id! optional#4293
AvhiMaz wants to merge 10 commits intosolana-foundation:masterfrom
AvhiMaz:feat/anchor-program-trait

Conversation

@AvhiMaz
Copy link

@AvhiMaz AvhiMaz commented Mar 7, 2026

Summary

makes declare_id! optional by introducing the AnchorProgram trait with const ID
as an associated constant, replacing the hardcoded global static in the entrypoint.
programs can now declare their ID inline inside the #[program] module instead of
relying on declare_id!, enabling flexible multi-instance deployments and easier testing.

Closes

@vercel
Copy link

vercel bot commented Mar 7, 2026

@AvhiMaz is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
@AvhiMaz AvhiMaz force-pushed the feat/anchor-program-trait branch from 5e5fabe to 84f267a Compare March 7, 2026 06:12
Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
AvhiMaz added 2 commits March 7, 2026 12:31
Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
@AvhiMaz AvhiMaz force-pushed the feat/anchor-program-trait branch from d6b9fc0 to 9eaea21 Compare March 7, 2026 07:26
AvhiMaz added 4 commits March 7, 2026 13:06
Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
@AvhiMaz AvhiMaz marked this pull request as ready for review March 7, 2026 08:09
@AvhiMaz
Copy link
Author

AvhiMaz commented Mar 7, 2026

gm @nutafrost, MR is ready for review, happy to make further changes. thanks :)

Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
@jamie-osec
Copy link
Collaborator

Please address the CI failures

Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
@AvhiMaz
Copy link
Author

AvhiMaz commented Mar 10, 2026

Please address the CI failures

@jamie-osec pushed some changes, hope ci passes now. i’m still concerned about the bench. it increased some cus in the tests/bench, but ig that’s because i’m using the latest version of solana cli. let’s see if the ci gets green 🤞🏻

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