chore: remove cost voting r2 - full functional removal (post-4.0)#7342
Draft
cylewitruk-stacks wants to merge 6 commits into
Draft
chore: remove cost voting r2 - full functional removal (post-4.0)#7342cylewitruk-stacks wants to merge 6 commits into
cylewitruk-stacks wants to merge 6 commits into
Conversation
…/remove-cost-voting-r1
Contributor
There was a problem hiding this comment.
Pull request overview
This draft PR completes the “r2” cleanup for SIP-044 by removing the remaining functional machinery and test coverage for .cost-voting-driven runtime cost updates, leaving the VM to always resolve runtime costs via the epoch’s default boot cost contract (costs, costs-2, costs-3, costs-4, costs-5). It also refactors test utilities around epoch ranges and boot-contract initialization (notably for epoch 4.0’s costs-5 setup).
Changes:
- Remove cost-voting integration paths in Clarity cost tracking (including contract-call cost “short-circuiting”), plus associated analysis hooks and tests.
- Add a test-only
StacksEpochRangeTestExtto express epoch ranges via standard Rust range syntax and update affected tests. - Refactor epoch 4.0 boot contract instantiation to allow initializing
costs-5without requiring full epoch 4.0 boot (PoX-5 / sBTC stubs), and update costs tests accordingly.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| stackslib/src/net/api/tests/postblock_v3.rs | Removes an unused hash/Merkle import after related functionality/test coverage removal. |
| stackslib/src/clarity_vm/tests/costs.rs | Refactors costs test setup to bootstrap only needed epochs/contracts and removes cost-voting integration tests. |
| stackslib/src/clarity_vm/clarity.rs | Adds reusable boot-contract tx helpers and a dedicated epoch 4.0 costs-5 instantiation path used by tests and epoch init. |
| stackslib/src/chainstate/tests/runtime_tests.rs | Migrates epoch range construction to range-based test extension helpers. |
| stackslib/src/chainstate/tests/runtime_analysis_tests.rs | Migrates epoch range construction to range-based test extension helpers. |
| stackslib/src/chainstate/tests/consensus.rs | Replaces StacksEpochId::since usage with range-based iteration and updates associated docs. |
| stackslib/src/chainstate/tests/consensus_unit_tests.rs | Migrates deploy epoch lists to the new range-based helper. |
| stackslib/src/chainstate/stacks/boot/contract_tests.rs | Removes .cost-voting contract tests and arithmetic-only checks tied to cost-voting eligibility. |
| stacks-node/src/tests/neon_integrations.rs | Removes the ignored end-to-end cost-voting integration test. |
| stacks-common/src/types/mod.rs | Removes test-only since/between helpers and adds StacksEpochRangeTestExt + additional test-only epoch helpers. |
| stacks-common/src/types/tests.rs | Adds unit tests validating StacksEpochRangeTestExt range behavior and edge cases. |
| clarity/src/vm/tests/epoch_gating.rs | Updates monotonicity test to use range-based epoch slice helper. |
| clarity/src/vm/functions/database.rs | Removes contract-call cost short-circuiting path and always executes contract calls normally. |
| clarity/src/vm/costs/mod.rs | Removes cost-voting state loading/applying and associated circuit tracking; always loads default boot cost contract for the current epoch. |
| clarity/src/vm/contexts.rs | Removes run_free and short_circuit_contract_call plumbing from execution/global contexts. |
| clarity/src/vm/ast/mod.rs | Updates test cost tracker implementation to match the simplified CostTracker trait. |
| clarity/src/vm/analysis/types.rs | Removes is_cost_contract_eligible from ContractAnalysis. |
| clarity/src/vm/analysis/type_checker/v2_1/mod.rs | Updates CostTracker implementation after removing short-circuit API. |
| clarity/src/vm/analysis/type_checker/v2_05/mod.rs | Updates imports/CostTracker implementation after removing short-circuit API. |
| clarity/src/vm/analysis/mod.rs | Removes arithmetic-checker pass wiring from analysis pipeline. |
| clarity/src/vm/analysis/contract_interface_builder/mod.rs | Removes destructuring of the deleted is_cost_contract_eligible field. |
| clarity/src/vm/analysis/arithmetic_checker/tests.rs | Deletes arithmetic-checker tests tied to cost-voting eligibility. |
| clarity/src/vm/analysis/arithmetic_checker/mod.rs | Deletes the arithmetic-checker pass previously used for cost-voting contract eligibility. |
| changelog.d/7341-cost-voting-epoch-4-0-gate | Adds/updates a changelog fragment (currently describing only the r1 gating). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1 @@ | |||
| Added `.cost-voting` disablement gate beginning from epoch 4.0 | |||
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.
developoncepox-wf-integrationmerges for the final removal.ℹ️ Currently targets
pox-wf-integrationbut is based onchore/remove-cost-voting-r1and thus includes its diff.This PR fully removes the
SIP-006's.cost-votingcontract's functional side-effects, as proposed inSIP-044, and is contingent onSIP-044's acceptance and activation in epoch 4.0, together with ther1precursor (#7341).Description
Applicable issues
Additional info (benefits, drawbacks, caveats)
is_cost_contract_eligiblefromContractAnalysisis backwards-compatible asserde_jsonignores unknown fields during deserialization of previously stored analyses.Checklist
docs/property-testing.md)changelog.d/README.md)