Sui fuzzer - #3
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a comprehensive fuzzing framework for Move-based blockchains, starting with Sui support. The fuzzer detects shift violations and other security issues through automated testing with intelligent mutation strategies.
- Complete fuzzing framework with trait-based architecture for multi-blockchain support
- Real-time shift violation detection using Sui Move VM tracing integration
- Automated integration testing with Python scripts for CI/CD workflows
Reviewed Changes
Copilot reviewed 54 out of 60 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| bin/fuzzer/src/main.rs | CLI interface for the fuzzer with Sui command support |
| crates/fuzzer-core/ | Generic fuzzing framework with chain adapter traits |
| crates/sui-fuzzer/ | Sui-specific implementation with mutation strategies |
| crates/sui-simulator/ | Transaction simulation environment for Sui |
| crates/sui-tracer/ | Real-time shift violation detection during execution |
| scripts/integration_test.py | Automated end-to-end testing framework |
| contracts/sui-demo/ | Demo Move contracts for testing shift operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if hasattr(select, 'select'): | ||
| ready, _, _ = select.select([self.localnet_process.stdout], [], [], 0) | ||
| if ready: | ||
| line = self.localnet_process.stdout.readline() | ||
| if line: | ||
| self.log(f"Recent output: {line.strip()}", "DEBUG") | ||
| except Exception: |
There was a problem hiding this comment.
The import of 'select' inside a try block is unusual and could hide import errors. Consider moving the import to the top of the file and checking platform compatibility differently, as select.select() is not available on Windows.
| impl RandomStrategy { | ||
| pub fn new() -> Self { | ||
| Self { | ||
| rng: StdRng::from_rng(&mut rand::rng()), |
There was a problem hiding this comment.
Using rand::rng() to seed StdRng creates a temporary mutable borrow that may not compile correctly. Consider using StdRng::from_entropy() for cryptographically secure seeding or StdRng::seed_from_u64(seed) for deterministic seeding.
| rng: StdRng::from_rng(&mut rand::rng()), | |
| rng: StdRng::from_entropy(), |
| impl PowerOfTwoStrategy { | ||
| pub fn new() -> Self { | ||
| Self { | ||
| rng: StdRng::from_rng(&mut rand::rng()), |
There was a problem hiding this comment.
Same issue as in random.rs - using rand::rng() to seed StdRng may not compile correctly. Consider using StdRng::from_entropy() or StdRng::seed_from_u64(seed) instead.
| rng: StdRng::from_rng(&mut rand::rng()), | |
| rng: StdRng::from_entropy(), |
| impl BoundaryValueStrategy { | ||
| pub fn new() -> Self { | ||
| Self { | ||
| rng: StdRng::from_rng(&mut rand::rng()), |
There was a problem hiding this comment.
Same issue as in other mutation strategies - using rand::rng() to seed StdRng may not compile correctly. Consider using StdRng::from_entropy() or StdRng::seed_from_u64(seed) instead.
| rng: StdRng::from_rng(&mut rand::rng()), | |
| rng: StdRng::from_entropy(), |
| power_of_two_strategy: PowerOfTwoStrategy::new(), | ||
| boundary_strategy: BoundaryValueStrategy::new(), | ||
| random_strategy: RandomStrategy::new(), | ||
| rng: StdRng::from_rng(&mut rand::rng()), |
There was a problem hiding this comment.
Multiple instances of the same seeding issue with rand::rng(). Consider using StdRng::from_entropy() for the orchestrator's RNG and ensuring all strategies use consistent seeding approaches.
| rng: StdRng::from_rng(&mut rand::rng()), | |
| rng: StdRng::from_entropy(), |
| let mut rng = rand::rng(); | ||
| let index = rng.random_range(0..items.len()); |
There was a problem hiding this comment.
Using rand::rng() creates a new thread-local RNG instance each time. For better performance, consider storing an RNG instance in the ObjectCache struct or using rand::random() for simple cases.
No description provided.