You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When multiple crates exists in an Anchor program (e.g. by including a tests integration folder), the IDL file generated by anchor build will have an empty address property.
Expected Behavior
The IDL JSON file for the program is generated with the correct address property.
Actual Behavior
The address property in the IDL file is empty.
Environment
Component
Version
Anchor
0.30.1
Solana CLI
1.18.26
Reproduction Steps
# 1. Generate a new Anchor project
anchor init idl-multi-crate-bug
cd idl-multi-crate-bug
# 2. Run a build to confirm the IDL file includes a program address
anchor build
grep address target/idl/idl_multi_crate_bug.json # => e.g. "address": "7RuRMKRpVsW7A9BBxLfJVijbfNc1F1xAaSHNhEgJRNP4",# 3. Add a dummy Rust integration test folder
mkdir programs/idl-multi-crate-bug/tests
touch programs/idl-multi-crate-bug/tests/dummy-test.rs
# 4. Trigger another build
anchor build
# 5. Verify the address property in the IDL file is now empty
grep address target/idl/idl_multi_crate_bug.json # => "address": "",
Analysis
It appears that when multiple crates exists in a package, the IDL build tool is confused and unable to insert the program address into the program's IDL file.
For example, if a binary crate is included in an Anchor program (e.g. by defining /src/main.rs), the same bug is triggered.
The text was updated successfully, but these errors were encountered:
dhl
changed the title
Empty address in IDL file when multiple crates exists within an Anchor program package
Empty address in IDL file when multiple crates exist within an Anchor program package
Nov 29, 2024
Problem
When multiple crates exists in an Anchor program (e.g. by including a
tests
integration folder), the IDL file generated byanchor build
will have an emptyaddress
property.Expected Behavior
The IDL JSON file for the program is generated with the correct
address
property.Actual Behavior
The
address
property in the IDL file is empty.Environment
Reproduction Steps
Analysis
It appears that when multiple crates exists in a package, the IDL build tool is confused and unable to insert the program address into the program's IDL file.
For example, if a binary crate is included in an Anchor program (e.g. by defining
/src/main.rs
), the same bug is triggered.The text was updated successfully, but these errors were encountered: