Will TON prefix hashmap implementation be shown to have a bug?
Basic
2
Ṁ24
Dec 31
60%
chance

While exploring possibilities of code optimization, I've found some strange behaviour in TVM prefix hashmaps - mappings that support variable-length keys which are not prefixes of each other. In short, I create one such dictionary via TVM and one via my custom program in Python with same key-value pairs, try retrieving the same keys, and one attempt succeeds while other fails.

Is it a bug in TVM or in my program? If former, this market resolves YES. If latter, and no other bug is found by the end of 2024, resolves NO.

This market refers to instructions PFXDICTSET, PFXDICTREPLACE, PFXDICTADD and PFXDICTDEL of TVM of The Open Network blockchain.

Pieces of evidence:

  1. The underlying code is awfully inconvenient to read or understand which functions call which ones, but there is a version from competitor blockchain Everscale which should theoretically be compatible - since it's a fork.

  2. Nor blockchain nor VM have had many bugs earlier.

  3. I've grouped files of my test into a single gist: https://gist.github.com/ProgramCrafter/a22ff3e820f644e57d7cddb57f7b7fe7. Please take note of matching and mismatching hashes in particular.

  4. I've heard a report that someone tried using prefix hashmaps for a zero-terminated-string (that'd guarantee that one string isn't prefix of another) mapping and failed.

Get
Ṁ1,000
and
S3.00
© Manifold Markets, Inc.Terms + Mana-only TermsPrivacyRules