Skip to content

Commit

Permalink
dev: set minimal base fee at start up (#1505)
Browse files Browse the repository at this point in the history
set the minimal base fee at rpc start up

Signed-off-by: Gregory Edison <[email protected]>
  • Loading branch information
greged93 authored Oct 28, 2024
1 parent 443e148 commit 8889ae9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ use kakarot_rpc::{
constants::{KAKAROT_RPC_CONFIG, RPC_CONFIG},
eth_rpc::{rpc::KakarotRpcModuleBuilder, run_server},
pool::mempool::{maintain_transaction_pool, AccountManager},
providers::eth_provider::database::Database,
providers::eth_provider::{
database::Database,
starknet::kakarot_core::{core::KakarotCoreReader, KAKAROT_ADDRESS},
},
};
use mongodb::options::{DatabaseOptions, ReadConcern, WriteConcern};
use opentelemetry_sdk::runtime::Tokio;
use reth_transaction_pool::PoolConfig;
use starknet::{
core::types::Felt,
core::types::{BlockId, BlockTag, Felt},
providers::{jsonrpc::HttpTransport, JsonRpcClient},
};
use tracing_opentelemetry::MetricsLayer;
Expand Down Expand Up @@ -46,9 +49,12 @@ async fn main() -> Result<()> {
let starknet_provider = Arc::new(starknet_provider);

// Get the pool config
// TODO call Kakarot.get_base_fee
let config = PoolConfig { minimal_protocol_basefee: 0, ..Default::default() };
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() };

// Init the Ethereum Client
let eth_client = EthClient::new(starknet_provider, config, db.clone());
let eth_client = Arc::new(eth_client);

Expand Down

0 comments on commit 8889ae9

Please sign in to comment.