anchor icon indicating copy to clipboard operation
anchor copied to clipboard

Unable to upload Solang generated idl

Open CrossedCarpet opened this issue 1 year ago • 8 comments

Steps to reproduce:

  • anchor init testprogram --solidity
  • anchor build
  • anchor keys sync
  • anchor idl init -f target/idl/testprogram.json `solana address -k target/deploy/testprogram-keypair.json`

This last commands outputs:

Error: RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: invalid program argument [3 log messages]

Caused by:
    RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: invalid program argument [3 log messages]

I haven't been able to find any solution for this. I also do not know how to access those [3 log messages].

edit

These are my program versions in case it's some compatibility issue:

  • solana-cli 1.16.17
  • anchor-cli 0.28.0
  • solang version v0.3.2

CrossedCarpet avatar Oct 24 '23 14:10 CrossedCarpet

@seanyoung any insight?

acheroncrypto avatar Oct 24 '23 14:10 acheroncrypto

I'm aware of this, I have not fully debugged it yet. It certainly looks like a solang issue.

seanyoung avatar Oct 24 '23 15:10 seanyoung

Is there a workaround where I can load the idl from a file within my webapp?

CrossedCarpet avatar Oct 24 '23 15:10 CrossedCarpet

Is there a workaround where I can load the idl from a file within my webapp?

Yes, the IDL is just a JSON file, you can load it from anywhere and pass it to new anchor.Program(idl, ...).

acheroncrypto avatar Oct 24 '23 16:10 acheroncrypto

Ah that's right, thanks!

I was looking for a way to modify: const idl = await Program.fetchIdl(programID, getProvider());

But a simple import idl from "./testprogram.json"; suffices.

CrossedCarpet avatar Oct 24 '23 16:10 CrossedCarpet

I am having issue initing my idl too. Worth noting that I am able to upgrade existing idls. But unable to init a new idl.

solana-cli 1.16.18 anchor-cli 0.29.0

conky-dev avatar Oct 29 '23 19:10 conky-dev

linking https://solana.stackexchange.com/questions/7897/anchor-idl-upgrade-triggers-require-gte-expression-was-violated if it isnt by any chance related. you can add https://github.com/amilkov3/anchor/commit/b9d85109b6ea318a98a0ab6fce334c1cc9d077f3 and then recompile anchor and run ./target/deploy/anchor init .... to print the error logs to figure out what the actual errors is

also is this project even being maintained anymore? like can barely get an answer on discord or anywhere else

amilkov3 avatar Oct 31 '23 15:10 amilkov3

@conky-dev @amilkov3

This issue is related to Solang only, please create a new issue if you don't use Solang.

acheroncrypto avatar Oct 31 '23 16:10 acheroncrypto