Skip to content

Commit

Permalink
Demo fixes (#1313)
Browse files Browse the repository at this point in the history
* Demo fixes

* Some config fixes suggested by Informal Systems
* Fix name of builder docker image

* Handle duplicate VID/DA proposals in SQL persistence
  • Loading branch information
jbearer authored Apr 10, 2024
1 parent ab31169 commit 425f9d6
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 16 deletions.
12 changes: 6 additions & 6 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ ESPRESSO_ORCHESTRATOR_MIN_PROPOSE_TIME=1s
ESPRESSO_ORCHESTRATOR_MAX_PROPOSE_TIME=2s
ESPRESSO_CONSENSUS_SERVER_PORT=40002
ESPRESSO_DA_SERVER_PORT=40003
ESPRESSO_SEQUENCER_DA_SERVER_URL=http://da-server:$ESPRESSO_WEB_SERVER_PORT
ESPRESSO_SEQUENCER_CONSENSUS_SERVER_URL=http://consensus-server:$ESPRESSO_WEB_SERVER_PORT
ESPRESSO_SEQUENCER_ORCHESTRATOR_URL=http://orchestrator:$ESPRESSO_ORCHESTRATOR_PORT
ESPRESSO_SEQUENCER_DA_SERVER_URL=http://da-server:${ESPRESSO_WEB_SERVER_PORT}
ESPRESSO_SEQUENCER_CONSENSUS_SERVER_URL=http://consensus-server:${ESPRESSO_WEB_SERVER_PORT}
ESPRESSO_SEQUENCER_ORCHESTRATOR_URL=http://orchestrator:${ESPRESSO_ORCHESTRATOR_PORT}
ESPRESSO_SEQUENCER_API_PORT=50000
ESPRESSO_SEQUENCER1_API_PORT=50001
ESPRESSO_SEQUENCER2_API_PORT=50002
ESPRESSO_SEQUENCER3_API_PORT=50003
ESPRESSO_SEQUENCER4_API_PORT=50004
ESPRESSO_SEQUENCER_URL=http://sequencer0:$ESPRESSO_SEQUENCER_API_PORT
ESPRESSO_SEQUENCER_URL=http://sequencer0:${ESPRESSO_SEQUENCER_API_PORT}
ESPRESSO_SEQUENCER_STORAGE_PATH=/store/sequencer
ESPRESSO_SEQUENCER_L1_PORT=8545
ESPRESSO_SEQUENCER_L1_WS_PORT=8546
ESPRESSO_SEQUENCER_L1_PROVIDER=http://demo-l1-network:$ESPRESSO_SEQUENCER_L1_PORT
ESPRESSO_SEQUENCER_L1_PROVIDER=http://demo-l1-network:${ESPRESSO_SEQUENCER_L1_PORT}
ESPRESSO_SEQUENCER_ETH_MNEMONIC="test test test test test test test test test test test junk"
ESPRESSO_SEQUENCER_PREFUNDED_BUILDER_ACCOUNTS=0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f
ESPRESSO_COMMITMENT_TASK_PORT=60000
ESPRESSO_SEQUENCER_DB_PORT=5432
ESPRESSO_STATE_RELAY_SERVER_PORT=40004
ESPRESSO_STATE_RELAY_SERVER_URL=http://state-relay-server:$ESPRESSO_STATE_RELAY_SERVER_PORT
ESPRESSO_STATE_RELAY_SERVER_URL=http://state-relay-server:${ESPRESSO_STATE_RELAY_SERVER_PORT}

# Ethereum accounts (note 11-15 are used by the sequencer nodes)
ESPRESSO_SEQUENCER_HOTSHOT_ACCOUNT_INDEX=5
Expand Down
5 changes: 3 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ services:
- ESPRESSO_SEQUENCER_API_PEERS=http://sequencer2:$ESPRESSO_SEQUENCER_API_PORT
- ESPRESSO_SEQUENCER_STATE_PEERS=http://sequencer2:$ESPRESSO_SEQUENCER_API_PORT
- ESPRESSO_SEQUENCER_POSTGRES_HOST=sequencer-db
- ESPRESSO_SEQUENCER_POSTGRES_USER=postgres
- ESPRESSO_SEQUENCER_POSTGRES_USER=root
- ESPRESSO_SEQUENCER_POSTGRES_PASSWORD=password
- ESPRESSO_SEQUENCER_L1_PROVIDER
- ESPRESSO_STATE_RELAY_SERVER_URL
Expand Down Expand Up @@ -302,7 +302,7 @@ services:
condition: service_healthy

permissionless-builder:
image: ghcr.io/espressosystems/espresso-sequencer/permissionless-builder:main
image: ghcr.io/espressosystems/espresso-sequencer/builder:main
ports:
- "$ESPRESSO_BUILDER_SERVER_PORT:$ESPRESSO_BUILDER_SERVER_PORT"
environment:
Expand Down Expand Up @@ -342,6 +342,7 @@ services:
- "$ESPRESSO_SEQUENCER_DB_PORT:5432"
environment:
- POSTGRES_PASSWORD=password
- POSTGRES_USER=root
healthcheck:
# Postgres can be falsely "ready" once before running init scripts.
# See https://github.com/docker-library/postgres/issues/146 for discussion.
Expand Down
25 changes: 23 additions & 2 deletions process-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,15 @@ processes:
failure_threshold: 100

sequencer1:
command: sequencer -- http -- query -- catchup -- status
command: sequencer -- storage-sql -- http -- query -- catchup -- status
environment:
- ESPRESSO_SEQUENCER_API_PORT=$ESPRESSO_SEQUENCER1_API_PORT
- ESPRESSO_SEQUENCER_API_PEERS=http://localhost:$ESPRESSO_SEQUENCER_API_PORT
- ESPRESSO_SEQUENCER_STATE_PEERS=http://localhost:$ESPRESSO_SEQUENCER2_API_PORT
- ESPRESSO_SEQUENCER_STORAGE_PATH=$ESPRESSO_BASE_STORAGE_PATH/seq1
- ESPRESSO_SEQUENCER_POSTGRES_HOST=localhost
- ESPRESSO_SEQUENCER_POSTGRES_PORT=$ESPRESSO_SEQUENCER_DB_PORT
- ESPRESSO_SEQUENCER_POSTGRES_USER=root
- ESPRESSO_SEQUENCER_POSTGRES_PASSWORD=password
- ESPRESSO_SEQUENCER_PRIVATE_STAKING_KEY=$ESPRESSO_DEMO_SEQUENCER_STAKING_PRIVATE_KEY_1
- ESPRESSO_SEQUENCER_PRIVATE_STATE_KEY=$ESPRESSO_DEMO_SEQUENCER_STATE_PRIVATE_KEY_1
- ESPRESSO_SEQUENCER_ETH_ACCOUNT_INDEX=11
Expand All @@ -141,6 +144,8 @@ processes:
condition: process_healthy
state-relay-server:
condition: process_healthy
sequencer-db:
condition: process_healthy
readiness_probe:
http_get:
scheme: http
Expand Down Expand Up @@ -270,3 +275,19 @@ processes:
port: $ESPRESSO_NASTY_CLIENT_PORT
path: /healthcheck
failure_threshold: 100

sequencer-db:
command: docker run -e POSTGRES_PASSWORD -e POSTGRES_USER -p $ESPRESSO_SEQUENCER_DB_PORT:5432 postgres
environment:
- POSTGRES_PASSWORD=password
- POSTGRES_USER=root
readiness_probe:
exec:
command: pg_isready -h localhost -p $ESPRESSO_SEQUENCER_DB_PORT
initial_delay_seconds: 5
period_seconds: 5
timeout_seconds: 4
# Postgres can be falsely "ready" once before running init scripts.
# See https://github.com/docker-library/postgres/issues/146 for discussion.
success_threshold: 2
failure_threshold: 20
16 changes: 10 additions & 6 deletions sequencer/src/persistence/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,11 @@ impl SequencerPersistence for Persistence {

transaction(self, |mut tx| {
async move {
tx.execute_one_with_retries(
"INSERT INTO vid_share (view, data) VALUES ($1, $2)",
[sql_param(&(view as i64)), sql_param(&data_bytes)],
tx.upsert(
"vid_share",
["view", "data"],
["view"],
[[sql_param(&(view as i64)), sql_param(&data_bytes)]],
)
.await?;
Ok(())
Expand All @@ -398,9 +400,11 @@ impl SequencerPersistence for Persistence {

transaction(self, |mut tx| {
async move {
tx.execute_one_with_retries(
"INSERT INTO da_proposal (view, data) VALUES ($1, $2)",
[sql_param(&(view as i64)), sql_param(&data_bytes)],
tx.upsert(
"da_proposal",
["view", "data"],
["view"],
[[sql_param(&(view as i64)), sql_param(&data_bytes)]],
)
.await?;
Ok(())
Expand Down

0 comments on commit 425f9d6

Please sign in to comment.