Skip to content
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

Misleading error message RPC methods when validator mode is disabled #3259

Open
ines-toupeira opened this issue Jan 29, 2025 · 1 comment
Open

Comments

@ines-toupeira
Copy link
Member

The getAddress, getSigningKey, and getVotingKey RPC methods, defined in rpc-interface/src/validator.rs, return the following response when called on a full node without validator mode enabled:

In cURL:
{"jsonrpc":"2.0","error":{"code":-32601,"message":"Method not found","data":"Method does not exist: getAddress"},"id":1}%

Via cargo run:
Error: JSON-RPC protocol error: The server responded with an error: JSON-RPC error: code=-32601: Method not found - Caused by: "Method does not exist: getAddress"

The issue is for both the RPC client and the RPC interface.

Once validator mode is enabled, all methods return the expected responses.

The error message should indicate that the method is unavailable due to the node configuration rather than stating that it does not exist. A note will be added in the method descriptions to clarify that these methods are only available when validator mode is enabled, but the error messages must also be fixed

@Eligioo
Copy link
Member

Eligioo commented Jan 31, 2025

The reason why Method not found is returned by the RPC server is because the ValidatorDispatcher (object containing the methods you are trying to call) is only added if the node that runs the RPC server is actually configured as a validator. In that sense the error message is correct because the RPC server will not find a match.

As discussed @ines-toupeira will add this as clarification to each method that requires the node to be a validator. This way it will show up in the RPC specification on the Developer Center.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants