Skip to content

feat(e2e): Token Lane Refactor#763

Open
rodrigombsoares wants to merge 13 commits into
mainfrom
pr2-token-lane
Open

feat(e2e): Token Lane Refactor#763
rodrigombsoares wants to merge 13 commits into
mainfrom
pr2-token-lane

Conversation

@rodrigombsoares

@rodrigombsoares rodrigombsoares commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Second stacked PR in the token-lane refactor (pr2-token-lane on top of pr1-load-metrics). Centralizes token pool config in TokenLane, adds env-scoped TOML, supports Canton fixed-point amounts and optional transfer instruments, and updates SetupSend / MintTokens to 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 + SetSequentialSends correctly pick initial holdings for multi-send batches so rotation can advance send 2+.

Features

Constants & env

  • ccip/devenv/constants.go — Shared constants moved out of tests/constants.go:
    • CantonToEVMFeeAmount = 50 (message-only)
    • CantonToEVMTokenTransferFeeAmount = 130 (token path)
    • CantonFixedPointScale (10¹⁰) and CantonFixedPointToEVMScale (10⁸), replacing EVMDecimalsScale
  • ccip/devenv/tests/env.go — Minimal CCIPEnv API: EnvDevenv, EnvProdTestnet, ParseCCIPEnv, IsRemote()

Token lane

  • token_transfer_config.toml — Flat [evm_to_canton] / [canton_to_evm] → nested [devenv.*] and [prod-testnet.*] skeleton
  • token_lane.goResolveTokenLane(t, env, …) with env-scoped TOML, TransferInstrument / TransferInstrumentID, Canton instrument resolution from datastore labels
  • token_lane_test.go — Unit tests for env selection, TOML parsing, scale conversion, instrument helpers

Core impl

  • impl.go — Token hunks only:
    • SetupSend(ctx, feePerMessage, transferPerMessage *big.Rat, optional instrument) — per-send amounts; callers pass 1× values
    • SetSequentialSends + batch-aware initial holding selection — call SetSequentialSends(N) before SetupSend when running N sends in a batch. Setup multiplies fee/transfer holding mins by sendsLeft (perMessage × N) so the first UTXO can split across sends; stored feePerMessage and 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 rotation
    • selectHolding logging at setup/rotate (Source, Candidates, MinRequired) for holding-debug
    • MintTokens(ctx, *big.Rat) with nil/zero guard
    • Fixed-point SendMessage via CantonFixedPointScale
    • FTF BlockDepth: 1 on token pool configs
    • setNextHoldings nil/exhaustion semantics with *big.Rat; skip rotation after last planned send in batch
    • LINKInstrument constant
  • manual_execution.go — Idempotent DeployCCIPSender (CANTON_SENDER_INSTANCE_ID, default e2e-ccipsender)
  • deployment/sequences/token_pools.go — Copy Labels from deploy input onto token ref in datastore (required for ResolveTokenLane instrument resolution)

Tests

  • E2E and load tests use ResolveTokenLane(t, EnvDevenv, …) and cantondevenv.* constants
  • Token e2e/load: SetSequentialSends(N) before SetupSend; per-send transferPerMessage only (no batch totals in callers)
  • Inline devenv bootstrap kept (no BootstrapE2E yet — PR3)
  • setupCantonTokenLoadHoldings updated for token transfer fee, fixed-point minting, and optional TransferInstrument

Removed

  • ccip/devenv/tests/constants.go — Superseded by ccip/devenv/constants.go

Testing

On CI:

  1. Check e2e tests already run by CI here
  2. Use github action to run load tests pointing to this branch https://github.com/smartcontractkit/chainlink-canton/actions/workflows/ccip-load-tests.yml
image example run: https://github.com/smartcontractkit/chainlink-canton/actions/runs/28914300723/job/85777914380

With local devenv running:

  1. make start-devenv
  2. Token e2e — Run token subtests in both directions (canton2evm, evm2canton); Canton→EVM token subtest sends 2 messages sequentially
  3. Token loadmake run-canton2evm-token-load and make run-evm2canton-token-load
  4. Compile / unit — e.g. go test ./ccip/devenv/... and token_lane unit tests

@rodrigombsoares rodrigombsoares requested a review from a team as a code owner July 7, 2026 20:16
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

👋 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!

@rodrigombsoares rodrigombsoares changed the base branch from main to pr1-load-metrics July 7, 2026 20:16
@rodrigombsoares rodrigombsoares force-pushed the pr2-token-lane branch 3 times, most recently from e864bf3 to 2bba87f Compare July 8, 2026 00:30
Base automatically changed from pr1-load-metrics to main July 8, 2026 02:40
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.

1 participant