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

BigInt coin represented with number in TreasuryWithdrawals

iccicci opened this issue · comments

OS
Your OS: Ubuntu on WSL2

Versions
The db-sync version (eg cardano-db-sync --version): 3.0.0
PostgreSQL version: 12.16

Build/Install Method
The method you use to build or install cardano-db-sync: Docker image from ghcr.io/intersectmbo/cardano-db-sync

Run method
The method you used to run cardano-db-sync (eg Nix/Docker/systemd/none): Docker

Additional context
In sanchonet

Problem Report
In description column, of gov_action_proposal table, for TreasuryWithdrawals proposals, the coin property is expressed as a number but it should be a BigInt. Since BigInt can't be serialized through JSON, probably it should be better to express it as a string (the raw conversion of the amount).

Without this change, for big imports, the number could not have enough precision to represent the real requested amount.

I see treasury_withdrawal table can be used, but as per #1611 , having this would help che client to simplify the queries.

This is consistent with how we represent all Lovelace. Are you requesting we use bigint anywhere we represent lovelace?

It would be safer... I have no idea about the impact of this change anywhere, so it's hard to say "yes, I'm asking for that".

Maybe I'm just too much scrupulous... if it never caused problems, maybe it's not so urgent...

I double checked and Number.MAX_SAFE_INTEGER is 4 figures grater than the max supply expressed in Lovelace...