-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistency between how Medusa and Echidna manage libraries. #529
Comments
Hi @beirao! can you confirm |
Here is the working Echidna command: echidna tests/echidna/PropertiesMain.sol --contract PropertiesMain --config tests/echidna/config/config1_fast.yaml So I changed the medusa config file to this: {
"fuzzing": {
"workers": 10,
"workerResetLimit": 50,
"timeout": 0,
"testLimit": 0,
"shrinkLimit": 5000,
"callSequenceLength": 100,
"corpusDirectory": "",
"coverageEnabled": true,
"targetContracts": ["PropertiesMain"],
"predeployedContracts": {
"BorrowLogic": "0xf01",
"DepositLogic": "0xf03",
"FlashLoanLogic": "0xf11",
"GenericLogic": "0xf12",
"LiquidationLogic": "0xf13",
"MiniPoolBorrowLogic": "0xa01",
"MiniPoolDepositLogic": "0xa03",
"MiniPoolFlashLoanLogic": "0xa11",
"MiniPoolGenericLogic": "0xa12",
"MiniPoolLiquidationLogic": "0xa13",
"MiniPoolReserveLogic": "0xa15",
"MiniPoolValidationLogic": "0xa16",
"MiniPoolWithdrawLogic": "0xa17"
},
"targetContractsBalances": [],
"constructorArgs": {},
"deployerAddress": "0x30000",
"senderAddresses": ["0x10000", "0x20000", "0x30000"],
"blockNumberDelayMax": 60480,
"blockTimestampDelayMax": 604800,
"blockGasLimit": 125000000,
"transactionGasLimit": 12500000,
"testing": {
"stopOnFailedTest": true,
"stopOnFailedContractMatching": false,
"stopOnNoTests": true,
"testAllContracts": false,
"traceAll": false,
"assertionTesting": {
"enabled": true,
"testViewMethods": false,
"panicCodeConfig": {
"failOnCompilerInsertedPanic": false,
"failOnAssertion": true,
"failOnArithmeticUnderflow": false,
"failOnDivideByZero": false,
"failOnEnumTypeConversionOutOfBounds": false,
"failOnIncorrectStorageAccess": false,
"failOnPopEmptyArray": false,
"failOnOutOfBoundsArrayAccess": false,
"failOnAllocateTooMuchMemory": false,
"failOnCallUninitializedVariable": false
}
},
"propertyTesting": {
"enabled": true,
"testPrefixes": ["property_"]
},
"optimizationTesting": {
"enabled": true,
"testPrefixes": ["optimize_"]
},
"targetFunctionSignatures": [],
"excludeFunctionSignatures": []
},
"chainConfig": {
"codeSizeCheckDisabled": true,
"cheatCodes": {
"cheatCodesEnabled": true,
"enableFFI": false
},
"skipAccountChecks": true
}
},
"compilation": {
"platform": "crytic-compile",
"platformConfig": {
"target": "tests/echidna/",
"solcVersion": "",
"exportDirectory": "",
"args": [
"--foundry-compile-all",
"--compile-libraries=(BorrowLogic,0xf01),(DepositLogic,0xf03),(FlashLoanLogic,0xf11),(GenericLogic,0xf12),(LiquidationLogic,0xf13),(MiniPoolBorrowLogic,0xa01),(MiniPoolDepositLogic,0xa03),(MiniPoolFlashLoanLogic,0xa11),(MiniPoolGenericLogic,0xa12),(MiniPoolLiquidationLogic,0xa13),(MiniPoolReserveLogic,0xa15),(MiniPoolValidationLogic,0xa16),(MiniPoolWithdrawLogic,0xa17)"
]
}
},
"logging": {
"level": "info",
"logDirectory": "",
"noColor": false
}
} I added PropertiesMain in 'targetContracts' and changed 'target'. And here is the new output: ⇾ Finished compiling targets in 47s
⇾ Initializing corpus
⇾ Setting up test chain
error Failed to initialize the test chain
‣ deploying PropertiesMain returned a failed status: execution reverted This error is strange since Echidna succeeds in deploying PropertiesMain. Here's the file tree structure:
The command I use from the root is:
It's probably not a bug but just me messing up the config file. |
it sounds like |
I tried
The fact that it reverts without giving the reason makes it hard to debug. I don't know what else I can provide to help find the bug? |
Hey @beirao which version of medusa are you using? We added execution tracing for contract deployments to aid in debugging but it seems like it is not being attached. This can mean two things: (1) the version is outdated or (2) we cannot capture the execution trace (more likely). It would also be great if I could access to the repo so that I can run medusa on the codebase to see what is going wrong. |
Hey @anishnaik, I can give you the access. Should I give access to your account directly? (https://github.com/anishnaik) |
Yes, that would be great :) |
Ok you should have access now. Here is what you should run: git clone https://github.com/Cod3x-Labs/Cod3x-Lend
cd Cod3x-Lend
git checkout mitigation
forge install
echidna tests/echidna/PropertiesMain.sol --contract PropertiesMain --config tests/echidna/config/config1_fast.yaml
medusa fuzz --config medusa_config.json |
After successfully setting up a test suite with Echidna, I’ve been trying to integrate Medusa for further testing. However, I’ve run into configuration issues that I suspect are causing the setup to fail.
Here is my Echidna configuration file, which works perfectly:
Here is my Medusa configuration file:
When I run the command below, I encounter an error related to the predeployed contracts not being found in the compilation artifacts:
Interestingly, the library listed as problematic (here MiniPoolFlashLoanLogic) changes with each rerun of the command.
If there are no errors on my end, and the Echidna and Medusa config files are equivalent, then there must be a problem with how Medusa handles libraries.
The text was updated successfully, but these errors were encountered: