coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.36k stars 1.25k forks source link

fix: recursive idl gen #2946

Closed guibescos closed 2 months ago

guibescos commented 2 months ago

There's a bug in the logic for adding external types from other crates into the idl.

The way it works is a macro that :

The bug I'm trying to fix appears in a recursive situation where a program A imports a type from crate B which uses a type from crate C. When the macro gets expanded in crate B, it is incapable of finding the Cargo.lock of the project and panics (this is because at that point the working directory is the ~/.cargo/registry and not the anchor workspace ).

I propose to update the code so Cargo.lock is searched from the program path.

Here's a reproducible example: https://github.com/diyahir/minimal-pyth-version-error

vercel[bot] commented 2 months ago

@guibescos is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

guibescos commented 2 months ago

Addressed the comments