Skip to content

chore: remove cost voting r2 - full functional removal (post-4.0)#7342

Draft
cylewitruk-stacks wants to merge 6 commits into
stacks-network:pox-wf-integrationfrom
cylewitruk-stacks:chore/remove-cost-voting-r2
Draft

chore: remove cost voting r2 - full functional removal (post-4.0)#7342
cylewitruk-stacks wants to merge 6 commits into
stacks-network:pox-wf-integrationfrom
cylewitruk-stacks:chore/remove-cost-voting-r2

Conversation

@cylewitruk-stacks

Copy link
Copy Markdown
Contributor

⚠️ DO NOT MERGE - This is a draft PR for review only and this branch will be retargeted to develop once pox-wf-integration merges for the final removal.
ℹ️ Currently targets pox-wf-integration but is based on chore/remove-cost-voting-r1 and thus includes its diff.

This PR fully removes the SIP-006's .cost-voting contract's functional side-effects, as proposed in SIP-044, and is contingent on SIP-044's acceptance and activation in epoch 4.0, together with the r1 precursor (#7341).

Description

Applicable issues

Additional info (benefits, drawbacks, caveats)

  • Removes a whole bunch of unused code/tests.
  • The removal of is_cost_contract_eligible from ContractAnalysis is backwards-compatible as serde_json ignores unknown fields during deserialization of previously stored analyses.

Checklist

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 StacksEpochRangeTestExt to express epoch ranges via standard Rust range syntax and update affected tests.
  • Refactor epoch 4.0 boot contract instantiation to allow initializing costs-5 without 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
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