Skip to content

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

Open
AvhiMaz wants to merge 13 commits into
otter-sec:masterfrom
AvhiMaz:feat/anchor-program-trait
Open

lang: add AnchorProgram trait to make declare_id! optional#4293
AvhiMaz wants to merge 13 commits into
otter-sec:masterfrom
AvhiMaz:feat/anchor-program-trait

Conversation

@AvhiMaz
Copy link
Copy Markdown
Contributor

@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
Copy Markdown

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.

@AvhiMaz AvhiMaz force-pushed the feat/anchor-program-trait branch from 5e5fabe to 84f267a Compare March 7, 2026 06:12
Comment thread lang/syn/src/codegen/program/entry.rs
@AvhiMaz AvhiMaz force-pushed the feat/anchor-program-trait branch from d6b9fc0 to 9eaea21 Compare March 7, 2026 07:26
@AvhiMaz AvhiMaz marked this pull request as ready for review March 7, 2026 08:09
@AvhiMaz
Copy link
Copy Markdown
Contributor Author

AvhiMaz commented Mar 7, 2026

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

@jamie-osec
Copy link
Copy Markdown
Collaborator

Please address the CI failures

@AvhiMaz
Copy link
Copy Markdown
Contributor 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 🤞🏻

AvhiMaz added 10 commits March 19, 2026 23:20
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>
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>
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 ba4d76b to 6981c8c Compare March 19, 2026 18:01
@0x4ka5h
Copy link
Copy Markdown
Collaborator

0x4ka5h commented Apr 27, 2026

can you rebase and resolve conflicts?

Copy link
Copy Markdown
Collaborator

@0x4ka5h 0x4ka5h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new no-declare-id fixture is not actually run in CI

Comment thread lang/syn/src/codegen/program/entry.rs
@0x4ka5h
Copy link
Copy Markdown
Collaborator

0x4ka5h commented Apr 28, 2026

@AvhiMaz can you handle the failed CI + requested changes?

@AvhiMaz
Copy link
Copy Markdown
Contributor Author

AvhiMaz commented Apr 28, 2026

@AvhiMaz can you handle the failed CI + requested changes?

sure, on it 🫡

@AvhiMaz AvhiMaz force-pushed the feat/anchor-program-trait branch from 4b410cb to e277ca4 Compare April 29, 2026 01:19
Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
@AvhiMaz AvhiMaz force-pushed the feat/anchor-program-trait branch from e277ca4 to 96fd954 Compare April 29, 2026 01:40
@AvhiMaz AvhiMaz requested a review from 0x4ka5h April 29, 2026 01:53
Comment thread lang/syn/src/codegen/program/entry.rs
Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
@0x4ka5h 0x4ka5h requested a review from jamie-osec April 30, 2026 06:25
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.

3 participants