kadena-io / chainweb-data

Data ingestion for Chainweb.
BSD 3-Clause "New" or "Revised" License
14 stars 8 forks source link

Store hashes consistently in hex #24

Closed mightybyte closed 4 years ago

mightybyte commented 4 years ago
chainweb-data=# select powhash from blocks limit 10;
                             powhash
------------------------------------------------------------------
 0000000000000156c931661d6ecfee72c7789bcc7792b63b316006f26fd0336f
 000000000001e07e120762afc29678c0278802ef4db297827169b45d70a8a414
 000000000000836c53022c32c1c166926a003af307159e183fdfd2567a543edd
 0000000000001958e57a41ea2ee544352d7e465d759ef0160b11aa35b9293e11
 BOQ_HOAVEqs80XEtWxdx0vovBFP2uaPPUgiErrsHqeQ=
 vSm9aAj1YIoix3QjHbL6DiKHqvKQjBFHX2_NH13lGzw=
 Fid3V5qk8Sa-haoMKRXtdttdahP776vKpRVYnwac07k=
 BxZ_SnT7nKRikhuwYiToe-klYiELjAVXkxwvTSt1zvs=
 Aip4EdsyovdLf2nRgygyh00Ng4kVAlYT1SA7zlzVYvY=
 nQNkADqnXctuHdjHQ79ss33pICYCUy90cESWZteiTEM=
(10 rows)
mightybyte commented 4 years ago

Looking at the code more, I get the impression that storing hashes as base64 was intentional. I can certainly see an argument for that, but I can also see an argument for hex...especially for powhash. Perhaps the data structure should be a newtype wrapper around the raw ByteString and then have two of them...one for hex and one for base64? Or perhaps even put the raw bytes in the DB as a blob? Not sure.