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] design and implement redundant validator setup #36

Closed LeoHChen closed 3 years ago

LeoHChen commented 3 years ago

Description

Design and implement a new feature of redundant validator mode in harmony node

Context

Currently, harmony validators can run multiple redundant validator nodes at the same time w/o being penalized by signing the same block more than once. It is allowed to keep higher uptime of the blockchain nodes. However, this setup will NOT be allowed in the near term once the protocol enabled double-signing detection and slashing.

There is still a requirement from the validator community to allow a redundant setup of nodes in passive mode to maintain high availability and uptime just in case one validator node is offline due to unexpected reasons. So, this feature requests a design and implementation of a new mechanism to allow validators keep redundant node setup, but only run one active validator in the network.

Just to give a bit more context, there is a simple request from validators to support passive mode with manual switch, https://github.com/harmony-one/harmony/issues/3670

Noted, this is a recommendation of the design of this feature, if you have a better idea to support passive validator mode, feel free to propose a new solution and discuss with the team.

Together with the following Grafana monitoring setup, the validator can get alert on telegram/discord, this design can help validators maintain high availability and uptime. https://github.com/harmony-one/Harmony_Prometheus-Grafana-Setup

Acceptance Criteria

Reward

US$1,000 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 10221.2016 ONE (1000.94 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 day, 19 hours ago. Please review their action plans below:

1) luttyyang has started work.

design and implement redundant validator setup 2) slava096 has started work.

I will try to implement the described functionality

Learn more on the Gitcoin Issue Details page.

LuttyYang commented 3 years ago

hey guys. i have finished the develop work. let me know if there is any issue for it

PR is here: https://github.com/harmony-one/harmony/pull/3689

LuttyYang commented 3 years ago

It can active by pass these ways:

  1. startup parameter --run.backup=true
  2. IsBackup = false in toml config
  3. hmy_setNodeToBackupMode command in json-rpc

this is json-rpc example

### set node to backup mode
### curl --location --request POST 'http://127.0.0.1:9500/' --header 'Content-Type: application/json' --data-raw '{"jsonrpc": "2.0","method": "hmy_setNodeToBackupMode","params": [true],"id": 1}' | jq
POST 127.0.0.1:9500
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "method": "hmy_setNodeToBackupMode",
  "params": [true],
  "id": 1
}

### get current node backup state
### curl --location --request POST 'http://127.0.0.1:9500/' --header 'Content-Type: application/json' --data-raw '{"jsonrpc": "2.0","method": "hmy_getCurrentNodeBackupState","params": [],"id": 1}' | jq
POST 127.0.0.1:9500
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "method": "hmy_getCurrentNodeBackupState",
  "params": [],
  "id": 1
}
LuttyYang commented 3 years ago

this is demo video:

https://user-images.githubusercontent.com/14296262/117168364-a6650680-adfa-11eb-8aeb-32262cf8bc97.mp4

gitcoinbot commented 3 years ago

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


The funding of 10221.2016 ONE (1073.44 USD @ $0.11/ONE) attached to this issue has been cancelled by the bounty submitter

gitcoinbot commented 3 years ago

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


Work for 10221.2016 ONE (829.73 USD @ $0.08/ONE) has been submitted by:


gitcoinbot commented 3 years ago

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


The funding of 10221.2016 ONE (809.12 USD @ $0.08/ONE) attached to this issue has been approved & issued to @luttyyang.