Balanced Solana spoke contracts
This document outlines the major changes in the implementation of Balanced in the Solana blockchain and the rationale behind these changes. Key updates includes query handle call message accounts features on all programs, bnUSD token(an SPL token) separation from Balanced dollar program, force rollback feature and return type of handle_call_message method
For more details on each spoke contracts see: Balanced Crosschain Docs
For more details on the Balanced Protocol see Balanced Docs or Balanced Network
- Query Handle call message accounts
Change: A feature has been added so that all required accounts for the handle call message method can be queried from the program.
Process:
- Added the
query_handle_call_message_accountsmethod on all the balanced programs. The method takes state account in the context and takes data and the protocols on the parameter. Data is required to get accounts inside the data. protocols is not required for balanced and added it as per the xcall standard only.
Rationale:
- The methods of Solana programs requires all associated accounts of the methods to be sent on the context of the method. it makes relayer easier to send the account without storing or creating any accounts priorly
- Balanced Dollar Token Contract Separation
Change: Token program for Balanced Dollar is separated from the cross-chain features.
Rationale: Solana SPL token can be created with CLI and a general SPL token don't need a program. The bnUSD token will be created with CLI and only the cross chain features is included on balanced dollar program
- Return type of
handle_call_messagemethod
Change: handle_call_message method of all the programs returning same specific data structure
Rationale: This is the xcall specification for solana blockchain to return the specified data structure from handle_call_message method
-
Handling Rollback Failures
Change: Introduced
forced_rollbackin Balanced, which can be executed by an admin in case of a failure inhandle call message.Rationale: There is no concept of exception handling in Solana CPI, such as try-catch, making it impossible to rollback every message that fails in
handlecall message, specially while getting accounts forexecute_callof Xcall. Instead, it will fail the entire transaction if there is a configuration failure.