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(vote-program): Update commission instruction #615

Open
wants to merge 7 commits into
base: dade/vote-program-update-identity
Choose a base branch
from

Conversation

dadepo
Copy link
Contributor

@dadepo dadepo commented Mar 12, 2025

The commission is the percentage that represents what part of a rewards payout should be given to a VoteAccoun, while the rest would be distributed to the delegates.

This PR implements the instruction for updating a vote account's commission. It also adds feature sets which are needed for this instruction.

Copy link

codecov bot commented Mar 12, 2025

Codecov Report

Attention: Patch coverage is 99.41520% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/runtime/program/vote/execute.zig 99.34% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/runtime/feature_set.zig 100.00% <100.00%> (ø)
src/runtime/instruction_context.zig 94.11% <100.00%> (+0.78%) ⬆️
src/runtime/program/vote/state.zig 87.38% <100.00%> (+0.47%) ⬆️
src/runtime/program/vote/execute.zig 96.26% <99.34%> (+1.32%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dadepo dadepo marked this pull request as ready for review March 13, 2025 20:12
@dadepo dadepo requested review from 0xNineteen and yewman March 13, 2025 20:12
Copy link
Contributor

@0xNineteen 0xNineteen left a comment

Choose a reason for hiding this comment

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

few nits otherwise lgtm

Comment on lines +505 to +506
/// Agave https://github.com/anza-xyz/solana-sdk/blob/69edb584ac17df2f5d8b5e817d7afede7877eded/vote-interface/src/instruction.rs#L415
fn updateCommission(
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines +36 to +40
pub const allow_commission_decrease_at_any_time =
Pubkey.parseBase58String("5x3825XS7M2A3Ekbn5VGGkvFoAg5qrRWkTrY4bARP1GL") catch unreachable;

pub const commission_updates_only_allowed_in_first_half_of_epoch =
Pubkey.parseBase58String("noRuG2kzACwgaY7TVmLRnUNPLKNVQE1fb7X55YWBehp") catch unreachable;
Copy link
Contributor

Choose a reason for hiding this comment

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

can we declare constants these at the top of the struct

Comment on lines +71 to +76
pub fn getSysvar(
self: *const InstructionContext,
comptime T: type,
) InstructionError!T {
return self.tc.sysvar_cache.get(T) orelse InstructionError.UnsupportedSysvar;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

do we use this anywhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

2 participants