Update arbitrary_cpi lint to check for Instruction and CpiContext::new calls #91
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The lint is updated to check for
Instruction {...}
initialization instead ofinvoke
calls. As a result,invoke
,invoke_signed
calls.invoke -> Instruction -> program
, the lint can directly getInstruction -> program
Instruction
used byinvoke
is returned by a function defined in a dependency.The updated lint also checks for calls to
CpiContext::new
andCpiContext::new_with_signer
which are common in Anchor programs. The lint reports the call unless the program is the return value of.to_account_info()
called on AnchorProgram
orInterface
.The majority of the updates could be implemented using HIR. However, some of the old functions written in MIR are reused and The lint requires further updates which most probably can only be implemented in MIR. Hence, the updates to lint also rely on MIR.