Skip to content

Commit 5ce53a8

Browse files
sakulstravnmrtz
andcommitted
feat: Actor-Based Invariant Testing Suite developed for the Aave v3 protocol
Co-authored-by: Elpacos <[email protected]> Co-authored-by: Víctor Nicolás Martínez Carralero <[email protected]>
1 parent 6eeeeae commit 5ce53a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+6725
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ broadcast/
3333
certora-logs
3434
certora_debug_log.txt
3535
resource_errors.json
36+
37+
# invariants
38+
_corpus/
39+
crytic-export/

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ lib
33
cache
44
node_modules
55
report
6+
_corpus
7+
crytic-export
68
snapshots

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,32 @@ deploy-libs :
5555

5656
# Gas reports
5757
gas-report :; forge test --mp 'tests/gas/*.t.sol' --isolate
58+
59+
60+
# Invariants
61+
echidna:
62+
echidna tests/invariants/Tester.t.sol --contract Tester --config ./tests/invariants/_config/echidna_config.yaml --corpus-dir ./tests/invariants/_corpus/echidna/default/_data/corpus
63+
64+
echidna-assert:
65+
echidna tests/invariants/Tester.t.sol --contract Tester --test-mode assertion --config ./tests/invariants/_config/echidna_config.yaml --corpus-dir ./tests/invariants/_corpus/echidna/default/_data/corpus
66+
67+
echidna-explore:
68+
echidna tests/invariants/Tester.t.sol --contract Tester --test-mode exploration --config ./tests/invariants/_config/echidna_config.yaml --corpus-dir ./tests/invariants/_corpus/echidna/default/_data/corpus
69+
70+
# Medusa
71+
medusa:
72+
medusa fuzz --config ./medusa.json
73+
74+
# Echidna Runner
75+
76+
HOST = power-runner
77+
LOCAL_FOLDER = ./
78+
REMOTE_FOLDER = ./echidna-runner
79+
REMOTE_COMMAND = cd $(REMOTE_FOLDER)/aave-v3-origin && make echidna > process_output.log 2>&1
80+
REMOTE_COMMAND_ASSERT = cd $(REMOTE_FOLDER)/aave-v3-origin && make echidna-assert > process_output.log 2>&1
81+
82+
echidna-runner:
83+
tar --exclude='./tests/invariants/_corpus' -czf - $(LOCAL_FOLDER) | ssh $(HOST) "export PATH=$$PATH:/root/.local/bin:/root/.foundry/bin && mkdir -p $(REMOTE_FOLDER)/aave-v3-origin && tar -xzf - -C $(REMOTE_FOLDER)/aave-v3-origin && $(REMOTE_COMMAND)"
84+
85+
echidna-assert-runner:
86+
tar --exclude='./tests/invariants/_corpus' -czf - $(LOCAL_FOLDER) | ssh $(HOST) "export PATH=$$PATH:/root/.local/bin:/root/.foundry/bin && mkdir -p $(REMOTE_FOLDER)/aave-v3-origin && tar -xzf - -C $(REMOTE_FOLDER)/aave-v3-origin && $(REMOTE_COMMAND_ASSERT)"

medusa.json

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"fuzzing": {
3+
"workers": 10,
4+
"workerResetLimit": 50,
5+
"timeout": 0,
6+
"testLimit": 0,
7+
"callSequenceLength": 100,
8+
"corpusDirectory": "tests/invariants/_corpus/medusa",
9+
"coverageEnabled": true,
10+
"coverageFormats": ["html", "lcov"],
11+
"deploymentOrder": ["Tester"],
12+
"targetContracts": ["Tester"],
13+
"targetContractsBalances": [
14+
"0xffffffffffffffffffffffffffffffffffffffffffffffffffff"
15+
],
16+
"predeployedContracts": {
17+
"Create2Factory": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7",
18+
"Pretty": "0xf01",
19+
"Strings": "0xf02",
20+
"AaveV3BatchOrchestration": "0xf03",
21+
"SupplyLogic": "0xf04",
22+
"PoolLogic": "0xf05",
23+
"LiquidationLogic": "0xf06",
24+
"FlashLoanLogic": "0xf07",
25+
"BridgeLogic": "0xf08",
26+
"EModeLogic": "0xf09",
27+
"BorrowLogic": "0xf10",
28+
"ConfiguratorLogic": "0xf11"
29+
},
30+
"constructorArgs": {},
31+
"deployerAddress": "0x30000",
32+
"senderAddresses": ["0x10000", "0x20000", "0x30000"],
33+
"blockNumberDelayMax": 60480,
34+
"blockTimestampDelayMax": 604800,
35+
"blockGasLimit": 12500000000,
36+
"transactionGasLimit": 1250000000,
37+
"testing": {
38+
"stopOnFailedTest": false,
39+
"stopOnFailedContractMatching": false,
40+
"stopOnNoTests": true,
41+
"testAllContracts": false,
42+
"traceAll": false,
43+
"assertionTesting": {
44+
"enabled": true,
45+
"testViewMethods": true,
46+
"panicCodeConfig": {
47+
"failOnCompilerInsertedPanic": false,
48+
"failOnAssertion": true,
49+
"failOnArithmeticUnderflow": false,
50+
"failOnDivideByZero": false,
51+
"failOnEnumTypeConversionOutOfBounds": false,
52+
"failOnIncorrectStorageAccess": false,
53+
"failOnPopEmptyArray": false,
54+
"failOnOutOfBoundsArrayAccess": false,
55+
"failOnAllocateTooMuchMemory": false,
56+
"failOnCallUninitializedVariable": false
57+
}
58+
},
59+
"propertyTesting": {
60+
"enabled": true,
61+
"testPrefixes": ["fuzz_", "echidna_"]
62+
},
63+
"optimizationTesting": {
64+
"enabled": false,
65+
"testPrefixes": ["optimize_"]
66+
}
67+
},
68+
"chainConfig": {
69+
"codeSizeCheckDisabled": true,
70+
"cheatCodes": {
71+
"cheatCodesEnabled": true,
72+
"enableFFI": false
73+
},
74+
"skipAccountChecks": true
75+
}
76+
},
77+
"compilation": {
78+
"platform": "crytic-compile",
79+
"platformConfig": {
80+
"target": "tests/invariants/Tester.t.sol",
81+
"solcVersion": "",
82+
"exportDirectory": "",
83+
"args": [
84+
"--solc-remaps",
85+
"@crytic/properties/=../../../lib/properties/ forge-std/=../../../lib/forge-std/src/ ds-test/=../../../lib/forge-std/lib/ds-test/src/",
86+
"--compile-libraries=(Pretty,0xf01), (Strings,0xf02), (AaveV3BatchOrchestration,0xf03), (SupplyLogic,0xf04), (PoolLogic,0xf05), (LiquidationLogic,0xf06), (FlashLoanLogic,0xf07), (BridgeLogic,0xf08), (EModeLogic,0xf09), (BorrowLogic,0xf10), (ConfiguratorLogic,0xf11)"
87+
]
88+
}
89+
},
90+
"logging": {
91+
"level": "info",
92+
"logDirectory": "",
93+
"noColor": false
94+
}
95+
}

0 commit comments

Comments
 (0)