coral-xyz / anchor

âš“ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.62k stars 1.33k forks source link

lang: Anchor IDL should be uploaded to program binary instead of separate PDA #3225

Open ngundotra opened 1 month ago

ngundotra commented 1 month ago

To date, only 25% of Anchor programs have uploaded their IDL 🤯 (1,324 programs out of 5,335 anchor programs currently on mainnet).

If anchor IDLs were uploaded with program binaries, then we would have 100% IDL adoption, leading to increased transparency on Solana.

Instead of requiring developers to write the compressed IDL bytes to the IDL address, anchor build should write the zipped bytes to an ELF section called .anchor.idl. Example: https://github.com/nifty-oss/asset/blob/main/include-idl/src/lib.rs

Developers should still be able to opt-out of this default behavior and deploy the IDLs the old way.

acheroncrypto commented 1 month ago

Overall, this would be great.

If anchor IDLs were uploaded with program binaries, then we would have 100% IDL adoption, leading to increased transparency on Solana.

It would increase the percentage, but I don't think we'd ever see 100% IDL adoption, especially if we give people the chance to opt out of this behavior.

Developers should still be able to opt-out of this default behavior and deploy the IDLs the old way.

Is this for backwards compatibility? We have to get rid of the IDL instructions when the IDL exists in the binary, otherwise the binary size will grow significantly.

ngundotra commented 1 month ago

It would increase the percentage, but I don't think we'd ever see 100% IDL adoption, especially if we give people the chance to opt out of this behavior.

Yes this is true. I think aiming for 50% adoption or higher over next year would be attainable, with this change alone.

On backwards compatibility, I am agnostic.

On removing IDL instructions from the binary, this is super exciting because then deploying IDLs with your binary is essentially "free". In other words - this shouldn't change deployment costs 😄 ! That should make adopting this easier🤞