test: Implement deterministic fuzz target for lifecycle sequences and invariants - #198
Merged
Merged
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.
Closes #192
Description
Problem:
The example tests previously did not adequately cover permutations involving expiry, refunds, partial settlements, and large amounts. Furthermore, we needed a robust suite to assert contract invariants correctly under arbitrary command sequences.
Objective:
Deliver a production-quality improvement to the property and lifecycle test suite by integrating fuzzing capabilities that generate diverse sequences of operations. This aims to create measurable value for correctness, security, reliability, and maintainability.
Implementation Scope:
remitflow-contract-fuzzpackage to utilize thearbitrarycrate andsoroban-sdktestutils.fuzz_target_1.rsto generate arbitrary sequence actions:AdvanceTime,CreateTransfer,ClaimTransfer,CancelTransfer, andSweepExpired.Pending).Acceptance Criteria Met:
libfuzzer-syswith a strictFuzzDatastruct serialization.Design Tradeoffs:
We chose
libfuzzer-sysalong witharbitrary::Arbitraryfor state generation, which provides excellent interoperability with cargo-fuzz and simplifies finding complex regressions for smart contract state transitions. Mock setups limit user scopes deterministically, allowing us to accurately simulate token movements without triggering extraneous Soroban test framework limitations onauth.