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

[mtg-578] Penalties/block the clam operation #39

Merged
merged 8 commits into from
Sep 3, 2024

Conversation

kstepanovdev
Copy link
Collaborator

No description provided.

@kstepanovdev kstepanovdev requested review from StanChe and rwwwx August 30, 2024 12:17
@kstepanovdev kstepanovdev self-assigned this Aug 30, 2024
programs/rewards/src/error.rs Outdated Show resolved Hide resolved
@@ -32,6 +32,9 @@ pub struct WrappedImmutableMining<'a> {
pub weighted_stake_diffs: &'a MiningWeightedStakeDiffs,
}

pub const ACCOUNT_TYPE_BIT: usize = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Right now it's byte, not bit. But using bits for that kind of bools makes sense as we're introducing several restrictions. Wdyt of using a bitmap?

Copy link
Collaborator Author

@kstepanovdev kstepanovdev Sep 2, 2024

Choose a reason for hiding this comment

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

If you mean a dedicated structure from some crate (or self-written), I'm not sure it may be used without headache with Pod because bool is an u8 in fact and bool is not Pod.


let mining_data = &mut (*mining.data).borrow_mut();
let wrapped_mining = WrappedMining::from_bytes_mut(mining_data)?;

Copy link
Collaborator

Choose a reason for hiding this comment

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

Mining is not related to pool (potentially)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could you please explain what you mean? Mining is a PDA from a pool's address.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

However, it's used to verify the signer is that program which was expected.

/// 2-7: unused
/// 0: account type
/// 1: claim is restricted
/// 2-6: unused
pub data: [u8; 7],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not put the data in the named fields?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I consider it tedious to re-shuffle the memory layout each time. Also, see no benefits for having it as a dedicated bool.

@kstepanovdev kstepanovdev requested a review from StanChe September 2, 2024 12:30
@kstepanovdev kstepanovdev merged commit f221500 into main Sep 3, 2024
3 checks passed
@kstepanovdev kstepanovdev deleted the penalties/block-the-clam-operation branch September 3, 2024 08:11
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