input-output-hk / partner-chains

Substrate node with capability of communicating with Cardano network
Apache License 2.0
33 stars 4 forks source link

Essential tasks fail when first setting up main chain state @ v1.1.0-rc2 #46

Open bwbush opened 3 weeks ago

bwbush commented 3 weeks ago

Describe the bug

When first setting up the main chain state, four essential tasks fail and then ExpectedDataNotFound("DParameter") is reported along with Ariadne parameters not found. However, I don't see an entry for DParameter in any of the JSON configuration files that were generated in early steps in the process. Because of #45, I had to use v1.1.0-rc2 instead of v1.0.0.

Is this behavior a fatal error? or expected behavior? In either case, it would be helpful if it were documented in the instructions.

$ ./partner-chains-cli setup-main-chain-state
This wizard will set or update D-Parameter and Permissioned Candidates on the main chain. Setting either of these costs ADA!
Will read the current D-Parameter and Permissioned Candidates from the main chain, using 'partner-chains-node ariadne-parameters' command.
> DB-Sync Postgres connection string postgresql://cardano:bcb33b5c09e31e3dd5a2b4ff0ee111e6@192.168.0.12:5432/preview
> Partner Chains node executable ./partner-chains-node
running external command: ./partner-chains-node ariadne-parameters --base-path /tmp/.tmpQj6ovC --chain chain-spec.json --mc-epoch-number 672
command output: 2024-08-25 13:20:12 Using block data source configuration: DbSyncBlockDataSourceConfig { cardano_security_parameter: 432, cardano_active_slots_coeff: 0.05, block_stability_margin: 0 }    
command output: 2024-08-25 13:20:12 Executing 'CREATE INDEX IF NOT EXISTS idx_ma_tx_out_ident ON ma_tx_out(ident)', this might take a while    
command output: 2024-08-25 13:20:12 relation "idx_ma_tx_out_ident" already exists, skipping
command output: 2024-08-25 13:20:12 Using candidate data source configuration: CandidateDataSourceCacheConfig { cardano_security_parameter: 432 }    
command output: 2024-08-25 13:20:12 Start session 0, epoch 0    
command output: 2024-08-25 13:20:12 🔨 Initializing Genesis block/state (state: 0x1a8f…8e36, header-hash: 0x80b1…8c8f)    
command output: 2024-08-25 13:20:12 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.    
command output: 2024-08-25 13:20:12 Essential task `txpool-background` failed. Shutting down service.    
command output: 2024-08-25 13:20:12 Essential task `transaction-pool-task-0` failed. Shutting down service.    
command output: 2024-08-25 13:20:12 Essential task `transaction-pool-task-1` failed. Shutting down service.    
command output: 2024-08-25 13:20:12 Essential task `basic-block-import-worker` failed. Shutting down service.    
ExpectedDataNotFound("DParameter")

Ariadne parameters not found.
> Do you want to set/update the permissioned candidates on the main chain with values from configuration file? Yes
Partner Chains Smart Contracts require access to Kupo and Ogmios. Please provide their configuration.
> Kupo protocol (http/https) http
> Kupo hostname 192.168.0.12
> Kupo port 21442
> Ogmios protocol (http/https) http
> Ogmios hostname 192.168.0.12
> Ogmios port 21337
> path to the payment signing file /scratch/iohk/networks/treasury/john-webster.skey
running external command: ./sidechain-main-cli update-permissioned-candidates --remove-all-candidates --network testnet --add-candidate 020a1091341fe5664bfa1782d5e0477968906ac916b04cb365ec3153755684d9a1:d43593c715fdd31c61141abd04a99fd6822c8558854ccde49a5684e7a56da27d:88dc3417d5058ec4b4503e0c12ea1a0a89be200f498922423d4334014fa6b0ee --add-candidate 0390084fdbf27d2b79d26a4f13f0cdd982cb755a661969143c37cbc49ef5b91f27:8eaf04151687736326c9fea17e25fc5287613698c912909cb226aa4794f26a48:d17c2d7823ebf260fd138f2d7e27d114cb145d968b5ff5006125f2414fadae69 --sidechain-id 2 --genesis-committee-hash-utxo 0000000000000000000000000000000000000000000000000000000000000000#0 --threshold-numerator 2 --threshold-denominator 3 --governance-authority 0x7482e8285c7dfcfbf87bb2ed3e17836eafec035d3cde957ab6ab0fad --atms-kind plain-ecdsa-secp256k1 --kupo-host 192.168.0.12 --kupo-port 21442  --ogmios-host 192.168.0.12 --ogmios-port 21337  --payment-signing-key-file /scratch/iohk/networks/treasury/john-webster.skey
Permissioned candidates updated. The change will be effective in two main chain epochs.
> Do you want to set/update the D-parameter on the main chain? Yes
> Enter P, the number of permissioned candidates seats, as a non-negative integer. 2
> Enter R, the number of registered candidates seats, as a non-negative integer. 0
Partner Chains Smart Contracts require access to Kupo and Ogmios. Please provide their configuration.
> Kupo protocol (http/https) http
> Kupo hostname 192.168.0.12
> Kupo port 21442
> Ogmios protocol (http/https) http
> Ogmios hostname 192.168.0.12
> Ogmios port 21337
> path to the payment signing file /scratch/iohk/networks/treasury/john-webster.skey
running external command: ./sidechain-main-cli insert-d-parameter --network testnet --d-parameter-permissioned-candidates-count 2 --d-parameter-registered-candidates-count 0 --sidechain-id 2 --genesis-committee-hash-utxo 0000000000000000000000000000000000000000000000000000000000000000#0 --threshold-numerator 2 --threshold-denominator 3 --governance-authority 0x7482e8285c7dfcfbf87bb2ed3e17836eafec035d3cde957ab6ab0fad --atms-kind plain-ecdsa-secp256k1 --kupo-host 192.168.0.12 --kupo-port 21442  --ogmios-host 192.168.0.12 --ogmios-port 21337  --payment-signing-key-file /scratch/iohk/networks/treasury/john-webster.skey
D-parameter updated to (2, 0). The change will be effective in two main chain epochs.
Done. Main chain state is set. Please remember that any changes can be observed immediately, but from the Partner Chain point of view they will be effective in two main chain epochs.

To Reproduce

Follow the steps in chain-builder.md for the preview testnet.

I built partner-chains-cli etc. using the following recipe:

$ nix develop
$ cargo build --profile=production

I built sidechain-main-cli using the following recipe:

$ nix build .#sidechain-main-cli
$ cd target/production
$ ln -s ../../result/bin/sidechain-main-cli

All of the steps up until Run the setup main chain state wizard proceeded without incident, but the four failures were reported when ./partner-chains-cli setup-main-chain-state was run.

I ignored the errors and proceeded answering the prompts (as shown above). Both Cardano transaction succeeded and were visible on the chain.

Expected behavior No fatal errors when ./partner-chains-cli setup-main-chain-state is run, or clear instructions about how to deal with these.

Additional resources

Environment

$ nixos-version
24.05.4169.797f7dc49e0b (Uakari)

$ nix --version
nix (Nix) 2.18.5

$ git latest
b991b7e1b4a28f3773eeb1d4aef061c9c511fa17 (HEAD, tag: v1.1.0-rc2) update changelog for 1.1.0-rc1 (#35)
falcucci commented 2 weeks ago

Hey @bwbush I've got the same situation.

The ExpectedDataNotFound("DParameter") seems to be caused by this query IF the returns is null using yours d_parameter_policy_id from partner-chains-cli-chain-config.json file.

 SELECT
            origin_tx.hash        AS origin_tx_hash,
            tx_out.index          AS utxo_index,
            origin_block.epoch_no AS tx_epoch_no,
            origin_block.block_no AS tx_block_no,
            origin_block.slot_no  AS tx_slot_no,
            origin_tx.block_index AS tx_block_index,
            datum.value           AS datum
        FROM ma_tx_out
        INNER JOIN multi_asset          ON ma_tx_out.ident = multi_asset.id
        INNER JOIN tx_out               ON ma_tx_out.tx_out_id = tx_out.id
        INNER JOIN tx origin_tx         ON tx_out.tx_id = origin_tx.id
        INNER JOIN block origin_block   ON origin_tx.block_id = origin_block.id
        LEFT JOIN datum                 ON tx_out.data_hash = datum.hash
        WHERE multi_asset.policy = '06fe544f055633c94e27c22cd51d18f10802c50cd68ba96127b81dfe'
        AND multi_asset.name = ''
        AND origin_block.epoch_no <= 668
        ORDER BY tx_block_no DESC, origin_tx.block_index DESC
        LIMIT 1;
falcucci commented 2 weeks ago

Ive also ignored the errors and proceeded answering the prompts at ./partner-chains-cli setup-main-chain-state like you but afterwards when I run the node it still doesn't produces the blocks.

./partner-chains-cli start-node
🛠️ Loaded node base path from config (partner-chains-cli-resources-config.json): ./data
🛠️ Loaded Partner Chains node executable from config (partner-chains-cli-resources-config.json): ./partner-chains-node
🛠️ Loaded DB-Sync Postgres connection string from config (partner-chains-cli-resources-config.json): postgresql://postgres:v8hlDV0yMAHHlIurYupj@postgres.cardano-db-sync.orb.local:5432/cexplorer
The following values will be used to run the node:
    executable = ./partner-chains-node
    base path  = ./data
    chain spec = chain-spec.json
    bootnodes  = [/ip4/127.0.0.1/tcp/3033/p2p/12D3KooWGxZsVx5a9FDaJcC6XEVGqi24oQGp5j6CZ8ZZUA3nU32L]
    environment:
        BLOCK_STABILITY_MARGIN             = 0
        CARDANO_SECURITY_PARAMETER         = 432
        CARDANO_ACTIVE_SLOTS_COEFF         = 0.05
        FIRST_EPOCH_TIMESTAMP_MILLIS       = 1666656000000
        EPOCH_DURATION_MILLIS              = 86400000
        FIRST_EPOCH_NUMBER                 = 0
        FIRST_SLOT_NUMBER                  = 0
        DB_SYNC_POSTGRES_CONNECTION_STRING = postgresql://postgres:v8hlDV0yMAHHlIurYupj@postgres.cardano-db-sync.orb.local:5432/cexplorer
        SIDECHAIN_BLOCK_BENEFICIARY        = 9b201f7febd09b16c8bd0aa1ade6ae53d1d834d045cae657faabda1b6a6449d2
> Proceed? Yes
running external command: CARDANO_SECURITY_PARAMETER='432' \
         CARDANO_ACTIVE_SLOTS_COEFF='0.05' \
         DB_SYNC_POSTGRES_CONNECTION_STRING='postgresql://postgres:v8hlDV0yMAHHlIurYupj@postgres.cardano-db-sync.orb.local:5432/cexplorer' \
         MC__FIRST_EPOCH_TIMESTAMP_MILLIS='1666656000000' \
         MC__EPOCH_DURATION_MILLIS='86400000' \
         MC__FIRST_EPOCH_NUMBER='0' \
         MC__FIRST_SLOT_NUMBER='0' \
         BLOCK_STABILITY_MARGIN='0' \
         SIDECHAIN_BLOCK_BENEFICIARY='9b201f7febd09b16c8bd0aa1ade6ae53d1d834d045cae657faabda1b6a6449d2' \
 ./partner-chains-node --validator --chain chain-spec.json --base-path ./data --port 30333 --bootnodes /ip4/127.0.0.1/tcp/3033/p2p/12D3KooWGxZsVx5a9FDaJcC6XEVGqi24oQGp5j6CZ8ZZUA3nU32L
command output: 2024-08-28 15:18:04 Partner Chains Node
command output: 2024-08-28 15:18:04 ✌️  version 1.0.0-2620a12269e
command output: 2024-08-28 15:18:04 ❤️  by IOG , 2017-2024
command output: 2024-08-28 15:18:04 📋 Chain specification: Partner Chains Template
command output: 2024-08-28 15:18:04 🏷  Node name: absurd-sugar-5632
command output: 2024-08-28 15:18:04 👤 Role: AUTHORITY
command output: 2024-08-28 15:18:04 💾 Database: RocksDb at ./data/chains/partner_chains_template/db/full
command output: 2024-08-28 15:18:04 Using block data source configuration: DbSyncBlockDataSourceConfig { cardano_security_parameter: 432, cardano_active_slots_coeff: 0.05, block_stability_margin: 0 }
command output: 2024-08-28 15:18:04 Executing 'CREATE INDEX IF NOT EXISTS idx_ma_tx_out_ident ON ma_tx_out(ident)', this might take a while
command output: 2024-08-28 15:18:04 relation "idx_ma_tx_out_ident" already exists, skipping
command output: 2024-08-28 15:18:04 Using candidate data source configuration: CandidateDataSourceCacheConfig { cardano_security_parameter: 432 }
command output: 2024-08-28 15:18:05 Start session 0, epoch 0
command output: 2024-08-28 15:18:07 Using default protocol ID "sup" because none is configured in the chain specs
command output: 2024-08-28 15:18:07 🏷  Local node identity is: 12D3KooWGxZsVx5a9FDaJcC6XEVGqi24oQGp5j6CZ8ZZUA3nU32L
command output: 2024-08-28 15:18:07 Running libp2p network backend
command output: 2024-08-28 15:18:07 Using block data source configuration: DbSyncBlockDataSourceConfig { cardano_security_parameter: 432, cardano_active_slots_coeff: 0.05, block_stability_margin: 0 }
command output: 2024-08-28 15:18:07 Executing 'CREATE INDEX IF NOT EXISTS idx_ma_tx_out_ident ON ma_tx_out(ident)', this might take a while
command output: 2024-08-28 15:18:07 relation "idx_ma_tx_out_ident" already exists, skipping
command output: 2024-08-28 15:18:07 Using candidate data source configuration: CandidateDataSourceCacheConfig { cardano_security_parameter: 432 }
command output: 2024-08-28 15:18:07 💻 Operating system: macos
command output: 2024-08-28 15:18:07 💻 CPU architecture: aarch64
command output: 2024-08-28 15:18:07 📦 Highest known block at #0
command output: 2024-08-28 15:18:07 〽️ Prometheus exporter started at 127.0.0.1:9615
command output: 2024-08-28 15:18:07 Running JSON-RPC server: addr=127.0.0.1:9944, allowed origins=["http://localhost:*", "http://127.0.0.1:*", "https://localhost:*", "https://127.0.0.1:*", "https://polkadot.js.org"]
command output: 2024-08-28 15:18:12 Unable to author block in slot. Failure creating inherent data provider: Stable block not found at 1724851092000. It means that the main chain wasn't producing blocks for a long time.
command output: 2024-08-28 15:18:12 💤 Idle (0 peers), best: #0 (0x2991…7d6e), finalized #0 (0x2991…7d6e), ⬇ 0 ⬆ 0
command output: 2024-08-28 15:18:17 💤 Idle (0 peers), best: #0 (0x2991…7d6e), finalized #0 (0x2991…7d6e), ⬇ 0 ⬆ 0
command output: 2024-08-28 15:18:18 Unable to author block in slot. Failure creating inherent data provider: Stable block not found at 1724851098000. It means that the main chain wasn't producing blocks for a long time.
command output: 2024-08-28 15:18:22 💤 Idle (0 peers), best: #0 (0x2991…7d6e), finalized #0 (0x2991…7d6e), ⬇ 0 ⬆ 0
command output: 2024-08-28 15:18:24 Unable to author block in slot. Failure creating inherent data provider: Stable block not found at 1724851104000. It means that the main chain wasn't producing blocks for a long time.
command output: 2024-08-28 15:18:27 💤 Idle (0 peers), best: #0 (0x2991…7d6e), finalized #0 (0x2991…7d6e), ⬇ 0 ⬆ 0
command output: 2024-08-28 15:18:30 Unable to author block in slot. Failure creating inherent data provider: Stable block not found at 1724851110000. It means that the main chain wasn't producing blocks for a long time.
command output: 2024-08-28 15:18:32 💤 Idle (0 peers), best: #0 (0x2991…7d6e), finalized #0 (0x2991…7d6e), ⬇ 0 ⬆ 0
command output: 2024-08-28 15:18:36 Unable to author block in slot. Failure creating inherent data provider: Stable block not found at 1724851116000. It means that the main chain wasn't producing blocks for a long time.
command output: 2024-08-28 15:18:37 💤 Idle (0 peers), best: #0 (0x2991…7d6e), finalized #0 (0x2991…7d6e), ⬇ 0 ⬆ 0
command output: 2024-08-28 15:18:42 Unable to author block in slot. Failure creating inherent data provider: Stable block not found at 1724851122000. It means that the main chain wasn't producing blocks for a long time.
command output: 2024-08-28 15:18:42 💤 Idle (0 peers), best: #0 (0x2991…7d6e), finalized #0 (0x2991…7d6e), ⬇ 0 ⬆ 0
command output: 2024-08-28 15:18:47 💤 Idle (0 peers), best: #0 (0x2991…7d6e), finalized #0 (0x2991…7d6e), ⬇ 0 ⬆ 0
command output: 2024-08-28 15:18:48 Unable to author block in slot. Failure creating inherent data provider: Stable block not found at 1724851128000. It means that the main chain wasn't producing blocks for a long time.
bwbush commented 2 weeks ago

@falcucci , thanks for the diagnosis. Interestingly, my node doesn't report command output: 2024-08-28 15:18:18 Unable to author block in slot. Failure creating inherent data provider: Stable block not found at 1724851098000. It means that the main chain wasn't producing blocks for a long time. message, but it doesn't produce blocks either.

I'm going to try to run the chain in a pure substrate environment in order to see what the expected behavior (logs, blocks, etc.) and then compare that to the output of the PC node.

falcucci commented 2 weeks ago

cc @LGLO @tgunnoe @skylar-simoncelli @AmbientTea