pytoniq v0.1.35
What's Changed
getAllShardsInfo
- add new proof checking in
get_all_shards_info
since the proof system has been changed.
Get Methods
- rename
run_get_method
torun_get_method_remote
run_get_method
now returnsrun_get_method_remote
result, in future may be changed torun_get_method_local
. Please explicitly specifyrun_get_method_remote
in your code if you want to execute methods remotely.- add
run_get_method_local
which downloads contract's state and executes tvm locally via pytvm. Now one can run get methods which require more gas amount, providinggas_limit
param. Executing get method locally is also critically important if you don't trust LiteServer, since result of a remote method execution is unprovable.
New LiteServer methods
- add
get_out_msg_queue_sizes
method which returns sizes of outboundary queues for specified shard or for all shards.
sh = await client.get_out_msg_queue_sizes()
print(len(sh['shards']) - 1, 'shards')
for i in sh['shards']:
print(f"{i['id']['workchain']}:{hex(i['id']['shard']& 0xffffffffffffffff).replace('0x', '')} - {i['size']}")
# output:
4 shards
-1:8000000000000000 - 0
0:2000000000000000 - 253
0:6000000000000000 - 153
0:a000000000000000 - 61
0:e000000000000000 - 119
-
add nonfinal LiteServer methods
nonfinal_get_validator_groups
andnonfinal_get_candidate
.To use these methods one need to use LiteServer which is at the same time a validator and pass flag
--nonfinal-ls
toExecStart
node command. Then usenonfinal_get_validator_groups
method to getBlockIdExt
and then pass it to other LiteServer raw methods or usenonfinal_get_candidate
method which returns block data and collated data.
resp = await client.nonfinal_get_validator_groups(0, -6917529027641081856)
print(resp)
blk = BlockIdExt.from_dict(resp['groups'][0]['candidates'][0]['id']['block_id'])
print(blk)
print(await client.raw_get_block_transactions_ext(blk))
print(await client.nonfinal_raw_get_candidate(resp['groups'][0]['candidates'][0]['id']))
print(await client.nonfinal_get_candidate(resp['groups'][0]['candidates'][0]['id']))
# output:
{'@type': 'liteServer.nonfinal.validatorGroups', 'groups': [{'next_block_id': {'workchain': 0, 'shard': -6917529027641081856, 'seqno': 19738991, '@type': 'tonNode.blockId'}, 'cc_seqno': 253643, 'prev': [{'workchain': 0, 'shard': -6917529027641081856, 'seqno': 19738990, 'root_hash': '1424b1412ee3658190ccef95483e6e694093e721bac67fca0e7afb15fde132be', 'file_hash': 'eae1435e89c768892b4ab286e58b9723bedbb6004adcba1192d82d527aca0616'}], 'candidates': [{'id': {'block_id': {'workchain': 0, 'shard': -6917529027641081856, 'seqno': 19738991, 'root_hash': 'ea860f329c4660be305ccf5e0e94630db67f6e4396509d751dace1f11915f09d', 'file_hash': '07bee68a49a69e6145ad9693d827e11800e5c346387009f83e273a8620758eca', '@type': 'tonNode.blockIdExt'}, 'creator': '6c2b768957e1501deaaf424bd2dafb6ddbe2ecc7794659f8d4c548420261a18c', 'collated_data_hash': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', '@type': 'liteServer.nonfinal.candidateId'}, 'available': True, 'approved_weight': 14, 'signed_weight': 0, 'total_weight': 15}]}]}
<TL BlockIdExt [wc=0, shard=-6917529027641081856, seqno=19738991, root_hash=ea860f329c4660be305ccf5e0e94630db67f6e4396509d751dace1f11915f09d, file_hash=07bee68a49a69e6145ad9693d827e11800e5c346387009f83e273a8620758eca] >
# [< Tl-B Transaction account_addr: b'\x80\xdc"\x8f\xec ....
# {'@type': 'liteServer.nonfinal.candidate', 'id': {'block_id': {'wor
# < Tl-B Block global_id: -3 info: < Tl-B BlockInfo version: ....