Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
feat(fee): add n_events field to BouncerInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
ayeletstarkware committed Feb 13, 2024
1 parent fdfba79 commit 4d761f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/blockifier/src/execution/bouncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ use crate::abi::constants;
use crate::transaction::objects::{ResourcesMapping, TransactionExecutionResult};

#[derive(Clone, Default)]
// TODO(Ayelet, 24/01/2024): Consider remove message_segment_length, state_diff_size.
pub struct BouncerInfo {
pub state_diff_size: usize, // The number of felts needed to store the state diff.
pub l1_gas_amount: usize,
pub message_segment_length: usize, // The number of felts needed to store L1<>L2 messages.
pub execution_resources: VmExecutionResources,
// TODO(Ayelet, 12/02/2024): Fill this field.
pub n_events: usize,
}

impl BouncerInfo {
Expand Down Expand Up @@ -66,11 +67,15 @@ impl BouncerInfo {
merged_resources.n_steps += merged_resources.n_memory_holes;
merged_resources.n_memory_holes = 0;

// TODO(Ayelet, 12/02/2024): Fill this field.
let n_events = 0;

Ok(Self {
state_diff_size,
l1_gas_amount,
message_segment_length,
execution_resources: merged_resources,
n_events,
})
}
}
3 changes: 3 additions & 0 deletions crates/native_blockifier/src/py_transaction_execution_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ pub struct PyBouncerInfo {
pub message_segment_length: usize, // The number of felts needed to store L1<>L2 messages.
#[pyo3(get)]
pub execution_resources: PyExecutionResources,
#[pyo3(get)]
pub n_events: usize,
}

impl From<BouncerInfo> for PyBouncerInfo {
Expand All @@ -236,6 +238,7 @@ impl From<BouncerInfo> for PyBouncerInfo {
l1_gas_amount: bouncer_info.l1_gas_amount,
message_segment_length: bouncer_info.message_segment_length,
execution_resources: PyExecutionResources::from(bouncer_info.execution_resources),
n_events: bouncer_info.n_events,
}
}
}

0 comments on commit 4d761f1

Please sign in to comment.