feat(e2e): Token Lane Refactor#763
Open
rodrigombsoares wants to merge 13 commits into
Open
Conversation
|
👋 rodrigombsoares, 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! |
e864bf3 to
2bba87f
Compare
2bba87f to
a0b7f76
Compare
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.
Summary
Second stacked PR in the token-lane refactor (
pr2-token-laneon top ofpr1-load-metrics). Centralizes token pool config inTokenLane, adds env-scoped TOML, supports Canton fixed-point amounts and optional transfer instruments, and updatesSetupSend/MintTokensto use*big.Rat.Devenv-only paths are exercised;
[prod-testnet.*]TOML blocks exist but stay inert until PR4.Reviewer story: Token tests resolve lanes from TOML instead of ad-hoc setup; Canton token sends support multiple instruments via fixed-point amounts.
SetupSend+SetSequentialSendscorrectly pick initial holdings for multi-send batches so rotation can advance send 2+.Features
Constants & env
ccip/devenv/constants.go— Shared constants moved out oftests/constants.go:CantonToEVMFeeAmount = 50(message-only)CantonToEVMTokenTransferFeeAmount = 130(token path)CantonFixedPointScale(10¹⁰) andCantonFixedPointToEVMScale(10⁸), replacingEVMDecimalsScaleccip/devenv/tests/env.go— MinimalCCIPEnvAPI:EnvDevenv,EnvProdTestnet,ParseCCIPEnv,IsRemote()Token lane
token_transfer_config.toml— Flat[evm_to_canton]/[canton_to_evm]→ nested[devenv.*]and[prod-testnet.*]skeletontoken_lane.go—ResolveTokenLane(t, env, …)with env-scoped TOML,TransferInstrument/TransferInstrumentID, Canton instrument resolution from datastore labelstoken_lane_test.go— Unit tests for env selection, TOML parsing, scale conversion, instrument helpersCore impl
impl.go— Token hunks only:SetupSend(ctx, feePerMessage, transferPerMessage *big.Rat, optional instrument)— per-send amounts; callers pass 1× valuesSetSequentialSends+ batch-aware initial holding selection — callSetSequentialSends(N)beforeSetupSendwhen running N sends in a batch. Setup multiplies fee/transfer holding mins bysendsLeft(perMessage × N) so the first UTXO can split across sends; storedfeePerMessageand rotation mins stay per-send (1×). Fixes Canton→EVM 2-send e2e failing on send 2 when setup picked a dust UTXO (exact 1× transfer) with no change Created for rotationselectHoldinglogging at setup/rotate (Source,Candidates,MinRequired) for holding-debugMintTokens(ctx, *big.Rat)with nil/zero guardSendMessageviaCantonFixedPointScaleBlockDepth: 1on token pool configssetNextHoldingsnil/exhaustion semantics with*big.Rat; skip rotation after last planned send in batchLINKInstrumentconstantmanual_execution.go— IdempotentDeployCCIPSender(CANTON_SENDER_INSTANCE_ID, defaulte2e-ccipsender)deployment/sequences/token_pools.go— CopyLabelsfrom deploy input onto token ref in datastore (required forResolveTokenLaneinstrument resolution)Tests
ResolveTokenLane(t, EnvDevenv, …)andcantondevenv.*constantsSetSequentialSends(N)beforeSetupSend; per-sendtransferPerMessageonly (no batch totals in callers)BootstrapE2Eyet — PR3)setupCantonTokenLoadHoldingsupdated for token transfer fee, fixed-point minting, and optionalTransferInstrumentRemoved
ccip/devenv/tests/constants.go— Superseded byccip/devenv/constants.goTesting
On CI:
With local devenv running:
make start-devenvcanton2evm,evm2canton); Canton→EVM token subtest sends 2 messages sequentiallymake run-canton2evm-token-loadandmake run-evm2canton-token-loadgo test ./ccip/devenv/...andtoken_laneunit tests