diff --git a/builder/src/non_permissioned.rs b/builder/src/non_permissioned.rs index 83b751bb8..e26e0d30e 100644 --- a/builder/src/non_permissioned.rs +++ b/builder/src/non_permissioned.rs @@ -145,8 +145,8 @@ impl BuilderConfig { vid_commitment, leaf_commit: fake_commitment(), builder_commitment, - tx_count: todo!(), - last_nonempty_view: todo!(), + tx_count: 0, + last_nonempty_view: None, }, decide_receiver, da_receiver, diff --git a/marketplace-builder/src/builder.rs b/marketplace-builder/src/builder.rs index 5f42783ca..914fb4105 100644 --- a/marketplace-builder/src/builder.rs +++ b/marketplace-builder/src/builder.rs @@ -36,8 +36,10 @@ use hotshot_types::{ }, utils::BuilderCommitment, }; -use marketplace_builder_core::service::{GlobalState, ProxyGlobalState}; -use marketplace_builder_core::{hooks::BuilderHooks, service::EventServiceStream}; +use marketplace_builder_core::{ + hooks::BuilderHooks, + service::{EventServiceStream, GlobalState, ProxyGlobalState}, +}; use marketplace_builder_shared::block::ParentBlockReferences; use marketplace_solver::SolverError; use sequencer::{catchup::StatePeers, L1Params, NetworkParams, SequencerApiVersion}; @@ -105,11 +107,8 @@ impl BuilderConfig { // spawn the builder service tracing::info!("Running builder against hotshot events API at {events_api_url}",); - let stream = marketplace_builder_core::service::EventServiceStream::< - SeqTypes, - SequencerApiVersion, - >::connect(events_api_url) - .await?; + let stream = + EventServiceStream::::connect(events_api_url).await?; spawn(async move { let res = global_state.start_event_loop(stream).await; @@ -169,16 +168,18 @@ impl BuilderConfig { }; // create the global state - // let global_state: Arc> = GlobalState::new( - // (builder_key_pair.fee_account(), builder_key_pair), - // api_timeout, - // maximize_txns_count_timeout_duration, - // Duration::from_secs(60), - // tx_channel_capacity.get(), - // base_fee.as_u64().expect("Base fee too high"), - // hooks, - // ); - let global_state = todo!(); + let global_state = GlobalState::new( + marketplace_builder_core::service::BuilderConfig { + builder_keys: (builder_key_pair.fee_account(), builder_key_pair), + api_timeout, + tx_capture_timeout: maximize_txns_count_timeout_duration, + txn_garbage_collect_duration: Duration::from_secs(60), + txn_channel_capacity: tx_channel_capacity.get(), + tx_status_cache_capacity: 81920, + base_fee: base_fee.as_u64().expect("Base fee too high"), + }, + hooks, + ); Self::start_service( Arc::clone(&global_state), diff --git a/sequencer/src/lib.rs b/sequencer/src/lib.rs index 0dc3fbbb9..5c0214e2b 100644 --- a/sequencer/src/lib.rs +++ b/sequencer/src/lib.rs @@ -593,7 +593,10 @@ pub mod testing { traits::{block_contents::BlockHeader, metrics::NoMetrics, stake_table::StakeTableScheme}, HotShotConfig, PeerConfig, }; - use marketplace_builder_core::{hooks::NoHooks, service::GlobalState}; + use marketplace_builder_core::{ + hooks::NoHooks, + service::{BuilderConfig, GlobalState}, + }; use portpicker::pick_unused_port; use tokio::spawn; @@ -637,21 +640,21 @@ pub mod testing { .parse() .expect("Failed to parse builder URL"); - // let hooks = NoHooks(PhantomData); - // create the global state - // let global_state: Arc>> = GlobalState::new( - // (builder_key_pair.fee_account(), builder_key_pair), - // Duration::from_secs(60), - // Duration::from_millis(100), - // Duration::from_secs(60), - // BUILDER_CHANNEL_CAPACITY_FOR_TEST, - // 10, - // hooks, - // ); - let global_state: Arc>> = todo!(); - - // create the proxy global state it will server the builder apis + let global_state = GlobalState::new( + BuilderConfig { + builder_keys: (builder_key_pair.fee_account(), builder_key_pair), + api_timeout: Duration::from_secs(60), + tx_capture_timeout: Duration::from_millis(100), + txn_garbage_collect_duration: Duration::from_secs(60), + txn_channel_capacity: BUILDER_CHANNEL_CAPACITY_FOR_TEST, + tx_status_cache_capacity: 81920, + base_fee: 10, + }, + NoHooks(PhantomData), + ); + + // Create and spawn the tide-disco app to serve the builder APIs let app = Arc::clone(&global_state) .into_app() .expect("Failed to create builder tide-disco app"); @@ -665,6 +668,7 @@ pub mod testing { ), ); + // Pass on the builder task to be injected in the testing harness ( Box::new(MarketplaceBuilderImplementation { global_state }), url,