Skip to content

Commit

Permalink
feat(starknet_batcher): add l2 gas used to decision_reached (#2950)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayeletstarkware authored Dec 26, 2024
1 parent 148491d commit 55158fd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/starknet_batcher/src/batcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,10 @@ impl Batcher {
block_execution_artifacts.tx_hashes(),
)
.await?;
Ok(DecisionReachedResponse { state_diff })
Ok(DecisionReachedResponse {
state_diff,
l2_gas_used: block_execution_artifacts.l2_gas_used,
})
}

async fn commit_proposal_and_block(
Expand Down
1 change: 1 addition & 0 deletions crates/starknet_batcher/src/batcher_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ async fn decision_reached() {
let response =
batcher.decision_reached(DecisionReachedInput { proposal_id: PROPOSAL_ID }).await.unwrap();
assert_eq!(response.state_diff, expected_artifacts.state_diff());
assert_eq!(response.l2_gas_used, expected_artifacts.l2_gas_used);
}

#[rstest]
Expand Down
2 changes: 2 additions & 0 deletions crates/starknet_batcher_types/src/batcher_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
use starknet_api::block::{BlockHashAndNumber, BlockInfo, BlockNumber};
use starknet_api::core::StateDiffCommitment;
use starknet_api::executable_transaction::Transaction;
use starknet_api::execution_resources::GasAmount;
use starknet_api::state::ThinStateDiff;

use crate::errors::BatcherError;
Expand Down Expand Up @@ -92,6 +93,7 @@ pub struct SendProposalContentResponse {
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct DecisionReachedResponse {
pub state_diff: ThinStateDiff,
pub l2_gas_used: GasAmount,
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
Expand Down

0 comments on commit 55158fd

Please sign in to comment.