Skip to content
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

feat: poc #189

Draft
wants to merge 27 commits into
base: sc-feat/interop-testing-campaign
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
29e9c28
test(wip): medusa setup
hexshire Dec 24, 2024
0bbda87
refactor: add proxies
hexshire Dec 24, 2024
d059926
chore: add comments
hexshire Dec 24, 2024
3236904
refactor: medusa setup
hexshire Dec 26, 2024
4126967
fix: compile faster
0xteddybear Dec 26, 2024
c89e646
chore: deploy token bridge
hexshire Dec 27, 2024
cd94d4d
chore: deploy super weth
hexshire Dec 27, 2024
1ca144a
chore: deploy all
hexshire Dec 27, 2024
8cdb422
refactor: split main file
hexshire Dec 30, 2024
30b3314
refactor: proxy deplpyment
hexshire Dec 30, 2024
c3d683c
Merge branch 'sc-feat/add-shared-lockbox' into test/interop-testing-c…
hexshire Dec 30, 2024
8908381
chore: move tests to invariant folder
hexshire Dec 30, 2024
956e874
Merge branch 'sc-feat/add-shared-lockbox' into test/interop-testing-c…
hexshire Dec 30, 2024
7ec6587
chore: address review comments
hexshire Dec 30, 2024
a5dabad
chore: change proxy
hexshire Dec 31, 2024
ad6ae9f
feat: initialize contracts and create portal mock
0xDiscotech Jan 3, 2025
4dc1eb7
fix: modifier
hexshire Jan 3, 2025
960e3c1
test: first four properties with actors and handlers
0xDiscotech Jan 7, 2025
aa5717b
refactor: actors system as proxies
0xDiscotech Jan 7, 2025
07c93c8
chore: re organize structure
0xDiscotech Jan 7, 2025
5da9d96
fix: add deposit and withdraw handlers for super weth
0xDiscotech Jan 7, 2025
8acfed8
fix: use high level calls to interact with superchain token bridge du…
0xDiscotech Jan 8, 2025
c37ea22
chore: corpus
0xDiscotech Jan 8, 2025
181abf9
Revert "chore: corpus"
0xDiscotech Jan 8, 2025
6d5a0b6
feat: add superchainweth relay eth handler
0xDiscotech Jan 8, 2025
c950ff6
chore: comment failing handler
0xDiscotech Jan 8, 2025
0a10a49
feat: poc
0xDiscotech Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ __pycache__

# Ignore echidna artifacts
crytic-export
# TODO: Remove
packages/contracts-bedrock/test/invariants/interop/SetupFoundry.sol
packages/contracts-bedrock/test/invariants/interop/FuzzTestFoundry.t.sol
4 changes: 4 additions & 0 deletions packages/contracts-bedrock/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ deploy-config/devnetL1.json

# Getting Started guide deploy config
deploy-config/getting-started.json

# Medusa
# TODO: Uncomment
test/invariants/interop/corpus
13 changes: 13 additions & 0 deletions packages/contracts-bedrock/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ timeout = 300
[profile.lite]
optimizer = false

################################################################
# PROFILE: MEDUSA #
################################################################

# workaround: pass --foundry-compile-all, so it doesnt add --skip '*/test/**'
# '*/scripts/**', which causes an empty compilation with this file structure, but
# define 'test/medusa' as the only directory visible to foundry, so it only
# compiles files present there and those imported by them.
[profile.medusa]
src = 'test/invariants/interop/'
test = 'test/invariants/interop/'
script = 'test/invariants/interop/'

################################################################
# PROFILE: KONTROL #
################################################################
Expand Down
9 changes: 9 additions & 0 deletions packages/contracts-bedrock/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ coverage: build-go-ffi
coverage-lcov: build-go-ffi
forge coverage --report lcov

# runs medusa on a foundry profile that allows faster compilation by omitting
# to build other tests and scripts
test-medusa *ARGS:
FOUNDRY_PROFILE=medusa medusa fuzz {{ARGS}}

# runs medusa on a foundry profile that allows faster compilation by omitting
# to build other tests and scripts and deletes corpus before running
test-medusa-debug:
TEMP_DIR=$(mktemp -d) && FOUNDRY_PROFILE=medusa medusa fuzz --corpus-dir "$TEMP_DIR" --config medusa-debug.json && rm -rf "$TEMP_DIR"

########################################################
# DEPLOY #
Expand Down
81 changes: 81 additions & 0 deletions packages/contracts-bedrock/medusa-debug.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"fuzzing": {
"workers": 10,
"workerResetLimit": 50,
"timeout": 60,
"testLimit": 0,
"shrinkLimit": 5000,
"callSequenceLength": 100,
"corpusDirectory": "test/invariants/interop/corpus",
"coverageEnabled": false,
"coverageFormats": ["html", "lcov"],
"targetContracts": ["FuzzTest"],
"predeployedContracts": {
"Deployer815": "0x4200000000000000000000000000000000000815",
"Deployer825": "0x4200000000000000000000000000000000000825"
},
"targetContractsBalances": [],
"constructorArgs": {},
"deployerAddress": "0x30000",
"senderAddresses": ["0x10000"],
"blockNumberDelayMax": 60480,
"blockTimestampDelayMax": 604800,
"blockGasLimit": 125000000,
"transactionGasLimit": 12500000,
"testing": {
"stopOnFailedTest": false,
"stopOnFailedContractMatching": false,
"stopOnNoTests": true,
"testAllContracts": false,
"traceAll": true,
"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": ".",
"solcVersion": "",
"exportDirectory": "",
"args": ["--foundry-compile-all", "--foundry-out-directory", "artifacts"]
}
},
"logging": {
"level": "info",
"logDirectory": "",
"noColor": false
}
}
92 changes: 92 additions & 0 deletions packages/contracts-bedrock/medusa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"fuzzing": {
"workers": 10,
"workerResetLimit": 50,
"timeout": 0,
"testLimit": 0,
"shrinkLimit": 5000,
"callSequenceLength": 100,
"corpusDirectory": "test/invariants/interop/corpus",
"coverageEnabled": true,
"coverageFormats": ["html", "lcov"],
"targetContracts": ["FuzzTest"],
"predeployedContracts": {
"Deployer815": "0x4200000000000000000000000000000000000815",
"Deployer825": "0x4200000000000000000000000000000000000825"
},
"targetContractsBalances": [],
"constructorArgs": {},
"deployerAddress": "0x30000",
"senderAddresses": [
"0x10000",
"0x20000",
"0x30000",
"0x40000",
"0x50000",
"0x60000",
"0x70000",
"0x80000",
"0x90000",
"0xa0000"
],
"blockNumberDelayMax": 60480,
"blockTimestampDelayMax": 604800,
"blockGasLimit": 125000000,
"transactionGasLimit": 12500000,
"testing": {
"stopOnFailedTest": false,
"stopOnFailedContractMatching": false,
"stopOnNoTests": true,
"testAllContracts": false,
"traceAll": true,
"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": ".",
"solcVersion": "",
"exportDirectory": "",
"args": ["--foundry-compile-all", "--foundry-out-directory", "artifacts"]
}
},
"logging": {
"level": "info",
"logDirectory": "",
"noColor": false
}
}
7 changes: 7 additions & 0 deletions packages/contracts-bedrock/src/L2/SuperchainWETH.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { IETHLiquidity } from "interfaces/L2/IETHLiquidity.sol";
import { IERC7802, IERC165 } from "interfaces/L2/IERC7802.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { console } from "forge-std/Console.sol";

/// @custom:proxied true
/// @custom:predeploy 0x4200000000000000000000000000000000000024
/// @title SuperchainWETH
Expand Down Expand Up @@ -131,9 +133,14 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver {
revert NotCustomGasToken();
}

console.log("msg.value: %s", msg.value);
console.log("address(this).balamce: %s", address(this).balance);

// NOTE: 'burn' will soon change to 'deposit'.
IETHLiquidity(Predeploys.ETH_LIQUIDITY).burn{ value: msg.value }();

console.log("address(this).balamce AFTER: %s", address(this).balance);

msgHash_ = IL2ToL2CrossDomainMessenger(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER).sendMessage({
_destination: _chainId,
_target: address(this),
Expand Down
Loading