Fix PerpMarket data layout breakage

The new fees_settled must be added at the end and the reserved amount
needs to be reduced.
This commit is contained in:
Christian Kamm 2022-09-20 11:40:30 +02:00
parent b7e79a4663
commit 6399e6cb6c
3 changed files with 26 additions and 26 deletions

View File

@ -100,7 +100,7 @@ pub fn perp_create_market(
registration_time: Clock::get()?.unix_timestamp,
padding1: Default::default(),
padding2: Default::default(),
reserved: [0; 128],
reserved: [0; 112],
};
let mut bids = ctx.accounts.bids.load_init()?;

View File

@ -76,9 +76,6 @@ pub struct PerpMarket {
/// Fees accrued in native quote currency
pub fees_accrued: I80F48,
/// Fees settled in native quote currency
pub fees_settled: I80F48,
/// Liquidity mining metadata
/// pub liquidity_mining_info: LiquidityMiningInfo,
@ -94,12 +91,15 @@ pub struct PerpMarket {
pub registration_time: i64,
pub reserved: [u8; 128],
/// Fees settled in native quote currency
pub fees_settled: I80F48,
pub reserved: [u8; 112],
}
const_assert_eq!(
size_of::<PerpMarket>(),
32 + 2 + 2 + 4 + 16 + 32 + 16 + 32 * 3 + 8 * 2 + 16 * 12 + 8 * 2 + 8 * 2 + 16 + 2 + 6 + 8 + 128
32 + 2 + 2 + 4 + 16 + 32 + 16 + 32 * 3 + 8 * 2 + 16 * 12 + 8 * 2 + 8 * 2 + 16 + 2 + 6 + 8 + 112
);
const_assert_eq!(size_of::<PerpMarket>() % 8, 0);

View File

@ -3889,15 +3889,6 @@ export type MangoV4 = {
"defined": "I80F48"
}
},
{
"name": "feesSettled",
"docs": [
"Fees settled in native quote currency"
],
"type": {
"defined": "I80F48"
}
},
{
"name": "bump",
"docs": [
@ -3926,12 +3917,21 @@ export type MangoV4 = {
"name": "registrationTime",
"type": "i64"
},
{
"name": "feesSettled",
"docs": [
"Fees settled in native quote currency"
],
"type": {
"defined": "I80F48"
}
},
{
"name": "reserved",
"type": {
"array": [
"u8",
128
112
]
}
}
@ -9888,15 +9888,6 @@ export const IDL: MangoV4 = {
"defined": "I80F48"
}
},
{
"name": "feesSettled",
"docs": [
"Fees settled in native quote currency"
],
"type": {
"defined": "I80F48"
}
},
{
"name": "bump",
"docs": [
@ -9925,12 +9916,21 @@ export const IDL: MangoV4 = {
"name": "registrationTime",
"type": "i64"
},
{
"name": "feesSettled",
"docs": [
"Fees settled in native quote currency"
],
"type": {
"defined": "I80F48"
}
},
{
"name": "reserved",
"type": {
"array": [
"u8",
128
112
]
}
}