Skip to content

Commit

Permalink
get DAL pod to derive a list of pkh from a list of named accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasochem committed Dec 12, 2023
1 parent 0dccd81 commit a3c3063
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 3 additions & 2 deletions charts/tezos/scripts/dal-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ extra_args=""
if [ "${BOOTSTRAP_PROFILE}" == "true" ]; then
extra_args="--bootstrap-profile"
fi
if [ "${ATTESTER_PROFILES}" != "" ]; then
extra_args="${extra_args} --attester-profiles ${ATTESTER_PROFILES}"
if [ -s "${TEZ_VAR}/dal_attester_config" ]; then
attester_config=$(cat "/var/tezos/dal_attester_config")
extra_args="${extra_args} --attester-profiles ${attester_config}"
fi
if [ "${PEER}" != "" ]; then
extra_args="${extra_args} --peer ${PEER}"
Expand Down
16 changes: 15 additions & 1 deletion utils/config-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def main():
fill_in_missing_keys(all_accounts)

fill_in_activation_account(all_accounts)
import_keys(all_accounts)
all_accounts = import_keys(all_accounts)

if MY_POD_NAME in BAKING_NODES:
# If this node is a baker, it must have an account with a secret key.
Expand Down Expand Up @@ -170,6 +170,17 @@ def main():
with open("/var/tezos/snapshot_config.json", "w") as json_file:
print(node_snapshot_config_json, file=json_file)

# Create dal_config.json
if MY_POD_TYPE == "dal":
attest_for_accounts = json.loads(os.getenv("ATTEST_FOR_ACCOUNTS", "[]"))
attester_list = ""
for account in attest_for_accounts:
attester_list += f"{all_accounts[account]['public_key_hash']} "

with open("/var/tezos/dal_attester_config", "w") as attester_file:
print(attester_list, file=attester_file)
print("Generated dal attester account list for this node: %s" % attester_list)


# If NETWORK_CONFIG["genesis"]["block"] hasn't been specified, we generate a
# deterministic one.
Expand Down Expand Up @@ -439,6 +450,7 @@ def import_keys(all_accounts):
public_key_hashs = []
authorized_keys = []

accounts = {}
for account_name, account_values in all_accounts.items():
print("\n Importing keys for account: " + account_name)
account_key = account_values.get("key")
Expand Down Expand Up @@ -487,6 +499,7 @@ def import_keys(all_accounts):
f" Is account a bootstrap baker: "
+ f"{account_values.get('is_bootstrap_baker_account', False)}"
)
accounts[account_name] = account_values

sk_path, pk_path, pkh_path, ak_path = (
f"{tezdir}/secret_keys",
Expand All @@ -504,6 +517,7 @@ def import_keys(all_accounts):
print(f" Writing {ak_path}")
json.dump(authorized_keys, open(ak_path, "w"), indent=4)

return accounts

def create_node_identity_json():
identity_file_path = f"{DATA_DIR}/identity.json"
Expand Down

0 comments on commit a3c3063

Please sign in to comment.