-
Notifications
You must be signed in to change notification settings - Fork 659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ed25519 signature verification is not performed consistently by different implementations #2700
Comments
Can those issues be handled by restricting what keys we accept for accounts / validators? If no, what is the best course of action? |
I checked a few Ed25519 implementations, and here are the results:
Overall, I think that the behavior of |
@abacabadabacaba should we just switch to verify_strict? |
@ilblackdragon Regarding Ethereum's EIP 665, it has a couple of problems: in addition to depending on libsodium's implementation with its nonstandard behavior, it requires the message to be exactly 32 bytes long for no good reason. Anyway, I don't think that we should adapt our behavior to an EIP that is not even accepted. By the time they accept it (if it ever happens), we may already switch to using aggregate signatures or even something different. |
On a second thought, we might even switch the bridge. |
So are we closing this issue and just document exact formula for verification? @abacabadabacaba |
Yes, and open separate issues for every implementation that doesn't follow the expected behavior. For near-api-js, this is near/near-api-js#343. |
Different implementations of Ed25519 signature verification do not work in the same way. There are signatures that are accepted by some implementations but not the others. This may lead to multiple ways to attack the network:
At the moment, I am aware of the following implementation-specific behaviors:
This issue underscores the importance of having a full specification of all aspects of blockchain verification behavior, including all cryptographic operations. Merely pointing to external standards is not sufficient, because they may not prescribe a single correct behavior, and having such a behavior is necessary for consensus safety.
Note: in the past, Bitcoin had a similar issue with ECDSA-secp256k1 signatures that it uses. After that, new implementations were developed with the aim of having a consistent behavior across all implementation (and also preventing signature malleability, which fortunately doesn't affect the newer Ed25519 implementations). Therefore, the current use of ECDSA-secp256k1 signatures is likely not affected by a similar issue, but this still needs to be checked.
The text was updated successfully, but these errors were encountered: