fix(CCIP): increase timeout for cross-chain Aptos token transfer test#22221
fix(CCIP): increase timeout for cross-chain Aptos token transfer
test#22221
Conversation
Test_CCIP_TokenTransfer_BnM_Aptos2EVM flakes due to insufficient context timeout. Cross-chain finality requires sequential waits across heterogeneous blockchains: - ConfirmMultipleCommits (Aptos consensus) - ConfirmExecWithSeqNrsForAll (cross-chain attestation) - WaitForTokenBalances (token availability across chains) These operations can exceed Go's default context timeout since Aptos and EVM have different consensus finality times. Increase context timeout to 10 minutes to accommodate worst-case cross-chain finality latency. Fixes: CCIP-11174
|
👋 sebawo, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
|
✅ No conflicts with other open PRs targeting |
There was a problem hiding this comment.
Pull request overview
Risk Rating: LOW (test-only change), but currently introduces a compile error.
Increases the context timeout for the flaky cross-chain Aptos→EVM token transfer smoke test to reduce timeouts during slow finality/relay conditions.
Changes:
- Add
context/timeimports. - Wrap
t.Context()withcontext.WithTimeout(..., 10*time.Minute)anddefer cancel()inTest_CCIP_TokenTransfer_BnM_Aptos2EVM.
| // can exceed default context timeout. Allow up to 10 minutes for all confirmations. | ||
| rootCtx := t.Context() | ||
| var cancel context.CancelFunc | ||
| ctx, cancel = context.WithTimeout(rootCtx, 10*time.Minute) |
There was a problem hiding this comment.
ctx is no longer declared after removing ctx := t.Context(), but the new code uses assignment (ctx, cancel = ...). This won’t compile unless ctx is declared earlier in the function. Use a short declaration (ctx, cancel := context.WithTimeout(...)) or explicitly declare var ctx context.Context before assigning.
| ctx, cancel = context.WithTimeout(rootCtx, 10*time.Minute) | |
| ctx, cancel := context.WithTimeout(rootCtx, 10*time.Minute) |
Use short variable declaration (:=) instead of assignment (=) so ctx is properly declared in scope. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|





Summary
Fixes flaky test CCIP-11174:
Test_CCIP_TokenTransfer_BnM_Aptos2EVMProblem
The test is flaky due to insufficient context timeout for cross-chain finality. When transferring BnM tokens from Aptos to EVM, the
test performs sequential waits across heterogeneous blockchains:
Aptos and EVM have different consensus times and finality guarantees. The sequential nature of these operations can exceed Go's
default context timeout in slow/congested network conditions.
Solution
Increased context timeout from default to 10 minutes (
10*time.Minute).This conservative estimate accommodates:
The 10-minute window is safe for production environments while preventing test timeouts during normal operation.
Changes
contextandtimeimportscontext.WithTimeoutTesting
This fix enables the test to run reliably in CI/CD pipelines against testnet environments with variable network conditions.