Closed locallycompact closed 2 years ago
I saw it mentioned in a comment here that the chain index is slow and utxosAt
could take hours to complete.
https://github.com/input-output-hk/plutus-apps/issues/249#issuecomment-1060207972
Indeed it's not effective at the moment. There is #319 that should improve the speed of chain index.
Not sure how easy it is with your current setup, but can you try removing the utxosAt
call and passing the UTxOs in through PAB endpoint parameters instead? If it's your own address on the testnet I guess you can also try hardcoding the UTxOs in to see if the problem is really on utxosAt
, and in turn the Plutus chain index behind it.
So just an update for this. I'm on latest master for everything. I have cardano-node, cardano-wallet and plutus-chain-index running independently on ports, and the plutus-pab.yaml is configured with those ports, the chain index is fully synced, but utxosAt does not return. There doesn't seem to be any reference to the endpoint "/utxo-at-address" anywhere in the code except for the tests. So is the PAB interpreter even calling this?
Edit: I can call utxo-at-address just fine with the API using curl, now I will try what @kk-hainq suggested and pass that in through the endpoint.
I just realised I can't really hardcode it because I need something to pass into the lookups.
I think I have the same issue. Running PAB in verbose the final line before "hanging" is
[pab:Debug:28] [2022-03-28 13:00:57.69 UTC] Handling 1 requests for c835ae89-0aef-4a95-b8e6-d202f367cf4f
Iteration 3 request ID 1
Request: Chain index query: requesting utxos located at addresses with the credential PubKeyCredential: dada5e7c74f6c15d1c7899d6620dd17963e8a3e0697f631cd2877ea1
[pab:Debug:28] [2022-03-28 13:00:57.69 UTC] Slot 0: W4231afb: handleChainIndexQueries start
If I query the chain-index directly with what I guess utxosAt
should be doing, its slow but does respond
curl -X 'POST' 'http://localhost:9083/utxo-at-address' -H 'accept: application/json;charset=utf-8' -H 'Content-Type: application/json;charset=utf-8' -d '{
"credential": {
"contents": {"getPubKeyHash" : "dada5e7c74f6c15d1c7899d6620dd17963e8a3e0697f631cd2877ea1"},
"tag": "PubKeyCredential"
}
}'
...
{"currentTip":{"tag":"Tip","tipBlockNo":3431466,"tipBlockId":"adb80a72985e7446bbc7b5b22219e90b8533b972c3ffb88a99f7cb6a68670c9d","tipSlot":{"getSlot":54102725}},"page":{"currentPageQuery":{"pageQueryLastItem":null,"pageQuerySize":{"getPageSize":50}},"pageItems":[{"txOutRefId":{"getTxId":"1253f04ef06d8a3c415713ac5995c414029aeb9687b7890ed4f12b1ffeecfa1e"},"txOutRefIdx":0},{"txOutRefId":{"getTxId":"a439edf4ab362b676152fa8ab759d048d9512bd7c7888b4f01a09d948f34ecdb"},"txOutRefIdx":0},{"txOutRefId":{"getTxId":"e6eb1c810297e4b835f8b52a69297e074b4e07426448851f9cd54e95253fb3d9"},"txOutRefIdx":0},{"txOutRefId":{"getTxId":"fc006af9d370c12b26d615dcabc5f50f9941aa1802cd65f0cd7383b501b69be4"},"txOutRefIdx":0}],"nextPageQuery":null}}
The chain index also logs the request from the curl command, while I see nothing when I expect the PAB to hit it.
PS chain index swagger says credential.contents
is expecting a string
, when it actually requires an object. This happens in a few places.
PPS I was gonna try to follow @kk-hainq suggestion of shoe horning the utxo data in by other means, but I thought I'd first try bumping my dependencies. This did not go well, but my issues are no longer as above so I just wanted to point that out before it took up too much of anyone elses attention.
The PAB now says "utxo not found"
. I am guessing this is because I've set pabResumeFrom
to be too recent, but if I push it back my machine falls over. I don't entirely understand why the PAB needs to sync at all, and doesn't leave this to the Chain Index, Wallet and Node. And I still can't see the PAB actually talking to the chain index, according to the chain index logs.
Plutus-apps commit c9c1e917edbf
Apologies for spamming the thread. A further update. (This is all above my head but) I think I've diagnosed that the PAB is posting to an endpoint that the chain-index doesn't have. At least not my version.
Piping the requests through a socat
relay dumps the following output:
POST /unspent-tx-out HTTP/1.1\r
Host: localhost:9084\r
Accept-Encoding: gzip\r
Content-Length: 109\r
Accept: application/json;charset=utf-8,application/json\r
Content-Type: application/json;charset=utf-8\r
\r
{"txOutRefId":{"getTxId":"1253f04ef06d8a3c415713ac5995c414029aeb9687b7890ed4f12b1ffeecfa1e"},"txOutRefIdx":1}< 2022/03/29 11:29:41.512195 length=117 from=0 to=116
HTTP/1.1 404 Not Found\r
Transfer-Encoding: chunked\r
Date: Tue, 29 Mar 2022 11:29:41 GMT\r
Server: Warp/3.3.18\r
This is running Lars's PPP#3L6 mint.
PAB reporting the error from here since the return is Nothing
My version of the chain index has /unspent-tx-out, but it doesn't work. Perhaps this is related. https://github.com/input-output-hk/plutus-apps/pull/377
When chain-index is syncing, the querying is blocked until the next set of blocks are processed (because of a blocking MVar).
The following PR will probably solve it #386 .
@locallycompact Can you try again? Should be solved in main
with the PR #386 .
Oh yes I did get this working. Thanks!
Summary
Hi, I'm using an NFT contract through the PAB.
https://gitlab.homotopic.tech/plutus/contracts/nft/-/blob/master/src/Plutus/Contracts/NFT.hs
Pasted here:
The output that I get from calling the "mint" endpoint through the pab-cli using the wallet backend is as follows:
There is no additional information the testnet output from pab-cli that indicates an error. So, it seems like it gets as far as the
utxosAt
call and then just stops doing anything.Steps to reproduce the behavior
The PAB I'm using is here: https://gitlab.homotopic.tech/plutus/apps/multi-pab with the above contract as a package dependency.
nix run.
Actual Result
No log
Expected Result
Some log
Describe the approach you would take to fix this
No response
System info
NixOS