-
Notifications
You must be signed in to change notification settings - Fork 72
[Infra] Modify signaturure verification method #522
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
[Infra] Modify signaturure verification method #522
Conversation
|
I don't see any unexpected behaviour here. With the new implementation we could also ask the question "When does We return null when the inputs are invalid, or an exception has been thrown. With It's useful for a contract to know that an operation has failed and the For this particular method returning null to indicate failure might be fine. For the other parts of the API returning |
|
IMO the method should return empty array at worst case otherwise these null values bring null checks everywhere in codebase. |
|
Empty arrays can also be returned when the parameters are correct and there are no errors. So an empty array could indicate an error, but it could also be a valid result. We need a way to differentiate between the two. |
|
So I understand that the main issue is with returning |
|
Returning |
|
From client perspective empty array will not cause any side effect whether it is empty array becuse of success or failure. |
|
Sure, maybe not for this particular method. But it will be important somewhere else in the SCL API, and our methods need to be consistent. |
|
Does the library support extension methods? E.g.: This way we don't need the VerifySignatures method that's currently in the smart contract? Seems |
|
The library should not have knowledge of |
@rowandh, some things that are common coding practice, such as throwing exceptions from library methods, seem to be frowned upon when it comes to smart contracts. Is there also some weakness or limitation that smart contracts have - thereby making this bad coding practice for smart contracts? |
|
@quantumagi it's largely to do with the type of programming paradigm that we want people to follow when writing contracts. Because of the inability to easily patch bugs and the potential for funds to be lost, things that behave in unexpected ways can quickly become problematic. Because of this, we want to guide people to a 'happy path' where it's difficult to make these kinds of errors. |
rowandh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@rowandh , besides the points @YakupIpek is making regarding "expected behaviour" there is also the issue of converting the challenge to bytes, which probably can't / shouldn't be done within the contract. As such we should have the option of either passing the challenge/message as bytes or as a string.
Regarding Yakup's points. I thought the same and assumed it was only my opinion, however having this confirmed makes me think most users may feel this way.