diff --git a/Cargo.toml b/Cargo.toml index e9c7e1871..c50a59df6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -166,7 +166,7 @@ katana-primitives = { git = 'https://github.com/dojoengine/dojo', rev = "7ff6593 "serde", ], optional = true } mockall = { version = "0.13.0", default-features = false, optional = true } -clap = { version = "4.5.17", optional = true } +clap = { version = "4.5.17" } starknet_api = { version = "0.13.0-rc.0", optional = true } @@ -209,7 +209,6 @@ testing = [ "revm-primitives", "starknet-crypto", ] -binaries = ["clap"] hive = [] arbitrary = ["rand", "dep:arbitrary"] @@ -219,8 +218,8 @@ required-features = ["testing"] [[bin]] name = "hive_genesis" -required-features = ["testing", "binaries"] +required-features = ["testing"] [[bin]] name = "hive_chain" -required-features = ["testing", "binaries"] +required-features = ["testing"] diff --git a/docker/hive/Dockerfile b/docker/hive/Dockerfile index 2f9755ad1..492309504 100644 --- a/docker/hive/Dockerfile +++ b/docker/hive/Dockerfile @@ -126,9 +126,9 @@ COPY --from=compiler /usr/src/compiler/.kakarot/artifacts /usr/src/rpc/.kakarot/ RUN cargo build \ --features hive --release --target-dir /usr/src/rpc/target && \ cargo build \ - --bin hive_genesis --release --features "testing,binaries" --target-dir /usr/src/rpc/target && \ + --bin hive_genesis --release --features "testing" --target-dir /usr/src/rpc/target && \ cargo build \ - --bin hive_chain --release --features "testing,binaries" --target-dir /usr/src/rpc/target + --bin hive_chain --release --features "testing" --target-dir /usr/src/rpc/target FROM ubuntu:24.10 as base # Install any necessary dependencies diff --git a/src/main.rs b/src/main.rs index d9542b934..bb9c89787 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +use clap::Parser; use dotenvy::dotenv; use eyre::Result; use kakarot_rpc::{ @@ -11,10 +12,15 @@ use mongodb::options::{DatabaseOptions, ReadConcern, WriteConcern}; use opentelemetry_sdk::runtime::Tokio; use reth_transaction_pool::PoolConfig; use starknet::providers::{jsonrpc::HttpTransport, JsonRpcClient}; -use std::{env::var, sync::Arc}; +use std::{env::var, path::PathBuf, sync::Arc}; use tracing_opentelemetry::MetricsLayer; use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Layer}; +#[derive(Parser)] +struct Cli { + accounts_path: PathBuf, +} + #[tokio::main] async fn main() -> Result<()> { // Environment variables are safe to use after this @@ -77,7 +83,8 @@ async fn main() -> Result<()> { } #[cfg(not(feature = "hive"))] { - AccountManager::new("./src/pool/accounts.json", Arc::clone(ð_client)).await? + let args = Cli::parse(); + AccountManager::new(args.accounts_path, Arc::clone(ð_client)).await? } }; account_manager.start(); diff --git a/src/pool/accounts.json b/src/pool/accounts.json deleted file mode 100644 index ee0b27932..000000000 --- a/src/pool/accounts.json +++ /dev/null @@ -1,92 +0,0 @@ -[ - { - "address": 2883640181176136234335915321173609316686035330597712783682502353343947167672 - }, - { - "address": 163189206500119404227396165700254790683726361202744501915894563246389642629 - }, - { - "address": 99811111405698367639528220086574377972317373523910065236962345649200639292 - }, - { - "address": 2897092793511649051419086551617932615733568314252678278132566380801240597692 - }, - { - "address": 3557618131434419594032056470174132498562617124886954494051347809858912455674 - }, - { - "address": 1217339404557647669586992910030803945817900518679235602197474203370008659931 - }, - { - "address": 1464989680417864978593244890085291655623537972528277142413062631659350590777 - }, - { - "address": 3500721539480872355911032760932736747238156289671001523378953906588583720447 - }, - { - "address": 1189807619050407034899032453787483131133983484974792461173832274025084191774 - }, - { - "address": 2985546498260957401453332630595421074332534262451681090083934350878055070090 - }, - { - "address": 2580096488720121038258346221537379350097672926793615943695292983325940933873 - }, - { - "address": 706586203185748046365025732046053556805324249384167918098765550171718485921 - }, - { - "address": 421352004629673117208877412201401279649821578920324265912223355570932536940 - }, - { - "address": 2603356782109509424930544374694920931981019619056919975558520835269149427754 - }, - { - "address": 731033513512582389832362211515114005979257885275159768513182805678819013813 - }, - { - "address": 398281199416797166894380656032915600018115167507583891417737921174186928892 - }, - { - "address": 2774917776797702469508748354373730940526329628211713188213584292456328299705 - }, - { - "address": 1694157804671749028259579467788788754526050718013798913033975622792629758778 - }, - { - "address": 1296348027856980725603557273608267665711233357934795200103762754011200899651 - }, - { - "address": 174699578338218540309219917032974618221356133891943608204320521113172701168 - }, - { - "address": 3329414828134176321922292135530875317266323263350298936045126776946408659638 - }, - { - "address": 404387488974038694333026067659627045970703132572673602290137191805941292350 - }, - { - "address": 3514189287805716489413613662390603552056579910539979406321636000461641750195 - }, - { - "address": 2685648146184946138079197716161208410943314695135298447068882451708251814403 - }, - { - "address": 351432195372800705139748767484403593176983146171895792478992735683159545982 - }, - { - "address": 649343696316947362661130019698399215509076913806056259510851614341093582720 - }, - { - "address": 3419974615650193381701278879036176812715335592876510554127336537442872429736 - }, - { - "address": 380681588646550140026679325470389027549802801092031324722960996196573866569 - }, - { - "address": 1892212033858068894675761061916192924097964867361432342750729538530979196470 - }, - { - "address": 1931767032496410938755750916548087456375215926597715702491737739690723504395 - } -] diff --git a/src/pool/mempool.rs b/src/pool/mempool.rs index cd6ac31be..f9fcb022c 100644 --- a/src/pool/mempool.rs +++ b/src/pool/mempool.rs @@ -22,7 +22,7 @@ use starknet::{ core::types::{BlockTag, Felt}, providers::{jsonrpc::HttpTransport, JsonRpcClient}, }; -use std::{collections::HashMap, fs::File, io::Read, str::FromStr, sync::Arc, time::Duration}; +use std::{collections::HashMap, fs::File, io::Read, path::PathBuf, str::FromStr, sync::Arc, time::Duration}; use tokio::sync::Mutex; /// A type alias for the Kakarot Transaction Validator. @@ -50,7 +50,7 @@ pub struct AccountManager AccountManager { /// Creates a new [`AccountManager`] instance by initializing account data from a JSON file. - pub async fn new(path: &str, eth_client: Arc>) -> eyre::Result { + pub async fn new(path: PathBuf, eth_client: Arc>) -> eyre::Result { let mut accounts = HashMap::new(); // Open the file specified by `path` @@ -368,8 +368,7 @@ mod tests { write!(temp_file, "{json_data}").unwrap(); // Create an AccountManager instance with the temporary file - let account_manager = - AccountManager::new(temp_file.path().to_str().unwrap(), Arc::new(eth_client)).await.unwrap(); + let account_manager = AccountManager::new(temp_file.path().to_path_buf(), Arc::new(eth_client)).await.unwrap(); // Verify that the accounts are loaded correctly let accounts = account_manager.accounts; diff --git a/src/pool/staging_accounts.json b/src/pool/staging_accounts.json new file mode 100644 index 000000000..18360034e --- /dev/null +++ b/src/pool/staging_accounts.json @@ -0,0 +1,92 @@ +[ + { + "address": "196811956655529464938870506963356417265254982755656721182220531581703691722" + }, + { + "address": "21957093533996098199893735879676383136588679748311520227589168706310756352" + }, + { + "address": "3156983370717363046107439255471720141779327817437045655686255812427584160473" + }, + { + "address": "1266699859155881030745853831582690989288270820499403211360777706785321251524" + }, + { + "address": "1383285862124284806198255017695143972155822358618284496274717006854914400434" + }, + { + "address": "556622474269041273239978518722272168991994308790614400316179417436866885562" + }, + { + "address": "863898040113600763634815654889111716414611996024493703975326561137637580397" + }, + { + "address": "1049948733640154265069686452829912746649894206825640979196164127637122215704" + }, + { + "address": "435094584583033448832295201512088425433478133620062714947210506762034497669" + }, + { + "address": "3346228509229892705693151942978582777745110237359153985339946277086349208770" + }, + { + "address": "940672080678076973284220857522811867751109665531403734530877519116610543631" + }, + { + "address": "1153905432749985401265458683733499773022608046916287656285521728480507290626" + }, + { + "address": "3239474275390657297685389416379959181890460903604840916970761026219042521373" + }, + { + "address": "250213415159271018200527943072110142874471999830693008856604231562179598802" + }, + { + "address": "2198280314339223222557092281776828065489416638847497213783499893084441097963" + }, + { + "address": "3128048873093243381876638739685352454173062731516385990432861353508777886705" + }, + { + "address": "1555828588265071115262743178862761512333590937219830474927477936652084904587" + }, + { + "address": "1771170141088019121607099543715528103387743149193776509961998409196567829256" + }, + { + "address": "1391138740407817780135845053928430177089762593084057844256920673963627467438" + }, + { + "address": "867729030279064875529548689518070988175185922650816101519059977121980115724" + }, + { + "address": "2242984317358998574195157522220615218790909801911372191666690443003473623640" + }, + { + "address": "1332644935669106989468987587551966650897687168489438413314411798711369176245" + }, + { + "address": "477452606747289630100801764512823550290143451527521169897857094721176773996" + }, + { + "address": "3152299787013812409150951128071649069809927970379603418783350452667249428318" + }, + { + "address": "2900219484813815244663452001325825033560729068581832394454919729462799825793" + }, + { + "address": "3020030869193293942595440056191719689367143055447934973977689404209268663703" + }, + { + "address": "396568809214101853914278146231211325536717896034045776470162047322020134406" + }, + { + "address": "1701701142581572481335003412606291319941240723790422258957246134847335593845" + }, + { + "address": "389430096329694827798034205258091031637534110544741892019394563550374910970" + }, + { + "address": "2524233885883809884722481000086760329502676546916492443119822698758295241716" + } +]