idl: Fix missing program::seed
resolution
#3474
Merged
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.
Problem
If
seeds
gets parsed successfully butprogram::seed
fails to get parsed, the generated account in the IDL hasseeds
field, but it does not have the program information. I noticed this while answering another related problem in #3471 (comment).For example:
Outputs (incorrectly):
This is because using external functions (
System::id()
in this example) is not currently supported (see #2903), which means this is a bug that will lead to incorrect account resolution.Summary of changes
Fix missing
program::seed
resolution by changing the logic to the following:seeds
andseeds::program
get parsed succcessfuly, include both in the IDLpda
field generation completely.The above example now outputs (because
seeds::program
fails to get parsed):This means there will be no error, but the user will need to manually find the address of the
pda
account.