Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasochem committed Dec 12, 2023
1 parent 8094c2b commit b4f4eb5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion mkchain/tqchain/mkchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def main():

dalNodes = {
f"{DAL_NODE_NAME}-{n}": {
"attester_using_accounts": [ "baker-0"],
"attester_using_accounts": ["baker-0"],
"node_rpc_url": f"http://{L1_NODE_NAME}-0.{L1_NODE_NAME}:8732",
}
for n in range(args.dal_nodes)
Expand Down
32 changes: 24 additions & 8 deletions utils/config-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def main():
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(attester_list, file=attester_file)
print("Generated dal attester account list for this node: %s" % attester_list)


Expand Down Expand Up @@ -334,16 +334,22 @@ def fill_in_missing_keys(all_accounts):
account_values["key"] = sk_b58
account_values["type"] = "secret"


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 (
signer_val["authorized_keys"][0]
if signer_val["authorized_keys"]
else None
)
return


def expose_secret_key(account_name):
"""
Decides if an account needs to have its secret key exposed on the current
Expand All @@ -355,20 +361,23 @@ def expose_secret_key(account_name):
"""
if MY_POD_TYPE == "activating":
activation_account = NETWORK_CONFIG["activation_account_name"]
return account_name in [ activation_account, authorized_key_for(activation_account)]
return account_name in [
activation_account,
authorized_key_for(activation_account),
]

if MY_POD_TYPE == "signing":
return account_name in MY_POD_CONFIG.get("accounts")

if MY_POD_TYPE == "rollup":
return account_name == MY_POD_CONFIG.get("operator_account")

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

return False
Expand Down Expand Up @@ -519,6 +528,7 @@ def import_keys(all_accounts):

return accounts


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

Expand Down Expand Up @@ -589,7 +599,10 @@ def create_protocol_parameters_json(accounts):

# Append any additional bootstrap params such as smart rollups, if any
if protocol_activation.get("bootstrap_parameters"):
protocol_params = { **protocol_params, **protocol_activation.get("bootstrap_parameters") }
protocol_params = {
**protocol_params,
**protocol_activation.get("bootstrap_parameters"),
}

return protocol_params

Expand Down Expand Up @@ -744,7 +757,10 @@ def create_node_snapshot_config_json(history_mode):
response = requests.get(snapshot_source)
response.raise_for_status() # Raises an HTTPError if the HTTP request returned an unsuccessful status code
all_snapshots = response.json()
except (requests.exceptions.RequestException, requests.exceptions.JSONDecodeError): # Catches exceptions related to requests and invalid JSON
except (
requests.exceptions.RequestException,
requests.exceptions.JSONDecodeError,
): # Catches exceptions related to requests and invalid JSON
print(f"Error: unable to retrieve snapshot metadata from {snapshot_source}")
return
else:
Expand Down

0 comments on commit b4f4eb5

Please sign in to comment.