Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
set block gas limit in pool to 7M
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger committed Oct 30, 2024
1 parent 2c468f5 commit f1e9832
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/client/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
constants::ETH_CHAIN_ID,
constants::{ETH_CHAIN_ID, KAKAROT_BLOCK_GAS_LIMIT},
pool::{
mempool::{KakarotPool, TransactionOrdering},
validate::KakarotTransactionValidatorBuilder,
Expand Down Expand Up @@ -65,6 +65,7 @@ where

let validator = KakarotTransactionValidatorBuilder::new(&Arc::new(ChainSpec {
chain: (*ETH_CHAIN_ID).into(),
max_gas_limit: KAKAROT_BLOCK_GAS_LIMIT,
..Default::default()
}))
.build::<_, EthPooledTransaction>(eth_provider.clone());
Expand Down
3 changes: 3 additions & 0 deletions src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ pub static KAKAROT_RPC_CONFIG: LazyLock<KakarotRpcConfig> =
/// The RPC configuration.
pub static RPC_CONFIG: LazyLock<RPCConfig> =
LazyLock::new(|| RPCConfig::from_env().expect("failed to load RPC config"));

/// The gas limit for Kakarot blocks.
pub const KAKAROT_BLOCK_GAS_LIMIT: u64 = 7_000_000;
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use dotenvy::dotenv;
use eyre::Result;
use kakarot_rpc::{
client::EthClient,
constants::{KAKAROT_RPC_CONFIG, RPC_CONFIG},
constants::{KAKAROT_BLOCK_GAS_LIMIT, KAKAROT_RPC_CONFIG, RPC_CONFIG},
eth_rpc::{rpc::KakarotRpcModuleBuilder, run_server},
pool::{
constants::PRUNE_DURATION,
Expand Down Expand Up @@ -54,7 +54,8 @@ async fn main() -> Result<()> {
let contract_reader = KakarotCoreReader::new(*KAKAROT_ADDRESS, starknet_provider.clone());
let base_fee = contract_reader.get_base_fee().block_id(BlockId::Tag(BlockTag::Pending)).call().await?.base_fee;
let base_fee = base_fee.try_into()?;
let config = PoolConfig { minimal_protocol_basefee: base_fee, ..Default::default() };
let config =
PoolConfig { minimal_protocol_basefee: base_fee, gas_limit: KAKAROT_BLOCK_GAS_LIMIT, ..Default::default() };

// Init the Ethereum Client
let eth_client = EthClient::new(starknet_provider, config, db.clone());
Expand Down
11 changes: 7 additions & 4 deletions src/pool/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use super::validate::KakarotTransactionValidator;
use crate::{
client::EthClient,
constants::KAKAROT_RPC_CONFIG,
constants::{KAKAROT_BLOCK_GAS_LIMIT, KAKAROT_RPC_CONFIG},
into_via_try_wrapper,
pool::constants::ONE_TENTH_ETH,
providers::eth_provider::{database::state::EthDatabase, starknet::relayer::Relayer, BlockProvider},
Expand Down Expand Up @@ -249,10 +249,13 @@ where
let latest_header = latest_block.header.clone().seal(hash);

// Update the block information in the pool
let chain_spec =
ChainSpec { chain: eth_client.eth_provider().chain_id.into(), ..Default::default() };
let chain_spec = ChainSpec {
chain: eth_client.eth_provider().chain_id.into(),
max_gas_limit: KAKAROT_BLOCK_GAS_LIMIT,
..Default::default()
};
let info = BlockInfo {
block_gas_limit: latest_header.gas_limit,
block_gas_limit: KAKAROT_BLOCK_GAS_LIMIT,
last_seen_block_hash: hash,
last_seen_block_number: latest_header.number,
pending_basefee: latest_header
Expand Down

0 comments on commit f1e9832

Please sign in to comment.