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

TransactionCost::SimpleVote doesn't report correct number of sigs for two-sig votes #353

Open
steviez opened this issue Mar 21, 2024 · 2 comments
Assignees

Comments

@steviez
Copy link

steviez commented Mar 21, 2024

Problem

TransactionCost has two cases in the enum; SimpleVote and Transaction. A SimpleVote is defined by these things:

/// SimpleVote has a simpler and pre-determined format: it has 1 or 2 signatures,
/// 2 write locks, a vote instruction and less than 32k (page size) accounts to load.
/// It's cost therefore can be static #33269.

Note that a SimpleVote can contain 1 or 2 signatures, but TransactionCost::num_transaction_signatures() reports a fixed value of 1 for simple votes:

pub fn num_transaction_signatures(&self) -> u64 {
match self {
Self::SimpleVote { .. } => 1,
Self::Transaction(usage_cost) => usage_cost.num_transaction_signatures,
}
}

This doesn't affect actual fees (the fee-payer will still be charged for 2 sigs) or CU's in the way things are currently written, but for the sake of accurate counting, it is incorrect.

Proposed Solution

Update SimpleVote to track the number of signatures:

SimpleVote { writable_accounts: Vec<Pubkey> },

and populate that field here:

TransactionCost::SimpleVote {
writable_accounts: Self::get_writable_accounts(transaction),
}

@steviez
Copy link
Author

steviez commented Mar 21, 2024

Not super high priority to fix at the moment, one of us will pick it up eventually

@apfitzge
Copy link

Just want to clarify here for later - transactions are still charged the correct fee, for 2 signatures, it is just not properly accounted for by cost-model.

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

No branches or pull requests

3 participants