Skip to content

Commit

Permalink
fix(blockifier): enforce fee for allresourcebounds when l1 gas is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
aner-starkware committed Sep 16, 2024
1 parent 38cefc8 commit 808d19d
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions crates/blockifier/src/transaction/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,22 @@ impl TransactionInfo {

pub fn enforce_fee(&self) -> bool {
match self {
TransactionInfo::Current(context) => {
let l1_bounds = context.l1_resource_bounds();
let max_amount: u128 = l1_bounds.max_amount.into();
max_amount * l1_bounds.max_price_per_unit > 0
}
TransactionInfo::Current(context) => match &context.resource_bounds {
ValidResourceBounds::L1Gas(l1_bounds) => {
let max_amount: u128 = l1_bounds.max_amount.into();
max_amount * l1_bounds.max_price_per_unit > 0
}
ValidResourceBounds::AllResources(AllResourceBounds {
l1_gas,
l2_gas,
l1_data_gas,
}) => {
u128::from(l1_gas.max_amount) * l1_gas.max_price_per_unit
+ u128::from(l2_gas.max_amount) * l2_gas.max_price_per_unit
+ u128::from(l1_data_gas.max_amount) * l1_data_gas.max_price_per_unit
> 0
}
},
TransactionInfo::Deprecated(context) => context.max_fee != Fee(0),
}
}
Expand Down

0 comments on commit 808d19d

Please sign in to comment.