Skip to content

Commit

Permalink
Allow to load web3signer key from deposit data (#408)
Browse files Browse the repository at this point in the history
Signed-off-by: cyc60 <avsysoev60@gmail.com>
  • Loading branch information
cyc60 authored Sep 5, 2024
1 parent ec95f95 commit 29fb6f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Settings(metaclass=Singleton):
keystores_password_file: Path
remote_signer_url: str | None
remote_signer_public_keys_url: str | None
remote_signer_use_deposit_data: bool
dappnode: bool = False
hashi_vault_key_paths: list[str] | None
hashi_vault_url: str | None
Expand Down Expand Up @@ -167,6 +168,9 @@ def set(
self.remote_signer_public_keys_url: str = decouple_config(
'REMOTE_SIGNER_PUBLIC_KEYS_URL', default=None
)
self.remote_signer_use_deposit_data: bool = decouple_config(
'REMOTE_SIGNER_USE_DEPOSIT_DATA', default=False, cast=bool
)
self.dappnode = dappnode

# hashi vault configuration
Expand Down
5 changes: 5 additions & 0 deletions src/validators/keystores/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from src.config.settings import REMOTE_SIGNER_TIMEOUT, settings
from src.validators.keystores.base import BaseKeystore
from src.validators.utils import load_deposit_data

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -50,6 +51,10 @@ def __init__(self, public_keys: list[HexStr]):

@staticmethod
async def load() -> 'BaseKeystore':
if settings.remote_signer_use_deposit_data:
deposit_data = load_deposit_data(settings.vault, settings.deposit_data_file)
return RemoteSignerKeystore(deposit_data.public_keys)

public_keys = await RemoteSignerKeystore._get_remote_signer_public_keys()
return RemoteSignerKeystore(public_keys)

Expand Down

0 comments on commit 29fb6f3

Please sign in to comment.