solana-web3.js icon indicating copy to clipboard operation
solana-web3.js copied to clipboard

[experimental] program derived address assertion and type guard functions don't actually assert that the address is off the curve

Open steveluscher opened this issue 2 years ago • 2 comments

assertIsProgramDerivedAddress and isProgramDerivedAddress don't actually check to see if the address is off the curve. All they do is validate the format of the tuple.

Someone could supply a regular on-curve address there and have those guards pass.

The job is to add in the off-curve check, and to write tests.

NOTE: This still does nothing to assert that the bump seed is the correct one given the address supplied. Thoughts?

steveluscher avatar Oct 23 '23 00:10 steveluscher

Sure I can make that change. Both methods will become async functions but I don't think that's an issue (EDIT: It's an issue).

RE the bump: it's only valid in conjunction with an array of seeds so there would be no way to assert it's valid unless we require the seeds. Maybe that's the job for another helper method like verifyProgramDerivedAddress(pda, seeds)?

lorisleiva avatar Oct 23 '23 10:10 lorisleiva

Both methods will become async functions but I don't think that's an issue.

🪦 https://github.com/microsoft/TypeScript/issues/37681#issuecomment-1650605236

steveluscher avatar Oct 24 '23 02:10 steveluscher

Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up.

github-actions[bot] avatar Nov 11 '24 08:11 github-actions[bot]