etclabscore / jade-signer-rpc

🔏Jade Signer JSON-RPC lets you manage keys and sign transactions and messages offline for any EVM-based blockchain.
Apache License 2.0
6 stars 3 forks source link

Failing openrpc-test-coverage tests #55

Open mersinvald opened 5 years ago

mersinvald commented 5 years ago

Describe the bug Testing against open-rpc-test-coverage fails:

To Reproduce

  1. Run the server
  2. open-rpc-test-coverage -s ./openrpc.json --transport=http --reporter=console

Expected behavior Clear and green test run

Log

Example Validation Error:  signer_newAccount
params:  [
  {
    name: 'my test wallet',
    description: 'my test wallet description',
    passphrase: 'baz'
  },
  { chain: 'etc' }
]
result:  0xcfd0078e959c72404783cb289b8f050c79e88e0e
examples:  [
  {
    name: 'newAccountExample',
    description: 'Example of creating a new account',
    params: [ [Object], [Object] ],
    result: {
      name: 'newAccountResultExample',
      value: '0xae6645b12af5f3d76d854f9cbe514476f9b110fb'
    }
  }
]
method object {
  name: 'signer_newAccount',
  summary: 'Creates a new account and stores it locally as a passphrase-encoded keystore file.',
  params: [
    {
      name: 'newAccount',
      description: 'Creates a new account and stores it locally as a passphrase-encoded keystore file.',
      schema: [Object]
    },
    {
      name: 'additional',
      summary: 'additional params',
      description: 'additional list of parameters to define network or account specific options',
      schema: [Object]
    }
  ],
  result: {
    name: 'address',
    summary: 'Account address',
    required: true,
    description: 'hex-encoded 20 bytes public address',
    schema: { type: 'string', pattern: '^0x[a-fA-F\\d]{40}$' }
  },
  examples: [
    {
      name: 'newAccountExample',
      description: 'Example of creating a new account',
      params: [Array],
      result: [Object]
    }
  ]
}
JSON-RPC Request Error:  signer_importMnemonic
{ code: -32601, message: 'Method not found' }
[
  {
    name: 'my imported wallet',
    description: 'my imported wallet description',
    passphrase: 'baz',
    hd_path: "m/44'/60'/160720'/0'",
    mnemonic: 'icon suggest road current ripple engage spell clay route large arena climb oxygen electric cupboard dream title immune fit beyond mouse slab bronze salad'
  },
  { chain: 'etc' }
]
JSON-RPC Request Error:  signer_listAccounts
{
  code: -32602,
  message: 'Invalid data format: Required chain name or chain id parameter'
}
[ {} ]
JSON-RPC Request Error:  signer_unhideAccount
{ code: -32602, message: 'Corrupted input parameters' }
[ '0x5343056cdBeE51Ca53Ef059dF6111E43c4BdeC1A', {} ]
JSON-RPC Request Error:  signer_hideAccount
{ code: -32602, message: 'Corrupted input parameters' }
[ '0xFFDECDa3Eed4e9b9a6C7c45a7BEa675B4AA59F7E', {} ]
JSON-RPC Request Error:  signer_signTransaction
{
  code: -32602,
  message: 'Invalid data format: Required chain name or chain id parameter'
}
[
  {
    from: '0xd77CECbBED6c6EaD5b6A7EaDDFBDa4A3a780A9B0',
    to: '0xDaAC7bc5cDa4DAFDfdc8040847cedBb8bedbBAb1',
    gas: '0x3AE4B6bD4',
    gasPrice: '0xBa5',
    nonce: '0x9Dd682563E'
  },
  'dolore consequat dolore ipsum nisi',
  {}
]
JSON-RPC Request Error:  signer_importAccount
{
  code: -32602,
  message: 'Invalid data format: Required chain name or chain id parameter'
}
[ {}, {} ]
Success:  signer_generateMnemonic
JSON-RPC Request Error:  signer_sign
{
  code: -32602,
  message: 'Invalid data format: Required chain name or chain id parameter'
}
[
  '0xD5f76',
  '0xf8305EBD6D2e7Ff2FBCD4f56A2FDa3CedEDfb6e1',
  'aute aliqua esse',
  {}
]
JSON-RPC Request Error:  signer_exportAccount
{ code: -32602, message: 'Corrupted input parameters' }
[ '0xdd05fAD3405c5FAFC9D09B3CB45d6fa16CBf2204', {} ]
==========
Success:  1
Errors:  8
==========
mersinvald commented 5 years ago

Fixed fail for signer_newAccount in #58 and #57

mersinvald commented 5 years ago

Okay, most of the failures are due to test-coverage tool trying to pass randomly-generated params, which doesn't work well with stateful jade-signer.

PR #59 fixes that through skipping tests with no examples defined.

Current state:

Example Success:  signer_newAccount [
  {
    name: 'my test wallet',
    description: 'my test wallet description',
    passphrase: 'baz'
  },
  { chain: 'etc' }
] 0x90ee510fb88ea47a84b45a6d983a0bc6b193e385
JSON-RPC Request Error:  signer_importMnemonic
{ code: -32601, message: 'Method not found' }
[
  {
    name: 'my imported wallet',
    description: 'my imported wallet description',
    passphrase: 'baz',
    hd_path: "m/44'/60'/160720'/0'",
    mnemonic: 'icon suggest road current ripple engage spell clay route large arena climb oxygen electric cupboard dream title immune fit beyond mouse slab bronze salad'
  },
  { chain: 'etc' }
]