Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasochem committed Dec 13, 2023
1 parent 5736ca4 commit 60ea864
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
17 changes: 12 additions & 5 deletions mkchain/tqchain/mkchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,13 @@ def node_config(n):
ret["config"]["shell"]["history_mode"] = "archive"
return ret


def assign_node_rpc_url(entities, num_nodes, node_name_prefix):
for i, key in enumerate(entities):
node_index = i % num_nodes
entities[key]["node_rpc_url"] = f"http://{node_name_prefix}-{node_index}.{node_name_prefix}:8732"
entities[key][
"node_rpc_url"
] = f"http://{node_name_prefix}-{node_index}.{node_name_prefix}:8732"


def main():
Expand Down Expand Up @@ -247,25 +250,29 @@ def main():

# Assign node_rpc_url for DAL nodes
assign_node_rpc_url(dalNodes, args.nodes, L1_NODE_NAME)

# Initialize bakers data and assign to DAL nodes in round-robin fashion
bakers = {}
for i, char in enumerate(string.ascii_lowercase[: args.bakers]):
dal_node_index = i % args.dal_nodes
baker_name = f"{BAKER_NAME}-{char}"
bakers[char] = {
"bake_using_accounts": [baker_name],
"dal_node_rpc_url": f"http://{DAL_NODE_NAME}-{dal_node_index}:10732"
"dal_node_rpc_url": f"http://{DAL_NODE_NAME}-{dal_node_index}:10732",
}
# Add the baker to the DAL node's attest_for_accounts list
dalNodes[f"{DAL_NODE_NAME}-{dal_node_index}"]["attest_using_accounts"].append(baker_name)
dalNodes[f"{DAL_NODE_NAME}-{dal_node_index}"]["attest_using_accounts"].append(
baker_name
)

# Assign node_rpc_url for bakers
assign_node_rpc_url(bakers, args.nodes, L1_NODE_NAME)

octezSigners = {
"tezos-signer-0": {
"accounts": [f"baker-{char}" for char in string.ascii_lowercase[: args.bakers]],
"accounts": [
f"baker-{char}" for char in string.ascii_lowercase[: args.bakers]
],
"authorized_keys": ["authorized-key-0"],
}
}
Expand Down
20 changes: 10 additions & 10 deletions test/charts/private-chain.expect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,8 @@ spec:
extra_args="${extra_args} --operations-pool $(cat /etc/tezos/baker-config/${my_baker_account}_operations_pool)"
fi
if [ -f /etc/tezos/baker-config/${my_baker_account}_dal_node ]; then
extra_args="${extra_args} --dal-node $(cat /etc/tezos/baker-config/${my_baker_account}_dal_node)"
if [ -f /etc/tezos/baker-config/${my_baker_account}_dal_node_rpc_url ]; then
extra_args="${extra_args} --dal-node $(cat /etc/tezos/baker-config/${my_baker_account}_dal_node_rpc_url)"
fi
CLIENT="$TEZ_BIN/octez-client -d $CLIENT_DIR"
Expand Down Expand Up @@ -912,8 +912,8 @@ spec:
extra_args="${extra_args} --operations-pool $(cat /etc/tezos/baker-config/${my_baker_account}_operations_pool)"
fi
if [ -f /etc/tezos/baker-config/${my_baker_account}_dal_node ]; then
extra_args="${extra_args} --dal-node $(cat /etc/tezos/baker-config/${my_baker_account}_dal_node)"
if [ -f /etc/tezos/baker-config/${my_baker_account}_dal_node_rpc_url ]; then
extra_args="${extra_args} --dal-node $(cat /etc/tezos/baker-config/${my_baker_account}_dal_node_rpc_url)"
fi
CLIENT="$TEZ_BIN/octez-client -d $CLIENT_DIR"
Expand Down Expand Up @@ -993,8 +993,8 @@ spec:
extra_args="${extra_args} --operations-pool $(cat /etc/tezos/baker-config/${my_baker_account}_operations_pool)"
fi
if [ -f /etc/tezos/baker-config/${my_baker_account}_dal_node ]; then
extra_args="${extra_args} --dal-node $(cat /etc/tezos/baker-config/${my_baker_account}_dal_node)"
if [ -f /etc/tezos/baker-config/${my_baker_account}_dal_node_rpc_url ]; then
extra_args="${extra_args} --dal-node $(cat /etc/tezos/baker-config/${my_baker_account}_dal_node_rpc_url)"
fi
CLIENT="$TEZ_BIN/octez-client -d $CLIENT_DIR"
Expand Down Expand Up @@ -1074,8 +1074,8 @@ spec:
extra_args="${extra_args} --operations-pool $(cat /etc/tezos/baker-config/${my_baker_account}_operations_pool)"
fi
if [ -f /etc/tezos/baker-config/${my_baker_account}_dal_node ]; then
extra_args="${extra_args} --dal-node $(cat /etc/tezos/baker-config/${my_baker_account}_dal_node)"
if [ -f /etc/tezos/baker-config/${my_baker_account}_dal_node_rpc_url ]; then
extra_args="${extra_args} --dal-node $(cat /etc/tezos/baker-config/${my_baker_account}_dal_node_rpc_url)"
fi
CLIENT="$TEZ_BIN/octez-client -d $CLIENT_DIR"
Expand Down Expand Up @@ -1155,8 +1155,8 @@ spec:
extra_args="${extra_args} --operations-pool $(cat /etc/tezos/baker-config/${my_baker_account}_operations_pool)"
fi
if [ -f /etc/tezos/baker-config/${my_baker_account}_dal_node ]; then
extra_args="${extra_args} --dal-node $(cat /etc/tezos/baker-config/${my_baker_account}_dal_node)"
if [ -f /etc/tezos/baker-config/${my_baker_account}_dal_node_rpc_url ]; then
extra_args="${extra_args} --dal-node $(cat /etc/tezos/baker-config/${my_baker_account}_dal_node_rpc_url)"
fi
CLIENT="$TEZ_BIN/octez-client -d $CLIENT_DIR"
Expand Down

0 comments on commit 60ea864

Please sign in to comment.