Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commit network config when saving to Postgres #960

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ ESPRESSO_SEQUENCER_L1_USE_LATEST_BLOCK_TAG=true
ESPRESSO_SEQUENCER_ETH_MNEMONIC="test test test test test test test test test test test junk"
ESPRESSO_SEQUENCER_HOTSHOT_ACCOUNT_INDEX=5
ESPRESSO_COMMITMENT_TASK_PORT=60000
ESPRESSO_SEQUENCER_DB_PORT=5432

# Example rollup demo variables
ESPRESSO_DEMO_ROLLUP_PORT=8084
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ services:

sequencer-db:
image: postgres
ports:
- "$ESPRESSO_SEQUENCER_DB_PORT:5432"
environment:
- POSTGRES_PASSWORD=password
healthcheck:
Expand Down
3 changes: 2 additions & 1 deletion sequencer/src/persistence/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::{NetworkConfig, PersistenceOptions, SequencerPersistence};
use crate::api::{data_source::SequencerDataSource, sql::DataSource};
use async_trait::async_trait;
use clap::Parser;
use hotshot_query_service::data_source::sql::Query;
use hotshot_query_service::data_source::{sql::Query, VersionedDataSource};

/// Options for Postgres-backed persistence.
#[derive(Parser, Clone, Debug, Default)]
Expand Down Expand Up @@ -84,6 +84,7 @@ impl SequencerPersistence for Persistence {
.await?
.execute("INSERT INTO network_config (config) VALUES ($1)", [&json])
.await?;
self.commit().await?;
Ok(())
}
}