From ce3cba3c20c79d43a40d903c91101ed0574f5d9a Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Mon, 27 Feb 2023 17:26:22 -0700 Subject: [PATCH] builder: drop use of `Arc` for `Context` and fix error with genesis details --- mev-build-rs/src/mempool_builder.rs | 4 ++-- mev-build-rs/src/service.rs | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mev-build-rs/src/mempool_builder.rs b/mev-build-rs/src/mempool_builder.rs index 4271608..d20e7b9 100644 --- a/mev-build-rs/src/mempool_builder.rs +++ b/mev-build-rs/src/mempool_builder.rs @@ -37,7 +37,7 @@ pub struct Inner { proposer_scheduler: ProposerScheduler, engine_api_client: EngineApiClient, proxy: Arc, - context: Arc, + context: Context, state: Mutex, } @@ -59,7 +59,7 @@ impl Builder { secret_key: SecretKey, genesis_validators_root: Root, client: Client, - context: Arc, + context: Context, engine_api_client: EngineApiClient, proxy: Arc, ) -> Self { diff --git a/mev-build-rs/src/service.rs b/mev-build-rs/src/service.rs index d64444e..4164690 100644 --- a/mev-build-rs/src/service.rs +++ b/mev-build-rs/src/service.rs @@ -77,16 +77,15 @@ impl Service { let context = if let Some(context) = context { context } else { Context::try_from(&network)? }; - let clock = context.clock(Option::from(genesis_details.genesis_time)); - let context = Arc::new(context); let (tx, rx) = mpsc::channel(BUILD_JOB_BUFFER_SIZE); let engine_api_client = EngineApiClient::new(&engine_api_proxy.engine_api_endpoint); let http_client = HttpClient::new(); let proxy = Arc::new(Proxy::new(http_client, &engine_api_proxy.engine_api_endpoint, tx)); let engine_api_proxy = EngineApiProxy::new(engine_api_proxy); - let genesis_validators_root = - client.get_genesis_details().await.map(|details| details.genesis_validators_root)?; + let genesis_details = client.get_genesis_details().await?; + let genesis_validators_root = genesis_details.genesis_validators_root; + let clock = context.clock(Some(genesis_details.genesis_time)); let builder = Builder::new( secret_key, genesis_validators_root,