From 1d4392320b095ed052c0f3e4b21a097bfb79ccb9 Mon Sep 17 00:00:00 2001 From: Torsten Gippert <46532698+tgip-work@users.noreply.github.com> Date: Tue, 23 Aug 2022 17:35:46 +0200 Subject: [PATCH] propose to remove unknown nodes (#174) --- charts/quorum-node/Chart.yaml | 2 +- charts/quorum-node/README.md | 14 +++--- .../templates/configmap-scripts.yaml | 45 ++++++++++++++++++- 3 files changed, 51 insertions(+), 10 deletions(-) diff --git a/charts/quorum-node/Chart.yaml b/charts/quorum-node/Chart.yaml index 9e43303f..7e729bf7 100644 --- a/charts/quorum-node/Chart.yaml +++ b/charts/quorum-node/Chart.yaml @@ -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 diff --git a/charts/quorum-node/README.md b/charts/quorum-node/README.md index 10470f7f..3aa777c4 100644 --- a/charts/quorum-node/README.md +++ b/charts/quorum-node/README.md @@ -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. @@ -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 \ @@ -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 @@ -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 \ @@ -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 @@ -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 \ @@ -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 \ diff --git a/charts/quorum-node/templates/configmap-scripts.yaml b/charts/quorum-node/templates/configmap-scripts.yaml index 7c8f95fe..f20c0618 100644 --- a/charts/quorum-node/templates/configmap-scripts.yaml +++ b/charts/quorum-node/templates/configmap-scripts.yaml @@ -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