Skip to content

Commit

Permalink
chore(batcher): set temp gas prices in propose block input
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware committed Nov 28, 2024
1 parent 9ad8065 commit 6541e23
Showing 1 changed file with 35 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 6541e23

Please sign in to comment.