From 6541e23916bb183e59d249bca05cc185bc37637c Mon Sep 17 00:00:00 2001 From: Arni Hod Date: Thu, 28 Nov 2024 10:53:27 +0200 Subject: [PATCH] chore(batcher): set temp gas prices in propose block input --- .../src/sequencer_consensus_context.rs | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs b/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs index 99274e1271b..fe9b88b416e 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs +++ b/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs @@ -28,7 +28,15 @@ use papyrus_protobuf::consensus::{ TransactionBatch, Vote, }; -use starknet_api::block::{BlockHash, BlockHashAndNumber, BlockInfo, BlockNumber}; +use starknet_api::block::{ + BlockHash, + BlockHashAndNumber, + BlockInfo, + BlockNumber, + GasPriceVector, + GasPrices, + NonzeroGasPrice, +}; use starknet_api::executable_transaction::Transaction; use starknet_batcher_types::batcher_types::{ DecisionReachedInput, @@ -45,6 +53,20 @@ use starknet_batcher_types::batcher_types::{ use starknet_batcher_types::communication::BatcherClient; use tracing::{debug, debug_span, error, info, trace, warn, Instrument}; +// TODO(Dan, Matan): Remove this once and replace with real gas prices. +const TEMPORARY_GAS_PRICES: GasPrices = GasPrices { + eth_gas_prices: GasPriceVector { + l1_gas_price: NonzeroGasPrice::MIN, + l1_data_gas_price: NonzeroGasPrice::MIN, + l2_gas_price: NonzeroGasPrice::MIN, + }, + strk_gas_prices: GasPriceVector { + l1_gas_price: NonzeroGasPrice::MIN, + l1_data_gas_price: NonzeroGasPrice::MIN, + l2_gas_price: NonzeroGasPrice::MIN, + }, +}; + // {height: {proposal_id: (content, [proposal_ids])}} // Note that multiple proposals IDs can be associated with the same content, but we only need to // store one of them. @@ -115,8 +137,12 @@ impl ConsensusContext for SequencerConsensusContext { number: BlockNumber::default(), hash: BlockHash::default(), }), - // TODO: Fill block info. - block_info: BlockInfo { block_number: proposal_init.height, ..Default::default() }, + // TODO(Dan, Matan): Fill block info. + block_info: BlockInfo { + block_number: proposal_init.height, + gas_prices: TEMPORARY_GAS_PRICES, + ..Default::default() + }, }; self.maybe_start_height(proposal_init.height).await; // TODO: Should we be returning an error? @@ -174,8 +200,12 @@ impl ConsensusContext for SequencerConsensusContext { number: BlockNumber::default(), hash: BlockHash::default(), }), - // TODO: Fill block info. - block_info: BlockInfo { block_number: height, ..Default::default() }, + // TODO(Dan, Matan): Fill block info. + block_info: BlockInfo { + block_number: height, + gas_prices: TEMPORARY_GAS_PRICES, + ..Default::default() + }, }; self.maybe_start_height(height).await; batcher.validate_block(input).await.expect("Failed to initiate proposal validation");