From 9e98118e07b5a29ae6be5e3dd9e9d2dd91d5dd31 Mon Sep 17 00:00:00 2001 From: Ihor Farion Date: Tue, 21 Oct 2025 21:48:22 -0700 Subject: [PATCH 1/3] add remappings.txt Signed-off-by: Ihor Farion --- remappings.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 remappings.txt diff --git a/remappings.txt b/remappings.txt new file mode 100644 index 000000000..b809403eb --- /dev/null +++ b/remappings.txt @@ -0,0 +1,18 @@ +@across-protocol/=node_modules/@across-protocol/ +@ensdomains/=node_modules/@ensdomains/ +@eth-optimism/=node_modules/@eth-optimism/ +@gnosis.pm/=node_modules/@gnosis.pm/ +@maticnetwork/=node_modules/@maticnetwork/ +@matterlabs/=node_modules/@matterlabs/ +@openzeppelin/=node_modules/@openzeppelin/ +@scroll-tech/=node_modules/@scroll-tech/ +@uma/=node_modules/@uma/ +@uniswap/=node_modules/@uniswap/ +arb-bridge-eth/=node_modules/arb-bridge-eth/ +arb-bridge-peripherals/=node_modules/arb-bridge-peripherals/ +arbos-precompiles/=node_modules/arbos-precompiles/ +base64-sol/=node_modules/base64-sol/ +eth-gas-reporter/=node_modules/eth-gas-reporter/ +hardhat-deploy/=node_modules/hardhat-deploy/ +hardhat/=node_modules/hardhat/ +forge-std/=lib/forge-std/src/ From 6c17a47fa9cdb9eeaa1bbd03c9bf5a342d46ca7c Mon Sep 17 00:00:00 2001 From: Ihor Farion Date: Tue, 21 Oct 2025 22:18:42 -0700 Subject: [PATCH 2/3] add pre-commit hook Signed-off-by: Ihor Farion --- scripts/preCommitHook.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/preCommitHook.sh b/scripts/preCommitHook.sh index e8fbc8b15..9cc8b2ad8 100644 --- a/scripts/preCommitHook.sh +++ b/scripts/preCommitHook.sh @@ -47,3 +47,22 @@ if [ $EXTRACT_ADDRESSES_EXIT -ne 0 ]; then echo "extract-addresses encountered an error. Aborting the hook." exit $EXTRACT_ADDRESSES_EXIT fi + +# Check if foundry.toml was modified in staged changes and update remappings.txt if so +if git diff --cached --name-only --diff-filter=d | grep -q "foundry\.toml"; then + echo "Running forge remappings to update remappings.txt ..." + forge remappings > remappings.txt + FORGE_REMAPPINGS_EXIT=$? + if [ $FORGE_REMAPPINGS_EXIT -ne 0 ]; then + echo "forge remappings encountered an error. Aborting the hook." + exit $FORGE_REMAPPINGS_EXIT + fi + + # Stage remappings.txt if it was modified + if git diff --name-only remappings.txt | grep -q "remappings.txt"; then + git add remappings.txt + echo "Updated and staged remappings.txt" + fi +else + echo "Skipping forge remappings (foundry.toml not modified)" +fi \ No newline at end of file From 3559130131d41ce6ea6f08dbf23a2295e1a2b8b9 Mon Sep 17 00:00:00 2001 From: Ihor Farion Date: Tue, 21 Oct 2025 22:20:58 -0700 Subject: [PATCH 3/3] add newline Signed-off-by: Ihor Farion --- scripts/preCommitHook.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/preCommitHook.sh b/scripts/preCommitHook.sh index 9cc8b2ad8..36f7ba87f 100644 --- a/scripts/preCommitHook.sh +++ b/scripts/preCommitHook.sh @@ -65,4 +65,4 @@ if git diff --cached --name-only --diff-filter=d | grep -q "foundry\.toml"; then fi else echo "Skipping forge remappings (foundry.toml not modified)" -fi \ No newline at end of file +fi