assert simple vote tx const cost (#100)

* assert simple vote tx const cost
This commit is contained in:
Tao Zhu 2024-03-06 11:08:49 -06:00 committed by GitHub
parent b6f6fdbc9a
commit c1613517bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 1 deletions

View File

@ -18,8 +18,19 @@ pub enum TransactionCost {
impl TransactionCost {
pub fn sum(&self) -> u64 {
#![allow(clippy::assertions_on_constants)]
match self {
Self::SimpleVote { .. } => SIMPLE_VOTE_USAGE_COST,
Self::SimpleVote { .. } => {
const _: () = assert!(
SIMPLE_VOTE_USAGE_COST
== solana_vote_program::vote_processor::DEFAULT_COMPUTE_UNITS
+ block_cost_limits::SIGNATURE_COST
+ 2 * block_cost_limits::WRITE_LOCK_UNITS
+ 8
);
SIMPLE_VOTE_USAGE_COST
}
Self::Transaction(usage_cost) => usage_cost.sum(),
}
}