Skip to content

feat: Tron testnet support with prover updates and quote validation#25

Open
nknavkal wants to merge 26 commits into
mainfrom
feat/tron_testnet
Open

feat: Tron testnet support with prover updates and quote validation#25
nknavkal wants to merge 26 commits into
mainfrom
feat/tron_testnet

Conversation

@nknavkal

Copy link
Copy Markdown
Contributor

Summary

Brings the feat/tron_testnet work onto the latest main, adding Tron testnet (Shasta) support along with prover/portal address corrections, multi-prover selection, and quote-safety validation.

Key changes

  • Chain configs: corrected prod & testnet portal/prover addresses (Base, Tron mainnet, Tron Shasta, Base Sepolia); EIP-55 checksum fixes; removed zero-address LayerZero placeholders; added Solana portal/prover.
  • Multi-prover support: destination-aware prover selection, auto-select when only one type is common, --prover-type flag validated against both source and dest chains.
  • Quote validation: validateQuoteRouteAmount rejects solver quote/encoded-route amount mismatches before publish (would otherwise revert on-chain).
  • TVM address normalization: use length check instead of 0x41 prefix when denormalizing, avoiding misfires on 20-byte bodies starting with 41.
  • Config: drop hardcoded TVM/SVM RPC fallbacks; require explicit config.
  • Misc: surface result.error on publish failure; improved quote catch block; merge of latest main.

Notes

Merge conflicts in chains.config.ts were resolved in favor of this branch's corrected addresses (main carried the pre-fix baseline from squashed PR #17). Typecheck passes.

🤖 Generated with Claude Code

nknavkal and others added 26 commits March 31, 2026 20:27
…ken flows

- Replace `proverAddress` on ChainConfig with `provers` map (prover type name -> address)
- EVM testnets now have Hyperlane and LayerZero entries; TVM chains have LayerZero
- Add selectProver() helper that intersects source/dest prover keys and presents a
  named list; falls back to free-text prompt when no intersection exists
- Guard quote fetch and reward/route token amount prompts behind null token checks
- Support "None (no tokens)" selection in selectToken(), returning null

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…coding

- Add LayerZero prover and portal addresses for mainnet EVM chains (ETH, OP, Base, Arbitrum, Polygon) and TVM chains (Tron, Shasta)
- Update Base Sepolia portal and LayerZero prover addresses to latest deployments
- Fix TVM address normalization to store 20-byte EVM-compatible payload (strip 0x41 prefix)
- Fix denormalization to always prepend 0x41 prefix when converting back to Tron hex
- Support no-token flows in TVM publisher by skipping approval when reward.tokens is empty
- Fix PortalHashUtils.getIntentHashFromReward argument order (source, destination)
- Add destination portal prompt/config lookup; use dest portal in route instead of source portal
- Fix chain ID parsing to guard against non-numeric strings before BigInt conversion
- Fix encode call to use denormalizeToEvm for ERC20 transfer recipient

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Migrated multi-prover (provers dict) and no-token flow changes to new arch
- Ported TVM address encoding fix and getIntentHashFromReward arg order fix
- Updated chains.config with LZ prover/portal addresses for all EVM + TVM chains
- Fixed USDT Shasta token address
- Fixed SOLVER_URL trailing slash normalization
- Downgraded ora and inquirer to CJS-compatible versions (v5/v8)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add portal + LayerZero prover addresses for all mainnet EVM chains (ETH, OP, Base, Arbitrum, Polygon) and TVM chains (Tron, Shasta)
- Update Base Sepolia portal and LayerZero prover addresses to latest deployments
- Switch chains.config to multi-prover dict (provers: Record<string, string>)
- Fix TVM address normalization: strip 0x41 prefix on normalize, restore on denormalize
- Support no-token flows in TVM publisher (skip approval when reward.tokens is empty)
- Fix PortalHashUtils.getIntentHashFromReward arg order (source, destination)
- Add destination portal prompt/config lookup; route.portal uses dest portal
- Fix chain ID parsing to guard non-numeric strings before BigInt conversion
- Fix ERC20 transfer recipient encoding to use denormalizeToEvm
- Fix USDT Shasta token address

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace proverAddress with provers dict in SOURCE_CHAIN fixture
- Lower statements threshold from 20% to 19% to account for new source files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Resolve conflict in publish.command.ts by adopting main's IntentPublishFlow
refactor, then wire in the LZ prover support from this branch:
- resolveProver now calls prompt.selectProver(source, dest) to use the
  provers dict intersection instead of the removed proverAddress field
- fetchQuoteOrManualRoute accepts nullable tokens (selectToken can return
  null when user picks "None") and handles that path explicitly
- Test fixture updated: proverAddress → provers dict, selectProver mock added

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Optimism Sepolia, Plasma Testnet, and Sepolia had LayerZero provers set
to the zero address with a TODO marker. selectProver offered them as
valid options, which would publish an intent that can never be proven.
Removing them so the option simply doesn't appear until real addresses land.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds PROVER_TYPES const and ProverType union ('LayerZero' | 'Hyperlane')
to chain-config.ts and tightens provers to Partial<Record<ProverType, ...>>
in both RawChainConfig and ChainConfig. A typo like 'Layerzero' is now a
compile error rather than a silent empty intersection at runtime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The unconditional '41' + unpadded.substring(2) prepend corrupts any
UniversalAddress stored in the old 21-byte format (0x41<20-byte>),
producing '4141<20-byte>' — an invalid Tron hex address. Restoring the
prefix check makes both old- and new-format universals round-trip correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When source and destination chains share no prover type, selectProver
silently dropped into a free-text prompt with no context. The user had
no way to tell whether the route was unsupported or their config was wrong.
Now logs the prover keys on each chain so the user can make an informed
decision before entering an address manually.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
resolveProver now skips the interactive list when source and destination
share exactly one prover type (the common mainnet case today with only
LayerZero configured). Also adds a --prover-type <name> CLI option so
headless/scripted callers can select by name without knowing the address.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The 'None (no tokens)' option bundled zero-reward intents that are
unfulfillable on EVM (no solver incentive), blocked on TVM by
TvmPublisher.validate(), and blocked on SVM. No callers, no tests,
no justification. Removed from selectToken, buildReward (rewardToken
is now required), and fetchQuoteOrManualRoute.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The bare catch swallowed RoutesCliError (e.g. from normalizing a bad
quote.prover address) and dumped raw errors via console.error, which
can include funder/recipient from JSON.stringify'd responses. Now:
- RoutesCliError propagates instead of being reported as 'unavailable'
- display.warn shows the error message through the structured display service

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Before each waitForTransactionReceipt call, log the submitted tx hash so
users can find the pending tx on the explorer if the wait times out. On
timeout (WaitForTransactionReceiptTimeoutError), throw a clear message
warning against double-submit rather than letting it surface as a generic
BasePublisher error with no hash context.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The threshold was lowered from 20 to 19 to accommodate new untested code.
Restoring it now that the no-token path (the main untested addition) has
been removed and the remaining new behaviors are covered by existing tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous check only confirmed the source chain had the prover type
configured. A route where the destination only supports Hyperlane while
the caller passes --prover-type LayerZero would publish an intent that
can never be proven. Now both sides are checked, mirroring the symmetric
intersection the auto-select and selectProver paths already perform.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0x9523b6c0caac8122dbd5dd1c1d336ceba637038d was stored in lowercase
across all four testnet entries. Corrected to the EIP-55 checksummed
form 0x9523b6c0cAaC8122DbD5Dd1c1d336CEBA637038D.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…chars)

The UniversalAddress fixture was one hex character short after 0x.
The as unknown as UniversalAddress cast hid the mismatch from the type
system but the fixture was technically malformed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ormalization

- Add validateQuoteRouteAmount to catch solver quote/route amount mismatches
  before publish (would otherwise revert on-chain)
- Update prod portal/prover addresses for Base, Tron; add Solana portal/prover
- Use length check (not 0x41 prefix) when denormalizing TVM addresses to avoid
  misfiring on 20-byte bodies starting with 41
- Surface result.error in publish failure message
- Drop hardcoded TVM/SVM RPC fallbacks; require explicit config

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts:
#	src/blockchain/chains.config.ts
#	src/blockchain/utils/address-normalizer.ts
#	src/cli/services/intent-publish-flow.service.ts
@github-actions github-actions Bot requested a review from fernandofcampos June 19, 2026 16:43
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