Skip to content

Commit 36cc939

Browse files
add initial components
1 parent 388d31a commit 36cc939

File tree

18,396 files changed

+2474824
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

18,396 files changed

+2474824
-0
lines changed
Lines changed: 323 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,323 @@
1+
# End-to-End Testing Guide
2+
3+
This guide walks through testing the complete ICA-based forwarding flow from EVM Chain 1 → Celestia → EVM Chain 2.
4+
5+
## Prerequisites
6+
7+
1. Three-chain environment running (see `PHASE1_STATUS.md`)
8+
2. Hyperlane contracts deployed on all chains
9+
3. Warp routes configured
10+
4. ICA module integrated into Celestia
11+
12+
## Test Flow Overview
13+
14+
```
15+
┌─────────────────────────────────────────────────────────────────────┐
16+
│ E2E Test Flow │
17+
├─────────────────────────────────────────────────────────────────────┤
18+
│ │
19+
│ 1. Compute forwarding address off-chain │
20+
│ │ │
21+
│ ▼ │
22+
│ 2. Send tokens from EVM Chain 1 to forwarding address on Celestia │
23+
│ │ │
24+
│ ▼ │
25+
│ 3. (Automatic) Hyperlane relayer delivers message to Celestia │
26+
│ │ │
27+
│ ▼ │
28+
│ 4. Execute forwarding on Celestia (permissionless) │
29+
│ │ │
30+
│ ▼ │
31+
│ 5. (Automatic) Hyperlane relayer delivers to EVM Chain 2 │
32+
│ │ │
33+
│ ▼ │
34+
│ 6. Verify tokens received at destination on EVM Chain 2 │
35+
│ │
36+
└─────────────────────────────────────────────────────────────────────┘
37+
```
38+
39+
## Step 1: Compute Forwarding Address
40+
41+
### Using TypeScript SDK
42+
43+
```bash
44+
cd "ICA-based forwarding/sdk"
45+
npm install
46+
npm run build
47+
48+
# Parameters for the test
49+
TOKEN_ID="0x0000000000000000000000000000000000000000000000000000000000000001" # Warp token on Celestia
50+
DEST_DOMAIN="31338" # EVM Chain 2 domain
51+
DEST_RECIPIENT="0x000000000000000000000000f39Fd6e51aad88F6F4ce6aB8827279cffFb92266" # Recipient on Chain 2
52+
53+
# Compute the forwarding address
54+
npx ts-node src/cli/index.ts compute-address \
55+
--token-id $TOKEN_ID \
56+
--dest-domain $DEST_DOMAIN \
57+
--dest-recipient $DEST_RECIPIENT
58+
```
59+
60+
### Using Web UI
61+
62+
1. Start the local server:
63+
```bash
64+
cd "ICA-based forwarding/sdk/ui"
65+
python3 -m http.server 3000
66+
```
67+
68+
2. Open http://localhost:3000 in your browser
69+
70+
3. Enter the parameters:
71+
- Token ID: The warp token address on Celestia
72+
- Destination Domain: EVM Chain 2 domain ID
73+
- Destination Recipient: Final recipient address
74+
75+
4. Click "Compute Address" to get the forwarding address
76+
77+
## Step 2: Send Tokens to Forwarding Address
78+
79+
### From EVM Chain 1
80+
81+
Use the Hyperlane warp route to send tokens to the computed forwarding address:
82+
83+
```bash
84+
# Example using cast (Foundry)
85+
FORWARDING_ADDR="celestia1..." # Forwarding address from Step 1
86+
AMOUNT="1000000000000000000" # 1 token (18 decimals)
87+
88+
# Approve the warp route contract
89+
cast send $TOKEN_ADDRESS "approve(address,uint256)" $WARP_ROUTE $AMOUNT \
90+
--rpc-url http://localhost:8545 \
91+
--private-key $PRIVATE_KEY
92+
93+
# Transfer via warp route
94+
# The recipient should be the forwarding address (as bytes32)
95+
cast send $WARP_ROUTE "transferRemote(uint32,bytes32,uint256)" \
96+
69420 \ # Celestia domain
97+
$(cast --from-utf8 $FORWARDING_ADDR) \
98+
$AMOUNT \
99+
--rpc-url http://localhost:8545 \
100+
--private-key $PRIVATE_KEY
101+
```
102+
103+
### Alternative: Direct Synthetic Transfer
104+
105+
If you already have synthetic tokens on Celestia, you can send directly to the forwarding address:
106+
107+
```bash
108+
celestiad tx bank send $FROM_ADDR $FORWARDING_ADDR 1000000hyperlane/... \
109+
--from $KEY_NAME \
110+
--chain-id $CHAIN_ID \
111+
--node http://localhost:26657
112+
```
113+
114+
## Step 3: Verify Message Delivery
115+
116+
Monitor the Hyperlane relayer logs:
117+
118+
```bash
119+
docker logs relayer -f
120+
```
121+
122+
Look for:
123+
- Message dispatch on EVM Chain 1
124+
- Message delivery on Celestia
125+
126+
## Step 4: Execute Forwarding
127+
128+
Forwarding is permissionless - anyone can trigger it.
129+
130+
### Using Celestia CLI
131+
132+
```bash
133+
celestiad tx ica execute-forward \
134+
--ica-address $FORWARDING_ADDR \
135+
--token-id $TOKEN_ID \
136+
--dest-domain $DEST_DOMAIN \
137+
--dest-recipient $DEST_RECIPIENT \
138+
--from $KEY_NAME \
139+
--chain-id $CHAIN_ID \
140+
--node http://localhost:26657
141+
```
142+
143+
### Verify Balance Before Execution
144+
145+
```bash
146+
celestiad query bank balances $FORWARDING_ADDR \
147+
--node http://localhost:26657
148+
```
149+
150+
## Step 5: Verify Cross-Chain Delivery
151+
152+
Monitor the relayer for the second hop:
153+
154+
```bash
155+
docker logs relayer -f
156+
```
157+
158+
Look for:
159+
- Message dispatch on Celestia
160+
- Message delivery on EVM Chain 2
161+
162+
## Step 6: Verify Final Receipt
163+
164+
Check the recipient balance on EVM Chain 2:
165+
166+
```bash
167+
# Check synthetic token balance
168+
cast call $SYNTHETIC_TOKEN "balanceOf(address)" $DEST_RECIPIENT \
169+
--rpc-url http://localhost:9545
170+
```
171+
172+
## Automated Test Script
173+
174+
Create `test/e2e_forward.sh`:
175+
176+
```bash
177+
#!/bin/bash
178+
set -e
179+
180+
# Configuration
181+
EVM1_RPC="http://localhost:8545"
182+
CELESTIA_RPC="http://localhost:26657"
183+
EVM2_RPC="http://localhost:9545"
184+
185+
TOKEN_ID="0x0000000000000000000000000000000000000000000000000000000000000001"
186+
DEST_DOMAIN="31338"
187+
DEST_RECIPIENT="0x000000000000000000000000f39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
188+
189+
echo "=== ICA Forwarding E2E Test ==="
190+
191+
echo "Step 1: Computing forwarding address..."
192+
cd "ICA-based forwarding/sdk"
193+
FORWARD_ADDR=$(npx ts-node src/cli/index.ts compute-address \
194+
--token-id $TOKEN_ID \
195+
--dest-domain $DEST_DOMAIN \
196+
--dest-recipient $DEST_RECIPIENT \
197+
--json | jq -r '.address')
198+
echo "Forwarding address: $FORWARD_ADDR"
199+
200+
echo "Step 2: Sending tokens to forwarding address..."
201+
# (Add warp route transfer command here)
202+
203+
echo "Step 3: Waiting for message delivery (30s)..."
204+
sleep 30
205+
206+
echo "Step 4: Checking balance at forwarding address..."
207+
# celestiad query bank balances $FORWARD_ADDR
208+
209+
echo "Step 5: Executing forwarding..."
210+
# celestiad tx ica execute-forward ...
211+
212+
echo "Step 6: Waiting for final delivery (30s)..."
213+
sleep 30
214+
215+
echo "Step 7: Verifying final balance..."
216+
# cast call $SYNTHETIC_TOKEN "balanceOf(address)" $DEST_RECIPIENT
217+
218+
echo "=== Test Complete ==="
219+
```
220+
221+
## Troubleshooting
222+
223+
### Message Not Delivered
224+
225+
1. Check relayer logs:
226+
```bash
227+
docker logs relayer
228+
```
229+
230+
2. Verify ISM is configured correctly:
231+
```bash
232+
# On EVM Chain 1
233+
cast call $MAILBOX "defaultIsm()"
234+
235+
# On Celestia
236+
celestiad query hyperlane mailbox
237+
```
238+
239+
### Forwarding Fails
240+
241+
1. Check balance at forwarding address:
242+
```bash
243+
celestiad query bank balances $FORWARD_ADDR
244+
```
245+
246+
2. Verify address derivation matches:
247+
- Compare TypeScript SDK output
248+
- Compare Celestia module output
249+
250+
### Cross-Chain Gas Issues
251+
252+
Ensure sufficient gas payment:
253+
```bash
254+
# Check IGP balance
255+
cast call $IGP "balanceOf(address)" $SENDER
256+
```
257+
258+
## Test Vectors
259+
260+
Use these known test vectors to verify address derivation consistency:
261+
262+
### Test Vector 1: All Zeros
263+
```
264+
tokenId: 0x0000000000000000000000000000000000000000000000000000000000000000
265+
destDomain: 0
266+
destRecipient: 0x0000000000000000000000000000000000000000000000000000000000000000
267+
268+
Expected Salt: 0x... (compute and document)
269+
Expected Addr: celestia1... (compute and document)
270+
```
271+
272+
### Test Vector 2: Specific Values
273+
```
274+
tokenId: 0x0000000000000000000000000000000000000000000000000000000000000001
275+
destDomain: 31337
276+
destRecipient: 0x000000000000000000000000f39Fd6e51aad88F6F4ce6aB8827279cffFb92266
277+
278+
Expected Salt: 0x... (compute and document)
279+
Expected Addr: celestia1... (compute and document)
280+
```
281+
282+
## Success Criteria
283+
284+
- [ ] Forwarding address computed identically across all implementations
285+
- [ ] Tokens successfully bridged to forwarding address on Celestia
286+
- [ ] Forwarding executed successfully
287+
- [ ] Tokens received at final destination on EVM Chain 2
288+
- [ ] Total latency < 5 minutes
289+
- [ ] No fund loss in any scenario
290+
291+
## Security Tests
292+
293+
### 1. Redirection Attempt (Should Fail)
294+
295+
Try to forward to a different destination:
296+
```bash
297+
celestiad tx ica execute-forward \
298+
--ica-address $FORWARD_ADDR \
299+
--token-id $TOKEN_ID \
300+
--dest-domain 99999 \ # Wrong domain
301+
--dest-recipient $WRONG_RECIPIENT \
302+
--from $KEY_NAME
303+
```
304+
305+
Expected: Transaction should fail with "address mismatch" error.
306+
307+
### 2. Double Execution (Should Handle Gracefully)
308+
309+
Execute forwarding twice:
310+
```bash
311+
# First execution
312+
celestiad tx ica execute-forward ...
313+
314+
# Second execution
315+
celestiad tx ica execute-forward ...
316+
```
317+
318+
Expected: Second execution should fail gracefully (no funds to forward).
319+
320+
---
321+
322+
**Last Updated**: December 2024
323+

0 commit comments

Comments
 (0)