Skip to content

Commit

Permalink
add extra space
Browse files Browse the repository at this point in the history
  • Loading branch information
guibescos committed Aug 20, 2024
1 parent 6ac6b37 commit 2ba238d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
14 changes: 8 additions & 6 deletions staking/programs/integrity-pool/src/state/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@ use {
#[derive(AnchorSerialize, AnchorDeserialize, Debug, Clone, Copy, Zeroable, Pod, PartialEq, Eq)]
#[repr(C)]
pub struct Event {
pub epoch: u64,
pub epoch: u64,
// storing historical values of y
pub y: frac64,
pub event_data: [PublisherEventData; MAX_PUBLISHERS],
pub y: frac64,
pub extra_space: [frac64; 7],
pub event_data: [PublisherEventData; MAX_PUBLISHERS],
}

impl Default for Event {
fn default() -> Self {
Self {
epoch: 0,
y: 0,
event_data: [PublisherEventData::default(); MAX_PUBLISHERS],
epoch: 0,
y: 0,
extra_space: [0; 7],
event_data: [PublisherEventData::default(); MAX_PUBLISHERS],
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions staking/programs/integrity-pool/src/state/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,10 @@ mod tests {


let mut event = Event {
epoch: 1,
y: FRAC_64_MULTIPLIER / 10, // 10%
event_data: [PublisherEventData::default(); MAX_PUBLISHERS],
epoch: 1,
y: FRAC_64_MULTIPLIER / 10, // 10%
extra_space: [0; 7],
event_data: [PublisherEventData::default(); MAX_PUBLISHERS],
};

event.event_data[publisher_index] = PublisherEventData {
Expand Down

0 comments on commit 2ba238d

Please sign in to comment.