Skip to content

Commit 6a07fb8

Browse files
Kubernetes configuration for Keep Maintainer bot (#3689)
In this PR we update the configuration of keep-client maintainer deployment running in keep-test and keep-prd. ### Template We define a template for running the keep-client in maintainer mode with all the available modules: - spv - walletCoordination - bitcoinDifficulty ### keep-prd In keep-prd cluster we replaced the previously running Bitcoin difficulty maintainer with a new instance of all-in-one maintainer bot. ### keep-test In keep-test we have to adjust the setup to work correctly with the `LightRelay` contract. Bitcoin Relay used by the tTBTC system on testnet environment is an optimized version of the Light Relay implemented by [GoerliLightRelay](https://github.com/keep-network/tbtc-v2/blob/main/solidity/contracts/test/GoerliLightRelay.sol) contract. The reason the Light Relay had to be modified for testnet is that on Bitcoin testnet difficulty often drops to `1`, which makes the blocks validation on such change impossible to the regular Light Relay contract. The `GoerliLightRelay` version doesn't require a maintainer bot to submit block headers on difficulty change. It accepts ad-hoc difficulty alignment according to the tests needs. For these reasons, we are running two instances of keep-maintainer. The first instance `keep-maintainer` is connected to Bitcoin testnet and runs `spv` and `walletCoordination` modules. The second instance `keep-maintainer-staging` is connected to Bitcoin mainnet and runs only `bitcoinDifficulty` module. The test environment setup for the relay contract is subject to change in the coming weeks, so the configuration defined in this PR for the keep-test is expected to be modified then.
2 parents 08ee58c + 8a1d59b commit 6a07fb8

File tree

10 files changed

+237
-197
lines changed

10 files changed

+237
-197
lines changed

Diff for: infrastructure/kube/keep-prd/btc-difficulty/kustomization.yaml

-27
This file was deleted.

Diff for: infrastructure/kube/keep-prd/btc-difficulty/maintainer-statefulset.yaml

-70
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
resources:
2+
- ../../templates/keep-maintainer
3+
4+
namespace: default
5+
6+
commonLabels:
7+
app: keep-maintainer
8+
type: all
9+
network: mainnet
10+
11+
images:
12+
- name: keep-maintainer
13+
newName: gcr.io/keep-prd-210b/keep-client
14+
newTag: v2.0.0-m4-rc
15+
16+
configMapGenerator:
17+
- name: keep-maintainer-config
18+
behavior: merge
19+
literals:
20+
- network=mainnet
21+
- electrum-api-url=ws://electrumx.bitcoin:8080
22+
files:
23+
- .secret/keep-maintainer-keyfile
24+
25+
secretGenerator:
26+
- name: keep-maintainer-eth-account-password
27+
files:
28+
- .secret/keep-maintainer-password
29+
30+
generatorOptions:
31+
disableNameSuffixHash: true
32+
annotations:
33+
note: generated

Diff for: infrastructure/kube/keep-test/btc-difficulty/kustomization.yaml

-27
This file was deleted.

Diff for: infrastructure/kube/keep-test/btc-difficulty/maintainer-statefulset.yaml

-73
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Keep Maintainer Staging Mainnet
2+
3+
Bitcoin Relay used by the tTBTC system on testnet environment is an optimized version
4+
of the Light Relay implemented by [GoerliLightRelay](https://github.com/keep-network/tbtc-v2/blob/main/solidity/contracts/test/GoerliLightRelay.sol)
5+
contract. The reason the Light Relay had to be modified for testnet is that on
6+
Bitcoin testnet difficulty often drops to `1`, which makes the blocks validation
7+
on such change impossible to the regular Light Relay contract.
8+
9+
The `GoerliLightRelay` version doesn't require a maintainer bot to submit block
10+
headers on difficulty change. It accepts ad-hoc difficulty alignment according to
11+
the tests needs.
12+
13+
The setup defined in this directory is meant for testing the bitcoin difficulty module
14+
of the maintainer bot with the Bitcoin mainnet blockchain state.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
resources:
2+
- ../../templates/keep-maintainer
3+
4+
namespace: default
5+
6+
# Regular testnet maintainer doesn't run bitcoinDifficulty module due to specifics
7+
# of LightRelay running on testnet (GoerliLightRelay). This setup is running
8+
# the `bitcoinDifficulty` module of maintainer connected to Bitcoin mainnet.
9+
nameSuffix: -staging
10+
11+
commonLabels:
12+
app: keep-maintainer-staging
13+
type: bitcoinDifficulty
14+
network: goerli
15+
16+
images:
17+
- name: keep-maintainer
18+
newName: gcr.io/keep-test-f3e0/keep-client
19+
newTag: latest
20+
21+
configMapGenerator:
22+
- name: keep-maintainer-config
23+
behavior: merge
24+
literals:
25+
- network=testnet
26+
- electrum-api-url=wss://electrumx-server.tbtc.network:8443
27+
files:
28+
- .secret/keep-maintainer-keyfile
29+
30+
secretGenerator:
31+
- name: keep-maintainer-eth-account-password
32+
files:
33+
- .secret/keep-maintainer-password
34+
35+
patches:
36+
- target:
37+
kind: StatefulSet
38+
name: keep-maintainer
39+
patch: |-
40+
- op: add
41+
path: /spec/template/spec/containers/0/args/-
42+
value: --bitcoinDifficulty
43+
- op: replace
44+
path: /spec/template/spec/containers/0/env/0/valueFrom/secretKeyRef/name
45+
value: eth-network-goerli
46+
47+
generatorOptions:
48+
disableNameSuffixHash: true
49+
annotations:
50+
note: generated
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
resources:
2+
- ../../templates/keep-maintainer
3+
4+
namespace: default
5+
6+
commonLabels:
7+
app: keep-maintainer
8+
# The current setup runs spv and walletCoordination modules as a workaround
9+
# for reasons mentioned in `patches` property below.
10+
type: all
11+
network: goerli
12+
13+
images:
14+
- name: keep-maintainer
15+
newName: gcr.io/keep-test-f3e0/keep-client
16+
newTag: latest
17+
18+
configMapGenerator:
19+
- name: keep-maintainer-config
20+
behavior: merge
21+
literals:
22+
- network=testnet
23+
- electrum-api-url=ws://electrumx.bitcoin-testnet:8080
24+
files:
25+
- .secret/keep-maintainer-keyfile
26+
27+
secretGenerator:
28+
- name: keep-maintainer-eth-account-password
29+
files:
30+
- .secret/keep-maintainer-password
31+
32+
patches:
33+
# Testnet's maintainer shouldn't run `--bitcoinDifficulty` module, as the testnet
34+
# uses modified version of LightRelay contract (GoerliLightRelay) that doesn't
35+
# require the bitcoin difficulty to be submitted. This patch defines manually
36+
# which modules should be started.
37+
- target:
38+
kind: StatefulSet
39+
name: keep-maintainer
40+
patch: |-
41+
- op: add
42+
path: /spec/template/spec/containers/0/args/-
43+
value: --spv
44+
- op: add
45+
path: /spec/template/spec/containers/0/args/-
46+
value: --walletCoordination
47+
- op: replace
48+
path: /spec/template/spec/containers/0/env/0/valueFrom/secretKeyRef/name
49+
value: eth-network-goerli
50+
51+
generatorOptions:
52+
disableNameSuffixHash: true
53+
annotations:
54+
note: generated
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
resources:
2+
- maintainer-statefulset.yaml
3+
4+
commonLabels:
5+
app: keep-maintainer
6+
type: all
7+
8+
configMapGenerator:
9+
- name: keep-maintainer-config
10+
literals:
11+
- log-level=info
12+
- log-format=json
13+
14+
generatorOptions:
15+
disableNameSuffixHash: true
16+
annotations:
17+
note: generated

0 commit comments

Comments
 (0)