Skip to content

Commit 885278a

Browse files
Merge pull request #92 from availproject/fix/pg-serialization
fix: Justification serialization issue on Postgres insertion
2 parents 5a99bb4 + 60ab2b0 commit 885278a

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

docker/docker-compose.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: '3'
2+
3+
services:
4+
db:
5+
image: postgres:latest
6+
container_name: bridge-proof_db
7+
environment:
8+
POSTGRES_USER: myuser
9+
POSTGRES_PASSWORD: mypassword
10+
POSTGRES_DB: vectorx-indexer
11+
ports:
12+
- "5433:5432"
13+
volumes:
14+
- postgres_data:/var/lib/postgresql/data
15+
16+
volumes:
17+
postgres_data:

services/src/postgres.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use anyhow::Result;
2-
use serde_json::{from_str, to_string};
2+
use serde_json::{from_str, to_value};
33
use sqlx::{PgPool, Row};
44
use tracing::info;
55

@@ -27,7 +27,7 @@ impl PostgresClient {
2727
avail_chain_id: &str,
2828
justification: GrandpaJustification,
2929
) -> Result<()> {
30-
let json_data = to_string(&justification)?;
30+
let json_data = to_value(&justification)?;
3131
let block_nb = justification.commit.target_number;
3232
let id = format!("{}-{}", avail_chain_id, block_nb).to_lowercase();
3333

0 commit comments

Comments
 (0)