Skip to content

[Interim] Support to validate solana destination addresses + unit testing of key functions#9

Merged
zeuslawyer merged 7 commits intomainfrom
zp-svm
Aug 5, 2025
Merged

[Interim] Support to validate solana destination addresses + unit testing of key functions#9
zeuslawyer merged 7 commits intomainfrom
zp-svm

Conversation

@zeuslawyer
Copy link
Collaborator

** For SAFE JSON applyChainUpdate calldata generation **

Right now the script validates that remotePoolAddresses and remoteTokenAddress are EVM-compatible addresses by abi-encoding them.

This change adds other for validating user-supplied Solana addresses for the same outcome.

@zeuslawyer zeuslawyer requested a review from andrejrakic August 2, 2025 00:34
@andrejrakic andrejrakic requested a review from Copilot August 2, 2025 15:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ChainType enum 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

Copy link
Collaborator

@andrejrakic andrejrakic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@zeuslawyer zeuslawyer marked this pull request as ready for review August 5, 2025 03:31
@zeuslawyer zeuslawyer requested a review from andrejrakic August 5, 2025 03:31
Copy link
Collaborator

@andrejrakic andrejrakic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@zeuslawyer zeuslawyer merged commit 93fd8d6 into main Aug 5, 2025
2 checks passed
@zeuslawyer zeuslawyer deleted the zp-svm branch August 5, 2025 16:29
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.

3 participants