Skip to content

Commit

Permalink
assert simple vote tx const cost (#100)
Browse files Browse the repository at this point in the history
* assert simple vote tx const cost
  • Loading branch information
tao-stones authored and willhickey committed Mar 9, 2024
1 parent 1f7e6f2 commit c954939
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cost-model/src/transaction_cost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}
Expand Down

0 comments on commit c954939

Please sign in to comment.