Skip to content

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
mainfrom
evm-dest-simulate-pool
Open

feat(sdk): add pre-send destination-liquidity preflight that mandatorily simulates the destination pool's releaseOrMint for token transfers#301
aelmanaa wants to merge 1 commit into
mainfrom
evm-dest-simulate-pool

Conversation

@aelmanaa

@aelmanaa aelmanaa commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

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 estimateReceiveExecution not 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:

  • Added a new guide, pre-send-validation.mdx, detailing how estimateReceiveExecution validates that a transfer can execute on the destination chain before sending, including error handling and lower-level simulation primitives.
  • Updated gas-estimation.mdx to clarify that on EVM chains, estimateReceiveExecution simulates ccipReceive and 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]
  • Improved tables and descriptions in gas-estimation.mdx for consistency and clarity, including error and method reference tables. [1] [2] [3]
  • Added the new "Pre-Send Validation" guide to the SDK sidebar for better discoverability.

SDK and Error Handling Enhancements:

  • Introduced new error codes and exports for destination pool preflight checks: CCIPDestExecutionRevertError and CCIPDestSimulationUnavailableError, improving error reporting when a transfer would fail on the destination. [1] [2]
  • Extended the Chain class with a new simulateLockOrBurn method, allowing simulation of source pool logic to obtain accurate data for destination pool validation.
  • Updated the validation logic in the SDK to allow more flexible message input and removed redundant liquidity checks from the chain-level preflight, as these are now handled by destination simulation. [1] [2] [3]

…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
@aelmanaa
aelmanaa requested review from a team and PabloMansanet as code owners July 15, 2026 19:23
@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

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

@aelmanaa
aelmanaa requested a review from andrevmatos July 16, 2026 08:32
* 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'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants