[Interim] Support to validate solana destination addresses + unit testing of key functions#9
[Interim] Support to validate solana destination addresses + unit testing of key functions#9zeuslawyer merged 7 commits intomainfrom
Conversation
…(remote) addressess. Add unit tests.
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for validating Solana (SVM) destination addresses in addition to existing EVM address validation for cross-chain token pool operations. The change enables the script to generate SAFE JSON applyChainUpdate calldata for multiple blockchain architectures.
Key changes:
- Added
ChainTypeenum to differentiate between EVM, SVM, and MVM chain types - Enhanced address validation logic to handle Solana public keys using base58 encoding
- Added unit tests for two key logic functions covering all chain types and error scenarios
Reviewed Changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/chainUpdate.ts | Adds ChainType enum and remoteChainType field to schema |
| src/generators/chainUpdateCalldata.ts | Implements multi-chain address validation and encoding logic |
| src/test/unit.test.ts | unit tests for two key functions |
| package.json | Adds Jest testing framework and Solana web3.js dependency |
| jest.config.ts | Jest configuration for TypeScript testing |
| examples/chain-update.json | Updates example to include remoteChainType field |
| README.md | Documents new multi-chain support and address formats |
There was a problem hiding this comment.
Copilot suggested error message should be thrown as an Error object rather than a string in two places, please fix that.
There are two other comments that are irrelevant, will resolve them.
I've also added a couple of comments to most critical part of this PR, no mandatory changes required (code works, but it can be improved). Thanks
** For SAFE JSON
applyChainUpdatecalldata generation **Right now the script validates that
remotePoolAddressesandremoteTokenAddressare EVM-compatible addresses by abi-encoding them.This change adds other for validating user-supplied Solana addresses for the same outcome.