-
Notifications
You must be signed in to change notification settings - Fork 29
fix: update solana cli for latest programs #1079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fix: add decimal handling to its token deployments and trasnfer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
This PR updates the Solana CLI to work with the current version of Solana programs. The changes involve several key areas:Configuration and Naming Standardization: The most prominent change is renaming the chain_id
field to chain
throughout the codebase. This affects the Config struct, CLI parameters, and all references across multiple files including main.rs
, config.rs
, gateway.rs
, deploy.rs
, its.rs
, governance.rs
, gas_service.rs
, and utils.rs
. The CLI parameter description changes from 'Axelar chainId' to 'Axelar chain', indicating a shift from ID-based to name-based chain identification.
CLI Command Updates: The documentation files show significant changes to command syntax. The --chain-id
parameter has been removed from most commands in the GMP deployment documentation, while the ITS documentation now requires --chain-id $CHAIN
for initialization. A new --signer-keys
parameter has been added to gas service initialization commands.
ITS Module Enhancements: The ITS module receives substantial updates including changing initial_supply
from u64
to f64
for human-readable input, adding optional authority parameters for better role-based access control, implementing a new get_token_decimals
function that handles both Token-2022 and standard SPL tokens, and adding amount conversion logic with overflow protection.
Gateway Module Updates: The gateway module is updated to work with newer program interfaces, including changes to payload hashing (removing the signer_set
parameter), updating PDA generation to include both payload and verifier set merkle roots, changing the ITS instruction builder method name, and adding fee payer parameters.
Configuration Cleanup: The devnet-amplifier configuration removes the entire 'solana-5' chain configuration while keeping 'solana-2', consolidating on a single Solana environment setup.
These changes reflect API evolution in the underlying Solana programs, improved user experience through human-readable inputs, and better security through explicit authority specifications.
Important Files Changed
Changed Files
Filename | Score | Overview |
---|---|---|
solana/src/config.rs |
5/5 | Renames chain_id field to chain in Config struct for naming consistency |
solana/src/main.rs |
5/5 | Updates CLI parameter from chain_id to chain with description changes |
solana/src/governance.rs |
5/5 | Fixes field reference from config.chain_id to config.chain |
solana/src/deploy.rs |
5/5 | Updates variable reference from config.chain_id to config.chain |
solana/src/gas_service.rs |
5/5 | Corrects config field access from config.chain_id to config.chain |
solana/src/utils.rs |
5/5 | Renames function parameters from chain_id to chain for consistency |
solana/src/its.rs |
4/5 | Major updates including f64 amounts, authority params, token decimals handling |
solana/src/gateway.rs |
4/5 | Updates for newer program interfaces with payload hashing and PDA changes |
releases/solana/2025-09-GMP-vanilla.md |
5/5 | Removes --chain-id parameter from CLI commands and adds --signer-keys |
releases/solana/2025-09-ITS-vanilla.md |
5/5 | Adds --chain-id $CHAIN requirement to ITS init commands |
axelar-chains-config/info/devnet-amplifier.json |
4/5 | Removes solana-5 chain configuration, consolidates on solana-2 |
Confidence score: 4/5
- This PR is generally safe to merge with careful attention to testing the updated CLI commands
- Score reflects comprehensive but breaking changes to CLI interfaces that require validation
- Pay close attention to ITS and gateway modules which have significant API changes
Sequence Diagram
sequenceDiagram
participant User
participant CLI
participant Config
participant Gateway
participant GasService
participant ITS
participant SolanaRPC
participant AxelarNetwork
User->>CLI: Execute command (send/generate/sign/broadcast)
CLI->>Config: Initialize config from chains info
Config->>Config: Load network configuration from JSON
alt Send Command
CLI->>CLI: Parse instruction subcommand
alt Gateway Command
CLI->>Gateway: Build gateway transaction
Gateway->>AxelarNetwork: Query verifier set (if needed)
Gateway->>Gateway: Construct execute data
Gateway->>CLI: Return instructions
else Gas Service Command
CLI->>GasService: Build gas service transaction
GasService->>CLI: Return instructions
else ITS Command
CLI->>ITS: Build ITS transaction
ITS->>SolanaRPC: Query token manager/mint info
ITS->>CLI: Return instructions
end
CLI->>SolanaRPC: Get latest blockhash
CLI->>CLI: Create signed transaction
CLI->>SolanaRPC: Broadcast transaction
CLI->>User: Return transaction result
else Generate Command
CLI->>CLI: Build unsigned transaction
CLI->>SolanaRPC: Fetch nonce account data
CLI->>Config: Save unsigned transaction to output dir
CLI->>User: Return unsigned transaction file
else Sign Command
CLI->>Config: Load unsigned transaction
CLI->>CLI: Sign with local keypair/Ledger
CLI->>Config: Save partial signature
CLI->>User: Return signature file
else Broadcast Command
CLI->>Config: Load signed transaction
CLI->>SolanaRPC: Broadcast to network
CLI->>User: Return transaction result
end
11 files reviewed, 1 comment
…ffchain_data function and default to payer if not passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments, where I focused mostly on the parse_decimal_string_to_raw_units
method. Thanks!
why?
Updating solana/cli to work with current version of solana programs on main
how?
testing
Note
Modernizes Solana CLI, programs integration, and docs: switch to
--chain
, add decimal amount parsing and new authority/minter params, update gateway verification flow, refresh dependencies, and prune Solana devnet-5 config entries.chain_id
tochain
across config/CLI; update JSON writes/reads to usechains[chain]
.--chain-id
from docs/commands; add--signer-keys
for gas-service init.solana-5
entries fromdevnet-amplifier.json
and related Axelar Solana contract mappings.parse_decimal_string_to_raw_units
(with tests) using mintdecimals
for SPL/Token-2022.authority
,operator
,minter
,deployer
; pass through to instructions.decimals
, token program IDs.initialize_payload_verification_session
and verification PDA; adjust signature verification loop.fee_payer
.chain
.chains[chain]
.maxDecimalsWhenTruncating
to6
; add instructions to find token source accounts.lazy_static
,regex
; update Cargo.lock with Solana 2.1.16 and related crate changes.Written by Cursor Bugbot for commit 32b544a. This will update automatically on new commits. Configure here.