Skip to content

Commit

Permalink
Merge branch 'bake_remotely' into midlbaker
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasochem committed Dec 16, 2023
2 parents b8b9823 + f74ce19 commit 11b86b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
3 changes: 3 additions & 0 deletions charts/tezos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,9 @@ expected_proof_of_work: 26
# # The name of the account who's public key will be set downstream in
# # config.json at `network.genesis_parameters.values.genesis_pubkey`.
# activation_account_name: baker0
# # if activation account is on a remote signer requiring authorization,
# # put authorized key account here
# activation_account_authorized_key: authorizedKey0
#
## To join a public network you may set `chain_name` in one of two ways:
## - Specify the name of the network which must be recognized by the
Expand Down
25 changes: 5 additions & 20 deletions utils/config-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,6 @@ def verify_this_bakers_account(accounts):
# public key hash as a side-effect. These are used later.


def authorized_key_for(account_name):
"""
If `account_name` has a remote signer and this remote signer
requires an authorized key, returns it.
"""
for signer_val in OCTEZ_SIGNERS.values():
if account_name in signer_val["accounts"]:
return (
signer_val["authorized_keys"][0]
if signer_val["authorized_keys"]
else None
)
return


def expose_secret_key(account_name):
"""
Expand All @@ -235,10 +221,9 @@ def expose_secret_key(account_name):
as is the case in Octez client's "secret_keys" file.
"""
if MY_POD_TYPE == "activating":
activation_account = NETWORK_CONFIG["activation_account_name"]
return account_name in [
activation_account,
authorized_key_for(activation_account),
NETWORK_CONFIG["activation_account_name"],
NETWORK_CONFIG["activation_account_authorized_key"]
]

if MY_POD_TYPE == "signing":
Expand All @@ -251,9 +236,9 @@ def expose_secret_key(account_name):
return account_name == os.environ["INJECTOR_ACCOUNT"]

if MY_POD_TYPE in ["node", "baker"]:
for baking_account in MY_POD_CONFIG.get("bake_using_accounts", {}):
if account_name in [baking_account, authorized_key_for(baking_account)]:
return True
if account_name in MY_POD_CONFIG.get("authorized_keys", {}):
return True
return account_name in MY_POD_CONFIG.get("bake_using_accounts", {})


def get_accounts_signer(signers, account_name):
Expand Down

0 comments on commit 11b86b5

Please sign in to comment.