Skip to content

Commit d2fe6ac

Browse files
committed
Support cb-signer
1 parent 1043b5a commit d2fe6ac

File tree

7 files changed

+192
-3
lines changed

7 files changed

+192
-3
lines changed

commit-boost-pbs.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ services:
1111
image: ${CB_PBS_DOCKER_REPO:-ghcr.io/commit-boost/pbs}:${CB_PBS_DOCKER_TAG:-latest}
1212
environment:
1313
CB_CONFIG: /cb-config.toml
14-
CB_METRICS_PORT: 10000
1514
volumes:
16-
- ./commit-boost/cb-config.toml:/cb-config.toml:ro
15+
- ./commit-boost/cb-config.toml:/cb-config.toml:ro
1716
networks:
1817
default:
1918
aliases:

commit-boost-signer.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
x-logging: &logging
2+
logging:
3+
driver: json-file
4+
options:
5+
max-size: 100m
6+
max-file: "3"
7+
tag: '{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}'
8+
9+
services:
10+
cb-signer-init:
11+
build:
12+
context: ./commit-boost
13+
dockerfile: Dockerfile.signer-init
14+
image: init:cb-signer
15+
restart: no
16+
environment:
17+
COMPOSE_FILE: ${COMPOSE_FILE}
18+
LOG_LEVEL: ${LOG_LEVEL:-info}
19+
WEB3SIGNER: ${WEB3SIGNER:-false}
20+
W3S_NODE: ${W3S_NODE}
21+
volumes:
22+
- ./commit-boost/cb-config.toml:/cb-config.toml
23+
24+
cb-signer:
25+
image: ${CB_SIGNER_DOCKER_REPO:-ghcr.io/commit-boost/pbs}:${CB_SIGNER_DOCKER_TAG:-latest}
26+
environment:
27+
CB_CONFIG: /cb-config.toml
28+
volumes:
29+
- ./commit-boost/cb-config.toml:/cb-config.toml:ro
30+
- lhvalidator-data:/var/lib/lighthouse
31+
- lsvalidator-data:/var/lib/lodestar
32+
- prysmvalidator-data:/var/lib/prysm
33+
- teku-data:/var/lib/teku
34+
- teku-vc-data:/var/lib/teku-vc
35+
- nimbus-vc-data:/var/lib/nimbus
36+
depends_on:
37+
cb-signer-init:
38+
condition: service_completed_successfully
39+
40+
networks:
41+
default:
42+
aliases:
43+
- ${CB_SIGNER_ALIAS:-cb-signer-${NETWORK}} # This allows multiple Eth Docker stacks all connected to the same bridge network
44+
labels:
45+
- metrics.scrape=true
46+
- metrics.path=/metrics
47+
- metrics.port=10000
48+
- metrics.instance=cb-signer
49+
- metrics.network=${NETWORK}
50+
51+
volumes:
52+
lhvalidator-data:
53+
lsvalidator-data:
54+
prysmvalidator-data:
55+
teku-data:
56+
teku-vc-data:
57+
nimbus-vc-data:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM python:3.13-alpine
2+
3+
WORKDIR /app
4+
5+
RUN pip install --no-cache-dir tomlkit
6+
7+
COPY ./signer-init.py .
8+
9+
ENTRYPOINT ["python", "signer-init.py"]
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# See https://github.com/Commit-Boost/commit-boost-client/blob/main/config.example.toml
2+
chain = "Hoodi"
3+
4+
[pbs]
5+
port = 18550
6+
host = "0.0.0.0"
7+
with_signer = true
8+
9+
[[relays]]
10+
id = "aestus"
11+
url = "https://0x98f0ef62f00780cf8eb06701a7d22725b9437d4768bb19b363e882ae87129945ec206ec2dc16933f31d983f8225772b6@hoodi.aestus.live"
12+
[[relays]]
13+
id = "titan"
14+
url = "https://0xaa58208899c6105603b74396734a6263cc7d947f444f396a90f7b7d3e65d102aec7e5e5291b27e08d02c50a050825c2f@hoodi.titanrelay.xyz"
15+
[[relays]]
16+
id = "flashbots"
17+
url = "https://0xafa4c6985aa049fb79dd37010438cfebeb0f2bd42b115b89dd678dab0670c1de38da0c4e9138c9290a398ecd9a0b3110@boost-relay-hoodi.flashbots.net"
18+
[[relays]]
19+
id = "ultrasound"
20+
url = "https://0xb1559beef7b5ba3127485bbbb090362d9f497ba64e177ee2c8e7db74746306efad687f2cf8574e38d70067d40ef136dc@relay-hoodi.ultrasound.money"
21+
22+
# For Remote signer:
23+
# [signer.remote]
24+
# URL of the Web3Signer instance
25+
# url = "https://remote.signer.url"
26+
27+
# [signer.local.loader]
28+
# ValidatorsDir: format of the keystore (lighthouse, prysm, teku, lodestar, or nimbus)
29+
# format = "lighthouse"
30+
# ValidatorsDir: full path to the keys directory
31+
# For lighthouse, it's the path to the directory where the `<pubkey>` directories are located, under each of which is a `voting-keystore.json` file.
32+
# For prysm, it's the path to the `all-accounts.keystore.json` file.
33+
# For teku, it's the path to the directory where all `<pubkey>.json` files are located.
34+
# For lodestar, it's the path to the directory where all `<pubkey>.json` files are located.
35+
# For nimbus, it's the path to the directory where the `<pubkey>` directories are located, under each of which is a `keystore.json` file.
36+
# keys_path = ""
37+
# ValidatorsDir: full path to the secrets file/directory
38+
# For lighthouse, it's the path to the directory where the `<pubkey>` files are located.
39+
# For prysm, it's the path to the file containing the wallet decryption password.
40+
# For teku, it's the path to the directory where all `<pubkey>.txt` files are located.
41+
# For lodestar, it's the path to the file containing the decryption password.
42+
# For nimbus, it's the path to the directory where the `<pubkey>` files are located.
43+
# secrets_path = ""
44+
45+
[metrics]
46+
port = 10000
47+
host = "0.0.0.0"
48+
49+
[logs.stdout]
50+
level = "info"
51+
52+
[logs.file]
53+
enabled = false

commit-boost/cb-config.toml.sample

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
# See https://github.com/Commit-Boost/commit-boost-client/blob/main/config.example.toml
12
chain = "Hoodi"
23

34
[pbs]
45
port = 18550
6+
host = "0.0.0.0"
57

68
[[relays]]
79
id = "aestus"
@@ -15,3 +17,13 @@ url = "https://0xafa4c6985aa049fb79dd37010438cfebeb0f2bd42b115b89dd678dab0670c1d
1517
[[relays]]
1618
id = "ultrasound"
1719
url = "https://0xb1559beef7b5ba3127485bbbb090362d9f497ba64e177ee2c8e7db74746306efad687f2cf8574e38d70067d40ef136dc@relay-hoodi.ultrasound.money"
20+
21+
[metrics]
22+
port = 10000
23+
host = "0.0.0.0"
24+
25+
[logs.stdout]
26+
level = "info"
27+
28+
[logs.file]
29+
enabled = false

commit-boost/signer-init.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import os
2+
import logging
3+
import sys
4+
import tomlkit
5+
from pathlib import Path
6+
from collections.abc import Mapping
7+
from typing import Any
8+
from tomlkit.toml_document import TOMLDocument
9+
10+
logger = logging.getLogger("signer-init")
11+
if not logger.handlers:
12+
_handler = logging.StreamHandler(sys.stdout)
13+
_handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(message)s"))
14+
logger.addHandler(_handler)
15+
_level = os.getenv("LOG_LEVEL", "INFO").upper()
16+
logger.setLevel(getattr(logging, _level, logging.INFO))
17+
logger.propagate = False # Prevent propagation to root logger
18+
19+
def getenv_bool(name: str, default: bool = False) -> bool:
20+
val = os.getenv(name)
21+
if val is None:
22+
return default
23+
return val.strip().lower() in {"true"}
24+
25+
# Load environment variables
26+
COMPOSE_FILE = os.environ["COMPOSE_FILE"]
27+
WEB3SIGNER = getenv_bool("WEB3SIGNER", default=False)
28+
W3S_NODE = os.getenv("W3S_NODE", "")
29+
LOG_LEVEL = os.getenv("LOG_LEVEL", "info").lower()
30+
31+
def get_in(mapping: Mapping[str, Any] ,path: str, default: Any=None) -> Any:
32+
"""Safe lookup like 'signer.remote.url'."""
33+
cur = mapping
34+
for key in path.split("."):
35+
if isinstance(cur, Mapping) and key in cur:
36+
cur = cur[key]
37+
else:
38+
return default
39+
return cur
40+
41+
def update_signer(doc: TOMLDocument) -> None:
42+
43+
def main():
44+
path = Path("/cb-config.toml")
45+
doc = tomlkit.parse(path.read_text(encoding="utf-8"))
46+
47+
doc["logs"]["stdout"]["level"] = LOG_LEVEL
48+
49+
update_signer(doc)
50+
51+
path.write_text(tomlkit.dumps(doc), encoding="utf-8")
52+
53+
sys.exit(0)
54+
55+
if __name__ == "__main__":
56+
main()

default.env

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ CONTRIBUTOOR_DOCKER_TAG=latest
268268
# Commit-Boost
269269
CB_PBS_DOCKER_TAG=latest
270270
CB_PBS_DOCKER_REPO=ghcr.io/commit-boost/pbs
271+
CB_SIGNER_DOCKER_TAG=latest
272+
CB_SIGNER_DOCKER_REPO=ghcr.io/commit-boost/signer
273+
271274
# MEV-Boost
272275
# SRC build target can be a tag, a branch, or a pr as "pr-ID"
273276
MEV_SRC_BUILD_TARGET=stable
@@ -413,4 +416,4 @@ NODE_EXPORTER_IGNORE_MOUNT_REGEX='^/(dev|proc|sys|run|var/snap/.+|var/lib/docker
413416
DOCKER_ROOT=/var/lib/docker
414417

415418
# Used by ethd update - please do not adjust
416-
ENV_VERSION=40
419+
ENV_VERSION=41

0 commit comments

Comments
 (0)