From 816078e06343da0d03354da10cfc3f03148014df Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Wed, 13 Sep 2023 09:41:13 +0200 Subject: [PATCH] Changelog, version bump for program v0.19.1 --- CHANGELOG.md | 21 +++++++++-- Cargo.lock | 2 +- mango_v4.json | 35 ++++++++++++++++-- programs/mango-v4/Cargo.toml | 2 +- ts/client/src/mango_v4.ts | 70 +++++++++++++++++++++++++++++++++--- 5 files changed, 119 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea830bde3..3c0be4350 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,24 @@ Update this for each program release and mainnet deployment. ## not on mainnet -### v0.19.0, 2023-8- +### v0.19.1, 2023-9- + +- Fix a health overestimation with OpenBook open orders + + When bids or asks crossed the oracle price, the serum3 health would be + overestimated before. + + Now we track an account's max bid and min ask in each market and use that + as a worst-case price. The tracking isn't perfect for technical reasons + (compute cost, no notifications on fill) but produces an upper bound on + bids (lower bound on asks) that is sufficient to make health not + overestimate. + +## mainnet + +### v0.19.0, 2023-9-7 + +Deployment: Sep 7, 2023 at 13:10:08 Central European Summer Time, https://explorer.solana.com/tx/3xcQWmAinBjFF4QgUCS7v5KxS7CjUQMJmENBHMyMMoeNCdKpLQL6fJXcKRRDmzW4ajPUywgPxBzMoYJn9c8CteEP - Token deposits and withdraws: Allow full withdraw or full borrow repays even when the oracle is stale (#646, #675) @@ -56,8 +73,6 @@ Update this for each program release and mainnet deployment. - Flash loan: Better errors for missing banks (#639) - OpenBook v2 integration: First draft of instructions (#628) -## mainnet - ### v0.18.0, 2023-7-28 Deployment: Jul 28, 2023 at 08:29:46 Central European Summer Time, https://explorer.solana.com/tx/TaPcQ8dUDyFEaqprasGVEeG3x4Z2nMT7jY9tr2G8KVVf3kvDUQv8TRTjzDirasx3YkyYq3PmQcmcMbCcHsAnUNT diff --git a/Cargo.lock b/Cargo.lock index 7d19bb413..e1aad8e46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2937,7 +2937,7 @@ dependencies = [ [[package]] name = "mango-v4" -version = "0.19.0" +version = "0.19.1" dependencies = [ "anchor-lang", "anchor-spl", diff --git a/mango_v4.json b/mango_v4.json index 8abfc7723..0ad6c98f5 100644 --- a/mango_v4.json +++ b/mango_v4.json @@ -1,5 +1,5 @@ { - "version": "0.19.0", + "version": "0.19.1", "name": "mango_v4", "instructions": [ { @@ -8019,6 +8019,18 @@ "defined": "I80F48" } }, + { + "name": "reservedBaseAsQuoteLowestAsk", + "type": { + "defined": "I80F48" + } + }, + { + "name": "reservedQuoteAsBaseHighestBid", + "type": { + "defined": "I80F48" + } + }, { "name": "baseInfoIndex", "type": "u64" @@ -8400,12 +8412,31 @@ ] } }, + { + "name": "highestPlacedBidInv", + "docs": [ + "Track something like the highest open bid / lowest open ask, in native/native units.", + "", + "Tracking it exactly isn't possible since we don't see fills. So instead track", + "the min/max of the _placed_ bids and asks.", + "", + "The value is reset in serum3_place_order when a new order is placed without an", + "existing one on the book.", + "", + "0 is a special \"unset\" state." + ], + "type": "f64" + }, + { + "name": "lowestPlacedAsk", + "type": "f64" + }, { "name": "reserved", "type": { "array": [ "u8", - 64 + 48 ] } } diff --git a/programs/mango-v4/Cargo.toml b/programs/mango-v4/Cargo.toml index be21bfe4f..6fdbd7de3 100644 --- a/programs/mango-v4/Cargo.toml +++ b/programs/mango-v4/Cargo.toml @@ -2,7 +2,7 @@ cargo-features = ["workspace-inheritance"] [package] name = "mango-v4" -version = "0.19.0" +version = "0.19.1" description = "Created with Anchor" edition = "2021" diff --git a/ts/client/src/mango_v4.ts b/ts/client/src/mango_v4.ts index 6d88385e5..97f26571a 100644 --- a/ts/client/src/mango_v4.ts +++ b/ts/client/src/mango_v4.ts @@ -1,5 +1,5 @@ export type MangoV4 = { - "version": "0.19.0", + "version": "0.19.1", "name": "mango_v4", "instructions": [ { @@ -8019,6 +8019,18 @@ export type MangoV4 = { "defined": "I80F48" } }, + { + "name": "reservedBaseAsQuoteLowestAsk", + "type": { + "defined": "I80F48" + } + }, + { + "name": "reservedQuoteAsBaseHighestBid", + "type": { + "defined": "I80F48" + } + }, { "name": "baseInfoIndex", "type": "u64" @@ -8400,12 +8412,31 @@ export type MangoV4 = { ] } }, + { + "name": "highestPlacedBidInv", + "docs": [ + "Track something like the highest open bid / lowest open ask, in native/native units.", + "", + "Tracking it exactly isn't possible since we don't see fills. So instead track", + "the min/max of the _placed_ bids and asks.", + "", + "The value is reset in serum3_place_order when a new order is placed without an", + "existing one on the book.", + "", + "0 is a special \"unset\" state." + ], + "type": "f64" + }, + { + "name": "lowestPlacedAsk", + "type": "f64" + }, { "name": "reserved", "type": { "array": [ "u8", - 64 + 48 ] } } @@ -12562,7 +12593,7 @@ export type MangoV4 = { }; export const IDL: MangoV4 = { - "version": "0.19.0", + "version": "0.19.1", "name": "mango_v4", "instructions": [ { @@ -20582,6 +20613,18 @@ export const IDL: MangoV4 = { "defined": "I80F48" } }, + { + "name": "reservedBaseAsQuoteLowestAsk", + "type": { + "defined": "I80F48" + } + }, + { + "name": "reservedQuoteAsBaseHighestBid", + "type": { + "defined": "I80F48" + } + }, { "name": "baseInfoIndex", "type": "u64" @@ -20963,12 +21006,31 @@ export const IDL: MangoV4 = { ] } }, + { + "name": "highestPlacedBidInv", + "docs": [ + "Track something like the highest open bid / lowest open ask, in native/native units.", + "", + "Tracking it exactly isn't possible since we don't see fills. So instead track", + "the min/max of the _placed_ bids and asks.", + "", + "The value is reset in serum3_place_order when a new order is placed without an", + "existing one on the book.", + "", + "0 is a special \"unset\" state." + ], + "type": "f64" + }, + { + "name": "lowestPlacedAsk", + "type": "f64" + }, { "name": "reserved", "type": { "array": [ "u8", - 64 + 48 ] } }