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

manifest command CLI format: publicMalformed error (Version: 1.5.0-rc1) #3317

Closed
mDuo13 opened this issue Mar 25, 2020 · 2 comments
Closed
Assignees
Labels
Bug Good First Issue Great issue for a new contributor

Comments

@mDuo13
Copy link
Collaborator

mDuo13 commented Mar 25, 2020

The manifest command introduced in #3197 doesn't seem to work when I use it on the commandline.

Issue Description

I successfully used the manifest command in both WebSocket and JSON-RPC to get the manifest info for alloy.ee using my server, for example JSON-RPC:

{
    "method":"manifest",
    "params": [{"public_key":"nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p"}]
}

However, the CLI syntax consistently gives me an error message.

Steps to Reproduce

$ ./rippled manifest nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p 

(Putting the key in quotes or not makes no difference.)

Expected Result

The response should match the JSON-RPC response, like this:

{
  "result": {
    "details": {
      "domain": "",
      "ephemeral_key": "n9J67zk4B7GpbQV5jRQntbgdKf7TW6894QuG7qq1rE5gvjCu6snA",
      "master_key": "nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p",
      "seq": 1
    },
    "manifest": "JAAAAAFxIe3AkJgOyqs3y+UuiAI27Ff3Mrfbt8e7mjdo06bnGEp5XnMhAhRmvCZmWZXlwShVE9qXs2AVCvhVuA/WGYkTX/vVGBGwdkYwRAIgGnYpIGufURojN2cTXakAM7Vwa0GR7o3osdVlZShroXQCIH9R/Lx1v9rdb4YY2n5nrxdnhSSof3U6V/wIHJmeao5ucBJA9D1iAMo7YFCpb245N3Czc0L1R2Xac0YwQ6XdGT+cZ7yw2n8JbdC3hH8Xu9OUqc867Ee6JmlXtyDHzBdY/hdJCQ==",
    "requested": "nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p",
    "status": "success"
  }
}

Actual Result

A publicMalformed error such as this:

{
   "error" : "publicMalformed",
   "error_code" : 62,
   "error_message" : "Public key is malformed.",
   "rpc" : {
      "method" : "manifest",
      "params" : [ "nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p" ]
   },
   "status" : "error"
}

Environment

Arch Linux x86_64, self-compiled rippled v1.5.0-rc1
Synced to mainnet.

@mDuo13 mDuo13 added the Bug label Mar 25, 2020
@nbougalis nbougalis added the Good First Issue Great issue for a new contributor label May 13, 2020
@nbougalis
Copy link
Contributor

Looking at the code, we land at ripple::RPCParser::parseManifest.

The function calls ripple::RPCParser::validPublicKey and a closer look at that function reveals it attempts to parse its input as base58 and if that fails, it falls back to hex.

The input you provided certain is base58, so it should work. But it doesn't:

    if (parseBase58<PublicKey> (TokenType::AccountPublic, strPk))
        return true;

The problem is that it only attempts to account TokenType::AccountPublic encoded keys, and the key you provided is TokenType::NodePublic instead.

This function is called from several places so it can't just be arbitrarily changed. My suggestion would to add a new parameter to the validPublicKey that accepts the type of public key being decoded as a command line argument, and passing the correct type.

@nbougalis nbougalis self-assigned this Jan 13, 2021
@nbougalis
Copy link
Contributor

image

@nbougalis nbougalis linked a pull request Jan 13, 2021 that will close this issue
manojsdoshi pushed a commit to manojsdoshi/rippled that referenced this issue Jan 15, 2021
The existing code attempts to validate the provided node public key
using a function that assumes that the encoded public key is for an
account. This causes the parsing to fail.

This commit fixes XRPLF#3317 by letting the caller specify the type of
the public key being checked.
manojsdoshi pushed a commit to manojsdoshi/rippled that referenced this issue Jan 15, 2021
The existing code attempts to validate the provided node public key
using a function that assumes that the encoded public key is for an
account. This causes the parsing to fail.

This commit fixes XRPLF#3317 by letting the caller specify the type of
the public key being checked.
manojsdoshi pushed a commit to manojsdoshi/rippled that referenced this issue Jan 18, 2021
The existing code attempts to validate the provided node public key
using a function that assumes that the encoded public key is for an
account. This causes the parsing to fail.

This commit fixes XRPLF#3317 by letting the caller specify the type of
the public key being checked.
manojsdoshi pushed a commit to manojsdoshi/rippled that referenced this issue Jan 20, 2021
The existing code attempts to validate the provided node public key
using a function that assumes that the encoded public key is for an
account. This causes the parsing to fail.

This commit fixes XRPLF#3317 by letting the caller specify the type of
the public key being checked.
manojsdoshi pushed a commit to manojsdoshi/rippled that referenced this issue Jan 20, 2021
The existing code attempts to validate the provided node public key
using a function that assumes that the encoded public key is for an
account. This causes the parsing to fail.

This commit fixes XRPLF#3317 by letting the caller specify the type of
the public key being checked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Good First Issue Great issue for a new contributor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants