From 69a997928e3248d34e139ddb3c1f996bc5abba0f Mon Sep 17 00:00:00 2001 From: alpharush <0xalpharush@protonmail.com> Date: Mon, 24 Jun 2024 17:08:01 -0500 Subject: [PATCH] fix: use the shrunken abi values as the msg's data (#374) --- fuzzing/fuzzer_worker.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fuzzing/fuzzer_worker.go b/fuzzing/fuzzer_worker.go index 7ee4e93a..08bd5f6b 100644 --- a/fuzzing/fuzzer_worker.go +++ b/fuzzing/fuzzer_worker.go @@ -10,6 +10,7 @@ import ( fuzzerTypes "github.com/crytic/medusa/fuzzing/contracts" "github.com/crytic/medusa/fuzzing/coverage" "github.com/crytic/medusa/fuzzing/valuegeneration" + "github.com/crytic/medusa/logging" "github.com/crytic/medusa/utils" "github.com/ethereum/go-ethereum/common" "golang.org/x/exp/maps" @@ -466,6 +467,13 @@ func (fw *FuzzerWorker) shrinkCallSequence(callSequence calls.CallSequence, shri abiValuesMsgData.InputValues[j] = mutatedInput } + // Re-encode the ABI values as calldata. + abiData, err := abiValuesMsgData.Pack() + if err != nil { + logging.GlobalLogger.Panic("Failed to pack call message ABI values", err) + } + possibleShrunkSequence[i].Call.Data = abiData + // Test the shrunken sequence. validShrunkSequence, err := fw.testShrunkenCallSequence(possibleShrunkSequence, shrinkRequest) shrinkIteration++