Draft
Conversation
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.
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.akvalidator. The code is pretty well commented to explain what each test is doing, but to describe succinctly, we're uskingaiken/fuzz(which you can run with varying iterations by doingaiken check --number-success=Nfor some N) to test for certain invariants with generators. Succinctly, the invariants being tested for this host state validator are:prop_host_state_bind_port_accepts_valid_transitionchecks that a validBindPortstate transition is accepted.prop_host_state_bind_port_rejects_arbitrary_rootchecks that if the new root is made-up/incorrect, validation is rejected.prop_host_state_bind_port_rejects_missing_bound_port_updatechecks that a transition is rejected ifbound_portis not actually updated.prop_host_state_bind_port_rejects_non_incremented_versionxhecks that a transition is rejected if version is not incremented.prop_host_state_bind_port_sequence_preserves_invariantschecks that after a sequence of valid binds, key invariants hold: version == number of binds,bound_portis correct, and root matches recomputed commitments.prop_host_state_bind_port_sequence_root_is_order_independentchecks that binding the same distinct ports in forward vs reverse order gives the same final root and samefinal bound_port.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/fuzzyet