Skip to content

Commit

Permalink
db: Display the block VRF key as Bech32
Browse files Browse the repository at this point in the history
Since there is currently no query that relies on this value the raw
hex version does not need to be stored.

Closes: #295
  • Loading branch information
erikd committed Oct 11, 2020
1 parent c373998 commit a503bb9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions cardano-db-sync/src/Cardano/DbSync/Era/Shelley/Util.hs
Expand Up @@ -50,7 +50,6 @@ import qualified Cardano.Api.Typed as Api
import qualified Cardano.Crypto.Hash as Crypto
import qualified Cardano.Crypto.DSIGN as DSIGN
import qualified Cardano.Crypto.KES.Class as KES
import qualified Cardano.Crypto.VRF.Class as VRF

import qualified Cardano.Db as Db
import Cardano.DbSync.Config
Expand Down Expand Up @@ -124,8 +123,8 @@ blockTxs =
blockOpCert :: Shelley.BHBody StandardShelley -> ByteString
blockOpCert = KES.rawSerialiseVerKeyKES . Shelley.ocertVkHot . Shelley.bheaderOCert

blockVrfKey :: Shelley.BHBody StandardShelley -> ByteString
blockVrfKey = VRF.rawSerialiseVerKeyVRF . Shelley.bheaderVrfVk
blockVrfKey :: Shelley.BHBody StandardShelley -> Text
blockVrfKey = Api.serialiseToBech32 . Api.VrfVerificationKey . Shelley.bheaderVrfVk

blockVrfKeyToPoolHash :: ShelleyBlock -> ByteString
blockVrfKeyToPoolHash =
Expand Down
2 changes: 1 addition & 1 deletion cardano-db/src/Cardano/Db/Schema.hs
Expand Up @@ -88,7 +88,7 @@ share
time UTCTime sqltype=timestamp
txCount Word64
-- Shelley specific
vrfKey ByteString Maybe sqltype=hash32type
vrfKey Text Maybe
opCert ByteString Maybe sqltype=hash32type
protoVersion Text Maybe
UniqueBlock hash
Expand Down
Expand Up @@ -12,7 +12,7 @@ BEGIN
EXECUTE 'ALTER TABLE "slot_leader" ADD COLUMN "pool_hash_id" INT8 NULL' ;
EXECUTE 'ALTER TABLE "block" ADD COLUMN "epoch_slot_no" uinteger NULL' ;
EXECUTE 'ALTER TABLE "block" ALTER COLUMN "tx_count" TYPE INT8' ;
EXECUTE 'ALTER TABLE "block" ADD COLUMN "vrf_key" hash32type NULL' ;
EXECUTE 'ALTER TABLE "block" ADD COLUMN "vrf_key" VARCHAR NULL' ;
EXECUTE 'ALTER TABLE "block" ADD COLUMN "op_cert" hash32type NULL' ;
EXECUTE 'ALTER TABLE "block" ADD COLUMN "proto_version" VARCHAR NULL' ;
EXECUTE 'ALTER TABLE "tx" ADD COLUMN "deposit" INT8 NOT NULL' ;
Expand Down

0 comments on commit a503bb9

Please sign in to comment.