-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
programs/rewards/src/state/mining.rs
Outdated
@@ -32,6 +32,9 @@ pub struct WrappedImmutableMining<'a> { | |||
pub weighted_stake_diffs: &'a MiningWeightedStakeDiffs, | |||
} | |||
|
|||
pub const ACCOUNT_TYPE_BIT: usize = 0; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)?; | ||
|
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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], |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Co-authored-by: Stanislav Cherviakov <stchervyakov@gmail.com>
No description provided.