feat(sdk): add pre-send destination-liquidity preflight that mandatorily simulates the destination pool's releaseOrMint for token transfers#301
Open
aelmanaa wants to merge 1 commit into
Conversation
…ily simulates the destination pool's releaseOrMint for token transfers, blocks on any revert with one typed error carrying the raw revert, and ships exhaustive native pool-error ABI coverage
|
You must have Developer access to commit code to Chainlink Labs on Vercel. If you contact an administrator and receive Developer access, commit again to see your changes. Learn more: https://vercel.com/docs/accounts/team-members-and-roles/access-roles#team-level-roles |
andrevmatos
reviewed
Jul 16, 2026
| * ERC165 interface id of v1 pools: `Pool.CCIP_POOL_V1 = bytes4(keccak256("CCIP_POOL_V1"))` | ||
| * (1-arg `releaseOrMint`/`lockOrBurn`; v1.5.0 through v1.6.x, incl. the oUSDT pools). | ||
| */ | ||
| export const CCIP_POOL_V1_INTERFACE_ID = '0xaff2afbf' |
Collaborator
There was a problem hiding this comment.
Prefer code as doc:
Suggested change
| export const CCIP_POOL_V1_INTERFACE_ID = '0xaff2afbf' | |
| export const CCIP_POOL_V1_INTERFACE_ID = id('CCIP_POOL_V1').substring(0, 10) as '0xaff2afbf' |
Collaborator
There was a problem hiding this comment.
I don't think you need a fork.test for these; fork tests are mostly for read-write tests; your simulations here are read-only, a plain integration test would do
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant improvements to the gas estimation documentation and SDK, particularly around pre-send validation and error handling for CCIP transfers. The main focus is on clarifying and enhancing how
estimateReceiveExecutionnot only estimates gas but also validates transfer executability on the destination chain, helping developers avoid stuck transfers. Additionally, new error types and lower-level simulation primitives are documented and implemented, and the guides are reorganized to highlight these features.Documentation and Guide Improvements:
pre-send-validation.mdx, detailing howestimateReceiveExecutionvalidates that a transfer can execute on the destination chain before sending, including error handling and lower-level simulation primitives.gas-estimation.mdxto clarify that on EVM chains,estimateReceiveExecutionsimulatesccipReceiveand returns gas units, while on Solana it estimates compute units; also documented that the method validates executability and throws errors if the transfer would be stuck. [1] [2]gas-estimation.mdxfor consistency and clarity, including error and method reference tables. [1] [2] [3]SDK and Error Handling Enhancements:
CCIPDestExecutionRevertErrorandCCIPDestSimulationUnavailableError, improving error reporting when a transfer would fail on the destination. [1] [2]Chainclass with a newsimulateLockOrBurnmethod, allowing simulation of source pool logic to obtain accurate data for destination pool validation.