Skip to content
Merged
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
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,3 @@ repos:
entry: mypy
language: system
types: [python]
- id: pyright
name: pyright
entry: pyright
language: system
types: [python]
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_kes.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _check_block_production(
)

# Check if the pool is forging any blocks
blocks_made = ledger_state["blocksCurrent"] or {}
blocks_made: dict = ledger_state["blocksCurrent"] or {}
is_forging = pool_id_dec in blocks_made

return epoch, is_forging
Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_mir_certs.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def registered_users(
fixture_cache: cluster_management.FixtureCache[list[clusterlib.PoolUser] | None]
with cluster_manager.cache_fixture() as fixture_cache:
if fixture_cache.value is not None:
return fixture_cache.value
return fixture_cache.value # type: ignore[no-any-return]
fixture_cache.value = registered

for i, pool_user in enumerate(registered):
Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_native_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,7 @@ def new_token(
fixture_cache: cluster_management.FixtureCache[clusterlib_utils.NativeTokenRec | None]
with cluster_manager.cache_fixture() as fixture_cache:
if fixture_cache.value is not None:
return fixture_cache.value
return fixture_cache.value # type: ignore[no-any-return]

rand = clusterlib.get_rand_str(4)
temp_template = f"test_tx_new_token_ci{cluster_manager.cluster_instance_num}_{rand}"
Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_staking_rewards.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ def test_decreasing_reward_transferred_funds(
f"Incorrect balance for source address `{delegation_out.pool_user.payment.address}`"
)

rewards_rec = []
rewards_rec: list[int] = []

# Keep withdrawing new rewards so reward balance is 0
def _withdraw():
Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/test_tx_negative.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def _get_validity_range(
"""Get validity range from a transaction body."""
tx_loaded = tx_view.load_tx_view(cluster_obj=cluster_obj, tx_body_file=tx_body_file)

validity_range = tx_loaded.get("validity range") or {}
validity_range: dict = tx_loaded.get("validity range") or {}

loaded_invalid_before = validity_range.get("lower bound")
loaded_invalid_hereafter = validity_range.get("upper bound") or validity_range.get(
Expand Down
6 changes: 4 additions & 2 deletions cardano_node_tests/tests/tests_conway/test_committee.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,9 @@ def _check_resign_dbsync(res_member: clusterlib.CCMember) -> None:

xfail_ledger_4001_msgs = set()
for _cc_member_key in (cc_member1_key, cc_member2_key, cc_member3_key):
rat_add_member_rec = rat_add_committee_state["committee"].get(_cc_member_key) or {}
rat_add_member_rec: dict = (
rat_add_committee_state["committee"].get(_cc_member_key) or {}
)
if rat_add_member_rec:
assert rat_add_member_rec["hotCredsAuthStatus"]["tag"] != "MemberAuthorized", (
"CC Member is still authorized"
Expand Down Expand Up @@ -1516,7 +1518,7 @@ def _check_rat_gov_state(
vote_zero_cc_epoch = cluster.g_query.get_epoch()

def _check_zero_cc_state(state: dict):
pparams = state.get("curPParams") or state.get("currentPParams") or {}
pparams: dict = state.get("curPParams") or state.get("currentPParams") or {}
clusterlib_utils.check_updated_params(
update_proposals=zero_cc_proposal.proposals, protocol_params=pparams
)
Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/tests_conway/test_drep.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def get_custom_drep(
fixture_cache: cluster_management.FixtureCache[governance_utils.DRepRegistration | None]
with cluster_manager.cache_fixture(key=caching_key) as fixture_cache:
if fixture_cache.value is not None:
return fixture_cache.value
return fixture_cache.value # type: ignore[no-any-return]

reg_drep = create_drep(
name_template=name_template,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ def _propose_pparams_update(
prev_action_rec=prev_action_rec,
)

proposed_pparams_errors = []
proposed_pparams_errors: list[str] = []

def _check_proposed_pparams(
update_proposals: list[clusterlib_utils.UpdateProposal], protocol_params: dict
Expand Down
2 changes: 1 addition & 1 deletion cardano_node_tests/tests/tests_plutus/test_mint_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def past_horizon_funds(
fixture_cache: cluster_management.FixtureCache[PHorizonFundsT | None]
with cluster_manager.cache_fixture() as fixture_cache:
if fixture_cache.value is not None:
return fixture_cache.value
return fixture_cache.value # type: ignore[no-any-return]

temp_template = common.get_test_id(cluster)
payment_addr = payment_addrs[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ def fund_script_guessing_game_v1(
fixture_cache: cluster_management.FixtureCache[FundTupleT | None]
with cluster_manager.cache_fixture() as fixture_cache:
if fixture_cache.value is not None:
return fixture_cache.value
return fixture_cache.value # type: ignore[no-any-return]

temp_template = common.get_test_id(cluster)

Expand All @@ -780,7 +780,7 @@ def fund_script_guessing_game_v2(
fixture_cache: cluster_management.FixtureCache[FundTupleT | None]
with cluster_manager.cache_fixture() as fixture_cache:
if fixture_cache.value is not None:
return fixture_cache.value
return fixture_cache.value # type: ignore[no-any-return]

temp_template = common.get_test_id(cluster)

Expand Down
8 changes: 4 additions & 4 deletions cardano_node_tests/utils/clusterlib_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,11 +547,11 @@ def load_registered_pool_data(
pool_id = helpers.decode_bech32(pool_id)

pool_state: dict = cluster_obj.g_query.get_pool_state(stake_pool_id=pool_id).pool_params
metadata = helpers.get_pool_param("spsMetadata", pool_params=pool_state) or {}
metadata: dict = helpers.get_pool_param("spsMetadata", pool_params=pool_state) or {}

# TODO: extend to handle more relays records
relays_list = helpers.get_pool_param("spsRelays", pool_params=pool_state) or []
relay = relays_list[0] if relays_list else {}
relays_list: list = helpers.get_pool_param("spsRelays", pool_params=pool_state) or []
relay: dict = relays_list[0] if relays_list else {}
relay = relay.get("single host address") or {}

pool_data = clusterlib.PoolData(
Expand Down Expand Up @@ -605,7 +605,7 @@ def _get_param(key: str) -> tp.Any:
)

if pool_creation_data.pool_metadata_url and pool_creation_data.pool_metadata_hash:
metadata = _get_param("spsMetadata") or {}
metadata: dict = _get_param("spsMetadata") or {}

metadata_hash = metadata.get("hash")
if metadata_hash != pool_creation_data.pool_metadata_hash:
Expand Down
6 changes: 3 additions & 3 deletions cardano_node_tests/utils/dbsync_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ def check_pool_data( # noqa: C901
f"Expected: {sps_cost} vs Returned: {db_pool_data.fixed_cost}"
)

metadata = helpers.get_pool_param("spsMetadata", pool_params=ledger_pool_data) or {}
metadata: dict = helpers.get_pool_param("spsMetadata", pool_params=ledger_pool_data) or {}

metadata_hash = metadata.get("hash") or ""
if metadata_hash != db_pool_data.metadata_hash:
Expand Down Expand Up @@ -751,7 +751,7 @@ def check_pool_off_chain_data(
msg = f"no off chain data for pool {pool_id}"
raise DbSyncNoResponseError(msg)

metadata = helpers.get_pool_param("spsMetadata", pool_params=ledger_pool_data) or {}
metadata: dict = helpers.get_pool_param("spsMetadata", pool_params=ledger_pool_data) or {}
metadata_hash = metadata.get("hash") or ""
db_metadata_hash = db_pool_off_chain_data[0].hash.hex()

Expand All @@ -775,7 +775,7 @@ def check_pool_off_chain_fetch_error(
raise DbSyncNoResponseError(msg)

fetch_error_str = db_pool_off_chain_fetch_error[0].fetch_error or ""
metadata = helpers.get_pool_param("spsMetadata", pool_params=ledger_pool_data) or {}
metadata: dict = helpers.get_pool_param("spsMetadata", pool_params=ledger_pool_data) or {}
metadata_url = metadata.get("url") or ""

assert (
Expand Down
4 changes: 2 additions & 2 deletions cardano_node_tests/utils/governance_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def create_vote_stake(


def load_committee(*, cluster_obj: clusterlib.ClusterLib) -> list[governance_utils.CCKeyMember]:
genesis_cc_members = cluster_obj.conway_genesis.get("committee", {}).get("members") or {}
genesis_cc_members: dict = cluster_obj.conway_genesis.get("committee", {}).get("members") or {}
if not genesis_cc_members:
return []

Expand Down Expand Up @@ -292,7 +292,7 @@ def _setup_gov() -> governance_utils.GovernanceRecords | None:
fixture_cache: cluster_management.FixtureCache[governance_utils.GovernanceRecords | None]
with cluster_manager.cache_fixture(key=gov_data_checksum) as fixture_cache:
if fixture_cache.value is not None:
return fixture_cache.value
return fixture_cache.value # type: ignore[no-any-return]

if governance_data is None:
with open(gov_data_store, "rb") as in_data:
Expand Down
8 changes: 4 additions & 4 deletions cardano_node_tests/utils/governance_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,12 @@ def get_vote_str(*, vote: clusterlib.Votes) -> str:

def check_drep_delegation(*, deleg_state: dict, drep_id: str, stake_addr_hash: str) -> None:
dstate = deleg_state["dstate"]
drep_records = dstate.get("accounts") or {} # In cardano-node >= 10.6.0
drep_records: dict = dstate.get("accounts") or {} # In cardano-node >= 10.6.0
if not drep_records:
drep_records = dstate.get("unified", {}).get("credentials") or {}

stake_addr_key = f"keyHash-{stake_addr_hash}"
stake_addr_val = drep_records.get(stake_addr_key) or {}
stake_addr_val: dict = drep_records.get(stake_addr_key) or {}

cred_name = get_drep_cred_name(drep_id=drep_id)
expected_drep = f"drep-{cred_name}"
Expand All @@ -225,11 +225,11 @@ def check_drep_stake_distribution(
def get_prev_action(
*, action_type: PrevGovActionIds, gov_state: dict[str, tp.Any]
) -> PrevActionRec:
prev_action_rec = (
prev_action_rec: dict = (
gov_state["nextRatifyState"]["nextEnactState"]["prevGovActionIds"][action_type.value] or {}
)
txid = prev_action_rec.get("txId") or ""
_ix = prev_action_rec.get("govActionIx", None)
_ix = prev_action_rec.get("govActionIx")
ix = -1 if _ix is None else _ix
return PrevActionRec(txid=txid, ix=ix)

Expand Down
4 changes: 2 additions & 2 deletions cardano_node_tests/utils/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def merge_reqs(*reqs: dict[str, dict]) -> dict:
for gname, greqs in report.items():
merged_group = merged.get(gname) or {}
for req_id, req_data in greqs.items():
merged_rec = merged_group.get(req_id) or {}
merged_rec: dict = merged_group.get(req_id) or {}
merged_status_key = merged_rec.get("status") or "uncovered"

merged_status_val = Statuses[merged_status_key].value
Expand All @@ -137,7 +137,7 @@ def get_mapped_req(*, mapping: pl.Path, executed_req: dict) -> dict: # noqa: C9
errors: dict[str, set[str]] = {}
for group, reqs in requirements_mapping.items():
reqs_set = set(reqs.keys())
executed_group = executed_req.get(group) or {}
executed_group: dict = executed_req.get(group) or {}
if not executed_group:
executed_req[group] = executed_group

Expand Down
8 changes: 4 additions & 4 deletions cardano_node_tests/utils/tx_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def _check_inline_datums(tx_raw_output: clusterlib.TxRawOutput, tx_loaded: dict)

def _check_return_collateral(tx_raw_output: clusterlib.TxRawOutput, tx_loaded: dict) -> None:
"""Check return collateral in tx_view."""
collateral_inputs = tx_loaded.get("collateral inputs") or []
collateral_inputs: list = tx_loaded.get("collateral inputs") or []
if not collateral_inputs:
return

Expand All @@ -210,7 +210,7 @@ def _check_return_collateral(tx_raw_output: clusterlib.TxRawOutput, tx_loaded: d
if tx_raw_output.total_collateral_amount and not tx_raw_output.return_collateral_txouts:
return

return_collateral = tx_loaded.get("return collateral") or {}
return_collateral: dict = tx_loaded.get("return collateral") or {}
assert return_collateral, "No return collateral in tx view"

assert "lovelace" in return_collateral.get("amount", {}), (
Expand Down Expand Up @@ -256,7 +256,7 @@ def check_tx_view( # noqa: C901
raise AssertionError(msg)

# Check outputs
tx_loaded_outputs = tx_loaded.get("outputs") or []
tx_loaded_outputs: list = tx_loaded.get("outputs") or []
loaded_txouts: set[tuple[str, int, str]] = set()
for txout in tx_loaded_outputs:
address = txout["address"]
Expand All @@ -280,7 +280,7 @@ def check_tx_view( # noqa: C901
raise AssertionError(msg)

# Check validity intervals
validity_range = tx_loaded.get("validity range") or {}
validity_range: dict = tx_loaded.get("validity range") or {}

loaded_invalid_before = validity_range.get("lower bound")
if tx_raw_output.invalid_before != loaded_invalid_before:
Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ dev = [
"mypy (>=1.19.0,<2.0.0)",
"pandas (>=2.3.3,<3.0.0)",
"pre-commit (>=4.5.0,<5.0.0)",
"pyright (>=1.1.406,<1.1.407)", # Regression in 1.1.407, see #11060
"seaborn (>=0.13.2,<0.14.0)",
"types-pyyaml (>=6.0.12.20250915,<7.0.0.0)",
"types-requests (>=2.32.4.20250913,<3.0.0.0)",
Expand Down Expand Up @@ -116,6 +115,13 @@ warn_return_any = true
pythonVersion = "3.13"
reportPrivateImportUsage = false

[tool.pyrefly]
python_version = "3.13.0"
project_includes = ["cardano_node_tests", "framework_tests"]
replace_imports_with_any = ["allure.*", "hypothesis.*", "pytest.*", "pytest_subtests.*", "psycopg2.*", "requests.*"]
ignore_errors_in_generated_code = true
ignore_missing_source = true

[tool.pytest.ini_options]
log_cli = true
log_level = "INFO"
Expand Down
15 changes: 0 additions & 15 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading