8000 Refactor `zeth` and `zeth_debug` commands organization · Issue #251 · clearmatics/zeth · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Refactor zeth and zeth_debug commands organization #251
Closed
@AntoineRondelet

Description

@AntoineRondelet

For now we have to CLIs:

  • zeth: The main CLI that provides basic functionalities to generate Zeth addresses, interact with the Zeth Mixer etc
  • zeth_debug: A debug CLI which provides useful functionalities - not strictly related to Zeth - but helping to use Zeth on an Eth-like network etc.

When I run zeth --help and zeth_debug --help I get:

(env) > zeth --help
Usage: zeth [OPTIONS] COMMAND [ARGS]...

Options:
  --eth-network TEXT    Ethereum RPC endpoint, network or config file
                        (default: 'eth-network' if it exists, otherwise
                        'ganache')
  --prover-server TEXT  Prover server endpoint (default=localhost:50051)
  --instance-file TEXT  Instance file (default=zeth-instance.json)
  --address-file TEXT   Instance file (default=zeth-address.json)
  --wallet-dir TEXT     Wallet directory (default=./wallet)
  --help                Show this message and exit.

Commands:
  help*          Print help and exit
  deploy         Deploy the zeth contracts and record the instantiation...
  gen-address    Generate a new Zeth secret key and public address
  ls-commits     List all commitments in the Zeth mixer contract
  ls-notes       List the set of notes owned by this wallet
  mix            Generic mix function
  sync           Attempt to retrieve new notes for the key in <key-file>
  token-approve  Approve the mixer to spend some amount of tokens

and

(env) > zeth_debug --help
Usage: zeth_debug [OPTIONS] COMMAND [ARGS]...

Options:
  --eth-network TEXT  Ethereum RPC endpoint, network or config file (default:
                      'eth-network' if it exists, otherwise 'ganache')
  --help              Show this message and exit.

Commands:
  help*                    Print help and exit
  deploy-test-token        Deploy a simple ERC20 token for testing, and
                           mint...
  fund-eth-address         Fund an address.
  generate-eth-address     Locally generate a new Ethereum private key and...
  generate-network-config  Generate a network config file.
  get-eth-balance          Command to get the balance of specific addresses.

Some things are not consistent - and/or can be improved here IMO:

  1. There is a token-approve command in the zeth CLI. This is confusing. zeth should be about interacting with the Zeth tooling (prover_server, Mixer contract). Moreover, we have a deploy-test-token command in zeth_debug which is used to deploy the MintableERC20 token. Why would we have "token-related" commands spread across zeth and zeth_debug?
  2. The command zeth_debug deploy-test-token does not only - as mentioned in the help message - deploy the token. It also mints it. I would separate these 2 things in 2 different commands for clarity.

Ultimately, here's how I would structure both CLIs:

zeth
  |_ deploy
  |_ gen-address
  |_ ls-commits
  |_ ls-notes
  |_ mix
  |_ sync

and:

zeth_debug
  |_ token
  |    |_ deploy
  |    |_ mint
  |    |_ approve
  |_ eth
  |    |_ gen_address
  |    |_ fund_address
  |    |_ get_balance
  |    |_ gen_network_config

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestwalletTask related to the wallet implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0