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

Realloc instructions #20

Merged
merged 10 commits into from
Dec 17, 2024
Merged

Realloc instructions #20

merged 10 commits into from
Dec 17, 2024

Conversation

ebatsell
Copy link
Collaborator

@ebatsell ebatsell commented Dec 12, 2024

  • also standardizes on epoch over ncn_epoch in instructions

notes to self

  • can remove restaking_config from some accounts
  • need to update ncn_epoch->epoch variable name in a few places still

@ebatsell ebatsell marked this pull request as ready for review December 13, 2024 20:01
Copy link
Collaborator

@coachchucksol coachchucksol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple things to finish up

core/src/epoch_snapshot.rs Outdated Show resolved Hide resolved
integration_tests/tests/fixtures/test_builder.rs Outdated Show resolved Hide resolved
program/src/cast_vote.rs Outdated Show resolved Hide resolved
program/src/initialize_ncn_reward_router.rs Outdated Show resolved Hide resolved
realloc(ballot_box, new_size, payer, &Rent::get()?)?;
}

if ballot_box.data_len() >= BallotBox::SIZE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit suggestion - which could be applied to all realloc functions:

let should_initailize = ballot_box.data_len() >= BallotBox::SIZE && ballot_box.try_borrow_data()?[0] != BallotBox::DISCRIMINATOR

if should_initailize {
ballot_box.initalize()
}

let current_slot = Clock::get()?.slot;
let (_, ncn_epoch_length) = load_ncn_epoch(restaking_config, current_slot, None)?;

//TODO move to helper function
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good argument for the suggested nit above.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: TODO

program/src/realloc_weight_table.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@coachchucksol coachchucksol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits otherwise lgtm

let current_slot = Clock::get()?.slot;
let (_, ncn_epoch_length) = load_ncn_epoch(restaking_config, current_slot, None)?;

//TODO move to helper function
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: TODO

@@ -65,8 +63,12 @@ pub fn process_route_ncn_rewards(

let rent_cost = ncn_reward_router_account.rent_cost(&Rent::get()?)?;

msg!("A");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Remove

@ebatsell ebatsell merged commit 9b15dda into master Dec 17, 2024
2 of 4 checks passed
@ebatsell ebatsell deleted the eb/realloc branch December 17, 2024 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants