Compute health based on two prices (#298)
Now the oracle price and a "safe" price go into the health computation and init health uses the min of both for assets and the max for liabs. This has far-reaching consequences for how serum and perp health need to be computed because many intermediate values depend on the prices, which now differ for init and maint health computations. The biggest change is that the serum3 reservation totals need to be done for each health call from scratch. This PR increases the health CU host per serum3 market and perp market significantly, check the test_health_compute tests.
This commit is contained in:
parent
860696f74b
commit
6ea7eddcb3
File diff suppressed because it is too large
Load Diff
|
@ -39,7 +39,7 @@ async fn test_health_compute_tokens() -> Result<(), TransportError> {
|
||||||
create_funded_account(&solana, group, owner, 0, &context.users[1], mints, 1000, 0).await;
|
create_funded_account(&solana, group, owner, 0, &context.users[1], mints, 1000, 0).await;
|
||||||
|
|
||||||
// TODO: actual explicit CU comparisons.
|
// TODO: actual explicit CU comparisons.
|
||||||
// On 2022-5-25 the final deposit costs 36905 CU and each new token increases it by roughly 1600 CU
|
// On 2022-11-18 the final deposit costs 45495 CU and each new token increases it by roughly 1729 CU
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ async fn test_health_compute_serum() -> Result<(), TransportError> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: actual explicit CU comparisons.
|
// TODO: actual explicit CU comparisons.
|
||||||
// On 2022-6-21 the final deposit costs 54074 CU and each new market increases it by roughly 4500 CU
|
// On 2022-11-18 the final deposit costs 62920 CU and each new market increases it by roughly 4820 CU
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ async fn test_health_compute_perp() -> Result<(), TransportError> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: actual explicit CU comparisons.
|
// TODO: actual explicit CU comparisons.
|
||||||
// On 2022-5-25 the final deposit costs 32700 CU and each new market increases it by roughly 1500 CU
|
// On 2022-11-18 the final deposit costs 50502 CU and each new market increases it by roughly 3037 CU
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue