diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 201730a..e425860 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,7 +20,7 @@ jobs: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} - runs-on: arc-runner-set + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 @@ -39,9 +39,9 @@ jobs: run: | cd docs && make html - name: Upload artifact - uses: actions/upload-pages-artifact@v1 + uses: actions/upload-pages-artifact@v3 with: path: './docs/build/html' - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v2 + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 5e5a88c..16237d6 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -18,35 +18,29 @@ permissions: jobs: build: strategy: + fail-fast: false matrix: include: - # macOS x86_64 - arch: x86_64 - os: macos-latest - python: "3.8" - link: https://github.com/disintar/ton/releases/download/ton-cpython-38-x86_64-darwin/ - file: python_ton.cpython-38-darwin.so - fix_tag: x86_64 - - arch: x86_64 - os: macos-latest + os: macos-13 python: "3.10" link: https://github.com/disintar/ton/releases/download/ton-cpython-310-x86_64-darwin/ file: python_ton.cpython-310-darwin.so fix_tag: x86_64 - arch: x86_64 - os: macos-latest + os: macos-13 python: "3.11" link: https://github.com/disintar/ton/releases/download/ton-cpython-311-x86_64-darwin/ file: python_ton.cpython-311-darwin.so fix_tag: x86_64 - arch: x86_64 - os: macos-latest + os: macos-13 python: "3.12" link: https://github.com/disintar/ton/releases/download/ton-cpython-312-x86_64-darwin/ file: python_ton.cpython-312-darwin.so fix_tag: x86_64 - arch: x86_64 - os: macos-latest + os: macos-13 python: "3.13" link: https://github.com/disintar/ton/releases/download/ton-cpython-313-x86_64-darwin/ file: python_ton.cpython-313-darwin.so @@ -66,39 +60,21 @@ jobs: file: python_ton.cpython-313-x86_64-linux-gnu.so fix_tag: manylinux2014_x86_64 - # Legacy Linux x86_64 (kuber) kept - - arch: x86_64 - os: kuber - python: "3.8" - link: https://github.com/disintar/ton/releases/download/ton-cpython-38-x86_64-linux/ - file: python_ton.cpython-38-x86_64-linux-gnu.so - fix_tag: manylinux2014_x86_64 + # Legacy Linux x86_64 - arch: x86_64 - os: kuber - python: "3.9" - link: https://github.com/disintar/ton/releases/download/ton-cpython-39-x86_64-linux/ - file: python_ton.cpython-39-x86_64-linux-gnu.so - fix_tag: manylinux2014_x86_64 - - arch: x86_64 - os: kuber + os: arc-runner-set python: "3.10" link: https://github.com/disintar/ton/releases/download/ton-cpython-310-x86_64-linux/ file: python_ton.cpython-310-x86_64-linux-gnu.so fix_tag: manylinux2014_x86_64 - arch: x86_64 - os: kuber + os: arc-runner-set python: "3.11" link: https://github.com/disintar/ton/releases/download/ton-cpython-311-x86_64-linux/ file: python_ton.cpython-311-x86_64-linux-gnu.so fix_tag: manylinux2014_x86_64 # macOS arm64 - - arch: aarch64 - os: macos-15 - python: "3.8" - link: https://github.com/disintar/ton/releases/download/ton-cpython-38-aarch64-darwin/ - file: python_ton.cpython-38-darwin.so - fix_tag: arm64 - arch: aarch64 os: macos-15 python: "3.10" @@ -126,31 +102,25 @@ jobs: # Windows x64 - arch: x86_64 - os: windows-2019 - python: "3.9" - link: https://github.com/disintar/ton/releases/download/ton-cpython-39-x86_64-windows/ - file: python_ton.cp39-win_amd64.pyd - fix_tag: - - arch: x86_64 - os: windows-2019 + os: windows-2022 python: "3.10" link: https://github.com/disintar/ton/releases/download/ton-cpython-310-x86_64-windows/ file: python_ton.cp310-win_amd64.pyd fix_tag: - arch: x86_64 - os: windows-2019 + os: windows-2022 python: "3.11" link: https://github.com/disintar/ton/releases/download/ton-cpython-311-x86_64-windows/ file: python_ton.cp311-win_amd64.pyd fix_tag: - arch: x86_64 - os: windows-2019 + os: windows-2022 python: "3.12" link: https://github.com/disintar/ton/releases/download/ton-cpython-312-x86_64-windows/ file: python_ton.cp312-win_amd64.pyd fix_tag: - arch: x86_64 - os: windows-2019 + os: windows-2022 python: "3.13" link: https://github.com/disintar/ton/releases/download/ton-cpython-313-x86_64-windows/ file: python_ton.cp313-win_amd64.pyd @@ -175,7 +145,7 @@ jobs: run: | sudo apt update sudo apt install -y curl - if: matrix.os == 'kuber' + if: matrix.os == 'arc-runner-set' - name: Download prebuilt run: | @@ -186,7 +156,7 @@ jobs: mv win/libcrypto-1_1-x64.dll ./src/tonpy/libs/ mv MANIFEST.in MANIFEST_LINUX.in mv MANIFEST_WIN.in MANIFEST.in - if: matrix.os == 'windows-2019' + if: matrix.os == 'windows-2022' - name: Run tests run: | @@ -198,67 +168,11 @@ jobs: python fix_whl_name.py env: TAG_FIX: ${{ matrix.fix_tag }} - - name: Store the binary wheel - uses: actions/upload-artifact@v4 - with: - name: python-package-distributions - path: dist - buildMacOs39: - strategy: - matrix: - include: - - arch: x86_64 - os: macos-latest - python: "3.9" - link: https://github.com/disintar/ton/releases/download/ton-cpython-39-x86_64-darwin/ - file: python_ton.cpython-39-darwin.so - fix_tag: x86_64 - - - arch: aarch64 - os: macos-15 - python: "3.9" - link: https://github.com/disintar/ton/releases/download/ton-cpython-39-aarch64-darwin/ - file: python_ton.cpython-39-darwin.so - fix_tag: arm64 - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - - name: Install python3.9 - run: | - /opt/homebrew/bin/brew install python@3.9 - if: matrix.os == 'macOS' - - - name: Install python3.9 - run: | - brew install python@3.9 - if: matrix.os == 'macos-latest' - - - name: Install deps - run: | - python3.9 -m pip install -r built_requirements.txt - python3.9 -m pip install -r requirements.txt - - - name: Download prebuilt - run: | - curl -Lo ./src/tonpy/libs/${{ matrix.file }} ${{ matrix.link }}${{ matrix.file }} - - - name: Run tests - run: | - python3.9 -m pytest - - - name: Build wheel - run: | - python3.9 -m build --wheel --outdir dist/ . - python3.9 fix_whl_name.py - env: - TAG_FIX: ${{ matrix.fix_tag }} - name: Store the binary wheel uses: actions/upload-artifact@v4 with: - name: python-package-distributions + name: python-package-distributions-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.python }} path: dist # buildVirtualLinux: @@ -317,11 +231,10 @@ jobs: deploy: name: Publish 🐍📦 to PyPI - runs-on: kuber + runs-on: arc-runner-set needs: # - buildVirtualLinux - build - - buildMacOs39 steps: - uses: actions/checkout@v4 @@ -330,10 +243,18 @@ jobs: python-version: "3.11" env: USER: tvorogme + - name: Merge artifacts + uses: actions/upload-artifact/merge@v4 + if: always() + with: + name: python-package-distributions-${{ github.run_id }} + pattern: python-package-distributions-${{ github.run_id }}-* + delete-merged: true + - name: Download all the dists - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: - name: python-package-distributions + name: python-package-distributions-${{ github.run_id }} path: dist/ - name: Install deps @@ -344,4 +265,4 @@ jobs: twine upload dist/* env: TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + TWINE_PASSWORD: ${{ secrets.PYPI_MAIN_API_TOKEN }} diff --git a/README.md b/README.md index 52d3b85..a675c5b 100644 --- a/README.md +++ b/README.md @@ -48,13 +48,13 @@ Documentation can be found on [tonpy.dton.io](https://tonpy.dton.io) ### Supported systems / architectures / Python | System | Architecture | Python versions | CI status | -|:--|:--|:--|:-----------------------| -| 🐧 Linux | `x86_64` | 3.8 – 3.13 | ✅ | -| 🐧 Linux | `aarch64` | 3.8 – 3.13 | ✅ | -| 🍎 macOS | `x86_64` (Intel) | 3.8 – 3.13 | ✅ | -| 🍎 macOS | `aarch64` (Apple Silicon) | 3.8 – 3.13 | ✅ | -| 🪟 Windows | `x86_64` | 3.9 – 3.13 | ✅ | -| 🪟 Windows | `aarch64` | — | ⛔ | +|:--|:--|:----------------|:-----------------------| +| 🐧 Linux | `x86_64` | 3.10 – 3.13 | ✅ | +| 🐧 Linux | `aarch64` | 3.10 – 3.13 | ✅ | +| 🍎 macOS | `x86_64` (Intel) | 3.10 – 3.13 | ✅ | +| 🍎 macOS | `aarch64` (Apple Silicon) | 3.10 – 3.13 | ✅ | +| 🪟 Windows | `x86_64` | 3.10 – 3.13 | ✅ | +| 🪟 Windows | `aarch64` | — | ⛔ | ## Speed compare diff --git a/setup.py b/setup.py index 689bf60..50a5e51 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ def finalize_options(self): setup( name="tonpy" if not IS_DEV else "tonpy-dev", - version="0.0.0.1.3a0" if not IS_DEV else "0.0.0.5.9c1", + version="0.0.0.1.3b0" if not IS_DEV else "0.0.0.5.9c1", author="Disintar LLP", author_email="andrey@head-labs.com", description="Types / API for TON blockchain", diff --git a/src/tonpy/blockscanner/blockscanner.py b/src/tonpy/blockscanner/blockscanner.py index 78d6f81..fc1864c 100644 --- a/src/tonpy/blockscanner/blockscanner.py +++ b/src/tonpy/blockscanner/blockscanner.py @@ -526,6 +526,7 @@ class BlockScanner(Thread): Loads masterchain and shardchain blocks, optionally filters/emulates transactions, and emits results to a queue or a user-provided callback. """ + def __init__(self, lcparams: dict, start_from: int = None, @@ -764,11 +765,35 @@ def prepare_prev_block_data(self, shards_data, mc_data): for i in range(last_mc - 16, last_mc): to_load_masters.append(i) + prev_block_100 = int(last_mc - last_mc % 100) + to_load_by_100 = [] + while len(to_load_by_100) < 16: + to_load_by_100.append(prev_block_100) + if prev_block_100 == 100: + break + + prev_block_100 -= 100 + + to_load_masters.extend(to_load_by_100) + for s in shards_data: - for i in range(s['master'] - 15, s['master'] + 1): + last_mc = s['master'] + prev_block_100 = int(last_mc - last_mc % 100) + to_load_by_100 = [] + + for i in range(last_mc - 15, last_mc + 1): if i not in known_mcs: to_load_masters.append(i) + while len(to_load_by_100) < 16: + to_load_by_100.append(prev_block_100) + if prev_block_100 == 100: + break + + prev_block_100 -= 100 + + to_load_masters.extend(to_load_by_100) + to_load_masters = list(set(to_load_masters)) if self.loglevel > 1: @@ -781,13 +806,26 @@ def prepare_prev_block_data(self, shards_data, mc_data): for x in mc_data: prev_blocks = [] + prev_blocks_100 = [] + + for i in range(x['block_id'].id.seqno - 16, x['block_id'].id.seqno): + prev_blocks.append(known_mcs[i].to_data()) + + prev_100_seqno = int(x['block_id'].id.seqno - x['block_id'].id.seqno % 100) + while len(prev_blocks_100) < 16: + prev_blocks_100.append(known_mcs[prev_100_seqno].to_data()) + if prev_100_seqno == 100: + break + prev_100_seqno -= 100 for i in range(x['block_id'].id.seqno - 16, x['block_id'].id.seqno): prev_blocks.append(known_mcs[i].to_data()) prev_blocks = list(reversed(prev_blocks)) key = self.known_key_blocks[x['prev_key_block_seqno']] - x['prev_block_data'] = [prev_blocks, key['blk_id'].to_data()] + x['prev_block_data'] = [prev_blocks_100, + prev_blocks, + key['blk_id'].to_data()] x['prev_block_left'] = known_mcs[i] x['prev_block_right'] = None x['key_block'] = key @@ -803,11 +841,19 @@ def prepare_prev_block_data(self, shards_data, mc_data): i['prev_block_data'] = known_prev_block_data[i['master']] else: prev_blocks = [] + prev_blocks_100 = [] for j in range(i['master'] - 16, i['master']): prev_blocks.append(known_mcs[j].to_data()) + prev_100_seqno = int(i['master'] - i['master'] % 100) + while len(prev_blocks_100) < 16: + prev_blocks_100.append(known_mcs[prev_100_seqno].to_data()) + if prev_100_seqno == 100: + break + prev_100_seqno -= 100 + prev_blocks = list(reversed(prev_blocks)) - i['prev_block_data'] = [prev_blocks, key['blk_id'].to_data()] + i['prev_block_data'] = [prev_blocks_100, prev_blocks, key['blk_id'].to_data()] known_prev_block_data[i['master']] = i['prev_block_data'] i['master'] -= 1