From 37ca509fda6f27779e5eda4e9a53f3ab8fbbfad7 Mon Sep 17 00:00:00 2001 From: Arni Hod Date: Thu, 28 Nov 2024 10:53:27 +0200 Subject: [PATCH] chore(starknet_batcher): set temp gas prices in propose block input --- .../src/sequencer_consensus_context.rs | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 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 c3b9281b53..7a25f8582c 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, @@ -47,6 +55,20 @@ use tokio::sync::Notify; use tokio::task::JoinHandle; 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. @@ -131,8 +153,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() + }, }; // TODO: Should we be returning an error? // I think this implies defining an error type in this crate and moving the trait definition @@ -310,7 +336,11 @@ impl SequencerConsensusContext { hash: BlockHash::default(), }), // TODO: Fill block info. - block_info: BlockInfo { block_number: height, ..Default::default() }, + block_info: BlockInfo { + block_number: height, + gas_prices: TEMPORARY_GAS_PRICES, + ..Default::default() + }, }; batcher.validate_block(input).await.expect("Failed to initiate proposal validation");