Skip to content

feat: add marginfi-deposit feature#39

Open
ChiefWoods wants to merge 3 commits intoblueshift-gg:masterfrom
ChiefWoods:feat/marginfi-deposit
Open

feat: add marginfi-deposit feature#39
ChiefWoods wants to merge 3 commits intoblueshift-gg:masterfrom
ChiefWoods:feat/marginfi-deposit

Conversation

@ChiefWoods
Copy link
Contributor

Summary

Changes

Testing

  • make format
  • make clippy
  • make test
  • make test-upstream (if relevant)

Protocol integration checklist (if applicable)

  • Feature flag added and used for all protocol code
  • Action context enums updated
  • Detection logic updated
  • Account parsing validates count and types
  • Tests added or updated

@L0STE L0STE mentioned this pull request Mar 24, 2026
9 tasks
@L0STE
Copy link
Contributor

L0STE commented Mar 24, 2026

Byte 17 of the CPI instruction data is never written — that's UB.

DEPOSIT_DATA_LEN = 18 is correct (MarginFi expects Borsh Option<bool> = tag + value = 2 bytes), but you're only writing the value:

core::ptr::write(ptr.add(16), data.deposit_up_to_amount.unwrap_or(0)); // writes 1 byte, not 2

You need both the tag and the value:

match data.deposit_up_to_amount {
    None    => { *ptr.add(16) = 0; *ptr.add(17) = 0; }
    Some(v) => { *ptr.add(16) = 1; *ptr.add(17) = v; }
}

Rebase onto #33 once it lands.

@ChiefWoods ChiefWoods force-pushed the feat/marginfi-deposit branch from a9528a7 to 962c72c Compare March 24, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants