@@ -10,17 +10,17 @@ VERBOSE=false
10
10
11
11
# Parse command line arguments
12
12
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
24
24
done
25
25
26
26
ROOT=" $( git rev-parse --show-toplevel) "
@@ -31,29 +31,29 @@ echo "Setting up foundry-uniswap-v3 tests..."
31
31
# Setup dependencies and submodules
32
32
echo " Running setup-compatibility-tests.sh..."
33
33
if [ " $VERBOSE " = true ]; then
34
- " $ROOT /scripts/setup-compatibility-tests.sh"
34
+ " $ROOT /scripts/setup-compatibility-tests.sh"
35
35
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
37
37
fi
38
38
39
39
# Launch evmd node
40
40
echo " Starting evmd node..."
41
41
pushd " $ROOT " > /dev/null
42
42
if [ " $VERBOSE " = true ]; then
43
- ./local_node.sh -y &
43
+ ./local_node.sh -y &
44
44
else
45
- ./local_node.sh -y > /tmp/evmd.log 2>&1 &
45
+ ./local_node.sh -y > /tmp/evmd.log 2>&1 &
46
46
fi
47
47
NODE_PID=$!
48
48
popd > /dev/null
49
49
50
50
# Cleanup function to kill the node on exit
51
51
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
57
57
}
58
58
59
59
# Set trap to cleanup on exit
@@ -70,78 +70,79 @@ TIMEOUT=60
70
70
ELAPSED=0
71
71
72
72
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 ))
104
104
done
105
105
106
106
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
114
114
fi
115
115
116
116
# Change to the test directory
117
117
cd " $TEST_DIR "
118
118
119
119
# Source the environment file
120
120
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
123
124
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
126
127
fi
127
128
128
129
# Verify required environment variables are set
129
130
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
135
136
fi
136
137
137
138
echo " Running foundry-uniswap-v3 deployment scripts..."
138
139
139
140
# Deploy NFTDescriptor
140
141
echo " Deploying NFTDescriptor..."
141
142
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 "
145
146
146
147
# Take a rest to ensure the deployment is complete
147
148
echo " Waiting for NFTDescriptor deployment to complete..."
@@ -150,11 +151,11 @@ sleep 5
150
151
# Deploy UniswapV3 with NFTDescriptor library
151
152
echo " Deploying UniswapV3..."
152
153
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