Skip to content

fix(scripts): sync cost model genesis values with mainnet - #148

Merged
mkoura merged 1 commit into
masterfrom
sync-mainnet-cost-models
Jul 23, 2026
Merged

fix(scripts): sync cost model genesis values with mainnet#148
mkoura merged 1 commit into
masterfrom
sync-mainnet-cost-models

Conversation

@OlufemiAdeOlusile

@OlufemiAdeOlusile OlufemiAdeOlusile commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Genesis specs (genesis.conway.spec.json, all 3 variants) still carried the Conway-launch PlutusV3 length (251 entries); local_slow's cost_models_list.json was already ahead at 297. Mainnet has since raised cost models via governance (V1=332, V2=332, V3=350 as of epoch 640).
  • common.sh and common-start-fast/common-start-slow additionally truncated PlutusV2/V3 cost models back down to the old lengths on every cluster start via jq, silently discarding correct genesis values. Removed those truncations from common code entirely (not re-added anywhere).
  • Removed a redundant extraConfig re-injection jq block from common-start-fast per review feedback - the extraConfig field itself is untouched and still present in all three variants' genesis spec files (it was always inert; only the jq that copied it into the generated genesis output is gone).

Per-variant end state (verified by actually running each)

  • local_fast / mainnet_fast: genesis only, no extra jq/code - {PlutusV1: 332, PlutusV2: 185, PlutusV3: 350}. PlutusV1/PlutusV3 pass through the spec unchanged; cardano-cli genesis create-staked hard-caps PlutusV2 at exactly 185 regardless of spec/extraConfig content, confirmed by isolated testing against two different cardano-cli versions (10.11.1.0, 11.1.0.0).
  • local_slow: genesis intentionally stays at the original historical values - genesis.alonzo.spec.json is byte-identical to master, not touched by this PR net of all commits. PlutusV1 stays at 166 throughout (genesis and cost_models_list.json both 166, never changes). PlutusV2 starts at 175 in genesis and grows to 185 through the historical era-transition proposals (Alonzo-PV6/Babbage), then the existing PV9 governance flow (_update_cost_model_in_pv9 / _wait_pv9_cost_model_enacted, using cost_models_list.json) explicitly asserts it lands at 185. cost_models_list.json's PlutusV1/V2 arrays are the original historical bytes (master's own values); only PlutusV3 was updated (297 -> 350), matching genesis.conway.spec.json byte for byte.

Open question, not resolved in this PR: reaching PlutusV2=332 (full current-mainnet value) on local_fast/mainnet_fast would require a governance action submitted after genesis (the same pattern local_slow's PV9 test already uses) - extraConfig does not do this; nothing reads it. A governance-action mechanism was added and tested (confirmed working), then reverted after re-reading the review feedback as asking for jq removal only, not new logic. Whether to add it back is a decision for review, not made in this PR.

Test plan

  • make lint passes
  • local_fast: cardano-cli query protocol-parameters reports {PlutusV1: 332, PlutusV2: 185, PlutusV3: 350}
  • mainnet_fast: same result, confirmed
  • local_slow: full Byron -> Conway startup completes, PV9 cost model proposal enacts, hard-fork to Conway PV10 succeeds; final state {PlutusV1: 166, PlutusV2: 185, PlutusV3: 350}
  • Full cardano-node-tests pytest suite re-run against the current (post-revert) {332,185,350} state: test_pparam_update, test_pparam_keys, 8xtest_legacy_proposal_submit, test_incompatible_cost_models, test_node_upgrade.py::test_update_cost_models - all pass

…aConfig jq

Cluster genesis specs still carried Conway-launch cost model values.
genesis.conway.spec.json (all 3 variants) had PlutusV3 at 251 entries;
local_slow's cost_models_list.json was already ahead at 297. Mainnet
has since raised cost models via governance (V1=332, V2=332, V3=350
as of epoch 640, from Koios API).

common.sh and common-start-fast/common-start-slow additionally
truncated PlutusV2/V3 cost models back down on every cluster start
via jq, discarding correct genesis values. Removed those truncations
entirely, not replaced with anything.

Also removed a redundant extraConfig re-injection jq block from
common-start-fast. The extraConfig field itself is untouched and
still present in all three variants' genesis spec files; it was
always inert (nothing reads it), only the jq that copied it into
the generated genesis output is gone.

Per-variant end state, each verified by actually running the
cluster:

local_fast / mainnet_fast: genesis only, no extra code, reaches
PlutusV1=332, PlutusV2=185, PlutusV3=350. PlutusV1/V3 pass through
the spec unchanged; cardano-cli genesis create-staked hard-caps
PlutusV2 at exactly 185 regardless of spec or extraConfig content,
confirmed by isolated testing against two different cardano-cli
versions (10.11.1.0 and 11.1.0.0).

local_slow: genesis stays at the original historical values
(genesis.alonzo.spec.json is byte-identical to master, untouched).
PlutusV1 stays at 166 throughout. PlutusV2 starts at 175 in genesis
and grows to 185 through the historical era-transition proposals
(Alonzo-PV6, Babbage), then the existing PV9 governance flow
asserts it lands at 185. cost_models_list.json's PlutusV1/V2 arrays
are the original historical bytes; only PlutusV3 was updated
(297 to 350), matching genesis.conway.spec.json byte for byte.

Open question, not resolved here: reaching PlutusV2=332 on
local_fast/mainnet_fast would need a governance action submitted
after genesis, the same pattern local_slow's PV9 test already uses.
extraConfig does not do this. Whether to add that is a decision for
review, not made in this commit.

Verified: make lint passes; local_fast and mainnet_fast both report
protocol-parameters {PlutusV1: 332, PlutusV2: 185, PlutusV3: 350};
local_slow completes the full Byron to Conway startup with the PV9
proposal enacting and the hard fork to Conway PV10 succeeding; the
full cardano-node-tests pytest suite (test_pparam_update,
test_pparam_keys, test_legacy_proposal_submit variants,
test_incompatible_cost_models, test_node_upgrade.py::
test_update_cost_models) passes against the resulting cluster.
@OlufemiAdeOlusile
OlufemiAdeOlusile force-pushed the sync-mainnet-cost-models branch from c9b2205 to ff45c9f Compare July 19, 2026 13:36
@mkoura
mkoura merged commit 7b20294 into master Jul 23, 2026
4 checks passed
@mkoura
mkoura deleted the sync-mainnet-cost-models branch July 23, 2026 11:02
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.

2 participants