Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

struct takes 0 lifetime arguments but 1 lifetime argument was supplied expected 0 lifetime arguments when using declare_program #3514

Open
jim4067 opened this issue Jan 27, 2025 · 1 comment
Labels
bug Something isn't working lang

Comments

@jim4067
Copy link
Contributor

jim4067 commented Jan 27, 2025

When using the declare_program! with the Kamino Lending program -> https://github.com/Kamino-Finance/klend, I can't get the project to build due to the error

struct takes 0 lifetime arguments but 1 lifetime argument was supplied expected 0 lifetime arguments

Image

What I've tried,

  • convert the IDL to the new spec but it still fails with the same error
  • switching solana version to 1.18.17

For quick reproducibility,
old idl -> https://gist.github.com/jim4067/eacd867f28d3761ba501cf7b31e3b93b

new idl -> https://gist.github.com/jim4067/9eaf7c91387deb3e79acc1700e0a456d

Anchor CLI - 0.30.1
Solana CLI - 2.0.22

@acheroncrypto acheroncrypto added bug Something isn't working lang labels Jan 28, 2025
@acheroncrypto
Copy link
Collaborator

This is because refresh_reserves_batch instruction doesn't have any accounts:

{
  "name": "refresh_reserves_batch",
  "discriminator": [144, 110, 26, 103, 162, 204, 252, 147],
  "accounts": [],
  "args": [
    {
      "name": "skip_price_updates",
      "type": "bool"
    }
  ]
}

Essentially the same issue as #1628, but with declare_program! instead of a dependency with cpi feature.

It should be quite easy to fix this for declare_program! since we already know the amount of accounts the instruction expects (which is not the case for the regular dependency import with cpi feature enabled).

Thanks for the report! I'll fix this this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lang
Projects
None yet
Development

No branches or pull requests

2 participants