Skip to content

Commit

Permalink
Fix docker demo (#1519)
Browse files Browse the repository at this point in the history
* Fix docker demo

- Set stake table capacity to 10 for mock contract.
- Log the stake table capacity on prover service startup.
- Set a lower prover interval for local demos.
- Query all logs in smoke test. By default it only queries the latest
  block.
- Add stake table capacity to public env vars
  • Loading branch information
sveitser authored and jbearer committed Jun 3, 2024
1 parent 1f01e01 commit ea43e38
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ ESPRESSO_DEMO_SEQUENCER_LIBP2P_PORT_2=7002
ESPRESSO_DEMO_SEQUENCER_LIBP2P_PORT_3=7003
ESPRESSO_DEMO_SEQUENCER_LIBP2P_PORT_4=7004

# The demo uses the mock stake table contract, only capacity 10 is supported.
ESPRESSO_SEQUENCER_STAKE_TABLE_CAPACITY=10

# Foundry
# The mnemonic used by foundry to deploy contracts.
MNEMONIC="test test test test test test test test test test test junk"
Expand All @@ -91,7 +94,7 @@ ESPRESSO_STATE_SIGNATURE_TOTAL_STAKE=5

# Prover service
ESPRESSO_PROVER_SERVICE_PORT=30050
ESPRESSO_STATE_PROVER_UPDATE_INTERVAL=10m
ESPRESSO_STATE_PROVER_UPDATE_INTERVAL=20s

# Builder service
ESPRESSO_BUILDER_L1_PROVIDER=${ESPRESSO_SEQUENCER_L1_PROVIDER}
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ services:
environment:
- ESPRESSO_SEQUENCER_ORCHESTRATOR_URL
- ESPRESSO_SEQUENCER_L1_PROVIDER
- ESPRESSO_SEQUENCER_STAKE_TABLE_CAPACITY
- ESPRESSO_DEPLOYER_ACCOUNT_INDEX
- RUST_LOG
- RUST_LOG_FORMAT
Expand Down Expand Up @@ -189,6 +190,7 @@ services:
- ESPRESSO_SEQUENCER_L1_PROVIDER
- ESPRESSO_SEQUENCER_ETH_MNEMONIC
- ESPRESSO_SEQUENCER_LIGHTCLIENT_ADDRESS
- ESPRESSO_SEQUENCER_STAKE_TABLE_CAPACITY
- MNEMONIC=$ESPRESSO_SEQUENCER_ETH_MNEMONIC
- ESPRESSO_SEQUENCER_STATE_PROVER_ACCOUNT_INDEX
- RAYON_NUM_THREADS=$PROVER_RAYON_NUM_THREADS
Expand Down
3 changes: 2 additions & 1 deletion hotshot-state-prover/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ async fn init_stake_table_from_orchestrator(
orchestrator_url: &Url,
stake_table_capacity: usize,
) -> StakeTable<BLSPubKey, StateVerKey, CircuitField> {
tracing::info!("Initializing stake table from HotShot orchestrator.");
tracing::info!("Initializing stake table from HotShot orchestrator {orchestrator_url}");
let client = Client::<ServerError, OrchestratorVersion>::new(orchestrator_url.clone());
loop {
match client.get::<bool>("api/peer_pub_ready").send().await {
Expand Down Expand Up @@ -384,6 +384,7 @@ pub async fn run_prover_service<Ver: StaticVersionType + 'static>(
config: StateProverConfig,
bind_version: Ver,
) {
tracing::info!("Stake table capacity: {}", config.stake_table_capacity);
// TODO(#1022): maintain the following stake table
let st = Arc::new(
init_stake_table_from_orchestrator(&config.orchestrator_url, config.stake_table_capacity)
Expand Down
4 changes: 0 additions & 4 deletions process-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ processes:
# The contract addresses are implicitly inherited from .env. We need to unset these or else the
# script will think they're already deployed.
command: unset ESPRESSO_SEQUENCER_HOTSHOT_ADDRESS ESPRESSO_SEQUENCER_LIGHT_CLIENT_PROXY_ADDRESS && deploy --use-mock-contract --only hotshot,light-client
environment:
- ESPRESSO_SEQUENCER_STAKE_TABLE_CAPACITY=10
depends_on:
demo-l1-network:
condition: process_healthy
Expand Down Expand Up @@ -92,8 +90,6 @@ processes:
command: state-prover -d
environment:
- MNEMONIC=$ESPRESSO_SEQUENCER_ETH_MNEMONIC
- ESPRESSO_SEQUENCER_STAKE_TABLE_CAPACITY=10
- ESPRESSO_STATE_PROVER_UPDATE_INTERVAL=30s
- RAYON_NUM_THREADS=$PROVER_RAYON_NUM_THREADS
depends_on:
orchestrator:
Expand Down
17 changes: 10 additions & 7 deletions scripts/smoke-test-demo
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,17 @@ function get_balance() {
}

function last_light_client_update() {
curl -s $L1_PROVIDER \
curl -s "$L1_PROVIDER" \
-H "Content-Type: application/json" \
-d "{
\"method\": \"eth_getLogs\",
\"params\": [{\"address\": \"$ESPRESSO_SEQUENCER_LIGHT_CLIENT_PROXY_ADDRESS\"}],
\"id\": 1,
\"jsonrpc\": \"2.0\"
}" \
-d '{
"method": "eth_getLogs",
"params": [{
"fromBlock": "earliest",
"address": "'"$ESPRESSO_SEQUENCER_LIGHT_CLIENT_PROXY_ADDRESS"'"
}],
"id": 1,
"jsonrpc": "2.0"
}' \
| jq '.result | .[-1].blockNumber // "0x0"' \
| xargs printf "%d\n" # Convert from hex to decimal
}
Expand Down
1 change: 1 addition & 0 deletions sequencer/api/public-env-vars.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ variables = [
"ESPRESSO_SEQUENCER_PRUNER_MINIMUM_RETENTION",
"ESPRESSO_SEQUENCER_PRUNER_PRUNING_THRESHOLD",
"ESPRESSO_SEQUENCER_PRUNER_TARGET_RETENTION",
"ESPRESSO_SEQUENCER_STAKE_TABLE_CAPACITY",
"ESPRESSO_SEQUENCER_STATE_PEERS",
"ESPRESSO_SEQUENCER_STORAGE_PATH",
"ESPRESSO_SEQUENCER_STORE_UNDECIDED_STATE",
Expand Down

0 comments on commit ea43e38

Please sign in to comment.