Skip to content

Sui fuzzer - #3

Merged
iamjacobjia merged 8 commits into
masterfrom
sui-fuzzer
Sep 16, 2025
Merged

Sui fuzzer#3
iamjacobjia merged 8 commits into
masterfrom
sui-fuzzer

Conversation

@iamjacobjia

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings September 16, 2025 06:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +288 to +294
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:

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
impl RandomStrategy {
pub fn new() -> Self {
Self {
rng: StdRng::from_rng(&mut rand::rng()),

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
rng: StdRng::from_rng(&mut rand::rng()),
rng: StdRng::from_entropy(),

Copilot uses AI. Check for mistakes.
impl PowerOfTwoStrategy {
pub fn new() -> Self {
Self {
rng: StdRng::from_rng(&mut rand::rng()),

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
rng: StdRng::from_rng(&mut rand::rng()),
rng: StdRng::from_entropy(),

Copilot uses AI. Check for mistakes.
impl BoundaryValueStrategy {
pub fn new() -> Self {
Self {
rng: StdRng::from_rng(&mut rand::rng()),

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
rng: StdRng::from_rng(&mut rand::rng()),
rng: StdRng::from_entropy(),

Copilot uses AI. Check for mistakes.
power_of_two_strategy: PowerOfTwoStrategy::new(),
boundary_strategy: BoundaryValueStrategy::new(),
random_strategy: RandomStrategy::new(),
rng: StdRng::from_rng(&mut rand::rng()),

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
rng: StdRng::from_rng(&mut rand::rng()),
rng: StdRng::from_entropy(),

Copilot uses AI. Check for mistakes.
Comment on lines +73 to +74
let mut rng = rand::rng();
let index = rng.random_range(0..items.len());

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@iamjacobjia
iamjacobjia merged commit 3c33a0d into master Sep 16, 2025
1 check failed
@iamjacobjia
iamjacobjia deleted the sui-fuzzer branch September 16, 2025 08:10
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.

2 participants