Skip to content

Commit

Permalink
Fix large dict map
Browse files Browse the repository at this point in the history
  • Loading branch information
tvorogme committed May 29, 2024
1 parent 14a1359 commit c00e551
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def finalize_options(self):

setup(
name="tonpy" if not IS_DEV else "tonpy-dev",
version="0.0.0.1.2b0" if not IS_DEV else "0.0.0.4.4b1",
version="0.0.0.1.2b0" if not IS_DEV else "0.0.0.4.4c1",
author="Disintar LLP",
author_email="[email protected]",
description="Types / API for TON blockchain",
Expand Down
23 changes: 22 additions & 1 deletion src/tonpy/tests/test_vmdict.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@
from tonpy.data_for_tests.dict_test_boc import config_44, reveal_dict_boc


def test_large_key_map():
vmdict = VmDict(264, False)

vmdict.set_builder_keycs(
CellBuilder().store_uint(5, 8).store_bitstring('0' * 256).end_cell().begin_parse(),
CellBuilder().store_bitstring('1' * 512)
)

def f(x, y):
assert x.bits == 264
assert y.bits == 512
assert x.load_uint(8) == 5
assert x.load_uint(256) == 0
assert y.to_bitstring() == '1' * 512

return True

vmdict.map(f)


def test_vm_dict_from_boc():
keys = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
Expand Down Expand Up @@ -676,5 +696,6 @@ def load_key_value(key: CellSlice, value: CellSlice):
'-1:EF03AC917E6B763F85079F196B4146457019CABB1F262F678CA8182978C14FA2',
'-1:FC3D252D2B2FD4F8964348D50DA8DE5C56C9FD39126A4BDDCBE8344CF476ECA1']


if __name__ == '__main__':
test_vm_dict_large()
test_vm_dict_large()

0 comments on commit c00e551

Please sign in to comment.