Skip to content

AAC Testing: Develop Integration Test Harness for append_block in stackslib #6523

@jferrant

Description

@jferrant

Create the foundational boilerplate for an integration test harness in stackslib to test the append_block function (stackslib/src/chainstate/nakamoto/mod.rs#L4359). Initialize a minimal chain state and required databases (e.g., MARF, Clarity DB) to enable invoking append_block. Ensure the setup is reusable for other tests and compatible with Clarity VM and Nakamoto chainstate logic.

Acceptance Criteria:

  • Create a test module in stackslib/src/chainstate/nakamoto/tests for append_block integration tests.
  • Initialize a minimal chain state (e.g., genesis balances, block height) and databases
  • Verify that append_block can be invoked with a dummy block without crashing.
  • Ensure setup is compatible with Clarity VM (e.g., handles Clarity contracts) and Nakamoto chainstate.
  • Write a simple test that sets up the environment and calls append_block with an empty block.
  • Create a utility function in stackslib/src/chainstate/tests to construct test blocks.
  • Support all transaction types: STX transfers, Clarity contract calls, Contract deployments, etc.
  • Generate one valid block (e.g., 3 STX transfers) and one invalid block (e.g., transaction with excessive cost).
  • Verify blocks can be serialized and passed to append_block without errors.
  • Ensure compatibility with Clarity VM (e.g., transactions use valid Value types).

Notes:

  • Maybe can leverage existing setup code in stackslib/src/chainstate/stacks/tests/mod.rs
  • Leverage TestPeer

Sub-issues

Metadata

Metadata

Assignees

Labels

aacAvoiding Accidental Consensusaac-testingAvoiding Accidental Consensus Testing Specific Task

Projects

Status

Status: 💻 In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions