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: implemented the get_flag_index_deltas and process_rewards_and_penalties functions #94

Merged
merged 3 commits into from
Feb 12, 2025

Conversation

Kayden-ML
Copy link
Contributor

@Kayden-ML Kayden-ML commented Feb 11, 2025

@Kayden-ML Kayden-ML changed the title feat: implemented the get_flag_index_deltas function feat: implemented the get_flag_index_deltas and process_rewards_and_penalties functions Feb 11, 2025
Copy link
Contributor

@jihoonsong jihoonsong left a comment

Choose a reason for hiding this comment

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

It closely followed the spec making it easier to read, nice!

Comment on lines 1653 to 1663
let mut flag_deltas = vec![];

for flag_index in 0..PARTICIPATION_FLAG_WEIGHTS.len() {
let delta = self.get_flag_index_deltas(flag_index as u8)?;
flag_deltas.push(delta);
}

let (penalties_rewards, penalties) = self.get_inactivity_penalty_deltas()?;

let mut deltas = flag_deltas;
deltas.push((penalties_rewards, penalties));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let mut flag_deltas = vec![];
for flag_index in 0..PARTICIPATION_FLAG_WEIGHTS.len() {
let delta = self.get_flag_index_deltas(flag_index as u8)?;
flag_deltas.push(delta);
}
let (penalties_rewards, penalties) = self.get_inactivity_penalty_deltas()?;
let mut deltas = flag_deltas;
deltas.push((penalties_rewards, penalties));
let mut deltas = vec![];
for flag_index in 0..PARTICIPATION_FLAG_WEIGHTS.len() {
deltas.push(self.get_flag_index_deltas(flag_index as u8)?);
}
deltas.push(self.get_inactivity_penalty_deltas()?);

How about this?

@Kayden-ML Kayden-ML added this pull request to the merge queue Feb 12, 2025
Merged via the queue into ReamLabs:master with commit 518d1f8 Feb 12, 2025
5 checks passed
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