Skip to content

Commit f13d954

Browse files
authored
Merge pull request #78 from OffchainLabs/sig-check-ci
Add sig check to CI
2 parents cfeb274 + c597648 commit f13d954

22 files changed

+368
-2
lines changed

.github/workflows/build-test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ jobs:
6666
- name: Run integration tests
6767
run: yarn test
6868

69-
test-storage:
70-
name: Test storage layout
69+
test-contracts:
70+
name: Test storage layout and signatures
7171
runs-on: ubuntu-latest
7272
steps:
7373
- uses: actions/checkout@v3
@@ -95,6 +95,9 @@ jobs:
9595
- name: Test Storage Layouts
9696
run: yarn run test:storage
9797

98+
- name: Test function signatures
99+
run: yarn run test:signatures
100+
98101
test-e2e:
99102
name: Test e2e
100103
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ forge-cache/
1616
#Storage layout test files
1717
test/storage/*-old.dot
1818
test/storage/*-old
19+
test/signatures/*-old
1920

2021
# local deployment files
2122
network.json

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"test:unit": "forge test",
2121
"test:e2e:local-env": "yarn hardhat test test-e2e/*",
2222
"test:storage": "./scripts/storage_layout_test.bash",
23+
"test:signatures": "./scripts/signatures_test.bash",
2324
"test:mutation": "ts-node test-mutation/gambitTester.ts",
2425
"deploy:local:token-bridge": "ts-node ./scripts/local-deployment/deployCreatorAndCreateTokenBridge.ts",
2526
"deploy:token-bridge-creator": "ts-node ./scripts/deployment/deployTokenBridgeCreator.ts",

scripts/signatures_test.bash

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
output_dir="./test/signatures"
3+
for CONTRACTNAME in L1ERC20Gateway L1CustomGateway L1ReverseCustomGateway L1WethGateway L2ERC20Gateway L2CustomGateway L2ReverseCustomGateway L2WethGateway L1GatewayRouter L2GatewayRouter StandardArbERC20 L1AtomicTokenBridgeCreator L1TokenBridgeRetryableSender L2AtomicTokenBridgeFactory L1OrbitCustomGateway L1OrbitERC20Gateway L1OrbitGatewayRouter L1OrbitReverseCustomGateway
4+
do
5+
echo "Checking for signature changes in $CONTRACTNAME"
6+
[ -f "$output_dir/$CONTRACTNAME" ] && mv "$output_dir/$CONTRACTNAME" "$output_dir/$CONTRACTNAME-old"
7+
forge inspect "$CONTRACTNAME" methods > "$output_dir/$CONTRACTNAME"
8+
diff "$output_dir/$CONTRACTNAME-old" "$output_dir/$CONTRACTNAME"
9+
if [[ $? != "0" ]]
10+
then
11+
CHANGED=1
12+
fi
13+
done
14+
if [[ $CHANGED == 1 ]]
15+
then
16+
exit 1
17+
fi
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"canonicalL2FactoryAddress()": "bfd3e518",
3+
"createTokenBridge(address,address,uint256,uint256)": "8277742b",
4+
"gasLimitForL2FactoryDeployment()": "888139d4",
5+
"getRouter(address)": "8369166d",
6+
"inboxToL1Deployment(address)": "d9ce0ef9",
7+
"inboxToL2Deployment(address)": "46052706",
8+
"initialize(address)": "c4d66de8",
9+
"l1Multicall()": "b1460a71",
10+
"l1Templates()": "a5595da9",
11+
"l1Weth()": "146bf4b1",
12+
"l2CustomGatewayTemplate()": "41083186",
13+
"l2MulticallTemplate()": "8c99e31c",
14+
"l2RouterTemplate()": "381c9d99",
15+
"l2StandardGatewayTemplate()": "d7eee6ca",
16+
"l2TokenBridgeFactoryTemplate()": "1aeef2e2",
17+
"l2WethGatewayTemplate()": "9095765e",
18+
"l2WethTemplate()": "fd40ad85",
19+
"owner()": "8da5cb5b",
20+
"renounceOwnership()": "715018a6",
21+
"retryableSender()": "36dddb97",
22+
"setDeployment(address,(address,address,address,address,address),(address,address,address,address,address,address,address,address,address))": "4c149671",
23+
"setTemplates((address,address,address,address,address,address,address,address),address,address,address,address,address,address,address,address,address,uint256)": "81fb9184",
24+
"transferOwnership(address)": "f2fde38b"
25+
}

test/signatures/L1CustomGateway

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"calculateL2TokenAddress(address)": "a7e28d48",
3+
"counterpartGateway()": "2db09c1c",
4+
"encodeWithdrawal(uint256,address)": "020a6058",
5+
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
6+
"forceRegisterTokenToL2(address[],address[],uint256,uint256,uint256)": "1d3a689f",
7+
"getExternalCall(uint256,address,bytes)": "f68a9082",
8+
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
9+
"inbox()": "fb0e722b",
10+
"initialize(address,address,address,address)": "f8c8765e",
11+
"l1ToL2Token(address)": "8a2dc014",
12+
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
13+
"outboundTransferCustomRefund(address,address,address,uint256,uint256,uint256,bytes)": "4fb1a07b",
14+
"owner()": "8da5cb5b",
15+
"postUpgradeInit()": "95fcea78",
16+
"redirectedExits(bytes32)": "bcf2e6eb",
17+
"registerTokenToL2(address,uint256,uint256,uint256)": "f26bdead",
18+
"registerTokenToL2(address,uint256,uint256,uint256,address)": "ca346d4a",
19+
"router()": "f887ea40",
20+
"setOwner(address)": "13af4035",
21+
"supportsInterface(bytes4)": "01ffc9a7",
22+
"transferExitAndCall(uint256,address,address,bytes,bytes)": "bd5f3e7d",
23+
"whitelist()": "93e59dc1"
24+
}

test/signatures/L1ERC20Gateway

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"calculateL2TokenAddress(address)": "a7e28d48",
3+
"cloneableProxyHash()": "97881f8d",
4+
"counterpartGateway()": "2db09c1c",
5+
"encodeWithdrawal(uint256,address)": "020a6058",
6+
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
7+
"getExternalCall(uint256,address,bytes)": "f68a9082",
8+
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
9+
"inbox()": "fb0e722b",
10+
"initialize(address,address,address,bytes32,address)": "a01893bf",
11+
"l2BeaconProxyFactory()": "70fc045f",
12+
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
13+
"outboundTransferCustomRefund(address,address,address,uint256,uint256,uint256,bytes)": "4fb1a07b",
14+
"postUpgradeInit()": "95fcea78",
15+
"redirectedExits(bytes32)": "bcf2e6eb",
16+
"router()": "f887ea40",
17+
"supportsInterface(bytes4)": "01ffc9a7",
18+
"transferExitAndCall(uint256,address,address,bytes,bytes)": "bd5f3e7d",
19+
"whitelist()": "93e59dc1"
20+
}

test/signatures/L1GatewayRouter

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"calculateL2TokenAddress(address)": "a7e28d48",
3+
"counterpartGateway()": "2db09c1c",
4+
"defaultGateway()": "03295802",
5+
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
6+
"getGateway(address)": "bda009fe",
7+
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
8+
"inbox()": "fb0e722b",
9+
"initialize(address,address,address,address,address)": "1459457a",
10+
"l1TokenToGateway(address)": "ed08fdc6",
11+
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
12+
"outboundTransferCustomRefund(address,address,address,uint256,uint256,uint256,bytes)": "4fb1a07b",
13+
"owner()": "8da5cb5b",
14+
"postUpgradeInit()": "95fcea78",
15+
"router()": "f887ea40",
16+
"setDefaultGateway(address,uint256,uint256,uint256)": "5625a952",
17+
"setGateway(address,uint256,uint256,uint256)": "dd614569",
18+
"setGateway(address,uint256,uint256,uint256,address)": "2d67b72d",
19+
"setGateways(address[],address[],uint256,uint256,uint256)": "658b53f4",
20+
"setOwner(address)": "13af4035",
21+
"supportsInterface(bytes4)": "01ffc9a7",
22+
"updateWhitelistSource(address)": "47466f98",
23+
"whitelist()": "93e59dc1"
24+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"calculateL2TokenAddress(address)": "a7e28d48",
3+
"counterpartGateway()": "2db09c1c",
4+
"encodeWithdrawal(uint256,address)": "020a6058",
5+
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
6+
"forceRegisterTokenToL2(address[],address[],uint256,uint256,uint256)": "1d3a689f",
7+
"forceRegisterTokenToL2(address[],address[],uint256,uint256,uint256,uint256)": "85f25597",
8+
"getExternalCall(uint256,address,bytes)": "f68a9082",
9+
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
10+
"inbox()": "fb0e722b",
11+
"initialize(address,address,address,address)": "f8c8765e",
12+
"l1ToL2Token(address)": "8a2dc014",
13+
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
14+
"outboundTransferCustomRefund(address,address,address,uint256,uint256,uint256,bytes)": "4fb1a07b",
15+
"owner()": "8da5cb5b",
16+
"postUpgradeInit()": "95fcea78",
17+
"redirectedExits(bytes32)": "bcf2e6eb",
18+
"registerTokenToL2(address,uint256,uint256,uint256)": "f26bdead",
19+
"registerTokenToL2(address,uint256,uint256,uint256,address)": "ca346d4a",
20+
"registerTokenToL2(address,uint256,uint256,uint256,address,uint256)": "37daacad",
21+
"registerTokenToL2(address,uint256,uint256,uint256,uint256)": "3e8ee3df",
22+
"router()": "f887ea40",
23+
"setOwner(address)": "13af4035",
24+
"supportsInterface(bytes4)": "01ffc9a7",
25+
"transferExitAndCall(uint256,address,address,bytes,bytes)": "bd5f3e7d",
26+
"whitelist()": "93e59dc1"
27+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"calculateL2TokenAddress(address)": "a7e28d48",
3+
"cloneableProxyHash()": "97881f8d",
4+
"counterpartGateway()": "2db09c1c",
5+
"encodeWithdrawal(uint256,address)": "020a6058",
6+
"finalizeInboundTransfer(address,address,address,uint256,bytes)": "2e567b36",
7+
"getExternalCall(uint256,address,bytes)": "f68a9082",
8+
"getOutboundCalldata(address,address,address,uint256,bytes)": "a0c76a96",
9+
"inbox()": "fb0e722b",
10+
"initialize(address,address,address,bytes32,address)": "a01893bf",
11+
"l2BeaconProxyFactory()": "70fc045f",
12+
"outboundTransfer(address,address,uint256,uint256,uint256,bytes)": "d2ce7d65",
13+
"outboundTransferCustomRefund(address,address,address,uint256,uint256,uint256,bytes)": "4fb1a07b",
14+
"postUpgradeInit()": "95fcea78",
15+
"redirectedExits(bytes32)": "bcf2e6eb",
16+
"router()": "f887ea40",
17+
"supportsInterface(bytes4)": "01ffc9a7",
18+
"transferExitAndCall(uint256,address,address,bytes,bytes)": "bd5f3e7d",
19+
"whitelist()": "93e59dc1"
20+
}

0 commit comments

Comments
 (0)