Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
aa75ae4
Support Token-2022 in `CreateBuffer` and `ReclaimBuffer`
kaze-cow Aug 28, 2026
e499b86
Take the legacy program id from the Token-2022 crate
kaze-cow Aug 28, 2026
50b05b1
Merge remote-tracking branch 'origin/main' into kaze/sc-153-token-202…
kaze-cow Aug 31, 2026
881178b
fixes from final manual review
kaze-cow Aug 31, 2026
d690f26
switch fully away from legacy spl interface
kaze-cow Aug 31, 2026
a056888
fix inconsistencies in token program support
kaze-cow Aug 31, 2026
8248ade
Keep the test CLI's Token-2022 support out of this PR
kaze-cow Aug 31, 2026
a25598c
Merge branch 'main' into kaze/sc-153-token-2022-program
kaze-cow Aug 31, 2026
4ed9541
switch to using an enum based approach, which seems clean
kaze-cow Sep 1, 2026
5fd2f6a
idl update
kaze-cow Sep 1, 2026
7836f89
remove the unnecessary early return which skips the length CPI
kaze-cow Sep 1, 2026
421a926
update documentation and design
kaze-cow Sep 1, 2026
ce75edf
update tests
kaze-cow Sep 1, 2026
88b1c48
fix undo changes and lint
kaze-cow Sep 1, 2026
90a8783
fix bench
kaze-cow Sep 1, 2026
1d5ac46
Update programs/settlement/src/token.rs
kaze-cow Sep 3, 2026
08fc979
Update Cargo.toml
kaze-cow Sep 3, 2026
b427f49
Update programs/settlement/src/reclaim_buffer.rs
kaze-cow Sep 3, 2026
a091047
Update programs/settlement/tests/common/token.rs
kaze-cow Sep 3, 2026
641c08c
Update interface/src/token_program.rs
kaze-cow Sep 3, 2026
e3ccd22
use new tokenprgoram enum in client instructions
kaze-cow Sep 3, 2026
1d2106b
switch to using tokenProgram in the client caused other changes
kaze-cow Sep 3, 2026
ada2e5a
remove the check
kaze-cow Sep 3, 2026
1194762
remove superfluous test
kaze-cow Sep 3, 2026
5a86bce
Merge branch 'main' into kaze/sc-153-token-2022-program
kaze-cow Sep 3, 2026
fbe9396
Merge branch 'kaze/sc-153-token-2022-program' of github.com:cowprotoc…
kaze-cow Sep 4, 2026
f74498b
refactor `base_layout` to use the actual encoder, and rename for clarity
kaze-cow Sep 4, 2026
2907aaa
update test and spl token mint behavior
kaze-cow Sep 4, 2026
62776ff
add some tests for wierd edge cases with recreating mints
kaze-cow Sep 4, 2026
3f1aa2b
Merge branch 'main' into kaze/sc-153-token-2022-program
kaze-cow Sep 4, 2026
00312df
fix idl
kaze-cow Sep 4, 2026
3c8a10c
Update programs/settlement/tests/common/token_2022.rs
kaze-cow Sep 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 131 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ litesvm-token = "0.15"
num_enum = "0.7"
pinocchio = "0.11"
pinocchio-system = "0.6"
pinocchio-token = "0.6"
pinocchio-token = "0.7"
pinocchio-token-2022 = "0.4"
proptest = "1"
serde_json = { version = "1", features = ["preserve_order"] }
cow-settlement-client = { path = "client", version = "0.3.0" }
Expand All @@ -58,6 +59,7 @@ solana-sha256-hasher = { version = "3", features = ["sha2"] }
solana-system-interface = "3"
spl-associated-token-account-interface = "2"
spl-token = "9"
spl-token-2022-interface = "3"
spl-token-interface = "3"
syn = { version = "2", features = ["full"] }

Expand Down
4 changes: 3 additions & 1 deletion DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,6 @@ The main reason to prefer the SOL flow described here is the handling of the ren

## Token 2022

The settlement program will natively support [Token-2022](https://www.solana-program.com/docs/token-2022) tokens. All operations available to standard tokens will be usable for tokens based on this standard, and no major front-end or back-end changes are expected in order to support the majority of tokens based on this standard.
The settlement program natively supports [Token-2022](https://www.solana-program.com/docs/token-2022) tokens. The settlement program does not explicitly block any
token extensions, but if the extension interferes with the settlement process such that it causes a failure (such as locked tokens), then any affected orders will
be unsettleable.
44 changes: 21 additions & 23 deletions bench-report.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,32 @@
"compute_units": {
"add_solver/add_with_many_existing_solvers": 5074,
"add_solver/adds_a_solver": 4622,
"create_buffers/happy_path_creates_initialized_buffer_token_account": 7347,
"create_buffers/happy_path_creates_multiple_buffers_in_one_instruction": 17247,
"create_buffers/max_buffers_in_one_instruction": 169571,
"create_buffers/happy_path_creates_initialized_buffer_token_account": 7376,
"create_buffers/happy_path_creates_multiple_buffers_in_one_instruction": 17290,
"create_buffers/max_buffers_in_one_instruction": 169803,
"create_order/happy_path_creates_order_pda_with_expected_body": 4985,
"initialize/happy_path_initializes_state_pda_with_expected_data": 4530,
"reclaim_buffer/funded_buffer_is_skipped": 4835,
"reclaim_buffer/happy_path_reclaims_empty_buffer_to_the_authority_itself": 5982,
"reclaim_buffer/max_buffers_in_one_instruction": 124622,
"reclaim_buffer/reclaims_multiple_buffers_skipping_funded": 7581,
"initialize/happy_path_initializes_state_pda_with_expected_data": 4529,
"reclaim_buffer/funded_buffer_is_skipped": 4859,
"reclaim_buffer/happy_path_reclaims_empty_buffer_to_the_authority_itself": 6009,
"reclaim_buffer/max_buffers_in_one_instruction": 124823,
"reclaim_buffer/reclaims_multiple_buffers_skipping_funded": 7611,
"reclaim_order/happy_path_expired_returns_lamports_and_closes_pda": 2202,
"reclaim_order/happy_path_on_chain_order_cancelled_is_reclaimable_before_expiry": 2071,
"reclaim_order/happy_path_on_chain_order_cancelled_is_reclaimable_before_expiry": 2072,
"reclaim_order/happy_path_on_chain_order_fully_filled_is_reclaimable_before_expiry": 2079,
"reclaim_order/off_chain_order_is_reclaimable_only_once_expired": null,
"reclaim_order/on_chain_order_partially_filled_is_not_reclaimable_before_expiry": null,
"remove_solver/remove_with_many_existing_solvers": 3757,
"remove_solver/removes_a_solver": 3492,
"settle/finalizes_with_no_pushes": 7154,
"settle/pulls_from_multiple_orders": 20059,
"settle/pulls_funds_to_destination": 13640,
"settle/pulls_to_multiple_destinations": 14781,
"settle/pushes_a_single_order": 12495,
"settle/pushes_several_orders_from_different_buffers": 17767,
"settle/pushes_several_orders_from_one_buffer": 17766,
"settle/settles_a_single_order": 12513,
"settle/settles_multiple_orders": 23086,
"transfer_authority/manager_can_transfer_manager": 3173,
"transfer_authority/manager_can_transfer_reclaim_authority": 3175,
"transfer_authority/reclaim_authority_can_transfer_itself": 3179
"settle/finalizes_with_no_pushes": 7171,
"settle/pulls_from_multiple_orders": 20076,
"settle/pulls_funds_to_destination": 13657,
"settle/pulls_to_multiple_destinations": 14798,
"settle/pushes_a_single_order": 12512,
"settle/pushes_several_orders_from_different_buffers": 17784,
"settle/pushes_several_orders_from_one_buffer": 17783,
"settle/settles_a_single_order": 12530,
"settle/settles_multiple_orders": 23103,
"transfer_authority/manager_can_transfer_manager": 3174,
"transfer_authority/manager_can_transfer_reclaim_authority": 3176,
"transfer_authority/reclaim_authority_can_transfer_itself": 3180
},
"transaction_bytes": {
"add_solver/add_with_many_existing_solvers": 366,
Expand Down
5 changes: 5 additions & 0 deletions client/src/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use cow_settlement_interface::{
data::intent::{EncodedOrderIntent, OrderIntent},
pda::{buffer::find_buffer_pda, order::find_order_pda, state::find_state_pda},
token_program::TokenProgram,
Instruction, Pubkey, Role,
};

Expand Down Expand Up @@ -148,6 +149,7 @@ impl From<CreateOrder<'_>> for Instruction {
pub struct CreateBuffers<'a> {
pub program_id: Pubkey,
pub payer: Pubkey,
pub token_program: TokenProgram,
pub mints: &'a [Pubkey],
}

Expand All @@ -161,6 +163,7 @@ impl From<CreateBuffers<'_>> for Instruction {
cow_settlement_interface::instruction::create_buffer::CreateBuffers {
program_id: builder.program_id,
payer: builder.payer,
token_program: builder.token_program.address(),
buffers: &buffers,
}
.into()
Expand Down Expand Up @@ -199,6 +202,7 @@ pub struct ReclaimBuffer<'a> {
pub program_id: Pubkey,
pub reclaim_authority: Pubkey,
pub reclaim_recipient: Pubkey,
pub token_program: TokenProgram,
pub mints: &'a [Pubkey],
}

Expand All @@ -218,6 +222,7 @@ impl From<ReclaimBuffer<'_>> for Instruction {
state_pda,
reclaim_authority: builder.reclaim_authority,
reclaim_recipient: builder.reclaim_recipient,
token_program: builder.token_program.address(),
buffers: &buffers,
}
.into()
Expand Down
3 changes: 3 additions & 0 deletions client/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ mod tests {
fixtures::fake_account_from_array, reclaim_buffer::ReclaimBuffer,
reclaim_order::ReclaimOrder, transfer_authority::TransferAuthority,
},
token_program::TokenProgram,
Instruction, Role,
};

Expand Down Expand Up @@ -115,6 +116,7 @@ mod tests {
SettlementInstruction::CreateBuffer => CreateBuffers {
program_id,
payer,
token_program: TokenProgram::SplToken,
mints: &[pubkey_from_seed("mint")],
}
.into(),
Expand Down Expand Up @@ -146,6 +148,7 @@ mod tests {
state_pda: pubkey_from_seed("state pda"),
reclaim_authority: payer,
reclaim_recipient: payer,
token_program: pubkey_from_seed("token program"),
buffers: &[(pubkey_from_seed("buffer pda"), pubkey_from_seed("mint"))],
}
.into(),
Expand Down
2 changes: 1 addition & 1 deletion interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ solana-pubkey = { workspace = true, features = ["curve25519"] }
solana-sdk-ids.workspace = true
solana-sha256-hasher.workspace = true
solana-system-interface.workspace = true
spl-token-interface.workspace = true
spl-token-2022-interface.workspace = true
Comment thread
fedgiac marked this conversation as resolved.

[dev-dependencies]
hex-literal.workspace = true
Expand Down
Loading
Loading