Skip to content
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"test:l2": "hardhat test test/*.l2.ts",
"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:storage": "./test/storage/test-storage.bash",
"test:signatures": "./test/signatures/test-sigs.bash",
"test:mutation": "ts-node test-mutation/gambitTester.ts",
"test:unused:errors": "./test/unused-errors/find_unused_errors.sh",
"deploy:local:token-bridge": "ts-node ./scripts/local-deployment/deployCreatorAndCreateTokenBridge.ts",
Expand Down
17 changes: 0 additions & 17 deletions scripts/signatures_test.bash

This file was deleted.

17 changes: 0 additions & 17 deletions scripts/storage_layout_test.bash

This file was deleted.

43 changes: 43 additions & 0 deletions scripts/template/print-contracts.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# search for all contracts defined in the contracts directory and print them

# need to build with this flag to get AST output
# could keep an eye on this issue to optimize this: https://github.com/foundry-rs/foundry/issues/7212
forge build --build-info > /dev/null

if [ $? -ne 0 ]; then
echo "Build failed"
exit 1
fi

OUTPUT_PATH="out/"
SOURCE_PATH="contracts/"

# find all json files in the out directory
FILES=$(find $OUTPUT_PATH -name "*.json")

# Initialize an empty array to collect all contract names
declare -a all_contract_names=()

# for each file, print the absolutePath
for file in $FILES; do
sol_path=$(cat "$file" | jq '.ast.absolutePath' -r)

# make sure the path is in the source path and exclude test directory
if [[ $sol_path == $SOURCE_PATH* ]] && [[ $sol_path != *"contracts/tokenbridge/test/"* ]]; then
# Read contract names into an array and append them to the all_contract_names array
while IFS= read -r name; do
all_contract_names+=("$name")
done < <(cat $file | jq '.ast.nodes[] | select(.nodeType == "ContractDefinition" and .contractKind == "contract" and .abstract == false).name' -r)
fi
done

# if we have no contracts, exit with an error
if [ ${#all_contract_names[@]} -eq 0 ]; then
echo "No contracts found"
exit 1
fi

# Print unique contract names, removing duplicates
printf "%s\n" "${all_contract_names[@]}" | sort | uniq
33 changes: 33 additions & 0 deletions test/signatures/ArbMulticall2
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

╭-----------------------------------------------+------------╮
| Method | Identifier |
+============================================================+
| aggregate((address,bytes)[]) | 252dba42 |
|-----------------------------------------------+------------|
| blockAndAggregate((address,bytes)[]) | c3077fa9 |
|-----------------------------------------------+------------|
| getBlockHash(uint256) | ee82ac5e |
|-----------------------------------------------+------------|
| getBlockNumber() | 42cbb15c |
|-----------------------------------------------+------------|
| getCurrentBlockCoinbase() | a8b0574e |
|-----------------------------------------------+------------|
| getCurrentBlockDifficulty() | 72425d9d |
|-----------------------------------------------+------------|
| getCurrentBlockGasLimit() | 86d516e8 |
|-----------------------------------------------+------------|
| getCurrentBlockTimestamp() | 0f28c97d |
|-----------------------------------------------+------------|
| getEthBalance(address) | 4d2301cc |
|-----------------------------------------------+------------|
| getL1BlockNumber() | b9b3efe9 |
|-----------------------------------------------+------------|
| getLastBlockHash() | 27e86d6e |
|-----------------------------------------------+------------|
| tryAggregate(bool,(address,bytes)[]) | bce38bd7 |
|-----------------------------------------------+------------|
| tryAggregateGasRation(bool,(address,bytes)[]) | 2935cd90 |
|-----------------------------------------------+------------|
| tryBlockAndAggregate(bool,(address,bytes)[]) | 399542e9 |
╰-----------------------------------------------+------------╯

19 changes: 19 additions & 0 deletions test/signatures/BeaconProxyFactory
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

╭-------------------------------------------+------------╮
| Method | Identifier |
+========================================================+
| beacon() | 59659e90 |
|-------------------------------------------+------------|
| calculateExpectedAddress(address,bytes32) | e75b2141 |
|-------------------------------------------+------------|
| calculateExpectedAddress(bytes32) | 396a5f95 |
|-------------------------------------------+------------|
| cloneableProxyHash() | 97881f8d |
|-------------------------------------------+------------|
| createProxy(bytes32) | 29a5c5cf |
|-------------------------------------------+------------|
| getSalt(address,bytes32) | b3e3bf42 |
|-------------------------------------------+------------|
| initialize(address) | c4d66de8 |
╰-------------------------------------------+------------╯

6 changes: 6 additions & 0 deletions test/signatures/ClonableBeaconProxy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

╭--------+------------╮
| Method | Identifier |
+=====================+
╰--------+------------╯

7 changes: 7 additions & 0 deletions test/signatures/Cloneable
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

╭------------+------------╮
| Method | Identifier |
+=========================+
| isMaster() | 6f791d29 |
╰------------+------------╯

27 changes: 27 additions & 0 deletions test/signatures/ERC20Upgradeable
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

╭---------------------------------------+------------╮
| Method | Identifier |
+====================================================+
| allowance(address,address) | dd62ed3e |
|---------------------------------------+------------|
| approve(address,uint256) | 095ea7b3 |
|---------------------------------------+------------|
| balanceOf(address) | 70a08231 |
|---------------------------------------+------------|
| decimals() | 313ce567 |
|---------------------------------------+------------|
| decreaseAllowance(address,uint256) | a457c2d7 |
|---------------------------------------+------------|
| increaseAllowance(address,uint256) | 39509351 |
|---------------------------------------+------------|
| name() | 06fdde03 |
|---------------------------------------+------------|
| symbol() | 95d89b41 |
|---------------------------------------+------------|
| totalSupply() | 18160ddd |
|---------------------------------------+------------|
| transfer(address,uint256) | a9059cbb |
|---------------------------------------+------------|
| transferFrom(address,address,uint256) | 23b872dd |
╰---------------------------------------+------------╯

49 changes: 49 additions & 0 deletions test/signatures/L1ForceOnlyReverseCustomGateway
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

╭-------------------------------------------------------------------------------------+------------╮
| Method | Identifier |
+==================================================================================================+
| 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 |
╰-------------------------------------------------------------------------------------+------------╯

45 changes: 45 additions & 0 deletions test/signatures/L2CustomGatewayToken
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

╭---------------------------------------------------------------+------------╮
| Method | Identifier |
+============================================================================+
| DOMAIN_SEPARATOR() | 3644e515 |
|---------------------------------------------------------------+------------|
| allowance(address,address) | dd62ed3e |
|---------------------------------------------------------------+------------|
| approve(address,uint256) | 095ea7b3 |
|---------------------------------------------------------------+------------|
| balanceOf(address) | 70a08231 |
|---------------------------------------------------------------+------------|
| bridgeBurn(address,uint256) | 74f4f547 |
|---------------------------------------------------------------+------------|
| bridgeMint(address,uint256) | 8c2a993e |
|---------------------------------------------------------------+------------|
| decimals() | 313ce567 |
|---------------------------------------------------------------+------------|
| decreaseAllowance(address,uint256) | a457c2d7 |
|---------------------------------------------------------------+------------|
| increaseAllowance(address,uint256) | 39509351 |
|---------------------------------------------------------------+------------|
| initialize(string,string,uint8,address,address) | c820f146 |
|---------------------------------------------------------------+------------|
| l1Address() | c2eeeebd |
|---------------------------------------------------------------+------------|
| l2Gateway() | 8fa74a0e |
|---------------------------------------------------------------+------------|
| name() | 06fdde03 |
|---------------------------------------------------------------+------------|
| nonces(address) | 7ecebe00 |
|---------------------------------------------------------------+------------|
| permit(address,address,uint256,uint256,uint8,bytes32,bytes32) | d505accf |
|---------------------------------------------------------------+------------|
| symbol() | 95d89b41 |
|---------------------------------------------------------------+------------|
| totalSupply() | 18160ddd |
|---------------------------------------------------------------+------------|
| transfer(address,uint256) | a9059cbb |
|---------------------------------------------------------------+------------|
| transferAndCall(address,uint256,bytes) | 4000aea0 |
|---------------------------------------------------------------+------------|
| transferFrom(address,address,uint256) | 23b872dd |
╰---------------------------------------------------------------+------------╯

31 changes: 31 additions & 0 deletions test/signatures/Multicall2
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

╭-----------------------------------------------+------------╮
| Method | Identifier |
+============================================================+
| aggregate((address,bytes)[]) | 252dba42 |
|-----------------------------------------------+------------|
| blockAndAggregate((address,bytes)[]) | c3077fa9 |
|-----------------------------------------------+------------|
| getBlockHash(uint256) | ee82ac5e |
|-----------------------------------------------+------------|
| getBlockNumber() | 42cbb15c |
|-----------------------------------------------+------------|
| getCurrentBlockCoinbase() | a8b0574e |
|-----------------------------------------------+------------|
| getCurrentBlockDifficulty() | 72425d9d |
|-----------------------------------------------+------------|
| getCurrentBlockGasLimit() | 86d516e8 |
|-----------------------------------------------+------------|
| getCurrentBlockTimestamp() | 0f28c97d |
|-----------------------------------------------+------------|
| getEthBalance(address) | 4d2301cc |
|-----------------------------------------------+------------|
| getLastBlockHash() | 27e86d6e |
|-----------------------------------------------+------------|
| tryAggregate(bool,(address,bytes)[]) | bce38bd7 |
|-----------------------------------------------+------------|
| tryAggregateGasRation(bool,(address,bytes)[]) | 2935cd90 |
|-----------------------------------------------+------------|
| tryBlockAndAggregate(bool,(address,bytes)[]) | 399542e9 |
╰-----------------------------------------------+------------╯

15 changes: 15 additions & 0 deletions test/signatures/Whitelist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

╭-------------------------------------+------------╮
| Method | Identifier |
+==================================================+
| isAllowed(address) | babcc539 |
|-------------------------------------+------------|
| owner() | 8da5cb5b |
|-------------------------------------+------------|
| setOwner(address) | 13af4035 |
|-------------------------------------+------------|
| setWhitelist(address[],bool[]) | 3b99adf7 |
|-------------------------------------+------------|
| triggerConsumers(address,address[]) | 37ca2617 |
╰-------------------------------------+------------╯

Loading