Skip to content

Commit abec6e8

Browse files
committed
fix ci
1 parent fddae70 commit abec6e8

File tree

7 files changed

+231
-198
lines changed

7 files changed

+231
-198
lines changed

.github/workflows/foundry-uniswap-v3.yml

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,68 +2,71 @@ name: Foundry Uniswap V3 Tests
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [main, develop]
66
paths:
77
- 'tests/evm-tools-compatibility/foundry-uniswap-v3/**'
88
- 'scripts/setup-compatibility-tests.sh'
99
- 'scripts/ci-foundry-uniswap-v3.sh'
1010
- 'local_node.sh'
1111
- '.github/workflows/foundry-uniswap-v3.yml'
1212
pull_request:
13-
branches: [ main, develop ]
13+
branches: [main, develop]
1414
paths:
1515
- 'tests/evm-tools-compatibility/foundry-uniswap-v3/**'
1616
- 'scripts/setup-compatibility-tests.sh'
1717
- 'scripts/ci-foundry-uniswap-v3.sh'
1818
- 'local_node.sh'
1919
- '.github/workflows/foundry-uniswap-v3.yml'
2020

21+
permissions:
22+
contents: read
23+
2124
jobs:
2225
foundry-uniswap-v3:
2326
runs-on: ubuntu-latest
2427
timeout-minutes: 30
2528

2629
steps:
27-
- name: Checkout code
28-
uses: actions/checkout@v4
29-
with:
30-
submodules: recursive
31-
32-
- name: Set up Go
33-
uses: actions/setup-go@v5
34-
with:
35-
go-version: '1.22'
36-
37-
- name: Install system dependencies
38-
run: |
39-
sudo apt-get update
40-
sudo apt-get install -y build-essential curl git
41-
42-
- name: Install Foundry
43-
uses: foundry-rs/foundry-toolchain@v1
44-
with:
45-
version: nightly
46-
47-
- name: Install Node.js
48-
uses: actions/setup-node@v4
49-
with:
50-
node-version: '18'
51-
52-
- name: Cache Go modules
53-
uses: actions/cache@v4
54-
with:
55-
path: ~/go/pkg/mod
56-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
57-
restore-keys: |
58-
${{ runner.os }}-go-
59-
60-
- name: Build and install evmd
61-
run: |
62-
make install
63-
64-
- name: Run foundry-uniswap-v3 tests
65-
run: |
66-
chmod +x scripts/ci-foundry-uniswap-v3.sh
67-
./scripts/ci-foundry-uniswap-v3.sh
68-
env:
69-
COMPAT_DIR: ${{ github.workspace }}/tests/evm-tools-compatibility
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
with:
33+
submodules: recursive
34+
35+
- name: Set up Go
36+
uses: actions/setup-go@v5
37+
with:
38+
go-version: '1.22'
39+
40+
- name: Install system dependencies
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install -y build-essential curl git
44+
45+
- name: Install Foundry
46+
uses: foundry-rs/foundry-toolchain@v1
47+
with:
48+
version: nightly
49+
50+
- name: Install Node.js
51+
uses: actions/setup-node@v4
52+
with:
53+
node-version: '18'
54+
55+
- name: Cache Go modules
56+
uses: actions/cache@v4
57+
with:
58+
path: ~/go/pkg/mod
59+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
60+
restore-keys: |
61+
${{ runner.os }}-go-
62+
63+
- name: Build and install evmd
64+
run: |
65+
make install
66+
67+
- name: Run foundry-uniswap-v3 tests
68+
run: |
69+
chmod +x scripts/ci-foundry-uniswap-v3.sh
70+
./scripts/ci-foundry-uniswap-v3.sh
71+
env:
72+
COMPAT_DIR: ${{ github.workspace }}/tests/evm-tools-compatibility

.gitleaks.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ paths = [
1616
'''gitleaks.toml''',
1717
'''(.*?)(jpg|gif|pdf|png|svg)$''',
1818
'''(go.mod|go.sum|go.work|go.work.sum)$''',
19+
'''tests/evm-tools-compatibility/.*''',
20+
'''tests/.*''',
1921
]
2022
stopwords = [
2123
'''secp256k1''',
2224
'''cosmospub1addwnpepqgcxazmq6wgt2j4rdfumsfwla0zfk8e5sws3p3zg5dkm9007hmfysxas0u2''',
2325
'''0x8FA78CEB7F04118Ec6d06AaC37Ca854691d8e963''',
2426
'''0x205CF44075E77A3543abC690437F3b2819bc450a''',
2527
'''cosmos10d07y265gmmuvt4z0w9aw880jnsr700jcrztvm''',
28+
'''0x8a36c69d940a92fcea94b36d0f2928c7a0ee19a90073eda769693298dfa9603b''',
29+
'''0x8a36c69d940a92fcea94b36d0f2928c7a0ee19a90''',
30+
'''073eda769693298dfa9603b''',
2631
]
2732

2833
[[rules]]

local_node.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fi
225225

226226
# Start the node
227227
evmd start "$TRACE" \
228-
--pruning nothing \
228+
--pruning nothing \
229229
--log_level $LOGLEVEL \
230230
--minimum-gas-prices=0.0001atest \
231231
--home "$CHAINDIR" \

scripts/ci-foundry-uniswap-v3.sh

Lines changed: 79 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ VERBOSE=false
1010

1111
# Parse command line arguments
1212
while [[ $# -gt 0 ]]; do
13-
case $1 in
14-
--verbose|-v)
15-
VERBOSE=true
16-
shift
17-
;;
18-
*)
19-
echo "Unknown option: $1"
20-
echo "Usage: $0 [--verbose]"
21-
exit 1
22-
;;
23-
esac
13+
case $1 in
14+
--verbose | -v)
15+
VERBOSE=true
16+
shift
17+
;;
18+
*)
19+
echo "Unknown option: $1"
20+
echo "Usage: $0 [--verbose]"
21+
exit 1
22+
;;
23+
esac
2424
done
2525

2626
ROOT="$(git rev-parse --show-toplevel)"
@@ -31,29 +31,29 @@ echo "Setting up foundry-uniswap-v3 tests..."
3131
# Setup dependencies and submodules
3232
echo "Running setup-compatibility-tests.sh..."
3333
if [ "$VERBOSE" = true ]; then
34-
"$ROOT/scripts/setup-compatibility-tests.sh"
34+
"$ROOT/scripts/setup-compatibility-tests.sh"
3535
else
36-
"$ROOT/scripts/setup-compatibility-tests.sh" > /tmp/setup-compatibility-tests.log 2>&1
36+
"$ROOT/scripts/setup-compatibility-tests.sh" >/tmp/setup-compatibility-tests.log 2>&1
3737
fi
3838

3939
# Launch evmd node
4040
echo "Starting evmd node..."
4141
pushd "$ROOT" >/dev/null
4242
if [ "$VERBOSE" = true ]; then
43-
./local_node.sh -y &
43+
./local_node.sh -y &
4444
else
45-
./local_node.sh -y > /tmp/evmd.log 2>&1 &
45+
./local_node.sh -y >/tmp/evmd.log 2>&1 &
4646
fi
4747
NODE_PID=$!
4848
popd >/dev/null
4949

5050
# Cleanup function to kill the node on exit
5151
cleanup() {
52-
if [ -n "$NODE_PID" ]; then
53-
echo "Stopping evmd node..."
54-
kill "$NODE_PID" 2>/dev/null || true
55-
wait "$NODE_PID" 2>/dev/null || true
56-
fi
52+
if [ -n "$NODE_PID" ]; then
53+
echo "Stopping evmd node..."
54+
kill "$NODE_PID" 2>/dev/null || true
55+
wait "$NODE_PID" 2>/dev/null || true
56+
fi
5757
}
5858

5959
# Set trap to cleanup on exit
@@ -70,78 +70,79 @@ TIMEOUT=60
7070
ELAPSED=0
7171

7272
while [ $ELAPSED -lt $TIMEOUT ]; do
73-
# Get the block number from the RPC endpoint
74-
RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" \
75-
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
76-
"$RPC_URL" 2>/dev/null || true)
77-
78-
if [ -n "$RESPONSE" ]; then
79-
# Extract the hex block number from the JSON response
80-
BLOCK_HEX=$(echo "$RESPONSE" | grep -o '"result":"[^"]*"' | cut -d'"' -f4 || true)
81-
82-
if [ -n "$BLOCK_HEX" ] && [ "$BLOCK_HEX" != "null" ]; then
83-
# Convert hex to decimal (handle potential errors)
84-
if BLOCK_NUMBER=$((16#${BLOCK_HEX#0x} 2>/dev/null)); then
85-
if [ "$VERBOSE" = true ]; then
86-
echo "Current block number: $BLOCK_NUMBER (waiting for >= 5)"
87-
fi
88-
89-
# Check if block number is >= 5
90-
if [ "$BLOCK_NUMBER" -ge 5 ]; then
91-
echo "Node is ready! Block number: $BLOCK_NUMBER"
92-
break
93-
fi
94-
fi
95-
fi
96-
fi
97-
98-
if [ "$VERBOSE" = true ]; then
99-
echo "Waiting for node... ($ELAPSED/$TIMEOUT seconds)"
100-
fi
101-
102-
sleep 2
103-
ELAPSED=$((ELAPSED + 2))
73+
# Get the block number from the RPC endpoint
74+
RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" \
75+
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
76+
"$RPC_URL" 2>/dev/null || true)
77+
78+
if [ -n "$RESPONSE" ]; then
79+
# Extract the hex block number from the JSON response
80+
BLOCK_HEX=$(echo "$RESPONSE" | grep -o '"result":"[^"]*"' | cut -d'"' -f4 || true)
81+
82+
if [ -n "$BLOCK_HEX" ] && [ "$BLOCK_HEX" != "null" ]; then
83+
# Convert hex to decimal (handle potential errors)
84+
if BLOCK_NUMBER=$((16#${BLOCK_HEX#0x})); then
85+
if [ "$VERBOSE" = true ]; then
86+
echo "Current block number: $BLOCK_NUMBER (waiting for >= 5)"
87+
fi
88+
89+
# Check if block number is >= 5
90+
if [ "$BLOCK_NUMBER" -ge 5 ]; then
91+
echo "Node is ready! Block number: $BLOCK_NUMBER"
92+
break
93+
fi
94+
fi
95+
fi
96+
fi
97+
98+
if [ "$VERBOSE" = true ]; then
99+
echo "Waiting for node... ($ELAPSED/$TIMEOUT seconds)"
100+
fi
101+
102+
sleep 2
103+
ELAPSED=$((ELAPSED + 2))
104104
done
105105

106106
if [ $ELAPSED -ge $TIMEOUT ]; then
107-
echo "Error: Node failed to reach block 5 within $TIMEOUT seconds"
108-
if [ "$VERBOSE" = true ]; then
109-
echo "Last response: $RESPONSE"
110-
echo "Checking node logs:"
111-
tail -20 /tmp/evmd.log 2>/dev/null || echo "No evmd logs found"
112-
fi
113-
exit 1
107+
echo "Error: Node failed to reach block 5 within $TIMEOUT seconds"
108+
if [ "$VERBOSE" = true ]; then
109+
echo "Last response: $RESPONSE"
110+
echo "Checking node logs:"
111+
tail -20 /tmp/evmd.log 2>/dev/null || echo "No evmd logs found"
112+
fi
113+
exit 1
114114
fi
115115

116116
# Change to the test directory
117117
cd "$TEST_DIR"
118118

119119
# Source the environment file
120120
if [ -f ".env" ]; then
121-
echo "Sourcing .env file..."
122-
source .env
121+
echo "Sourcing .env file..."
122+
# shellcheck source=/dev/null
123+
source test.env
123124
else
124-
echo "Error: .env file not found in $TEST_DIR"
125-
exit 1
125+
echo "Error: .env file not found in $TEST_DIR"
126+
exit 1
126127
fi
127128

128129
# Verify required environment variables are set
129130
if [ -z "$CUSTOM_RPC" ] || [ -z "$CHAIN_ID" ] || [ -z "$LIBRARY_CONTRACT" ]; then
130-
echo "Error: Required environment variables not set"
131-
echo "CUSTOM_RPC: $CUSTOM_RPC"
132-
echo "CHAIN_ID: $CHAIN_ID"
133-
echo "LIBRARY_CONTRACT: $LIBRARY_CONTRACT"
134-
exit 1
131+
echo "Error: Required environment variables not set"
132+
echo "CUSTOM_RPC: $CUSTOM_RPC"
133+
echo "CHAIN_ID: $CHAIN_ID"
134+
echo "LIBRARY_CONTRACT: $LIBRARY_CONTRACT"
135+
exit 1
135136
fi
136137

137138
echo "Running foundry-uniswap-v3 deployment scripts..."
138139

139140
# Deploy NFTDescriptor
140141
echo "Deploying NFTDescriptor..."
141142
forge script script/DeployNFTDescriptor.s.sol:DeployNFTDescriptor \
142-
--rpc-url "$CUSTOM_RPC" \
143-
--broadcast \
144-
--chain-id "$CHAIN_ID"
143+
--rpc-url "$CUSTOM_RPC" \
144+
--broadcast \
145+
--chain-id "$CHAIN_ID"
145146

146147
# Take a rest to ensure the deployment is complete
147148
echo "Waiting for NFTDescriptor deployment to complete..."
@@ -150,11 +151,11 @@ sleep 5
150151
# Deploy UniswapV3 with NFTDescriptor library
151152
echo "Deploying UniswapV3..."
152153
forge script script/DeployUniswapV3.s.sol:DeployUniswapV3 \
153-
--rpc-url "$CUSTOM_RPC" \
154-
--chain-id "$CHAIN_ID" \
155-
--broadcast \
156-
--slow \
157-
--private-key "$PRIVATE_KEY" \
158-
--libraries "lib/v3-periphery/contracts/libraries/NFTDescriptor.sol:NFTDescriptor:$LIBRARY_CONTRACT"
159-
160-
echo "foundry-uniswap-v3 tests completed successfully!"
154+
--rpc-url "$CUSTOM_RPC" \
155+
--chain-id "$CHAIN_ID" \
156+
--broadcast \
157+
--slow \
158+
--private-key "$PRIVATE_KEY" \
159+
--libraries "lib/v3-periphery/contracts/libraries/NFTDescriptor.sol:NFTDescriptor:$LIBRARY_CONTRACT"
160+
161+
echo "foundry-uniswap-v3 tests completed successfully!"

0 commit comments

Comments
 (0)