Description
Hello :),
First, thank you for your work on this example. I was able to set up and test the implementation, and it works great.
I've been reviewing the Ed25519 verification logic and believe we can safely remove the sig
parameter from the verification functions without compromising security. Here's my reasoning and I would love to have your feedback:
-
Signature is already embedded in the instruction: We retrieve the signature directly from the Ed25519Program instruction data.
-
Message is a cryptographic hash: The message being signed is typically a hash (using
solana_program::hash::hashv
or SHA256) of our program's instruction arguments, plus additional parameters like expiration timestamps. -
Our verification logic already handles the essential checks: We verify that:
- The public key matches between our instruction and the Ed25519Program instruction
- The reconstructed message hash matches the one passed to the Ed25519Program
- The signature is the result of message hash signed by public key
The verification logic would still validate without this extra signature passed as a parameter.
Does this analysis make sense? I believe this change would simplify the API without reducing security.
I'd love to hear your thoughts on whether this approach is sound or if there are security considerations I might be missing.
Thanks :)