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

dev: set minimal base fee at start up #1505

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
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
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
Loading