hicetnunc icon indicating copy to clipboard operation
hicetnunc copied to clipboard

Unable to purchase objkt 62034 due to wrong swap_id

Open skenaja opened this issue 3 years ago • 11 comments

Describe the bug

Try to collect https://www.hicetnunc.xyz/objkt/62034 returns in this transaction is likely to fail

"transaction", "amount": 1500000, "parameters":
 { "entrypoint": "collect", "value": { "prim": "Pair", "args": [ { "int": "1" }, { "int": "105359" } ] } } } ]

The HEN API has returned the wrong swap_id to the front-end.

It invokes the following ConseilJS call to cryptonomics, which returns the wrong key (105359)

$ curl  -X POST -H "Content-Type: application/json" \
> -d  '{"fields":["key","value"],"predicates":[{"field":"big_map_id","operation":"eq","set":[523],"inverse":false},{"field":"value","operation":"like","set":[") (Pair 62034 "],"inverse":false},{"field":"block_level","operation":"gt","set":[1434792],"inverse":false}],"orderBy":[],"aggregation":[],"limit":1000}' --header "apiKey: galleon" https://conseil-prod.cryptonomic-infra.tech/v2/data/tezos/mainnet/big_map_contents

[{"key":"105359","value":"Pair (Pair 0x0000e64f144bcf34fd84108f8dd1a663ed59d102de4d 33) (Pair 62034 1500000)"}]

The swap ID should be 105363. This can be confirmed from these API calls:

https://staging.api.tzkt.io/v1/bigmaps/523/keys?value.objkt_id=62034

[{"id":953080,"active":true,"hash":"exprvK2XZ4BRwkeKDQ2ZVqem5q9jKxLvxwMNyYb2T31GXWnhYZJ93p",
"key":"105363","value":{"issuer":"tz1gdnqmKkbyJagbTEFc6tzbWtz6HpfgNzGd","objkt_id":"62034",
"objkt_amount":"33","xtz_per_objkt":"1500000"},"firstLevel":1456591,"lastLevel":1456591,"updates":1}]

OPG: ooBhPpn6yKUxyAWeeWp4bZxUomwj1Eq6T7QeHNgyN7r45V4qiz9

To Reproduce See above.

Issue escalated to Crytonomics team via https://app.element.io/#/room/#cryptonomic-users:cryptonomic.tech

I'll add comments to the issue when more information received from Crytonomics.

skenaja avatar May 04 '21 16:05 skenaja

I've validated that the BCD hash and swap ID data is the correct one.

$ ./tezos-client hash data '105363' of type int
... Script-expression-ID-Hash: exprvK2XZ4BRwkeKDQ2ZVqem5q9jKxLvxwMNyYb2T31GXWnhYZJ93p

skenaja avatar May 04 '21 17:05 skenaja

Another example:

https://staging.api.tzkt.io/v1/bigmaps/523/keys?value.objkt_id=8410&active=true

[{"id":856126,"active":true,"hash":"exprvHHdZEYaUXEdd5unvTEiN4yLGCquwa6Z9yPoSLuRjYk6Z262YT","key":"87172","value":{"issuer":"tz1UGcoyfZj3QaKkLXuQSXgBA7urSBjDDvXe","objkt_id":"8410","objkt_amount":"1","xtz_per_objkt":"2000000"},"firstLevel":1449894,"lastLevel":1449894,"updates":1},{"id":859470,"active":true,"hash":"exprvF5moJUtvpLmeidYMkKFTXw7YLsQxnLTju33xwoVC8N3xcjjWB","key":"87613","value":{"issuer":"tz1NzZB8EdvW5Uppth48tbajc77Uk3iXTmkg","objkt_id":"8410","objkt_amount":"1","xtz_per_objkt":"1230000"},"firstLevel":1450063,"lastLevel":1450063,"updates":1}]

Cryptonomic incorrectly includes swap_id 8374 in bigmap 523.

curl  -X POST -H "Content-Type: application/json" \
-d '{"fields":["key","value"],"predicates":[{"field":"big_map_id","operation":"eq","set":[523],"inverse":false},{"field":"value","operation":"like","set":["Pair (Pair 0x0000c7709cab41083683eb024122c56bdef51474a9ed "],"inverse":false}],"orderBy":[],"aggregation":[],"limit":1000}' \
 --header "apiKey: galleon" https://conseil-prod.cryptonomic-infra.tech/v2/data/tezos/mainnet/big_map_contents
 
 [{"key":"63341","value":"Pair (Pair 0x0000c7709cab41083683eb024122c56bdef51474a9ed 5) (Pair 43105 2000000)"},{"key":"67742","value":"Pair (Pair 0x0000c7709cab41083683eb024122c56bdef51474a9ed 5) (Pair 45961 2000000)"},{"key":"8374","value":"Pair (Pair 0x0000c7709cab41083683eb024122c56bdef51474a9ed 25) (Pair 8410 0)"},{"key":"75189","value":"Pair (Pair 0x0000c7709cab41083683eb024122c56bdef51474a9ed 5) (Pair 49918 1000000)"},{"key":"13648","value":"Pair (Pair 0x0000c7709cab41083683eb024122c56bdef51474a9ed 96) (Pair 12781 250000)"},{"key":"87258","value":"Pair (Pair 0x0000c7709cab41083683eb024122c56bdef51474a9ed 5) (Pair 54631 1000000)"},{"key":"90782","value":"Pair (Pair 0x0000c7709cab41083683eb024122c56bdef51474a9ed 4) (Pair 56106 2000000)"},{"key":"109931","value":"Pair (Pair 0x0000c7709cab41083683eb024122c56bdef51474a9ed 5) (Pair 63988 2000000)"}]

skenaja avatar May 05 '21 16:05 skenaja

Another example of wrong swap ID 111316 vs 111304 https://staging.api.tzkt.io/v1/bigmaps/523/keys?value.objkt_id=64641

[{"id":984789,"active":false,"hash":"exprvEJFjj6tYbD72Zi22gCM7JoX2JduE2zVqGR925zToHSF4uTDt5","key":"111316","value":{"issuer":"tz1gVKxpEGC7QW1fZyEEMEW2kgJRbpgWLNpD","objkt_id":"64641","objkt_amount":"50","xtz_per_objkt":"3000000"},"firstLevel":1458787,"lastLevel":1458791,"updates":2}]

 curl  -X POST -H "Content-Type: application/json" \
 -d  '{"fields":["key","value"],"predicates":[{"field":"big_map_id","operation":"eq","set":[523],"inverse":false},{"field":"value","operation":"like","set":[") (Pair 64641 "],"inverse":false}],"orderBy":[],"aggregation":[],"limit":1000}' --header "apiKey: galleon" https://conseil-prod.cryptonomic-infra.tech/v2/data/tezos/mainnet/big_map_contents

[{"key":"111304","value":"Pair (Pair 0x0000e4b55088f992f7a8814184f86ba817eeeebda8d0 50) (Pair 64641 3000000)"}]

skenaja avatar May 05 '21 18:05 skenaja

Another example: 111305 vs 111307

https://staging.api.tzkt.io/v1/bigmaps/523/keys?value.objkt_id=64647

[{"id":984655,"active":true,"hash":"exprupbnNjHc8bQhKosxndbRJCCgTztuuJn72wNffZ642yfsJLNKyK","key":"111305","value":{"issuer":"tz1SRhv2Nrj31bXXCW9vo8LbA9PzbRk2LcK9","objkt_id":"64647","objkt_amount":"1","xtz_per_objkt":"9000000"},"firstLevel":1458786,"lastLevel":1458786,"updates":1}]

$ curl  -X POST -H "Content-Type: application/json" \
>  -d  '{"fields":["key","value"],"predicates":[{"field":"big_map_id","operation":"eq","set":[523],"inverse":false},{"field":"value","operation":"like","set":[") (Pair 64647 "],"inverse":false}],"orderBy":[],"aggregation":[],"limit":1000}' --header "apiKey: galleon" https://conseil-prod.cryptonomic-infra.tech/v2/data/tezos/mainnet/big_map_contents
[{"key":"111307","value":"Pair (Pair 0x00004a7436db38cd71e30ee7fd4f5b92d18ba23d3e86 1) (Pair 64647 9000000)"}]

skenaja avatar May 05 '21 21:05 skenaja

Latest update from earlier today:

Thanks for all the data you supplied us. Looks like we have a deployment bug rather than a code bug. We are actively working on a fix. Other deployments of Conseil should not face this issue.

skenaja avatar May 06 '21 21:05 skenaja

All the above incorrect swap ID issues have been resolved & users have been updated.

skenaja avatar May 08 '21 15:05 skenaja

This issue is reoccurring again:

https://api.tzkt.io/v1/bigmaps/523/keys?value.objkt_id=116557&select=key,value,hash

[{"key":"234549","value":{"issuer":"tz1SnahmhRye1aTDGojxTpxZt5JLZr3odmt1","objkt_id":"116557","objkt_amount":"10","xtz_per_objkt":"2000000"},"hash":"exprv4FfSasQCAiFAqPQYpZFdF7BJ2DwWXqaAWynvhGmPDUCFPWcc9"}]

confirm 234549 is correct key - compare hash:
~/code/Tezos$ ./tezos-client hash data '234549' of type int
Script-expression-ID-Hash: exprv4FfSasQCAiFAqPQYpZFdF7BJ2DwWXqaAWynvhGmPDUCFPWcc9

Conseil:

$ curl  -X POST -H "Content-Type: application/json" -d  '{"fields":["key","value"],"predicates":[{"field":"big_map_id","operation":"eq","set":[523],"inverse":false},{"field":"value","operation":"like","set":[") (Pair 116557 "],"inverse":false}],"orderBy":[],"aggregation":[],"limit":1000}' --header "apiKey: galleon" https://conseil-prod.cryptonomic-infra.tech/v2/data/tezos/mainnet/big_map_contents
[{"key":"234548","value":"Pair (Pair 0x00004e66ee08e3e72dd52283d0c87b653cdb8caaf917 10) (Pair 116557 2000000)"}]

234548 is therefore incorrect key. Reporting to cryptonomic

skenaja avatar Jun 08 '21 14:06 skenaja

Another example (from #857) - one of the swaps (key = 247332) is missing from Conseil:

Actual:

 curl  -X POST -H "Content-Type: application/json" -d  '{"fields":["key","value"],"predicates":[{"field":"big_map_id","operation":"eq","set":[523],"inverse":false},{"field":"value","operation":"like","set":[") (Pair 121271 "],"inverse":false}],"orderBy":[],"aggregation":[],"limit":1000}' --header "apiKey: galleon" https://conseil-prod.cryptonomic-infra.tech/v2/data/tezos/mainnet/big_map_contents
[{"key":"247204","value":"Pair (Pair 0x00009d600e4c21c0c813eae00bfbe0247bbd96173444 1) (Pair 121271 50000000)"},
{"key":"247174","value":"Pair (Pair 0x00007b7d8e30c0e41b7acd31f77032ed72cb5cafe811 3) (Pair 121271 16000000)"}]

Expected https://api.tzkt.io/v1/bigmaps/523/keys?value.objkt_id=121271&select=key,value,hash

[{"key":"247174","value":{"issuer":"tz1WtzDTZ9CpNsBem8DrK7owB4pt4XvzdUKB","objkt_id":"121271","objkt_amount":"3","xtz_per_objkt":"16000000"},"hash":"exprtaDh7V1skoHs2CnZ7VG9jEUfbhky7GuY6fpYExHaCg3p7q8MXa"},
{"key":"247204","value":{"issuer":"tz1Zz9rKATokYFEGaVPbuPkGUPqa4hPuBKAb","objkt_id":"121271","objkt_amount":"1","xtz_per_objkt":"50000000"},"hash":"expruRznaiAZrxK8HS8Rk6Bzb4Z9Dw1Dhuvv5GoXyWstyr1B6YDk7E"},
{"key":"247332","value":{"issuer":"tz2ScEdNF1p9QDZezWzaDdADJAHgoK4SG4bz","objkt_id":"121271","objkt_amount":"1","xtz_per_objkt":"36573000"},"hash":"expruJKvFjW9MnPvbtCN4qGiGq8FZ68DqgHgf9KrimjRinwzZGQzWb"}]

skenaja avatar Jun 11 '21 11:06 skenaja

Is there something I have to do to get this resolved?

TJohanson82 avatar Jun 11 '21 21:06 TJohanson82

@TJohanson82 When Cryptonomic fix their data (they're a blockchain data provider used by the hicetnunc) it will resolve itself. I'll update this ticket when I've heard back from them.

skenaja avatar Jun 11 '21 22:06 skenaja

Another potential indexing issue (from #888), this one has null value

tzkt: https://api.tzkt.io/v1/bigmaps/523/keys?key=271193

[{"id":1906339,"active":false,"hash":"exprvDumfZ2eZPgsUqJpvH4Hz2JmFVMnkDL6kV5uFPakHoVwiswnfL",
"key":"271193","value":{"issuer":"tz1ZfApCB1rmfyByn9e1jj1w9jLSY1wfu9dm","objkt_id":"129238","objkt_amount":"1","xtz_per_objkt":"15000000"},
"firstLevel":1513573,"lastLevel":1516677,"updates":2}]

conseil:

curl  -X POST -H "Content-Type: application/json" -d  '{"fields":["key","value","key_hash"],"predicates":[{"field":"big_map_id","operation":"eq","set":[523],"inverse":false},{"field":"key","operation":"like","set":["271193"],"inverse":false}],"orderBy":[],"aggregation":[],"limit":1000}' --header "apiKey: galleon" https://conseil-prod.cryptonomic-infra.tech/v2/data/tezos/mainnet/big_map_contents
[{"key":"271193","value":null,"key_hash":"exprvDumfZ2eZPgsUqJpvH4Hz2JmFVMnkDL6kV5uFPakHoVwiswnfL"}]a

skenaja avatar Jun 16 '21 11:06 skenaja