Skip to content

Commit

Permalink
refactor(batcher): rename ExecutionConfig to BlockBuilderConfig (#1412)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayeletstarkware authored Oct 15, 2024
1 parent 485f608 commit b27e000
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions crates/batcher/src/batcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ pub fn create_batcher(config: BatcherConfig, mempool_client: SharedMempoolClient
.expect("Failed to open batcher's storage");

// TODO(Arni): use real config - add as part of batcher config.
let execution_config = BlockBuilderConfig::default();
let block_builder_config = BlockBuilderConfig::default();
let cache_size = 100;

let block_builder_factory = Arc::new(BlockBuilderFactory {
execution_config,
block_builder_config,
storage_reader: storage_reader.clone(),
global_class_hash_to_class: GlobalContractCache::new(cache_size),
});
Expand Down
18 changes: 9 additions & 9 deletions crates/batcher/src/block_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ pub trait BlockBuilderFactoryTrait {
}

pub struct BlockBuilderFactory {
pub execution_config: BlockBuilderConfig,
pub block_builder_config: BlockBuilderConfig,
pub storage_reader: StorageReader,
pub global_class_hash_to_class: GlobalContractCache,
}
Expand All @@ -251,25 +251,25 @@ impl BlockBuilderFactory {
height: BlockNumber,
retrospective_block_hash: Option<BlockNumberHashPair>,
) -> BlockBuilderResult<TransactionExecutor<PapyrusReader>> {
let execution_config = self.execution_config.clone();
let block_builder_config = self.block_builder_config.clone();
let next_block_info = BlockInfo {
block_number: height,
block_timestamp: BlockTimestamp(chrono::Utc::now().timestamp().try_into()?),
sequencer_address: execution_config.sequencer_address,
sequencer_address: block_builder_config.sequencer_address,
// TODO (yael 7/10/2024): add logic to compute gas prices
gas_prices: {
let tmp_val = NonzeroGasPrice::MIN;
GasPrices::new(tmp_val, tmp_val, tmp_val, tmp_val, tmp_val, tmp_val)
},
use_kzg_da: execution_config.use_kzg_da,
use_kzg_da: block_builder_config.use_kzg_da,
};
let block_context = BlockContext::new(
next_block_info,
execution_config.chain_info,
block_builder_config.chain_info,
VersionedConstants::get_versioned_constants(
execution_config.versioned_constants_overrides,
block_builder_config.versioned_constants_overrides,
),
execution_config.bouncer_config,
block_builder_config.bouncer_config,
);

// TODO(Yael: 8/9/2024) Need to reconsider which StateReader to use. the papyrus execution
Expand All @@ -288,7 +288,7 @@ impl BlockBuilderFactory {
state_reader,
block_context,
retrospective_block_hash,
execution_config.execute_config,
block_builder_config.execute_config,
)?;

Ok(executor)
Expand All @@ -303,7 +303,7 @@ impl BlockBuilderFactoryTrait for BlockBuilderFactory {
) -> BlockBuilderResult<Box<dyn BlockBuilderTrait>> {
let executor =
self.preprocess_and_create_transaction_executor(height, retrospective_block_hash)?;
Ok(Box::new(BlockBuilder::new(Box::new(executor), self.execution_config.tx_chunk_size)))
Ok(Box::new(BlockBuilder::new(Box::new(executor), self.block_builder_config.tx_chunk_size)))
}
}

Expand Down

0 comments on commit b27e000

Please sign in to comment.