Skip to content

Proof of AuditsExplore EvidenceSolana programsDrift Protocol v2

Drift Protocol v2

Drift Protocol v2 is a Solana exchange program for perpetual futures, spot margin, lending and borrowing. Users deposit collateral and place orders that keepers fill. The source repository is now archived under velocity-exchange/protocol-v2.

  • Recorded data
  • 1programs
  • 2audit reports
  • 4curated transactions
  • 7open questions
  • observed at slot471,652,414

What this page showsEvery program Drift Protocol v2 runs on Solana, the audit reports POA holds for it, which report covers which instructions (actions), and what POA could not establish.

Open questions

What is not established

7 open questions recorded

Facts research could not establish, copied from the evidence as written.

  1. The live program was redeployed at slot 429731225 (2026-06-29). The only provider commit (OtterSec, v2.100.0 from 2024-11-14) is far older, and the provider marks it not verified. The source of the current deployment is not established.
  2. The repository is archived. At its last commit (13e8e9b8, 2026-06-23, crate version 2.162.0) every instruction in the #[program] module is commented out (commit e32903be, "comment out all ixs", 2026-04-01), leaving only two native oracle-update instructions handled before the Anchor dispatcher. Whether this build is the one deployed on 2026-06-29 is not established.
  3. Recent direct user transactions observed in November 2026 fail with Anchor error 101 (InstructionFallbackNotFound). In a sample of successful transactions after the redeployment, none called deposit or order instructions at top level.
  4. Neodyme reviewed commits b8283103 to 0ee9e960 (February to April 2024) and says later changes were only partly reviewed; programs/drift changed in 121 files between 0ee9e960 and the OtterSec commit. No audit is linked for later code.
  5. Neodyme says fixes for CR-01, IN-01 and IN-03 were in pull requests awaiting merge when the report was written; their merge was not checked here.
  6. The handler map and IDL are pinned to the OtterSec commit fee7bfa6 (181 instructions). The on-chain IDL account holds version 2.150.0 with 241 instructions, so instructions added later are not mapped.
  7. Static CPI lists come from source pattern matching up to three helper calls deep. An empty list does not prove the handler makes no CPI.

Programs

Executable programs POA read from mainnet, each with its proof chain counted over its instructions.

  1. The proof chain
    1. Instruction decoded

      181 of 181 instructions

    2. Live code rebuilt by POA

      0 of 181 instructions

    3. Report names the handler file

      181 of 181 instructions

    4. Reviewed commit printed

      0 of 181 instructions

    5. Reviewed code is the live code

      0 of 181 instructions

    Every link must hold before POA says Matched. A missing link is not a failure, and never an approval.

Audit reports

2 reports, 2 with a reviewed commit printed.

Which audit covers what

For each program, one row per report that relates to it. Counts are instructions of that program.

ReportChecked version (commit)Names the file that runs itCovers the program, no files namedChecked version vs running code
Neodyme0ee9e96181 of 1810 of 181Running code not rebuilt by POA
Trail of Bits57dd5c60 of 181181 of 181Running code not rebuilt by POA

POA did not rebuild the running code, so no report's version can be compared with it.

As extracted from each PDF. Commits, scope paths and exclusions are what the report prints. A dash means the record states no count for that severity.

  1. 01

    Neodyme

    Security Audit: Drift Protocol

    2024-02-01 to 2024-04-13 · published 2024-05-10

    Report PDF (opens in a new tab)

    Reviewed commits

    • b828310initial · p. 5
    • 0ee9e96final · p. 5

    Scope paths

    • programs/drift

    Exclusions

    • third-party dependencies
    • keeper-bots-v2 (fragments reviewed unofficially, not in scope)
    • jit-proxy (fragments reviewed unofficially, not in scope)

    Findings

    • 1 critical
    • 0 high
    • 2 medium
    • 4 low
    • 3 info
    PDF SHA-256b53102…9fafff b53102cc84db792800c1a72d7be91f3a15901e344bf8d35c6e9f4ec5b89fafffPrinted in the report · PDF text
  2. 02

    Trail of Bits

    Drift Protocol Security Assessment

    2022-11-07 to 2022-12-02 · published 2023-02-15

    Report PDF (opens in a new tab)

    Reviewed commits

    • 57dd5c6initial · p. 11

    Scope paths

    No paths named

    Exclusions

    None stated

    Findings

    • – critical
    • – high
    • 1 medium
    • – low
    • 15 info
    • 4 unrated
    PDF SHA-256a32979…7a0365 a32979f57b9587da8f97bd7bd5d73ef6da258eedd882fab3c03ebdc43f7a0365Printed in the report · PDF text

Source diffs

File-level git diffs between pinned commits, restricted to the program crate.

  1. 0ee9e96fee7bfaNeodyme 2024: last revision during audit timeframe → OtterSec verify API commit (v2.100.0)

    From Neodyme 2024: last revision during audit timeframe

    To OtterSec verify API commit (v2.100.0)

    121121 files changed under programs/drift

    +16,275 −2,449 lines

    computed 2026-11-19 · Compare on GitHub (opens in a new tab)

    Show the 121 changed files
    FileStatusAddedRemoved
    programs/drift/Cargo.tomlmodified126
    programs/drift/src/controller/amm.rsmodified12783
    programs/drift/src/controller/amm/tests.rsmodified88
    programs/drift/src/controller/funding.rsmodified151
    programs/drift/src/controller/insurance.rsmodified10734
    programs/drift/src/controller/insurance/tests.rsmodified11
    programs/drift/src/controller/liquidation.rsmodified55024
    programs/drift/src/controller/liquidation/tests.rsmodified1,542214
    programs/drift/src/controller/lp.rsmodified84
    programs/drift/src/controller/lp/tests.rsmodified84
    programs/drift/src/controller/orders.rsmodified680166
    programs/drift/src/controller/orders/amm_jit_tests.rsmodified81111
    programs/drift/src/controller/orders/amm_lp_jit_tests.rsmodified80100
    programs/drift/src/controller/orders/fuel_tests.rsadded8160
    programs/drift/src/controller/orders/tests.rsmodified454199
    programs/drift/src/controller/pda.rsmodified5815
    programs/drift/src/controller/pnl.rsmodified11564
    programs/drift/src/controller/pnl/delisting.rsmodified2216
    programs/drift/src/controller/pnl/tests.rsmodified20119
    programs/drift/src/controller/position.rsmodified1514
    programs/drift/src/controller/position/tests.rsmodified5457
    programs/drift/src/controller/repeg.rsmodified4112
    programs/drift/src/controller/repeg/tests.rsmodified66
    programs/drift/src/controller/spot_balance.rsmodified21
    programs/drift/src/controller/spot_balance/tests.rsmodified1527
    programs/drift/src/controller/token.rsmodified9128
    programs/drift/src/error.rsmodified880
    programs/drift/src/ids.rsmodified701
    programs/drift/src/instructions/admin.rsmodified1,85783
    programs/drift/src/instructions/constraints.rsmodified100
    programs/drift/src/instructions/if_staker.rsmodified5614
    programs/drift/src/instructions/keeper.rsmodified852122
    programs/drift/src/instructions/mod.rsmodified20
    programs/drift/src/instructions/optional_accounts.rsmodified4811
    programs/drift/src/instructions/pyth_pull_oracle.rsadded2650
    programs/drift/src/instructions/user.rsmodified69494
    programs/drift/src/lib.rsmodified38284
    programs/drift/src/macros.rsmodified70
    programs/drift/src/math/amm.rsmodified1818
    programs/drift/src/math/amm/tests.rsmodified44
    programs/drift/src/math/amm_jit.rsmodified73
    programs/drift/src/math/amm_spread.rsmodified3417
    programs/drift/src/math/amm_spread/tests.rsmodified12318
    programs/drift/src/math/auction.rsmodified5021
    programs/drift/src/math/auction/tests.rsmodified8022
    programs/drift/src/math/bn.rsmodified039
    programs/drift/src/math/casting.rsmodified10
    programs/drift/src/math/constants.rsmodified217
    programs/drift/src/math/cp_curve.rsmodified11
    programs/drift/src/math/cp_curve/tests.rsmodified33
    programs/drift/src/math/fees.rsmodified3915
    programs/drift/src/math/fees/tests.rsmodified890
    programs/drift/src/math/fuel.rsadded730
    programs/drift/src/math/fuel/tests.rsadded660
    programs/drift/src/math/fulfillment.rsmodified2712
    programs/drift/src/math/fulfillment/tests.rsmodified2713
    programs/drift/src/math/funding/tests.rsmodified1556
    programs/drift/src/math/insurance.rsmodified11
    programs/drift/src/math/liquidation.rsmodified723
    programs/drift/src/math/liquidation/tests.rsmodified324
    programs/drift/src/math/lp.rsmodified41
    programs/drift/src/math/lp/tests.rsmodified70
    programs/drift/src/math/margin.rsmodified10239
    programs/drift/src/math/margin/tests.rsmodified60920
    programs/drift/src/math/matching.rsmodified61
    programs/drift/src/math/matching/tests.rsmodified4511
    programs/drift/src/math/mod.rsmodified10
    programs/drift/src/math/oracle.rsmodified4328
    programs/drift/src/math/oracle/tests.rsmodified3510
    programs/drift/src/math/orders.rsmodified9034
    programs/drift/src/math/orders/tests.rsmodified3615
    programs/drift/src/math/position.rsmodified272
    programs/drift/src/math/repeg.rsmodified10
    programs/drift/src/math/serum.rsmodified44
    programs/drift/src/math/spot_balance.rsmodified5628
    programs/drift/src/math/spot_swap.rsmodified10
    programs/drift/src/math/spot_withdraw.rsmodified426
    programs/drift/src/state/events.rsmodified4154
    programs/drift/src/state/fill_mode.rsmodified416
    programs/drift/src/state/fill_mode/tests.rsmodified44
    programs/drift/src/state/fulfillment_params/drift.rsmodified179
    programs/drift/src/state/fulfillment_params/mod.rsmodified10
    programs/drift/src/state/fulfillment_params/openbook_v2.rsadded5080
    programs/drift/src/state/fulfillment_params/phoenix.rsmodified211
    programs/drift/src/state/fulfillment_params/serum.rsmodified222
    programs/drift/src/state/high_leverage_mode_config.rsadded380
    programs/drift/src/state/load_ref.rsadded390
    programs/drift/src/state/margin_calculation.rsmodified1565
    programs/drift/src/state/mod.rsmodified50
    programs/drift/src/state/oracle.rsmodified11641
    programs/drift/src/state/oracle/tests.rsmodified702
    programs/drift/src/state/oracle_map.rsmodified1126
    programs/drift/src/state/order_params.rsmodified29378
    programs/drift/src/state/order_params/tests.rsmodified3553
    programs/drift/src/state/paused_operations.rsmodified394
    programs/drift/src/state/paused_operations/tests.rsmodified33
    programs/drift/src/state/perp_market.rsmodified20443
    programs/drift/src/state/perp_market/tests.rsmodified620
    programs/drift/src/state/perp_market_map.rsmodified1217
    programs/drift/src/state/rfq_user.rsadded1180
    programs/drift/src/state/settle_pnl_mode.rsadded330
    programs/drift/src/state/settle_pnl_mode/tests.rsadded180
    programs/drift/src/state/spot_fulfillment_params.rsmodified140
    programs/drift/src/state/spot_market.rsmodified7830
    programs/drift/src/state/spot_market_map.rsmodified5312
    programs/drift/src/state/state.rsmodified136
    programs/drift/src/state/swift_user.rsadded2270
    programs/drift/src/state/swift_user/tests.rsadded2760
    programs/drift/src/state/user.rsmodified40890
    programs/drift/src/state/user/tests.rsmodified2845
    programs/drift/src/state/user_map.rsmodified545
    programs/drift/src/validation/fee_structure.rsmodified11
    programs/drift/src/validation/fee_structure/tests.rsmodified62
    programs/drift/src/validation/margin.rsmodified444
    programs/drift/src/validation/mod.rsmodified10
    programs/drift/src/validation/order.rsmodified9254
    programs/drift/src/validation/order/test.rsadded1110
    programs/drift/src/validation/sig_verification.rsadded1670
    programs/drift/src/validation/spot_market.rsmodified101
    programs/drift/src/validation/user.rsmodified22
    programs/drift/src/validation/whitelist.rsmodified60
  2. 57dd5c6fee7bfaTrail of Bits 2022: reviewed version → OtterSec verify API commit (v2.100.0)

    From Trail of Bits 2022: reviewed version

    To OtterSec verify API commit (v2.100.0)

    143143 files changed under programs/drift

    +68,421 −12,241 lines

    computed 2026-11-19 · Compare on GitHub (opens in a new tab)

    Show the 143 changed files
    FileStatusAddedRemoved
    programs/drift/Cargo.tomlmodified238
    programs/drift/src/controller/amm.rsmodified349161
    programs/drift/src/controller/amm/tests.rsmodified1,15358
    programs/drift/src/controller/funding.rsmodified389
    programs/drift/src/controller/insurance.rsmodified22555
    programs/drift/src/controller/insurance/tests.rsmodified2652
    programs/drift/src/controller/liquidation.rsmodified1,483396
    programs/drift/src/controller/liquidation/tests.rsmodified5,219725
    programs/drift/src/controller/lp.rsmodified16951
    programs/drift/src/controller/lp/tests.rsmodified1,68411
    programs/drift/src/controller/mod.rsmodified01
    programs/drift/src/controller/orders.rsmodified2,8981,518
    programs/drift/src/controller/orders/amm_jit_tests.rsmodified1,213240
    programs/drift/src/controller/orders/amm_lp_jit_tests.rsadded3,2950
    programs/drift/src/controller/orders/fuel_tests.rsadded8160
    programs/drift/src/controller/orders/tests.rsmodified9,8223,225
    programs/drift/src/controller/pda.rsmodified5815
    programs/drift/src/controller/pnl.rsmodified23753
    programs/drift/src/controller/pnl/delisting.rsmodified265253
    programs/drift/src/controller/pnl/tests.rsmodified649111
    programs/drift/src/controller/position.rsmodified11387
    programs/drift/src/controller/position/tests.rsmodified1,3875
    programs/drift/src/controller/repeg.rsmodified7725
    programs/drift/src/controller/repeg/tests.rsmodified16057
    programs/drift/src/controller/serum.rsdeleted0224
    programs/drift/src/controller/spot_balance.rsmodified3028
    programs/drift/src/controller/spot_balance/tests.rsmodified59457
    programs/drift/src/controller/spot_position.rsmodified4611
    programs/drift/src/controller/spot_position/tests.rsmodified510
    programs/drift/src/controller/token.rsmodified10321
    programs/drift/src/error.rsmodified1724
    programs/drift/src/ids.rsmodified1221
    programs/drift/src/instructions/admin.rsmodified2,921390
    programs/drift/src/instructions/constraints.rsmodified5322
    programs/drift/src/instructions/if_staker.rsmodified14717
    programs/drift/src/instructions/keeper.rsmodified1,267231
    programs/drift/src/instructions/mod.rsmodified20
    programs/drift/src/instructions/optional_accounts.rsmodified90157
    programs/drift/src/instructions/pyth_pull_oracle.rsadded2650
    programs/drift/src/instructions/user.rsmodified2,543779
    programs/drift/src/lib.rsmodified75381
    programs/drift/src/macros.rsmodified70
    programs/drift/src/math/amm.rsmodified17787
    programs/drift/src/math/amm/tests.rsmodified24333
    programs/drift/src/math/amm_jit.rsmodified13126
    programs/drift/src/math/amm_jit/tests.rsmodified248
    programs/drift/src/math/amm_spread.rsmodified42476
    programs/drift/src/math/amm_spread/tests.rsmodified1,23737
    programs/drift/src/math/auction.rsmodified16627
    programs/drift/src/math/auction/tests.rsmodified3620
    programs/drift/src/math/bn.rsmodified039
    programs/drift/src/math/casting.rsmodified10
    programs/drift/src/math/constants.rsmodified3710
    programs/drift/src/math/cp_curve.rsmodified3327
    programs/drift/src/math/cp_curve/tests.rsmodified76
    programs/drift/src/math/fees.rsmodified13037
    programs/drift/src/math/fees/tests.rsmodified36919
    programs/drift/src/math/fuel.rsadded730
    programs/drift/src/math/fuel/tests.rsadded660
    programs/drift/src/math/fulfillment.rsmodified15840
    programs/drift/src/math/fulfillment/tests.rsadded9040
    programs/drift/src/math/funding.rsmodified227
    programs/drift/src/math/funding/tests.rsmodified2848
    programs/drift/src/math/helpers.rsmodified10
    programs/drift/src/math/insurance.rsmodified43
    programs/drift/src/math/liquidation.rsmodified23948
    programs/drift/src/math/liquidation/tests.rsmodified3634
    programs/drift/src/math/lp.rsmodified1168
    programs/drift/src/math/lp/tests.rsmodified2010
    programs/drift/src/math/margin.rsmodified584437
    programs/drift/src/math/margin/tests.rsmodified2,414396
    programs/drift/src/math/matching.rsmodified2212
    programs/drift/src/math/matching/tests.rsmodified2110
    programs/drift/src/math/mod.rsmodified30
    programs/drift/src/math/oracle.rsmodified14859
    programs/drift/src/math/oracle/tests.rsmodified5519
    programs/drift/src/math/orders.rsmodified991183
    programs/drift/src/math/orders/tests.rsmodified3,415269
    programs/drift/src/math/position.rsmodified12676
    programs/drift/src/math/repeg.rsmodified5475
    programs/drift/src/math/repeg/tests.rsmodified985
    programs/drift/src/math/safe_unwrap.rsadded430
    programs/drift/src/math/serum.rsmodified166
    programs/drift/src/math/serum/tests.rsmodified358
    programs/drift/src/math/spot_balance.rsmodified7555
    programs/drift/src/math/spot_swap.rsadded1480
    programs/drift/src/math/spot_swap/tests.rsadded3560
    programs/drift/src/math/spot_withdraw.rsmodified18627
    programs/drift/src/math/stats.rsmodified91
    programs/drift/src/state/events.rsmodified15954
    programs/drift/src/state/fill_mode.rsadded790
    programs/drift/src/state/fill_mode/tests.rsadded510
    programs/drift/src/state/fulfillment.rsmodified53
    programs/drift/src/state/fulfillment_params/drift.rsadded1050
    programs/drift/src/state/fulfillment_params/mod.rsadded40
    programs/drift/src/state/fulfillment_params/openbook_v2.rsadded5080
    programs/drift/src/state/fulfillment_params/phoenix.rsadded7260
    programs/drift/src/state/fulfillment_params/serum.rsadded7150
    programs/drift/src/state/high_leverage_mode_config.rsadded380
    programs/drift/src/state/insurance_fund_stake.rsmodified742
    programs/drift/src/state/insurance_fund_stake/tests.rsadded220
    programs/drift/src/state/load_ref.rsadded390
    programs/drift/src/state/margin_calculation.rsadded4970
    programs/drift/src/state/mod.rsmodified131
    programs/drift/src/state/oracle.rsmodified37266
    programs/drift/src/state/oracle/tests.rsadded1280
    programs/drift/src/state/oracle_map.rsmodified25219
    programs/drift/src/state/order_params.rsadded8840
    programs/drift/src/state/order_params/tests.rsadded1,4540
    programs/drift/src/state/paused_operations.rsadded990
    programs/drift/src/state/paused_operations/tests.rsadded790
    programs/drift/src/state/perp_market.rsmodified1,116155
    programs/drift/src/state/perp_market/tests.rsadded1040
    programs/drift/src/state/perp_market_map.rsmodified1821
    programs/drift/src/state/rfq_user.rsadded1180
    programs/drift/src/state/serum.rsdeleted0114
    programs/drift/src/state/settle_pnl_mode.rsadded330
    programs/drift/src/state/settle_pnl_mode/tests.rsadded180
    programs/drift/src/state/spot_fulfillment_params.rsadded1170
    programs/drift/src/state/spot_market.rsmodified38780
    programs/drift/src/state/spot_market_map.rsmodified5916
    programs/drift/src/state/state.rsmodified11226
    programs/drift/src/state/state/tests.rsadded530
    programs/drift/src/state/swift_user.rsadded2270
    programs/drift/src/state/swift_user/tests.rsadded2760
    programs/drift/src/state/traits.rsadded100
    programs/drift/src/state/traits/tests.rsadded1040
    programs/drift/src/state/user.rsmodified1,225180
    programs/drift/src/state/user/tests.rsmodified1,43399
    programs/drift/src/state/user_map.rsadded4060
    programs/drift/src/test_utils.rsmodified230
    programs/drift/src/validation/fee_structure.rsmodified42
    programs/drift/src/validation/fee_structure/tests.rsmodified62
    programs/drift/src/validation/margin.rsmodified444
    programs/drift/src/validation/mod.rsmodified10
    programs/drift/src/validation/order.rsmodified27091
    programs/drift/src/validation/order/test.rsadded1110
    programs/drift/src/validation/perp_market.rsmodified6015
    programs/drift/src/validation/position.rsmodified80
    programs/drift/src/validation/sig_verification.rsadded1670
    programs/drift/src/validation/spot_market.rsmodified101
    programs/drift/src/validation/user.rsmodified873
    programs/drift/src/validation/whitelist.rsmodified60

Accounts that are not programs

State, config, mint and multisig accounts. None of these is an executable program, and none has a verdict.

AddressKindLabelNoteSource
StateDrift State accountGlobal State PDA (seed "drift_state"), owned by the program, not executable.Derived by POA from pinned source · 2026-11-20
StateSpot market 0 vaultToken vault PDA for spot market index 0 (seeds "spot_market_vault", 0u16). Deposits to market 0 land here.Derived by POA from pinned source · 2026-11-20
Otheron-chain Anchor IDL accountAnchor IDL account. It holds IDL version 2.150.0 with 241 instructions, which matches neither the OtterSec commit nor the repo head, so it is not used for decoding.Read by POA from mainnet · 2026-11-20

Curated transactions

Finalized mainnet transactions POA decoded. Each opens on Solana Explorer.

SignatureInstructionSlotBlock timeCode that ran
HctYAMSS…jKN2rf HctYAMSSb1XXiUtSwhv8Mbd155veY1BLbzYGtrVa4HeLtgoVCbAF1SWfrbzr7tAmMCEJfTLwpcpyg2GE3jKN2rf (opens Solana Explorer in a new tab)deposit304,999,8462024-12-02 18:40 UTC

Program upgraded after this transaction: the executable that ran is not established. Deployment slot 429,731,225, transaction slot 304,999,846, snapshot slot 471,652,414.

3NZEQh8y…BQWBDr 3NZEQh8ypBs1njP6YtUF5vCP7W2W3YRY8SczZL2h8fgmomZKUZwWCR3sgzAJGUJSxXN6KTm2XtUudLW9y7BQWBDr (opens Solana Explorer in a new tab)deposit304,999,7802024-12-02 18:39 UTC

Program upgraded after this transaction: the executable that ran is not established. Deployment slot 429,731,225, transaction slot 304,999,780, snapshot slot 471,652,414.

2grkFouc…U97jUs 2grkFoucxxqp6nVZ1CsD5LVZuR5ayGzspKfiomyBZ8Vm6rEpcGA3CQv8DFwjBJmmXbJe7M3DzH9kbRg1TPU97jUs (opens Solana Explorer in a new tab)place_perp_order406,799,9942026-03-16 13:08 UTC

Program upgraded after this transaction: the executable that ran is not established. Deployment slot 429,731,225, transaction slot 406,799,994, snapshot slot 471,652,414.

4BC9FToQ…jZ7dRS 4BC9FToQpxWvxf2aXZLp4XFr8yBBN4QS9YXzhXDTgQXriefUid1x3WyZoT8A3Y4qNZg5pZLh6d3VTy4tqejZ7dRS (opens Solana Explorer in a new tab)place_perp_order406,799,9942026-03-16 13:08 UTC

Program upgraded after this transaction: the executable that ran is not established. Deployment slot 429,731,225, transaction slot 406,799,994, snapshot slot 471,652,414.

Summary

Category
perpetuals and spot exchange
Depth
Catalog only
Observed at slot
471,652,414
Generated
2026-11-22
Input file SHA-256
511dfcd9f8…a7124d208e 511dfcd9f8067393f466598d254cec5b4eb3c1f959f5f38088acc0a7124d208e