forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: barebones medusa setup from boilerplate
- Loading branch information
1 parent
fdb548e
commit 31f6095
Showing
10 changed files
with
226 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
medusa-tests: | ||
name: Medusa Test | ||
runs-on: ubuntu-latest | ||
container: ghcr.io/defi-wonderland/eth-security-toolbox-ci:dev | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install dependencies | ||
working-directory: ./packages/contracts-bedrock | ||
run: yarn --frozen-lockfile --network-concurrency 1 | ||
|
||
- name: Run Medusa | ||
working-directory: ./packages/contracts-bedrock | ||
run: medusa fuzz --test-limit 200000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/contracts-bedrock/contracts/test/invariants/balance-claimer/FuzzTest.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.15; | ||
|
||
import {BalanceClaimerGuidedHandlers} from './handlers/guided/BalanceClaimer.t.sol'; | ||
import {BalanceClaimerUnguidedHandlers} from './handlers/unguided/BalanceClaimer.t.sol'; | ||
import {BalanceClaimerProperties} from './properties/BalanceClaimer.t.sol'; | ||
|
||
contract FuzzTest is BalanceClaimerGuidedHandlers, BalanceClaimerUnguidedHandlers, BalanceClaimerProperties {} |
9 changes: 9 additions & 0 deletions
9
...ts-bedrock/contracts/test/invariants/balance-claimer/handlers/guided/BalanceClaimer.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.15; | ||
|
||
import {BalanceClaimerSetup} from '../../setup/BalanceClaimer.t.sol'; | ||
|
||
contract BalanceClaimerGuidedHandlers is BalanceClaimerSetup { | ||
function handler_fooGuided() external { | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...-bedrock/contracts/test/invariants/balance-claimer/handlers/unguided/BalanceClaimer.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.15; | ||
|
||
import {BalanceClaimerSetup} from '../../setup/BalanceClaimer.t.sol'; | ||
|
||
contract BalanceClaimerUnguidedHandlers is BalanceClaimerSetup { | ||
/// @custom:property-id | ||
/// @custom:property | ||
function handler_fooUnguided(address _caller, string memory _newGreeting) external { | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ntracts-bedrock/contracts/test/invariants/balance-claimer/properties/BalanceClaimer.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.15; | ||
|
||
import {BalanceClaimerSetup} from '../setup/BalanceClaimer.t.sol'; | ||
|
||
contract BalanceClaimerProperties is BalanceClaimerSetup { | ||
/// @custom:property-id 1 | ||
/// @custom:property foo | ||
function property_foo() external view { | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...es/contracts-bedrock/contracts/test/invariants/balance-claimer/setup/BalanceClaimer.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.15; | ||
|
||
import "forge-std/console.sol"; | ||
|
||
import {BalanceClaimer} from "contracts/L1/winddown/BalanceClaimer.sol"; | ||
import {OptimismPortal} from "contracts/L1/OptimismPortal.sol"; | ||
import {L1StandardBridge} from "contracts/L1/L1StandardBridge.sol"; | ||
import {L1ChugSplashProxy} from "contracts/legacy/L1ChugSplashProxy.sol"; | ||
import {L2OutputOracle} from "contracts/L1/L2OutputOracle.sol"; | ||
import {SystemConfig} from "contracts/L1/SystemConfig.sol"; | ||
import {Proxy} from "contracts/universal/Proxy.sol"; | ||
import {WinddownConstants} from "scripts/winddown-upgrade/WinddownConstants.sol"; | ||
|
||
import {CommonBase} from "forge-std/Base.sol"; | ||
|
||
contract BalanceClaimerSetup is CommonBase { | ||
L1StandardBridge internal l1StandardBridge; | ||
OptimismPortal internal optimismPortal; | ||
BalanceClaimer internal balanceClaimer; | ||
|
||
constructor() { | ||
// _targetContract = new BalanceClaimer(); | ||
// optimismPortal = new OptimimismPortal({ | ||
// _l2Oracle: L2OutputOracle(address(0)), | ||
// _guardian: address(0), | ||
// _config: SystemConfig(address(0))}, | ||
// balanceClaimer: balanceClaimer); | ||
// l1StandardBridge = new L1StandardBridge(address(0), address(balanceClaimer)); | ||
// Get the proxies for L1StandardBridge and OptimismPortal | ||
L1ChugSplashProxy l1StandardBridgeProxy = | ||
L1ChugSplashProxy(payable(address(WinddownConstants.L1_STANDARD_BRIDGE_PROXY))); | ||
Proxy optimismPortalProxy = Proxy(payable(address(WinddownConstants.OPTIMISM_PORTAL_PROXY))); | ||
|
||
// Deploy BalanceClaimer proxy | ||
Proxy balanceClaimerProxy = new Proxy(address(this)); | ||
|
||
// Deploy BalanceClaimer implementation | ||
BalanceClaimer balanceClaimerImpl = new BalanceClaimer(); | ||
|
||
// Set BalanceClaimer implementation | ||
balanceClaimerProxy.upgradeToAndCall( | ||
address(balanceClaimerImpl), | ||
abi.encodeWithSelector( | ||
balanceClaimerImpl.initialize.selector, | ||
address(optimismPortalProxy), | ||
address(l1StandardBridgeProxy), | ||
WinddownConstants.MERKLE_ROOT | ||
) | ||
); | ||
|
||
optimismPortal = OptimismPortal(payable(optimismPortalProxy)); | ||
l1StandardBridge = L1StandardBridge(payable(l1StandardBridgeProxy)); | ||
balanceClaimer = BalanceClaimer(address(balanceClaimerProxy)); | ||
} | ||
|
||
/// @custom:prop-id 0 | ||
/// @custom:prop sanity checks for setup | ||
function property_setup() external { | ||
assert(address(l1StandardBridge.BALANCE_CLAIMER()) == address(balanceClaimer)); | ||
assert(address(optimismPortal.BALANCE_CLAIMER()) == address(balanceClaimer)); | ||
assert(address(balanceClaimer.ethBalanceWithdrawer()) == address(l1StandardBridge)); | ||
assert(address(balanceClaimer.erc20BalanceWithdrawer()) == address(optimismPortal)); | ||
assert(balanceClaimer.root() == bytes32(0)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"fuzzing": { | ||
"workers": 10, | ||
"workerResetLimit": 50, | ||
"timeout": 0, | ||
"testLimit": 0, | ||
"shrinkLimit": 5000, | ||
"callSequenceLength": 100, | ||
"corpusDirectory": "", | ||
"coverageEnabled": true, | ||
"coverageFormats": [ | ||
"html", | ||
"lcov" | ||
], | ||
"targetContracts": ["FuzzTest"], | ||
"predeployedContracts": {}, | ||
"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": true, | ||
"panicCodeConfig": { | ||
"failOnCompilerInsertedPanic": false, | ||
"failOnAssertion": true, | ||
"failOnArithmeticUnderflow": false, | ||
"failOnDivideByZero": false, | ||
"failOnEnumTypeConversionOutOfBounds": false, | ||
"failOnIncorrectStorageAccess": false, | ||
"failOnPopEmptyArray": false, | ||
"failOnOutOfBoundsArrayAccess": false, | ||
"failOnAllocateTooMuchMemory": false, | ||
"failOnCallUninitializedVariable": false | ||
} | ||
}, | ||
"propertyTesting": { | ||
"enabled": false, | ||
"testPrefixes": [ | ||
"property_" | ||
] | ||
}, | ||
"optimizationTesting": { | ||
"enabled": false, | ||
"testPrefixes": [ | ||
"optimize_" | ||
] | ||
}, | ||
"targetFunctionSignatures": [], | ||
"excludeFunctionSignatures": [] | ||
}, | ||
"chainConfig": { | ||
"codeSizeCheckDisabled": true, | ||
"cheatCodes": { | ||
"cheatCodesEnabled": true, | ||
"enableFFI": false | ||
}, | ||
"skipAccountChecks": true | ||
} | ||
}, | ||
"compilation": { | ||
"platform": "crytic-compile", | ||
"platformConfig": { | ||
"target": ".", | ||
"solcVersion": "", | ||
"exportDirectory": "", | ||
"args": ["--foundry-compile-all", "--foundry-out-directory", "artifacts"] | ||
} | ||
}, | ||
"logging": { | ||
"level": "info", | ||
"logDirectory": "", | ||
"noColor": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters