Skip to content

feat: VoteStateV4 goodies#331

Closed
ksn6 wants to merge 4 commits intoanza-xyz:masterfrom
ksn6:convert-vote-state-v4-to-vote-state-v3
Closed

feat: VoteStateV4 goodies#331
ksn6 wants to merge 4 commits intoanza-xyz:masterfrom
ksn6:convert-vote-state-v4-to-vote-state-v3

Conversation

@ksn6
Copy link
Copy Markdown

@ksn6 ksn6 commented Sep 19, 2025

No description provided.

@ksn6 ksn6 requested review from buffalojoec and jstarry September 19, 2025 05:35
@jstarry
Copy link
Copy Markdown
Contributor

jstarry commented Sep 19, 2025

This is a lossy conversion. Can you explain why this would be needed? I don't think we want this

@ksn6
Copy link
Copy Markdown
Author

ksn6 commented Sep 19, 2025

This is a lossy conversion. Can you explain why this would be needed? I don't think we want this

https://github.com/anza-xyz/agave/blob/3684e5825abf375e9318a0bf9ccca1e8edfc0a7e/programs/vote/src/vote_state/handler.rs#L393

How would we handle the above function for set_vote_account_state? Should we panic if the account isn't large enough to store the vote state?

@ksn6 ksn6 changed the title feat: convert VoteStateV4 to VoteStateV3 feat: VoteStateV4 goodies Sep 19, 2025
pub authorized_voter: Pubkey,
pub authorized_withdrawer: Pubkey,
pub commission: u8,

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@jstarry @buffalojoec - should we add in fields for the inflation bps and block rewards bps commissions?


impl VoteStateV4 {
pub fn new(vote_init: &VoteInit, clock: &Clock) -> Self {
let inflation_rewards_commission_bps = (vote_init.commission as u16)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@jstarry @buffalojoec - leaving this as a placeholder, though we probably don't want to do this. My guess is that we want VoteInit to have both commission bps fields.

}

pub fn commission(&self) -> Result<u8, InstructionError> {
let commission_bps = self
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

(same here)

@jstarry
Copy link
Copy Markdown
Contributor

jstarry commented Sep 22, 2025

We can close this in favor of anza-xyz/agave#8108 / anza-xyz/agave#8120

@ksn6 ksn6 closed this Sep 22, 2025
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