Skip to content

Commit 7066dcf

Browse files
bridges-common-relay: add reward types override (#374)
* bridges-common-relay: add reward types override The reward-claim CronJobs use polkadot-js-api to query/claim bridgeRelayers rewards. This change adds optional per-reward configuration: - params_wrapper: wrap RewardsAccountParams JSON inside a top-level enum variant - types_override: inline JSON types rendered into a ConfigMap, mounted into the CronJob, and passed to polkadot-js-api via --types When unset, existing CronJob behavior is unchanged. This change enables supporting types not yet updated in upstream polkadot-js. * docs: update Helm chart READMEs via helm-docs * Update pre-commit and helm-docs * ci(node): apply test manifests to node-test The ginkgo suite runs with --namespace node-test but the CI script applied chart manifests without an explicit namespace, so resources landed in the default namespace and tests failed with 'statefulsets ... not found'. Apply with kubectl -n node-test to match the test namespace.
1 parent 399d8d5 commit 7066dcf

16 files changed

Lines changed: 59 additions & 17 deletions

File tree

.github/workflows/pr.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jobs:
3535

3636
- name: Install pre-commit and helm-docs
3737
run: |
38-
pip install pre-commit==3.6.0
39-
curl -fSsL -o - https://github.com/norwoodj/helm-docs/releases/download/v1.12.0/helm-docs_1.12.0_Linux_x86_64.tar.gz | tar -xz -C /usr/local/bin helm-docs
38+
pip install pre-commit==4.5.1
39+
curl -fSsL -o - https://github.com/norwoodj/helm-docs/releases/download/v1.14.2/helm-docs_1.14.2_Linux_x86_64.tar.gz | tar -xz -C /usr/local/bin helm-docs
4040
4141
- name: Run pre-commit hooks
4242
run: pre-commit run --all-files

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/norwoodj/helm-docs
3-
rev: v1.12.0
3+
rev: v1.14.2
44
hooks:
55
- id: helm-docs
66
args:

charts/bridges-common-relay/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: bridges-common-relay
33
description: A Helm chart for bridges-common-relay
44
type: application
5-
version: 1.1.1
5+
version: 1.2.0
66
maintainers:
77
- name: Parity
88
url: https://github.com/paritytech/helm-charts

charts/bridges-common-relay/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This is intended behaviour. Make sure to run `git add -A` once again to stage ch
1818

1919
# Parity Bridges Common helm chart
2020

21-
![Version: 1.1.1](https://img.shields.io/badge/Version-1.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
21+
![Version: 1.2.0](https://img.shields.io/badge/Version-1.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
2222

2323
This helm chart installs [Parity Bridges Common](https://github.com/paritytech/parity-bridges-common) relayer.
2424

@@ -80,4 +80,4 @@ helm install bridges-common-relay parity/bridges-common-relay
8080
| tolerations | list | `[]` | Tolerations for use with node taints |
8181

8282
----------------------------------------------
83-
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
83+
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)

charts/bridges-common-relay/templates/cronjob.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{{ range $val := .Values.rewards }}
22
{{ range $reward_owner := tuple "ThisChain" "BridgedChain" }}
3+
{{- $typesVolumeName := printf "types-override-%s" ($val.name | lower | trunc 40 | trimSuffix "-") }}
4+
{{- $typesFile := default "bridge-reward-types-override.json" $val.types_override_filename }}
5+
{{- $typesArgs := "" }}
6+
{{- if $val.types_override }}
7+
{{- $typesArgs = printf " --types /types/%s" $typesFile }}
8+
{{- end }}
39
apiVersion: batch/v1
410
kind: CronJob
511
metadata:
@@ -32,6 +38,11 @@ spec:
3238
secret:
3339
secretName: {{ include "bridges-common-relay.secretName" $ }}
3440
optional: false
41+
{{- if $val.types_override }}
42+
- name: {{ $typesVolumeName }}
43+
configMap:
44+
name: {{ include "bridges-common-relay.fullname" $ }}-{{ $val.name | lower }}-types
45+
{{- end }}
3546
{{- end}}
3647
containers:
3748
- name: bridges-common-relay-{{ $val.name | lower }}-{{ $reward_owner | lower }}
@@ -57,9 +68,13 @@ spec:
5768
"owner": $owner
5869
}'
5970
)
71+
{{- if $val.params_wrapper }}
72+
73+
rewards_account_params=$(jq -n --arg key {{ $val.params_wrapper | quote }} --argjson params "$rewards_account_params" '{($key): $params}')
74+
{{- end }}
6075
6176
reward=$(
62-
polkadot-js-api --ws "$RPC_URL" query.bridgeRelayers.relayerRewards \
77+
polkadot-js-api --ws "$RPC_URL"{{ $typesArgs }} query.bridgeRelayers.relayerRewards \
6378
{{ $val.address | quote }} \
6479
"$rewards_account_params" \
6580
| jq -r '.relayerRewards'
@@ -74,7 +89,7 @@ spec:
7489
# Avoid nonce collision with "ThisChain".
7590
{{ if eq $reward_owner "BridgedChain" }}sleep 10{{ end }}
7691
77-
polkadot-js-api --ws "$RPC_URL" \
92+
polkadot-js-api --ws "$RPC_URL"{{ $typesArgs }} \
7893
--seed "$(cat /secrets/{{ $val.seed_phrase_secret_name }})" \
7994
tx.bridgeRelayers.claimRewards "$rewards_account_params"
8095
resources:
@@ -84,6 +99,11 @@ spec:
8499
- name: secrets
85100
mountPath: "/secrets"
86101
readOnly: true
102+
{{- if $val.types_override }}
103+
- name: {{ $typesVolumeName }}
104+
mountPath: "/types"
105+
readOnly: true
106+
{{- end}}
87107
{{- end}}
88108
---
89109
{{- end }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{- range $val := .Values.rewards }}
2+
{{- if $val.types_override }}
3+
apiVersion: v1
4+
kind: ConfigMap
5+
metadata:
6+
name: {{ include "bridges-common-relay.fullname" $ }}-{{ $val.name | lower }}-types
7+
labels:
8+
{{- include "bridges-common-relay.labels" $ | nindent 4 }}
9+
data:
10+
{{- $typesFile := default "bridge-reward-types-override.json" $val.types_override_filename }}
11+
{{ $typesFile }}: |
12+
{{ $val.types_override | nindent 4 }}
13+
---
14+
{{- end }}
15+
{{- end }}

charts/bridges-common-relay/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,10 @@ rewards: {}
130130
# bridged_chain_id: "0x62687764"
131131
# # -- Secret name of the seed phrase of the relayer
132132
# seed_phrase_secret_name: "bridge-hub-rococo-signer-file"
133+
# # -- Optional: wrap rewards params in a top-level enum variant
134+
# params_wrapper: "PolkadotKusamaBridge"
135+
# # -- Optional: JSON types override for polkadot-js-api
136+
# types_override: |
137+
# {"MyType": "u32"}
138+
# # -- Optional: override types file name (default: bridge-reward-types-override.json)
139+
# types_override_filename: "bridge-reward-types-override.json"

charts/common/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,4 @@ This is intended behaviour. Make sure to run `git add -A` once again to stage ch
8787
| tolerations | list | `[]` | Tolerations for use with node taints |
8888

8989
----------------------------------------------
90-
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
90+
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)

charts/node/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,4 +563,4 @@ If you're running a collator node:
563563
| wsHealthExporter.resources | object | `{}` | Resource limits & requests |
564564

565565
----------------------------------------------
566-
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
566+
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)

charts/node/ci/run-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ done
1414
echo "Waiting for addons to be ready..."
1515
sleep 30
1616

17-
kustomize build --enable-helm . | kubectl apply -f -
17+
kustomize build --enable-helm . | kubectl apply -n node-test -f -
1818

1919
cd ginkgo && go test --namespace node-test --kubeconfig ${KUBECONFIG:-$HOME/.kube/config}

0 commit comments

Comments
 (0)