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
rpc: fix invalid parameter error codes for {sign,verify}message RPCs #18466
rpc: fix invalid parameter error codes for {sign,verify}message RPCs #18466
Conversation
16f22f9
to
d208f80
Compare
Do we have guidelines on what error code to use? |
Not that I know of, I was just orienting myself on what most other RPCs receiving address parameters use as error codes (see e.g.
). Even without guideline I'd assume it's common practice to choose the most specific error code, and only use the more more generic one (like |
I think it's good to be consistent here, whether there are guidelines or not. To return the same return values for the same kind of errors over different RPC calls. I do agree this change needs a release notes mention. Some people depend on specific return values, see e.g. talaia-labs/python-teos#37 (which is not relevant to this specific RPCs). |
checks parameter validity and error codes for the related RPCs: - signmessagewithprivkey - signmessage - verifymessage
d208f80
to
a5cfb40
Compare
Added a relase note commit and rebased on master. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
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.
utACK
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.
utACK a5cfb40
Code review ACK a5cfb40 |
RPCs that accept address parameters usually return the intended error code
RPC_INVALID_ADDRESS_OR_KEY
(-5) if a passed address is invalid. The two exceptions to the rule aresignmessage
andverifymessage
, which returnRPC_TYPE_ERROR
(-3) in this case instead. Oddly enoughverifymessage
returnsRPC_INVALID_ADDRESS_OR_KEY
when the signature was malformed, whereRPC_TYPE_ERROR
would be more approriate.This PR fixes these inaccuracies and as well adds tests to
rpc_signmessage.py
that check the parameter validity and error codes for the related RPCssignmessagewithprivkey
,signmessage
andverifymessage
.master branch:
PR branch: