preclude health check restarts and excluding vamm from prelaunch markets

This commit is contained in:
Nour Alharithi
2024-08-02 10:39:09 -07:00
parent 7274cce8e5
commit 579d9bc805
2 changed files with 18 additions and 8 deletions

View File

@@ -136,14 +136,23 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
// Test for oracle staleness to know whether to include vamm
const dlobSlot = this.slotSource.getSlot();
const oracleSlot =
const oracleData =
marketType === 'perp'
? this.driftClient.getOracleDataForPerpMarket(marketArgs.marketIndex)
.slot
: this.driftClient.getOracleDataForSpotMarket(marketArgs.marketIndex)
.slot;
: this.driftClient.getOracleDataForSpotMarket(marketArgs.marketIndex);
const oracleSlot = oracleData.slot;
const isPerpMarketAndPrelaunchMarket =
marketType === 'perp' &&
isVariant(
this.driftClient.getPerpMarketAccount(marketArgs.marketIndex).amm
.oracleSource,
'prelaunch'
);
let includeVamm = marketArgs.includeVamm;
if (dlobSlot - oracleSlot.toNumber() > STALE_ORACLE_REMOVE_VAMM_THRESHOLD) {
if (
dlobSlot - oracleSlot.toNumber() > STALE_ORACLE_REMOVE_VAMM_THRESHOLD &&
!isPerpMarketAndPrelaunchMarket
) {
logger.info('Oracle is stale, removing vamm orders');
includeVamm = false;
}
@@ -203,7 +212,8 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
if (
Math.abs(slot - parseInt(l2Formatted['oracleData']['slot'])) >
this.killSwitchSlotDiffThreshold &&
!skipSlotCheck
!skipSlotCheck &&
!isPerpMarketAndPrelaunchMarket
) {
console.log(`Unhealthy process due to slot diffs for market ${marketName}:
dlobProvider slot: ${slot}

View File

@@ -453,7 +453,7 @@
kuler "^2.0.0"
"@drift-labs/sdk@file:./drift-common/protocol/sdk", "@drift-labs/sdk@file:drift-common/protocol/sdk":
version "2.87.0-beta.5"
version "2.88.0-beta.2"
dependencies:
"@coral-xyz/anchor" "0.28.0"
"@coral-xyz/anchor-30" "npm:@coral-xyz/anchor@0.30.1"
@@ -476,7 +476,7 @@
"@drift/common@file:./drift-common/common-ts":
version "1.0.0"
dependencies:
"@drift-labs/sdk" "file:../../Library/Caches/Yarn/v6/npm-@drift-common-1.0.0-5100cc95-a4ee-4c2f-887c-afd8df503dc6-1722441182380/node_modules/@drift/protocol/sdk"
"@drift-labs/sdk" "file:../../Library/Caches/Yarn/v6/npm-@drift-common-1.0.0-1feb394f-1286-4f02-aa04-2cdc83124014-1722620079611/node_modules/@drift/protocol/sdk"
"@jest/globals" "^29.3.1"
"@slack/web-api" "^6.4.0"
"@solana/spl-token" "^0.3.8"