mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-26 14:41:12 +00:00
fix(amm): require signer on user token holdings in swap and add-liquidity
The swap and add-liquidity instructions debited user-owned token holdings without requiring those accounts to be signers. Mark them `signer` so a transaction can't move a user's tokens without their authorization: - add liquidity: `user_holding_lp` is now `#[account(mut, signer)]` - swap (both directions): `user_holding_a` and `user_holding_b` are now `#[account(mut, signer)]` Regenerate artifacts/amm-idl.json to reflect the new signer metadata. Update integration tests accordingly: swaps now sign and supply nonces for both user holdings (incrementing both nonces), and `amm_new_definition_precreated_zero_balance_user_lp` becomes `amm_new_definition_precreated_user_lp_unsigned_fails`, asserting an unsigned pre-existing LP holding is rejected and the transaction reverts.
This commit is contained in:
@@ -194,7 +194,7 @@
|
||||
{
|
||||
"name": "user_holding_lp",
|
||||
"writable": true,
|
||||
"signer": false,
|
||||
"signer": true,
|
||||
"init": false
|
||||
},
|
||||
{
|
||||
@@ -425,13 +425,13 @@
|
||||
{
|
||||
"name": "user_holding_a",
|
||||
"writable": true,
|
||||
"signer": false,
|
||||
"signer": true,
|
||||
"init": false
|
||||
},
|
||||
{
|
||||
"name": "user_holding_b",
|
||||
"writable": true,
|
||||
"signer": false,
|
||||
"signer": true,
|
||||
"init": false
|
||||
},
|
||||
{
|
||||
@@ -496,13 +496,13 @@
|
||||
{
|
||||
"name": "user_holding_a",
|
||||
"writable": true,
|
||||
"signer": false,
|
||||
"signer": true,
|
||||
"init": false
|
||||
},
|
||||
{
|
||||
"name": "user_holding_b",
|
||||
"writable": true,
|
||||
"signer": false,
|
||||
"signer": true,
|
||||
"init": false
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user