Skip to content

Commit

Permalink
propose to remove unknown nodes (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgip-work authored Aug 23, 2022
1 parent 35ab9dd commit 1d43923
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 10 deletions.
2 changes: 1 addition & 1 deletion charts/quorum-node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.6.0
version: 0.6.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
14 changes: 7 additions & 7 deletions charts/quorum-node/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# quorum-node

![Version: 0.6.0](https://img.shields.io/badge/Version-0.6.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 22.7.0](https://img.shields.io/badge/AppVersion-22.7.0-informational?style=flat-square)
![Version: 0.6.1](https://img.shields.io/badge/Version-0.6.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 22.7.0](https://img.shields.io/badge/AppVersion-22.7.0-informational?style=flat-square)

A Helm chart for the deployment of the quorum node on Kubernetes supporting new-network, join-network and update-partners-info use cases.

Expand Down Expand Up @@ -62,7 +62,7 @@ use_case:
```
```shell
helm upgrade --install quorum-node-0 pharmaledger-imi/quorum-node --version=0.6.0 \
helm upgrade --install quorum-node-0 pharmaledger-imi/quorum-node --version=0.6.1 \
--values ./my-values.yaml \
--set-file use_case.joinNetwork.plugin_data_common=./join-network.plugin.json \
--set-file use_case.joinNetwork.plugin_data_secrets=./join-network.plugin.secrets.json \
Expand All @@ -87,7 +87,7 @@ use_case:
```
```shell
helm upgrade --install quorum-node-0 pharmaledger-imi/quorum-node --version=0.6.0 \
helm upgrade --install quorum-node-0 pharmaledger-imi/quorum-node --version=0.6.1 \
--values ./my-values.yaml \
--set-file use_case.joinNetwork.plugin_data_common=./join-network.plugin.json \
--set-file use_case.joinNetwork.plugin_data_secrets=./join-network.plugin.secrets.json
Expand All @@ -111,7 +111,7 @@ use_case:
```
```shell
helm upgrade --install quorum-node-0 pharmaledger-imi/quorum-node --version=0.6.0 \
helm upgrade --install quorum-node-0 pharmaledger-imi/quorum-node --version=0.6.1 \
--values ./my-values.yaml \
--set-file use_case.newNetwork.plugin_data_common=./new-network.plugin.json \
--set-file use_case.newNetwork.plugin_data_secrets=./new-network.plugin.secrets.json \
Expand All @@ -136,7 +136,7 @@ use_case:
```
```shell
helm upgrade --install quorum-node-0 pharmaledger-imi/quorum-node --version=0.6.0 \
helm upgrade --install quorum-node-0 pharmaledger-imi/quorum-node --version=0.6.1 \
--values ./my-values.yaml \
--set-file use_case.newNetwork.plugin_data_common=./new-network.plugin.json \
--set-file use_case.newNetwork.plugin_data_secrets=./new-network.plugin.secrets.json
Expand All @@ -156,7 +156,7 @@ Run `helm upgrade --helm` for full list of options.
You can install into other namespace than `default` by setting the `--namespace` parameter, e.g.

```bash
helm upgrade my-release-name pharmaledger-imi/quorum-node --version=0.6.0 \
helm upgrade my-release-name pharmaledger-imi/quorum-node --version=0.6.1 \
--install \
--namespace=my-namespace \
--values my-values.yaml \
Expand All @@ -167,7 +167,7 @@ Run `helm upgrade --helm` for full list of options.
Provide the `--wait` argument and time to wait (default is 5 minutes) via `--timeout`

```bash
helm upgrade my-release-name pharmaledger-imi/quorum-node --version=0.6.0 \
helm upgrade my-release-name pharmaledger-imi/quorum-node --version=0.6.1 \
--install \
--wait --timeout=600s \
--values my-values.yaml \
Expand Down
45 changes: 43 additions & 2 deletions charts/quorum-node/templates/configmap-scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,51 @@ data:
#!/bin/ash
#set -xe
echo "1. Retrieving current validator candidates"
echo "=========================================="
/geth-helpers/geth-exec.sh "istanbul.candidates"
echo ""
echo "2. Proposing to remove existing validators that are unknown nodes"
echo "================================================================="
echo "> Retrieving current validators via 'istanbul.getValidators()' ..."
# This will return ["0x....", "0x....", "0x...."]
# Sample: ["0x3257b9c9f66c6ca013def70cc075313d9adc9ed6", "0x601a483538f17126eb78a1bec95d2a297f2b89dd", "0x6f0c0b4f77d74d04673be303e376faa01f358db8", "0xaabf92868622b738b81fd4ee5a8706e1cb43af2d", "0xba0a4116eb16cfb5bbbe00204ba017dbf2f88ee4", "0xc1c6048ee3079fe87c36bce542672e85a19fe967", "0xce75491ea8e89826a87b9dd6efbaa20d0f5ec67a", "0xfc9dfe9d2c1fb15c7105e56d2b5c925034d1b1e4"]
validators=$(/geth-helpers/geth-exec.sh "istanbul.getValidators()")
echo " Current validators:"
echo " $validators"
for each_validator in $(echo ${validators} | grep "0x" | sed 's/,//g; s/"//g; s/\[//g; s/\]//g' ); do
echo ""
echo "> Checking if $each_validator is in a known node ..."
grep_result=$(grep -i "$each_validator" {{ .Values.quorum.homeMountPath }}/istanbul-validator-config.toml/istanbul-validator-config.toml)
if [[ "$grep_result" != "" ]]; then
echo " WELL-KNOWN: Validator $each_validator is well-known. No need to propose removal."
else
echo " UNKNOWN: Validator $each_validator is unknown and not listed in validator whitelist. Proposing to remove validator."
{{ .Values.quorum.homeMountPath }}/node-management/ibft_propose.sh $each_validator false
fi
done
echo ""
echo "3. Retrieving current validator candidates"
echo "=========================================="
/geth-helpers/geth-exec.sh "istanbul.candidates"
echo ""
echo "4. Proposing all known nodes as validators"
echo "=========================================="
for Addr in $( awk '/validators/,0' {{ .Values.quorum.homeMountPath }}/istanbul-validator-config.toml/istanbul-validator-config.toml | grep "0x" | sed 's/,//g; s/"//g' ); do
echo "Proposing $Addr ..."
{{ .Values.quorum.homeMountPath }}/node-management/ibft_propose.sh $Addr true
echo ""
echo "> Proposing $Addr as a validator ..."
{{ .Values.quorum.homeMountPath }}/node-management/ibft_propose.sh $Addr true
done
echo ""
echo "5. Retrieving current validator candidates"
echo "=========================================="
/geth-helpers/geth-exec.sh "istanbul.candidates"
geth-attach.sh: |-
#!/bin/sh
Expand Down

0 comments on commit 1d43923

Please sign in to comment.