Repository navigation
feat(cct-sdk): Add simulateEVMTx for CCT writes - #511
Conversation
|
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 |
|
👋 apedrob, 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! |
CI Test Report✅ 4392/4392 tests passed (1097 suites) in 5m 55s SummaryCoverage report |
andrevmatos
left a comment
There was a problem hiding this comment.
LGTM, approving. The result shape is clean: a revert gives success: false, a bare revert gives 0x, and a transport error throws, so it never looks like a revert. Rejecting a missing from before the RPC is the right call. The every-vendored-error guard test is a good idea. Typecheck, lint, and the CCT unit tests pass on 395a9320. One cross-PR note inline.
| * (`InvalidLockBoxToken`, `CanOnlySelfRegister`, `RequiredRoleNotFound`, ...). Every other | ||
| * vendored CCT error decodes through core; `simulate.test.ts` checks each one. | ||
| */ | ||
| const CCT_ERROR_INTERFACES: readonly Interface[] = [ |
There was a problem hiding this comment.
Heads-up on merge order with #505/#506: I test-merged this PR onto #506, and the guard test fails (V1_6_2/usdc-token-pool.ts: InvalidDomain). Neither core nor this list knows 19 errors in the 1.6.2/1.6.5 USDC ABIs: InvalidDomain, InvalidMessageLength, InvalidMessageVersion, InvalidTransmitterInProxy, InvalidSourcePoolDataLength, InvalidPreviousPool, plus the CCTPV2 ones (InvalidBurnToken, InvalidDepositHash, InvalidMinFee, InvalidMinFinalityThreshold, InvalidExecutionFinalityThreshold). The 1.5.1/2.0.0 USDC ABIs and BurnToAddress decode fine. Git sees only a CHANGELOG conflict, so the second PR to land needs one of these:
- add the legacy USDC interfaces here, which also gives feat(cct-sdk): Read USDC pools in getTokenPoolState #506's
USDC_TOKEN_POOL_ABISa real consumer; or - scope the guard test, and accept
errorName: nullfor those reverts.
What
simulateEVMTx(chain, unsigned, { from? }), which runs a built CCT tx witheth_calland returns{ success: true }or{ success: false, errorName, errorArgs, revertData }Why
Testing
Notes
fromoverrides the tx's own, so calldata built withoutsender(multisig) can be simulated against the signer; RPC failures throw instead of returningsuccess: false