Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Features

- program: remove same slot matching restriction [#2104](https://github.com/drift-labs/protocol-v2/pull/2104)

### Fixes

### Breaking
Expand Down Expand Up @@ -47,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixes

### Breaking

- sdk: `channelOptions` in the GrpcConfigs type has been updated to work with new grpc lib

## [2.153.0] - 2025-12-30
Expand Down Expand Up @@ -104,11 +107,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixes

### Breaking

- program: add DepositRecord::spot_balance_after [#2034](https://github.com/drift-labs/protocol-v2/pull/2034)

## [2.149.0] - 2025-11-19

### Features

- sdk: allow deposit from external authority directly to drift account

### Fixes
Expand Down Expand Up @@ -171,7 +176,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Features

- program: use-5min-for-target-expiry-price ([#1967](https://github.com/drift-labs/protocol-v2/pull/1967))
- program: use-5min-for-target-expiry-price ([#1967](https://github.com/drift-labs/protocol-v2/pull/1967))

### Fixes

Expand Down
6 changes: 2 additions & 4 deletions programs/drift/src/math/matching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ pub fn is_maker_for_taker(
taker_order: &Order,
slot: u64,
) -> DriftResult<bool> {
// Maker and taker order not allowed to match if both were placed in the current slot
if slot == maker_order.slot && slot == taker_order.slot && !maker_order.is_jit_maker() {
return Ok(false);
};
// Self match protection handled upstream via maker_key != taker_key check.
// Removed slot equality restriction to enable same slot fills.

// taker cant be post only and maker must be resting limit order
if taker_order.post_only || !maker_order.is_resting_limit_order(slot)? {
Expand Down
49 changes: 49 additions & 0 deletions programs/drift/src/math/matching/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,55 @@ mod is_maker_for_taker {

assert_eq!(is_maker_for_taker(&maker, &taker, slot).unwrap(), true);
}

#[test]
fn same_slot_maker_taker_non_resting() {
let slot = 0;

// Taker market order
let taker = Order {
post_only: false,
order_type: OrderType::Market,
slot: 0,
..Default::default()
};

// Maker resting with 0 auction
let maker = Order {
post_only: false,
order_type: OrderType::Limit,
slot: 0,
auction_duration: 0,
..Default::default()
};

assert_eq!(is_maker_for_taker(&maker, &taker, slot).unwrap(), true);
}

#[test]
fn same_slot_maker_taker_both_resting() {
let slot = 20;

// Resting taker order
let taker = Order {
post_only: false,
order_type: OrderType::Limit,
slot: 10,
auction_duration: 5,
..Default::default()
};

// Resting maker order (older)
let maker = Order {
post_only: false,
order_type: OrderType::Limit,
slot: 5,
auction_duration: 2,
..Default::default()
};

assert_eq!(is_maker_for_taker(&maker, &taker, slot).unwrap(), true);
}
}

#[test]
Expand Down
Loading