anchor
anchor copied to clipboard
Added safety check to IDL write instruction handler.
I think this is the correct logic for issue #1149 but I could use some advice on how best to test/verify the behavior. What is your typical development workflow for working on these generated IDL handlers?
hey @kevinaud Id like to merge this. Are you interested in updating this? If not, I can also take over.
Sorry for the delayed response, haven't had free time to work on this lately. Feel free to take over :)
There's a lot of old janky stuff with the IDL instructions. The fact that the authority can accidentally passed in the IDL account instead of the buffer here is one of them for sure. It would be nicer if this could be added as a constraint on the account struct but that's not possible because 1: we won't have the program id and 2: idlAccounts is used for another instruction, setAuthority, as well.constraint = idl.key != IdlAccount::address(program_id)
The other thing that would be cool to add as well is loading up the program's metadata account and using that as the idl authority instead of whoever manually sets it once the program is uploaded. All of this is just more work and means modifying all of the other code built on top of this, like the ts idl functions and the cli stuff.