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

New Config Changes - issue with `only_utxo` preset

ArturWieczorek opened this issue · comments

Version
Used cardano-db-sync version from master

According to the description:

"only_utxo" - Only load block, tx, tx_out and ma_tx_out

Initially populates only a few tables, like block and tx. It maintains a ledger state but doesn't use any of its data.
When syncing is completed, it loads the whole UTxO set from the ledger to the tx_out and ma_tx_out tables.

This is the state at the very beginning of syncing process :

  • epoch table is populated - probably should not be
  • tx_in table is populated - description does not mention it so I guess it rather should be left empty
  • tx_out is already being filled with data but description mentions that it only should happen When syncing is completed ...
  • block, tx tables have data which is correct and ma_tx_out is empty - which is correct as well. Once the sync is completed I will update ticket with info if ma_tx_out has data or not.
    EDIT - looks like ma_tx_out is still empty after sync is completed.
preprod_test_config=# select * from epoch LIMIT 5;
 id |      out_sum      |  fees  | tx_count | blk_count | no |     start_time      |      end_time       
----+-------------------+--------+----------+-----------+----+---------------------+---------------------
  1 |                 0 |      0 |        0 |        11 |  0 | 2022-06-01 00:00:00 | 2022-06-05 12:01:40
  2 |                 0 |      0 |        0 |        10 |  1 | 2022-06-06 00:00:00 | 2022-06-10 12:00:40
  3 |                 0 |      0 |        0 |        14 |  2 | 2022-06-11 00:00:20 | 2022-06-15 12:00:20
  4 |                 0 |      0 |        0 |        11 |  3 | 2022-06-16 00:00:40 | 2022-06-20 12:00:40
  5 | 89699996986717641 | 644302 |        3 |     21599 |  4 | 2022-06-21 00:00:00 | 2022-06-25 23:59:20
(5 rows)

preprod_test_config=# select * from block LIMIT 5;
 id |                                hash                                | epoch_no | slot_no | epoch_slot_no | block_no | previous_id | slot_leader_id | size |        time         | tx_count | proto_major | proto_minor | vrf_key | op_cert | op_cert_counter 
----+--------------------------------------------------------------------+----------+---------+---------------+----------+-------------+----------------+------+---------------------+----------+-------------+-------------+---------+---------+-----------------
  1 | \xd4b8de7a11d929a323373cbab6c1a9bdc931beffff11db111cf9d57356ee1937 |          |         |               |          |             |              1 |    0 | 2022-06-01 00:00:00 |        8 |           0 |           0 |         |         |                
  2 | \x9ad7ff320c9cf74e0f5ee78d22a85ce42bb0a487d0506bf60cfb5a91ea4497d2 |        0 |         |               |          |           1 |              2 |   81 | 2022-06-01 00:00:00 |        0 |           0 |           0 |         |         |                
  3 | \x1d031daf47281f69cd95ab929c269fd26b1434a56a5bbbd65b7afe85ef96b233 |        0 |       2 |             2 |        1 |           2 |              3 |  623 | 2022-06-01 00:00:40 |        0 |           0 |           0 |         |         |                
  4 | \x9972ffaee13b4afcf1a133434161ce25e8ecaf34b7a76e06b0c642125cf911a9 |        0 |    2163 |          2163 |        2 |           3 |              4 | 2111 | 2022-06-01 12:01:00 |        0 |           0 |           0 |         |         |                
  5 | \xf3d7cd6f93cb4c59b61b28ac974f4a4dccfc44a4c83c1998aad17bb6b7b03446 |        0 |    4325 |          4325 |        3 |           4 |              5 |  625 | 2022-06-02 00:01:40 |        0 |           0 |           0 |         |         |                
(5 rows)


preprod_test_config=# select * from tx LIMIT 5;
 id |                                hash                                | block_id | block_index |      out_sum      | fee | deposit | size | invalid_before | invalid_hereafter | valid_contract | script_size 
----+--------------------------------------------------------------------+----------+-------------+-------------------+-----+---------+------+----------------+-------------------+----------------+-------------
  1 | \x8e0280beebc3d12626e87b182f4205d75e49981042f54081cd35f3a4a85630b0 |        1 |           0 |                 0 |   0 |       0 |    0 |                |                   | t              |           0
  2 | \x02e9a39dec6fad8a889a619b71a3cf06fab8475a6d19ea6e949846b5e0ba8747 |        1 |           0 |                 0 |   0 |       0 |    0 |                |                   | t              |           0
  3 | \x5526b1373acfc774794a62122f95583ff17febb2ca8a0fe948d097e29cf99099 |        1 |           0 | 30000000000000000 |   0 |       0 |    0 |                |                   | t              |           0
  4 | \x21184177437666b3d3229e118d000e9eb0e625063610ee707921493bc215fc01 |        1 |           0 |                 0 |   0 |       0 |    0 |                |                   | t              |           0
  5 | \x84e79ec2eea95464106f80f70989a29c6247119174d16d505d574ab600e7249a |        1 |           0 |                 0 |   0 |       0 |    0 |                |                   | t              |           0
(5 rows)


preprod_test_config=# select * from tx_in LIMIT 5;
 id | tx_in_id | tx_out_id | tx_out_index | redeemer_id 
----+----------+-----------+--------------+-------------
  1 |        9 |         3 |            0 |            
  2 |       10 |         9 |            0 |            
  3 |       11 |        10 |            0 |            
  4 |       12 |        11 |            0 |            
  5 |       13 |        12 |            0 |            
(5 rows)


preprod_test_config=# select * from tx_out LIMIT 5;
 id | tx_id | index |                             address                             | address_has_script | payment_cred | stake_address_id |       value       | data_hash | inline_datum_id | reference_script_id 
----+-------+-------+-----------------------------------------------------------------+--------------------+--------------+------------------+-------------------+-----------+-----------------+---------------------
  1 |     1 |     0 | FHnt4NL7yPXhCzCHVywZLqVsvwuG3HvwmjKXQJBrXh3h2aigv6uxkePbpzRNV8q | f                  |              |                  |                 0 |           |                 |                    
  2 |     2 |     0 | FHnt4NL7yPXuJGViM3KwSPwrwECD9q5vNetX3QJDYRWgiX3RHi5i5VV32dnETDK | f                  |              |                  |                 0 |           |                 |                    
  3 |     3 |     0 | FHnt4NL7yPXuYUxBF33VX5dZMBDAab2kvSNLRzCskvuKNCSDknzrQvKeQhGUw5a | f                  |              |                  | 30000000000000000 |           |                 |                    
  4 |     4 |     0 | FHnt4NL7yPY8exfnuJ8ACyoU7xCN93tKXSv357UrTp1nddGbkWxJpQfrt62xYFX | f                  |              |                  |                 0 |           |                 |                    
  5 |     5 |     0 | FHnt4NL7yPYFpVcAXZADrKdsqCAFvcRFYkTcqkn2guGmj8akQMiMVjhSUECvD1F | f                  |              |                  |                 0 |           |                 |                    
(5 rows)


preprod_test_config=# select * from ma_tx_out LIMIT 5;
 id | quantity | tx_out_id | ident 
----+----------+-----------+-------
(0 rows)


Seems like a bug, especially for tx_in, tx_out tables

There seem to be some discrepancies between the docs and the code here:

onlyUTxOInsertOptions :: SyncInsertOptions
onlyUTxOInsertOptions =
  SyncInsertOptions
    { sioTxOut = TxOutEnable
    , sioLedger = LedgerIgnore
    , sioShelley = ShelleyDisable
    , sioRewards = RewardsConfig True
    , sioMultiAsset = MultiAssetDisable
    , sioMetadata = MetadataDisable
    , sioPlutus = PlutusDisable
    , sioGovernance = GovernanceConfig False
    , sioOffchainPoolData = OffchainPoolDataConfig False
    , sioJsonType = JsonTypeText
    }

My initial thought is that the docs are right and the preset code needs to be updated