Skip to content

Conversation

@francesco-stacks
Copy link

Description

Updates the consensus testing infrastructure to support deploying dependency contracts before the main contract under test.

While writing tests for CheckErrorKind, I encountered multiple scenarios requiring pre-deployed contracts (e.g., for the traits ) that the main contract references. Instead of using ConsensusTest for each case, I extended the macros to simplify this setup.

Changes

  • Macros: Updated contract_call_consensus_test! and contract_deploy_consensus_test! to accept an optional setup_contracts parameter.
  • New Helper: Introduced SetupContract to define these dependencies.
    • By default, setup contracts are deployed in the first epoch of the test using the default Clarity version for that epoch.
    • The deployment epoch and Clarity version can be overridden using with_epoch and with_clarity_version.
  • Example: Added static_check_error_bad_trait_implementation to static_analysis_tests.rs demonstrating the use of a
    setup contract for a trait definition.

Will add more tests in future PRs.

Applicable issues

  • fixes #

Additional info (benefits, drawbacks, caveats)

Checklist

  • Test coverage for new or modified code paths
  • Changelog is updated
  • Required documentation changes (e.g., docs/rpc/openapi.yaml and rpc-endpoints.md for v2 endpoints, event-dispatcher.md for new events)
  • New clarity functions have corresponding PR in clarity-benchmarking repo

@francesco-stacks francesco-stacks self-assigned this Nov 19, 2025
@francesco-stacks francesco-stacks added the aac Avoiding Accidental Consensus label Nov 19, 2025
@francesco-stacks francesco-stacks added the aac-testing Avoiding Accidental Consensus Testing Specific Task label Nov 19, 2025
@codecov
Copy link

codecov bot commented Nov 19, 2025

Codecov Report

❌ Patch coverage is 82.47423% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.63%. Comparing base (62fe5cb) to head (cdfacf2).
⚠️ Report is 14 commits behind head on develop.

Files with missing lines Patch % Lines
stackslib/src/chainstate/tests/consensus.rs 80.68% 17 Missing ⚠️

❌ Your project status has failed because the head coverage (75.63%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #6699      +/-   ##
===========================================
- Coverage    79.47%   75.63%   -3.84%     
===========================================
  Files          577      577              
  Lines       357469   357564      +95     
===========================================
- Hits        284089   270460   -13629     
- Misses       73380    87104   +13724     
Files with missing lines Coverage Δ
...slib/src/chainstate/tests/static_analysis_tests.rs 83.33% <100.00%> (-9.49%) ⬇️
stackslib/src/chainstate/tests/consensus.rs 92.21% <80.68%> (-4.09%) ⬇️

... and 245 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62fe5cb...cdfacf2. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@francesco-stacks francesco-stacks marked this pull request as ready for review November 19, 2025 13:55
@francesco-stacks francesco-stacks requested review from a team as code owners November 19, 2025 13:55
@francesco-stacks francesco-stacks moved this to Status: In Review in Stacks Core Eng Nov 19, 2025
jacinta-stacks
jacinta-stacks previously approved these changes Nov 19, 2025
@Jiloc Jiloc dismissed stale reviews from federico-stacks and jacinta-stacks via d35184e November 20, 2025 14:44
jacinta-stacks
jacinta-stacks previously approved these changes Nov 20, 2025
@jacinta-stacks jacinta-stacks added this pull request to the merge queue Nov 21, 2025
Merged via the queue into stacks-network:develop with commit f3f889f Nov 21, 2025
301 of 313 checks passed
@github-project-automation github-project-automation bot moved this from Status: In Review to Status: ✅ Done in Stacks Core Eng Nov 21, 2025
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

aac Avoiding Accidental Consensus aac-testing Avoiding Accidental Consensus Testing Specific Task locked

Projects

Status: Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

4 participants