Skip to content

Commit

Permalink
Builder changes
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinI committed Dec 19, 2024
1 parent 87e146b commit 1e2fd09
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 34 deletions.
4 changes: 2 additions & 2 deletions builder/src/non_permissioned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
35 changes: 18 additions & 17 deletions marketplace-builder/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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::<SeqTypes, SequencerApiVersion>::connect(events_api_url).await?;

spawn(async move {
let res = global_state.start_event_loop(stream).await;
Expand Down Expand Up @@ -169,16 +168,18 @@ impl BuilderConfig {
};

// create the global state
// let global_state: Arc<GlobalState<SeqTypes, DynamicHooks>> = 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),
Expand Down
34 changes: 19 additions & 15 deletions sequencer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<SeqTypes, NoHooks<SeqTypes>>> = 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<GlobalState<SeqTypes, NoHooks<SeqTypes>>> = 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");
Expand All @@ -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,
Expand Down

0 comments on commit 1e2fd09

Please sign in to comment.