substrate-archive icon indicating copy to clipboard operation
substrate-archive copied to clipboard

Store Justifications along with the rest of the block

Open insipx opened this issue 4 years ago • 5 comments

For one reason or another Justifications aren't stored in the Postgres Database.

Justification is present on the SignedBlock field of Block though, so it would be nice to store it if it exists. This requires a new SQL migration that creates a Justification column as a bytea field. It is possible for justification to be null for a block, so the columns should reflect this.

The SQL Inserts should be modified to add the justification as well: https://github.com/paritytech/substrate-archive/blob/7c886898323029cb5ded646b0a57ad565e0fd17c/substrate-archive/src/database.rs#L88

insipx avatar Jan 08 '21 13:01 insipx

I'll work on this guy

jakehemmerle avatar Jun 10 '21 23:06 jakehemmerle

After trying for an hour or two to get the postgres scripts to work with a docker container, I created a docker-compose.yaml with the URL defaults that makes spinning it up the DB super easy for those (like me) who don't know postgres ins and outs. Is this something worth including in the PR?

version: '3'

services:
  # container name is:
  pg-substrate-archive:
    image: 'postgres:latest'
    ports:
      - 5432:5432 # localhost_port:container_port ; don't change container_port
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: 123 # change me
      POSTGRES_DB: kusama # default db name

basically sets up a db instance with user/pass as postgres and 123, kusama as the database name, and binds container port 5432 to localhost:5432. Too easy.

docker tl;dr we can stick in the readme: start it up : docker-compose up -d shut it down: docker-compose down delete it: docker container stop pg-substrate-archive && docker container rm pg-substrate-archive

jakehemmerle avatar Jun 11 '21 19:06 jakehemmerle

Yeah that would be great! Would start the journey to closing #206 as well, but yeah definitely a worthy addition imo

insipx avatar Jun 11 '21 20:06 insipx

Is this something worth including in the PR?

I think it would be best as a separate PR; it's orthogonal to justifications.

I'm fine with anything that makes the first-use experience better but I do not want to bless Docker as the "preferred way" of running substrate-archive. :)

dvdplm avatar Jun 14 '21 06:06 dvdplm

Since justifications are nullable values, I think this is blocked until this is solved: https://github.com/launchbadge/sqlx/issues/1294#issuecomment-866618995.

jakehemmerle avatar Jun 27 '21 15:06 jakehemmerle