Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extendend whitelist options #1644

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

Extendend whitelist options #1644

wants to merge 22 commits into from

Conversation

Cmdv
Copy link
Contributor

@Cmdv Cmdv commented Mar 6, 2024

Description

This PR fixes #1600 adding more whitelists to the configs

The most complex whitelist was the Shelley Stake Address as it stored in the table stake_address.
The functionality is if the stake address doesn't match in the whitelist on any of the inserts into the following tables, then we don't insert at all:

+-----------------------+
|         table         |
|-----------------------+
| collateral_tx_out     |
| delegation            |
| delegation_vote       |
| epoch_stake           |
| gov_action_proposal   |
| instant_reward        |
| pool_owner            |
| pool_update           |
| reserve               |
| reward                |
| stake_deregistration  |
| stake_registration    |
| treasury              |
| treasury_withdrawal   |
| tx_out                |
| withdrawal            | 
+-----------------------+

Checklist

  • Commit sequence broadly makes sense
  • Commits have useful messages
  • New tests are added if needed and existing tests are updated
  • Any changes are noted in the changelog
  • Code is formatted with fourmolu on version 0.10.1.0 (which can be run with scripts/fourmolize.sh)
  • Self-reviewed the diff

Migrations

  • The pr causes a breaking change of type a,b or c
  • If there is a breaking change, the pr includes a database migration and/or a fix process for old values, so that upgrade is possible
  • Resyncing and running the migrations provided will result in the same database semantically

If there is a breaking change, especially a big one, please add a justification here. Please elaborate
more what the migration achieves, what it cannot achieve or why a migration is not possible.

@Cmdv Cmdv mentioned this pull request Mar 6, 2024
9 tasks
@Cmdv Cmdv force-pushed the 1600-extend-whitelist branch 3 times, most recently from cf3fcab to cc0f1a7 Compare March 14, 2024 12:55
@Cmdv Cmdv marked this pull request as ready for review March 14, 2024 12:57
@Cmdv Cmdv requested review from sgillespie and kderme and removed request for sgillespie March 14, 2024 12:57
sgillespie
sgillespie previously approved these changes Mar 14, 2024
Copy link
Contributor

@sgillespie sgillespie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I added a few questions also

sgillespie
sgillespie previously approved these changes Apr 4, 2024
@ArturWieczorek
Copy link
Contributor

ArturWieczorek commented Apr 9, 2024

Run into following error message with executable built from this branch, on sanchonet:

[db-sync-node:Error:68] [2024-04-09 19:18:08.57 UTC] Error SNErrDefault: "resolveGovActionProposal.queryGovActionProposalId missing GovAction (TxKey {unTxKey = SqlBackendKey {unSqlBackendKey = 1878}}, 0)" [db-sync-node:Info:68] [2024-04-09 19:18:08.57 UTC] Shutting down DB thread

and it is hanging like that for quite some time, even though I used export DbSyncAbortOnPanic=1;

Longer log:

[db-sync-node:Info:68] [2024-04-09 19:18:08.15 UTC] Insert Conway Block: epoch 241, slot 20899080, block 1045000, hash 63f067e9e3ea707046130d460f1ab5fa9b66a6e28a2b00db937b7919d92db6c4
[db-sync-node:Info:68] [2024-04-09 19:18:08.16 UTC] queryOrInsertRewardAccount: "e0e23ef55a0099f4f3c0bf172828424d91ae0d61ef2d1456ba59117f59"
[db-sync-node:Info:68] [2024-04-09 19:18:08.17 UTC] queryOrInsertRewardAccount: "e0e23ef55a0099f4f3c0bf172828424d91ae0d61ef2d1456ba59117f59"
[db-sync-node:Info:68] [2024-04-09 19:18:08.17 UTC] queryOrInsertRewardAccount: "e0e23ef55a0099f4f3c0bf172828424d91ae0d61ef2d1456ba59117f59"
[db-sync-node:Info:68] [2024-04-09 19:18:08.17 UTC] queryOrInsertRewardAccount: "e0e23ef55a0099f4f3c0bf172828424d91ae0d61ef2d1456ba59117f59"
[db-sync-node:Info:68] [2024-04-09 19:18:08.21 UTC] queryOrInsertRewardAccount: "e05d7925e67a3c06e73529044636347d622f825cfbf8f2901bce2a4076"
[db-sync-node:Info:68] [2024-04-09 19:18:08.23 UTC] queryOrInsertRewardAccount: "e0d7b6df431bcd4f6547370dd91a84b9f19baa531fed0050d06d3eccbf"
[db-sync-node:Info:68] [2024-04-09 19:18:08.23 UTC] queryOrInsertRewardAccount: "e0d7b6df431bcd4f6547370dd91a84b9f19baa531fed0050d06d3eccbf"
[db-sync-node:Info:68] [2024-04-09 19:18:08.23 UTC] queryOrInsertRewardAccount: "e0d7b6df431bcd4f6547370dd91a84b9f19baa531fed0050d06d3eccbf"
[db-sync-node:Info:68] [2024-04-09 19:18:08.23 UTC] queryOrInsertRewardAccount: "e0d7b6df431bcd4f6547370dd91a84b9f19baa531fed0050d06d3eccbf"
[db-sync-node:Info:68] [2024-04-09 19:18:08.43 UTC] queryOrInsertRewardAccount: "e08411259f67557f242a8a3ce67ad49533861d88619493b0d2909a85ce"
[db-sync-node:Info:68] [2024-04-09 19:18:08.44 UTC] queryOrInsertRewardAccount: "e08411259f67557f242a8a3ce67ad49533861d88619493b0d2909a85ce"
[db-sync-node:Info:68] [2024-04-09 19:18:08.44 UTC] queryOrInsertRewardAccount: "e08411259f67557f242a8a3ce67ad49533861d88619493b0d2909a85ce"
[db-sync-node:Info:68] [2024-04-09 19:18:08.44 UTC] queryOrInsertRewardAccount: "e08411259f67557f242a8a3ce67ad49533861d88619493b0d2909a85ce"
[db-sync-node:Info:68] [2024-04-09 19:18:08.46 UTC] queryOrInsertRewardAccount: "e0fbfde89e03ec91335ea6a634f5c0c25b23fc0ea5bf12b6ad38b5e4dd"
[db-sync-node:Info:68] [2024-04-09 19:18:08.46 UTC] queryOrInsertRewardAccount: "e0fbfde89e03ec91335ea6a634f5c0c25b23fc0ea5bf12b6ad38b5e4dd"
[db-sync-node:Info:68] [2024-04-09 19:18:08.47 UTC] queryOrInsertRewardAccount: "e0fbfde89e03ec91335ea6a634f5c0c25b23fc0ea5bf12b6ad38b5e4dd"
[db-sync-node:Info:68] [2024-04-09 19:18:08.47 UTC] queryOrInsertRewardAccount: "e0fbfde89e03ec91335ea6a634f5c0c25b23fc0ea5bf12b6ad38b5e4dd"
[db-sync-node:Info:68] [2024-04-09 19:18:08.48 UTC] queryOrInsertRewardAccount: "e0608b8ec1b50edf6973e68b882c0e316eb0aa003f26be94d8cfd29b22"
[db-sync-node:Info:68] [2024-04-09 19:18:08.49 UTC] queryOrInsertRewardAccount: "e0892f36af0ddfd1ab639143893140b513f96ed48f7759ee6e4a652818"
[db-sync-node:Info:68] [2024-04-09 19:18:08.49 UTC] queryOrInsertRewardAccount: "e0892f36af0ddfd1ab639143893140b513f96ed48f7759ee6e4a652818"
[db-sync-node:Info:68] [2024-04-09 19:18:08.49 UTC] queryOrInsertRewardAccount: "e0892f36af0ddfd1ab639143893140b513f96ed48f7759ee6e4a652818"
[db-sync-node:Info:68] [2024-04-09 19:18:08.49 UTC] queryOrInsertRewardAccount: "e0892f36af0ddfd1ab639143893140b513f96ed48f7759ee6e4a652818"
[db-sync-node:Info:68] [2024-04-09 19:18:08.51 UTC] queryOrInsertRewardAccount: "e01d036f6ffdaf8341c63e4cf02ce788f5bcecd9b517cae17d22a08b53"
[db-sync-node:Info:68] [2024-04-09 19:18:08.52 UTC] queryOrInsertRewardAccount: "e01d036f6ffdaf8341c63e4cf02ce788f5bcecd9b517cae17d22a08b53"
[db-sync-node:Info:68] [2024-04-09 19:18:08.53 UTC] queryOrInsertRewardAccount: "e01d036f6ffdaf8341c63e4cf02ce788f5bcecd9b517cae17d22a08b53"
[db-sync-node:Info:68] [2024-04-09 19:18:08.53 UTC] queryOrInsertRewardAccount: "e01d036f6ffdaf8341c63e4cf02ce788f5bcecd9b517cae17d22a08b53"
[db-sync-node:Info:68] [2024-04-09 19:18:08.56 UTC] queryOrInsertRewardAccount: "e0192a8eb77a6f405d8196dd96db13950c48300a0ff8b6f42e7901a2ef"
[db-sync-node:Info:68] [2024-04-09 19:18:08.56 UTC] queryOrInsertRewardAccount: "e0192a8eb77a6f405d8196dd96db13950c48300a0ff8b6f42e7901a2ef"
[db-sync-node:Info:68] [2024-04-09 19:18:08.56 UTC] queryOrInsertRewardAccount: "e0192a8eb77a6f405d8196dd96db13950c48300a0ff8b6f42e7901a2ef"
[db-sync-node:Error:68] [2024-04-09 19:18:08.57 UTC] Error SNErrDefault: "resolveGovActionProposal.queryGovActionProposalId missing GovAction (TxKey {unTxKey = SqlBackendKey {unSqlBackendKey = 1878}}, 0)"
[db-sync-node:Info:68] [2024-04-09 19:18:08.57 UTC] Shutting down DB thread

@ArturWieczorek
Copy link
Contributor

Another question would be - should we have validator for stake addresses in config whitelisting ?

    "shelley": {
      "enable": true,
      "stake_addresses": ["ABCDEF248f556b733c3ef24899ae0609d3796198d5470192304c4894dd85cb"]
    },

I used this and no errors on cardano-db-sync side.

@Cmdv
Copy link
Contributor Author

Cmdv commented Apr 10, 2024

@ArturWieczorek

run into following error message with executable built from this branch, on sanchonet

what version of cardano-node are you using at the moment? I can't even get things to start syncing locally. I can see in the code where the issue is happening. Will try to get sanchonet working today 👍

Another question would be - should we have validator for stake addresses in config whitelisting

The problem with that is if you add the stake address before starting a fresh sync, there is no way to validate if it's existence as it's not been yet created.

@ArturWieczorek
Copy link
Contributor

@ArturWieczorek
what version of cardano-node are you using at the moment?

@Cmdv
For checking it I used:

cardano-node 8.9.0 - linux-x86_64 - ghc-9.6
git rev f7900cd232b33aa96e18e7a533454ce077d299c1

not sure if this is right - it seemed to work with this version.

@ArturWieczorek
Copy link
Contributor

ArturWieczorek commented Apr 10, 2024

I am using...

node:

./cardano-node version
cardano-node 8.9.1 - linux-x86_64 - ghc-8.10
git rev da945ea983d4722a9ffe54250edba9a193a57cf0

db-sync:

db-sync-node/bin/cardano-db-sync version
cardano-db-sync 13.2.0.1 - linux-x86_64 - ghc-8.10
git revision efa38c28ce7ebe666d2649299e38c4701dbca495

Network: sanchonet

Network Configs:

wget https://book.play.dev.cardano.org/environments/sanchonet/config.json \
  https://book.play.dev.cardano.org/environments/sanchonet/db-sync-config.json \
  https://book.play.dev.cardano.org/environments/sanchonet/submit-api-config.json \
  https://book.play.dev.cardano.org/environments/sanchonet/topology.json \
  https://book.play.dev.cardano.org/environments/sanchonet/byron-genesis.json \
  https://book.play.dev.cardano.org/environments/sanchonet/shelley-genesis.json \
  https://book.play.dev.cardano.org/environments/sanchonet/alonzo-genesis.json \
  https://book.play.dev.cardano.org/environments/sanchonet/conway-genesis.json

db-sync config:

  "insert_options": {
    "tx_out": {
      "value": "enable"
    },
    "ledger": "enable",
    "shelley": {
      "enable": true,
      "stake_addresses": ["e083d27f03b197750ee41b7dca02c806718164b934b0fbfa747349e8f2"]
    },
    "multi_asset": {
      "enable": true
    },
    "metadata": {
      "enable": true
    },
    "plutus": {
      "enable": true
    },
    "governance": "enable",
    "offchain_pool_data": "enable",
    "json_type": "text"
  },

Logs:

db_sync_whitelist_logs.txt

So If I am reading it correctly - it breaks on querying / inserting first record in gov_action_proposal table:

Error SNErrDefault: "resolveGovActionProposal.queryGovActionProposalId missing GovAction (TxKey {unTxKey = SqlBackendKey {unSqlBackendKey = 1878}}, 0)"

Query on database synced without whitelisting:

sancho=# select * from gov_action_proposal limit 3;
 id | tx_id | index | prev_gov_action_proposal |  deposit   | return_address | expiration | voting_anchor_id |        type         |                                                                                      description                                                                                      | param_proposal | ratified_epoch | enacted_epoch | dropped_epoch | expired_epoch 
----+-------+-------+--------------------------+------------+----------------+------------+------------------+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------+----------------+---------------+---------------+---------------
  1 |  1878 |     0 |                          | 1000000000 |           1024 |        251 |                1 | TreasuryWithdrawals | {"tag": "TreasuryWithdrawals", "contents": [[[{"network": "Testnet", "credential": {"keyHash": "248f556b733c3ef24899ae0609d3796198d5470192304c4894dd85cb"}}, 10000000000000]], null]} |                |                |               |               |              
  2 |  1948 |     0 |                          | 1000000000 |           1024 |        252 |                2 | InfoAction          | {"tag": "InfoAction"}                                                                                                                                                                 |                |                |               |               |              
  3 |  4116 |     0 |                          | 1000000000 |           1044 |        253 |                1 | TreasuryWithdrawals | {"tag": "TreasuryWithdrawals", "contents": [[[{"network": "Testnet", "credential": {"keyHash": "248f556b733c3ef24899ae0609d3796198d5470192304c4894dd85cb"}}, 51000000]], null]}       |                |                |               |               |              
(3 rows)

@ArturWieczorek
Copy link
Contributor

ArturWieczorek commented Apr 10, 2024

OK, I think I got it something more.

So basically adding return address

sancho=# select * from gov_action_proposal limit 3;
 id | tx_id | index | prev_gov_action_proposal |  deposit   | return_address | expiration | voting_anchor_id |        type         |                                                                                      description                                                                                      | param_proposal | ratified_epoch | enacted_epoch | dropped_epoch | expired_epoch 
----+-------+-------+--------------------------+------------+----------------+------------+------------------+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------+----------------+---------------+---------------+---------------
  1 |  1878 |     0 |                          | 1000000000 |           1024 |        251 |                1 | TreasuryWithdrawals | {"tag": "TreasuryWithdrawals", "contents": [[[{"network": "Testnet", "credential": {"keyHash": "248f556b733c3ef24899ae0609d3796198d5470192304c4894dd85cb"}}, 10000000000000]], null]} |                |                |               |               |              

in this case id=1024:

sancho=# select * from stake_address where id=1024;
  id  |                           hash_raw                           |                               view                               | script_hash 
------+--------------------------------------------------------------+------------------------------------------------------------------+-------------
 1024 | \xe0192a8eb77a6f405d8196dd96db13950c48300a0ff8b6f42e7901a2ef | stake_test1uqvj4r4h0fh5qhvpjmwedkcnj5xysvq2plutdapw0yq69mccrcnd7 | 
(1 row)

to stake_addresses whitelist:

      "stake_addresses": ["e083d27f03b197750ee41b7dca02c806718164b934b0fbfa747349e8f2","e0192a8eb77a6f405d8196dd96db13950c48300a0ff8b6f42e7901a2ef"]

Moved error past epoch 241:

[db-sync-node:Info:68] [2024-04-10 16:52:15.19 UTC] Starting epoch 243
[db-sync-node:Info:68] [2024-04-10 16:52:15.19 UTC] Insert Conway Block: epoch 243, slot 20995259, block 1048448, hash b1bbaf1289853643b930e143c20f88d02433804eaba473e071dff13f7aeaa617
[db-sync-node:Info:68] [2024-04-10 16:52:15.20 UTC] 
Inserted epoch 242 from updateEpochWhenSyncing with Cache. 
 epoch: Epoch {epochOutSum = 12944517829466, epochFees = DbLovelace 280783544, epochTxCount = 1411, epochBlkCount = 2974, epochNo = 242, epochStartTime = 2024-02-12 00:30:50 UTC, epochEndTime = 2024-02-13 00:29:06 UTC}
[db-sync-node:Info:76] [2024-04-10 16:52:15.24 UTC] Asynchronously wrote a ledger snapshot to ledger-state/sancho_whitelist/20995146-631926b413-242.lstate in 0.058838804s.
[db-sync-node:Info:68] [2024-04-10 16:52:15.74 UTC] Inserted 1 EpochStake for EpochNo 244
[db-sync-node:Info:68] [2024-04-10 16:52:16.97 UTC] Insert Conway Block: epoch 243, slot 21043666, block 1050000, hash e4ed716d1560fc7d3051b4da271410f31a28e233bb0c3462142fcd2950470f87
[db-sync-node:Error:68] [2024-04-10 16:52:17.55 UTC] Error SNErrDefault: "resolveGovActionProposal.queryGovActionProposalId missing GovAction (TxKey {unTxKey = SqlBackendKey {unSqlBackendKey = 4222}}, 0)"
[db-sync-node:Info:68] [2024-04-10 16:52:17.55 UTC] Shutting down DB thread

So if stake address for return_address is filtered out by whitelisting it will cause this exception.

@ArturWieczorek
Copy link
Contributor

ArturWieczorek commented Apr 15, 2024

@Cmdv With latest version on this branch I am left stuck at Reached EpochNo 301 message.

I see that tables listed below are empty while the non whitelisted version of DB have records for them ( the common thing is that they have gov_action_proposal_id field ):

select * from constitution;
 id | gov_action_proposal_id | voting_anchor_id | script_hash 
----+------------------------+------------------+-------------
(0 rows)


select * from new_committee_info;
 id | gov_action_proposal_id | quorum_numerator | quorum_denominator 
----+------------------------+------------------+--------------------
(0 rows)


select * from new_committee;
 id | gov_action_proposal_id | deleted_members | added_members | quorum_numerator | quorum_denominator 
----+------------------------+-----------------+---------------+------------------+--------------------
(0 rows)


select * from new_committee_member;
 id | gov_action_proposal_id | committee_hash_id | expiration_epoch 
----+------------------------+-------------------+------------------
(0 rows)


select * from voting_procedure;
 id | tx_id | index | gov_action_proposal_id | voter_role | drep_voter | pool_voter | vote | voting_anchor_id | committee_voter 
----+-------+-------+------------------------+------------+------------+------------+------+------------------+-----------------
(0 rows)

Also do not see records in those tables ( contrary to non whitelisted DB version )

off_chain_pool_data
off_chain_pool_fetch_error
off_chain_vote_fetch_error

EDIT:

    "shelley": {
      "enable": true,
      "stake_addresses": ["e083d27f03b197750ee41b7dca02c806718164b934b0fbfa747349e8f2"]
    },
sancho_regular=# select * from stake_address where id=5;
 id |                           hash_raw                           |                               view                               | script_hash 
----+--------------------------------------------------------------+------------------------------------------------------------------+-------------
  5 | \xe083d27f03b197750ee41b7dca02c806718164b934b0fbfa747349e8f2 | stake_test1uzpaylcrkxth2rhyrd7u5qkgqeccze9exjc0h7n5wdy73usd0pxpl | 
(1 row)

It seems like there might be also issue with tx_out table - on non whitelisted database stake_address_id=5 has no entries:

sancho_regular=# select * from tx_out where stake_address_id=5;
 id | tx_id | index | address | address_has_script | payment_cred | stake_address_id | value | data_hash | inline_datum_id | reference_script_id 
----+-------+-------+---------+--------------------+--------------+------------------+-------+-----------+-----------------+---------------------
(0 rows)

sancho_regular=# select count(*) from tx_out where stake_address_id IS NOT NULL;
 count 
-------
  6210
(1 row)

and on whitelisted by stake_address_id=5 there are - and generally all stake_address_id fields are NULL:

sancho_test_config_shelley_whitelist=# select count(*) from tx_out;
 count  
--------
 103980
(1 row)

sancho_test_config_shelley_whitelist=# select count(*) from tx_out where stake_address_id IS NOT NULL;
 count 
-------
     0
(1 row)

So we should get rid off all those records with NULL stake_address_id and then it should be OK I think.

@ArturWieczorek
Copy link
Contributor

This is related to plutus whitelisting.

Assuming that config below is correct:

  "insert_options": {
    "tx_out": {
      "value": "enable"
    },
    "ledger": "enable",
    "shelley": {
      "enable": true
    },
    "multi_asset": {
      "enable": true
    },
    "metadata": {
      "enable": true
    },
   "plututs": {
      "enable": true,
      "script_hashes":["34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518","67f33146617a5e61936081db3b2117cbf59bd2123748f58ac9678656", "bccf2a430c016bc960fbf31b02694011cd399d20da8882aac9d33611", "1b539b68e5389bdc3fe511c7694583e3755f58d4b38aef50384f4349"]
    },
    "governance": "enable",
    "offchain_pool_data": "enable",
    "json_type": "text"
  },

I am seeing entries in script table that should not be there:

sancho_test_config_shelley_whitelist_plutus=# SELECT id, tx_id, hash, type, json
FROM script
WHERE hash NOT IN (
    '\x34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518', -- hash for 'timelock' - 1st entry in script_hashes
    '\x67f33146617a5e61936081db3b2117cbf59bd2123748f58ac9678656', -- hash for 'plutusV1' - 2nd entry in script_hashes
    '\xbccf2a430c016bc960fbf31b02694011cd399d20da8882aac9d33611', -- hash for 'plutusV2' - 3rd entry in script_hashes
    '\x1b539b68e5389bdc3fe511c7694583e3755f58d4b38aef50384f4349'  -- hash for 'plutusV3' - 4th entry in script_hashes
)
ORDER BY type, id;
 id | tx_id |                            hash                            |   type   |                                                                                                                                                          json                                                                                                                                                           
----+-------+------------------------------------------------------------+----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  6 | 17132 | \xeeb006239ad2562556b736c3990f20968fcf89bb6d4f7292aaa0c30a | timelock | {"type": "atLeast", "scripts": [{"type": "sig", "keyHash": "ff750767ac2496a659b8325bf7064f92d969672d931ce0bc0290f6ba"}, {"type": "sig", "keyHash": "b7b9594ef50295739c95144238654413221df009f388cbf9b8ca73b7"}, {"type": "sig", "keyHash": "0253cc2bc1ed8176c675f454dd730fae5bfaa147b73924bde70d786a"}], "required": 2}
 24 | 28937 | \x6b0261483fa1fe471c6f941c2a917d75164cbd96a93a9e42f62efd1c | timelock | {"type": "sig", "keyHash": "6c6fe0b26f5bfa67ece9221683ea4e7ad19bdf14db8a9fae7b294b5e"}
  9 | 19924 | \x56b0f0b597150e619c76bed60683f3b1e42d7bc0685ed951b882bfc5 | plutusV2 | 
 10 | 19924 | \x86bff95ba20e9d1d1b34899a56d86bbacc9fed999260b27dcc92d128 | plutusV2 | 
 11 | 19927 | \x0689163fa0280c34d6e3d78657e2b06980be7ac77854f0dd5201bf05 | plutusV2 | 
 12 | 21241 | \x8275a6621fdb65e60c117fddd5f162d43adf6364c2645cd865bf5482 | plutusV2 | 
 14 | 24872 | \x04b8c921d534b5debae418ae679a83ec5e628b8e680af1a241788790 | plutusV2 |
...

@Cmdv
Copy link
Contributor Author

Cmdv commented Apr 16, 2024

@ArturWieczorek thanks a lot for the very thorough reports 🙏

With latest version on this branch I am left stuck at Reached EpochNo 301 message.

I wonder if it has something with stopping and restarting as I got to 301 last week and that was the tip but now we're on 306. So this morning I restarted and like you it was just not moving forward. I can't fully tell it's it's node not providing more data or something is going on on our side. Will investigate more.

This is related to plutus whitelisting.

So it's doesn't just whitelist against script hash, it also checks payment creds. Which was the existing functionality. I'm unsure as to the reasoning but it's functionality was kept. New code here

Copy link
Contributor

@kderme kderme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for multiassets and plutus, there needs to be a better distinction on the checks that happen before trying to insert anything (this checks if there is a whitelist) and the check that happens during inserting (this checks if the feauture is completely disabled). I left some comments that may help

cardano-db-sync/src/Cardano/DbSync/Util/Whitelist.hs Outdated Show resolved Hide resolved
cardano-db-sync/src/Cardano/DbSync/Util/Whitelist.hs Outdated Show resolved Hide resolved
-- first check the config option
case ioPlutus iopts of
PlutusEnable -> True
PlutusDisable -> False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly to isMAPoliciesInWhitelist, I think this should be True.

case ioPlutus iopts of
PlutusEnable -> True
PlutusDisable -> False
PlutusScripts plutusWhitelist -> toShort scriptHash `elem` plutusWhitelist
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be just True. Whiletelisting is checked previoiusly in isPlutusScriptHashesInWhitelist. It also probably needs to be renamed to isPlutusNotDisabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I'll check, but isPlutusNotDisabled is a double negative which in english makes it confusing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Cmdv thinking again, the current implementation may be correct. I thought the intented behaviout was different, but since the behaviour is open to interpretation, it's fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So let's say we have a whitelist for a specific script A. Some tx contains script A in an output and script B in another output. The tx passes the validation check, but do we want to insert B? I guess both answers are correct as long as we are consinstent.

}
ReaderT SqlBackend m (Maybe DB.ScriptId)
insertScript syncEnv txId script =
if isSimplePlutusScriptHashInWhitelist syncEnv $ Generic.txScriptHash script
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this check should change. See the comment at isSimplePlutusScriptHashInWhitelist for more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend modularity to specified stake address, minting policy, script hash
4 participants