Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set block gas limit in pool to 7M #1517

Merged
merged 4 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading