Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: 3.12
# Pinned to 3.11: pandas 1.5.x has no cp312 wheels, so 3.12 forces a
# source build that fails on modern setuptools (no pkg_resources).
python-version: "3.11"

- name: Run image
uses: abatilo/actions-poetry@v3
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ click = "^8.2.1"
pyyaml = "^6.0.2"


[tool.ruff.lint]
# Pin to ruff's documented default rule set so CI is stable across ruff
# versions (newer ruff enables many more rules by default otherwise). The
# codebase is clean under this set; broadening it is a separate cleanup.
select = ["E4", "E7", "E9", "F"]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
18 changes: 18 additions & 0 deletions topology_optimizer/data_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ def prepare_data(
) -> Dict[str, Any]:
# Remove everything that is not a replica
df_nodes = df_nodes[df_nodes["node_type"] != "API_BOUNDARY"]
# Exclude reward-type-4 nodes (Type4, Type4dot1, ... Type4dot5) entirely so
# they never enter the ILP input space. The dashboard formats the value as
# e.g. "Type4dot5"; lowercasing makes the match robust to that and to the
# registry's "type4.5" form. Guarded so older CSVs without the column work.
if "node_reward_type" in df_nodes.columns:
df_nodes = df_nodes[
~df_nodes["node_reward_type"].fillna("").str.lower().str.startswith("type4")
]
# Preprocessing
current_nodes = create_node_dataframe(df_nodes, sev_node_providers)

Expand Down Expand Up @@ -127,4 +135,14 @@ def default_special_limits(
"node_provider": {"DFINITY": (0, "eq")},
}

# Confidential (SEV) subnets do not host a DFINITY node, so override the
# default "exactly one DFINITY node per subnet" requirement.
confidential_subnets = network_topology[
network_topology["subnet_type"] == "Confidential"
]
for confidential_subnet_id in confidential_subnets.index:
limits[confidential_subnet_id] = {
"node_provider": {"DFINITY": (0, "eq")},
}

return limits
Loading