feat(tests): derive cost model proposals from live protocol params#3525
Open
OlufemiAdeOlusile wants to merge 2 commits into
Open
feat(tests): derive cost model proposals from live protocol params#3525OlufemiAdeOlusile wants to merge 2 commits into
OlufemiAdeOlusile wants to merge 2 commits into
Conversation
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]].
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cost_model_utils.get_current_cost_models/write_cost_model_proposalto build a governance proposal from the cluster's own live protocol parameters instead.test_pparam_update.pyandtest_node_upgrade.pynow use this for their happy-path proposals;test_incompatible_cost_modelskeeps its static fixture since it intentionally tests format rejection.LAST_KNOWN_PROTOCOL_VERSIONfromVersions.MAPinstead 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 lintpassespytest -k test_update_cost_modelsagainst a running cluster (bothtest_pparam_update.pyandtest_node_upgrade.pyupgrade-step-2 variants)