diff --git a/Cargo.lock b/Cargo.lock index 1e40a750f..c9da3375f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6372,6 +6372,24 @@ dependencies = [ "tap", ] +[[package]] +name = "x509-parser" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" +dependencies = [ + "asn1-rs", + "base64 0.13.1", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "rusticata-macros", + "thiserror", + "time", +] + [[package]] name = "xattr" version = "1.3.1" diff --git a/programs/manifest/src/state/market.rs b/programs/manifest/src/state/market.rs index 8ee66d3de..2df515174 100644 --- a/programs/manifest/src/state/market.rs +++ b/programs/manifest/src/state/market.rs @@ -861,10 +861,8 @@ impl, Dynamic: DerefOrBorrowMut<[u8]>> } } - // TODO: Remove the silent failures - // Silently fails because order could have matched before our cancel got - // there and that is correct behavior in that case. - Ok(()) + // Do not fail silently. + Err(ManifestError::InvalidCancel.into()) } pub fn cancel_order_by_index( diff --git a/programs/manifest/tests/cases/cancel_order.rs b/programs/manifest/tests/cases/cancel_order.rs index 9168451aa..7a3155d06 100644 --- a/programs/manifest/tests/cases/cancel_order.rs +++ b/programs/manifest/tests/cases/cancel_order.rs @@ -95,8 +95,8 @@ async fn cancel_order_sequence_number_not_exist_test() -> anyhow::Result<()> { .place_order(Side::Ask, 1, 1, 0, u32::MAX, OrderType::Limit) .await?; - // Sequence number does not exist, but it fails open. - test_fixture.cancel_order(1234).await?; + // Sequence number does not exist. It fails closed. + assert!(test_fixture.cancel_order(1234).await.is_err()); Ok(()) }