Skip to content

test: host state stt property tests#336

Draft
floor-licker wants to merge 9 commits intomainfrom
test/host-state-stt-property-tests
Draft

test: host state stt property tests#336
floor-licker wants to merge 9 commits intomainfrom
test/host-state-stt-property-tests

Conversation

@floor-licker
Copy link
Collaborator

@floor-licker floor-licker commented Feb 11, 2026

I wanted to include some property/fuzz based testing for the on-chain validators but for now I'll just stick to the highest leverage application which is the host_state_stt.ak validator. The code is pretty well commented to explain what each test is doing, but to describe succinctly, we're usking aiken/fuzz (which you can run with varying iterations by doing aiken check --number-success=N for some N) to test for certain invariants with generators. Succinctly, the invariants being tested for this host state validator are:

  1. prop_host_state_bind_port_accepts_valid_transition checks that a valid BindPort state transition is accepted.
  2. prop_host_state_bind_port_rejects_arbitrary_root checks that if the new root is made-up/incorrect, validation is rejected.
  3. prop_host_state_bind_port_rejects_missing_bound_port_update checks that a transition is rejected if bound_port is not actually updated.
  4. prop_host_state_bind_port_rejects_non_incremented_version xhecks that a transition is rejected if version is not incremented.
  5. prop_host_state_bind_port_sequence_preserves_invariants checks that after a sequence of valid binds, key invariants hold: version == number of binds, bound_port is correct, and root matches recomputed commitments.
  6. prop_host_state_bind_port_sequence_root_is_order_independent checks that binding the same distinct ports in forward vs reverse order gives the same final root and same final bound_port.
  7. prop_host_state_bind_port_replay_attempt_fails (marked fail) checks replay protection: trying to bind an already-bound port again is rejected.

Also bumped the aiken verison, was sitting at a version that didn't have aiken/fuzz yet

@floor-licker floor-licker marked this pull request as draft February 14, 2026 15:12
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.

1 participant