Skip to content

Commit

Permalink
Prover fixes for docker demo
Browse files Browse the repository at this point in the history
- Add env var for port
- Spawn server with healthcheck before generating keys to make it
  available earlier.
  • Loading branch information
sveitser committed Apr 23, 2024
1 parent 776461e commit ab07b9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ services:
ports:
- "$ESPRESSO_PROVER_SERVICE_PORT:$ESPRESSO_PROVER_SERVICE_PORT"
environment:
- ESPRESSO_PROVER_SERVICE_PORT
- ESPRESSO_STATE_RELAY_SERVER_URL
- ESPRESSO_SEQUENCER_ORCHESTRATOR_URL
- ESPRESSO_STATE_PROVER_UPDATE_INTERVAL
Expand Down
13 changes: 8 additions & 5 deletions hotshot-state-prover/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,20 +385,23 @@ pub async fn run_prover_service<Ver: StaticVersionType + 'static>(
init_stake_table_from_orchestrator(&config.orchestrator_url, config.stake_table_capacity)
.await,
);
let proving_key = Arc::new(load_proving_key(config.stake_table_capacity));
let relay_server_client =
Arc::new(Client::<ServerError, Ver>::new(config.relay_server.clone()));
let config = Arc::new(config);
let update_interval = config.update_interval;

tracing::info!("Light client address: {:?}", config.light_client_address);
let relay_server_client =
Arc::new(Client::<ServerError, Ver>::new(config.relay_server.clone()));

// Start the HTTP server to get a functioning healthcheck before any heavy computations.
if let Some(port) = config.port {
if let Err(err) = start_http_server(port, config.light_client_address, bind_version) {
tracing::error!("Error starting http server: {}", err);
}
}

let proving_key = async_std::task::block_on(async move {
Arc::new(load_proving_key(config.stake_table_capacity))
});

let update_interval = config.update_interval;
loop {
let st = st.clone();
let proving_key = proving_key.clone();
Expand Down

0 comments on commit ab07b9c

Please sign in to comment.