1

I tried to make a CPI call from puppret_master to puppet program exactly like the anchor document and i did everything right but "program" AND "cpi" keywords are still unkown for my puppet_master program ! what should i do ?!

enter image description here

enter image description here

1 Answer 1

1

There are a few areas to investigate based on the information that you've shared:

Anchor Version

You want to make sure that both puppet and puppet_master are using the same Anchor version ("0.28.0") to ensure compatibility

Cargo.toml

You've set cpi = ["no-entrypoint"] in your puppet_master's Cargo.toml. You want to make sure that puppet also contains this feature definition. When the cpi feature is dependent on the no-entrypoint feature, this configuration is needed for CPIs to function correctly as they would be following the same feature constraints. A consistent feature flag ensures that the calling and called contracts have predictable behavior. Without more context, it's hard to know whether there's complete consistency among all your features

Setting no-idl = [] could potentially be an issue if, for some reason, the puppet_master program needs to dynamically understand or parse the IDL of puppet. The no-idl feature would be an obstacle for this as IDL describes how to call functions in another contract. I note that this is a potential issue as you're already using the source code to include puppet as a dependency. Nonetheless, it is something to consider

Imports

Ensure that your imports for puppet::cpi are done correctly

Cache, Toolchain, Refreshing

You could try invalidating your, what looks like to be, VSCode's cache and running rustup update. I'd also recommend reloading the developer window by opening the command palette (Ctrl + Shift + P) and executing the command >Reload Window.

After checking and updating everything, try rebuilding both the puppet and puppet_master projects.

Hopefully this was helpful! Let me know if need any more help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.