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 sig check to CI #78

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ jobs:
- name: Run integration tests
run: yarn test

test-storage:
name: Test storage layout
test-contracts:
name: Test storage layout and signatures
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -95,6 +95,9 @@ jobs:
- name: Test Storage Layouts
run: yarn run test:storage

- name: Test function signatures
run: yarn run test:signatures

test-e2e:
name: Test e2e
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ forge-cache/
#Storage layout test files
test/storage/*-old.dot
test/storage/*-old
test/signatures/*-old

# local deployment files
network.json
Expand Down
1 change: 1 addition & 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:signatures": "./scripts/signatures_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",
Expand Down
17 changes: 17 additions & 0 deletions scripts/signatures_test.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
output_dir="./test/signatures"
for CONTRACTNAME in L1ERC20Gateway L1CustomGateway L1ReverseCustomGateway L1WethGateway L2ERC20Gateway L2CustomGateway L2ReverseCustomGateway L2WethGateway L1GatewayRouter L2GatewayRouter StandardArbERC20 L1AtomicTokenBridgeCreator L1TokenBridgeRetryableSender L2AtomicTokenBridgeFactory L1OrbitCustomGateway L1OrbitERC20Gateway L1OrbitGatewayRouter L1OrbitReverseCustomGateway
do
echo "Checking for signature changes in $CONTRACTNAME"
[ -f "$output_dir/$CONTRACTNAME" ] && mv "$output_dir/$CONTRACTNAME" "$output_dir/$CONTRACTNAME-old"
forge inspect "$CONTRACTNAME" methods > "$output_dir/$CONTRACTNAME"
diff "$output_dir/$CONTRACTNAME-old" "$output_dir/$CONTRACTNAME"
if [[ $? != "0" ]]
then
CHANGED=1
fi
done
if [[ $CHANGED == 1 ]]
then
exit 1
fi
25 changes: 25 additions & 0 deletions test/signatures/L1AtomicTokenBridgeCreator
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"canonicalL2FactoryAddress()": "bfd3e518",
"createTokenBridge(address,address,uint256,uint256)": "8277742b",
"gasLimitForL2FactoryDeployment()": "888139d4",
"getRouter(address)": "8369166d",
"inboxToL1Deployment(address)": "d9ce0ef9",
"inboxToL2Deployment(address)": "46052706",
"initialize(address)": "c4d66de8",
"l1Multicall()": "b1460a71",
"l1Templates()": "a5595da9",
"l1Weth()": "146bf4b1",
"l2CustomGatewayTemplate()": "41083186",
"l2MulticallTemplate()": "8c99e31c",
"l2RouterTemplate()": "381c9d99",
"l2StandardGatewayTemplate()": "d7eee6ca",
"l2TokenBridgeFactoryTemplate()": "1aeef2e2",
"l2WethGatewayTemplate()": "9095765e",
"l2WethTemplate()": "fd40ad85",
"owner()": "8da5cb5b",
"renounceOwnership()": "715018a6",
"retryableSender()": "36dddb97",
"setDeployment(address,(address,address,address,address,address),(address,address,address,address,address,address,address,address,address))": "4c149671",
"setTemplates((address,address,address,address,address,address,address,address),address,address,address,address,address,address,address,address,address,uint256)": "81fb9184",
"transferOwnership(address)": "f2fde38b"
}
24 changes: 24 additions & 0 deletions test/signatures/L1CustomGateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"calculateL2TokenAddress(address)": "a7e28d48",
"counterpartGateway()": "2db09c1c",
"encodeWithdrawal(uint256,address)": "020a6058",
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
"forceRegisterTokenToL2(address[],address[],uint256,uint256,uint256)": "1d3a689f",
"getExternalCall(uint256,address,bytes)": "f68a9082",
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
"inbox()": "fb0e722b",
"initialize(address,address,address,address)": "f8c8765e",
"l1ToL2Token(address)": "8a2dc014",
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
"outboundTransferCustomRefund(address,address,address,uint256,uint256,uint256,bytes)": "4fb1a07b",
"owner()": "8da5cb5b",
"postUpgradeInit()": "95fcea78",
"redirectedExits(bytes32)": "bcf2e6eb",
"registerTokenToL2(address,uint256,uint256,uint256)": "f26bdead",
"registerTokenToL2(address,uint256,uint256,uint256,address)": "ca346d4a",
"router()": "f887ea40",
"setOwner(address)": "13af4035",
"supportsInterface(bytes4)": "01ffc9a7",
"transferExitAndCall(uint256,address,address,bytes,bytes)": "bd5f3e7d",
"whitelist()": "93e59dc1"
}
20 changes: 20 additions & 0 deletions test/signatures/L1ERC20Gateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"calculateL2TokenAddress(address)": "a7e28d48",
"cloneableProxyHash()": "97881f8d",
"counterpartGateway()": "2db09c1c",
"encodeWithdrawal(uint256,address)": "020a6058",
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
"getExternalCall(uint256,address,bytes)": "f68a9082",
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
"inbox()": "fb0e722b",
"initialize(address,address,address,bytes32,address)": "a01893bf",
"l2BeaconProxyFactory()": "70fc045f",
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
"outboundTransferCustomRefund(address,address,address,uint256,uint256,uint256,bytes)": "4fb1a07b",
"postUpgradeInit()": "95fcea78",
"redirectedExits(bytes32)": "bcf2e6eb",
"router()": "f887ea40",
"supportsInterface(bytes4)": "01ffc9a7",
"transferExitAndCall(uint256,address,address,bytes,bytes)": "bd5f3e7d",
"whitelist()": "93e59dc1"
}
24 changes: 24 additions & 0 deletions test/signatures/L1GatewayRouter
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"calculateL2TokenAddress(address)": "a7e28d48",
"counterpartGateway()": "2db09c1c",
"defaultGateway()": "03295802",
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
"getGateway(address)": "bda009fe",
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
"inbox()": "fb0e722b",
"initialize(address,address,address,address,address)": "1459457a",
"l1TokenToGateway(address)": "ed08fdc6",
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
"outboundTransferCustomRefund(address,address,address,uint256,uint256,uint256,bytes)": "4fb1a07b",
"owner()": "8da5cb5b",
"postUpgradeInit()": "95fcea78",
"router()": "f887ea40",
"setDefaultGateway(address,uint256,uint256,uint256)": "5625a952",
"setGateway(address,uint256,uint256,uint256)": "dd614569",
"setGateway(address,uint256,uint256,uint256,address)": "2d67b72d",
"setGateways(address[],address[],uint256,uint256,uint256)": "658b53f4",
"setOwner(address)": "13af4035",
"supportsInterface(bytes4)": "01ffc9a7",
"updateWhitelistSource(address)": "47466f98",
"whitelist()": "93e59dc1"
}
27 changes: 27 additions & 0 deletions test/signatures/L1OrbitCustomGateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"calculateL2TokenAddress(address)": "a7e28d48",
"counterpartGateway()": "2db09c1c",
"encodeWithdrawal(uint256,address)": "020a6058",
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
"forceRegisterTokenToL2(address[],address[],uint256,uint256,uint256)": "1d3a689f",
"forceRegisterTokenToL2(address[],address[],uint256,uint256,uint256,uint256)": "85f25597",
"getExternalCall(uint256,address,bytes)": "f68a9082",
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
"inbox()": "fb0e722b",
"initialize(address,address,address,address)": "f8c8765e",
"l1ToL2Token(address)": "8a2dc014",
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
"outboundTransferCustomRefund(address,address,address,uint256,uint256,uint256,bytes)": "4fb1a07b",
"owner()": "8da5cb5b",
"postUpgradeInit()": "95fcea78",
"redirectedExits(bytes32)": "bcf2e6eb",
"registerTokenToL2(address,uint256,uint256,uint256)": "f26bdead",
"registerTokenToL2(address,uint256,uint256,uint256,address)": "ca346d4a",
"registerTokenToL2(address,uint256,uint256,uint256,address,uint256)": "37daacad",
"registerTokenToL2(address,uint256,uint256,uint256,uint256)": "3e8ee3df",
"router()": "f887ea40",
"setOwner(address)": "13af4035",
"supportsInterface(bytes4)": "01ffc9a7",
"transferExitAndCall(uint256,address,address,bytes,bytes)": "bd5f3e7d",
"whitelist()": "93e59dc1"
}
20 changes: 20 additions & 0 deletions test/signatures/L1OrbitERC20Gateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"calculateL2TokenAddress(address)": "a7e28d48",
"cloneableProxyHash()": "97881f8d",
"counterpartGateway()": "2db09c1c",
"encodeWithdrawal(uint256,address)": "020a6058",
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
"getExternalCall(uint256,address,bytes)": "f68a9082",
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
"inbox()": "fb0e722b",
"initialize(address,address,address,bytes32,address)": "a01893bf",
"l2BeaconProxyFactory()": "70fc045f",
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
"outboundTransferCustomRefund(address,address,address,uint256,uint256,uint256,bytes)": "4fb1a07b",
"postUpgradeInit()": "95fcea78",
"redirectedExits(bytes32)": "bcf2e6eb",
"router()": "f887ea40",
"supportsInterface(bytes4)": "01ffc9a7",
"transferExitAndCall(uint256,address,address,bytes,bytes)": "bd5f3e7d",
"whitelist()": "93e59dc1"
}
28 changes: 28 additions & 0 deletions test/signatures/L1OrbitGatewayRouter
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"calculateL2TokenAddress(address)": "a7e28d48",
"counterpartGateway()": "2db09c1c",
"defaultGateway()": "03295802",
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
"getGateway(address)": "bda009fe",
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
"inbox()": "fb0e722b",
"initialize(address,address,address,address,address)": "1459457a",
"l1TokenToGateway(address)": "ed08fdc6",
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
"outboundTransferCustomRefund(address,address,address,uint256,uint256,uint256,bytes)": "4fb1a07b",
"owner()": "8da5cb5b",
"postUpgradeInit()": "95fcea78",
"router()": "f887ea40",
"setDefaultGateway(address,uint256,uint256,uint256)": "5625a952",
"setDefaultGateway(address,uint256,uint256,uint256,uint256)": "c9a96997",
"setGateway(address,uint256,uint256,uint256)": "dd614569",
"setGateway(address,uint256,uint256,uint256,address)": "2d67b72d",
"setGateway(address,uint256,uint256,uint256,address,uint256)": "d7f7459c",
"setGateway(address,uint256,uint256,uint256,uint256)": "dc121927",
"setGateways(address[],address[],uint256,uint256,uint256)": "658b53f4",
"setGateways(address[],address[],uint256,uint256,uint256,uint256)": "55654af8",
"setOwner(address)": "13af4035",
"supportsInterface(bytes4)": "01ffc9a7",
"updateWhitelistSource(address)": "47466f98",
"whitelist()": "93e59dc1"
}
27 changes: 27 additions & 0 deletions test/signatures/L1OrbitReverseCustomGateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"calculateL2TokenAddress(address)": "a7e28d48",
"counterpartGateway()": "2db09c1c",
"encodeWithdrawal(uint256,address)": "020a6058",
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
"forceRegisterTokenToL2(address[],address[],uint256,uint256,uint256)": "1d3a689f",
"forceRegisterTokenToL2(address[],address[],uint256,uint256,uint256,uint256)": "85f25597",
"getExternalCall(uint256,address,bytes)": "f68a9082",
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
"inbox()": "fb0e722b",
"initialize(address,address,address,address)": "f8c8765e",
"l1ToL2Token(address)": "8a2dc014",
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
"outboundTransferCustomRefund(address,address,address,uint256,uint256,uint256,bytes)": "4fb1a07b",
"owner()": "8da5cb5b",
"postUpgradeInit()": "95fcea78",
"redirectedExits(bytes32)": "bcf2e6eb",
"registerTokenToL2(address,uint256,uint256,uint256)": "f26bdead",
"registerTokenToL2(address,uint256,uint256,uint256,address)": "ca346d4a",
"registerTokenToL2(address,uint256,uint256,uint256,address,uint256)": "37daacad",
"registerTokenToL2(address,uint256,uint256,uint256,uint256)": "3e8ee3df",
"router()": "f887ea40",
"setOwner(address)": "13af4035",
"supportsInterface(bytes4)": "01ffc9a7",
"transferExitAndCall(uint256,address,address,bytes,bytes)": "bd5f3e7d",
"whitelist()": "93e59dc1"
}
24 changes: 24 additions & 0 deletions test/signatures/L1ReverseCustomGateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"calculateL2TokenAddress(address)": "a7e28d48",
"counterpartGateway()": "2db09c1c",
"encodeWithdrawal(uint256,address)": "020a6058",
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
"forceRegisterTokenToL2(address[],address[],uint256,uint256,uint256)": "1d3a689f",
"getExternalCall(uint256,address,bytes)": "f68a9082",
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
"inbox()": "fb0e722b",
"initialize(address,address,address,address)": "f8c8765e",
"l1ToL2Token(address)": "8a2dc014",
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
"outboundTransferCustomRefund(address,address,address,uint256,uint256,uint256,bytes)": "4fb1a07b",
"owner()": "8da5cb5b",
"postUpgradeInit()": "95fcea78",
"redirectedExits(bytes32)": "bcf2e6eb",
"registerTokenToL2(address,uint256,uint256,uint256)": "f26bdead",
"registerTokenToL2(address,uint256,uint256,uint256,address)": "ca346d4a",
"router()": "f887ea40",
"setOwner(address)": "13af4035",
"supportsInterface(bytes4)": "01ffc9a7",
"transferExitAndCall(uint256,address,address,bytes,bytes)": "bd5f3e7d",
"whitelist()": "93e59dc1"
}
7 changes: 7 additions & 0 deletions test/signatures/L1TokenBridgeRetryableSender
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"initialize()": "8129fc1c",
"owner()": "8da5cb5b",
"renounceOwnership()": "715018a6",
"sendRetryable((address,address,address,address,uint256,uint256),(address,address,address,address,address,address,address),(address,address,address,address,address),address,address,address,address,bool)": "d5402e89",
"transferOwnership(address)": "f2fde38b"
}
19 changes: 19 additions & 0 deletions test/signatures/L1WethGateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"calculateL2TokenAddress(address)": "a7e28d48",
"counterpartGateway()": "2db09c1c",
"encodeWithdrawal(uint256,address)": "020a6058",
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
"getExternalCall(uint256,address,bytes)": "f68a9082",
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
"inbox()": "fb0e722b",
"initialize(address,address,address,address,address)": "1459457a",
"l1Weth()": "146bf4b1",
"l2Weth()": "247b2768",
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
"outboundTransferCustomRefund(address,address,address,uint256,uint256,uint256,bytes)": "4fb1a07b",
"postUpgradeInit()": "95fcea78",
"redirectedExits(bytes32)": "bcf2e6eb",
"router()": "f887ea40",
"supportsInterface(bytes4)": "01ffc9a7",
"transferExitAndCall(uint256,address,address,bytes,bytes)": "bd5f3e7d"
}
3 changes: 3 additions & 0 deletions test/signatures/L2AtomicTokenBridgeFactory
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"deployL2Contracts((bytes,bytes,bytes,bytes,bytes,bytes,bytes),address,address,address,address,address,address,address,address)": "b1c7a870"
}
14 changes: 14 additions & 0 deletions test/signatures/L2CustomGateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"calculateL2TokenAddress(address)": "a7e28d48",
"counterpartGateway()": "2db09c1c",
"exitNum()": "015234ab",
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
"initialize(address,address)": "485cc955",
"l1ToL2Token(address)": "8a2dc014",
"outboundTransfer(address,address,uint256,bytes)": "7b3a3c8b",
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
"postUpgradeInit()": "95fcea78",
"registerTokenFromL1(address[],address[])": "d4f5532f",
"router()": "f887ea40"
}
15 changes: 15 additions & 0 deletions test/signatures/L2ERC20Gateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"beaconProxyFactory()": "c05e6a95",
"calculateL2TokenAddress(address)": "a7e28d48",
"cloneableProxyHash()": "97881f8d",
"counterpartGateway()": "2db09c1c",
"exitNum()": "015234ab",
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
"getUserSalt(address)": "569f26ff",
"initialize(address,address,address)": "c0c53b8b",
"outboundTransfer(address,address,uint256,bytes)": "7b3a3c8b",
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
"postUpgradeInit()": "95fcea78",
"router()": "f887ea40"
}
16 changes: 16 additions & 0 deletions test/signatures/L2GatewayRouter
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"calculateL2TokenAddress(address)": "a7e28d48",
"counterpartGateway()": "2db09c1c",
"defaultGateway()": "03295802",
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
"getGateway(address)": "bda009fe",
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
"initialize(address,address)": "485cc955",
"l1TokenToGateway(address)": "ed08fdc6",
"outboundTransfer(address,address,uint256,bytes)": "7b3a3c8b",
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
"postUpgradeInit()": "95fcea78",
"router()": "f887ea40",
"setDefaultGateway(address)": "f7c9362f",
"setGateway(address[],address[])": "4201f985"
}
14 changes: 14 additions & 0 deletions test/signatures/L2ReverseCustomGateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"calculateL2TokenAddress(address)": "a7e28d48",
"counterpartGateway()": "2db09c1c",
"exitNum()": "015234ab",
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
"initialize(address,address)": "485cc955",
"l1ToL2Token(address)": "8a2dc014",
"outboundTransfer(address,address,uint256,bytes)": "7b3a3c8b",
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
"postUpgradeInit()": "95fcea78",
"registerTokenFromL1(address[],address[])": "d4f5532f",
"router()": "f887ea40"
}
14 changes: 14 additions & 0 deletions test/signatures/L2WethGateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"calculateL2TokenAddress(address)": "a7e28d48",
"counterpartGateway()": "2db09c1c",
"exitNum()": "015234ab",
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
"initialize(address,address,address,address)": "f8c8765e",
"l1Weth()": "146bf4b1",
"l2Weth()": "247b2768",
"outboundTransfer(address,address,uint256,bytes)": "7b3a3c8b",
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
"postUpgradeInit()": "95fcea78",
"router()": "f887ea40"
}
Loading
Loading