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

cmd: migrate to urfave/cli/v2 #741

Merged
merged 13 commits into from
Nov 25, 2024
Merged

Conversation

gzliudan
Copy link
Collaborator

@gzliudan gzliudan commented Nov 20, 2024

Proposed changes

This PR:

  • migrate cli from v1 to v2
  • reorganize the flags, normalize flag names
  • support old flag names by cli aliases
  • support env vars with XDC prefix
  • enable version flag by disable app.HideVersion:
    • XDC --version
    • XDC -version
    • XDC -v

Reference:

The changes of flag names:

old name new name
dev.period dev-period
lightserv light-serv
lightpeers light-peers
ethash.cachedir ethash-cachedir
ethash.cachesinmem ethash-cachesinmem
ethash.cachesondisk ethash-cachesondisk
ethash.dagdir ethash-dagdir
ethash.dagsinmem ethash-dagsinmem
ethash.dagsondisk ethash-dagsondisk
txpool.nolocals txpool-nolocals
txpool.journal txpool-journal
txpool.rejournal txpool-rejournal
txpool.pricelimit txpool-pricelimit
txpool.pricebump txpool-pricebump
txpool.accountslots txpool-accountslots
txpool.globalslots txpool-globalslots
txpool.accountqueue txpool-accountqueue
txpool.globalqueue txpool-globalqueue
txpool.lifetime txpool-lifetime
cache.database cache-database
cache.gc cache-gc
cache.blocklogs cache-blocklogs
minerthreads miner-threads
targetgaslimit miner-gaslimit
gasprice miner-gasprice
etherbase miner-etherbase
extradata miner-extradata
rpc.txfeecap rpc-txfeecap
rpc http
rpcaddr http-addr
rpcport http-port
rpccorsdomain http-corsdomain
rpcvhosts http-vhosts
rpcapi http-api
rpcreadtimeout http-readtimeout
rpcwritetimeout http-writetimeout
rpcidletimeout http-idletimeout
wsaddr ws-addr
wsport ws-port
wsapi ws-api
wsorigins ws-origins
gpoblocks gpo-blocks
gpopercentile gpo-percentile
gpo.maxprice gpo-maxprice
gpo.ignoreprice gpo-ignoreprice
metrics.addr metrics-addr
metrics.port metrics-port
XDCx.datadir XDCx-datadir
XDCx.dbengine XDCx-dbengine
XDCx.dbName XDCx-dbName
XDCx.dbConnectionUrl XDCx-dbConnectionUrl
XDCx.dbReplicaSetName XDCx-dbReplicaSetName
pprofport pprof-port
pprofaddr pprof-addr
memprofilerate pprof-memprofilerate
blockprofilerate pprof-blockprofilerate
cpuprofile pprof-cpuprofile

Types of changes

What types of changes does your code introduce to XDC network?
Put an in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)
  • Regular KTLO or any of the maintaince work. e.g code style
  • CICD Improvement

Impacted Components

Which part of the codebase this PR will touch base on,

Put an in the boxes that apply

  • Consensus
  • Account
  • Network
  • Geth
  • Smart Contract
  • External components
  • Not sure (Please specify below)

Checklist

Put an in the boxes once you have confirmed below actions (or provide reasons on not doing so) that

  • This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
  • Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
  • Tested the backwards compatibility.
  • Tested with XDC nodes running this version co-exist with those running the previous version.
  • Relevant documentation has been updated as part of this PR
  • N/A

@gzliudan gzliudan force-pushed the cli-v2 branch 20 times, most recently from 1a80ac3 to 638f515 Compare November 25, 2024 03:01
@gzliudan gzliudan changed the title [WIP] cmd: migrate to urfave/cli/v2 cmd: migrate to urfave/cli/v2 Nov 25, 2024
This fixes a cornercase bug where the flag migration would mess
up the value of StringSlice flags.
* internal/flags: use filepath.Clean instead of path.Clean

* internal/flags: fix windows pipe issue

* internal/flags: modify test for windows

* internal/flags: use backticks, fix test
…thereum#28692)

Certain flags, such as `--rpc.txfeecap` currently do not have an env-var auto-generated for them. This change adds three missing cli flag types to the auto env-var helper function to fix this.
@gzliudan gzliudan merged commit 4278930 into XinFinOrg:dev-upgrade Nov 25, 2024
15 of 17 checks passed
@gzliudan gzliudan deleted the cli-v2 branch November 25, 2024 09:25
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

Successfully merging this pull request may close these issues.

2 participants