harmony-one / bounties

Bounty program is to help the community take part in the development of the Harmony blockchain. It covers from core feature to validator tooling, from dApp development to DeFi integration.
MIT License
59 stars 23 forks source link

[feature] expose all configuration variables and values #41

Closed LeoHChen closed 3 years ago

LeoHChen commented 3 years ago

Description

We need to expose all configuration variables and values to the log file and RPC interface.

An option/flag in the configuration to print all configuration variables and their values in the log file, as a way to debug the configuration changes.

Also, a new RPC interface to expose all configuration variables and values, similar to the following RPC interface.

curl -s --request POST 'http://127.0.0.1:9500/' --header 'Content-Type: application/json' 
--data-raw '{ "jsonrpc": "2.0", "method": "hmyv2_getNodeMetadata", "params": [], "id": 1}' | jq .

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blskey": [
      "00000000000000000"
    ],
    "chain-config": {
      "chain-id": 1,
      "cross-link-epoch": 186,
      "cross-tx-epoch": 28,
      "eip155-epoch": 28,
      "eth-compatible-chain-id": 1666600003,
      "eth-compatible-epoch": 442,
      "eth-compatible-shard-0-chain-id": 1666600000,
      "five-seconds-epoch": 230,
      "istanbul-epoch": 314,
      "no-early-unlock-epoch": 530,
      "prestaking-epoch": 185,
      "quick-unlock-epoch": 191,
      "receipt-log-epoch": 101,
      "redelegation-epoch": 290,
      "s3-epoch": 28,
      "sixty-percent-epoch": 530,
      "staking-epoch": 186,
      "two-seconds-epoch": 366
    },
    "consensus": {
      "blocknum": 12513091,
      "finality": 524,
      "mode": "Normal",
      "phase": "Announce",
      "viewChangeId": 12499378,
      "viewId": 12513446
    },
    "current-epoch": 552,
    "dns-zone": "t.hmny.io",
    "is-archival": false,
    "is-leader": false,
    "network": "mainnet",
    "node-unix-start-time": 1619660085,
    "p2p-connectivity": {
      "connected": 483,
      "not-connected": 64,
      "total-known-peers": 547
    },
    "peerid": "Qmxxxxxxxxxxxxxxxxxxx",
    "role": "Validator",
    "shard-id": 3,
    "sync-peers": {
      "shard-0": 14,
      "shard-3": 14
    },
    "version": "Harmony (C) 2020. harmony, version v6933-v4.0.0-0-g78759217 (ec2-user@ 2021-04-06T00:30:49+0000)"
  }
}

Context

Harmony configuration variables can be controlled and overwritten in both cli flags and a toml config file. We are sometimes confused about the final configuration options used by the node, and we need an easy way to debug/triage if any configuration issue for validators. So we need to add the support to expose the configuration variables and their values to both log files and the RPC interface.

Acceptance Criteria

Reference

https://docs.harmony.one/home/developers/api

Reward

US $500 equivalent amount of Harmony ONE token.

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 4883.1401 ONE (501.48 USD @ $0.1/ONE) attached to it.

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 1 month, 1 week from now. Please review their action plans below:

1) gcbthtr has started work.

I will expose new configuration option and an RPC interface for exposing configuration values

Learn more on the Gitcoin Issue Details page.

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 4883.1401 ONE (493.91 USD @ $0.09/ONE) has been submitted by:


gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 4883.1401 ONE (456.18 USD @ $0.09/ONE) has been submitted by:

  1. @touhonoob

@papiofficial please take a look at the submitted work:


LeoHChen commented 3 years ago

@touhonoob, there is an issue opened for this bounty, would you please take a look? https://github.com/harmony-one/harmony/issues/3781

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 4883.1401 ONE (410.90 USD @ $0.09/ONE) attached to this issue has been approved & issued to @touhonoob.