IntersectMBO / cardano-db-sync

A component that follows the Cardano chain and stores blocks and transactions in PostgreSQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Offchain Governance Metadata

Cmdv opened this issue · comments

Currently we are storing the whole of the json into the Database inside of OffChainVoteDataJson / offchainvote table
which happens around here:

insert :: (MonadBaseControl IO m, MonadIO m) => OffChainPoolResult -> ReaderT SqlBackend m ()
insert = \case
OffChainPoolResultMetadata md -> void $ DB.insertCheckOffChainPoolData md
OffChainPoolResultError fe -> void $ DB.insertCheckOffChainPoolFetchError fe

current functionality was introduced in this PR

TLDR currently we:

  1. fetch offchain metadata
  2. put it into DB inside OffChainVoteDataJson

What we'd ideally like is:

  1. fech offchain metadata
  2. parse metadata
  3. put parsed metadata into a new table with same structure as the parsed type
  4. link newly created row id in OffChainVoteDataJson which is currently of the typeText

We can get the expected structure from cardano-foundation/CIPs#632 once it is merged and finalised.

An initial implementation of this is done at sancho-4-1-0