Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add extra space #493

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading