ArkEcosystem / core

The ARK Core Blockchain Framework. Check https://learn.ark.dev for more information.
https://ark.io
MIT License
338 stars 285 forks source link

tester-cli: flags not forwarded when running command programmatically #2094

Closed Nigui closed 5 years ago

Nigui commented 5 years ago

Describe the bug In the Vote command of tester-cli, Transfer command is called to initialize wallet balance (source)

Overriding base command flags (like p2pPort) during the vote command call, make transfer command crash due to invalid port used (default port of base command instead of source command port value).

It produces the following error:

[1550055840041] ERROR (core-tester-cli/28311 on laptop.local): Failed to get network config:  connect ECONNREFUSED 127.0.0.1:4002
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

To Reproduce Steps to reproduce the behavior:

  1. Start a testnet node (p2pPort is 4000 by default)
  2. Go to core-tester-cli
  3. yarn tester vote [...] --p2pPort 4000
  4. See error

Expected behavior flags used in source command should be forwarded to programmatically called commands.

ghost commented 5 years ago

@Nigui Thanks for opening this issue, a maintainer will get back to you shortly!

ghost commented 5 years ago

@air1one @faustbrian @supaiku0 - please review this in the next few days. Be sure to explicitly select labels so I know what's going on.

If no reviewer appears after a week, a reminder will be sent out.

Nigui commented 5 years ago

Tried to give this.options as second parameter of Transfer.run(...), but it produces the following error:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at up (~/Documents/projects/ark/core/node_modules/@oclif/config/lib/plugin.js:206:21)
    at up.next (<anonymous>)
    at findRoot (~/Documents/projects/ark/core/node_modules/@oclif/config/lib/plugin.js:212:14)
    at Plugin.load (~/Documents/projects/ark/core/node_modules/@oclif/config/lib/plugin.js:25:28)
    at Config.load (~/Documents/projects/ark/core/node_modules/@oclif/config/lib/config.js:28:22)
    at Object.load (~/Documents/projects/ark/core/node_modules/@oclif/config/lib/config.js:307:18)
    at Function.Command.run (~/Documents/projects/ark/core/node_modules/@oclif/command/lib/command.js:141:33)
    at NFTMint.run (~/Documents/projects/ark/core/packages/core-tester-cli/dist/commands/nftmint.js:23:46)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Maybe solution should be to manually forward flags, serializing as a string array and passing to Transfer.run first parameter.

faustbrian commented 5 years ago

Will take a look next week when I find time unless you've send a PR by then @Nigui.

ghost commented 5 years ago

@Nigui This issue has been closed. If you wish to re-open it please provide additional information.