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

Add mutation testing #66

Merged
merged 15 commits into from
Feb 5, 2024
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ test/storage/*-old

# local deployment files
network.json

# Gambit (mutation test) files
gambit_out/
test-mutation/mutant_test_env/
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"test:unit": "forge test",
"test:e2e:local-env": "yarn hardhat test test-e2e/*",
"test:storage": "./scripts/storage_layout_test.bash",
"test:mutation": "ts-node test-mutation/gambitTester.ts",
"deploy:local:token-bridge": "ts-node ./scripts/local-deployment/deployCreatorAndCreateTokenBridge.ts",
"deploy:token-bridge-creator": "ts-node ./scripts/deployment/deployTokenBridgeCreator.ts",
"create:token-bridge": "ts-node ./scripts/deployment/createTokenBridge.ts",
Expand Down Expand Up @@ -51,6 +52,7 @@
"@typechain/ethers-v5": "^7.0.1",
"@typechain/hardhat": "^2.3.0",
"@types/chai": "^4.2.15",
"@types/fs-extra": "^11.0.4",
"@types/mocha": "^9.0.0",
"@types/node": "^14.14.28",
"@types/prompts": "^2.0.14",
Expand All @@ -66,6 +68,7 @@
"eslint-plugin-prettier": "^4.0.0",
"ethereum-waffle": "^3.2.0",
"ethers": "^5.4.5",
"fs-extra": "^11.2.0",
"hardhat": "2.17.3",
"hardhat-contract-sizer": "^2.10.0",
"hardhat-deploy": "^0.9.1",
Expand Down
5 changes: 2 additions & 3 deletions remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/
@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/



@arbitrum=node_modules/@arbitrum
@offchainlabs=node_modules/@offchainlabs
10 changes: 10 additions & 0 deletions test-mutation/all-configs/config.single.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1ERC20Gateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
}
]
106 changes: 106 additions & 0 deletions test-mutation/all-configs/config.tokenbridge-ethereum.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
[
{
"filename": "../contracts/tokenbridge/ethereum/L1ArbitrumMessenger.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1ArbitrumExtendedGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1ArbitrumGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1CustomGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1ERC20Gateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1ForceOnlyReverseCustomGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1GatewayRouter.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1OrbitCustomGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1OrbitERC20Gateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1OrbitGatewayRouter.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1OrbitReverseCustomGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1ReverseCustomGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1WethGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
}
]
106 changes: 106 additions & 0 deletions test-mutation/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
[
{
"filename": "../contracts/tokenbridge/ethereum/L1ArbitrumMessenger.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1ArbitrumExtendedGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1ArbitrumGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1CustomGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1ERC20Gateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1ForceOnlyReverseCustomGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1GatewayRouter.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1OrbitCustomGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1OrbitERC20Gateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1OrbitGatewayRouter.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1OrbitReverseCustomGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1ReverseCustomGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
},
{
"filename": "../contracts/tokenbridge/ethereum/gateway/L1WethGateway.sol",
"sourceroot": "..",
"solc_remappings": [
"@openzeppelin=../node_modules/@openzeppelin",
"@arbitrum=../node_modules/@arbitrum"
]
}
]
Loading