Conversation
589ab86 to
59a2334
Compare
59a2334 to
8b02374
Compare
c8e1a93 to
a77fc25
Compare
1687869 to
f1fa669
Compare
|
@0xalpharush - this mutator rework looks valuable! The PR has conflicts with recent master changes. Could you rebase when you have a chance? We'd like to review and merge this. |
Resolve conflict in sequence_generator.go by keeping the new AppendAndMutate naming while using the corrected "tail" spelling from master (was "tao;" typo in feature branch). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… strategies - Fix swapRandList, spliceAtRandom, and interleaveAtRandom to use provider.Intn instead of global rand.Intn for deterministic fuzzing - Add empty slice bounds checks to spliceAtRandom and interleaveAtRandom to prevent panics when called with empty sequences - Wire up SpliceAndMutate and InterleaveAndMutate config fields to the mutationStrategyChooser (they were defined but never used) - Clean up test file: remove debug print statements, fix import path (medusa-geth vs ethereum), add tests for empty slice edge cases - Rename test from TestSplice to TestSequenceGenerationStrategies for clarity Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Review and FixesI've reviewed this PR and pushed fixes for several issues I found. Merge Conflict ResolutionResolved conflict in Bug Fixes1. Non-deterministic random number generation (Critical)
// Before (non-deterministic)
i, j := rand.Intn(len(xs)), rand.Intn(len(xs))
// After (deterministic)
i, j := provider.Intn(len(xs)), provider.Intn(len(xs))This defeated the purpose of seeded deterministic fuzzing - test results would not be reproducible. 2. Potential panics on empty slices
func spliceAtRandom[T any](provider *rand.Rand, xs1, xs2 []*T) []*T {
if len(xs1) == 0 {
return xs2
}
if len(xs2) == 0 {
return xs1
}
// ... rest of function
}3. Missing mutation strategies
randomutils.NewWeightedRandomChoice(
CallSequenceGeneratorMutationStrategy{
CallSequenceGeneratorFunc: spliceCorpus,
Mutate: true,
},
new(big.Int).SetUint64(config.SpliceAndMutate),
),
randomutils.NewWeightedRandomChoice(
CallSequenceGeneratorMutationStrategy{
CallSequenceGeneratorFunc: interleaveCorpus,
Mutate: true,
},
new(big.Int).SetUint64(config.InterleaveAndMutate),
),Code Quality Improvements4. Test file cleanup
Verification
|
replaces #445