Solana: Execute proposal (only transfer)#70
Open
GuidoDipietro wants to merge 26 commits intosolana/settlerfrom
Open
Solana: Execute proposal (only transfer)#70GuidoDipietro wants to merge 26 commits intosolana/settlerfrom
GuidoDipietro wants to merge 26 commits intosolana/settlerfrom
Conversation
Base automatically changed from
solana/controller-min-validations
to
solana/settler
April 23, 2026 16:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements
execute_proposalon SVM Settler, only for transfer intents.In tandem with this PR.
Almost 50% of this PR's additions are
Cargo.lock., and the remaining 50% is 58% unit tests.New dependencies
anchor-splwas added to the Settler program since we are now performing SPL transfers (token transfers).A note on SPL token "approvals"
Solana has a similar mechanism to EVM's approvals to move tokens on behalf of another wallet. This is called "delegate". You can design a delegate and a delegated amount to a given token account, which works as expected (the delegate can transfer up to "delegated amount" tokens, in one or more transactions).
The proposed implementation uses a PDA delegate (i.e. an account owned by the Settler program), so that users can give approval "to the Settler" or "to the Protocol" by adding this PDA as the delegate for their token accounts.
A note on style
Some lines are split into multiple ones, making readability of the Settler code a bit harder. I think we would benefit from extending the max line length, but doing so in this PR will imply making review harder, so let's keep it for another one.
A note on remaining accounts
The so-called "remaining accounts" are the
AccountInfos not parsed by any Anchor macro. These accounts are equivalent to how "vanilla" Solana programs work, where you just receive an array ofAccountInfos and it is your responsibility to properly deserialize and check them.Anchor does a ton of this work for us in their
Accountsstruct (tagged with#[derive(Accounts)]), but this comes with some limitations. One of them is that we can't pass dynamic accounts. Since the nature of the accounts struct in this instruction is dynamic (given the intent's operations, in this case transfers, is dynamic as well), we need to resort to "remaining accounts" and do everything by hand.The
SvmSettlerSDK will include a method to calculate these remaining accounts so that it remains transparent to the SDK user, as it should be given this is only a technical aspect of the implementation. This is missing in this PR as it will be added on the implementation on the Solver to avoid PR clutter.Expected remaining accounts
The
execute_proposalexpects the following remaining accounts for a transfer intent, in this order:The minimum number of remaining accounts for an intent with one transfer and one fee is 9 accounts.
I have decided to simply list every account, even if some might be repeated (such as, if fee token == transfer token, we will have 2 repeated accounts). This approach is simpler on the Settler code, although it might lead to us reaching accounts constraints more quickly (~64 accounts max on legacy format).
I propose that we go with this design and modify it afterwards if we find it necessary (an easy solution is using v0 transactions, which would be a quick fix).
Tests will remain to fail on CI until SDK version is bumped. PR merges are halted as main has changed significantly, until end-to-end is tested and we see that it works fine.