Skip to content

feat(tests): derive cost model proposals from live protocol params#3525

Open
OlufemiAdeOlusile wants to merge 2 commits into
masterfrom
dynamic-cost-model-tests
Open

feat(tests): derive cost model proposals from live protocol params#3525
OlufemiAdeOlusile wants to merge 2 commits into
masterfrom
dynamic-cost-model-tests

Conversation

@OlufemiAdeOlusile

Copy link
Copy Markdown
Collaborator

Summary

  • Governance and upgrade tests hardcoded fixture files with fixed PlutusV2/V3 cost model lengths (185/297, 185). Mainnet governance updates cost models over time, so these fixtures drift out of sync and get rejected by the node.
  • Added cost_model_utils.get_current_cost_models/write_cost_model_proposal to build a governance proposal from the cluster's own live protocol parameters instead. test_pparam_update.py and test_node_upgrade.py now use this for their happy-path proposals; test_incompatible_cost_models keeps its static fixture since it intentionally tests format rejection.
  • Derived LAST_KNOWN_PROTOCOL_VERSION from Versions.MAP instead of a hardcoded constant, so it no longer needs a manual bump on every new protocol version.

Companion infra fix: IntersectMBO/cardonnay#148 (syncs genesis cost model values with mainnet; this PR is what stays dynamic on the test side going forward).

Test plan

  • ./ai_run.sh make lint passes
  • pytest -k test_update_cost_models against a running cluster (both test_pparam_update.py and test_node_upgrade.py upgrade-step-2 variants)

Governance and upgrade tests hardcoded fixture files with fixed
PlutusV2/V3 cost model lengths (185/297, 185). Mainnet governance
updates cost models over time, so these fixtures drift out of sync
and get rejected by the node.

Add cost_model_utils.get_current_cost_models/write_cost_model_proposal
to build a governance proposal from the cluster's own live protocol
parameters instead. test_pparam_update.py and test_node_upgrade.py
now use this for their happy-path proposals; test_incompatible_cost_models
keeps its static fixture since it intentionally tests format rejection.

Also derive LAST_KNOWN_PROTOCOL_VERSION from Versions.MAP instead of
a hardcoded constant, so it no longer needs a manual bump on every
new protocol version.
get_protocol_params() returns dict[str, Any], so subscripting it
returned Any despite the function's declared return type. Assign
through an explicitly annotated local so mypy narrows it to
dict[str, list[int]].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant