Skip to content

Commit

Permalink
build(fee): add events to l2 cost
Browse files Browse the repository at this point in the history
  • Loading branch information
nimrod-starkware committed Aug 28, 2024
1 parent d4616c2 commit fc82229
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions crates/blockifier/src/transaction/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,18 +432,13 @@ impl StarknetResources {
versioned_constants: &VersionedConstants,
include_l2_gas: bool,
) -> GasVector {
if include_l2_gas {
todo!()
} else {
let l2_resource_gas_costs = &versioned_constants.l2_resource_gas_costs;
let (event_key_factor, data_word_cost) =
(l2_resource_gas_costs.event_key_factor, l2_resource_gas_costs.gas_per_data_felt);
let l1_gas: u128 = (data_word_cost
* (event_key_factor * self.total_event_keys + self.total_event_data_size))
.to_integer();

GasVector::from_l1_gas(l1_gas)
}
let l2_resource_gas_costs = &versioned_constants.l2_resource_gas_costs;
let (event_key_factor, data_word_cost) =
(l2_resource_gas_costs.event_key_factor, l2_resource_gas_costs.gas_per_data_felt);
let gas: u128 = (data_word_cost
* (event_key_factor * self.total_event_keys + self.total_event_data_size))
.to_integer();
if include_l2_gas { GasVector::from_l2_gas(gas) } else { GasVector::from_l1_gas(gas) }
}

pub fn get_onchain_data_segment_length(&self) -> usize {
Expand Down

0 comments on commit fc82229

Please sign in to comment.