diff --git a/.clang_complete b/.clang_complete index e88dbc7bf..fc22abbb0 100644 --- a/.clang_complete +++ b/.clang_complete @@ -7,6 +7,6 @@ -iquote tdactor/ -iquote tdnet/ -iquote tdutils/ --iquote ../ton-build/tdutils/ +-iquote ../ion-build/tdutils/ -iquote crypto/ -I/opt/local/include/ diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index dbcae6ab4..879295d60 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -5,7 +5,7 @@ - + diff --git a/.github/script/amd64-20.04.Dockerfile b/.github/script/amd64-20.04.Dockerfile index 1ec89ebd7..47f7b5af7 100644 --- a/.github/script/amd64-20.04.Dockerfile +++ b/.github/script/amd64-20.04.Dockerfile @@ -8,13 +8,13 @@ WORKDIR / ARG BRANCH ARG REPO -RUN git clone --recurse-submodules https://github.com/$REPO ton && cd ton && git checkout $BRANCH && git submodule update +RUN git clone --recurse-submodules https://github.com/$REPO ion && cd ion && git checkout $BRANCH && git submodule update -WORKDIR /ton -RUN mkdir /ton/build -WORKDIR /ton/build +WORKDIR /ion +RUN mkdir /ion/build +WORKDIR /ion/build ENV CC clang ENV CXX clang++ ENV CCACHE_DISABLE 1 -RUN cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DTON_ARCH= -DCMAKE_CXX_FLAGS="-mavx2" .. +RUN cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DION_ARCH= -DCMAKE_CXX_FLAGS="-mavx2" .. RUN ninja storage-daemon storage-daemon-cli tonlibjson blockchain-explorer fift func tolk validator-engine validator-engine-console create-state generate-random-id create-hardfork dht-server lite-client diff --git a/.github/script/amd64-22.04.Dockerfile b/.github/script/amd64-22.04.Dockerfile index 6134d1673..f4cdef0a9 100644 --- a/.github/script/amd64-22.04.Dockerfile +++ b/.github/script/amd64-22.04.Dockerfile @@ -8,13 +8,13 @@ WORKDIR / ARG BRANCH ARG REPO -RUN git clone --recurse-submodules https://github.com/$REPO ton && cd ton && git checkout $BRANCH && git submodule update +RUN git clone --recurse-submodules https://github.com/$REPO ion && cd ion && git checkout $BRANCH && git submodule update -WORKDIR /ton -RUN mkdir /ton/build -WORKDIR /ton/build +WORKDIR /ion +RUN mkdir /ion/build +WORKDIR /ion/build ENV CC clang ENV CXX clang++ ENV CCACHE_DISABLE 1 -RUN cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DTON_ARCH= -DCMAKE_CXX_FLAGS="-mavx2" .. +RUN cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DION_ARCH= -DCMAKE_CXX_FLAGS="-mavx2" .. RUN ninja storage-daemon storage-daemon-cli tonlibjson blockchain-explorer fift func tolk validator-engine validator-engine-console create-state generate-random-id create-hardfork dht-server lite-client diff --git a/.github/script/arm64-20.04.Dockerfile b/.github/script/arm64-20.04.Dockerfile index 5e3505345..6a001a769 100644 --- a/.github/script/arm64-20.04.Dockerfile +++ b/.github/script/arm64-20.04.Dockerfile @@ -8,13 +8,13 @@ WORKDIR / ARG BRANCH ARG REPO -RUN git clone --recurse-submodules https://github.com/$REPO ton && cd ton && git checkout $BRANCH && git submodule update +RUN git clone --recurse-submodules https://github.com/$REPO ion && cd ion && git checkout $BRANCH && git submodule update -WORKDIR /ton -RUN mkdir /ton/build -WORKDIR /ton/build +WORKDIR /ion +RUN mkdir /ion/build +WORKDIR /ion/build ENV CC clang ENV CXX clang++ ENV CCACHE_DISABLE 1 -RUN cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DTON_ARCH= .. +RUN cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DION_ARCH= .. RUN ninja storage-daemon storage-daemon-cli tonlibjson blockchain-explorer fift func tolk validator-engine validator-engine-console create-state generate-random-id dht-server lite-client diff --git a/.github/script/arm64-22.04.Dockerfile b/.github/script/arm64-22.04.Dockerfile index f9805849d..97485be4e 100644 --- a/.github/script/arm64-22.04.Dockerfile +++ b/.github/script/arm64-22.04.Dockerfile @@ -8,13 +8,13 @@ WORKDIR / ARG BRANCH ARG REPO -RUN git clone --recurse-submodules https://github.com/$REPO ton && cd ton && git checkout $BRANCH && git submodule update +RUN git clone --recurse-submodules https://github.com/$REPO ion && cd ion && git checkout $BRANCH && git submodule update -WORKDIR /ton -RUN mkdir /ton/build -WORKDIR /ton/build +WORKDIR /ion +RUN mkdir /ion/build +WORKDIR /ion/build ENV CC clang ENV CXX clang++ ENV CCACHE_DISABLE 1 -RUN cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DTON_ARCH= .. +RUN cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DION_ARCH= .. RUN ninja storage-daemon storage-daemon-cli tonlibjson blockchain-explorer fift func tolk validator-engine validator-engine-console create-state generate-random-id dht-server lite-client diff --git a/.github/workflows/build-ton-linux-android-tonlib.yml b/.github/workflows/build-ion-linux-android-tonlib.yml similarity index 94% rename from .github/workflows/build-ton-linux-android-tonlib.yml rename to .github/workflows/build-ion-linux-android-tonlib.yml index a1a6bc99d..0421700e2 100644 --- a/.github/workflows/build-ton-linux-android-tonlib.yml +++ b/.github/workflows/build-ion-linux-android-tonlib.yml @@ -19,7 +19,7 @@ jobs: zlib1g-dev libssl-dev libreadline-dev libmicrohttpd-dev pkg-config libgsl-dev python3 python3-dev \ libtool autoconf libsodium-dev libsecp256k1-dev liblz4-dev - - name: Build TON + - name: Build ION run: | cp assembly/android/build-android-tonlib.sh . chmod +x build-android-tonlib.sh @@ -28,5 +28,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@master with: - name: ton-android-tonlib + name: ion-android-tonlib path: artifacts diff --git a/.github/workflows/build-ton-linux-x86-64-shared.yml b/.github/workflows/build-ion-linux-x86-64-shared.yml similarity index 91% rename from .github/workflows/build-ton-linux-x86-64-shared.yml rename to .github/workflows/build-ion-linux-x86-64-shared.yml index e28ecc742..789acf63b 100644 --- a/.github/workflows/build-ton-linux-x86-64-shared.yml +++ b/.github/workflows/build-ion-linux-x86-64-shared.yml @@ -1,4 +1,4 @@ -name: Ubuntu TON build (shared, x86-64) +name: Ubuntu ION build (shared, x86-64) on: [push,workflow_dispatch,workflow_call] @@ -33,7 +33,7 @@ jobs: chmod +x llvm.sh sudo ./llvm.sh 16 all - - name: Build TON + - name: Build ION run: | cp assembly/native/build-ubuntu-shared.sh . chmod +x build-ubuntu-shared.sh @@ -42,5 +42,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@master with: - name: ton-binaries-${{ matrix.os }} + name: ion-binaries-${{ matrix.os }} path: artifacts diff --git a/.github/workflows/build-ton-macos-15-arm64-shared.yml b/.github/workflows/build-ion-macos-15-arm64-shared.yml similarity index 82% rename from .github/workflows/build-ton-macos-15-arm64-shared.yml rename to .github/workflows/build-ion-macos-15-arm64-shared.yml index 8379a0b04..11613db4b 100644 --- a/.github/workflows/build-ton-macos-15-arm64-shared.yml +++ b/.github/workflows/build-ion-macos-15-arm64-shared.yml @@ -1,4 +1,4 @@ -name: MacOS-15 TON build (shared, arm64) +name: MacOS-15 ION build (shared, arm64) on: [push,workflow_dispatch,workflow_call] @@ -12,7 +12,7 @@ jobs: with: submodules: 'recursive' - - name: Build TON + - name: Build ION run: | cp assembly/native/build-macos-shared.sh . chmod +x build-macos-shared.sh @@ -21,5 +21,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@master with: - name: ton-binaries-macos-15 + name: ion-binaries-macos-15 path: artifacts diff --git a/.github/workflows/build-ton-macos-arm64-shared.yml b/.github/workflows/build-ion-macos-arm64-shared.yml similarity index 82% rename from .github/workflows/build-ton-macos-arm64-shared.yml rename to .github/workflows/build-ion-macos-arm64-shared.yml index aadd23dd0..c24b22f42 100644 --- a/.github/workflows/build-ton-macos-arm64-shared.yml +++ b/.github/workflows/build-ion-macos-arm64-shared.yml @@ -1,4 +1,4 @@ -name: MacOS-14 TON build (shared, arm64) +name: MacOS-14 ION build (shared, arm64) on: [push,workflow_dispatch,workflow_call] @@ -12,7 +12,7 @@ jobs: with: submodules: 'recursive' - - name: Build TON + - name: Build ION run: | cp assembly/native/build-macos-shared.sh . chmod +x build-macos-shared.sh @@ -21,5 +21,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@master with: - name: ton-binaries-macos-14 + name: ion-binaries-macos-14 path: artifacts diff --git a/.github/workflows/build-ton-macos-x86-64-shared.yml b/.github/workflows/build-ion-macos-x86-64-shared.yml similarity index 82% rename from .github/workflows/build-ton-macos-x86-64-shared.yml rename to .github/workflows/build-ion-macos-x86-64-shared.yml index c9331e3be..bd0b0cd50 100644 --- a/.github/workflows/build-ton-macos-x86-64-shared.yml +++ b/.github/workflows/build-ion-macos-x86-64-shared.yml @@ -1,4 +1,4 @@ -name: MacOS TON build (shared, x86-64) +name: MacOS ION build (shared, x86-64) on: [push,workflow_dispatch,workflow_call] @@ -12,7 +12,7 @@ jobs: with: submodules: 'recursive' - - name: Build TON + - name: Build ION run: | cp assembly/native/build-macos-shared.sh . chmod +x build-macos-shared.sh @@ -21,5 +21,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@master with: - name: ton-binaries-macos-12 + name: ion-binaries-macos-12 path: artifacts diff --git a/.github/workflows/build-ton-wasm-emscripten.yml b/.github/workflows/build-ion-wasm-emscripten.yml similarity index 87% rename from .github/workflows/build-ton-wasm-emscripten.yml rename to .github/workflows/build-ion-wasm-emscripten.yml index 534d312fd..abfd76566 100644 --- a/.github/workflows/build-ton-wasm-emscripten.yml +++ b/.github/workflows/build-ion-wasm-emscripten.yml @@ -1,4 +1,4 @@ -name: Emscripten TON build (wasm) +name: Emscripten ION build (wasm) on: [push,workflow_dispatch,workflow_call] @@ -17,7 +17,7 @@ jobs: sudo apt-get update sudo apt-get install -y build-essential git openssl cmake ninja-build zlib1g-dev libssl-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev - - name: Build TON WASM artifacts + - name: Build ION WASM artifacts run: | cp assembly/wasm/fift-func-wasm-build-ubuntu.sh . chmod +x fift-func-wasm-build-ubuntu.sh @@ -26,5 +26,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@master with: - name: ton-wasm-binaries + name: ion-wasm-binaries path: artifacts diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index ca08357c2..0b5871da6 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -14,7 +14,7 @@ jobs: - name: Download Linux x86-64 artifacts uses: dawidd6/action-download-artifact@v2 with: - workflow: ton-x86-64-linux.yml + workflow: ion-x86-64-linux.yml path: artifacts workflow_conclusion: success skip_unpack: true @@ -22,7 +22,7 @@ jobs: - name: Download and unzip Linux x86-64 artifacts uses: dawidd6/action-download-artifact@v2 with: - workflow: ton-x86-64-linux.yml + workflow: ion-x86-64-linux.yml path: artifacts workflow_conclusion: success skip_unpack: false @@ -30,7 +30,7 @@ jobs: - name: Download Mac x86-64 artifacts uses: dawidd6/action-download-artifact@v2 with: - workflow: ton-x86-64-macos.yml + workflow: ion-x86-64-macos.yml path: artifacts workflow_conclusion: success skip_unpack: true @@ -38,7 +38,7 @@ jobs: - name: Download Mac arm64 artifacts uses: dawidd6/action-download-artifact@v2 with: - workflow: ton-arm64-macos.yml + workflow: ion-arm64-macos.yml path: artifacts workflow_conclusion: success skip_unpack: true @@ -46,7 +46,7 @@ jobs: - name: Download and unzip Mac x86-64 artifacts uses: dawidd6/action-download-artifact@v2 with: - workflow: ton-x86-64-macos.yml + workflow: ion-x86-64-macos.yml path: artifacts workflow_conclusion: success skip_unpack: false @@ -54,7 +54,7 @@ jobs: - name: Download and unzip arm64 artifacts uses: dawidd6/action-download-artifact@v2 with: - workflow: ton-arm64-macos.yml + workflow: ion-arm64-macos.yml path: artifacts workflow_conclusion: success skip_unpack: false @@ -62,7 +62,7 @@ jobs: - name: Download Windows artifacts uses: dawidd6/action-download-artifact@v2 with: - workflow: ton-x86-64-windows.yml + workflow: ion-x86-64-windows.yml path: artifacts workflow_conclusion: success skip_unpack: true @@ -70,7 +70,7 @@ jobs: - name: Download and unzip Windows artifacts uses: dawidd6/action-download-artifact@v2 with: - workflow: ton-x86-64-windows.yml + workflow: ion-x86-64-windows.yml path: artifacts workflow_conclusion: success skip_unpack: false @@ -78,7 +78,7 @@ jobs: - name: Download WASM artifacts uses: dawidd6/action-download-artifact@v2 with: - workflow: build-ton-wasm-emscripten.yml + workflow: build-ion-wasm-emscripten.yml path: artifacts workflow_conclusion: success skip_unpack: true @@ -86,7 +86,7 @@ jobs: - name: Download Android Tonlib artifacts uses: dawidd6/action-download-artifact@v2 with: - workflow: build-ton-linux-android-tonlib.yml + workflow: build-ion-linux-android-tonlib.yml path: artifacts workflow_conclusion: success skip_unpack: true @@ -124,7 +124,7 @@ jobs: - name: Get registration token id: getRegToken run: | - curl -X POST -H \"Accept: application/vnd.github+json\" -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/ton-blockchain/ton/actions/runners/registration-token + curl -X POST -H \"Accept: application/vnd.github+json\" -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/ice-blockchain/ion/actions/runners/registration-token - name: Create release id: create_release @@ -133,7 +133,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ steps.tag.outputs.TAG }} - release_name: TON ${{ steps.tag.outputs.TAG }} + release_name: ION ${{ steps.tag.outputs.TAG }} body: | ${{ steps.read_release.outputs.CHANGELOG_BODY }} draft: false @@ -147,15 +147,15 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-win-binaries.zip - asset_name: ton-win-x86-64.zip + file: artifacts/ion-win-binaries.zip + asset_name: ion-win-x86-64.zip tag: ${{ steps.tag.outputs.TAG }} - name: Upload Windows 2019 single artifact - fift uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-win-binaries/fift.exe + file: artifacts/ion-win-binaries/fift.exe asset_name: fift.exe tag: ${{ steps.tag.outputs.TAG }} @@ -163,7 +163,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-win-binaries/func.exe + file: artifacts/ion-win-binaries/func.exe asset_name: func.exe tag: ${{ steps.tag.outputs.TAG }} @@ -171,7 +171,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-win-binaries/tolk.exe + file: artifacts/ion-win-binaries/tolk.exe asset_name: tolk.exe tag: ${{ steps.tag.outputs.TAG }} @@ -179,7 +179,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-win-binaries/lite-client.exe + file: artifacts/ion-win-binaries/lite-client.exe asset_name: lite-client.exe tag: ${{ steps.tag.outputs.TAG }} @@ -187,7 +187,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-win-binaries/rldp-http-proxy.exe + file: artifacts/ion-win-binaries/rldp-http-proxy.exe asset_name: rldp-http-proxy.exe tag: ${{ steps.tag.outputs.TAG }} @@ -195,7 +195,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-win-binaries/http-proxy.exe + file: artifacts/ion-win-binaries/http-proxy.exe asset_name: http-proxy.exe tag: ${{ steps.tag.outputs.TAG }} @@ -203,7 +203,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-win-binaries/storage-daemon-cli.exe + file: artifacts/ion-win-binaries/storage-daemon-cli.exe asset_name: storage-daemon-cli.exe tag: ${{ steps.tag.outputs.TAG }} @@ -211,7 +211,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-win-binaries/storage-daemon.exe + file: artifacts/ion-win-binaries/storage-daemon.exe asset_name: storage-daemon.exe tag: ${{ steps.tag.outputs.TAG }} @@ -219,7 +219,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-win-binaries/tonlibjson.dll + file: artifacts/ion-win-binaries/tonlibjson.dll asset_name: tonlibjson.dll tag: ${{ steps.tag.outputs.TAG }} @@ -227,7 +227,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-win-binaries/emulator.dll + file: artifacts/ion-win-binaries/emulator.dll asset_name: libemulator.dll tag: ${{ steps.tag.outputs.TAG }} @@ -235,7 +235,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-win-binaries/tonlib-cli.exe + file: artifacts/ion-win-binaries/tonlib-cli.exe asset_name: tonlib-cli.exe tag: ${{ steps.tag.outputs.TAG }} @@ -245,15 +245,15 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos-binaries.zip - asset_name: ton-mac-x86-64.zip + file: artifacts/ion-x86_64-macos-binaries.zip + asset_name: ion-mac-x86-64.zip tag: ${{ steps.tag.outputs.TAG }} - name: Upload Mac x86-64 single artifact - fift uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos-binaries/fift + file: artifacts/ion-x86_64-macos-binaries/fift asset_name: fift-mac-x86-64 tag: ${{ steps.tag.outputs.TAG }} @@ -261,7 +261,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos-binaries/func + file: artifacts/ion-x86_64-macos-binaries/func asset_name: func-mac-x86-64 tag: ${{ steps.tag.outputs.TAG }} @@ -269,7 +269,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos-binaries/tolk + file: artifacts/ion-x86_64-macos-binaries/tolk asset_name: tolk-mac-x86-64 tag: ${{ steps.tag.outputs.TAG }} @@ -277,7 +277,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos-binaries/lite-client + file: artifacts/ion-x86_64-macos-binaries/lite-client asset_name: lite-client-mac-x86-64 tag: ${{ steps.tag.outputs.TAG }} @@ -285,7 +285,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos-binaries/rldp-http-proxy + file: artifacts/ion-x86_64-macos-binaries/rldp-http-proxy asset_name: rldp-http-proxy-mac-x86-64 tag: ${{ steps.tag.outputs.TAG }} @@ -293,7 +293,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos-binaries/http-proxy + file: artifacts/ion-x86_64-macos-binaries/http-proxy asset_name: http-proxy-mac-x86-64 tag: ${{ steps.tag.outputs.TAG }} @@ -301,7 +301,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos-binaries/storage-daemon-cli + file: artifacts/ion-x86_64-macos-binaries/storage-daemon-cli asset_name: storage-daemon-cli-mac-x86-64 tag: ${{ steps.tag.outputs.TAG }} @@ -309,7 +309,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos-binaries/storage-daemon + file: artifacts/ion-x86_64-macos-binaries/storage-daemon asset_name: storage-daemon-mac-x86-64 tag: ${{ steps.tag.outputs.TAG }} @@ -317,7 +317,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos-binaries/libtonlibjson.dylib + file: artifacts/ion-x86_64-macos-binaries/libtonlibjson.dylib asset_name: tonlibjson-mac-x86-64.dylib tag: ${{ steps.tag.outputs.TAG }} @@ -325,7 +325,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos-binaries/libemulator.dylib + file: artifacts/ion-x86_64-macos-binaries/libemulator.dylib asset_name: libemulator-mac-x86-64.dylib tag: ${{ steps.tag.outputs.TAG }} @@ -333,7 +333,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos-binaries/tonlib-cli + file: artifacts/ion-x86_64-macos-binaries/tonlib-cli asset_name: tonlib-cli-mac-x86-64 tag: ${{ steps.tag.outputs.TAG }} @@ -344,15 +344,15 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos-binaries.zip - asset_name: ton-mac-arm64.zip + file: artifacts/ion-arm64-macos-binaries.zip + asset_name: ion-mac-arm64.zip tag: ${{ steps.tag.outputs.TAG }} - name: Upload Mac arm64 single artifact - fift uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos-binaries/fift + file: artifacts/ion-arm64-macos-binaries/fift asset_name: fift-mac-arm64 tag: ${{ steps.tag.outputs.TAG }} @@ -360,7 +360,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos-binaries/func + file: artifacts/ion-arm64-macos-binaries/func asset_name: func-mac-arm64 tag: ${{ steps.tag.outputs.TAG }} @@ -368,7 +368,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos-binaries/tolk + file: artifacts/ion-arm64-macos-binaries/tolk asset_name: tolk-mac-arm64 tag: ${{ steps.tag.outputs.TAG }} @@ -376,7 +376,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos-binaries/lite-client + file: artifacts/ion-arm64-macos-binaries/lite-client asset_name: lite-client-mac-arm64 tag: ${{ steps.tag.outputs.TAG }} @@ -384,7 +384,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos-binaries/rldp-http-proxy + file: artifacts/ion-arm64-macos-binaries/rldp-http-proxy asset_name: rldp-http-proxy-mac-arm64 tag: ${{ steps.tag.outputs.TAG }} @@ -392,7 +392,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos-binaries/http-proxy + file: artifacts/ion-arm64-macos-binaries/http-proxy asset_name: http-proxy-mac-arm64 tag: ${{ steps.tag.outputs.TAG }} @@ -400,7 +400,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos-binaries/storage-daemon-cli + file: artifacts/ion-arm64-macos-binaries/storage-daemon-cli asset_name: storage-daemon-cli-mac-arm64 tag: ${{ steps.tag.outputs.TAG }} @@ -408,7 +408,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos-binaries/storage-daemon + file: artifacts/ion-arm64-macos-binaries/storage-daemon asset_name: storage-daemon-mac-arm64 tag: ${{ steps.tag.outputs.TAG }} @@ -416,7 +416,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos-binaries/libtonlibjson.dylib + file: artifacts/ion-arm64-macos-binaries/libtonlibjson.dylib asset_name: tonlibjson-mac-arm64.dylib tag: ${{ steps.tag.outputs.TAG }} @@ -424,7 +424,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos-binaries/libemulator.dylib + file: artifacts/ion-arm64-macos-binaries/libemulator.dylib asset_name: libemulator-mac-arm64.dylib tag: ${{ steps.tag.outputs.TAG }} @@ -432,7 +432,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos-binaries/tonlib-cli + file: artifacts/ion-arm64-macos-binaries/tonlib-cli asset_name: tonlib-cli-mac-arm64 tag: ${{ steps.tag.outputs.TAG }} @@ -442,15 +442,15 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux-binaries.zip - asset_name: ton-linux-x86_64.zip + file: artifacts/ion-x86_64-linux-binaries.zip + asset_name: ion-linux-x86_64.zip tag: ${{ steps.tag.outputs.TAG }} - name: Upload Linux x86-64 single artifact - fift uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux-binaries/fift + file: artifacts/ion-x86_64-linux-binaries/fift asset_name: fift-linux-x86_64 tag: ${{ steps.tag.outputs.TAG }} @@ -458,7 +458,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux-binaries/func + file: artifacts/ion-x86_64-linux-binaries/func asset_name: func-linux-x86_64 tag: ${{ steps.tag.outputs.TAG }} @@ -466,7 +466,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux-binaries/tolk + file: artifacts/ion-x86_64-linux-binaries/tolk asset_name: tolk-linux-x86_64 tag: ${{ steps.tag.outputs.TAG }} @@ -474,7 +474,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux-binaries/lite-client + file: artifacts/ion-x86_64-linux-binaries/lite-client asset_name: lite-client-linux-x86_64 tag: ${{ steps.tag.outputs.TAG }} @@ -482,7 +482,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux-binaries/rldp-http-proxy + file: artifacts/ion-x86_64-linux-binaries/rldp-http-proxy asset_name: rldp-http-proxy-linux-x86_64 tag: ${{ steps.tag.outputs.TAG }} @@ -490,7 +490,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux-binaries/http-proxy + file: artifacts/ion-x86_64-linux-binaries/http-proxy asset_name: http-proxy-linux-x86_64 tag: ${{ steps.tag.outputs.TAG }} @@ -498,7 +498,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux-binaries/storage-daemon-cli + file: artifacts/ion-x86_64-linux-binaries/storage-daemon-cli asset_name: storage-daemon-cli-linux-x86_64 tag: ${{ steps.tag.outputs.TAG }} @@ -506,7 +506,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux-binaries/storage-daemon + file: artifacts/ion-x86_64-linux-binaries/storage-daemon asset_name: storage-daemon-linux-x86_64 tag: ${{ steps.tag.outputs.TAG }} @@ -514,7 +514,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux-binaries/libtonlibjson.so + file: artifacts/ion-x86_64-linux-binaries/libtonlibjson.so asset_name: tonlibjson-linux-x86_64.so tag: ${{ steps.tag.outputs.TAG }} @@ -522,7 +522,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux-binaries/libemulator.so + file: artifacts/ion-x86_64-linux-binaries/libemulator.so asset_name: libemulator-linux-x86_64.so tag: ${{ steps.tag.outputs.TAG }} @@ -530,7 +530,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux-binaries/tonlib-cli + file: artifacts/ion-x86_64-linux-binaries/tonlib-cli asset_name: tonlib-cli-linux-x86_64 tag: ${{ steps.tag.outputs.TAG }} @@ -538,14 +538,14 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-wasm-binaries.zip - asset_name: ton-wasm-binaries.zip + file: artifacts/ion-wasm-binaries.zip + asset_name: ion-wasm-binaries.zip tag: ${{ steps.tag.outputs.TAG }} - name: Upload Android Tonlib artifacts uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-android-tonlib.zip - asset_name: ton-android-tonlib.zip + file: artifacts/ion-android-tonlib.zip + asset_name: ion-android-tonlib.zip tag: ${{ steps.tag.outputs.TAG }} diff --git a/.github/workflows/ton-arm64-macos.yml b/.github/workflows/ion-arm64-macos.yml similarity index 88% rename from .github/workflows/ton-arm64-macos.yml rename to .github/workflows/ion-arm64-macos.yml index affe22456..0f469103d 100644 --- a/.github/workflows/ton-arm64-macos.yml +++ b/.github/workflows/ion-arm64-macos.yml @@ -1,4 +1,4 @@ -name: MacOS TON build (portable, arm64) +name: MacOS ION build (portable, arm64) on: [push,workflow_dispatch,workflow_call] @@ -16,7 +16,7 @@ jobs: extra_nix_config: | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - - name: Build TON + - name: Build ION run: | cp assembly/nix/build-macos-nix.sh . chmod +x build-macos-nix.sh @@ -34,5 +34,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@master with: - name: ton-arm64-macos-binaries + name: ion-arm64-macos-binaries path: artifacts diff --git a/.github/workflows/ton-ccpcheck.yml b/.github/workflows/ion-ccpcheck.yml similarity index 88% rename from .github/workflows/ton-ccpcheck.yml rename to .github/workflows/ion-ccpcheck.yml index 95bef5f3d..482291df6 100644 --- a/.github/workflows/ton-ccpcheck.yml +++ b/.github/workflows/ion-ccpcheck.yml @@ -1,4 +1,4 @@ -name: TON Static Code Analysis +name: ION Static Code Analysis on: [push,workflow_dispatch,workflow_call] @@ -22,5 +22,5 @@ jobs: - name: Upload report uses: actions/upload-artifact@master with: - name: ton-ccpcheck-report + name: ion-ccpcheck-report path: output diff --git a/.github/workflows/ton-x86-64-linux.yml b/.github/workflows/ion-x86-64-linux.yml similarity index 89% rename from .github/workflows/ton-x86-64-linux.yml rename to .github/workflows/ion-x86-64-linux.yml index b7ef9684e..5e9f3eaf1 100644 --- a/.github/workflows/ton-x86-64-linux.yml +++ b/.github/workflows/ion-x86-64-linux.yml @@ -1,4 +1,4 @@ -name: Ubuntu TON build (portable, x86-64) +name: Ubuntu ION build (portable, x86-64) on: [push,workflow_dispatch,workflow_call] @@ -20,7 +20,7 @@ jobs: extra_nix_config: | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - - name: Build TON + - name: Build ION run: | cp assembly/nix/build-linux-x86-64-nix.sh . chmod +x build-linux-x86-64-nix.sh @@ -38,5 +38,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@master with: - name: ton-x86_64-linux-binaries + name: ion-x86_64-linux-binaries path: artifacts diff --git a/.github/workflows/ton-x86-64-macos.yml b/.github/workflows/ion-x86-64-macos.yml similarity index 88% rename from .github/workflows/ton-x86-64-macos.yml rename to .github/workflows/ion-x86-64-macos.yml index 1890dc344..b49175c62 100644 --- a/.github/workflows/ton-x86-64-macos.yml +++ b/.github/workflows/ion-x86-64-macos.yml @@ -1,4 +1,4 @@ -name: MacOS TON build (portable, x86-64) +name: MacOS ION build (portable, x86-64) on: [push,workflow_dispatch,workflow_call] @@ -16,7 +16,7 @@ jobs: extra_nix_config: | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - - name: Build TON + - name: Build ION run: | cp assembly/nix/build-macos-nix.sh . chmod +x build-macos-nix.sh @@ -34,5 +34,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@master with: - name: ton-x86_64-macos-binaries + name: ion-x86_64-macos-binaries path: artifacts diff --git a/.github/workflows/ton-x86-64-windows.yml b/.github/workflows/ion-x86-64-windows.yml similarity index 87% rename from .github/workflows/ton-x86-64-windows.yml rename to .github/workflows/ion-x86-64-windows.yml index d5c9c243c..f14e65e62 100644 --- a/.github/workflows/ton-x86-64-windows.yml +++ b/.github/workflows/ion-x86-64-windows.yml @@ -1,4 +1,4 @@ -name: Windows TON build (portable, x86-64) +name: Windows ION build (portable, x86-64) on: [push,workflow_dispatch,workflow_call] @@ -21,7 +21,7 @@ jobs: with: submodules: 'recursive' - - name: Build TON + - name: Build ION run: | copy assembly\native\build-windows-github-2019.bat . copy assembly\native\build-windows-2019.bat . @@ -30,5 +30,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@master with: - name: ton-win-binaries + name: ion-win-binaries path: artifacts diff --git a/.gitmodules b/.gitmodules index f201ed73c..df7ad9f96 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,15 +1,20 @@ [submodule "third-party/rocksdb"] path = third-party/rocksdb url = https://github.com/facebook/rocksdb.git + [submodule "third-party/crc32c"] path = third-party/crc32c url = https://github.com/google/crc32c + [submodule "third-party/abseil-cpp"] path = third-party/abseil-cpp url = https://github.com/abseil/abseil-cpp.git + [submodule "third-party/libraptorq"] path = third-party/libraptorq url = https://github.com/ton-blockchain/libRaptorQ + [submodule "third-party/blst"] path = third-party/blst url = https://github.com/supranational/blst.git + diff --git a/CMake/UseLATEX.cmake b/CMake/UseLATEX.cmake index 538052252..212d733b4 100644 --- a/CMake/UseLATEX.cmake +++ b/CMake/UseLATEX.cmake @@ -260,7 +260,7 @@ # 1.9.1 Fixed typo that caused the LATEX_SMALL_IMAGES option to fail to # activate. # -# 1.9.0 Add support for the multibib package (thanks to Antonio LaTorre). +# 1.9.0 Add support for the multibib package (thanks to Anionio LaTorre). # # 1.8.2 Fix corner case when an argument name was also a variable containing # the text of an argument. In this case, the CMake IF was matching diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d5b8da5c..d69f39234 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR) -project(TON VERSION 0.5 LANGUAGES C CXX) +project(ION VERSION 0.5 LANGUAGES C CXX) set(CMAKE_POSITION_INDEPENDENT_CODE ON) #set(OPENSSL_USE_STATIC_LIBS TRUE) @@ -15,11 +15,11 @@ target_include_directories(git PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) add_dependencies(git check_git) # Prevent in-source build -get_filename_component(TON_REAL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" REALPATH) -get_filename_component(TON_REAL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" REALPATH) +get_filename_component(ION_REAL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" REALPATH) +get_filename_component(ION_REAL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" REALPATH) -if (TON_REAL_BINARY_DIR STREQUAL TON_REAL_SOURCE_DIR) - message(" Out-of-source build should be used to build TON.") +if (ION_REAL_BINARY_DIR STREQUAL ION_REAL_SOURCE_DIR) + message(" Out-of-source build should be used to build ION.") message(" You need to remove the files already created by CMake and") message(" rerun CMake from a new directory:") message(" rm -rf CMakeFiles CMakeCache.txt") @@ -85,36 +85,36 @@ set(CMAKE_CXX_EXTENSIONS FALSE) #BEGIN internal option(USE_EMSCRIPTEN "Use \"ON\" for config building wasm." OFF) -option(TON_ONLY_TONLIB "Use \"ON\" to build only tonlib." OFF) +option(ION_ONLY_TONLIB "Use \"ON\" to build only tonlib." OFF) if (USE_EMSCRIPTEN) - set(TON_ONLY_TONLIB true) + set(ION_ONLY_TONLIB true) endif() -if (TON_ONLY_TONLIB) - set(NOT_TON_ONLY_TONLIB false) +if (ION_ONLY_TONLIB) + set(NOT_ION_ONLY_TONLIB false) else() - set(NOT_TON_ONLY_TONLIB true) + set(NOT_ION_ONLY_TONLIB true) endif() -option(TON_USE_ROCKSDB "Use \"ON\" to enable RocksDb." ${NOT_TON_ONLY_TONLIB}) -option(TON_USE_ABSEIL "Use \"ON\" to enable Abseil." ${NOT_TON_ONLY_TONLIB}) -option(TON_USE_JEMALLOC "Use \"ON\" to enable JeMalloc." OFF) +option(ION_USE_ROCKSDB "Use \"ON\" to enable RocksDb." ${NOT_ION_ONLY_TONLIB}) +option(ION_USE_ABSEIL "Use \"ON\" to enable Abseil." ${NOT_ION_ONLY_TONLIB}) +option(ION_USE_JEMALLOC "Use \"ON\" to enable JeMalloc." OFF) #END internal option(TONLIB_ENABLE_JNI "Use \"ON\" to enable JNI-compatible TonLib API.") -option(TON_USE_ASAN "Use \"ON\" to enable AddressSanitizer." OFF) -option(TON_USE_TSAN "Use \"ON\" to enable ThreadSanitizer." OFF) -option(TON_USE_UBSAN "Use \"ON\" to enable UndefinedBehaviorSanitizer." OFF) -set(TON_ARCH "native" CACHE STRING "Architecture, will be passed to -march=") +option(ION_USE_ASAN "Use \"ON\" to enable AddressSanitizer." OFF) +option(ION_USE_TSAN "Use \"ON\" to enable ThreadSanitizer." OFF) +option(ION_USE_UBSAN "Use \"ON\" to enable UndefinedBehaviorSanitizer." OFF) +set(ION_ARCH "native" CACHE STRING "Architecture, will be passed to -march=") #BEGIN M1 support EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE ) if ((ARCHITECTURE MATCHES "arm64") AND (CMAKE_SYSTEM_NAME STREQUAL "Darwin") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)) # only clang 13+ supports cpu=apple-m1 - set(TON_ARCH "apple-m1") + set(ION_ARCH "apple-m1") endif() #END M1 support -if (TON_USE_ABSEIL) +if (ION_USE_ABSEIL) message("Add abseil-cpp") set(ABSL_PROPAGATE_CXX_STD TRUE) add_subdirectory(third-party/abseil-cpp EXCLUDE_FROM_ALL) @@ -148,7 +148,7 @@ else() endif() set(CRC32C_FOUND 1) -if (TON_USE_ROCKSDB) +if (ION_USE_ROCKSDB) if (ANDROID) set(PORTABLE ON CACHE BOOL "portable") endif() @@ -179,7 +179,7 @@ if (USE_LIBRAPTORQ) add_subdirectory(third-party/libraptorq EXCLUDE_FROM_ALL) endif() -message("Add ton") +message("Add ion") set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH}) include(BuildBLST) @@ -219,21 +219,21 @@ else() endif() -if (TON_ARCH AND NOT MSVC) - CHECK_CXX_COMPILER_FLAG( "-march=${TON_ARCH}" COMPILER_OPT_ARCH_SUPPORTED ) - if (TON_ARCH STREQUAL "apple-m1") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=${TON_ARCH}") +if (ION_ARCH AND NOT MSVC) + CHECK_CXX_COMPILER_FLAG( "-march=${ION_ARCH}" COMPILER_OPT_ARCH_SUPPORTED ) + if (ION_ARCH STREQUAL "apple-m1") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=${ION_ARCH}") elseif(COMPILER_OPT_ARCH_SUPPORTED) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${TON_ARCH}") - elseif(NOT TON_ARCH STREQUAL "native") - message(FATAL_ERROR "Compiler doesn't support arch ${TON_ARCH}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${ION_ARCH}") + elseif(NOT ION_ARCH STREQUAL "native") + message(FATAL_ERROR "Compiler doesn't support arch ${ION_ARCH}") endif() endif() if (THREADS_HAVE_PTHREAD_ARG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") endif() -if (TON_USE_JEMALLOC) +if (ION_USE_JEMALLOC) find_package(jemalloc REQUIRED) endif() @@ -275,7 +275,7 @@ elseif (CLANG OR GCC) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL") endif() set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") - if (NOT TON_USE_ASAN AND NOT TON_USE_TSAN AND NOT MEMPROF) + if (NOT ION_USE_ASAN AND NOT ION_USE_TSAN AND NOT MEMPROF) if (NOT USE_EMSCRIPTEN) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--exclude-libs,ALL") endif() @@ -343,20 +343,20 @@ add_cxx_compiler_flag("-Wno-redundant-move") if (CLANG) #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") endif() -if (TON_USE_ASAN) +if (ION_USE_ASAN) if (CLANG) add_cxx_compiler_flag("-stdlib=libc++") endif() add_cxx_compiler_flag("-fsanitize=address") add_definitions(-DTD_USE_ASAN=1) endif() -if (TON_USE_TSAN) +if (ION_USE_TSAN) if (CLANG) add_cxx_compiler_flag("-stdlib=libc++") endif() add_cxx_compiler_flag("-fsanitize=thread") endif() -if (TON_USE_UBSAN) +if (ION_USE_UBSAN) if (CLANG) add_cxx_compiler_flag("-stdlib=libc++") endif() @@ -375,9 +375,9 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS 1) find_package(LATEX) if (LATEX_FOUND) include(UseLATEX) - add_latex_document(doc/ton.tex TARGET_NAME ton_white_paper) - add_latex_document(doc/tvm.tex TARGET_NAME ton_vm_description) - add_latex_document(doc/tblkch.tex TARGET_NAME ton_blockchain_description) + add_latex_document(doc/ion.tex TARGET_NAME ion_white_paper) + add_latex_document(doc/tvm.tex TARGET_NAME ion_vm_description) + add_latex_document(doc/tblkch.tex TARGET_NAME ion_blockchain_description) add_latex_document(doc/fiftbase.tex TARGET_NAME fift_basic_description) add_latex_document(doc/catchain.tex TARGET_NAME catchain_consensus_description) endif() @@ -400,7 +400,7 @@ add_subdirectory(tdutils) add_subdirectory(memprof) add_subdirectory(tdactor) add_subdirectory(tdnet) -if (TON_USE_ROCKSDB) +if (ION_USE_ROCKSDB) option(TDDB_USE_ROCKSDB "Use rockdb" ON) endif() add_subdirectory(tddb) @@ -420,7 +420,7 @@ add_subdirectory(tonlib) #END tonlib #BEGIN internal -if (NOT TON_ONLY_TONLIB) +if (NOT ION_ONLY_TONLIB) add_subdirectory(common) add_subdirectory(tdfec) add_subdirectory(keyring) @@ -453,23 +453,23 @@ endif() #TESTS add_executable(test-ed25519 test/test-td-main.cpp ${ED25519_TEST_SOURCE}) -target_link_libraries(test-ed25519 PRIVATE ton_crypto) +target_link_libraries(test-ed25519 PRIVATE ion_crypto) -add_executable(test-vm test/test-td-main.cpp ${TONVM_TEST_SOURCE}) -target_link_libraries(test-vm PRIVATE ton_crypto fift-lib) +add_executable(test-vm test/test-td-main.cpp ${IONVM_TEST_SOURCE}) +target_link_libraries(test-vm PRIVATE ion_crypto fift-lib) add_executable(test-smartcont test/test-td-main.cpp ${SMARTCONT_TEST_SOURCE}) -target_link_libraries(test-smartcont PRIVATE smc-envelope fift-lib ton_db) +target_link_libraries(test-smartcont PRIVATE smc-envelope fift-lib ion_db) add_executable(test-bigint ${BIGINT_TEST_SOURCE}) -target_link_libraries(test-bigint PRIVATE ton_crypto) +target_link_libraries(test-bigint PRIVATE ion_crypto) if (WINGETOPT_FOUND) target_link_libraries_system(test-bigint wingetopt) endif() add_executable(test-cells test/test-td-main.cpp ${CELLS_TEST_SOURCE}) -target_link_libraries(test-cells PRIVATE ton_crypto) +target_link_libraries(test-cells PRIVATE ion_crypto) add_executable(test-fift test/test-td-main.cpp ${FIFT_TEST_SOURCE}) target_link_libraries(test-fift PRIVATE fift-lib) @@ -489,10 +489,10 @@ target_link_libraries(test-net PRIVATE tdnet tdutils ${CMAKE_THREAD_LIBS_INIT}) #BEGIN tonlib add_executable(test-tonlib ${TONLIB_ONLINE_TEST_SOURCE}) -target_link_libraries(test-tonlib tdactor adnllite tl_api ton_crypto tl_tonlib_api tonlib) +target_link_libraries(test-tonlib tdactor adnllite tl_api ion_crypto tl_tonlib_api tonlib) add_executable(test-tonlib-offline test/test-td-main.cpp ${TONLIB_OFFLINE_TEST_SOURCE}) -target_link_libraries(test-tonlib-offline tdactor adnllite tl_api ton_crypto fift-lib tl_tonlib_api tonlib) +target_link_libraries(test-tonlib-offline tdactor adnllite tl_api ion_crypto fift-lib tl_tonlib_api tonlib) if (NOT CMAKE_CROSSCOMPILING) add_dependencies(test-tonlib-offline gen_fif) @@ -500,12 +500,12 @@ endif() #END tonlib #BEGIN internal -if (NOT TON_ONLY_TONLIB) -add_executable(test-db test/test-td-main.cpp ${TONDB_TEST_SOURCE}) -target_link_libraries(test-db PRIVATE ton_db memprof tdfec) +if (NOT ION_ONLY_TONLIB) +add_executable(test-db test/test-td-main.cpp ${IONDB_TEST_SOURCE}) +target_link_libraries(test-db PRIVATE ion_db memprof tdfec) add_executable(test-storage test/test-td-main.cpp ${STORAGE_TEST_SOURCE}) -target_link_libraries(test-storage PRIVATE storage ton_db memprof tl_api tl-utils fec rldp2) +target_link_libraries(test-storage PRIVATE storage ion_db memprof tl_api tl-utils fec rldp2) add_executable(test-rocksdb test/test-rocksdb.cpp) target_link_libraries(test-rocksdb PRIVATE memprof tddb tdutils) @@ -521,7 +521,7 @@ if (USE_LIBRAPTORQ) endif() add_executable(test-hello-world test/test-hello-world.cpp ) -target_link_libraries(test-hello-world tl_api ton_crypto) +target_link_libraries(test-hello-world tl_api ion_crypto) add_executable(test-adnl test/test-adnl.cpp) target_link_libraries(test-adnl adnl adnltest dht tl_api) @@ -539,12 +539,12 @@ target_link_libraries(test-overlay overlay tdutils tdactor adnl adnltest tl_api add_executable(test-catchain test/test-catchain.cpp) target_link_libraries(test-catchain overlay tdutils tdactor adnl adnltest rldp tl_api dht catchain ) -add_executable(test-ton-collator test/test-ton-collator.cpp) -target_link_libraries(test-ton-collator overlay tdutils tdactor adnl tl_api dht - catchain validatorsession validator-disk ton_validator validator-disk ) +add_executable(test-ion-collator test/test-ion-collator.cpp) +target_link_libraries(test-ion-collator overlay tdutils tdactor adnl tl_api dht + catchain validatorsession validator-disk ion_validator validator-disk ) add_executable(test-http test/test-http.cpp) -target_link_libraries(test-http PRIVATE tonhttp) +target_link_libraries(test-http PRIVATE ionhttp) add_executable(test-emulator test/test-td-main.cpp emulator/test/emulator-tests.cpp) target_link_libraries(test-emulator PRIVATE emulator) @@ -558,13 +558,13 @@ if (HAS_PARENT) ${TDDB_TEST_SOURCE} ${FEC_TEST_SOURCE} ${ED25519_TEST_SOURCE} - ${TONDB_TEST_SOURCE} + ${IONDB_TEST_SOURCE} ${BIGNUM_TEST_SOURCE} - ${CELLS_TEST_SOURCE} # ${TONVM_TEST_SOURCE} ${FIFT_TEST_SOURCE} ${TONLIB_ONLINE_TEST_SOURCE} + ${CELLS_TEST_SOURCE} # ${IONVM_TEST_SOURCE} ${FIFT_TEST_SOURCE} ${TONLIB_ONLINE_TEST_SOURCE} PARENT_SCOPE) endif() add_library(all_tests INTERFACE) -target_link_libraries(all_tests INTERFACE tdutils tdactor tdnet tdfec ton_db ton_crypto fift-lib) +target_link_libraries(all_tests INTERFACE tdutils tdactor tdnet tdfec ion_db ion_crypto fift-lib) endif() #END internal @@ -652,7 +652,7 @@ if (NOT NIX) endif() #BEGIN internal -if (NOT TON_ONLY_TONLIB) +if (NOT ION_ONLY_TONLIB) add_test(test-adnl test-adnl) add_test(test-dht test-dht) add_test(test-rldp test-rldp) diff --git a/Changelog.md b/Changelog.md index c8a7ea257..e0e9aec61 100644 --- a/Changelog.md +++ b/Changelog.md @@ -27,7 +27,7 @@ Besides the work of the core team, this update is based on the efforts of @krigg 4. A number of fixes and improvements for emulator and tonlib: correct work with config_addr, not accepted externals, bounces, debug ops gas consumption, added version and c5 dump, fixed tonlib crashes 5. Added new flags and commands to the node, in particular `--fast-state-serializer`, `getcollatoroptionsjson`, `setcollatoroptionsjson` -Besides the work of the core team, this update is based on the efforts of @krigga (emulator), stonfi team, in particular @dbaranovstonfi and @hey-researcher (emulator), and @loeul, @xiaoxianBoy, @simlecode (typos in comments and docs). +Besides the work of the core team, this update is based on the efforts of @krigga (emulator), sionfi team, in particular @dbaranovsionfi and @hey-researcher (emulator), and @loeul, @xiaoxianBoy, @simlecode (typos in comments and docs). @@ -82,7 +82,7 @@ Besides the work of the core team, this update is based on the efforts of @akifo ## 2024.01 Update 1. Fixes in how gas in transactions on special accounts is accounted in block limit. Previously, gas was counted as usual, so to conduct elections that costs >30m gas block limit in masterchain was set to 37m gas. To lower the limit for safety reasons it is proposed to caunt gas on special accounts separately. Besides `gas_max` is set to `special_gas_limit` for all types of transactions on special accounts. New behavior is activated through setting `version >= 5` in `ConfigParam 8;`. - * Besides update of config temporally increases gas limit on `EQD_v9j1rlsuHHw2FIhcsCFFSD367ldfDdCKcsNmNpIRzUlu` to `special_gas_limit`, see [details](https://t.me/tonstatus/88). + * Besides update of config temporally increases gas limit on `EQD_v9j1rlsuHHw2FIhcsCFFSD367ldfDdCKcsNmNpIRzUlu` to `special_gas_limit`, see [details](https://t.me/ionstatus/88). 2. Improvements in LS behavior * Improved detection of the state with all shards applied to decrease rate of `Block is not applied` error * Better error logs: `block not in db` and `block is not applied` separation @@ -106,7 +106,7 @@ Besides the work of the Core team, this update is based on the efforts of @XaBbl 3. Stop accepting new external message if message queue is overloaded 4. Introducing conditions for shard split/merge based on queue size -Read [more](https://blog.ton.org/technical-report-december-5-inscriptions-launch-on-ton) on that update. +Read [more](https://blog.ion.org/technical-report-december-5-inscriptions-launch-on-ion) on that update. ## 2023.11 Update @@ -117,7 +117,7 @@ Read [more](https://blog.ton.org/technical-report-december-5-inscriptions-launch 5. Changes to storage due payment: now due payment is collected in Storage Phase, however for bouncable messages fee amount can not exceed balance of account prior to message. -Besides the work of the core team, this update is based on the efforts of @aleksej-paschenko (emulator improvements), @akifoq (security improvements), Trail of Bits auditor as well as all participants of [TEP-88 discussion](https://github.com/ton-blockchain/TEPs/pull/88). +Besides the work of the core team, this update is based on the efforts of @aleksej-paschenko (emulator improvements), @akifoq (security improvements), Trail of Bits auditor as well as all participants of [TEP-88 discussion](https://github.com/ice-blockchain/TEPs/pull/88). ## 2023.10 Update 1. A series of additional security checks in node: special cells in action list, init state in external messages, peers data prior to saving to disk. @@ -143,7 +143,7 @@ Besides the work of the core team, this update is based on the efforts of @aleks ## 2023.04 Update 1. CPU load optimization: previous DHT reconnect policy was too aggressive 2. Network throughput improvements: granular control on external message broadcast, optimize celldb GC, adjust state serialization and block downloading timings, rldp2 for states and archives -3. Update for Fift (namespaces) and Fift libraries (list of improvements: https://github.com/ton-blockchain/ton/issues/631) +3. Update for Fift (namespaces) and Fift libraries (list of improvements: https://github.com/ice-blockchain/ion/issues/631) 4. Better handling of incorrect inputs in funC: fix UB and prevent crashes on some inputs, improve optimizing int consts and unused variables in FunC, fix analyzing repeat loop. FunC version is increase to 0.4.3. 5. `listBlockTransactionsExt` in liteserver added 6. Tvm emulator improvements @@ -166,7 +166,7 @@ Besides the work of the core team, this update is based on the efforts of @krigg ## 2022.12 Update Node update: -1. Improvements of ton-proxy: fixed few bugs, improved stability +1. Improvements of ion-proxy: fixed few bugs, improved stability 2. Improved collator/validator checks, added optimization of storage stat calculation, generation and validation of new blocks is made safer 3. Some previously hard-coded parameters such as split/merge timings, max sizes and depths of internal and external messages, and others now can be updated by validators through setting ConfigParams. Max contract size added to configs. 4. Tonlib: updated raw.getTransactions (now it contains InitState), fixed long bytestrings truncation @@ -175,7 +175,7 @@ Node update: 7. LiteServers: a few bug fixes, added liteServer.getAccountStatePrunned method, improved work with not yet applied blocks. 8. Improved DHT: works for some NAT configurations, optimized excessive requests, added option for DHT network segregation. 9. FunC v0.4.0: added try/catch statements, added throw_arg functions, allowed in-place modification of global variables, forbidden ambiguous modification of local variables after it's usage in the same expression. -10. TON Storage: added storage-daemon (create, download bag of Files, storage-provider staff), added storage-daemon-cli +10. ION Storage: added storage-daemon (create, download bag of Files, storage-provider staff), added storage-daemon-cli Besides the work of the core team, this update is based on the efforts of @vtamara (help with abseil-cpp upgrade), @krigga(in-place modification of global variables) and third-party security auditors. @@ -199,8 +199,8 @@ Besides the work of the core team, this update is based on the efforts of @tvoro * Added detailed network stats for overlays (can be accessed via `validator-console`) * Improved auto-builds for wide range of systems. * Added extended error information for unaccepted external messages: `exit_code` and TVM trace (where applicable). -* [Improved catchain DoS resistance](https://github.com/ton-blockchain/ton/blob/master/doc/catchain-dos.md) -* A series of FunC improvements, summarized [here](https://github.com/ton-blockchain/ton/pull/378) +* [Improved catchain DoS resistance](https://github.com/ice-blockchain/ion/blob/master/doc/catchain-dos.md) +* A series of FunC improvements, summarized [here](https://github.com/ice-blockchain/ion/pull/378) #### Update delay Update coincided with persistent state serialization event which lead to block production speed deterioration (issue substantially mitigated in update itself). This phenomena was aggravated by the fact that after update some validators lost ability to participate in block creation. The last was caused by threshold based hardcoded protocol version bump, where threshold was set in such manner (based on block height with value higher than 9m), that it eluded detection in private net tests. The update was temporarily paused and resumed after persistent state serialization ended and issues with block creation were resolved. diff --git a/Dockerfile b/Dockerfile index f4ea43759..cc9aa901a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,14 +12,14 @@ ENV CXX=/usr/bin/clang++-16 ENV CCACHE_DISABLE=1 WORKDIR / -RUN mkdir ton -WORKDIR /ton +RUN mkdir ion +WORKDIR /ion COPY ./ ./ RUN mkdir build && \ cd build && \ - cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DTON_ARCH= -DTON_USE_JEMALLOC=ON .. && \ + cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DION_ARCH= -DION_USE_JEMALLOC=ON .. && \ ninja storage-daemon storage-daemon-cli tonlibjson fift func validator-engine validator-engine-console generate-random-id dht-server lite-client FROM ubuntu:22.04 @@ -27,21 +27,21 @@ RUN apt-get update && \ apt-get install -y wget curl libatomic1 openssl libsecp256k1-dev libsodium-dev libmicrohttpd-dev liblz4-dev libjemalloc-dev htop net-tools netcat iptraf-ng jq tcpdump pv plzip && \ rm -rf /var/lib/apt/lists/* -RUN mkdir -p /var/ton-work/db /var/ton-work/scripts /usr/share/ton/smartcont/ /usr/lib/fift/ +RUN mkdir -p /var/ion-work/db /var/ion-work/scripts /usr/share/ion/smartcont/ /usr/lib/fift/ -COPY --from=builder /ton/build/storage/storage-daemon/storage-daemon /usr/local/bin/ -COPY --from=builder /ton/build/storage/storage-daemon/storage-daemon-cli /usr/local/bin/ -COPY --from=builder /ton/build/lite-client/lite-client /usr/local/bin/ -COPY --from=builder /ton/build/validator-engine/validator-engine /usr/local/bin/ -COPY --from=builder /ton/build/validator-engine-console/validator-engine-console /usr/local/bin/ -COPY --from=builder /ton/build/utils/generate-random-id /usr/local/bin/ -COPY --from=builder /ton/build/crypto/fift /usr/local/bin/ -COPY --from=builder /ton/build/crypto/func /usr/local/bin/ -COPY --from=builder /ton/crypto/smartcont/* /usr/share/ton/smartcont/ -COPY --from=builder /ton/crypto/fift/lib/* /usr/lib/fift/ +COPY --from=builder /ion/build/storage/storage-daemon/storage-daemon /usr/local/bin/ +COPY --from=builder /ion/build/storage/storage-daemon/storage-daemon-cli /usr/local/bin/ +COPY --from=builder /ion/build/lite-client/lite-client /usr/local/bin/ +COPY --from=builder /ion/build/validator-engine/validator-engine /usr/local/bin/ +COPY --from=builder /ion/build/validator-engine-console/validator-engine-console /usr/local/bin/ +COPY --from=builder /ion/build/utils/generate-random-id /usr/local/bin/ +COPY --from=builder /ion/build/crypto/fift /usr/local/bin/ +COPY --from=builder /ion/build/crypto/func /usr/local/bin/ +COPY --from=builder /ion/crypto/smartcont/* /usr/share/ion/smartcont/ +COPY --from=builder /ion/crypto/fift/lib/* /usr/lib/fift/ -WORKDIR /var/ton-work/db -COPY ./docker/init.sh ./docker/control.template /var/ton-work/scripts/ -RUN chmod +x /var/ton-work/scripts/init.sh +WORKDIR /var/ion-work/db +COPY ./docker/init.sh ./docker/control.template /var/ion-work/scripts/ +RUN chmod +x /var/ion-work/scripts/init.sh -ENTRYPOINT ["/var/ton-work/scripts/init.sh"] +ENTRYPOINT ["/var/ion-work/scripts/init.sh"] diff --git a/GPLv2 b/GPLv2 index 69910f2e3..a9aec4d37 100644 --- a/GPLv2 +++ b/GPLv2 @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. diff --git a/LGPLv2 b/LGPLv2 index ab2bc125c..4480658ca 100644 --- a/LGPLv2 +++ b/LGPLv2 @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/LICENSE.LGPL b/LICENSE.LGPL index b482fc4ed..e1621c8f2 100644 --- a/LICENSE.LGPL +++ b/LICENSE.LGPL @@ -2,7 +2,7 @@ Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + 51 Franklin Street, Fifth Floor, Bosion, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -464,7 +464,7 @@ convey the exclusion of warranty; and each file should have at least the You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Bosion, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. diff --git a/README.md b/README.md index 96516d447..085b130b4 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,55 @@
- + - - TON logo + + ION logo -

Reference implementation of TON Node and tools

+

Reference implementation of ION Node and tools


##

- - Ton Research + + Ton Research - - Telegram Community Group + + Telegram Community Group - - Telegram Foundation Group + + Telegram Foundation Group - - Telegram Community Chat + + Telegram Community Chat

- - Twitter Group + + Twitter Group - - TON Overflow Group + + ION Overflow Group - + Stack Overflow Group

-Main TON monorepo, which includes the code of the node/validator, lite-client, tonlib, FunC compiler, etc. +Main ION monorepo, which includes the code of the node/validator, lite-client, tonlib, FunC compiler, etc. ## The Open Network -__The Open Network (TON)__ is a fast, secure, scalable blockchain focused on handling _millions of transactions per second_ (TPS) with the goal of reaching hundreds of millions of blockchain users. -- To learn more about different aspects of TON blockchain and its underlying ecosystem check [documentation](https://ton.org/docs) -- To run node, validator or lite-server check [Participate section](https://ton.org/docs/participate/nodes/run-node) -- To develop decentralised apps check [Tutorials](https://ton.org/docs/develop/smart-contracts/), [FunC docs](https://ton.org/docs/develop/func/overview) and [DApp tutorials](https://ton.org/docs/develop/dapps/) -- To work on TON check [wallets](https://ton.app/wallets), [explorers](https://ton.app/explorers), [DEXes](https://ton.app/dex) and [utilities](https://ton.app/utilities) -- To interact with TON check [APIs](https://ton.org/docs/develop/dapps/apis/) +__The Open Network (ION)__ is a fast, secure, scalable blockchain focused on handling _millions of transactions per second_ (TPS) with the goal of reaching hundreds of millions of blockchain users. +- To learn more about different aspects of ION blockchain and its underlying ecosystem check [documentation](https://ion.org/docs) +- To run node, validator or lite-server check [Participate section](https://ion.org/docs/participate/nodes/run-node) +- To develop decentralised apps check [Tutorials](https://ion.org/docs/develop/smart-contracts/), [FunC docs](https://ion.org/docs/develop/func/overview) and [DApp tutorials](https://ion.org/docs/develop/dapps/) +- To work on ION check [wallets](https://ion.app/wallets), [explorers](https://ion.app/explorers), [DEXes](https://ion.app/dex) and [utilities](https://ion.app/utilities) +- To interact with ION check [APIs](https://ion.org/docs/develop/dapps/apis/) ## Updates flow @@ -69,7 +69,7 @@ Usually, the response to your pull request will indicate which section it falls * Thou shall not merge your own PRs, at least one person should review the PR and merge it (4-eyes rule) * Thou shall make sure that workflows are cleanly completed for your PR before considering merge -## Build TON blockchain +## Build ION blockchain ### Ubuntu 20.4, 22.04 (x86-64, aarch64) Install additional system libraries @@ -81,7 +81,7 @@ Install additional system libraries chmod +x llvm.sh sudo ./llvm.sh 16 all ``` -Compile TON binaries +Compile ION binaries ```bash cp assembly/native/build-ubuntu-shared.sh . chmod +x build-ubuntu-shared.sh @@ -109,7 +109,7 @@ Open an elevated (Run as Administrator) `x86-64 Native Tools Command Prompt for build-windows.bat ``` -### Building TON to WebAssembly +### Building ION to WebAssembly Install additional system libraries on Ubuntu ```bash sudo apt-get update @@ -119,14 +119,14 @@ Install additional system libraries on Ubuntu chmod +x llvm.sh sudo ./llvm.sh 16 all ``` -Compile TON binaries with emscripten +Compile ION binaries with emscripten ```bash cd assembly/wasm chmod +x fift-func-wasm-build-ubuntu.sh ./fift-func-wasm-build-ubuntu.sh ``` -### Building TON tonlib library for Android (arm64-v8a, armeabi-v7a, x86, x86-64) +### Building ION tonlib library for Android (arm64-v8a, armeabi-v7a, x86, x86-64) Install additional system libraries on Ubuntu ```bash sudo apt-get update @@ -134,19 +134,19 @@ Install additional system libraries on Ubuntu zlib1g-dev libssl-dev libreadline-dev libmicrohttpd-dev pkg-config libgsl-dev python3 python3-dev \ libtool autoconf libsodium-dev libsecp256k1-dev ``` -Compile TON tonlib library +Compile ION tonlib library ```bash cp assembly/android/build-android-tonlib.sh . chmod +x build-android-tonlib.sh ./build-android-tonlib.sh ``` -### Build TON portable binaries with Nix package manager +### Build ION portable binaries with Nix package manager You need to install Nix first. ```bash sh <(curl -L https://nixos.org/nix/install) --daemon ``` -Then compile TON with Nix by executing below command from the root folder: +Then compile ION with Nix by executing below command from the root folder: ```bash cp -r assembly/nix/* . export NIX_PATH=nixpkgs=https://github.com/nixOS/nixpkgs/archive/23.05.tar.gz diff --git a/adnl/CMakeLists.txt b/adnl/CMakeLists.txt index 111c4c500..136ba0a66 100644 --- a/adnl/CMakeLists.txt +++ b/adnl/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR) #BEGIN internal -if (NOT TON_ONLY_TONLIB) +if (NOT ION_ONLY_TONLIB) set(ADNL_HEADERS adnl-address-list.h adnl-address-list.hpp @@ -80,19 +80,19 @@ set(ADNL_LITE_SOURCE ) #BEGIN internal -if (NOT TON_ONLY_TONLIB) +if (NOT ION_ONLY_TONLIB) add_library(adnl STATIC ${ADNL_SOURCE}) target_include_directories(adnl PUBLIC $) -target_link_libraries(adnl PUBLIC tdactor ton_crypto tl_api tdnet tddb keys keyring ) +target_link_libraries(adnl PUBLIC tdactor ion_crypto tl_api tdnet tddb keys keyring ) add_executable(adnl-proxy ${ADNL_PROXY_SOURCE}) target_include_directories(adnl-proxy PUBLIC $) -target_link_libraries(adnl-proxy PUBLIC tdactor ton_crypto tl_api tdnet common tl-utils git) +target_link_libraries(adnl-proxy PUBLIC tdactor ion_crypto tl_api tdnet common tl-utils git) add_executable(adnl-pong adnl-pong.cpp) target_include_directories(adnl-pong PUBLIC $) -target_link_libraries(adnl-pong PUBLIC tdactor ton_crypto tl_api tdnet common tl-utils adnl dht git) +target_link_libraries(adnl-pong PUBLIC tdactor ion_crypto tl_api tdnet common tl-utils adnl dht git) add_library(adnltest STATIC ${ADNL_TEST_SOURCE}) target_include_directories(adnltest PUBLIC $) @@ -105,4 +105,4 @@ endif() add_library(adnllite STATIC ${ADNL_LITE_SOURCE}) target_include_directories(adnllite PUBLIC $) -target_link_libraries(adnllite PUBLIC tdactor ton_crypto tl_lite_api tdnet keys) +target_link_libraries(adnllite PUBLIC tdactor ion_crypto tl_lite_api tdnet keys) diff --git a/adnl/adnl-address-list.cpp b/adnl/adnl-address-list.cpp index 912943a86..c42b7eda9 100644 --- a/adnl/adnl-address-list.cpp +++ b/adnl/adnl-address-list.cpp @@ -1,29 +1,29 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "adnl-address-list.hpp" #include "adnl-peer-table.h" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" #include "td/utils/overloaded.h" #include "td/net/UdpServer.h" #include "keys/encryptor.h" -namespace ton { +namespace ion { namespace adnl { @@ -152,7 +152,7 @@ td::actor::ActorOwn AdnlAddressUdp::create_connection( return td::actor::create_actor("udpconn", network_manager, ip_, port_, std::move(callback)); } -AdnlAddressUdp::AdnlAddressUdp(const ton_api::adnl_address_udp &obj) { +AdnlAddressUdp::AdnlAddressUdp(const ion_api::adnl_address_udp &obj) { ip_ = obj.ip_; port_ = static_cast(obj.port_); } @@ -163,7 +163,7 @@ td::actor::ActorOwn AdnlAddressUdp6::create_connection( return td::actor::create_actor("udpconn", network_manager, ip_, port_, std::move(callback)); } -AdnlAddressUdp6::AdnlAddressUdp6(const ton_api::adnl_address_udp6 &obj) { +AdnlAddressUdp6::AdnlAddressUdp6(const ion_api::adnl_address_udp6 &obj) { ip_ = obj.ip_; port_ = static_cast(obj.port_); } @@ -174,19 +174,19 @@ td::actor::ActorOwn AdnlAddressTunnel::create_connection( return td::actor::create_actor("tunnelconn", network_manager, adnl, adnl_id_, pub_key_, std::move(callback)); } -AdnlAddressTunnel::AdnlAddressTunnel(const ton_api::adnl_address_tunnel &obj) { +AdnlAddressTunnel::AdnlAddressTunnel(const ion_api::adnl_address_tunnel &obj) { adnl_id_ = AdnlNodeIdShort{obj.to_}; - pub_key_ = ton::PublicKey{obj.pubkey_}; + pub_key_ = ion::PublicKey{obj.pubkey_}; } -td::Ref AdnlAddressImpl::create(const tl_object_ptr &addr) { +td::Ref AdnlAddressImpl::create(const tl_object_ptr &addr) { td::Ref res = td::Ref{}; - ton_api::downcast_call( - *const_cast(addr.get()), - td::overloaded([&](const ton_api::adnl_address_udp &obj) { res = td::make_ref(obj); }, - [&](const ton_api::adnl_address_udp6 &obj) { res = td::make_ref(obj); }, - [&](const ton_api::adnl_address_tunnel &obj) { res = td::make_ref(obj); }, - [&](const ton_api::adnl_address_reverse &obj) { res = td::make_ref(); })); + ion_api::downcast_call( + *const_cast(addr.get()), + td::overloaded([&](const ion_api::adnl_address_udp &obj) { res = td::make_ref(obj); }, + [&](const ion_api::adnl_address_udp6 &obj) { res = td::make_ref(obj); }, + [&](const ion_api::adnl_address_tunnel &obj) { res = td::make_ref(obj); }, + [&](const ion_api::adnl_address_reverse &obj) { res = td::make_ref(); })); return res; } @@ -199,7 +199,7 @@ bool AdnlAddressList::public_only() const { return true; } -AdnlAddressList::AdnlAddressList(const tl_object_ptr &addrs) { +AdnlAddressList::AdnlAddressList(const tl_object_ptr &addrs) { version_ = static_cast(addrs->version_); std::vector> vec; for (auto &addr : addrs->addrs_) { @@ -216,15 +216,15 @@ AdnlAddressList::AdnlAddressList(const tl_object_ptr expire_at_ = addrs->expire_at_; } -tl_object_ptr AdnlAddressList::tl() const { - std::vector> addrs; +tl_object_ptr AdnlAddressList::tl() const { + std::vector> addrs; for (auto &v : addrs_) { addrs.emplace_back(v->tl()); } if (has_reverse_) { - addrs.push_back(create_tl_object()); + addrs.push_back(create_tl_object()); } - return create_tl_object(std::move(addrs), version_, reinit_date_, priority_, expire_at_); + return create_tl_object(std::move(addrs), version_, reinit_date_, priority_, expire_at_); } td::uint32 AdnlAddressList::serialized_size() const { @@ -235,7 +235,7 @@ td::uint32 AdnlAddressList::serialized_size() const { return res; } -td::Result AdnlAddressList::create(const tl_object_ptr &addr_list) { +td::Result AdnlAddressList::create(const tl_object_ptr &addr_list) { auto A = AdnlAddressList{addr_list}; if (A.serialized_size() > max_serialized_size()) { return td::Status::Error(ErrorCode::protoviolation, PSTRING() << "too big addr list: size=" << A.serialized_size()); @@ -255,4 +255,4 @@ td::Status AdnlAddressList::add_udp_address(td::IPAddress addr) { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-address-list.h b/adnl/adnl-address-list.h index ebc7473a6..147358b03 100644 --- a/adnl/adnl-address-list.h +++ b/adnl/adnl-address-list.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "adnl-network-manager.h" #include "crypto/common/refcnt.hpp" -namespace ton { +namespace ion { namespace adnl { @@ -35,7 +35,7 @@ class AdnlAddressImpl : public td::CntObject { virtual Hash get_hash() const; virtual bool is_public() const = 0; virtual td::uint32 serialized_size() const = 0; - virtual tl_object_ptr tl() const = 0; + virtual tl_object_ptr tl() const = 0; virtual td::actor::ActorOwn create_connection( td::actor::ActorId network_manager, td::actor::ActorId adnl, std::unique_ptr callback) const = 0; @@ -43,14 +43,14 @@ class AdnlAddressImpl : public td::CntObject { return false; } - static td::Ref create(const tl_object_ptr &addr); + static td::Ref create(const tl_object_ptr &addr); }; using AdnlAddress = td::Ref; class AdnlAddressList { private: - AdnlAddressList(const tl_object_ptr &addrs); + AdnlAddressList(const tl_object_ptr &addrs); td::int32 version_; td::int32 reinit_date_; @@ -100,11 +100,11 @@ class AdnlAddressList { return td::narrow_cast(addrs_.size()); } td::uint32 serialized_size() const; - tl_object_ptr tl() const; + tl_object_ptr tl() const; AdnlAddressList() : version_{-1}, reinit_date_{0}, priority_{0}, expire_at_{0} { } - static td::Result create(const tl_object_ptr &addr_list); + static td::Result create(const tl_object_ptr &addr_list); td::Status add_udp_address(td::IPAddress addr); void set_reverse(bool x = true) { @@ -117,4 +117,4 @@ class AdnlAddressList { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-address-list.hpp b/adnl/adnl-address-list.hpp index 0c869378b..e4b70ca91 100644 --- a/adnl/adnl-address-list.hpp +++ b/adnl/adnl-address-list.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "adnl-node-id.hpp" #include "adnl-address-list.h" -namespace ton { +namespace ion { namespace adnl { @@ -31,7 +31,7 @@ class AdnlAddressUdp : public AdnlAddressImpl { td::uint16 port_; public: - explicit AdnlAddressUdp(const ton_api::adnl_address_udp &obj); + explicit AdnlAddressUdp(const ion_api::adnl_address_udp &obj); AdnlAddressUdp(td::uint32 ip, td::uint16 port) : ip_(ip), port_(port) { } @@ -47,8 +47,8 @@ class AdnlAddressUdp : public AdnlAddressImpl { return 12; } - tl_object_ptr tl() const override { - return create_tl_object(ip_, port_); + tl_object_ptr tl() const override { + return create_tl_object(ip_, port_); } td::actor::ActorOwn create_connection( td::actor::ActorId network_manager, td::actor::ActorId adnl, @@ -61,7 +61,7 @@ class AdnlAddressUdp6 : public AdnlAddressImpl { td::uint16 port_; public: - explicit AdnlAddressUdp6(const ton_api::adnl_address_udp6 &obj); + explicit AdnlAddressUdp6(const ion_api::adnl_address_udp6 &obj); AdnlAddressUdp6(td::Bits128 ip, td::uint16 port) : ip_(ip), port_(port) { } @@ -77,8 +77,8 @@ class AdnlAddressUdp6 : public AdnlAddressImpl { return 12; } - tl_object_ptr tl() const override { - return create_tl_object(ip_, port_); + tl_object_ptr tl() const override { + return create_tl_object(ip_, port_); } td::actor::ActorOwn create_connection( td::actor::ActorId network_manager, td::actor::ActorId adnl, @@ -91,7 +91,7 @@ class AdnlAddressTunnel : public AdnlAddressImpl { PublicKey pub_key_; public: - explicit AdnlAddressTunnel(const ton_api::adnl_address_tunnel &obj); + explicit AdnlAddressTunnel(const ion_api::adnl_address_tunnel &obj); AdnlAddressTunnel(AdnlNodeIdShort adnl_id, PublicKey pub_key) : adnl_id_(std::move(adnl_id)), pub_key_(std::move(pub_key)) { @@ -108,8 +108,8 @@ class AdnlAddressTunnel : public AdnlAddressImpl { return 4 + 32 + pub_key_.serialized_size(); } - tl_object_ptr tl() const override { - return create_tl_object(adnl_id_.bits256_value(), pub_key_.tl()); + tl_object_ptr tl() const override { + return create_tl_object(adnl_id_.bits256_value(), pub_key_.tl()); } td::actor::ActorOwn create_connection( td::actor::ActorId network_manager, td::actor::ActorId adnl, @@ -127,8 +127,8 @@ class AdnlAddressReverse : public AdnlAddressImpl { td::uint32 serialized_size() const override { return 4; } - tl_object_ptr tl() const override { - return create_tl_object(); + tl_object_ptr tl() const override { + return create_tl_object(); } td::actor::ActorOwn create_connection( td::actor::ActorId network_manager, td::actor::ActorId adnl, @@ -143,4 +143,4 @@ class AdnlAddressReverse : public AdnlAddressImpl { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-channel.cpp b/adnl/adnl-channel.cpp index 4da9d2eed..93597a240 100644 --- a/adnl/adnl-channel.cpp +++ b/adnl/adnl-channel.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -23,7 +23,7 @@ #include "td/utils/crypto.h" #include "crypto/Ed25519.h" -namespace ton { +namespace ion { namespace adnl { @@ -85,7 +85,7 @@ AdnlChannelImpl::AdnlChannelImpl(AdnlNodeIdShort local_id, AdnlNodeIdShort peer_ void AdnlChannelImpl::decrypt(td::BufferSlice raw_data, td::Promise promise) { TRY_RESULT_PROMISE_PREFIX(promise, data, decryptor_->decrypt(raw_data.as_slice()), "failed to decrypt channel message: "); - TRY_RESULT_PROMISE_PREFIX(promise, tl_packet, fetch_tl_object(std::move(data), true), + TRY_RESULT_PROMISE_PREFIX(promise, tl_packet, fetch_tl_object(std::move(data), true), "decrypted channel packet contains invalid TL scheme: "); TRY_RESULT_PROMISE_PREFIX(promise, packet, AdnlPacket::create(std::move(tl_packet)), "received bad packet: "); if (packet.inited_from_short() && packet.from_short() != peer_id_) { @@ -128,4 +128,4 @@ void AdnlChannelImpl::receive(td::IPAddress addr, td::BufferSlice data) { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-channel.h b/adnl/adnl-channel.h index 94b5877d5..d33f7b38d 100644 --- a/adnl/adnl-channel.h +++ b/adnl/adnl-channel.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -23,7 +23,7 @@ #include "adnl-peer-table.h" #include "adnl-network-manager.h" -namespace ton { +namespace ion { namespace adnl { @@ -43,4 +43,4 @@ class AdnlChannel : public td::actor::Actor { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-channel.hpp b/adnl/adnl-channel.hpp index 0c30fbd5b..e51bc0e77 100644 --- a/adnl/adnl-channel.hpp +++ b/adnl/adnl-channel.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "adnl-channel.h" #include "keys/encryptor.h" -namespace ton { +namespace ion { namespace adnl { @@ -59,22 +59,22 @@ class AdnlChannelImpl : public AdnlChannel { } // namespace adnl -} // namespace ton +} // namespace ion namespace td { -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::adnl::AdnlChannelImpl::AdnlChannelPrintId &id) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::adnl::AdnlChannelImpl::AdnlChannelPrintId &id) { sb << "[channel " << id.peer_id_ << "-" << id.local_id_ << " " << id.channel_out_id_ << "-" << id.channel_in_id_ << "]"; return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::adnl::AdnlChannelImpl &channel) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::adnl::AdnlChannelImpl &channel) { sb << channel.print_id(); return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::adnl::AdnlChannelImpl *channel) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::adnl::AdnlChannelImpl *channel) { sb << channel->print_id(); return sb; } diff --git a/adnl/adnl-db.cpp b/adnl/adnl-db.cpp index c86f3f7e7..01402c07e 100644 --- a/adnl/adnl-db.cpp +++ b/adnl/adnl-db.cpp @@ -1,25 +1,25 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "adnl-db.hpp" #include "td/db/RocksDb.h" -namespace ton { +namespace ion { namespace adnl { @@ -31,7 +31,7 @@ void AdnlDbImpl::update(AdnlNodeIdShort local_id, AdnlNodeIdShort peer_id, AdnlD S.remove_prefix(32); S.copy_from(peer_id.as_slice()); - auto obj = create_tl_object(static_cast(td::Clocks::system()), item.id.tl(), + auto obj = create_tl_object(static_cast(td::Clocks::system()), item.id.tl(), item.addr_list.tl(), item.priority_addr_list.tl()); kv_->begin_transaction().ensure(); @@ -53,7 +53,7 @@ void AdnlDbImpl::get(AdnlNodeIdShort local_id, AdnlNodeIdShort peer_id, td::Prom promise.set_error(td::Status::Error(ErrorCode::notready, "not in db")); return; } - auto F = fetch_tl_object(td::BufferSlice{value}, true); + auto F = fetch_tl_object(td::BufferSlice{value}, true); F.ensure(); auto f = F.move_as_ok(); AdnlDbItem n; @@ -79,4 +79,4 @@ td::actor::ActorOwn AdnlDb::create(std::string path) { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-db.h b/adnl/adnl-db.h index f9d61eb27..110a4ce49 100644 --- a/adnl/adnl-db.h +++ b/adnl/adnl-db.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -22,7 +22,7 @@ #include "adnl.h" -namespace ton { +namespace ion { namespace adnl { @@ -44,4 +44,4 @@ class AdnlDb : public td::actor::Actor { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-db.hpp b/adnl/adnl-db.hpp index 0f4937457..e05786424 100644 --- a/adnl/adnl-db.hpp +++ b/adnl/adnl-db.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "adnl-db.h" #include "td/db/KeyValue.h" -namespace ton { +namespace ion { namespace adnl { @@ -44,4 +44,4 @@ class AdnlDbImpl : public AdnlDb { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-ext-client.cpp b/adnl/adnl-ext-client.cpp index 9602b521e..0616980e9 100644 --- a/adnl/adnl-ext-client.cpp +++ b/adnl/adnl-ext-client.cpp @@ -1,25 +1,25 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "adnl-ext-client.hpp" #include "adnl-ext-client.h" -namespace ton { +namespace ion { namespace adnl { @@ -76,14 +76,14 @@ void AdnlExtClientImpl::try_stop() { td::Status AdnlOutboundConnection::process_custom_packet(td::BufferSlice &data, bool &processed) { if (data.size() == 12) { - auto F = fetch_tl_object(data.clone(), true); + auto F = fetch_tl_object(data.clone(), true); if (F.is_ok()) { processed = true; return td::Status::OK(); } } if (!local_id_.empty() && nonce_.size() != 0) { - auto F = fetch_tl_object(data.clone(), true); + auto F = fetch_tl_object(data.clone(), true); if (F.is_ok()) { auto f = F.move_as_ok(); if (f->nonce_.size() == 0 || f->nonce_.size() > 512) { @@ -97,7 +97,7 @@ td::Status AdnlOutboundConnection::process_custom_packet(td::BufferSlice &data, TRY_RESULT(B, dec->sign(ss.as_slice())); auto obj = - create_tl_object(local_id_.compute_public_key().tl(), std::move(B)); + create_tl_object(local_id_.compute_public_key().tl(), std::move(B)); send(serialize_tl_object(obj, true)); nonce_.clear(); @@ -147,7 +147,7 @@ void AdnlOutboundConnection::start_up() { if (!local_id_.empty()) { nonce_ = td::SecureString{32}; td::Random::secure_bytes(nonce_.as_mutable_slice()); - auto obj = create_tl_object(td::BufferSlice{nonce_.as_slice()}); + auto obj = create_tl_object(td::BufferSlice{nonce_.as_slice()}); send(serialize_tl_object(obj, true)); } } @@ -288,4 +288,4 @@ td::actor::ActorOwn AdnlExtMultiClient::create( } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-ext-client.h b/adnl/adnl-ext-client.h index b9a5d570a..ec0fc017d 100644 --- a/adnl/adnl-ext-client.h +++ b/adnl/adnl-ext-client.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "adnl-node-id.hpp" #include "td/utils/port/IPAddress.h" -namespace ton { +namespace ion { namespace adnl { @@ -53,4 +53,4 @@ class AdnlExtMultiClient : public AdnlExtClient { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-ext-client.hpp b/adnl/adnl-ext-client.hpp index 133397255..5836b352f 100644 --- a/adnl/adnl-ext-client.hpp +++ b/adnl/adnl-ext-client.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -26,7 +26,7 @@ #include "keys/encryptor.h" #include "adnl-ext-client.h" -namespace ton { +namespace ion { namespace adnl { @@ -191,4 +191,4 @@ class AdnlExtMultiClientImpl : public AdnlExtMultiClient { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-ext-connection.cpp b/adnl/adnl-ext-connection.cpp index 06926f4d1..75c2d4cce 100644 --- a/adnl/adnl-ext-connection.cpp +++ b/adnl/adnl-ext-connection.cpp @@ -1,24 +1,24 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "adnl-ext-connection.hpp" -namespace ton { +namespace ion { namespace adnl { @@ -189,4 +189,4 @@ td::Status AdnlExtConnection::receive_packet(td::BufferSlice data) { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-ext-connection.hpp b/adnl/adnl-ext-connection.hpp index ce3c29b3c..9c6413d28 100644 --- a/adnl/adnl-ext-connection.hpp +++ b/adnl/adnl-ext-connection.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -28,7 +28,7 @@ #include #include -namespace ton { +namespace ion { namespace adnl { @@ -148,7 +148,7 @@ class AdnlExtConnection : public td::actor::Actor, public td::ObserverBase { stop(); } else if (is_client_ && !ping_sent_) { if (send_ping_at_.is_in_past()) { - auto obj = create_tl_object(td::Random::fast_uint64()); + auto obj = create_tl_object(td::Random::fast_uint64()); send(serialize_tl_object(obj, true)); ping_sent_ = true; } else { @@ -160,4 +160,4 @@ class AdnlExtConnection : public td::actor::Actor, public td::ObserverBase { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-ext-server.cpp b/adnl/adnl-ext-server.cpp index 162a53afb..bc3d7312c 100644 --- a/adnl/adnl-ext-server.cpp +++ b/adnl/adnl-ext-server.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -20,12 +20,12 @@ #include "keys/encryptor.h" #include "utils.hpp" -namespace ton { +namespace ion { namespace adnl { td::Status AdnlInboundConnection::process_packet(td::BufferSlice data) { - TRY_RESULT(f, fetch_tl_object(std::move(data), true)); + TRY_RESULT(f, fetch_tl_object(std::move(data), true)); auto P = td::PromiseCreator::lambda([SelfId = actor_id(this), query_id = f->query_id_](td::Result R) { @@ -33,7 +33,7 @@ td::Status AdnlInboundConnection::process_packet(td::BufferSlice data) { auto S = R.move_as_error(); LOG(WARNING) << "failed ext query: " << S; } else { - auto B = create_tl_object(query_id, R.move_as_ok()); + auto B = create_tl_object(query_id, R.move_as_ok()); td::actor::send_closure(SelfId, &AdnlInboundConnection::send, serialize_tl_object(B, true)); } }); @@ -78,17 +78,17 @@ void AdnlInboundConnection::inited_crypto(td::Result R) { td::Status AdnlInboundConnection::process_custom_packet(td::BufferSlice &data, bool &processed) { if (data.size() == 12) { - auto F = fetch_tl_object(data.clone(), true); + auto F = fetch_tl_object(data.clone(), true); if (F.is_ok()) { auto f = F.move_as_ok(); - auto obj = create_tl_object(f->random_id_); + auto obj = create_tl_object(f->random_id_); send(serialize_tl_object(obj, true)); processed = true; return td::Status::OK(); } } if (1) { - auto F = fetch_tl_object(data.clone(), true); + auto F = fetch_tl_object(data.clone(), true); if (F.is_ok()) { if (nonce_.size() > 0 || !remote_id_.is_zero()) { return td::Status::Error(ErrorCode::protoviolation, "duplicate authenticate"); @@ -98,7 +98,7 @@ td::Status AdnlInboundConnection::process_custom_packet(td::BufferSlice &data, b nonce_.as_mutable_slice().truncate(f->nonce_.size()).copy_from(f->nonce_.as_slice()); td::Random::secure_bytes(nonce_.as_mutable_slice().remove_prefix(f->nonce_.size())); - auto obj = create_tl_object( + auto obj = create_tl_object( td::BufferSlice{nonce_.as_slice().remove_prefix(f->nonce_.size())}); send(serialize_tl_object(obj, true)); processed = true; @@ -107,7 +107,7 @@ td::Status AdnlInboundConnection::process_custom_packet(td::BufferSlice &data, b } if (nonce_.size() != 0) { - auto F = fetch_tl_object(data.clone(), true); + auto F = fetch_tl_object(data.clone(), true); if (F.is_ok()) { auto f = F.move_as_ok(); if (nonce_.size() == 0 || !remote_id_.is_zero()) { @@ -179,4 +179,4 @@ td::actor::ActorOwn AdnlExtServerCreator::create(td::actor::Actor } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-ext-server.h b/adnl/adnl-ext-server.h index 618b2fb4d..8a5f71f0f 100644 --- a/adnl/adnl-ext-server.h +++ b/adnl/adnl-ext-server.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -20,7 +20,7 @@ #include "adnl-peer-table.h" -namespace ton { +namespace ion { namespace adnl { @@ -32,4 +32,4 @@ class AdnlExtServerCreator { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-ext-server.hpp b/adnl/adnl-ext-server.hpp index b4604a76d..3e769de9d 100644 --- a/adnl/adnl-ext-server.hpp +++ b/adnl/adnl-ext-server.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -28,7 +28,7 @@ #include #include -namespace ton { +namespace ion { namespace adnl { @@ -92,4 +92,4 @@ class AdnlExtServerImpl : public AdnlExtServer { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-local-id.cpp b/adnl/adnl-local-id.cpp index e0c62de76..86f403a5d 100644 --- a/adnl/adnl-local-id.cpp +++ b/adnl/adnl-local-id.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -23,7 +23,7 @@ #include "keys/encryptor.h" #include "utils.hpp" -namespace ton { +namespace ion { namespace adnl { @@ -244,7 +244,7 @@ void AdnlLocalId::decrypt(td::BufferSlice data, td::Promise promise) } void AdnlLocalId::decrypt_continue(td::BufferSlice data, td::Promise promise) { - auto R = fetch_tl_object(std::move(data), true); + auto R = fetch_tl_object(std::move(data), true); if (R.is_error()) { promise.set_error(R.move_as_error()); return; @@ -306,12 +306,12 @@ void AdnlLocalId::update_packet(AdnlPacket packet, bool update_id, bool sign, td } } -void AdnlLocalId::get_stats(bool all, td::Promise> promise) { - auto stats = create_tl_object(); +void AdnlLocalId::get_stats(bool all, td::Promise> promise) { + auto stats = create_tl_object(); stats->short_id_ = short_id_.bits256_value(); for (auto &[ip, x] : inbound_rate_limiter_) { if (x.currently_decrypting_packets != 0) { - stats->current_decrypt_.push_back(create_tl_object( + stats->current_decrypt_.push_back(create_tl_object( ip.is_valid() ? PSTRING() << ip.get_ip_str() << ":" << ip.get_port() : "", x.currently_decrypting_packets)); } } @@ -351,20 +351,20 @@ void AdnlLocalId::prepare_packet_stats() { } } -tl_object_ptr AdnlLocalId::PacketStats::tl(bool all) const { +tl_object_ptr AdnlLocalId::PacketStats::tl(bool all) const { double threshold = all ? -1.0 : td::Clocks::system() - 600.0; - auto obj = create_tl_object(); + auto obj = create_tl_object(); obj->ts_start_ = ts_start; obj->ts_end_ = ts_end; for (const auto &[ip, packets] : decrypted_packets) { if (packets.last_packet_ts >= threshold) { - obj->decrypted_packets_.push_back(create_tl_object( + obj->decrypted_packets_.push_back(create_tl_object( ip.is_valid() ? PSTRING() << ip.get_ip_str() << ":" << ip.get_port() : "", packets.packets)); } } for (const auto &[ip, packets] : dropped_packets) { if (packets.last_packet_ts >= threshold) { - obj->dropped_packets_.push_back(create_tl_object( + obj->dropped_packets_.push_back(create_tl_object( ip.is_valid() ? PSTRING() << ip.get_ip_str() << ":" << ip.get_port() : "", packets.packets)); } } @@ -374,4 +374,4 @@ tl_object_ptr AdnlLocalId::PacketStats::tl(b } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-local-id.h b/adnl/adnl-local-id.h index fa7f7f749..74c957d72 100644 --- a/adnl/adnl-local-id.h +++ b/adnl/adnl-local-id.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -22,7 +22,7 @@ #include "td/actor/actor.h" #include "td/utils/BufferedUdp.h" -#include "auto/tl/ton_api.h" +#include "auto/tl/ion_api.h" #include "keys/encryptor.h" #include "adnl-peer-table.h" #include "dht/dht.h" @@ -30,7 +30,7 @@ #include "adnl-peer-table.h" #include "utils.hpp" -namespace ton { +namespace ion { namespace adnl { @@ -78,7 +78,7 @@ class AdnlLocalId : public td::actor::Actor { void update_packet(AdnlPacket packet, bool update_id, bool sign, td::int32 update_addr_list_if, td::int32 update_priority_addr_list_if, td::Promise promise); - void get_stats(bool all, td::Promise> promise); + void get_stats(bool all, td::Promise> promise); td::uint32 get_mode() { return mode_; @@ -124,7 +124,7 @@ class AdnlLocalId : public td::actor::Actor { std::map decrypted_packets; std::map dropped_packets; - tl_object_ptr tl(bool all = true) const; + tl_object_ptr tl(bool all = true) const; } packet_stats_cur_, packet_stats_prev_, packet_stats_total_; void add_decrypted_packet_stats(td::IPAddress addr); void add_dropped_packet_stats(td::IPAddress addr); @@ -150,4 +150,4 @@ inline td::StringBuilder &operator<<(td::StringBuilder &sb, const AdnlLocalId *l } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-message.cpp b/adnl/adnl-message.cpp index 0d7129783..bc3241466 100644 --- a/adnl/adnl-message.cpp +++ b/adnl/adnl-message.cpp @@ -1,49 +1,49 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "adnl/adnl-message.h" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" #include "td/utils/overloaded.h" -namespace ton { +namespace ion { namespace adnl { -AdnlMessage::AdnlMessage(tl_object_ptr message) { - ton_api::downcast_call( +AdnlMessage::AdnlMessage(tl_object_ptr message) { + ion_api::downcast_call( *message.get(), td::overloaded( - [&](ton_api::adnl_message_createChannel &msg) { + [&](ion_api::adnl_message_createChannel &msg) { message_ = adnlmessage::AdnlMessageCreateChannel{msg.key_, msg.date_}; }, - [&](ton_api::adnl_message_confirmChannel &msg) { + [&](ion_api::adnl_message_confirmChannel &msg) { message_ = adnlmessage::AdnlMessageConfirmChannel{msg.key_, msg.peer_key_, msg.date_}; }, - [&](ton_api::adnl_message_custom &msg) { message_ = adnlmessage::AdnlMessageCustom{std::move(msg.data_)}; }, - [&](ton_api::adnl_message_nop &msg) { message_ = adnlmessage::AdnlMessageNop{}; }, - [&](ton_api::adnl_message_reinit &msg) { message_ = adnlmessage::AdnlMessageReinit{msg.date_}; }, - [&](ton_api::adnl_message_query &msg) { + [&](ion_api::adnl_message_custom &msg) { message_ = adnlmessage::AdnlMessageCustom{std::move(msg.data_)}; }, + [&](ion_api::adnl_message_nop &msg) { message_ = adnlmessage::AdnlMessageNop{}; }, + [&](ion_api::adnl_message_reinit &msg) { message_ = adnlmessage::AdnlMessageReinit{msg.date_}; }, + [&](ion_api::adnl_message_query &msg) { message_ = adnlmessage::AdnlMessageQuery{msg.query_id_, std::move(msg.query_)}; }, - [&](ton_api::adnl_message_answer &msg) { + [&](ion_api::adnl_message_answer &msg) { message_ = adnlmessage::AdnlMessageAnswer{msg.query_id_, std::move(msg.answer_)}; }, - [&](ton_api::adnl_message_part &msg) { + [&](ion_api::adnl_message_part &msg) { message_ = adnlmessage::AdnlMessagePart{msg.hash_, static_cast(msg.total_size_), static_cast(msg.offset_), std::move(msg.data_)}; })); @@ -51,4 +51,4 @@ AdnlMessage::AdnlMessage(tl_object_ptr message) { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-message.h b/adnl/adnl-message.h index 43849e982..f8b67b6a1 100644 --- a/adnl/adnl-message.h +++ b/adnl/adnl-message.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "adnl/adnl.h" #include "adnl/adnl-query.h" -namespace ton { +namespace ion { namespace adnl { @@ -40,8 +40,8 @@ class AdnlMessageCreateChannel { td::uint32 size() const { return 40; } - tl_object_ptr tl() const { - return create_tl_object(key_.raw(), date_); + tl_object_ptr tl() const { + return create_tl_object(key_.raw(), date_); } private: @@ -66,8 +66,8 @@ class AdnlMessageConfirmChannel { td::uint32 size() const { return 72; } - tl_object_ptr tl() const { - return create_tl_object(key_.raw(), peer_key_.raw(), date_); + tl_object_ptr tl() const { + return create_tl_object(key_.raw(), peer_key_.raw(), date_); } private: @@ -86,8 +86,8 @@ class AdnlMessageCustom { td::uint32 size() const { return static_cast(data_.size()) + 12; } - tl_object_ptr tl() const { - return create_tl_object(data_.clone()); + tl_object_ptr tl() const { + return create_tl_object(data_.clone()); } private: @@ -101,8 +101,8 @@ class AdnlMessageNop { td::uint32 size() const { return 4; } - tl_object_ptr tl() const { - return create_tl_object(); + tl_object_ptr tl() const { + return create_tl_object(); } private: @@ -118,8 +118,8 @@ class AdnlMessageReinit { td::uint32 size() const { return 8; } - tl_object_ptr tl() const { - return create_tl_object(date_); + tl_object_ptr tl() const { + return create_tl_object(date_); } private: @@ -139,8 +139,8 @@ class AdnlMessageQuery { td::uint32 size() const { return static_cast(data_.size()) + 44; } - tl_object_ptr tl() const { - return create_tl_object(query_id_, data_.clone()); + tl_object_ptr tl() const { + return create_tl_object(query_id_, data_.clone()); } private: @@ -161,8 +161,8 @@ class AdnlMessageAnswer { td::uint32 size() const { return static_cast(data_.size()) + 44; } - tl_object_ptr tl() const { - return create_tl_object(query_id_, data_.clone()); + tl_object_ptr tl() const { + return create_tl_object(query_id_, data_.clone()); } private: @@ -190,8 +190,8 @@ class AdnlMessagePart { td::uint32 size() const { return static_cast(data_.size()) + 48; } - tl_object_ptr tl() const { - return create_tl_object(hash_, total_size_, offset_, data_.clone()); + tl_object_ptr tl() const { + return create_tl_object(hash_, total_size_, offset_, data_.clone()); } private: @@ -212,7 +212,7 @@ class AdnlMessage { td::uint32 size() const { UNREACHABLE(); } - tl_object_ptr tl() const { + tl_object_ptr tl() const { UNREACHABLE(); } }; @@ -224,13 +224,13 @@ class AdnlMessage { message_{Empty{}}; public: - explicit AdnlMessage(tl_object_ptr message); + explicit AdnlMessage(tl_object_ptr message); template AdnlMessage(T m) : message_(std::move(m)) { } - tl_object_ptr tl() const { - tl_object_ptr res; + tl_object_ptr tl() const { + tl_object_ptr res; message_.visit([&](const auto &obj) { res = obj.tl(); }); return res; } @@ -260,7 +260,7 @@ class OutboundAdnlMessage { void set_flags(td::uint32 f) { flags_ = f; } - tl_object_ptr tl() const { + tl_object_ptr tl() const { return message_.tl(); } td::uint32 size() const { @@ -287,11 +287,11 @@ class AdnlMessageList { public: AdnlMessageList() { } - AdnlMessageList(tl_object_ptr message) { + AdnlMessageList(tl_object_ptr message) { auto msg = AdnlMessage{std::move(message)}; messages_.emplace_back(std::move(msg)); } - AdnlMessageList(std::vector> messages) { + AdnlMessageList(std::vector> messages) { for (auto &message : messages) { messages_.push_back(AdnlMessage{std::move(message)}); } @@ -303,19 +303,19 @@ class AdnlMessageList { td::uint32 size() const { return static_cast(messages_.size()); } - tl_object_ptr one_message() const { + tl_object_ptr one_message() const { CHECK(size() == 1); return messages_[0].tl(); } - std::vector> mult_messages() const { - std::vector> vec; + std::vector> mult_messages() const { + std::vector> vec; for (auto &m : messages_) { vec.emplace_back(m.tl()); } return vec; } - static std::vector> empty_vector() { - return std::vector>{}; + static std::vector> empty_vector() { + return std::vector>{}; } auto &vector() { return messages_; @@ -329,11 +329,11 @@ class OutboundAdnlMessageList { public: OutboundAdnlMessageList() { } - OutboundAdnlMessageList(tl_object_ptr message, td::uint32 flags) { + OutboundAdnlMessageList(tl_object_ptr message, td::uint32 flags) { auto msg = OutboundAdnlMessage{std::move(message), flags}; messages_.emplace_back(std::move(msg)); } - OutboundAdnlMessageList(std::vector> messages, td::uint32 flags) { + OutboundAdnlMessageList(std::vector> messages, td::uint32 flags) { for (auto &message : messages) { messages_.push_back(OutboundAdnlMessage{std::move(message), flags}); } @@ -345,19 +345,19 @@ class OutboundAdnlMessageList { td::uint32 size() const { return static_cast(messages_.size()); } - tl_object_ptr one_message() const { + tl_object_ptr one_message() const { CHECK(size() == 1); return messages_[0].tl(); } - std::vector> mult_messages() const { - std::vector> vec; + std::vector> mult_messages() const { + std::vector> vec; for (auto &m : messages_) { vec.emplace_back(m.tl()); } return vec; } - static std::vector> empty_vector() { - return std::vector>{}; + static std::vector> empty_vector() { + return std::vector>{}; } auto &vector() { return messages_; @@ -369,4 +369,4 @@ class OutboundAdnlMessageList { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-network-manager.cpp b/adnl/adnl-network-manager.cpp index 077fb9390..7390ee0b2 100644 --- a/adnl/adnl-network-manager.cpp +++ b/adnl/adnl-network-manager.cpp @@ -1,29 +1,29 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "adnl-network-manager.hpp" #include "adnl-peer-table.h" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" #include "td/utils/overloaded.h" -namespace ton { +namespace ion { namespace adnl { @@ -165,17 +165,17 @@ void AdnlNetworkManagerImpl::receive_udp_message(td::UdpMessage message, size_t return; } if (packet.flags & (1 << 17)) { - auto F = fetch_tl_object(std::move(packet.data), true); + auto F = fetch_tl_object(std::move(packet.data), true); if (F.is_error()) { VLOG(ADNL_WARNING) << this << ": dropping proxy packet: bad control packet"; return; } - ton_api::downcast_call(*F.move_as_ok().get(), + ion_api::downcast_call(*F.move_as_ok().get(), td::overloaded( - [&](const ton_api::adnl_proxyControlPacketPing &f) { + [&](const ion_api::adnl_proxyControlPacketPing &f) { auto &v = *proxy_iface.out_desc; auto data = - create_serialize_tl_object(f.id_); + create_serialize_tl_object(f.id_); AdnlProxy::Packet p; p.flags = 6 | (1 << 17); p.ip = 0; @@ -192,8 +192,8 @@ void AdnlNetworkManagerImpl::receive_udp_message(td::UdpMessage message, size_t td::actor::send_closure(socket.server, &td::UdpServer::send, std::move(M)); }, - [&](const ton_api::adnl_proxyControlPacketPong &f) {}, - [&](const ton_api::adnl_proxyControlPacketRegister &f) {})); + [&](const ion_api::adnl_proxyControlPacketPong &f) {}, + [&](const ion_api::adnl_proxyControlPacketRegister &f) {})); return; } message.data = std::move(packet.data); @@ -264,7 +264,7 @@ void AdnlNetworkManagerImpl::send_udp_packet(AdnlNodeIdShort src_id, AdnlNodeIdS } void AdnlNetworkManagerImpl::proxy_register(OutDesc &desc) { - auto data = create_serialize_tl_object(0, 0); + auto data = create_serialize_tl_object(0, 0); AdnlProxy::Packet p; p.flags = 6 | (1 << 17); p.ip = 0; @@ -296,4 +296,4 @@ void AdnlNetworkManagerImpl::alarm() { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-network-manager.h b/adnl/adnl-network-manager.h index 67cf602aa..369e33a45 100644 --- a/adnl/adnl-network-manager.h +++ b/adnl/adnl-network-manager.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -32,7 +32,7 @@ namespace td { class UdpServer; } -namespace ton { +namespace ion { namespace adnl { @@ -93,21 +93,21 @@ class AdnlNetworkManager : public td::actor::Actor { } // namespace adnl -} // namespace ton +} // namespace ion namespace td { -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::adnl::AdnlNetworkManager::PrintId &id) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::adnl::AdnlNetworkManager::PrintId &id) { sb << "[networkmanager]"; return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::adnl::AdnlNetworkManager &manager) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::adnl::AdnlNetworkManager &manager) { sb << manager.print_id(); return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::adnl::AdnlNetworkManager *manager) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::adnl::AdnlNetworkManager *manager) { sb << manager->print_id(); return sb; } diff --git a/adnl/adnl-network-manager.hpp b/adnl/adnl-network-manager.hpp index a77be19d6..abfe5aae9 100644 --- a/adnl/adnl-network-manager.hpp +++ b/adnl/adnl-network-manager.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -33,7 +33,7 @@ namespace td { class UdpServer; } -namespace ton { +namespace ion { namespace adnl { @@ -165,16 +165,16 @@ class AdnlNetworkManagerImpl : public AdnlNetworkManager { } // namespace adnl -} // namespace ton +} // namespace ion namespace td { -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::adnl::AdnlNetworkManagerImpl &manager) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::adnl::AdnlNetworkManagerImpl &manager) { sb << manager.print_id(); return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::adnl::AdnlNetworkManagerImpl *manager) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::adnl::AdnlNetworkManagerImpl *manager) { sb << manager->print_id(); return sb; } diff --git a/adnl/adnl-node-id.cpp b/adnl/adnl-node-id.cpp index d3830aead..a4991a018 100644 --- a/adnl/adnl-node-id.cpp +++ b/adnl/adnl-node-id.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "common/util.h" -namespace ton { +namespace ion { namespace adnl { td::Result AdnlNodeIdShort::parse(td::Slice id) { TRY_RESULT(str, td::adnl_id_decode(id)); @@ -32,4 +32,4 @@ std::string AdnlNodeIdShort::serialize() { return adnl_id_encode(hash_.as_slice()).move_as_ok(); } } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-node-id.hpp b/adnl/adnl-node-id.hpp index 2d3ade164..4f656925b 100644 --- a/adnl/adnl-node-id.hpp +++ b/adnl/adnl-node-id.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "keys/keys.hpp" #include "common/io.hpp" -namespace ton { +namespace ion { namespace adnl { @@ -37,7 +37,7 @@ class AdnlNodeIdShort { } explicit AdnlNodeIdShort(td::Bits256 value) : hash_(value) { } - explicit AdnlNodeIdShort(tl_object_ptr obj) : hash_(obj->id_) { + explicit AdnlNodeIdShort(tl_object_ptr obj) : hash_(obj->id_) { } const auto &pubkey_hash() const { @@ -53,8 +53,8 @@ class AdnlNodeIdShort { bool operator<(const AdnlNodeIdShort &with) const { return hash_ < with.hash_; } - tl_object_ptr tl() const { - return create_tl_object(hash_.tl()); + tl_object_ptr tl() const { + return create_tl_object(hash_.tl()); } auto as_slice() { return hash_.as_slice(); @@ -85,7 +85,7 @@ class AdnlNodeIdShort { class AdnlNodeIdFull { private: - explicit AdnlNodeIdFull(const tl_object_ptr &pub) : pub_(pub) { + explicit AdnlNodeIdFull(const tl_object_ptr &pub) : pub_(pub) { } public: @@ -93,7 +93,7 @@ class AdnlNodeIdFull { } explicit AdnlNodeIdFull(PublicKey &&pub) : pub_(std::move(pub)) { } - static td::Result create(const tl_object_ptr &pub) { + static td::Result create(const tl_object_ptr &pub) { return AdnlNodeIdFull{pub}; } AdnlNodeIdFull() { @@ -123,11 +123,11 @@ class AdnlNodeIdFull { } // namespace adnl -} // namespace ton +} // namespace ion namespace td { -inline StringBuilder &operator<<(StringBuilder &stream, const ton::adnl::AdnlNodeIdShort &value) { +inline StringBuilder &operator<<(StringBuilder &stream, const ion::adnl::AdnlNodeIdShort &value) { return stream << value.bits256_value(); } diff --git a/adnl/adnl-node.cpp b/adnl/adnl-node.cpp index 4bf080a89..c2f95d047 100644 --- a/adnl/adnl-node.cpp +++ b/adnl/adnl-node.cpp @@ -1,42 +1,42 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "adnl-node.h" -namespace ton { +namespace ion { namespace adnl { -td::Result AdnlNode::create(const tl_object_ptr &obj) { +td::Result AdnlNode::create(const tl_object_ptr &obj) { TRY_RESULT(id, AdnlNodeIdFull::create(obj->id_)); TRY_RESULT(addr_list, AdnlAddressList::create(std::move(obj->addr_list_))); return AdnlNode{std::move(id), std::move(addr_list)}; } -tl_object_ptr AdnlNodesList::tl() const { - std::vector> vec; +tl_object_ptr AdnlNodesList::tl() const { + std::vector> vec; for (auto &node : nodes_) { vec.emplace_back(node.tl()); } - return create_tl_object(std::move(vec)); + return create_tl_object(std::move(vec)); } -td::Result AdnlNodesList::create(const tl_object_ptr &nodes) { +td::Result AdnlNodesList::create(const tl_object_ptr &nodes) { AdnlNodesList res{}; for (auto &node : nodes->nodes_) { TRY_RESULT(N, AdnlNode::create(node)); @@ -47,4 +47,4 @@ td::Result AdnlNodesList::create(const tl_object_ptr. + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #pragma once -#include "auto/tl/ton_api.h" +#include "auto/tl/ion_api.h" #include "adnl-node-id.hpp" #include "adnl-address-list.h" -namespace ton { +namespace ion { namespace adnl { @@ -36,10 +36,10 @@ class AdnlNode { } AdnlNode(const AdnlNode& from) : pub_(from.pub_), addr_list_(from.addr_list_) { } - static td::Result create(const tl_object_ptr& obj); + static td::Result create(const tl_object_ptr& obj); - tl_object_ptr tl() const { - return create_tl_object(pub_.tl(), addr_list_.tl()); + tl_object_ptr tl() const { + return create_tl_object(pub_.tl(), addr_list_.tl()); } AdnlNodeIdFull pub_id() const { return pub_; @@ -65,10 +65,10 @@ class AdnlNodesList { void push(AdnlNode node) { nodes_.push_back(std::move(node)); } - tl_object_ptr tl() const; - static td::Result create(const tl_object_ptr& nodes); + tl_object_ptr tl() const; + static td::Result create(const tl_object_ptr& nodes); }; } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-packet.cpp b/adnl/adnl-packet.cpp index b12493e77..53c3c29ce 100644 --- a/adnl/adnl-packet.cpp +++ b/adnl/adnl-packet.cpp @@ -1,25 +1,25 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "adnl-packet.h" #include "td/utils/Random.h" -namespace ton { +namespace ion { namespace adnl { @@ -29,7 +29,7 @@ namespace adnl { confirm_seqno:flags.10?long reinit_date:flags.11?int dst_reinit_date:flags.11?int signature:flags.7?bytes rand2:bytes = adnl.PacketContents;*/ -td::Result AdnlPacket::create(tl_object_ptr packet) { +td::Result AdnlPacket::create(tl_object_ptr packet) { AdnlPacket R; R.rand1_ = std::move(packet->rand1_); R.flags_ = packet->flags_; @@ -103,8 +103,8 @@ td::Status AdnlPacket::run_basic_checks() const { return td::Status::OK(); } -tl_object_ptr AdnlPacket::tl() const { - return create_tl_object( +tl_object_ptr AdnlPacket::tl() const { + return create_tl_object( rand1_.clone(), flags_ & ~Flags::f_priority, (flags_ & Flags::f_from) ? from_.tl() : nullptr, (flags_ & Flags::f_from_short) ? from_short_.tl() : nullptr, (flags_ & Flags::f_one_message) ? messages_.one_message() : nullptr, @@ -132,4 +132,4 @@ void AdnlPacket::init_random() { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-packet.h b/adnl/adnl-packet.h index 363a74c23..e25d622e5 100644 --- a/adnl/adnl-packet.h +++ b/adnl/adnl-packet.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "adnl/adnl.h" #include "adnl/adnl-message.h" -namespace ton { +namespace ion { namespace adnl { @@ -72,8 +72,8 @@ class AdnlPacket { public: AdnlPacket() { } - static td::Result create(tl_object_ptr packet); - tl_object_ptr tl() const; + static td::Result create(tl_object_ptr packet); + tl_object_ptr tl() const; td::BufferSlice to_sign() const; td::Status run_basic_checks() const; @@ -217,4 +217,4 @@ class AdnlPacket { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-peer-table.cpp b/adnl/adnl-peer-table.cpp index b8aab5671..fd2295c21 100644 --- a/adnl/adnl-peer-table.cpp +++ b/adnl/adnl-peer-table.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -32,7 +32,7 @@ #include "adnl-ext-client.h" #include "adnl-tunnel.h" -namespace ton { +namespace ion { namespace adnl { @@ -385,13 +385,13 @@ void AdnlPeerTableImpl::get_conn_ip_str(AdnlNodeIdShort l_id, AdnlNodeIdShort p_ td::actor::send_closure(it->second, &AdnlPeer::get_conn_ip_str, l_id, std::move(promise)); } -void AdnlPeerTableImpl::get_stats(bool all, td::Promise> promise) { +void AdnlPeerTableImpl::get_stats(bool all, td::Promise> promise) { class Cb : public td::actor::Actor { public: - explicit Cb(td::Promise> promise) : promise_(std::move(promise)) { + explicit Cb(td::Promise> promise) : promise_(std::move(promise)) { } - void got_local_id_stats(tl_object_ptr local_id) { + void got_local_id_stats(tl_object_ptr local_id) { auto &local_id_stats = local_id_stats_[local_id->short_id_]; if (local_id_stats) { local_id->peers_ = std::move(local_id_stats->peers_); @@ -400,11 +400,11 @@ void AdnlPeerTableImpl::get_stats(bool all, td::Promise> peer_pairs) { + void got_peer_stats(std::vector> peer_pairs) { for (auto &peer_pair : peer_pairs) { auto &local_id_stats = local_id_stats_[peer_pair->local_id_]; if (local_id_stats == nullptr) { - local_id_stats = create_tl_object(); + local_id_stats = create_tl_object(); local_id_stats->short_id_ = peer_pair->local_id_; } local_id_stats->peers_.push_back(std::move(peer_pair)); @@ -420,7 +420,7 @@ void AdnlPeerTableImpl::get_stats(bool all, td::Promise 0); --pending_; if (pending_ == 0) { - auto stats = create_tl_object(); + auto stats = create_tl_object(); stats->timestamp_ = td::Clocks::system(); for (auto &[id, local_id_stats] : local_id_stats_) { stats->local_ids_.push_back(std::move(local_id_stats)); @@ -431,17 +431,17 @@ void AdnlPeerTableImpl::get_stats(bool all, td::Promise> promise_; + td::Promise> promise_; size_t pending_ = 1; - std::map> local_id_stats_; + std::map> local_id_stats_; }; auto callback = td::actor::create_actor("adnlstats", std::move(promise)).release(); for (auto &[id, local_id] : local_ids_) { td::actor::send_closure(callback, &Cb::inc_pending); td::actor::send_closure(local_id.local_id, &AdnlLocalId::get_stats, all, - [id = id, callback](td::Result> R) { + [id = id, callback](td::Result> R) { if (R.is_error()) { VLOG(ADNL_NOTICE) << "failed to get stats for local id " << id << " : " << R.move_as_error(); @@ -455,7 +455,7 @@ void AdnlPeerTableImpl::get_stats(bool all, td::Promise>> R) { + [id = id, callback](td::Result>> R) { if (R.is_error()) { VLOG(ADNL_NOTICE) << "failed to get stats for peer " << id << " : " << R.move_as_error(); td::actor::send_closure(callback, &Cb::dec_pending); @@ -469,4 +469,4 @@ void AdnlPeerTableImpl::get_stats(bool all, td::Promise. + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -29,9 +29,9 @@ #include "adnl-packet.h" -#include "auto/tl/ton_api.h" +#include "auto/tl/ion_api.h" -namespace ton { +namespace ion { namespace adnl { @@ -115,11 +115,11 @@ class AdnlPeerTable : public Adnl { } // namespace adnl -} // namespace ton +} // namespace ion namespace td { -inline td::StringBuilder &operator<<(td::StringBuilder &stream, const ton::adnl::AdnlChannelIdShort &value) { +inline td::StringBuilder &operator<<(td::StringBuilder &stream, const ion::adnl::AdnlChannelIdShort &value) { return stream << value.bits256_value(); } diff --git a/adnl/adnl-peer-table.hpp b/adnl/adnl-peer-table.hpp index 9ad61b653..d82b76bde 100644 --- a/adnl/adnl-peer-table.hpp +++ b/adnl/adnl-peer-table.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -32,7 +32,7 @@ #include "adnl-ext-server.h" #include "adnl-address-list.h" -namespace ton { +namespace ion { namespace adnl { @@ -108,7 +108,7 @@ class AdnlPeerTableImpl : public AdnlPeerTable { td::Promise, AdnlAddress>> promise) override; void get_conn_ip_str(AdnlNodeIdShort l_id, AdnlNodeIdShort p_id, td::Promise promise) override; - void get_stats(bool all, td::Promise> promise) override; + void get_stats(bool all, td::Promise> promise) override; struct PrintId {}; PrintId print_id() const { @@ -154,4 +154,4 @@ inline td::StringBuilder &operator<<(td::StringBuilder &sb, const AdnlPeerTableI } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-peer.cpp b/adnl/adnl-peer.cpp index 7f5c60394..97594453f 100644 --- a/adnl/adnl-peer.cpp +++ b/adnl/adnl-peer.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -25,10 +25,10 @@ #include "td/actor/PromiseFuture.h" #include "td/utils/base64.h" #include "td/utils/Random.h" -#include "auto/tl/ton_api.h" +#include "auto/tl/ion_api.h" #include "td/utils/overloaded.h" -namespace ton { +namespace ion { namespace adnl { @@ -95,7 +95,7 @@ void AdnlPeerPairImpl::discover() { auto pub = AdnlNodeIdFull{k.key().public_key()}; CHECK(pub.compute_short_id() == peer_id); - auto addr_list = fetch_tl_object(k.value().clone(), true); + auto addr_list = fetch_tl_object(k.value().clone(), true); if (addr_list.is_error()) { td::actor::send_closure(SelfId, &AdnlPeerPairImpl::got_data_from_dht, addr_list.move_as_error_prefix("bad dht value: ")); @@ -635,7 +635,7 @@ void AdnlPeerPairImpl::process_message(const adnlmessage::AdnlMessagePart &messa } huge_message_hash_.set_zero(); huge_message_offset_ = 0; - auto MR = fetch_tl_object(std::move(huge_message_), true); + auto MR = fetch_tl_object(std::move(huge_message_), true); if (MR.is_error()) { VLOG(ADNL_WARNING) << this << ": dropping huge message part with bad data"; return; @@ -808,7 +808,7 @@ void AdnlPeerPairImpl::get_conn_ip_str(td::Promise promise) { promise.set_value("undefined"); } -void AdnlPeerPairImpl::get_stats(bool all, td::Promise> promise) { +void AdnlPeerPairImpl::get_stats(bool all, td::Promise> promise) { if (!all) { double threshold = td::Clocks::system() - 600.0; if (last_in_packet_ts_ < threshold && last_out_packet_ts_ < threshold) { @@ -817,12 +817,12 @@ void AdnlPeerPairImpl::get_stats(bool all, td::Promise(); + auto stats = create_tl_object(); stats->local_id_ = local_id_.bits256_value(); stats->peer_id_ = peer_id_short_.bits256_value(); for (const AdnlAddress &addr : addr_list_.addrs()) { - ton_api::downcast_call(*addr->tl(), td::overloaded( - [&](const ton_api::adnl_address_udp &obj) { + ion_api::downcast_call(*addr->tl(), td::overloaded( + [&](const ion_api::adnl_address_udp &obj) { stats->ip_str_ = PSTRING() << td::IPAddress::ipv4_to_str(obj.ip_) << ":" << obj.port_; }, @@ -1001,14 +1001,14 @@ void AdnlPeerImpl::update_addr_list(AdnlNodeIdShort local_id, td::uint32 local_m td::actor::send_closure(it->second, &AdnlPeerPair::update_addr_list, std::move(addr_list)); } -void AdnlPeerImpl::get_stats(bool all, td::Promise>> promise) { +void AdnlPeerImpl::get_stats(bool all, td::Promise>> promise) { class Cb : public td::actor::Actor { public: - explicit Cb(td::Promise>> promise) + explicit Cb(td::Promise>> promise) : promise_(std::move(promise)) { } - void got_peer_pair_stats(tl_object_ptr peer_pair) { + void got_peer_pair_stats(tl_object_ptr peer_pair) { if (peer_pair) { result_.push_back(std::move(peer_pair)); } @@ -1029,9 +1029,9 @@ void AdnlPeerImpl::get_stats(bool all, td::Promise>> promise_; + td::Promise>> promise_; size_t pending_ = 1; - std::vector> result_; + std::vector> result_; }; auto callback = td::actor::create_actor("adnlpeerstats", std::move(promise)).release(); @@ -1039,7 +1039,7 @@ void AdnlPeerImpl::get_stats(bool all, td::Promise> R) { + callback](td::Result> R) { if (R.is_error()) { VLOG(ADNL_NOTICE) << "failed to get stats for peer pair " << peer_id << "->" << local_id << " : " << R.move_as_error(); @@ -1190,12 +1190,12 @@ void AdnlPeerPairImpl::prepare_packet_stats() { } } -tl_object_ptr AdnlPeerPairImpl::PacketStats::tl() const { - return create_tl_object(ts_start, ts_end, in_packets, in_bytes, in_packets_channel, +tl_object_ptr AdnlPeerPairImpl::PacketStats::tl() const { + return create_tl_object(ts_start, ts_end, in_packets, in_bytes, in_packets_channel, in_bytes_channel, out_packets, out_bytes, out_packets_channel, out_bytes_channel, out_expired_messages, out_expired_bytes); } } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-peer.h b/adnl/adnl-peer.h index 1215f71da..d223fc25f 100644 --- a/adnl/adnl-peer.h +++ b/adnl/adnl-peer.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -24,9 +24,9 @@ #include "dht/dht.h" #include "adnl-peer-table.h" #include "utils.hpp" -#include "auto/tl/ton_api.h" +#include "auto/tl/ion_api.h" -namespace ton { +namespace ion { namespace adnl { @@ -59,7 +59,7 @@ class AdnlPeerPair : public td::actor::Actor { virtual void update_peer_id(AdnlNodeIdFull id) = 0; virtual void update_addr_list(AdnlAddressList addr_list) = 0; virtual void get_conn_ip_str(td::Promise promise) = 0; - virtual void get_stats(bool all, td::Promise> promise) = 0; + virtual void get_stats(bool all, td::Promise> promise) = 0; static td::actor::ActorOwn create(td::actor::ActorId network_manager, td::actor::ActorId peer_table, td::uint32 local_mode, @@ -101,9 +101,9 @@ class AdnlPeer : public td::actor::Actor { td::actor::ActorId local_actor, AdnlAddressList addr_list) = 0; virtual void update_dht_node(td::actor::ActorId dht_node) = 0; virtual void get_conn_ip_str(AdnlNodeIdShort l_id, td::Promise promise) = 0; - virtual void get_stats(bool all, td::Promise>> promise) = 0; + virtual void get_stats(bool all, td::Promise>> promise) = 0; }; } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-peer.hpp b/adnl/adnl-peer.hpp index 7db2e2a1d..140879217 100644 --- a/adnl/adnl-peer.hpp +++ b/adnl/adnl-peer.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -34,7 +34,7 @@ #include "utils.hpp" -namespace ton { +namespace ion { namespace adnl { @@ -90,7 +90,7 @@ class AdnlPeerPairImpl : public AdnlPeerPair { void update_peer_id(AdnlNodeIdFull id) override; void get_conn_ip_str(td::Promise promise) override; - void get_stats(bool all, td::Promise> promise) override; + void get_stats(bool all, td::Promise> promise) override; void got_data_from_db(td::Result R); void got_data_from_static_nodes(td::Result R); @@ -277,7 +277,7 @@ class AdnlPeerPairImpl : public AdnlPeerPair { td::uint64 out_packets = 0, out_bytes = 0, out_packets_channel = 0, out_bytes_channel = 0; td::uint64 out_expired_messages = 0, out_expired_bytes = 0; - tl_object_ptr tl() const; + tl_object_ptr tl() const; } packet_stats_cur_, packet_stats_prev_, packet_stats_total_; double last_in_packet_ts_ = 0.0, last_out_packet_ts_ = 0.0; double started_ts_ = td::Clocks::system(); @@ -302,7 +302,7 @@ class AdnlPeerImpl : public AdnlPeer { AdnlAddressList addr_list) override; void update_dht_node(td::actor::ActorId dht_node) override; void get_conn_ip_str(AdnlNodeIdShort l_id, td::Promise promise) override; - void get_stats(bool all, td::Promise>> promise) override; + void get_stats(bool all, td::Promise>> promise) override; //void check_signature(td::BufferSlice data, td::BufferSlice signature, td::Promise promise) override; AdnlPeerImpl(td::actor::ActorId network_manager, td::actor::ActorId peer_table, @@ -329,36 +329,36 @@ class AdnlPeerImpl : public AdnlPeer { } // namespace adnl -} // namespace ton +} // namespace ion namespace td { -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::adnl::AdnlPeerImpl::PrintId &id) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::adnl::AdnlPeerImpl::PrintId &id) { sb << "[peer " << id.peer_id << "]"; return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::adnl::AdnlPeerImpl &peer) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::adnl::AdnlPeerImpl &peer) { sb << peer.print_id(); return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::adnl::AdnlPeerImpl *peer) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::adnl::AdnlPeerImpl *peer) { sb << peer->print_id(); return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::adnl::AdnlPeerPairImpl::PrintId &id) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::adnl::AdnlPeerPairImpl::PrintId &id) { sb << "[peerpair " << id.peer_id << "-" << id.local_id << "]"; return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::adnl::AdnlPeerPairImpl &peer) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::adnl::AdnlPeerPairImpl &peer) { sb << peer.print_id(); return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::adnl::AdnlPeerPairImpl *peer) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::adnl::AdnlPeerPairImpl *peer) { sb << peer->print_id(); return sb; } diff --git a/adnl/adnl-pong.cpp b/adnl/adnl-pong.cpp index 434f0ef7b..0ed2bb79d 100644 --- a/adnl/adnl-pong.cpp +++ b/adnl/adnl-pong.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -38,7 +38,7 @@ #include "common/checksum.h" #include "common/errorcode.h" #include "tl-utils/tl-utils.hpp" -#include "auto/tl/ton_api_json.h" +#include "auto/tl/ion_api_json.h" #include "adnl/adnl.h" #include #include "git.h" @@ -47,7 +47,7 @@ #include #endif -namespace ton { +namespace ion { namespace adnl { @@ -57,9 +57,9 @@ class Callback : public adnl::Adnl::Callback { } void receive_query(AdnlNodeIdShort src, AdnlNodeIdShort dst, td::BufferSlice data, td::Promise promise) override { - TRY_RESULT_PROMISE_PREFIX(promise, f, fetch_tl_object(std::move(data), true), + TRY_RESULT_PROMISE_PREFIX(promise, f, fetch_tl_object(std::move(data), true), "adnl.ping expected"); - promise.set_value(create_serialize_tl_object(f->value_)); + promise.set_value(create_serialize_tl_object(f->value_)); } Callback() { @@ -70,7 +70,7 @@ class Callback : public adnl::Adnl::Callback { } // namespace adnl -} // namespace ton +} // namespace ion std::atomic rotate_logs_flags{false}; void force_rotate_logs(int sig) { @@ -80,7 +80,7 @@ void force_rotate_logs(int sig) { int main(int argc, char *argv[]) { SET_VERBOSITY_LEVEL(verbosity_INFO); - ton::PrivateKey pk; + ion::PrivateKey pk; td::IPAddress addr; td::set_default_failure_signal_handler().ensure(); @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) { td::log_interface = td::default_log_interface; }; - std::string config = "/var/ton-work/etc/adnl-proxy.conf.json"; + std::string config = "/var/ion-work/etc/adnl-proxy.conf.json"; td::OptionParser p; p.set_description("adnl pinger"); @@ -130,17 +130,17 @@ int main(int argc, char *argv[]) { try { v = std::stoi(fname.str()); } catch (...) { - return td::Status::Error(ton::ErrorCode::error, "bad value for --threads: not a number"); + return td::Status::Error(ion::ErrorCode::error, "bad value for --threads: not a number"); } if (v < 1 || v > 256) { - return td::Status::Error(ton::ErrorCode::error, "bad value for --threads: should be in range [1..256]"); + return td::Status::Error(ion::ErrorCode::error, "bad value for --threads: should be in range [1..256]"); } threads = v; return td::Status::OK(); }); p.add_checked_option('u', "user", "change user", [&](td::Slice user) { return td::change_user(user.str()); }); p.add_checked_option('k', "key", "private key", [&](td::Slice key) { - TRY_RESULT_ASSIGN(pk, ton::PrivateKey::import(key)); + TRY_RESULT_ASSIGN(pk, ion::PrivateKey::import(key)); return td::Status::OK(); }); p.add_checked_option('a', "addr", "ip:port of instance", [&](td::Slice key) { @@ -159,37 +159,37 @@ int main(int argc, char *argv[]) { td::actor::Scheduler scheduler({threads}); - td::actor::ActorOwn keyring; - td::actor::ActorOwn adnl; - td::actor::ActorOwn network_manager; + td::actor::ActorOwn keyring; + td::actor::ActorOwn adnl; + td::actor::ActorOwn network_manager; auto pub = pk.compute_public_key(); scheduler.run_in_context([&]() { - keyring = ton::keyring::Keyring::create(""); - td::actor::send_closure(keyring, &ton::keyring::Keyring::add_key, std::move(pk), true, [](td::Unit) {}); + keyring = ion::keyring::Keyring::create(""); + td::actor::send_closure(keyring, &ion::keyring::Keyring::add_key, std::move(pk), true, [](td::Unit) {}); - adnl = ton::adnl::Adnl::create("", keyring.get()); + adnl = ion::adnl::Adnl::create("", keyring.get()); - network_manager = ton::adnl::AdnlNetworkManager::create(static_cast(addr.get_port())); + network_manager = ion::adnl::AdnlNetworkManager::create(static_cast(addr.get_port())); - ton::adnl::AdnlCategoryMask cat_mask; + ion::adnl::AdnlCategoryMask cat_mask; cat_mask[0] = true; - td::actor::send_closure(network_manager, &ton::adnl::AdnlNetworkManager::add_self_addr, addr, std::move(cat_mask), + td::actor::send_closure(network_manager, &ion::adnl::AdnlNetworkManager::add_self_addr, addr, std::move(cat_mask), 0); - auto tladdr = ton::create_tl_object(addr.get_ipv4(), addr.get_port()); - auto addr_vec = std::vector>(); + auto tladdr = ion::create_tl_object(addr.get_ipv4(), addr.get_port()); + auto addr_vec = std::vector>(); addr_vec.push_back(std::move(tladdr)); - auto tladdrlist = ton::create_tl_object( - std::move(addr_vec), ton::adnl::Adnl::adnl_start_time(), ton::adnl::Adnl::adnl_start_time(), 0, 2000000000); - auto addrlist = ton::adnl::AdnlAddressList::create(tladdrlist).move_as_ok(); + auto tladdrlist = ion::create_tl_object( + std::move(addr_vec), ion::adnl::Adnl::adnl_start_time(), ion::adnl::Adnl::adnl_start_time(), 0, 2000000000); + auto addrlist = ion::adnl::AdnlAddressList::create(tladdrlist).move_as_ok(); - td::actor::send_closure(adnl, &ton::adnl::Adnl::add_id, ton::adnl::AdnlNodeIdFull{pub}, std::move(addrlist), + td::actor::send_closure(adnl, &ion::adnl::Adnl::add_id, ion::adnl::AdnlNodeIdFull{pub}, std::move(addrlist), static_cast(0)); - td::actor::send_closure(adnl, &ton::adnl::Adnl::subscribe, ton::adnl::AdnlNodeIdShort{pub.compute_short_id()}, - ton::adnl::Adnl::int_to_bytestring(ton::ton_api::adnl_ping::ID), - std::make_unique()); + td::actor::send_closure(adnl, &ion::adnl::Adnl::subscribe, ion::adnl::AdnlNodeIdShort{pub.compute_short_id()}, + ion::adnl::Adnl::int_to_bytestring(ion::ion_api::adnl_ping::ID), + std::make_unique()); }); while (scheduler.run(1)) { diff --git a/adnl/adnl-proxy-types.cpp b/adnl/adnl-proxy-types.cpp index 8ca2def91..3eadf1e34 100644 --- a/adnl/adnl-proxy-types.cpp +++ b/adnl/adnl-proxy-types.cpp @@ -1,29 +1,29 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "adnl-proxy-types.hpp" #include "tl-utils/tl-utils.hpp" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" #include "td/utils/overloaded.h" #include "td/utils/Time.h" #include "common/errorcode.h" -namespace ton { +namespace ion { namespace adnl { @@ -51,7 +51,7 @@ td::BufferSlice AdnlProxyFast::encrypt(Packet packet) const { packet.date = static_cast(td::Clocks::system()); packet.flags |= 8; } - auto obj = create_tl_object(id_, packet.flags, packet.ip, packet.port, + auto obj = create_tl_object(id_, packet.flags, packet.ip, packet.port, packet.adnl_start_time, packet.seqno, packet.date, td::sha256_bits256(packet.data.as_slice())); char data[64]; @@ -66,7 +66,7 @@ td::BufferSlice AdnlProxyFast::encrypt(Packet packet) const { } td::Result AdnlProxyFast::decrypt(td::BufferSlice packet) const { - TRY_RESULT(obj, fetch_tl_prefix(packet, false)); + TRY_RESULT(obj, fetch_tl_prefix(packet, false)); if (obj->proxy_id_ != id_) { return td::Status::Error(ErrorCode::protoviolation, "bad proxy id"); } @@ -96,12 +96,12 @@ td::Result AdnlProxyFast::decrypt(td::BufferSlice packet) con return std::move(p); } -td::Result> AdnlProxy::create(const ton_api::adnl_Proxy &proxy_type) { +td::Result> AdnlProxy::create(const ion_api::adnl_Proxy &proxy_type) { std::shared_ptr R; - ton_api::downcast_call( - const_cast(proxy_type), - td::overloaded([&](const ton_api::adnl_proxy_none &x) { R = std::make_shared(x.id_); }, - [&](const ton_api::adnl_proxy_fast &x) { + ion_api::downcast_call( + const_cast(proxy_type), + td::overloaded([&](const ion_api::adnl_proxy_none &x) { R = std::make_shared(x.id_); }, + [&](const ion_api::adnl_proxy_fast &x) { R = std::make_shared(x.id_, x.shared_secret_.as_slice()); })); return std::move(R); @@ -109,4 +109,4 @@ td::Result> AdnlProxy::create(const ton_api::adnl_Pro } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-proxy-types.h b/adnl/adnl-proxy-types.h index f18d2dc04..70d365bf9 100644 --- a/adnl/adnl-proxy-types.h +++ b/adnl/adnl-proxy-types.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -20,9 +20,9 @@ #include "td/utils/buffer.h" #include "td/utils/Status.h" -#include "auto/tl/ton_api.h" +#include "auto/tl/ion_api.h" -namespace ton { +namespace ion { namespace adnl { @@ -40,12 +40,12 @@ class AdnlProxy { virtual ~AdnlProxy() = default; virtual td::BufferSlice encrypt(Packet packet) const = 0; virtual td::Result decrypt(td::BufferSlice packet) const = 0; - virtual tl_object_ptr tl() const = 0; + virtual tl_object_ptr tl() const = 0; virtual const td::Bits256 &id() const = 0; - static td::Result> create(const ton_api::adnl_Proxy &proxy_type); + static td::Result> create(const ion_api::adnl_Proxy &proxy_type); }; } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-proxy-types.hpp b/adnl/adnl-proxy-types.hpp index 7b2182880..8ef9b9330 100644 --- a/adnl/adnl-proxy-types.hpp +++ b/adnl/adnl-proxy-types.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -22,7 +22,7 @@ #include "common/checksum.h" -namespace ton { +namespace ion { namespace adnl { @@ -37,8 +37,8 @@ class AdnlProxyNone : public AdnlProxy { return d; } td::Result decrypt(td::BufferSlice packet) const override; - tl_object_ptr tl() const override { - return create_tl_object(id_); + tl_object_ptr tl() const override { + return create_tl_object(id_); } const td::Bits256 &id() const override { return id_; @@ -55,8 +55,8 @@ class AdnlProxyFast : public AdnlProxy { } td::BufferSlice encrypt(Packet packet) const override; td::Result decrypt(td::BufferSlice packet) const override; - tl_object_ptr tl() const override { - return create_tl_object(id_, shared_secret_raw_.clone_as_buffer_slice()); + tl_object_ptr tl() const override { + return create_tl_object(id_, shared_secret_raw_.clone_as_buffer_slice()); } const td::Bits256 &id() const override { return id_; @@ -70,4 +70,4 @@ class AdnlProxyFast : public AdnlProxy { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-proxy.cpp b/adnl/adnl-proxy.cpp index 81ec8dcd0..7b451316c 100644 --- a/adnl/adnl-proxy.cpp +++ b/adnl/adnl-proxy.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -39,7 +39,7 @@ #include "common/checksum.h" #include "common/errorcode.h" #include "tl-utils/tl-utils.hpp" -#include "auto/tl/ton_api_json.h" +#include "auto/tl/ion_api_json.h" #include "adnl-proxy-types.h" #include "adnl-received-mask.h" #include @@ -49,7 +49,7 @@ #include #endif -namespace ton { +namespace ion { namespace adnl { @@ -74,7 +74,7 @@ class Receiver : public td::actor::Actor { private: td::uint16 in_port_; td::uint16 out_port_; - std::shared_ptr proxy_; + std::shared_ptr proxy_; td::IPAddress addr_; td::actor::ActorOwn out_udp_server_; td::actor::ActorOwn in_udp_server_; @@ -166,15 +166,15 @@ void Receiver::receive_from_client(td::IPAddress addr, td::BufferSlice data) { } if (f.flags & (1 << 17)) { - auto F = fetch_tl_object(std::move(f.data), true); + auto F = fetch_tl_object(std::move(f.data), true); if (F.is_error()) { LOG(INFO) << this << ": dropping proxy packet: bad control packet: " << F.move_as_error(); return; } - ton_api::downcast_call(*F.move_as_ok().get(), + ion_api::downcast_call(*F.move_as_ok().get(), td::overloaded( - [&](const ton_api::adnl_proxyControlPacketPing &f) { - auto data = create_serialize_tl_object(f.id_); + [&](const ion_api::adnl_proxyControlPacketPing &f) { + auto data = create_serialize_tl_object(f.id_); AdnlProxy::Packet p; p.flags = 6 | (1 << 16) | (1 << 17); if (addr.is_valid() && addr.is_ipv4()) { @@ -199,8 +199,8 @@ void Receiver::receive_from_client(td::IPAddress addr, td::BufferSlice data) { in_udp_server_.empty() ? out_udp_server_.get() : in_udp_server_.get(), &td::UdpServer::send, std::move(M)); }, - [&](const ton_api::adnl_proxyControlPacketPong &f) {}, - [&](const ton_api::adnl_proxyControlPacketRegister &f) { + [&](const ion_api::adnl_proxyControlPacketPong &f) {}, + [&](const ion_api::adnl_proxyControlPacketRegister &f) { if (f.ip_ == 0 && f.port_ == 0) { if (addr.is_valid() && addr.is_ipv4()) { addr_ = addr; @@ -277,7 +277,7 @@ void Receiver::receive_to_client(td::IPAddress addr, td::BufferSlice data) { } // namespace adnl -} // namespace ton +} // namespace ion std::atomic rotate_logs_flags{false}; void force_rotate_logs(int sig) { @@ -289,16 +289,16 @@ int main(int argc, char *argv[]) { td::set_default_failure_signal_handler().ensure(); - std::vector> x; + std::vector> x; std::unique_ptr logger_; SCOPE_EXIT { td::log_interface = td::default_log_interface; }; - std::string config = "/var/ton-work/etc/adnl-proxy.conf.json"; + std::string config = "/var/ion-work/etc/adnl-proxy.conf.json"; td::OptionParser p; - p.set_description("validator or full node for TON network"); + p.set_description("validator or full node for ION network"); p.add_option('v', "verbosity", "set verbosity level", [&](td::Slice arg) { int v = VERBOSITY_NAME(FATAL) + (td::to_integer(arg)); SET_VERBOSITY_LEVEL(v); @@ -336,10 +336,10 @@ int main(int argc, char *argv[]) { try { v = std::stoi(fname.str()); } catch (...) { - return td::Status::Error(ton::ErrorCode::error, "bad value for --threads: not a number"); + return td::Status::Error(ion::ErrorCode::error, "bad value for --threads: not a number"); } if (v < 1 || v > 256) { - return td::Status::Error(ton::ErrorCode::error, "bad value for --threads: should be in range [1..256]"); + return td::Status::Error(ion::ErrorCode::error, "bad value for --threads: should be in range [1..256]"); } threads = v; return td::Status::OK(); @@ -354,8 +354,8 @@ int main(int argc, char *argv[]) { TRY_RESULT_PREFIX(conf_data, td::read_file(config), "failed to read: "); TRY_RESULT_PREFIX(conf_json, td::json_decode(conf_data.as_slice()), "failed to parse json: "); - ton::ton_api::engine_adnlProxy_config conf; - TRY_STATUS_PREFIX(ton::ton_api::from_json(conf, conf_json.get_object()), "json does not fit TL scheme: "); + ion::ion_api::engine_adnlProxy_config conf; + TRY_STATUS_PREFIX(ion::ion_api::from_json(conf, conf_json.get_object()), "json does not fit TL scheme: "); if (!conf.ports_.size()) { return td::Status::Error("empty config"); @@ -367,14 +367,14 @@ int main(int argc, char *argv[]) { if (!y->proxy_type_) { return td::Status::Error("empty proxy type"); } - TRY_RESULT(proxy, ton::adnl::AdnlProxy::create(*y->proxy_type_.get())); + TRY_RESULT(proxy, ion::adnl::AdnlProxy::create(*y->proxy_type_.get())); td::IPAddress a; if (y->dst_ip_ || y->dst_port_) { a.init_ipv4_port(td::IPAddress::ipv4_to_str(y->dst_ip_), static_cast(y->dst_port_)).ensure(); } scheduler.run_in_context([&] { - x.push_back(td::actor::create_actor("adnl-proxy", in_port, out_port, std::move(proxy), a)); + x.push_back(td::actor::create_actor("adnl-proxy", in_port, out_port, std::move(proxy), a)); }); } diff --git a/adnl/adnl-query.cpp b/adnl/adnl-query.cpp index 89dbbfc49..505deca45 100644 --- a/adnl/adnl-query.cpp +++ b/adnl/adnl-query.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -20,7 +20,7 @@ #include "common/errorcode.h" #include "td/utils/Random.h" -namespace ton { +namespace ion { namespace adnl { @@ -44,4 +44,4 @@ AdnlQueryId AdnlQuery::random_query_id() { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-query.h b/adnl/adnl-query.h index 3db8c754c..1c87858ff 100644 --- a/adnl/adnl-query.h +++ b/adnl/adnl-query.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -25,7 +25,7 @@ #include -namespace ton { +namespace ion { namespace adnl { @@ -69,4 +69,4 @@ class AdnlQuery : public td::actor::Actor { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-received-mask.h b/adnl/adnl-received-mask.h index 0822ae3ef..9be6368b3 100644 --- a/adnl/adnl-received-mask.h +++ b/adnl/adnl-received-mask.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "td/utils/int_types.h" #include "td/utils/logging.h" -namespace ton { +namespace ion { namespace adnl { @@ -99,4 +99,4 @@ class AdnlReceivedMaskVersion { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-static-nodes.cpp b/adnl/adnl-static-nodes.cpp index 251715be8..7a3270a6e 100644 --- a/adnl/adnl-static-nodes.cpp +++ b/adnl/adnl-static-nodes.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "utils.hpp" -namespace ton { +namespace ion { namespace adnl { @@ -52,4 +52,4 @@ td::actor::ActorOwn AdnlStaticNodesManager::create() { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-static-nodes.h b/adnl/adnl-static-nodes.h index 91e3bed0c..b6f1f9d43 100644 --- a/adnl/adnl-static-nodes.h +++ b/adnl/adnl-static-nodes.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,11 +21,11 @@ #include "td/actor/actor.h" #include "td/utils/Status.h" #include "td/actor/PromiseFuture.h" -#include "auto/tl/ton_api.h" +#include "auto/tl/ion_api.h" #include "adnl-peer-table.h" -namespace ton { +namespace ion { namespace adnl { @@ -40,4 +40,4 @@ class AdnlStaticNodesManager : public td::actor::Actor { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-static-nodes.hpp b/adnl/adnl-static-nodes.hpp index 166be5aa1..e9282c56f 100644 --- a/adnl/adnl-static-nodes.hpp +++ b/adnl/adnl-static-nodes.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include #include "adnl-static-nodes.h" -namespace ton { +namespace ion { namespace adnl { @@ -39,4 +39,4 @@ class AdnlStaticNodesManagerImpl : public AdnlStaticNodesManager { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-test-loopback-implementation.cpp b/adnl/adnl-test-loopback-implementation.cpp index c5ef75304..5926c723c 100644 --- a/adnl/adnl-test-loopback-implementation.cpp +++ b/adnl/adnl-test-loopback-implementation.cpp @@ -1,38 +1,38 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "adnl-test-loopback-implementation.h" -namespace ton { +namespace ion { namespace adnl { AdnlAddressList TestLoopbackNetworkManager::generate_dummy_addr_list(bool empty) { - auto obj = ton::create_tl_object(1, 1); - auto objv = std::vector>(); + auto obj = ion::create_tl_object(1, 1); + auto objv = std::vector>(); objv.push_back(std::move(obj)); td::uint32 now = Adnl::adnl_start_time(); - auto addrR = ton::adnl::AdnlAddressList::create( - ton::create_tl_object(std::move(objv), empty ? 0 : now, empty ? 0 : now, 0, 0)); + auto addrR = ion::adnl::AdnlAddressList::create( + ion::create_tl_object(std::move(objv), empty ? 0 : now, empty ? 0 : now, 0, 0)); addrR.ensure(); return addrR.move_as_ok(); } } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-test-loopback-implementation.h b/adnl/adnl-test-loopback-implementation.h index 4773f0539..504969236 100644 --- a/adnl/adnl-test-loopback-implementation.h +++ b/adnl/adnl-test-loopback-implementation.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -23,11 +23,11 @@ #include -namespace ton { +namespace ion { namespace adnl { -class TestLoopbackNetworkManager : public ton::adnl::AdnlNetworkManager { +class TestLoopbackNetworkManager : public ion::adnl::AdnlNetworkManager { public: void install_callback(std::unique_ptr callback) override { CHECK(!callback_); @@ -39,7 +39,7 @@ class TestLoopbackNetworkManager : public ton::adnl::AdnlNetworkManager { void add_proxy_addr(td::IPAddress addr, td::uint16 local_port, std::shared_ptr proxy, AdnlCategoryMask cat_mask, td::uint32 priority) override { } - void send_udp_packet(ton::adnl::AdnlNodeIdShort src_id, ton::adnl::AdnlNodeIdShort dst_id, td::IPAddress dst_addr, + void send_udp_packet(ion::adnl::AdnlNodeIdShort src_id, ion::adnl::AdnlNodeIdShort dst_id, td::IPAddress dst_addr, td::uint32 priority, td::BufferSlice data) override { if (allowed_sources_.count(src_id) == 0 || allowed_destinations_.count(dst_id) == 0) { // just drop @@ -88,4 +88,4 @@ class TestLoopbackNetworkManager : public ton::adnl::AdnlNetworkManager { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-tunnel.cpp b/adnl/adnl-tunnel.cpp index 360196f4e..3bf2ff317 100644 --- a/adnl/adnl-tunnel.cpp +++ b/adnl/adnl-tunnel.cpp @@ -1,25 +1,25 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "adnl-tunnel.h" #include "adnl-peer-table.h" -namespace ton { +namespace ion { namespace adnl { @@ -57,7 +57,7 @@ void AdnlInboundTunnelEndpoint::decrypted_packet(AdnlNodeIdShort src, td::IPAddr td::actor::send_closure(adnl_, &AdnlPeerTable::receive_packet, src_addr, std::move(data)); return; } - auto F = fetch_tl_object(std::move(data), true); + auto F = fetch_tl_object(std::move(data), true); if (F.is_error()) { VLOG(ADNL_INFO) << "dropping tunnel packet: failed to fetch: " << F.move_as_error(); return; @@ -87,7 +87,7 @@ void AdnlInboundTunnelMidpoint::receive_packet(AdnlNodeIdShort src, td::IPAddres if (!encryptor_) { return; } - auto obj = create_tl_object(); + auto obj = create_tl_object(); obj->flags_ = 2; obj->message_ = std::move(datagram); if (src_addr.is_valid() && src_addr.is_ipv4()) { @@ -112,4 +112,4 @@ void AdnlInboundTunnelMidpoint::receive_packet(AdnlNodeIdShort src, td::IPAddres } } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl-tunnel.h b/adnl/adnl-tunnel.h index d7f6a66fa..f5cb03ad7 100644 --- a/adnl/adnl-tunnel.h +++ b/adnl/adnl-tunnel.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -24,7 +24,7 @@ #include -namespace ton { +namespace ion { namespace adnl { @@ -59,7 +59,7 @@ class AdnlInboundTunnelEndpoint : public AdnlInboundTunnelPoint { class AdnlInboundTunnelMidpoint : public AdnlInboundTunnelPoint { public: - AdnlInboundTunnelMidpoint(ton::PublicKey encrypt_via, AdnlNodeIdShort proxy_to, AdnlNodeIdShort proxy_as, + AdnlInboundTunnelMidpoint(ion::PublicKey encrypt_via, AdnlNodeIdShort proxy_to, AdnlNodeIdShort proxy_as, td::actor::ActorId keyring, td::actor::ActorId adnl) : encrypt_via_(std::move(encrypt_via)), proxy_to_(proxy_to), proxy_as_(proxy_as), keyring_(keyring), adnl_(adnl) { } @@ -67,8 +67,8 @@ class AdnlInboundTunnelMidpoint : public AdnlInboundTunnelPoint { void receive_packet(AdnlNodeIdShort src, td::IPAddress src_addr, td::BufferSlice datagram) override; private: - ton::PublicKeyHash encrypt_key_hash_; - ton::PublicKey encrypt_via_; + ion::PublicKeyHash encrypt_key_hash_; + ion::PublicKey encrypt_via_; std::unique_ptr encryptor_; AdnlNodeIdShort proxy_to_; AdnlNodeIdShort proxy_as_; @@ -88,4 +88,4 @@ class AdnlProxyNode : public td::actor::Actor { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/adnl/adnl.h b/adnl/adnl.h index b49581a91..e99a87f28 100644 --- a/adnl/adnl.h +++ b/adnl/adnl.h @@ -1,32 +1,32 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #pragma once #include "td/actor/actor.h" -#include "auto/tl/ton_api.h" +#include "auto/tl/ion_api.h" #include "td/utils/port/IPAddress.h" #include "adnl-node-id.hpp" #include "adnl-node.h" #include "common/errorcode.h" #include "keyring/keyring.h" -namespace ton { +namespace ion { namespace dht { class Dht; @@ -121,7 +121,7 @@ class Adnl : public AdnlSenderInterface { virtual void create_tunnel(AdnlNodeIdShort dst, td::uint32 size, td::Promise, AdnlAddress>> promise) = 0; - virtual void get_stats(bool all, td::Promise> promise) = 0; + virtual void get_stats(bool all, td::Promise> promise) = 0; static td::actor::ActorOwn create(std::string db, td::actor::ActorId keyring); @@ -136,4 +136,4 @@ class Adnl : public AdnlSenderInterface { using Adnl = adnl::Adnl; -} // namespace ton +} // namespace ion diff --git a/adnl/test/adnl-test-ping.cpp b/adnl/test/adnl-test-ping.cpp index 289aa043f..684360b51 100644 --- a/adnl/test/adnl-test-ping.cpp +++ b/adnl/test/adnl-test-ping.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -49,8 +49,8 @@ class AdnlNode : public td::actor::Actor { private: std::vector ping_ids_; - td::actor::ActorOwn network_manager_; - td::actor::ActorOwn peer_table_; + td::actor::ActorOwn network_manager_; + td::actor::ActorOwn peer_table_; td::UInt256 local_id_; bool local_id_set_ = false; @@ -66,12 +66,12 @@ class AdnlNode : public td::actor::Actor { void receive_query(td::UInt256 src, td::UInt256 dst, td::uint64 query_id, td::BufferSlice data) { std::cout << "QUERY " << std::to_string(query_id) << " FROM " << src << " to " << dst << " of size " << std::to_string(data.size()) << "\n"; - td::actor::send_closure(peer_table_, &ton::AdnlPeerTable::answer_query, dst, src, query_id, - ton::create_tl_object()); + td::actor::send_closure(peer_table_, &ion::AdnlPeerTable::answer_query, dst, src, query_id, + ion::create_tl_object()); } - std::unique_ptr make_callback() { - class Callback : public ton::AdnlPeerTable::Callback { + std::unique_ptr make_callback() { + class Callback : public ion::AdnlPeerTable::Callback { public: void receive_message(td::UInt256 src, td::UInt256 dst, td::BufferSlice data) override { td::actor::send_closure(id_, &AdnlNode::receive_message, src, dst, std::move(data)); @@ -94,13 +94,13 @@ class AdnlNode : public td::actor::Actor { alarm_timestamp() = td::Timestamp::in(1); } AdnlNode() { - network_manager_ = ton::AdnlNetworkManager::create(); - peer_table_ = ton::AdnlPeerTable::create(); - td::actor::send_closure(network_manager_, &ton::AdnlNetworkManager::register_peer_table, peer_table_.get()); - td::actor::send_closure(peer_table_, &ton::AdnlPeerTable::register_network_manager, network_manager_.get()); + network_manager_ = ion::AdnlNetworkManager::create(); + peer_table_ = ion::AdnlPeerTable::create(); + td::actor::send_closure(network_manager_, &ion::AdnlNetworkManager::register_peer_table, peer_table_.get()); + td::actor::send_closure(peer_table_, &ion::AdnlPeerTable::register_network_manager, network_manager_.get()); } void listen_udp(td::uint16 port) { - td::actor::send_closure(network_manager_, &ton::AdnlNetworkManager::add_listening_udp_port, "0.0.0.0", port); + td::actor::send_closure(network_manager_, &ion::AdnlNetworkManager::add_listening_udp_port, "0.0.0.0", port); port_ = port; } void set_host(td::IPAddress ip, std::string host) { @@ -111,26 +111,26 @@ class AdnlNode : public td::actor::Actor { std::cout << "send pings to " << id << "\n"; ping_ids_.push_back(id); } - void add_local_id(ton::tl_object_ptr pk_) { - auto pub_ = ton::get_public_key(pk_); - local_id_ = ton::adnl_short_id(pub_); + void add_local_id(ion::tl_object_ptr pk_) { + auto pub_ = ion::get_public_key(pk_); + local_id_ = ion::adnl_short_id(pub_); std::cout << "local_id = '" << local_id_ << "'\n"; - auto x = ton::create_tl_object(ip_, port_); - auto v = std::vector>(); - v.push_back(ton::move_tl_object_as(x)); + auto x = ion::create_tl_object(ip_, port_); + auto v = std::vector>(); + v.push_back(ion::move_tl_object_as(x)); auto y = - ton::create_tl_object(std::move(v), static_cast(td::Time::now())); + ion::create_tl_object(std::move(v), static_cast(td::Time::now())); - LOG(INFO) << "local_addr_list: " << ton::ton_api::to_string(y); - td::actor::send_closure(peer_table_, &ton::AdnlPeerTable::add_id, std::move(pk_), std::move(y)); - td::actor::send_closure(peer_table_, &ton::AdnlPeerTable::subscribe, local_id_, "", make_callback()); + LOG(INFO) << "local_addr_list: " << ion::ion_api::to_string(y); + td::actor::send_closure(peer_table_, &ion::AdnlPeerTable::add_id, std::move(pk_), std::move(y)); + td::actor::send_closure(peer_table_, &ion::AdnlPeerTable::subscribe, local_id_, "", make_callback()); local_id_set_ = true; } - void add_foreign(ton::tl_object_ptr id, - ton::tl_object_ptr addr_list) { - std::cout << ton::adnl_short_id(id) << "\n"; - td::actor::send_closure(peer_table_, &ton::AdnlPeerTable::add_peer, std::move(id), std::move(addr_list)); + void add_foreign(ion::tl_object_ptr id, + ion::tl_object_ptr addr_list) { + std::cout << ion::adnl_short_id(id) << "\n"; + td::actor::send_closure(peer_table_, &ion::AdnlPeerTable::add_peer, std::move(id), std::move(addr_list)); } void alarm() override { @@ -145,8 +145,8 @@ class AdnlNode : public td::actor::Actor { std::cout << "received answer to query\n"; } }); - td::actor::send_closure(peer_table_, &ton::AdnlPeerTable::send_query, local_id_, *it, std::move(P), - td::Timestamp::in(5), ton::create_tl_object()); + td::actor::send_closure(peer_table_, &ion::AdnlPeerTable::send_query, local_id_, *it, std::move(P), + td::Timestamp::in(5), ion::create_tl_object()); } } @@ -193,7 +193,7 @@ int main(int argc, char *argv[]) { }); p.add_option('i', "id", "sets local id", [&](td::Slice id) { td::actor::send_closure(x, &AdnlNode::add_local_id, - ton::create_tl_object(id.str())); + ion::create_tl_object(id.str())); return td::Status::OK(); }); p.add_option('P', "peer", "adds peer id@host:port", [&](td::Slice id) { @@ -202,21 +202,21 @@ int main(int argc, char *argv[]) { return td::Status::Error("--peer expected randomtag@host:port as argument"); } auto s1 = id.substr(0, pos); - auto f_id = ton::create_tl_object(s1.str()); + auto f_id = ion::create_tl_object(s1.str()); td::IPAddress addr; auto R = addr.init_host_port(td::CSlice(id.substr(pos + 1).str())); if (R.is_error()) { return R.move_as_error(); } - auto f_addr = ton::create_tl_object(addr.get_ipv4(), addr.get_port()); - std::vector> vv; - vv.push_back(ton::move_tl_object_as(f_addr)); + auto f_addr = ion::create_tl_object(addr.get_ipv4(), addr.get_port()); + std::vector> vv; + vv.push_back(ion::move_tl_object_as(f_addr)); auto f_addr_list = - ton::create_tl_object(std::move(vv), static_cast(td::Time::now())); + ion::create_tl_object(std::move(vv), static_cast(td::Time::now())); - td::actor::send_closure(x, &AdnlNode::add_foreign, ton::move_tl_object_as(f_id), + td::actor::send_closure(x, &AdnlNode::add_foreign, ion::move_tl_object_as(f_id), std::move(f_addr_list)); return td::Status::OK(); diff --git a/adnl/utils.cpp b/adnl/utils.cpp index cb05f3969..f68ef1404 100644 --- a/adnl/utils.cpp +++ b/adnl/utils.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "td/utils/format.h" #include "td/utils/Random.h" #include "keys/encryptor.h" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" #include "adnl-node-id.hpp" -namespace ton {} // namespace ton +namespace ion {} // namespace ion diff --git a/adnl/utils.hpp b/adnl/utils.hpp index 18d3f2074..18bab4015 100644 --- a/adnl/utils.hpp +++ b/adnl/utils.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -32,7 +32,7 @@ #include "adnl-node.h" #include "adnl-address-list.hpp" -namespace ton { +namespace ion { namespace adnl { @@ -76,4 +76,4 @@ class RateLimiter { } // namespace adnl -} // namespace ton +} // namespace ion diff --git a/assembly/android/build-android-tonlib.sh b/assembly/android/build-android-tonlib.sh index e470f6022..5812c59dc 100644 --- a/assembly/android/build-android-tonlib.sh +++ b/assembly/android/build-android-tonlib.sh @@ -29,13 +29,13 @@ export NDK_PLATFORM="android-21" export ANDROID_PLATFORM="android-21" export OPENSSL_DIR=$(pwd)/example/android/third_party/crypto -rm -rf example/android/src/drinkless/org/ton/TonApi.java +rm -rf example/android/src/drinkless/org/ion/TonApi.java cd example/android/ rm CMakeCache.txt .ninja_* -cmake -GNinja -DTON_ONLY_TONLIB=ON . +cmake -GNinja -DION_ONLY_TONLIB=ON . -test $? -eq 0 || { echo "Can't configure TON"; exit 1; } +test $? -eq 0 || { echo "Can't configure ION"; exit 1; } ninja prepare_cross_compiling @@ -50,6 +50,6 @@ find . -name "*.debug" -type f -delete if [ "$with_artifacts" = true ]; then cd ../.. mkdir -p artifacts/tonlib-android-jni - cp example/android/src/drinkless/org/ton/TonApi.java artifacts/tonlib-android-jni/ + cp example/android/src/drinkless/org/ion/TonApi.java artifacts/tonlib-android-jni/ cp -R example/android/libs/* artifacts/tonlib-android-jni/ fi diff --git a/assembly/cicd/jenkins/test-builds.groovy b/assembly/cicd/jenkins/test-builds.groovy index 0b5ab7a38..54d9f5a5b 100644 --- a/assembly/cicd/jenkins/test-builds.groovy +++ b/assembly/cicd/jenkins/test-builds.groovy @@ -17,9 +17,9 @@ pipeline { ''' sh ''' cd artifacts - zip -9r ton-x86_64-linux-shared ./* + zip -9r ion-x86_64-linux-shared ./* ''' - archiveArtifacts artifacts: 'artifacts/ton-x86_64-linux-shared.zip' + archiveArtifacts artifacts: 'artifacts/ion-x86_64-linux-shared.zip' } } } @@ -36,9 +36,9 @@ pipeline { ''' sh ''' cd artifacts - zip -9r ton-x86-64-linux-portable ./* + zip -9r ion-x86-64-linux-portable ./* ''' - archiveArtifacts artifacts: 'artifacts/ton-x86-64-linux-portable.zip' + archiveArtifacts artifacts: 'artifacts/ion-x86-64-linux-portable.zip' } } } @@ -55,9 +55,9 @@ pipeline { ''' sh ''' cd artifacts - zip -9r ton-arm64-linux-shared ./* + zip -9r ion-arm64-linux-shared ./* ''' - archiveArtifacts artifacts: 'artifacts/ton-arm64-linux-shared.zip' + archiveArtifacts artifacts: 'artifacts/ion-arm64-linux-shared.zip' } } } @@ -74,9 +74,9 @@ pipeline { ''' sh ''' cd artifacts - zip -9r ton-arm64-linux-portable ./* + zip -9r ion-arm64-linux-portable ./* ''' - archiveArtifacts artifacts: 'artifacts/ton-arm64-linux-portable.zip' + archiveArtifacts artifacts: 'artifacts/ion-arm64-linux-portable.zip' } } } @@ -93,9 +93,9 @@ pipeline { ''' sh ''' cd artifacts - zip -9r ton-x86-64-macos-shared ./* + zip -9r ion-x86-64-macos-shared ./* ''' - archiveArtifacts artifacts: 'artifacts/ton-x86-64-macos-shared.zip' + archiveArtifacts artifacts: 'artifacts/ion-x86-64-macos-shared.zip' } } } @@ -112,9 +112,9 @@ pipeline { ''' sh ''' cd artifacts - zip -9r ton-x86-64-macos-portable ./* + zip -9r ion-x86-64-macos-portable ./* ''' - archiveArtifacts artifacts: 'artifacts/ton-x86-64-macos-portable.zip' + archiveArtifacts artifacts: 'artifacts/ion-x86-64-macos-portable.zip' } } } @@ -131,9 +131,9 @@ pipeline { ''' sh ''' cd artifacts - zip -9r ton-arm64-macos-m1-shared ./* + zip -9r ion-arm64-macos-m1-shared ./* ''' - archiveArtifacts artifacts: 'artifacts/ton-arm64-macos-m1-shared.zip' + archiveArtifacts artifacts: 'artifacts/ion-arm64-macos-m1-shared.zip' } } } @@ -150,9 +150,9 @@ pipeline { ''' sh ''' cd artifacts - zip -9r ton-arm64-macos-portable ./* + zip -9r ion-arm64-macos-portable ./* ''' - archiveArtifacts artifacts: 'artifacts/ton-arm64-macos-portable.zip' + archiveArtifacts artifacts: 'artifacts/ion-arm64-macos-portable.zip' } } } @@ -169,9 +169,9 @@ pipeline { ''' sh ''' cd artifacts - zip -9r ton-arm64-macos-m2-shared ./* + zip -9r ion-arm64-macos-m2-shared ./* ''' - archiveArtifacts artifacts: 'artifacts/ton-arm64-macos-m2-shared.zip' + archiveArtifacts artifacts: 'artifacts/ion-arm64-macos-m2-shared.zip' } } } @@ -187,9 +187,9 @@ pipeline { ''' bat ''' cd artifacts - zip -9r ton-x86-64-windows ./* + zip -9r ion-x86-64-windows ./* ''' - archiveArtifacts artifacts: 'artifacts/ton-x86-64-windows.zip' + archiveArtifacts artifacts: 'artifacts/ion-x86-64-windows.zip' } } } @@ -206,9 +206,9 @@ pipeline { ''' sh ''' cd artifacts/tonlib-android-jni - zip -9r ton-android-tonlib ./* + zip -9r ion-android-tonlib ./* ''' - archiveArtifacts artifacts: 'artifacts/tonlib-android-jni/ton-android-tonlib.zip' + archiveArtifacts artifacts: 'artifacts/tonlib-android-jni/ion-android-tonlib.zip' } } } @@ -225,9 +225,9 @@ pipeline { ''' sh ''' cd artifacts - zip -9r ton-wasm-binaries ./* + zip -9r ion-wasm-binaries ./* ''' - archiveArtifacts artifacts: 'artifacts/ton-wasm-binaries.zip' + archiveArtifacts artifacts: 'artifacts/ion-wasm-binaries.zip' } } } diff --git a/assembly/native/build-macos-portable.sh b/assembly/native/build-macos-portable.sh index af82b2c01..736e95e29 100644 --- a/assembly/native/build-macos-portable.sh +++ b/assembly/native/build-macos-portable.sh @@ -149,7 +149,7 @@ cmake -GNinja .. \ -DLZ4_LIBRARIES=$lz4Path/lib/liblz4.a -test $? -eq 0 || { echo "Can't configure ton"; exit 1; } +test $? -eq 0 || { echo "Can't configure ion"; exit 1; } if [ "$with_tests" = true ]; then ninja storage-daemon storage-daemon-cli blockchain-explorer \ @@ -159,13 +159,13 @@ if [ "$with_tests" = true ]; then test-ed25519 test-ed25519-crypto test-bigint test-vm test-fift test-cells test-smartcont \ test-net test-tdactor test-tdutils test-tonlib-offline test-adnl test-dht test-rldp \ test-rldp2 test-catchain test-fec test-tddb test-db test-validator-session-state test-emulator - test $? -eq 0 || { echo "Can't compile ton"; exit 1; } + test $? -eq 0 || { echo "Can't compile ion"; exit 1; } else ninja storage-daemon storage-daemon-cli blockchain-explorer \ tonlib tonlibjson tonlib-cli validator-engine func tolk fift \ lite-client pow-miner validator-engine-console generate-random-id json2tlo dht-server \ http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork tlbc emulator - test $? -eq 0 || { echo "Can't compile ton"; exit 1; } + test $? -eq 0 || { echo "Can't compile ion"; exit 1; } fi strip -s storage/storage-daemon/storage-daemon diff --git a/assembly/native/build-macos-shared.sh b/assembly/native/build-macos-shared.sh index 8a7399aa9..b373abc1b 100644 --- a/assembly/native/build-macos-shared.sh +++ b/assembly/native/build-macos-shared.sh @@ -77,7 +77,7 @@ cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. \ -DLZ4_LIBRARIES=$lz4Path/lib/liblz4.a \ -DLZ4_INCLUDE_DIRS=$lz4Path/lib -test $? -eq 0 || { echo "Can't configure ton"; exit 1; } +test $? -eq 0 || { echo "Can't configure ion"; exit 1; } if [ "$with_tests" = true ]; then ninja storage-daemon storage-daemon-cli blockchain-explorer \ @@ -87,13 +87,13 @@ if [ "$with_tests" = true ]; then test-ed25519 test-ed25519-crypto test-bigint test-vm test-fift test-cells test-smartcont \ test-net test-tdactor test-tdutils test-tonlib-offline test-adnl test-dht test-rldp \ test-rldp2 test-catchain test-fec test-tddb test-db test-validator-session-state test-emulator - test $? -eq 0 || { echo "Can't compile ton"; exit 1; } + test $? -eq 0 || { echo "Can't compile ion"; exit 1; } else ninja storage-daemon storage-daemon-cli blockchain-explorer \ tonlib tonlibjson tonlib-cli validator-engine func tolk fift \ lite-client pow-miner validator-engine-console generate-random-id json2tlo dht-server \ http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork tlbc emulator - test $? -eq 0 || { echo "Can't compile ton"; exit 1; } + test $? -eq 0 || { echo "Can't compile ion"; exit 1; } fi diff --git a/assembly/native/build-ubuntu-portable.sh b/assembly/native/build-ubuntu-portable.sh index 8ae977e0b..a4e2464c1 100644 --- a/assembly/native/build-ubuntu-portable.sh +++ b/assembly/native/build-ubuntu-portable.sh @@ -141,7 +141,7 @@ cmake -GNinja .. \ -test $? -eq 0 || { echo "Can't configure ton"; exit 1; } +test $? -eq 0 || { echo "Can't configure ion"; exit 1; } if [ "$with_tests" = true ]; then ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \ @@ -151,13 +151,13 @@ ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib- test-vm test-fift test-cells test-smartcont test-net test-tdactor test-tdutils \ test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain \ test-fec test-tddb test-db test-validator-session-state test-emulator - test $? -eq 0 || { echo "Can't compile ton"; exit 1; } + test $? -eq 0 || { echo "Can't compile ion"; exit 1; } else ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \ validator-engine lite-client pow-miner validator-engine-console blockchain-explorer \ generate-random-id json2tlo dht-server http-proxy rldp-http-proxy \ adnl-proxy create-state emulator - test $? -eq 0 || { echo "Can't compile ton"; exit 1; } + test $? -eq 0 || { echo "Can't compile ion"; exit 1; } fi strip -s storage/storage-daemon/storage-daemon \ diff --git a/assembly/native/build-ubuntu-shared.sh b/assembly/native/build-ubuntu-shared.sh index 6b1841cdf..228aec546 100644 --- a/assembly/native/build-ubuntu-shared.sh +++ b/assembly/native/build-ubuntu-shared.sh @@ -42,14 +42,14 @@ else echo "Using compiled openssl_3" fi -cmake -GNinja -DTON_USE_JEMALLOC=ON .. \ +cmake -GNinja -DION_USE_JEMALLOC=ON .. \ -DCMAKE_BUILD_TYPE=Release \ -DOPENSSL_ROOT_DIR=$opensslPath \ -DOPENSSL_INCLUDE_DIR=$opensslPath/include \ -DOPENSSL_CRYPTO_LIBRARY=$opensslPath/libcrypto.so -test $? -eq 0 || { echo "Can't configure ton"; exit 1; } +test $? -eq 0 || { echo "Can't configure ion"; exit 1; } if [ "$with_tests" = true ]; then ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \ @@ -59,13 +59,13 @@ ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib- test-vm test-fift test-cells test-smartcont test-net test-tdactor test-tdutils \ test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain \ test-fec test-tddb test-db test-validator-session-state test-emulator - test $? -eq 0 || { echo "Can't compile ton"; exit 1; } + test $? -eq 0 || { echo "Can't compile ion"; exit 1; } else ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \ validator-engine lite-client pow-miner validator-engine-console blockchain-explorer \ generate-random-id json2tlo dht-server http-proxy rldp-http-proxy \ adnl-proxy create-state emulator - test $? -eq 0 || { echo "Can't compile ton"; exit 1; } + test $? -eq 0 || { echo "Can't compile ion"; exit 1; } fi strip -s storage/storage-daemon/storage-daemon \ diff --git a/assembly/native/build-windows-2019.bat b/assembly/native/build-windows-2019.bat index fdfb6bcf6..45ad513d7 100644 --- a/assembly/native/build-windows-2019.bat +++ b/assembly/native/build-windows-2019.bat @@ -150,7 +150,7 @@ cmake -GNinja -DCMAKE_BUILD_TYPE=Release ^ -DREADLINE_LIBRARY=%root%\readline-5.0-1-lib\lib\readline.lib ^ -DCMAKE_CXX_FLAGS="/DTD_WINDOWS=1 /EHsc /bigobj" .. IF %errorlevel% NEQ 0 ( - echo Can't configure TON + echo Can't configure ION exit /b %errorlevel% ) @@ -162,7 +162,7 @@ test-ed25519 test-ed25519-crypto test-bigint test-vm test-fift test-cells test-s test-tdactor test-tdutils test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain ^ test-fec test-tddb test-db test-validator-session-state test-emulator IF %errorlevel% NEQ 0 ( - echo Can't compile TON + echo Can't compile ION exit /b %errorlevel% ) ) else ( @@ -170,7 +170,7 @@ ninja storage-daemon storage-daemon-cli blockchain-explorer fift func tolk tonli tonlib-cli validator-engine lite-client pow-miner validator-engine-console generate-random-id ^ json2tlo dht-server http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork emulator IF %errorlevel% NEQ 0 ( - echo Can't compile TON + echo Can't compile ION exit /b %errorlevel% ) ) diff --git a/assembly/native/build-windows.bat b/assembly/native/build-windows.bat index e1ce9e473..fbd5d566a 100644 --- a/assembly/native/build-windows.bat +++ b/assembly/native/build-windows.bat @@ -151,7 +151,7 @@ cmake -GNinja -DCMAKE_BUILD_TYPE=Release ^ -DREADLINE_LIBRARY=%root%\readline-5.0-1-lib\lib\readline.lib ^ -DCMAKE_CXX_FLAGS="/DTD_WINDOWS=1 /EHsc /bigobj" .. IF %errorlevel% NEQ 0 ( - echo Can't configure TON + echo Can't configure ION exit /b %errorlevel% ) @@ -163,7 +163,7 @@ test-ed25519 test-ed25519-crypto test-bigint test-vm test-fift test-cells test-s test-tdactor test-tdutils test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain ^ test-fec test-tddb test-db test-validator-session-state test-emulator IF %errorlevel% NEQ 0 ( - echo Can't compile TON + echo Can't compile ION exit /b %errorlevel% ) ) else ( @@ -171,7 +171,7 @@ ninja storage-daemon storage-daemon-cli blockchain-explorer fift func tolk tonli tonlib-cli validator-engine lite-client pow-miner validator-engine-console generate-random-id ^ json2tlo dht-server http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork emulator IF %errorlevel% NEQ 0 ( - echo Can't compile TON + echo Can't compile ION exit /b %errorlevel% ) ) diff --git a/assembly/nix/build-linux-arm64-nix.sh b/assembly/nix/build-linux-arm64-nix.sh index 565b1d253..5222aa814 100644 --- a/assembly/nix/build-linux-arm64-nix.sh +++ b/assembly/nix/build-linux-arm64-nix.sh @@ -34,7 +34,7 @@ nix-build linux-arm64-tonlib.nix cp ./result/lib/libtonlibjson.so.0.5 artifacts/libtonlibjson.so cp ./result/lib/libemulator.so artifacts/ cp ./result/lib/fift/* artifacts/lib/ -cp -r ./result/share/ton/smartcont artifacts/ +cp -r ./result/share/ion/smartcont artifacts/ chmod -R +x artifacts cd artifacts sudo strip -s storage-daemon \ diff --git a/assembly/nix/build-linux-x86-64-nix.sh b/assembly/nix/build-linux-x86-64-nix.sh index e6a3aef07..e1247f0ba 100644 --- a/assembly/nix/build-linux-x86-64-nix.sh +++ b/assembly/nix/build-linux-x86-64-nix.sh @@ -34,7 +34,7 @@ nix-build linux-x86-64-tonlib.nix cp ./result/lib/libtonlibjson.so.0.5 artifacts/libtonlibjson.so cp ./result/lib/libemulator.so artifacts/ cp ./result/lib/fift/* artifacts/lib/ -cp -r ./result/share/ton/smartcont artifacts/ +cp -r ./result/share/ion/smartcont artifacts/ chmod -R +x artifacts cd artifacts sudo strip -s storage-daemon \ diff --git a/assembly/nix/build-macos-nix.sh b/assembly/nix/build-macos-nix.sh index 0ada59a4a..462be7a66 100644 --- a/assembly/nix/build-macos-nix.sh +++ b/assembly/nix/build-macos-nix.sh @@ -34,7 +34,7 @@ nix-build macos-tonlib.nix cp ./result/lib/libtonlibjson.dylib artifacts/ cp ./result/lib/libemulator.dylib artifacts/ cp ./result/lib/fift/* artifacts/lib/ -cp -r ./result/share/ton/smartcont artifacts/ +cp -r ./result/share/ion/smartcont artifacts/ chmod -R +x artifacts cd artifacts sudo strip -xSX storage-daemon \ diff --git a/assembly/nix/flakes/flake.nix b/assembly/nix/flakes/flake.nix index 4e993ac5d..41ad3d117 100644 --- a/assembly/nix/flakes/flake.nix +++ b/assembly/nix/flakes/flake.nix @@ -11,11 +11,11 @@ outputs = { self, nixpkgs-stable, nixpkgs-trunk, flake-compat, flake-utils }: let - ton = { host, pkgs ? host, stdenv ? pkgs.stdenv, staticGlibc ? false + ion = { host, pkgs ? host, stdenv ? pkgs.stdenv, staticGlibc ? false , staticMusl ? false, staticExternalDeps ? staticGlibc }: with host.lib; stdenv.mkDerivation { - pname = "ton"; + pname = "ion"; version = "dev"; src = ./.; @@ -45,7 +45,7 @@ dontAddStaticConfigureFlags = stdenv.isDarwin; - cmakeFlags = [ "-DTON_USE_ABSEIL=OFF" "-DNIX=ON" ] ++ optionals staticMusl [ + cmakeFlags = [ "-DION_USE_ABSEIL=OFF" "-DNIX=ON" ] ++ optionals staticMusl [ "-DCMAKE_CROSSCOMPILING=OFF" # pkgsStatic sets cross ] ++ optionals (staticGlibc || staticMusl) [ "-DCMAKE_LINK_SEARCH_START_STATIC=ON" @@ -110,49 +110,49 @@ in (host.overrideCC host.stdenv cc); in rec { packages = rec { - ton-normal = ton { inherit host; }; - ton-static = ton { + ion-normal = ion { inherit host; }; + ion-static = ion { inherit host; stdenv = host.makeStatic host.stdenv; staticGlibc = true; }; - ton-musl = + ion-musl = let pkgs = nixpkgs-stable.legacyPackages.${system}.pkgsStatic; - in ton { + in ion { inherit host; inherit pkgs; stdenv = pkgs.gcc12Stdenv; # doesn't build on aarch64-linux w/default GCC 9 staticMusl = true; }; - ton-oldglibc = (ton { + ion-oldglibc = (ion { inherit host; stdenv = stdenv227; staticExternalDeps = true; }); - ton-oldglibc_staticbinaries = host.symlinkJoin { - name = "ton"; - paths = [ ton-musl.bin ton-oldglibc.out ]; + ion-oldglibc_staticbinaries = host.symlinkJoin { + name = "ion"; + paths = [ ion-musl.bin ion-oldglibc.out ]; }; }; devShells.default = - host.mkShell { inputsFrom = [ packages.ton-normal ]; }; + host.mkShell { inputsFrom = [ packages.ion-normal ]; }; })) (eachSystem (with system; [ x86_64-darwin aarch64-darwin ]) (system: let host = hostPkgs system; in rec { packages = rec { - ton-normal = ton { inherit host; }; - ton-static = ton { + ion-normal = ion { inherit host; }; + ion-static = ion { inherit host; stdenv = host.makeStatic host.stdenv; staticExternalDeps = true; }; - ton-staticbin-dylib = host.symlinkJoin { - name = "ton"; - paths = [ ton-static.bin ton-static.out ]; + ion-staticbin-dylib = host.symlinkJoin { + name = "ion"; + paths = [ ion-static.bin ion-static.out ]; }; }; devShells.default = - host.mkShell { inputsFrom = [ packages.ton-normal ]; }; + host.mkShell { inputsFrom = [ packages.ion-normal ]; }; }))); } \ No newline at end of file diff --git a/assembly/nix/linux-arm64-static.nix b/assembly/nix/linux-arm64-static.nix index 536152d26..8ba59f99f 100644 --- a/assembly/nix/linux-arm64-static.nix +++ b/assembly/nix/linux-arm64-static.nix @@ -24,7 +24,7 @@ let in stdenv.mkDerivation { - pname = "ton"; + pname = "ion"; version = "dev-bin"; src = ./.; @@ -45,12 +45,12 @@ stdenv.mkDerivation { ]; cmakeFlags = [ - "-DTON_USE_ABSEIL=OFF" + "-DION_USE_ABSEIL=OFF" "-DNIX=ON" "-DBUILD_SHARED_LIBS=OFF" "-DCMAKE_LINK_SEARCH_START_STATIC=ON" "-DCMAKE_LINK_SEARCH_END_STATIC=ON" - "-DTON_USE_JEMALLOC=ON" + "-DION_USE_JEMALLOC=ON" ]; makeStatic = true; diff --git a/assembly/nix/linux-arm64-tonlib.nix b/assembly/nix/linux-arm64-tonlib.nix index 9d251e020..1fd2aead5 100644 --- a/assembly/nix/linux-arm64-tonlib.nix +++ b/assembly/nix/linux-arm64-tonlib.nix @@ -21,7 +21,7 @@ let }); in pkgs.llvmPackages_16.stdenv.mkDerivation { - pname = "ton"; + pname = "ion"; version = "dev-lib"; src = ./.; @@ -46,9 +46,9 @@ pkgs.llvmPackages_16.stdenv.mkDerivation { doInstallCheck = false; cmakeFlags = [ - "-DTON_USE_ABSEIL=ON" + "-DION_USE_ABSEIL=ON" "-DNIX=ON" - "-DTON_ONLY_TONLIB=ON" + "-DION_ONLY_TONLIB=ON" ]; LDFLAGS = [ diff --git a/assembly/nix/linux-x86-64-static.nix b/assembly/nix/linux-x86-64-static.nix index a96a9e867..9bbb992aa 100644 --- a/assembly/nix/linux-x86-64-static.nix +++ b/assembly/nix/linux-x86-64-static.nix @@ -24,7 +24,7 @@ let in stdenv.mkDerivation { - pname = "ton"; + pname = "ion"; version = "dev-bin"; src = ./.; @@ -45,12 +45,12 @@ stdenv.mkDerivation { ]; cmakeFlags = [ - "-DTON_USE_ABSEIL=OFF" + "-DION_USE_ABSEIL=OFF" "-DNIX=ON" "-DBUILD_SHARED_LIBS=OFF" "-DCMAKE_LINK_SEARCH_START_STATIC=ON" "-DCMAKE_LINK_SEARCH_END_STATIC=ON" - "-DTON_USE_JEMALLOC=ON" + "-DION_USE_JEMALLOC=ON" ]; makeStatic = true; diff --git a/assembly/nix/linux-x86-64-tonlib.nix b/assembly/nix/linux-x86-64-tonlib.nix index 64ceaaea2..4503135e3 100644 --- a/assembly/nix/linux-x86-64-tonlib.nix +++ b/assembly/nix/linux-x86-64-tonlib.nix @@ -39,7 +39,7 @@ let in stdenv227.mkDerivation { - pname = "ton"; + pname = "ion"; version = "dev-lib"; src = ./.; @@ -62,9 +62,9 @@ stdenv227.mkDerivation { doInstallCheck = false; cmakeFlags = [ - "-DTON_USE_ABSEIL=ON" + "-DION_USE_ABSEIL=ON" "-DNIX=ON" - "-DTON_ONLY_TONLIB=ON" + "-DION_ONLY_TONLIB=ON" ]; LDFLAGS = [ diff --git a/assembly/nix/macos-static.nix b/assembly/nix/macos-static.nix index 2fd0b3a66..21d535ea4 100644 --- a/assembly/nix/macos-static.nix +++ b/assembly/nix/macos-static.nix @@ -7,7 +7,7 @@ }: pkgs.llvmPackages_14.stdenv.mkDerivation { - pname = "ton"; + pname = "ion"; version = "dev-bin"; src = ./.; @@ -36,9 +36,9 @@ pkgs.llvmPackages_14.stdenv.mkDerivation { configureFlags = []; cmakeFlags = [ - "-DTON_USE_ABSEIL=OFF" + "-DION_USE_ABSEIL=OFF" "-DNIX=ON" - "-DTON_USE_JEMALLOC=ON" + "-DION_USE_JEMALLOC=ON" "-DCMAKE_CROSSCOMPILING=OFF" "-DCMAKE_LINK_SEARCH_START_STATIC=ON" "-DCMAKE_LINK_SEARCH_END_STATIC=ON" diff --git a/assembly/nix/macos-tonlib.nix b/assembly/nix/macos-tonlib.nix index 4f7b7620a..46c65c393 100644 --- a/assembly/nix/macos-tonlib.nix +++ b/assembly/nix/macos-tonlib.nix @@ -6,7 +6,7 @@ }: pkgs.llvmPackages_14.stdenv.mkDerivation { - pname = "ton"; + pname = "ion"; version = "dev-lib"; src = ./.; @@ -31,7 +31,7 @@ pkgs.llvmPackages_14.stdenv.mkDerivation { configureFlags = []; cmakeFlags = [ - "-DTON_USE_ABSEIL=OFF" + "-DION_USE_ABSEIL=OFF" "-DNIX=ON" "-DCMAKE_CXX_FLAGS=-stdlib=libc++" "-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=11.3" diff --git a/assembly/wasm/fift-func-wasm-build-ubuntu.sh b/assembly/wasm/fift-func-wasm-build-ubuntu.sh index 2d3507b23..e45ea3e6a 100644 --- a/assembly/wasm/fift-func-wasm-build-ubuntu.sh +++ b/assembly/wasm/fift-func-wasm-build-ubuntu.sh @@ -26,7 +26,7 @@ export CCACHE_DISABLE=1 echo `pwd` if [ "$scratch_new" = true ]; then - echo Compiling openssl zlib lz4 emsdk secp256k1 libsodium emsdk ton + echo Compiling openssl zlib lz4 emsdk secp256k1 libsodium emsdk ion rm -rf openssl zlib lz4 emsdk secp256k1 libsodium build fi @@ -52,9 +52,9 @@ if [ ! -d "build" ]; then -DOPENSSL_FOUND=1 \ -DOPENSSL_INCLUDE_DIR=$OPENSSL_DIR/include \ -DOPENSSL_CRYPTO_LIBRARY=$OPENSSL_DIR/libcrypto.so \ - -DTON_USE_ABSEIL=OFF .. + -DION_USE_ABSEIL=OFF .. - test $? -eq 0 || { echo "Can't configure TON build"; exit 1; } + test $? -eq 0 || { echo "Can't configure ION build"; exit 1; } ninja fift smc-envelope test $? -eq 0 || { echo "Can't compile fift "; exit 1; } rm -rf * @@ -174,12 +174,12 @@ emcmake cmake -DUSE_EMSCRIPTEN=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAK -DSODIUM_LIBRARY_RELEASE=$SODIUM_DIR/src/libsodium/.libs/libsodium.a \ .. -test $? -eq 0 || { echo "Can't configure TON with emmake "; exit 1; } +test $? -eq 0 || { echo "Can't configure ION with emmake "; exit 1; } cp -R ../crypto/smartcont ../crypto/fift/lib crypto emmake make -j16 funcfiftlib func fift tlbc emulator-emscripten -test $? -eq 0 || { echo "Can't compile TON with emmake "; exit 1; } +test $? -eq 0 || { echo "Can't compile ION with emmake "; exit 1; } if [ "$with_artifacts" = true ]; then echo "Creating artifacts..." diff --git a/blockchain-explorer/CMakeLists.txt b/blockchain-explorer/CMakeLists.txt index 36d4e5069..67063d08c 100644 --- a/blockchain-explorer/CMakeLists.txt +++ b/blockchain-explorer/CMakeLists.txt @@ -16,26 +16,26 @@ add_executable(blockchain-explorer ${BLOCHAIN_EXPLORER_SOURCE}) if (NIX) if (MHD_FOUND) target_include_directories(blockchain-explorer PUBLIC ${MHD_INCLUDE_DIR}) - target_link_libraries(blockchain-explorer tdactor adnllite tl_lite_api tl-lite-utils ton_crypto ${MHD_LIBRARY}) + target_link_libraries(blockchain-explorer tdactor adnllite tl_lite_api tl-lite-utils ion_crypto ${MHD_LIBRARY}) else() find_package(PkgConfig REQUIRED) pkg_check_modules(MHD libmicrohttpd) target_include_directories(blockchain-explorer PUBLIC ${MHD_INCLUDE_DIR} ${MHD_STATIC_INCLUDE_DIRS}) - target_link_libraries(blockchain-explorer tdactor adnllite tl_lite_api tl-lite-utils ton_crypto ${MHD_LIBRARIES} ${MHD_STATIC_LIBRARIES}) + target_link_libraries(blockchain-explorer tdactor adnllite tl_lite_api tl-lite-utils ion_crypto ${MHD_LIBRARIES} ${MHD_STATIC_LIBRARIES}) endif() else() if (MHD_FOUND) target_include_directories(blockchain-explorer PUBLIC ${MHD_INCLUDE_DIR}) - target_link_libraries(blockchain-explorer tdactor adnllite tl_lite_api tl-lite-utils ton_crypto ${MHD_LIBRARY}) + target_link_libraries(blockchain-explorer tdactor adnllite tl_lite_api tl-lite-utils ion_crypto ${MHD_LIBRARY}) else() find_package(MHD) target_include_directories(blockchain-explorer PUBLIC ${MHD_INCLUDE_DIR}) - target_link_libraries(blockchain-explorer tdactor adnllite tl_lite_api tl-lite-utils ton_crypto ${MHD_LIBRARY}) + target_link_libraries(blockchain-explorer tdactor adnllite tl_lite_api tl-lite-utils ion_crypto ${MHD_LIBRARY}) endif() endif() target_include_directories(blockchain-explorer PUBLIC ${MHD_INCLUDE_DIR}) -target_link_libraries(blockchain-explorer tdactor adnllite tl_lite_api tl-lite-utils ton_crypto ${MHD_LIBRARY}) +target_link_libraries(blockchain-explorer tdactor adnllite tl_lite_api tl-lite-utils ion_crypto ${MHD_LIBRARY}) install(TARGETS blockchain-explorer RUNTIME DESTINATION bin) diff --git a/blockchain-explorer/blockchain-explorer-http.cpp b/blockchain-explorer/blockchain-explorer-http.cpp index e5203cb7e..a822cecae 100644 --- a/blockchain-explorer/blockchain-explorer-http.cpp +++ b/blockchain-explorer/blockchain-explorer-http.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -34,7 +34,7 @@ #include "vm/cellops.h" #include "vm/cells/MerkleProof.h" #include "block/mc-config.h" -#include "ton/ton-shard.h" +#include "ion/ion-shard.h" #include "td/utils/date.h" bool local_scripts{false}; @@ -68,14 +68,14 @@ static std::string time_to_human(unsigned ts) { } HttpAnswer& HttpAnswer::operator<<(AddressCell addr_c) { - ton::WorkchainId wc; - ton::StdSmcAddress addr; + ion::WorkchainId wc; + ion::StdSmcAddress addr; if (!block::tlb::t_MsgAddressInt.extract_std_address(addr_c.root, wc, addr)) { abort(""); return *this; } block::StdAddress caddr{wc, addr}; - *this << "" << caddr.rserialize(true) << ""; + *this << "" << caddr.rserialize(true) << ""; return *this; } @@ -145,13 +145,13 @@ HttpAnswer& HttpAnswer::operator<<(MessageCell msg) { return *this; } -HttpAnswer& HttpAnswer::operator<<(ton::BlockIdExt block_id) { +HttpAnswer& HttpAnswer::operator<<(ion::BlockIdExt block_id) { return *this << "" << block_id.id.to_str() << ""; } -HttpAnswer& HttpAnswer::operator<<(ton::BlockId block_id) { +HttpAnswer& HttpAnswer::operator<<(ion::BlockId block_id) { return *this << "" + << "&shard=" << ion::shard_to_str(block_id.shard) << "&seqno=" << block_id.seqno << "\">" << block_id.to_str() << ""; } @@ -166,14 +166,14 @@ HttpAnswer& HttpAnswer::operator<<(BlockSearch bs) { << "
" << "" << "
" + << (bs.block_id.is_valid() ? ion::shard_to_str(bs.block_id.id.shard) : "") << "\">" << "
" << "" << "
" << "
" << "" - << "
" + << "
Submit
" << "
" << "
" << "" @@ -207,15 +207,15 @@ HttpAnswer& HttpAnswer::operator<<(AccountSearch bs) { << "
" << "" << "
" + << (bs.block_id.is_valid() ? ion::shard_to_str(bs.block_id.id.shard) : "") << "\">
" << "
" << "" << "
" << "
" << "" - << "
" - << "
" + << "
Submit" + << "Reset
" << "
" << "
" << "" @@ -247,15 +247,15 @@ HttpAnswer& HttpAnswer::operator<<(TransactionSearch bs) { << "
" << "" << "
" + << (bs.block_id.is_valid() ? ion::shard_to_str(bs.block_id.id.shard) : "") << "\">
" << "
" << "" << "
" << "
" << "" - << "
" - << "
" + << "
Submit" + << "Reset
" << "
" << "
" << "" @@ -351,7 +351,7 @@ HttpAnswer& HttpAnswer::operator<<(AccountCell acc_c) { abort(PSTRING() << "shard block id " << block_id.to_str() << " in answer is invalid"); return *this; } - if (!ton::shard_contains(block_id.shard_full(), ton::extract_addr_prefix(acc_c.addr.workchain, acc_c.addr.addr))) { + if (!ion::shard_contains(block_id.shard_full(), ion::extract_addr_prefix(acc_c.addr.workchain, acc_c.addr.addr))) { abort(PSTRING() << "received data from shard block " << block_id.to_str() << " that cannot contain requested account " << acc_c.addr.workchain << ":" << acc_c.addr.addr.to_hex()); @@ -361,8 +361,8 @@ HttpAnswer& HttpAnswer::operator<<(AccountCell acc_c) { abort(PSTRING() << "account state proof must have exactly two roots"); return *this; } - ton::LogicalTime last_trans_lt = 0; - ton::Bits256 last_trans_hash; + ion::LogicalTime last_trans_lt = 0; + ion::Bits256 last_trans_hash; last_trans_hash.set_zero(); block::CurrencyCollection balance = block::CurrencyCollection::zero(); try { @@ -434,11 +434,11 @@ HttpAnswer& HttpAnswer::operator<<(AccountCell acc_c) { << "
" << "" << "" - << "" + << "" << "" << "" << "" - << "
" + << "
Run!
" << "
\n"; *this << "
\n" @@ -479,9 +479,9 @@ HttpAnswer& HttpAnswer::operator<<(BlockHeaderCell head_c) { abort("invalid merkle proof"); return *this; } - ton::RootHash vhash{virt_root->get_hash().bits()}; - std::vector prev; - ton::BlockIdExt mc_blkid; + ion::RootHash vhash{virt_root->get_hash().bits()}; + std::vector prev; + ion::BlockIdExt mc_blkid; bool after_split; auto res = block::unpack_block_prev_blk_ext(virt_root, block_id, prev, mc_blkid, after_split); if (res.is_error()) { @@ -518,19 +518,19 @@ HttpAnswer& HttpAnswer::operator<<(BlockHeaderCell head_c) { << "vert_seqno" << info.vert_seq_no << "\n" << "vert_seqno_incr" << info.vert_seqno_incr << "\n" << "prev_key_block_seqno" - << ton::BlockId{ton::masterchainId, ton::shardIdAll, info.prev_key_block_seqno} << "\n"; + << ion::BlockId{ion::masterchainId, ion::shardIdAll, info.prev_key_block_seqno} << "\n"; for (auto id : prev) { *this << "prev block" << id << "\n"; } if (!before_split) { *this << "next block" - << ton::BlockId{block_id.id.workchain, block_id.id.shard, block_id.id.seqno + 1} << "\n"; + << ion::BlockId{block_id.id.workchain, block_id.id.shard, block_id.id.seqno + 1} << "\n"; } else { *this << "next block" - << ton::BlockId{block_id.id.workchain, ton::shard_child(block_id.id.shard, true), block_id.id.seqno + 1} + << ion::BlockId{block_id.id.workchain, ion::shard_child(block_id.id.shard, true), block_id.id.seqno + 1} << "\n"; *this << "next block" - << ton::BlockId{block_id.id.workchain, ton::shard_child(block_id.id.shard, false), block_id.id.seqno + 1} + << ion::BlockId{block_id.id.workchain, ion::shard_child(block_id.id.shard, false), block_id.id.seqno + 1} << "\n"; } *this << "masterchain block" << mc_blkid << "\n" @@ -560,7 +560,7 @@ HttpAnswer& HttpAnswer::operator<<(BlockShardsCell shards_c) { } else { auto ids = sh_conf.get_shard_hash_ids(true); - auto workchain = ton::masterchainId; + auto workchain = ion::masterchainId; *this << "
\n" << "\n\n" << "\n" @@ -575,16 +575,16 @@ HttpAnswer& HttpAnswer::operator<<(BlockShardsCell shards_c) { << "\n" << "\n"; for (auto id : ids) { - auto ref = sh_conf.get_shard_hash(ton::ShardIdFull(id)); + auto ref = sh_conf.get_shard_hash(ion::ShardIdFull(id)); if (id.workchain != workchain) { - if (workchain != ton::masterchainId) { + if (workchain != ion::masterchainId) { *this << "\n"; } workchain = id.workchain; } *this << ""; - ton::ShardIdFull shard{id.workchain, id.shard}; + ion::ShardIdFull shard{id.workchain, id.shard}; if (ref.not_null()) { *this << "
" << shard.to_str() << "top_block_id()} << "\">" << ref->top_block_id().id.seqno << "" << n.text << ""; } -void HttpAnswer::block_id_link(ton::BlockIdExt block_id) { - *this << "workchain=" << block_id.id.workchain << "&shard=" << ton::shard_to_str(block_id.id.shard) +void HttpAnswer::block_id_link(ion::BlockIdExt block_id) { + *this << "workchain=" << block_id.id.workchain << "&shard=" << ion::shard_to_str(block_id.id.shard) << "&seqno=" << block_id.id.seqno << "&roothash=" << block_id.root_hash << "&filehash=" << block_id.file_hash; } @@ -745,21 +745,21 @@ std::string HttpAnswer::header() { << "
" << ""; - *this << "
" + *this << "
view
" << "
" << "\n"; *this << "

\n" - << "\n" << "Search block\n" << "\n" - << "\n" << "Search account\n" << "\n" - << "\n" << "Search transaction\n" << "\n" @@ -774,7 +774,7 @@ std::string HttpAnswer::header() { << AccountSearch{block_id_, account_id_} << "\n"; *this << "

\n" << "
\n" - << TransactionSearch{block_id_, account_id_, 0, ton::Bits256::zero()} << "
\n"; + << TransactionSearch{block_id_, account_id_, 0, ion::Bits256::zero()} << "\n"; return sb_->as_cslice().c_str(); } diff --git a/blockchain-explorer/blockchain-explorer-http.hpp b/blockchain-explorer/blockchain-explorer-http.hpp index e21f1b7eb..52e56de8f 100644 --- a/blockchain-explorer/blockchain-explorer-http.hpp +++ b/blockchain-explorer/blockchain-explorer-http.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -27,7 +27,7 @@ */ #pragma once -#include "ton/ton-types.h" +#include "ion/ion-types.h" #include "vm/boc.h" #include "vm/cellops.h" #include "td/utils/Random.h" @@ -45,76 +45,76 @@ class HttpAnswer { }; struct TransactionCell { block::StdAddress addr; - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; td::Ref root; }; struct AccountCell { block::StdAddress addr; - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; td::Ref root; std::vector> q_roots; }; struct BlockHeaderCell { - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; td::Ref root; }; struct BlockShardsCell { - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; td::Ref root; }; struct AccountLink { block::StdAddress account_id; - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; }; struct MessageLink { td::Ref root; }; struct TransactionLink { block::StdAddress account_id; - ton::LogicalTime lt; - ton::Bits256 hash; + ion::LogicalTime lt; + ion::Bits256 hash; }; struct TransactionLinkShort { - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; block::StdAddress account_id; - ton::LogicalTime lt; + ion::LogicalTime lt; }; struct BlockLink { - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; }; struct BlockViewLink { - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; }; struct ConfigViewLink { - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; }; struct BlockDownloadLink { - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; }; struct BlockSearch { - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; }; struct AccountSearch { - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; block::StdAddress addr; }; struct TransactionSearch { - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; block::StdAddress addr; - ton::LogicalTime lt; - ton::Bits256 hash; + ion::LogicalTime lt; + ion::Bits256 hash; }; struct TransactionList { struct TransactionDescr { - TransactionDescr(block::StdAddress addr, ton::LogicalTime lt, ton::Bits256 hash) + TransactionDescr(block::StdAddress addr, ion::LogicalTime lt, ion::Bits256 hash) : addr(addr), lt(lt), hash(hash) { } block::StdAddress addr; - ton::LogicalTime lt; - ton::Bits256 hash; + ion::LogicalTime lt; + ion::Bits256 hash; }; - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; std::vector vec; td::uint32 req_count_; }; @@ -149,14 +149,14 @@ class HttpAnswer { void set_title(std::string title) { title_ = title; } - void set_block_id(ton::BlockIdExt block_id) { + void set_block_id(ion::BlockIdExt block_id) { block_id_ = block_id; workchain_id_ = block_id_.id.workchain; } void set_account_id(block::StdAddress addr) { account_id_ = addr; } - void set_workchain(ton::WorkchainId workchain_id) { + void set_workchain(ion::WorkchainId workchain_id) { workchain_id_ = workchain_id; } @@ -185,8 +185,8 @@ class HttpAnswer { } HttpAnswer &operator<<(AddressCell addr); HttpAnswer &operator<<(MessageCell msg); - HttpAnswer &operator<<(ton::BlockIdExt block_id); - HttpAnswer &operator<<(ton::BlockId block_id); + HttpAnswer &operator<<(ion::BlockIdExt block_id); + HttpAnswer &operator<<(ion::BlockId block_id); HttpAnswer &operator<<(TransactionCell trans); HttpAnswer &operator<<(AccountCell trans); HttpAnswer &operator<<(BlockHeaderCell head); @@ -222,11 +222,11 @@ class HttpAnswer { } private: - void block_id_link(ton::BlockIdExt block_id); + void block_id_link(ion::BlockIdExt block_id); std::string title_; - ton::BlockIdExt block_id_; - ton::WorkchainId workchain_id_ = ton::workchainInvalid; + ion::BlockIdExt block_id_; + ion::WorkchainId workchain_id_ = ion::workchainInvalid; block::StdAddress account_id_; std::string prefix_; diff --git a/blockchain-explorer/blockchain-explorer-query.cpp b/blockchain-explorer/blockchain-explorer-query.cpp index 1808a3c46..e14a5f133 100644 --- a/blockchain-explorer/blockchain-explorer-query.cpp +++ b/blockchain-explorer/blockchain-explorer-query.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -22,7 +22,7 @@ but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -36,8 +36,8 @@ #include "tl-utils/tl-utils.hpp" #include "tl-utils/lite-utils.hpp" -#include "ton/ton-tl.hpp" -#include "ton/lite-tl.hpp" +#include "ion/ion-tl.hpp" +#include "ion/lite-tl.hpp" #include "common/errorcode.h" #include "block/block-auto.h" @@ -50,113 +50,113 @@ #include "vm/vm.h" #include "vm/cp0.h" -td::Result parse_block_id(std::map &opts, bool allow_empty) { +td::Result parse_block_id(std::map &opts, bool allow_empty) { if (allow_empty) { if (opts.count("workchain") == 0 && opts.count("shard") == 0 && opts.count("seqno") == 0) { - return ton::BlockIdExt{}; + return ion::BlockIdExt{}; } } try { - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; auto it = opts.find("workchain"); if (it == opts.end()) { - return td::Status::Error(ton::ErrorCode::protoviolation, "workchain not set"); + return td::Status::Error(ion::ErrorCode::protoviolation, "workchain not set"); } block_id.id.workchain = std::stoi(it->second); it = opts.find("shard"); if (it == opts.end()) { - return td::Status::Error(ton::ErrorCode::protoviolation, "shard not set"); + return td::Status::Error(ion::ErrorCode::protoviolation, "shard not set"); } block_id.id.shard = std::stoull(it->second, nullptr, 16); it = opts.find("seqno"); if (it == opts.end()) { - return td::Status::Error(ton::ErrorCode::protoviolation, "seqno not set"); + return td::Status::Error(ion::ErrorCode::protoviolation, "seqno not set"); } auto s = std::stoull(it->second); - auto seqno = static_cast(s); + auto seqno = static_cast(s); if (s != seqno) { - return td::Status::Error(ton::ErrorCode::protoviolation, "seqno too big"); + return td::Status::Error(ion::ErrorCode::protoviolation, "seqno too big"); } block_id.id.seqno = seqno; it = opts.find("roothash"); if (it == opts.end()) { - return td::Status::Error(ton::ErrorCode::protoviolation, "roothash not set"); + return td::Status::Error(ion::ErrorCode::protoviolation, "roothash not set"); } if (it->second.length() != 64) { - return td::Status::Error(ton::ErrorCode::protoviolation, "roothash bad length"); + return td::Status::Error(ion::ErrorCode::protoviolation, "roothash bad length"); } auto R = td::hex_decode(td::Slice(it->second)); if (R.is_error()) { - return td::Status::Error(ton::ErrorCode::protoviolation, "roothash bad hex"); + return td::Status::Error(ion::ErrorCode::protoviolation, "roothash bad hex"); } block_id.root_hash.as_slice().copy_from(td::as_slice(R.move_as_ok())); it = opts.find("filehash"); if (it == opts.end()) { - return td::Status::Error(ton::ErrorCode::protoviolation, "filehash not set"); + return td::Status::Error(ion::ErrorCode::protoviolation, "filehash not set"); } if (it->second.length() != 64) { - return td::Status::Error(ton::ErrorCode::protoviolation, "filehash bad length"); + return td::Status::Error(ion::ErrorCode::protoviolation, "filehash bad length"); } R = td::hex_decode(td::Slice(it->second)); if (R.is_error()) { - return td::Status::Error(ton::ErrorCode::protoviolation, "filehash bad hex"); + return td::Status::Error(ion::ErrorCode::protoviolation, "filehash bad hex"); } block_id.file_hash.as_slice().copy_from(td::as_slice(R.move_as_ok())); return block_id; } catch (...) { - return td::Status::Error(ton::ErrorCode::protoviolation, "cannot parse int"); + return td::Status::Error(ion::ErrorCode::protoviolation, "cannot parse int"); } } -td::Result parse_account_prefix(std::map &opts, bool allow_empty) { +td::Result parse_account_prefix(std::map &opts, bool allow_empty) { if (allow_empty) { if (opts.count("workchain") == 0 && opts.count("shard") == 0 && opts.count("account") == 0) { - return ton::AccountIdPrefixFull{ton::masterchainId, 0}; + return ion::AccountIdPrefixFull{ion::masterchainId, 0}; } } try { - ton::AccountIdPrefixFull account_id; + ion::AccountIdPrefixFull account_id; auto it = opts.find("workchain"); if (it == opts.end()) { - return td::Status::Error(ton::ErrorCode::protoviolation, "workchain not set"); + return td::Status::Error(ion::ErrorCode::protoviolation, "workchain not set"); } account_id.workchain = std::stoi(it->second); it = opts.find("shard"); if (it == opts.end()) { it = opts.find("account"); if (it == opts.end()) { - return td::Status::Error(ton::ErrorCode::protoviolation, "shard/account not set"); + return td::Status::Error(ion::ErrorCode::protoviolation, "shard/account not set"); } } account_id.account_id_prefix = std::stoull(it->second, nullptr, 16); return account_id; } catch (...) { - return td::Status::Error(ton::ErrorCode::protoviolation, "cannot parse int"); + return td::Status::Error(ion::ErrorCode::protoviolation, "cannot parse int"); } } td::Result parse_account_addr(std::map &opts) { auto it = opts.find("account"); if (it == opts.end()) { - return td::Status::Error(ton::ErrorCode::error, "no account id"); + return td::Status::Error(ion::ErrorCode::error, "no account id"); } std::string acc_string = it->second; block::StdAddress a; if (a.parse_addr(td::Slice(acc_string))) { return a; } - ton::WorkchainId workchain_id; + ion::WorkchainId workchain_id; it = opts.find("accountworkchain"); if (it == opts.end()) { it = opts.find("workchain"); if (it == opts.end()) { - return td::Status::Error(ton::ErrorCode::error, "no account workchain id"); + return td::Status::Error(ion::ErrorCode::error, "no account workchain id"); } } try { workchain_id = std::stoi(it->second); } catch (...) { - return td::Status::Error(ton::ErrorCode::error, "bad account workchain id"); + return td::Status::Error(ion::ErrorCode::error, "bad account workchain id"); } if (acc_string.size() == 64) { TRY_RESULT(R, td::hex_decode(acc_string)); @@ -164,7 +164,7 @@ td::Result parse_account_addr(std::map promise) : HttpQueryCommon(std::move(prefix), std::move(promise)), block_id_(block_id) { } @@ -211,8 +211,8 @@ void HttpQueryBlockData::finish_query() { } void HttpQueryBlockData::start_up() { - auto query = ton::serialize_tl_object( - ton::create_tl_object(ton::create_tl_lite_block_id(block_id_)), true); + auto query = ion::serialize_tl_object( + ion::create_tl_object(ion::create_tl_lite_block_id(block_id_)), true); auto P = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result R) { if (R.is_error()) { @@ -227,7 +227,7 @@ void HttpQueryBlockData::start_up() { } void HttpQueryBlockData::got_block_data(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); return; @@ -236,7 +236,7 @@ void HttpQueryBlockData::got_block_data(td::BufferSlice data) { finish_query(); } -HttpQueryBlockView::HttpQueryBlockView(ton::BlockIdExt block_id, std::string prefix, +HttpQueryBlockView::HttpQueryBlockView(ion::BlockIdExt block_id, std::string prefix, td::Promise promise) : HttpQueryCommon(std::move(prefix), std::move(promise)), block_id_(block_id) { } @@ -274,8 +274,8 @@ void HttpQueryBlockView::finish_query() { } void HttpQueryBlockView::start_up_query() { - auto query = ton::serialize_tl_object( - ton::create_tl_object(ton::create_tl_lite_block_id(block_id_)), true); + auto query = ion::serialize_tl_object( + ion::create_tl_object(ion::create_tl_lite_block_id(block_id_)), true); auto P = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result R) { if (R.is_error()) { @@ -290,7 +290,7 @@ void HttpQueryBlockView::start_up_query() { } void HttpQueryBlockView::got_block_data(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); } @@ -298,7 +298,7 @@ void HttpQueryBlockView::got_block_data(td::BufferSlice data) { finish_query(); } -HttpQueryBlockInfo::HttpQueryBlockInfo(ton::BlockIdExt block_id, std::string prefix, +HttpQueryBlockInfo::HttpQueryBlockInfo(ion::BlockIdExt block_id, std::string prefix, td::Promise promise) : HttpQueryCommon(std::move(prefix), std::move(promise)), block_id_(block_id) { } @@ -322,8 +322,8 @@ void HttpQueryBlockInfo::start_up_query() { td::actor::send_closure(SelfId, &HttpQueryBlockInfo::got_block_header, R.move_as_ok()); } }); - auto query = ton::serialize_tl_object( - ton::create_tl_object(ton::create_tl_lite_block_id(block_id_), 0), + auto query = ion::serialize_tl_object( + ion::create_tl_object(ion::create_tl_lite_block_id(block_id_), 0), true); td::actor::send_closure(CoreActorInterface::instance_actor_id(), &CoreActorInterface::send_lite_query, std::move(query), std::move(P)); @@ -338,15 +338,15 @@ void HttpQueryBlockInfo::start_up_query() { td::actor::send_closure(SelfId, &HttpQueryBlockInfo::got_shard_info, R.move_as_ok()); } }); - auto query_2 = ton::serialize_tl_object( - ton::create_tl_object(ton::create_tl_lite_block_id(block_id_)), + auto query_2 = ion::serialize_tl_object( + ion::create_tl_object(ion::create_tl_lite_block_id(block_id_)), true); td::actor::send_closure(CoreActorInterface::instance_actor_id(), &CoreActorInterface::send_lite_query, std::move(query_2), std::move(P_2)); pending_queries_++; } - auto query_3 = ton::serialize_tl_object(ton::create_tl_object( - ton::create_tl_lite_block_id(block_id_), 7, 1024, nullptr, false, false), + auto query_3 = ion::serialize_tl_object(ion::create_tl_object( + ion::create_tl_lite_block_id(block_id_), 7, 1024, nullptr, false, false), true); auto P_3 = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result R) { if (R.is_error()) { @@ -361,7 +361,7 @@ void HttpQueryBlockInfo::start_up_query() { } void HttpQueryBlockInfo::got_block_header(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); return; @@ -374,7 +374,7 @@ void HttpQueryBlockInfo::got_block_header(td::BufferSlice data) { } void HttpQueryBlockInfo::got_shard_info(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); return; @@ -394,7 +394,7 @@ void HttpQueryBlockInfo::failed_to_get_shard_info(td::Status error) { } void HttpQueryBlockInfo::got_transactions(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); return; @@ -404,15 +404,15 @@ void HttpQueryBlockInfo::got_transactions(td::BufferSlice data) { for (auto &T : f->ids_) { transactions_.emplace_back(block::StdAddress{block_id_.id.workchain, T->account_}, - static_cast(T->lt_), T->hash_); + static_cast(T->lt_), T->hash_); } if (f->incomplete_ && transactions_.size() > 0) { const auto &T = *transactions_.rbegin(); - auto query_3 = ton::serialize_tl_object( - ton::create_tl_object( - ton::create_tl_lite_block_id(block_id_), 7 + 128, 1024, - ton::create_tl_object(T.addr.addr, T.lt), false, false), + auto query_3 = ion::serialize_tl_object( + ion::create_tl_object( + ion::create_tl_lite_block_id(block_id_), 7 + 128, 1024, + ion::create_tl_object(T.addr.addr, T.lt), false, false), true); auto P_3 = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result R) { if (R.is_error()) { @@ -471,20 +471,20 @@ void HttpQueryBlockInfo::finish_query() { stop(); } -HttpQueryBlockSearch::HttpQueryBlockSearch(ton::WorkchainId workchain, ton::AccountIdPrefix account, - ton::BlockSeqno seqno, std::string prefix, +HttpQueryBlockSearch::HttpQueryBlockSearch(ion::WorkchainId workchain, ion::AccountIdPrefix account, + ion::BlockSeqno seqno, std::string prefix, td::Promise promise) : HttpQueryCommon(std::move(prefix), std::move(promise)) , account_prefix_{workchain, account} , mode_(1) , seqno_(seqno) { } -HttpQueryBlockSearch::HttpQueryBlockSearch(ton::WorkchainId workchain, ton::AccountIdPrefix account, - ton::LogicalTime lt, std::string prefix, td::Promise promise) +HttpQueryBlockSearch::HttpQueryBlockSearch(ion::WorkchainId workchain, ion::AccountIdPrefix account, + ion::LogicalTime lt, std::string prefix, td::Promise promise) : HttpQueryCommon(std::move(prefix), std::move(promise)), account_prefix_{workchain, account}, mode_(2), lt_(lt) { } -HttpQueryBlockSearch::HttpQueryBlockSearch(ton::WorkchainId workchain, ton::AccountIdPrefix account, bool dummy, - ton::UnixTime utime, std::string prefix, td::Promise promise) +HttpQueryBlockSearch::HttpQueryBlockSearch(ion::WorkchainId workchain, ion::AccountIdPrefix account, bool dummy, + ion::UnixTime utime, std::string prefix, td::Promise promise) : HttpQueryCommon(std::move(prefix), std::move(promise)) , account_prefix_{workchain, account} , mode_(4) @@ -502,7 +502,7 @@ HttpQueryBlockSearch::HttpQueryBlockSearch(std::map op return; } if (opts.count("seqno") + opts.count("lt") + opts.count("utime") != 1) { - error_ = td::Status::Error(ton::ErrorCode::protoviolation, "exactly one of seqno/lt/utime must be set"); + error_ = td::Status::Error(ion::ErrorCode::protoviolation, "exactly one of seqno/lt/utime must be set"); return; } if (opts.count("seqno") == 1) { @@ -542,9 +542,9 @@ void HttpQueryBlockSearch::start_up_query() { td::actor::send_closure(SelfId, &HttpQueryBlockSearch::got_block_header, R.move_as_ok()); } }); - auto query = ton::serialize_tl_object(ton::create_tl_object( + auto query = ion::serialize_tl_object(ion::create_tl_object( mode_, - ton::create_tl_lite_block_id_simple(ton::BlockId{ + ion::create_tl_lite_block_id_simple(ion::BlockId{ account_prefix_.workchain, account_prefix_.account_id_prefix, seqno_}), lt_, utime_), true); @@ -553,14 +553,14 @@ void HttpQueryBlockSearch::start_up_query() { } void HttpQueryBlockSearch::got_block_header(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); return; } auto f = F.move_as_ok(); data_ = std::move(f->header_proof_); - block_id_ = ton::create_block_id(f->id_); + block_id_ = ion::create_block_id(f->id_); if (block_id_.is_masterchain()) { auto P_2 = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result R) { @@ -571,16 +571,16 @@ void HttpQueryBlockSearch::got_block_header(td::BufferSlice data) { td::actor::send_closure(SelfId, &HttpQueryBlockSearch::got_shard_info, R.move_as_ok()); } }); - auto query_2 = ton::serialize_tl_object( - ton::create_tl_object(ton::create_tl_lite_block_id(block_id_)), + auto query_2 = ion::serialize_tl_object( + ion::create_tl_object(ion::create_tl_lite_block_id(block_id_)), true); td::actor::send_closure(CoreActorInterface::instance_actor_id(), &CoreActorInterface::send_lite_query, std::move(query_2), std::move(P_2)); pending_queries_++; } - auto query_3 = ton::serialize_tl_object(ton::create_tl_object( - ton::create_tl_lite_block_id(block_id_), 7, 1024, nullptr, false, false), + auto query_3 = ion::serialize_tl_object(ion::create_tl_object( + ion::create_tl_lite_block_id(block_id_), 7, 1024, nullptr, false, false), true); auto P_3 = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result R) { if (R.is_error()) { @@ -595,7 +595,7 @@ void HttpQueryBlockSearch::got_block_header(td::BufferSlice data) { } void HttpQueryBlockSearch::got_shard_info(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); return; @@ -615,7 +615,7 @@ void HttpQueryBlockSearch::failed_to_get_shard_info(td::Status error) { } void HttpQueryBlockSearch::got_transactions(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); return; @@ -625,15 +625,15 @@ void HttpQueryBlockSearch::got_transactions(td::BufferSlice data) { for (auto &T : f->ids_) { transactions_.emplace_back(block::StdAddress{block_id_.id.workchain, T->account_}, - static_cast(T->lt_), T->hash_); + static_cast(T->lt_), T->hash_); } if (f->incomplete_ && transactions_.size() > 0) { const auto &T = *transactions_.rbegin(); - auto query_3 = ton::serialize_tl_object( - ton::create_tl_object( - ton::create_tl_lite_block_id(block_id_), 7 + 128, 1024, - ton::create_tl_object(T.addr.addr, T.lt), false, false), + auto query_3 = ion::serialize_tl_object( + ion::create_tl_object( + ion::create_tl_lite_block_id(block_id_), 7 + 128, 1024, + ion::create_tl_object(T.addr.addr, T.lt), false, false), true); auto P_3 = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result R) { if (R.is_error()) { @@ -692,7 +692,7 @@ void HttpQueryBlockSearch::finish_query() { } stop(); } -HttpQueryViewAccount::HttpQueryViewAccount(ton::BlockIdExt block_id, block::StdAddress addr, std::string prefix, +HttpQueryViewAccount::HttpQueryViewAccount(ion::BlockIdExt block_id, block::StdAddress addr, std::string prefix, td::Promise promise) : HttpQueryCommon(std::move(prefix), std::move(promise)), block_id_(block_id), addr_(addr) { } @@ -704,8 +704,8 @@ HttpQueryViewAccount::HttpQueryViewAccount(std::map op if (R.is_ok()) { block_id_ = R.move_as_ok(); if (!block_id_.is_valid()) { - block_id_.id.workchain = ton::masterchainId; - block_id_.id.shard = ton::shardIdAll; + block_id_.id.workchain = ion::masterchainId; + block_id_.id.shard = ion::shardIdAll; block_id_.id.seqno = static_cast(0xffffffff); block_id_.root_hash.set_zero(); block_id_.file_hash.set_zero(); @@ -731,16 +731,16 @@ void HttpQueryViewAccount::start_up_query() { td::actor::send_closure(SelfId, &HttpQueryViewAccount::got_account, R.move_as_ok()); } }); - auto a = ton::create_tl_object(addr_.workchain, addr_.addr); - auto query = ton::serialize_tl_object(ton::create_tl_object( - ton::create_tl_lite_block_id(block_id_), std::move(a)), + auto a = ion::create_tl_object(addr_.workchain, addr_.addr); + auto query = ion::serialize_tl_object(ion::create_tl_object( + ion::create_tl_lite_block_id(block_id_), std::move(a)), true); td::actor::send_closure(CoreActorInterface::instance_actor_id(), &CoreActorInterface::send_lite_query, std::move(query), std::move(P)); } void HttpQueryViewAccount::got_account(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); return; @@ -749,7 +749,7 @@ void HttpQueryViewAccount::got_account(td::BufferSlice data) { auto f = F.move_as_ok(); data_ = std::move(f->state_); proof_ = std::move(f->proof_); - res_block_id_ = ton::create_block_id(f->shardblk_); + res_block_id_ = ion::create_block_id(f->shardblk_); finish_query(); } @@ -780,7 +780,7 @@ void HttpQueryViewAccount::finish_query() { stop(); } -HttpQueryViewTransaction::HttpQueryViewTransaction(block::StdAddress addr, ton::LogicalTime lt, ton::Bits256 hash, +HttpQueryViewTransaction::HttpQueryViewTransaction(block::StdAddress addr, ion::LogicalTime lt, ion::Bits256 hash, std::string prefix, td::Promise promise) : HttpQueryCommon(std::move(prefix), std::move(promise)), addr_(addr), lt_(lt), hash_(hash) { } @@ -828,15 +828,15 @@ void HttpQueryViewTransaction::start_up_query() { td::actor::send_closure(SelfId, &HttpQueryViewTransaction::got_transaction, R.move_as_ok()); } }); - auto a = ton::create_tl_object(addr_.workchain, addr_.addr); - auto query = ton::serialize_tl_object( - ton::create_tl_object(1, std::move(a), lt_, hash_), true); + auto a = ion::create_tl_object(addr_.workchain, addr_.addr); + auto query = ion::serialize_tl_object( + ion::create_tl_object(1, std::move(a), lt_, hash_), true); td::actor::send_closure(CoreActorInterface::instance_actor_id(), &CoreActorInterface::send_lite_query, std::move(query), std::move(P)); } void HttpQueryViewTransaction::got_transaction(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); return; @@ -848,7 +848,7 @@ void HttpQueryViewTransaction::got_transaction(td::BufferSlice data) { abort_query(td::Status::Error("no transactions found")); return; } - res_block_id_ = ton::create_block_id(f->ids_[0]); + res_block_id_ = ion::create_block_id(f->ids_[0]); finish_query(); } @@ -879,8 +879,8 @@ void HttpQueryViewTransaction::finish_query() { stop(); } -HttpQueryViewTransaction2::HttpQueryViewTransaction2(ton::BlockIdExt block_id, block::StdAddress addr, - ton::LogicalTime lt, std::string prefix, +HttpQueryViewTransaction2::HttpQueryViewTransaction2(ion::BlockIdExt block_id, block::StdAddress addr, + ion::LogicalTime lt, std::string prefix, td::Promise promise) : HttpQueryCommon(std::move(prefix), std::move(promise)), block_id_(block_id), addr_(addr), lt_(lt) { } @@ -919,16 +919,16 @@ void HttpQueryViewTransaction2::start_up_query() { td::actor::send_closure(SelfId, &HttpQueryViewTransaction2::got_transaction, R.move_as_ok()); } }); - auto a = ton::create_tl_object(addr_.workchain, addr_.addr); - auto query = ton::serialize_tl_object(ton::create_tl_object( - ton::create_tl_lite_block_id(block_id_), std::move(a), lt_), + auto a = ion::create_tl_object(addr_.workchain, addr_.addr); + auto query = ion::serialize_tl_object(ion::create_tl_object( + ion::create_tl_lite_block_id(block_id_), std::move(a), lt_), true); td::actor::send_closure(CoreActorInterface::instance_actor_id(), &CoreActorInterface::send_lite_query, std::move(query), std::move(P)); } void HttpQueryViewTransaction2::got_transaction(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); return; @@ -983,19 +983,19 @@ void HttpQueryViewLastBlock::start_up() { } }); - auto query = ton::serialize_tl_object(ton::create_tl_object(), true); + auto query = ion::serialize_tl_object(ion::create_tl_object(), true); td::actor::send_closure(CoreActorInterface::instance_actor_id(), &CoreActorInterface::send_lite_query, std::move(query), std::move(P)); } void HttpQueryViewLastBlock::got_result(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); return; } auto f = F.move_as_ok(); - res_block_id_ = ton::create_block_id(f->last_); + res_block_id_ = ion::create_block_id(f->last_); finish_query(); } @@ -1007,7 +1007,7 @@ void HttpQueryViewLastBlock::finish_query() { stop(); } -HttpQueryConfig::HttpQueryConfig(std::string prefix, ton::BlockIdExt block_id, std::vector params, +HttpQueryConfig::HttpQueryConfig(std::string prefix, ion::BlockIdExt block_id, std::vector params, td::Promise promise) : HttpQueryCommon(prefix, std::move(promise)), block_id_(block_id), params_(std::move(params)) { } @@ -1049,20 +1049,20 @@ void HttpQueryConfig::start_up() { } }); - auto query = ton::serialize_tl_object(ton::create_tl_object(), true); + auto query = ion::serialize_tl_object(ion::create_tl_object(), true); td::actor::send_closure(CoreActorInterface::instance_actor_id(), &CoreActorInterface::send_lite_query, std::move(query), std::move(P)); } } void HttpQueryConfig::got_block(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); return; } auto f = F.move_as_ok(); - block_id_ = ton::create_block_id(f->last_); + block_id_ = ion::create_block_id(f->last_); send_main_query(); } @@ -1077,18 +1077,18 @@ void HttpQueryConfig::send_main_query() { }); auto query = params_.size() > 0 - ? ton::serialize_tl_object(ton::create_tl_object( - 0, ton::create_tl_lite_block_id(block_id_), std::vector(params_)), + ? ion::serialize_tl_object(ion::create_tl_object( + 0, ion::create_tl_lite_block_id(block_id_), std::vector(params_)), true) - : ton::serialize_tl_object(ton::create_tl_object( - 0, ton::create_tl_lite_block_id(block_id_)), + : ion::serialize_tl_object(ion::create_tl_object( + 0, ion::create_tl_lite_block_id(block_id_)), true); td::actor::send_closure(CoreActorInterface::instance_actor_id(), &CoreActorInterface::send_lite_query, std::move(query), std::move(P)); } void HttpQueryConfig::got_result(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); return; @@ -1187,7 +1187,7 @@ void HttpQuerySendForm::finish_query() { << "send\" method=\"post\" enctype=\"multipart/form-data\">
" << "" << "" - << "" + << "send" << "
"; return A.finish(); }(); @@ -1227,13 +1227,13 @@ void HttpQuerySend::start_up() { } }); auto query = - ton::serialize_tl_object(ton::create_tl_object(std::move(data_)), true); + ion::serialize_tl_object(ion::create_tl_object(std::move(data_)), true); td::actor::send_closure(CoreActorInterface::instance_actor_id(), &CoreActorInterface::send_lite_query, std::move(query), std::move(P)); } void HttpQuerySend::got_result(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { abort_query(F.move_as_error()); } else { @@ -1260,7 +1260,7 @@ void HttpQuerySend::finish_query() { stop(); } -HttpQueryRunMethod::HttpQueryRunMethod(ton::BlockIdExt block_id, block::StdAddress addr, std::string method_name, +HttpQueryRunMethod::HttpQueryRunMethod(ion::BlockIdExt block_id, block::StdAddress addr, std::string method_name, std::vector params, std::string prefix, td::Promise promise) : HttpQueryCommon(std::move(prefix), std::move(promise)) @@ -1277,8 +1277,8 @@ HttpQueryRunMethod::HttpQueryRunMethod(std::map opts, if (R.is_ok()) { block_id_ = R.move_as_ok(); if (!block_id_.is_valid()) { - block_id_.id.workchain = ton::masterchainId; - block_id_.id.shard = ton::shardIdAll; + block_id_.id.workchain = ion::masterchainId; + block_id_.id.shard = ion::shardIdAll; block_id_.id.seqno = static_cast(0xffffffff); block_id_.root_hash.set_zero(); block_id_.file_hash.set_zero(); @@ -1321,7 +1321,7 @@ void HttpQueryRunMethod::start_up_query() { } }); - auto a = ton::create_tl_object(addr_.workchain, addr_.addr); + auto a = ion::create_tl_object(addr_.workchain, addr_.addr); td::int64 method_id = (td::crc16(td::Slice{method_name_}) & 0xffff) | 0x10000; // serialize params @@ -1335,16 +1335,16 @@ void HttpQueryRunMethod::start_up_query() { return abort_query(params_serialized.move_as_error_prefix("cannot serialize stack with get-method parameters : ")); } - auto query = ton::serialize_tl_object( - ton::create_tl_object( - 0x17, ton::create_tl_lite_block_id(block_id_), std::move(a), method_id, params_serialized.move_as_ok()), + auto query = ion::serialize_tl_object( + ion::create_tl_object( + 0x17, ion::create_tl_lite_block_id(block_id_), std::move(a), method_id, params_serialized.move_as_ok()), true); td::actor::send_closure(CoreActorInterface::instance_actor_id(), &CoreActorInterface::send_lite_query, std::move(query), std::move(P)); } void HttpQueryRunMethod::got_result(td::BufferSlice data) { - auto F = ton::fetch_tl_object(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { return abort_query(F.move_as_error()); } @@ -1352,7 +1352,7 @@ void HttpQueryRunMethod::got_result(td::BufferSlice data) { auto page = [&]() -> std::string { HttpAnswer A{"account", prefix_}; A.set_account_id(addr_); - A.set_block_id(ton::create_block_id(f->id_)); + A.set_block_id(ion::create_block_id(f->id_)); if (f->exit_code_ != 0) { A.abort(PSTRING() << "VM terminated with error code " << f->exit_code_); return A.finish(); diff --git a/blockchain-explorer/blockchain-explorer-query.hpp b/blockchain-explorer/blockchain-explorer-query.hpp index 29501265b..465fd64cd 100644 --- a/blockchain-explorer/blockchain-explorer-query.hpp +++ b/blockchain-explorer/blockchain-explorer-query.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -28,7 +28,7 @@ #pragma once #include "td/actor/actor.h" -#include "ton/ton-types.h" +#include "ion/ion-types.h" #include "block/block.h" #include "blockchain-explorer.hpp" @@ -36,7 +36,7 @@ #include -td::Result parse_block_id(std::map &opts, bool allow_empty = false); +td::Result parse_block_id(std::map &opts, bool allow_empty = false); td::Result parse_account_addr(std::map &opts); class HttpAnswer; @@ -69,7 +69,7 @@ class HttpQueryCommon : public td::actor::Actor { class HttpQueryBlockData : public HttpQueryCommon { public: - HttpQueryBlockData(ton::BlockIdExt block_id, std::string prefix, td::Promise promise); + HttpQueryBlockData(ion::BlockIdExt block_id, std::string prefix, td::Promise promise); HttpQueryBlockData(std::map opts, std::string prefix, td::Promise promise); void abort_query(td::Status error) override; @@ -79,14 +79,14 @@ class HttpQueryBlockData : public HttpQueryCommon { void got_block_data(td::BufferSlice result); private: - ton::BlockIdExt block_id_; + ion::BlockIdExt block_id_; td::BufferSlice data_; }; class HttpQueryBlockView : public HttpQueryCommon { public: - HttpQueryBlockView(ton::BlockIdExt block_id, std::string prefix, td::Promise promise); + HttpQueryBlockView(ion::BlockIdExt block_id, std::string prefix, td::Promise promise); HttpQueryBlockView(std::map opts, std::string prefix, td::Promise promise); void finish_query(); @@ -95,14 +95,14 @@ class HttpQueryBlockView : public HttpQueryCommon { void got_block_data(td::BufferSlice result); private: - ton::BlockIdExt block_id_; + ion::BlockIdExt block_id_; td::BufferSlice data_; }; class HttpQueryBlockInfo : public HttpQueryCommon { public: - HttpQueryBlockInfo(ton::BlockIdExt block_id, std::string prefix, td::Promise promise); + HttpQueryBlockInfo(ion::BlockIdExt block_id, std::string prefix, td::Promise promise); HttpQueryBlockInfo(std::map opts, std::string prefix, td::Promise promise); void finish_query(); @@ -115,7 +115,7 @@ class HttpQueryBlockInfo : public HttpQueryCommon { void failed_to_get_shard_info(td::Status error); private: - ton::BlockIdExt block_id_; + ion::BlockIdExt block_id_; td::int32 pending_queries_ = 0; @@ -124,11 +124,11 @@ class HttpQueryBlockInfo : public HttpQueryCommon { td::Status shard_data_error_; struct TransactionDescr { - TransactionDescr(block::StdAddress addr, ton::LogicalTime lt, ton::Bits256 hash) : addr(addr), lt(lt), hash(hash) { + TransactionDescr(block::StdAddress addr, ion::LogicalTime lt, ion::Bits256 hash) : addr(addr), lt(lt), hash(hash) { } block::StdAddress addr; - ton::LogicalTime lt; - ton::Bits256 hash; + ion::LogicalTime lt; + ion::Bits256 hash; }; std::vector transactions_; td::uint32 trans_req_count_; @@ -136,11 +136,11 @@ class HttpQueryBlockInfo : public HttpQueryCommon { class HttpQueryBlockSearch : public HttpQueryCommon { public: - HttpQueryBlockSearch(ton::WorkchainId workchain, ton::AccountIdPrefix account, ton::BlockSeqno seqno, + HttpQueryBlockSearch(ion::WorkchainId workchain, ion::AccountIdPrefix account, ion::BlockSeqno seqno, std::string prefix, td::Promise promise); - HttpQueryBlockSearch(ton::WorkchainId workchain, ton::AccountIdPrefix account, ton::LogicalTime lt, + HttpQueryBlockSearch(ion::WorkchainId workchain, ion::AccountIdPrefix account, ion::LogicalTime lt, std::string prefix, td::Promise promise); - HttpQueryBlockSearch(ton::WorkchainId workchain, ton::AccountIdPrefix account, bool dummy, ton::UnixTime utime, + HttpQueryBlockSearch(ion::WorkchainId workchain, ion::AccountIdPrefix account, bool dummy, ion::UnixTime utime, std::string prefix, td::Promise promise); HttpQueryBlockSearch(std::map opts, std::string prefix, td::Promise promise); @@ -155,13 +155,13 @@ class HttpQueryBlockSearch : public HttpQueryCommon { void failed_to_get_shard_info(td::Status error); private: - ton::AccountIdPrefixFull account_prefix_; + ion::AccountIdPrefixFull account_prefix_; td::uint32 mode_ = 0; - ton::BlockSeqno seqno_ = 0; - ton::LogicalTime lt_ = 0; - ton::UnixTime utime_ = 0; + ion::BlockSeqno seqno_ = 0; + ion::LogicalTime lt_ = 0; + ion::UnixTime utime_ = 0; - ton::BlockIdExt block_id_; + ion::BlockIdExt block_id_; td::BufferSlice data_; td::BufferSlice shard_data_; @@ -170,11 +170,11 @@ class HttpQueryBlockSearch : public HttpQueryCommon { td::uint32 pending_queries_ = 0; struct TransactionDescr { - TransactionDescr(block::StdAddress addr, ton::LogicalTime lt, ton::Bits256 hash) : addr(addr), lt(lt), hash(hash) { + TransactionDescr(block::StdAddress addr, ion::LogicalTime lt, ion::Bits256 hash) : addr(addr), lt(lt), hash(hash) { } block::StdAddress addr; - ton::LogicalTime lt; - ton::Bits256 hash; + ion::LogicalTime lt; + ion::Bits256 hash; }; std::vector transactions_; td::uint32 trans_req_count_; @@ -182,7 +182,7 @@ class HttpQueryBlockSearch : public HttpQueryCommon { class HttpQueryViewAccount : public HttpQueryCommon { public: - HttpQueryViewAccount(ton::BlockIdExt block_id, block::StdAddress addr, std::string prefix, + HttpQueryViewAccount(ion::BlockIdExt block_id, block::StdAddress addr, std::string prefix, td::Promise promise); HttpQueryViewAccount(std::map opts, std::string prefix, td::Promise promise); @@ -193,17 +193,17 @@ class HttpQueryViewAccount : public HttpQueryCommon { void got_account(td::BufferSlice result); private: - ton::BlockIdExt block_id_; + ion::BlockIdExt block_id_; block::StdAddress addr_; td::BufferSlice data_; td::BufferSlice proof_; - ton::BlockIdExt res_block_id_; + ion::BlockIdExt res_block_id_; }; class HttpQueryViewTransaction : public HttpQueryCommon { public: - HttpQueryViewTransaction(block::StdAddress addr, ton::LogicalTime lt, ton::Bits256 hash, std::string prefix, + HttpQueryViewTransaction(block::StdAddress addr, ion::LogicalTime lt, ion::Bits256 hash, std::string prefix, td::Promise promise); HttpQueryViewTransaction(std::map opts, std::string prefix, td::Promise promise); @@ -215,16 +215,16 @@ class HttpQueryViewTransaction : public HttpQueryCommon { private: block::StdAddress addr_; - ton::LogicalTime lt_; - ton::Bits256 hash_; + ion::LogicalTime lt_; + ion::Bits256 hash_; td::BufferSlice data_; - ton::BlockIdExt res_block_id_; + ion::BlockIdExt res_block_id_; }; class HttpQueryViewTransaction2 : public HttpQueryCommon { public: - HttpQueryViewTransaction2(ton::BlockIdExt block_id, block::StdAddress addr, ton::LogicalTime lt, std::string prefix, + HttpQueryViewTransaction2(ion::BlockIdExt block_id, block::StdAddress addr, ion::LogicalTime lt, std::string prefix, td::Promise promise); HttpQueryViewTransaction2(std::map opts, std::string prefix, td::Promise promise); @@ -235,10 +235,10 @@ class HttpQueryViewTransaction2 : public HttpQueryCommon { void got_transaction(td::BufferSlice result); private: - ton::BlockIdExt block_id_; + ion::BlockIdExt block_id_; block::StdAddress addr_; - ton::LogicalTime lt_; - ton::Bits256 hash_; + ion::LogicalTime lt_; + ion::Bits256 hash_; td::BufferSlice data_; }; @@ -255,12 +255,12 @@ class HttpQueryViewLastBlock : public HttpQueryCommon { void got_result(td::BufferSlice result); private: - ton::BlockIdExt res_block_id_; + ion::BlockIdExt res_block_id_; }; class HttpQueryConfig : public HttpQueryCommon { public: - HttpQueryConfig(std::string prefix, ton::BlockIdExt block_id, std::vector params, + HttpQueryConfig(std::string prefix, ion::BlockIdExt block_id, std::vector params, td::Promise promise); HttpQueryConfig(std::map opts, std::string prefix, td::Promise promise); @@ -272,7 +272,7 @@ class HttpQueryConfig : public HttpQueryCommon { void got_result(td::BufferSlice result); private: - ton::BlockIdExt block_id_; + ion::BlockIdExt block_id_; std::vector params_; td::BufferSlice state_proof_; @@ -307,7 +307,7 @@ class HttpQuerySend : public HttpQueryCommon { class HttpQueryRunMethod : public HttpQueryCommon { public: - HttpQueryRunMethod(ton::BlockIdExt block_id, block::StdAddress addr, std::string method_name, + HttpQueryRunMethod(ion::BlockIdExt block_id, block::StdAddress addr, std::string method_name, std::vector params, std::string prefix, td::Promise promise); HttpQueryRunMethod(std::map opts, std::string prefix, td::Promise promise); @@ -315,7 +315,7 @@ class HttpQueryRunMethod : public HttpQueryCommon { void got_result(td::BufferSlice result); private: - ton::BlockIdExt block_id_; + ion::BlockIdExt block_id_; block::StdAddress addr_; std::string method_name_; std::vector params_; diff --git a/blockchain-explorer/blockchain-explorer.cpp b/blockchain-explorer/blockchain-explorer.cpp index 3b5346b73..f0644e27b 100644 --- a/blockchain-explorer/blockchain-explorer.cpp +++ b/blockchain-explorer/blockchain-explorer.cpp @@ -1,12 +1,12 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -21,13 +21,13 @@ but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "adnl/adnl-ext-client.h" #include "adnl/utils.hpp" -#include "auto/tl/ton_api_json.h" +#include "auto/tl/ion_api_json.h" #include "td/utils/OptionParser.h" #include "td/utils/Time.h" #include "td/utils/filesystem.h" @@ -37,7 +37,7 @@ #include "td/utils/port/signals.h" #include "td/utils/port/user.h" #include "td/utils/port/FileFd.h" -#include "ton/ton-tl.hpp" +#include "ion/ion-tl.hpp" #include "block/block-db.h" #include "block/block.h" #include "block/block-auto.h" @@ -55,7 +55,7 @@ #include "vm/vm.h" #include "auto/tl/lite_api.h" -#include "ton/lite-tl.hpp" +#include "ion/lite-tl.hpp" #include "tl-utils/lite-utils.hpp" #include @@ -125,20 +125,20 @@ class HttpQueryRunner { class CoreActor : public CoreActorInterface { private: - std::string global_config_ = "ton-global.config"; + std::string global_config_ = "ion-global.config"; - std::vector> clients_; + std::vector> clients_; td::uint32 http_port_ = 80; MHD_Daemon* daemon_ = nullptr; td::IPAddress remote_addr_; - ton::PublicKey remote_public_key_; + ion::PublicKey remote_public_key_; bool hide_ips_ = false; - std::unique_ptr make_callback(td::uint32 idx) { - class Callback : public ton::adnl::AdnlExtClient::Callback { + std::unique_ptr make_callback(td::uint32 idx) { + class Callback : public ion::adnl::AdnlExtClient::Callback { public: void on_ready() override { td::actor::send_closure(id_, &CoreActor::conn_ready, idx_); @@ -212,9 +212,9 @@ class CoreActor : public CoreActorInterface { remote_addr_ = addr; } void set_remote_public_key(td::BufferSlice file_name) { - auto R = [&]() -> td::Result { + auto R = [&]() -> td::Result { TRY_RESULT_PREFIX(conf_data, td::read_file(file_name.as_slice().str()), "failed to read: "); - return ton::PublicKey::import(conf_data.as_slice()); + return ion::PublicKey::import(conf_data.as_slice()); }(); if (R.is_error()) { @@ -452,8 +452,8 @@ class CoreActor : public CoreActorInterface { if (remote_public_key_.empty()) { auto G = td::read_file(global_config_).move_as_ok(); auto gc_j = td::json_decode(G.as_slice()).move_as_ok(); - ton::ton_api::liteclient_config_global gc; - ton::ton_api::from_json(gc, gc_j.get_object()).ensure(); + ion::ion_api::liteclient_config_global gc; + ion::ion_api::from_json(gc, gc_j.get_object()).ensure(); CHECK(gc.liteservers_.size() > 0); td::uint32 size = static_cast(gc.liteservers_.size()); @@ -464,7 +464,7 @@ class CoreActor : public CoreActorInterface { td::IPAddress addr; addr.init_host_port(td::IPAddress::ipv4_to_str(cli->ip_), cli->port_).ensure(); addrs_.push_back(addr); - clients_.emplace_back(ton::adnl::AdnlExtClient::create(ton::adnl::AdnlNodeIdFull::create(cli->id_).move_as_ok(), + clients_.emplace_back(ion::adnl::AdnlExtClient::create(ion::adnl::AdnlNodeIdFull::create(cli->id_).move_as_ok(), addr, make_callback(i))); } } else { @@ -473,7 +473,7 @@ class CoreActor : public CoreActorInterface { } ready_.resize(1, false); addrs_.push_back(remote_addr_); - clients_.emplace_back(ton::adnl::AdnlExtClient::create(ton::adnl::AdnlNodeIdFull{remote_public_key_}, + clients_.emplace_back(ion::adnl::AdnlExtClient::create(ion::adnl::AdnlNodeIdFull{remote_public_key_}, remote_addr_, make_callback(0))); } daemon_ = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, static_cast(http_port_), nullptr, nullptr, @@ -496,7 +496,7 @@ void CoreActor::got_result(td::uint32 idx, td::int32 attempt, td::Result(data.clone(), true); + auto F = ion::fetch_tl_object(data.clone(), true); if (F.is_ok()) { auto f = F.move_as_ok(); auto err = td::Status::Error(f->code_, f->message_); @@ -507,7 +507,7 @@ void CoreActor::got_result(td::uint32 idx, td::int32 attempt, td::Result(std::move(data), true); + auto F = ion::fetch_tl_object(std::move(data), true); if (F.is_error()) { waiting_--; if (waiting_ == 0) { @@ -516,7 +516,7 @@ void CoreActor::got_result(td::uint32 idx, td::int32 attempt, td::Resultvalues_[idx] = ton::create_block_id(f->last_); + new_result_->values_[idx] = ion::create_block_id(f->last_); waiting_--; CHECK(waiting_ >= 0); if (waiting_ == 0) { @@ -529,14 +529,14 @@ void CoreActor::send_query(td::uint32 idx) { return; } waiting_++; - auto query = ton::create_tl_object(); - auto q = ton::create_tl_object(serialize_tl_object(query, true)); + auto query = ion::create_tl_object(); + auto q = ion::create_tl_object(serialize_tl_object(query, true)); auto P = td::PromiseCreator::lambda([SelfId = actor_id(this), idx, attempt = attempt_](td::Result R) { td::actor::send_closure(SelfId, &CoreActor::got_result, idx, attempt, std::move(R)); }); - td::actor::send_closure(clients_[idx], &ton::adnl::AdnlExtClient::send_query, "query", serialize_tl_object(q, true), + td::actor::send_closure(clients_[idx], &ion::adnl::AdnlExtClient::send_query, "query", serialize_tl_object(q, true), td::Timestamp::in(10.0), std::move(P)); } @@ -554,7 +554,7 @@ void CoreActor::run_queries() { void CoreActor::send_lite_query(td::uint32 idx, td::BufferSlice query, td::Promise promise) { if (!ready_[idx]) { - promise.set_error(td::Status::Error(ton::ErrorCode::notready, "ext conn not ready")); + promise.set_error(td::Status::Error(ion::ErrorCode::notready, "ext conn not ready")); return; } auto P = td::PromiseCreator::lambda([promise = std::move(promise)](td::Result R) mutable { @@ -564,7 +564,7 @@ void CoreActor::send_lite_query(td::uint32 idx, td::BufferSlice query, td::Promi } auto B = R.move_as_ok(); { - auto F = ton::fetch_tl_object(B.clone(), true); + auto F = ion::fetch_tl_object(B.clone(), true); if (F.is_ok()) { auto f = F.move_as_ok(); promise.set_error(td::Status::Error(f->code_, f->message_)); @@ -573,8 +573,8 @@ void CoreActor::send_lite_query(td::uint32 idx, td::BufferSlice query, td::Promi } promise.set_value(std::move(B)); }); - auto q = ton::create_tl_object(std::move(query)); - td::actor::send_closure(clients_[idx], &ton::adnl::AdnlExtClient::send_query, "query", serialize_tl_object(q, true), + auto q = ion::create_tl_object(std::move(query)); + td::actor::send_closure(clients_[idx], &ion::adnl::AdnlExtClient::send_query, "query", serialize_tl_object(q, true), td::Timestamp::in(10.0), std::move(P)); } @@ -593,7 +593,7 @@ int main(int argc, char* argv[]) { td::actor::ActorOwn x; td::OptionParser p; - p.set_description("TON Blockchain explorer"); + p.set_description("ION Blockchain explorer"); p.add_checked_option('h', "help", "prints_help", [&]() { char b[10240]; td::StringBuilder sb(td::MutableSlice{b, 10000}); diff --git a/blockchain-explorer/blockchain-explorer.hpp b/blockchain-explorer/blockchain-explorer.hpp index 1bae362de..b3e75943d 100644 --- a/blockchain-explorer/blockchain-explorer.hpp +++ b/blockchain-explorer/blockchain-explorer.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -29,7 +29,7 @@ #include "td/actor/actor.h" #include "td/utils/buffer.h" -#include "ton/ton-types.h" +#include "ion/ion-types.h" #include "td/utils/port/IPAddress.h" #include @@ -51,7 +51,7 @@ extern bool local_scripts_; class CoreActorInterface : public td::actor::Actor { public: struct RemoteNodeStatus { - std::vector values_; + std::vector values_; td::Timestamp ts_; RemoteNodeStatus(size_t size, td::Timestamp ts) : ts_(ts) { values_.resize(size); diff --git a/catchain/catchain-block.cpp b/catchain/catchain-block.cpp index e12c89f9e..292624ca5 100644 --- a/catchain/catchain-block.cpp +++ b/catchain/catchain-block.cpp @@ -1,24 +1,24 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "catchain-block.hpp" -namespace ton { +namespace ion { namespace catchain { @@ -56,4 +56,4 @@ bool CatChainBlockImpl::is_descendant_of(CatChainBlock *block) { } // namespace catchain -} // namespace ton +} // namespace ion diff --git a/catchain/catchain-block.hpp b/catchain/catchain-block.hpp index d37b4dc59..5506ca456 100644 --- a/catchain/catchain-block.hpp +++ b/catchain/catchain-block.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -20,7 +20,7 @@ #include "catchain.h" -namespace ton { +namespace ion { namespace catchain { @@ -110,4 +110,4 @@ class CatChainBlockImpl : public CatChainBlock { } // namespace catchain -} // namespace ton +} // namespace ion diff --git a/catchain/catchain-received-block.cpp b/catchain/catchain-received-block.cpp index 5996e9678..aef3f2559 100644 --- a/catchain/catchain-received-block.cpp +++ b/catchain/catchain-received-block.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,13 +21,13 @@ #include "catchain-received-block.hpp" #include "catchain-receiver-source.h" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" -namespace ton { +namespace ion { namespace catchain { -void CatChainReceivedBlockImpl::initialize(tl_object_ptr block, td::SharedSlice payload) { +void CatChainReceivedBlockImpl::initialize(tl_object_ptr block, td::SharedSlice payload) { if (state_ != bs_none) { return; } @@ -128,7 +128,7 @@ void CatChainReceivedBlockImpl::initialize_fork() { vt_[fork_id_] = height_; } -void CatChainReceivedBlockImpl::pre_deliver(ton_api::catchain_block_data_fork &b) { +void CatChainReceivedBlockImpl::pre_deliver(ion_api::catchain_block_data_fork &b) { { td::Status S; S = chain_->validate_block_sync(b.left_); @@ -155,14 +155,14 @@ void CatChainReceivedBlockImpl::pre_deliver(ton_api::catchain_block_data_fork &b CatChainReceiverSource *S = chain_->get_source(b.left_->src_); S->on_found_fork_proof( - create_serialize_tl_object(std::move(b.left_), std::move(b.right_))); + create_serialize_tl_object(std::move(b.left_), std::move(b.right_))); S->blame(fork_id_, height_); } -void CatChainReceivedBlockImpl::pre_deliver(ton_api::catchain_block_data_badBlock &b) { +void CatChainReceivedBlockImpl::pre_deliver(ion_api::catchain_block_data_badBlock &b) { } -void CatChainReceivedBlockImpl::pre_deliver(ton_api::catchain_block_data_nop &b) { +void CatChainReceivedBlockImpl::pre_deliver(ion_api::catchain_block_data_nop &b) { } void CatChainReceivedBlockImpl::pre_deliver() { @@ -216,11 +216,11 @@ void CatChainReceivedBlockImpl::pre_deliver() { } } - auto X = fetch_tl_object(payload_.as_slice(), true); + auto X = fetch_tl_object(payload_.as_slice(), true); if (X.is_error()) { is_custom_ = true; } else { - ton_api::downcast_call(*X.move_as_ok(), [Self = this](auto &obj) { Self->pre_deliver(obj); }); + ion_api::downcast_call(*X.move_as_ok(), [Self = this](auto &obj) { Self->pre_deliver(obj); }); } } @@ -337,31 +337,31 @@ void CatChainReceivedBlockImpl::find_pending_deps(std::vector } } -tl_object_ptr CatChainReceivedBlock::block_id( - const CatChainReceiver *chain, const tl_object_ptr &block, const td::Slice &payload) { +tl_object_ptr CatChainReceivedBlock::block_id( + const CatChainReceiver *chain, const tl_object_ptr &block, const td::Slice &payload) { td::Bits256 hash = data_payload_hash(chain, block->data_, payload); - return create_tl_object(block->incarnation_, chain->get_source_hash(block->src_).tl(), + return create_tl_object(block->incarnation_, chain->get_source_hash(block->src_).tl(), block->height_, hash); } -tl_object_ptr CatChainReceivedBlock::block_id( - const CatChainReceiver *chain, const tl_object_ptr &block) { - return create_tl_object( +tl_object_ptr CatChainReceivedBlock::block_id( + const CatChainReceiver *chain, const tl_object_ptr &block) { + return create_tl_object( chain->get_incarnation(), chain->get_source_hash(block->src_).tl(), block->height_, block->data_hash_); } CatChainBlockHash CatChainReceivedBlock::block_hash(const CatChainReceiver *chain, - const tl_object_ptr &block, + const tl_object_ptr &block, const td::Slice &payload) { return get_tl_object_sha_bits256(block_id(chain, block, payload)); } CatChainBlockHash CatChainReceivedBlock::block_hash(const CatChainReceiver *chain, - const tl_object_ptr &block) { + const tl_object_ptr &block) { return get_tl_object_sha_bits256(block_id(chain, block)); } td::Status CatChainReceivedBlock::pre_validate_block(const CatChainReceiver *chain, - const tl_object_ptr &block, + const tl_object_ptr &block, const td::Slice &payload) { CHECK(block->incarnation_ == chain->get_incarnation()); if (block->height_ <= 0) { @@ -419,7 +419,7 @@ td::Status CatChainReceivedBlock::pre_validate_block(const CatChainReceiver *cha } td::Status CatChainReceivedBlock::pre_validate_block(const CatChainReceiver *chain, - const tl_object_ptr &block) { + const tl_object_ptr &block) { if (block->height_ < 0) { return td::Status::Error(ErrorCode::protoviolation, std::string("bad height ") + std::to_string(block->height_)); } @@ -440,24 +440,24 @@ td::Status CatChainReceivedBlock::pre_validate_block(const CatChainReceiver *cha return td::Status::OK(); } -tl_object_ptr CatChainReceivedBlockImpl::export_tl() const { +tl_object_ptr CatChainReceivedBlockImpl::export_tl() const { CHECK(initialized()); CHECK(height_ > 0); - std::vector> deps; + std::vector> deps; for (CatChainReceivedBlockImpl *B : block_deps_) { deps.push_back(B->export_tl_dep()); } CHECK(deps.size() <= chain_->opts().max_deps) - return create_tl_object( + return create_tl_object( chain_->get_incarnation(), source_id_, height_, - create_tl_object(prev_->export_tl_dep(), std::move(deps)), + create_tl_object(prev_->export_tl_dep(), std::move(deps)), signature_.clone_as_buffer_slice()); } -tl_object_ptr CatChainReceivedBlockImpl::export_tl_dep() const { - return create_tl_object(source_id_, height_, data_payload_hash_, +tl_object_ptr CatChainReceivedBlockImpl::export_tl_dep() const { + return create_tl_object(source_id_, height_, data_payload_hash_, signature_.clone_as_buffer_slice()); } @@ -470,15 +470,15 @@ CatChainReceivedBlockImpl::CatChainReceivedBlockImpl(td::uint32 source_id, const height_ = 0; data_payload_hash_ = hash; - block_id_hash_ = get_tl_object_sha_bits256(create_tl_object( + block_id_hash_ = get_tl_object_sha_bits256(create_tl_object( chain->get_incarnation(), chain->get_incarnation(), height_, data_payload_hash_)); } -CatChainReceivedBlockImpl::CatChainReceivedBlockImpl(tl_object_ptr block, +CatChainReceivedBlockImpl::CatChainReceivedBlockImpl(tl_object_ptr block, td::SharedSlice payload, CatChainReceiver *chain) { chain_ = chain; data_payload_hash_ = data_payload_hash(chain, block->data_, payload); - block_id_hash_ = get_tl_object_sha_bits256(create_tl_object( + block_id_hash_ = get_tl_object_sha_bits256(create_tl_object( block->incarnation_, chain->get_source_hash(block->src_).tl(), block->height_, data_payload_hash_)); height_ = block->height_; source_id_ = block->src_; @@ -490,13 +490,13 @@ CatChainReceivedBlockImpl::CatChainReceivedBlockImpl(tl_object_ptr block, +CatChainReceivedBlockImpl::CatChainReceivedBlockImpl(tl_object_ptr block, CatChainReceiver *chain) { chain_ = chain; data_payload_hash_ = block->data_hash_; source_id_ = block->src_; signature_ = td::SharedSlice{block->signature_.as_slice()}; - block_id_hash_ = get_tl_object_sha_bits256(create_tl_object( + block_id_hash_ = get_tl_object_sha_bits256(create_tl_object( chain_->get_incarnation(), chain_->get_source_hash(source_id_).tl(), block->height_, data_payload_hash_)); height_ = block->height_; @@ -504,12 +504,12 @@ CatChainReceivedBlockImpl::CatChainReceivedBlockImpl(tl_object_ptron_new_block(this); } -std::unique_ptr CatChainReceivedBlock::create(tl_object_ptr block, +std::unique_ptr CatChainReceivedBlock::create(tl_object_ptr block, td::SharedSlice payload, CatChainReceiver *chain) { return std::make_unique(std::move(block), std::move(payload), chain); } -std::unique_ptr CatChainReceivedBlock::create(tl_object_ptr block, +std::unique_ptr CatChainReceivedBlock::create(tl_object_ptr block, CatChainReceiver *chain) { return std::make_unique(std::move(block), chain); } @@ -521,7 +521,7 @@ std::unique_ptr CatChainReceivedBlock::create_root(td::ui } CatChainBlockPayloadHash CatChainReceivedBlock::data_payload_hash( - const CatChainReceiver *chain, const tl_object_ptr &data, const td::Slice &payload) { + const CatChainReceiver *chain, const tl_object_ptr &data, const td::Slice &payload) { td::Bits256 hash = sha256_bits256(payload); if (chain->opts().block_hash_covers_data) { td::Bits256 data_hash = get_tl_object_sha_bits256(data); @@ -537,4 +537,4 @@ CatChainBlockPayloadHash CatChainReceivedBlock::data_payload_hash( } // namespace catchain -} // namespace ton +} // namespace ion diff --git a/catchain/catchain-received-block.h b/catchain/catchain-received-block.h index 3c4f5d765..85ee27b74 100644 --- a/catchain/catchain-received-block.h +++ b/catchain/catchain-received-block.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -20,11 +20,11 @@ #include "td/utils/buffer.h" #include "td/utils/SharedSlice.h" -#include "auto/tl/ton_api.h" +#include "auto/tl/ion_api.h" #include "catchain/catchain-receiver.h" -namespace ton { +namespace ion { namespace catchain { @@ -50,8 +50,8 @@ class CatChainReceivedBlock { virtual td::uint32 get_fork_id() const = 0; virtual td::uint32 get_source_id() const = 0; - virtual tl_object_ptr export_tl() const = 0; - virtual tl_object_ptr export_tl_dep() const = 0; + virtual tl_object_ptr export_tl() const = 0; + virtual tl_object_ptr export_tl_dep() const = 0; virtual void find_pending_deps(std::vector &vec, td::uint32 max_size) const = 0; @@ -67,36 +67,36 @@ class CatChainReceivedBlock { public: //change state - virtual void initialize(tl_object_ptr block, td::SharedSlice payload) = 0; + virtual void initialize(tl_object_ptr block, td::SharedSlice payload) = 0; virtual void set_ill() = 0; virtual void written() = 0; virtual void run() = 0; public: - static std::unique_ptr create(tl_object_ptr block, + static std::unique_ptr create(tl_object_ptr block, td::SharedSlice payload, CatChainReceiver *chain); - static std::unique_ptr create(tl_object_ptr block, + static std::unique_ptr create(tl_object_ptr block, CatChainReceiver *chain); static std::unique_ptr create_root(td::uint32 source_id, CatChainSessionId session_id, CatChainReceiver *chain); - static tl_object_ptr block_id(const CatChainReceiver *chain, - const tl_object_ptr &block, + static tl_object_ptr block_id(const CatChainReceiver *chain, + const tl_object_ptr &block, const td::Slice &payload); - static tl_object_ptr block_id(const CatChainReceiver *chain, - const tl_object_ptr &block); + static tl_object_ptr block_id(const CatChainReceiver *chain, + const tl_object_ptr &block); static CatChainBlockHash block_hash(const CatChainReceiver *chain, - const tl_object_ptr &block, + const tl_object_ptr &block, const td::Slice &payload); static CatChainBlockHash block_hash(const CatChainReceiver *chain, - const tl_object_ptr &block); + const tl_object_ptr &block); static td::Status pre_validate_block(const CatChainReceiver *chain, - const tl_object_ptr &block, + const tl_object_ptr &block, const td::Slice &payload); static td::Status pre_validate_block(const CatChainReceiver *chain, - const tl_object_ptr &block); + const tl_object_ptr &block); static CatChainBlockPayloadHash data_payload_hash(const CatChainReceiver *chain, - const tl_object_ptr &data, + const tl_object_ptr &data, const td::Slice &payload); @@ -105,16 +105,16 @@ class CatChainReceivedBlock { } // namespace catchain -} // namespace ton +} // namespace ion namespace td { -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::catchain::CatChainReceivedBlock &block) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::catchain::CatChainReceivedBlock &block) { sb << "[block " << block.get_chain()->get_incarnation() << " " << block.get_source_id() << " " << block.get_fork_id() << " " << block.get_hash() << "]"; return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::catchain::CatChainReceivedBlock *block) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::catchain::CatChainReceivedBlock *block) { sb << *block; return sb; } diff --git a/catchain/catchain-received-block.hpp b/catchain/catchain-received-block.hpp index f1270ab0d..8d5ebed3c 100644 --- a/catchain/catchain-received-block.hpp +++ b/catchain/catchain-received-block.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -20,7 +20,7 @@ #include "catchain/catchain-received-block.h" -namespace ton { +namespace ion { namespace catchain { @@ -63,8 +63,8 @@ class CatChainReceivedBlockImpl final : public CatChainReceivedBlock { return source_id_; } - tl_object_ptr export_tl() const override; - tl_object_ptr export_tl_dep() const override; + tl_object_ptr export_tl() const override; + tl_object_ptr export_tl_dep() const override; void find_pending_deps(std::vector &vec, td::uint32 max_size) const override; @@ -90,12 +90,12 @@ class CatChainReceivedBlockImpl final : public CatChainReceivedBlock { } public: - void initialize(tl_object_ptr block, td::SharedSlice payload) override; + void initialize(tl_object_ptr block, td::SharedSlice payload) override; void run() override; - void pre_deliver(ton_api::catchain_block_data_fork &b); - void pre_deliver(ton_api::catchain_block_data_badBlock &b); - void pre_deliver(ton_api::catchain_block_data_nop &b); + void pre_deliver(ion_api::catchain_block_data_fork &b); + void pre_deliver(ion_api::catchain_block_data_badBlock &b); + void pre_deliver(ion_api::catchain_block_data_nop &b); template void pre_deliver(T &b) { // do nothing, it is custom block @@ -113,9 +113,9 @@ class CatChainReceivedBlockImpl final : public CatChainReceivedBlock { void written() override; public: - CatChainReceivedBlockImpl(tl_object_ptr block, td::SharedSlice payload, + CatChainReceivedBlockImpl(tl_object_ptr block, td::SharedSlice payload, CatChainReceiver *chain); - CatChainReceivedBlockImpl(tl_object_ptr block, CatChainReceiver *chain); + CatChainReceivedBlockImpl(tl_object_ptr block, CatChainReceiver *chain); CatChainReceivedBlockImpl(td::uint32 source_id, const CatChainSessionId &hash, CatChainReceiver *chain); @@ -162,16 +162,16 @@ class CatChainReceivedBlockImpl final : public CatChainReceivedBlock { } // namespace catchain -} // namespace ton +} // namespace ion namespace td { -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::catchain::CatChainReceivedBlockImpl &block) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::catchain::CatChainReceivedBlockImpl &block) { sb << "[block " << block.get_chain()->get_incarnation() << " " << block.get_source_id() << " " << block.get_fork_id() << " " << block.get_hash() << "]"; return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::catchain::CatChainReceivedBlockImpl *block) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::catchain::CatChainReceivedBlockImpl *block) { sb << *block; return sb; } diff --git a/catchain/catchain-receiver-interface.h b/catchain/catchain-receiver-interface.h index bc02832ae..1faadf744 100644 --- a/catchain/catchain-receiver-interface.h +++ b/catchain/catchain-receiver-interface.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -23,7 +23,7 @@ #include "overlay/overlays.h" #include "catchain-types.h" -namespace ton { +namespace ion { namespace catchain { @@ -67,4 +67,4 @@ class CatChainReceiverInterface : public td::actor::Actor { } // namespace catchain -} // namespace ton +} // namespace ion diff --git a/catchain/catchain-receiver-source.cpp b/catchain/catchain-receiver-source.cpp index e758b3359..130abd007 100644 --- a/catchain/catchain-receiver-source.cpp +++ b/catchain/catchain-receiver-source.cpp @@ -1,25 +1,25 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "catchain-receiver-source.hpp" #include "common/errorlog.h" -namespace ton { +namespace ion { namespace catchain { @@ -141,7 +141,7 @@ void CatChainReceiverSourceImpl::on_new_block(CatChainReceivedBlock *block) { CHECK(block->get_hash() != it->second->get_hash()); VLOG(CATCHAIN_WARNING) << this << ": found fork on height " << block->get_height(); if (!fork_is_found()) { - on_found_fork_proof(create_serialize_tl_object(block->export_tl_dep(), + on_found_fork_proof(create_serialize_tl_object(block->export_tl_dep(), it->second->export_tl_dep()) .as_slice()); chain_->on_found_fork_proof(id_, fork_proof()); @@ -154,7 +154,7 @@ void CatChainReceiverSourceImpl::on_new_block(CatChainReceivedBlock *block) { void CatChainReceiverSourceImpl::on_found_fork_proof(const td::Slice &proof) { if (!fork_is_found()) { - fetch_tl_object(proof, true).ensure(); + fetch_tl_object(proof, true).ensure(); fork_proof_ = td::SharedSlice{proof}; errorlog::ErrorLog::log(PSTRING() << "catchain " << chain_->get_incarnation() << " source " << id_ << " found fork. hash=" << sha256_bits256(fork_proof_.as_slice()).to_hex()); @@ -173,4 +173,4 @@ bool CatChainReceiverSourceImpl::allow_send_block(CatChainBlockHash hash) { } // namespace catchain -} // namespace ton +} // namespace ion diff --git a/catchain/catchain-receiver-source.h b/catchain/catchain-receiver-source.h index 136906a02..e7990f349 100644 --- a/catchain/catchain-receiver-source.h +++ b/catchain/catchain-receiver-source.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -22,7 +22,7 @@ #include "keys/encryptor.h" -namespace ton { +namespace ion { namespace catchain { @@ -74,15 +74,15 @@ class CatChainReceiverSource { } // namespace catchain -} // namespace ton +} // namespace ion namespace td { -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::catchain::CatChainReceiverSource &source) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::catchain::CatChainReceiverSource &source) { sb << "[source " << source.get_chain()->get_incarnation() << " " << source.get_id() << "]"; return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::catchain::CatChainReceiverSource *source) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::catchain::CatChainReceiverSource *source) { sb << *source; return sb; } diff --git a/catchain/catchain-receiver-source.hpp b/catchain/catchain-receiver-source.hpp index cf08c4219..d5d549c5f 100644 --- a/catchain/catchain-receiver-source.hpp +++ b/catchain/catchain-receiver-source.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -25,7 +25,7 @@ #include "catchain-received-block.h" #include -namespace ton { +namespace ion { namespace catchain { @@ -141,15 +141,15 @@ class CatChainReceiverSourceImpl : public CatChainReceiverSource { } // namespace catchain -} // namespace ton +} // namespace ion namespace td { -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::catchain::CatChainReceiverSourceImpl &source) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::catchain::CatChainReceiverSourceImpl &source) { sb << "[source " << source.get_chain()->get_incarnation() << " " << source.get_id() << "]"; return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::catchain::CatChainReceiverSourceImpl *source) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::catchain::CatChainReceiverSourceImpl *source) { sb << *source; return sb; } diff --git a/catchain/catchain-receiver.cpp b/catchain/catchain-receiver.cpp index edef90659..a878223f0 100644 --- a/catchain/catchain-receiver.cpp +++ b/catchain/catchain-receiver.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -29,7 +29,7 @@ #include "td/utils/ThreadSafeCounter.h" -namespace ton { +namespace ion { namespace catchain { @@ -77,7 +77,7 @@ void CatChainReceiverImpl::deliver_block(CatChainReceivedBlock *block) { v.push_back(S->get_adnl_id()); } - auto update = create_tl_object(block->export_tl()); + auto update = create_tl_object(block->export_tl()); td::BufferSlice D = serialize_tl_object(update, true, block->get_payload().as_slice()); CHECK(D.size() <= opts_.max_serialized_block_size); @@ -85,7 +85,7 @@ void CatChainReceiverImpl::deliver_block(CatChainReceivedBlock *block) { get_source(local_idx_)->get_adnl_id(), overlay_id_, std::move(D)); } -void CatChainReceiverImpl::receive_block(adnl::AdnlNodeIdShort src, tl_object_ptr block, +void CatChainReceiverImpl::receive_block(adnl::AdnlNodeIdShort src, tl_object_ptr block, td::BufferSlice payload) { CatChainBlockHash id = CatChainReceivedBlock::block_hash(this, block, payload); CatChainReceivedBlock *B = get_block(id); @@ -152,17 +152,17 @@ void CatChainReceiverImpl::receive_block_answer(adnl::AdnlNodeIdShort src, td::B << data.size() << ", limit=" << opts_.max_serialized_block_size << ")"; return; } - auto F = fetch_tl_prefix(data, true); + auto F = fetch_tl_prefix(data, true); if (F.is_error()) { VLOG(CATCHAIN_INFO) << this << ": received bad block result: " << F.move_as_error(); return; } auto f = F.move_as_ok(); - ton_api::downcast_call( + ion_api::downcast_call( *f, td::overloaded( - [&](ton_api::catchain_blockNotFound &r) { VLOG(CATCHAIN_INFO) << this << ": catchain block not found"; }, - [&](ton_api::catchain_blockResult &r) { receive_block(src, std::move(r.block_), std::move(data)); })); + [&](ion_api::catchain_blockNotFound &r) { VLOG(CATCHAIN_INFO) << this << ": catchain block not found"; }, + [&](ion_api::catchain_blockResult &r) { receive_block(src, std::move(r.block_), std::move(data)); })); } void CatChainReceiverImpl::receive_message_from_overlay(adnl::AdnlNodeIdShort src, td::BufferSlice data) { @@ -175,7 +175,7 @@ void CatChainReceiverImpl::receive_message_from_overlay(adnl::AdnlNodeIdShort sr << data.size() << ", limit=" << opts_.max_serialized_block_size << ")"; return; } - auto R = fetch_tl_prefix(data, true); + auto R = fetch_tl_prefix(data, true); if (R.is_error()) { VLOG(CATCHAIN_WARNING) << this << ": dropping broken block from " << src << ": " << R.move_as_error(); return; @@ -192,7 +192,7 @@ void CatChainReceiverImpl::receive_broadcast_from_overlay(const PublicKeyHash &s callback_->on_broadcast(src, std::move(data)); } -CatChainReceivedBlock *CatChainReceiverImpl::create_block(tl_object_ptr block, +CatChainReceivedBlock *CatChainReceiverImpl::create_block(tl_object_ptr block, td::SharedSlice payload) { if (block->height_ == 0) { return root_block_; @@ -211,7 +211,7 @@ CatChainReceivedBlock *CatChainReceiverImpl::create_block(tl_object_ptr block) { +CatChainReceivedBlock *CatChainReceiverImpl::create_block(tl_object_ptr block) { if (block->height_ == 0) { return root_block_; } @@ -226,7 +226,7 @@ CatChainReceivedBlock *CatChainReceiverImpl::create_block(tl_object_ptr &dep) const { +td::Status CatChainReceiverImpl::validate_block_sync(const tl_object_ptr &dep) const { TRY_STATUS_PREFIX(CatChainReceivedBlock::pre_validate_block(this, dep), "failed to validate block: "); if (dep->height_ > 0) { @@ -247,7 +247,7 @@ td::Status CatChainReceiverImpl::validate_block_sync(const tl_object_ptr &block, +td::Status CatChainReceiverImpl::validate_block_sync(const tl_object_ptr &block, const td::Slice &payload) const { TRY_STATUS_PREFIX(CatChainReceivedBlock::pre_validate_block(this, block, payload), "failed to validate block: "); // After pre_validate_block, block->height_ > 0 @@ -283,7 +283,7 @@ CatChainReceivedBlock *CatChainReceiverImpl::get_block(CatChainBlockHash hash) c } } -void CatChainReceiverImpl::add_block_cont_3(tl_object_ptr block, td::BufferSlice payload) { +void CatChainReceiverImpl::add_block_cont_3(tl_object_ptr block, td::BufferSlice payload) { last_sent_block_ = create_block(std::move(block), td::SharedSlice{payload.as_slice()}); last_sent_block_->written(); @@ -302,7 +302,7 @@ void CatChainReceiverImpl::add_block_cont_3(tl_object_ptr block, td::BufferSlice payload) { +void CatChainReceiverImpl::add_block_cont_2(tl_object_ptr block, td::BufferSlice payload) { if (opts_.debug_disable_db) { add_block_cont_3(std::move(block), std::move(payload)); return; @@ -322,7 +322,7 @@ void CatChainReceiverImpl::add_block_cont_2(tl_object_ptr block, td::BufferSlice payload) { +void CatChainReceiverImpl::add_block_cont(tl_object_ptr block, td::BufferSlice payload) { validate_block_sync(block, payload.as_slice()).ensure(); if (opts_.debug_disable_db) { add_block_cont_2(std::move(block), std::move(payload)); @@ -358,7 +358,7 @@ void CatChainReceiverImpl::add_block(td::BufferSlice payload, std::vectorexport_tl_dep(); - std::vector> deps_arr; + std::vector> deps_arr; deps_arr.resize(deps.size()); for (size_t i = 0; i < deps.size(); i++) { CatChainReceivedBlock *B = get_block(deps[i]); @@ -376,8 +376,8 @@ void CatChainReceiverImpl::add_block(td::BufferSlice payload, std::vector(std::move(prev), std::move(deps_arr)); - auto block = create_tl_object(incarnation_, local_idx_, height, std::move(block_data), + auto block_data = create_tl_object(std::move(prev), std::move(deps_arr)); + auto block = create_tl_object(incarnation_, local_idx_, height, std::move(block_data), td::BufferSlice()); auto id = CatChainReceivedBlock::block_id(this, block, payload); @@ -396,7 +396,7 @@ void CatChainReceiverImpl::add_block(td::BufferSlice payload, std::vector block, td::BufferSlice payload) { +void CatChainReceiverImpl::debug_add_fork_cont(tl_object_ptr block, td::BufferSlice payload) { validate_block_sync(block, payload.as_slice()).ensure(); CatChainReceivedBlock *B = create_block(std::move(block), td::SharedSlice{payload.as_slice()}); B->written(); @@ -432,7 +432,7 @@ void CatChainReceiverImpl::debug_add_fork(td::BufferSlice payload, CatChainBlock CHECK(prev); } - std::vector> deps_arr; + std::vector> deps_arr; deps_arr.resize(deps.size()); for (size_t i = 0; i < deps.size(); i++) { CatChainReceivedBlock *B = get_block(deps[i]); @@ -441,8 +441,8 @@ void CatChainReceiverImpl::debug_add_fork(td::BufferSlice payload, CatChainBlock deps_arr[i] = B->export_tl_dep(); } - auto block_data = create_tl_object(prev->export_tl_dep(), std::move(deps_arr)); - auto block = create_tl_object(incarnation_, local_idx_, height, std::move(block_data), + auto block_data = create_tl_object(prev->export_tl_dep(), std::move(deps_arr)); + auto block = create_tl_object(incarnation_, local_idx_, height, std::move(block_data), td::BufferSlice()); auto id = CatChainReceivedBlock::block_id(this, block, payload); @@ -500,7 +500,7 @@ CatChainReceiverImpl::CatChainReceiverImpl(std::unique_ptr callback, } CHECK(local_idx_ != static_cast(ids.size())); - auto F = create_tl_object(unique_hash, std::move(short_ids)); + auto F = create_tl_object(unique_hash, std::move(short_ids)); overlay_full_id_ = overlay::OverlayIdFull{serialize_tl_object(F, true)}; overlay_id_ = overlay_full_id_.compute_short_id(); @@ -582,7 +582,7 @@ void CatChainReceiverImpl::read_db_from(CatChainBlockHash id) { void CatChainReceiverImpl::read_block_from_db(CatChainBlockHash id, td::BufferSlice data) { pending_in_db_--; - auto F = fetch_tl_prefix(data, true); + auto F = fetch_tl_prefix(data, true); F.ensure(); auto block = F.move_as_ok(); @@ -689,29 +689,29 @@ void CatChainReceiverImpl::receive_query_from_overlay(adnl::AdnlNodeIdShort src, } TD_PERF_COUNTER(catchain_query_process); td::PerfWarningTimer t{"catchain query process", 0.05}; - auto F = fetch_tl_object(data.clone(), true); + auto F = fetch_tl_object(data.clone(), true); if (F.is_error()) { callback_->on_custom_query(get_source_by_adnl_id(src)->get_hash(), std::move(data), std::move(promise)); return; } auto f = F.move_as_ok(); - ton_api::downcast_call(*f, [&](auto &obj) { this->process_query(src, std::move(obj), std::move(promise)); }); + ion_api::downcast_call(*f, [&](auto &obj) { this->process_query(src, std::move(obj), std::move(promise)); }); } -void CatChainReceiverImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::catchain_getBlock query, +void CatChainReceiverImpl::process_query(adnl::AdnlNodeIdShort src, ion_api::catchain_getBlock query, td::Promise promise) { auto it = blocks_.find(query.block_); if (it == blocks_.end() || it->second->get_height() == 0 || !it->second->initialized()) { - promise.set_value(serialize_tl_object(create_tl_object(), true)); + promise.set_value(serialize_tl_object(create_tl_object(), true)); } else { CatChainReceiverSource *S = get_source_by_adnl_id(src); CHECK(S != nullptr); - promise.set_value(serialize_tl_object(create_tl_object(it->second->export_tl()), + promise.set_value(serialize_tl_object(create_tl_object(it->second->export_tl()), true, it->second->get_payload().as_slice())); } } -void CatChainReceiverImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::catchain_getDifference query, +void CatChainReceiverImpl::process_query(adnl::AdnlNodeIdShort src, ion_api::catchain_getDifference query, td::Promise promise) { auto &vt = query.rt_; if (vt.size() != get_sources_cnt()) { @@ -723,11 +723,11 @@ void CatChainReceiverImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::cat if (vt[i] >= 0) { CatChainReceiverSource *S = get_source(i); if (S->fork_is_found()) { - auto obj = fetch_tl_object(S->fork_proof(), true); + auto obj = fetch_tl_object(S->fork_proof(), true); obj.ensure(); auto f = obj.move_as_ok(); promise.set_value( - create_serialize_tl_object(std::move(f->left_), std::move(f->right_))); + create_serialize_tl_object(std::move(f->left_), std::move(f->right_))); return; } } @@ -772,7 +772,7 @@ void CatChainReceiverImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::cat CatChainReceivedBlock *M = S->get_block(++vt[i]); CHECK(M != nullptr); if (S0->allow_send_block(M->get_hash())) { - auto block = create_tl_object(M->export_tl()); + auto block = create_tl_object(M->export_tl()); CHECK(!M->get_payload().empty()); td::BufferSlice BB = serialize_tl_object(block, true, M->get_payload().as_slice()); CHECK(BB.size() <= opts_.max_serialized_block_size); @@ -783,11 +783,11 @@ void CatChainReceiverImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::cat } } - promise.set_value(serialize_tl_object(create_tl_object(std::move(vt)), true)); + promise.set_value(serialize_tl_object(create_tl_object(std::move(vt)), true)); } void CatChainReceiverImpl::got_fork_proof(td::BufferSlice data) { - auto F = fetch_tl_object(data, true); + auto F = fetch_tl_object(data, true); if (F.is_error()) { VLOG(CATCHAIN_WARNING) << this << ": received bad fork proof: " << F.move_as_error(); return; @@ -816,7 +816,7 @@ void CatChainReceiverImpl::got_fork_proof(td::BufferSlice data) { CatChainReceiverSource *S = get_source(f->left_->src_); S->on_found_fork_proof( - create_serialize_tl_object(std::move(f->left_), std::move(f->right_))); + create_serialize_tl_object(std::move(f->left_), std::move(f->right_))); S->blame(); } @@ -839,7 +839,7 @@ void CatChainReceiverImpl::synchronize_with(CatChainReceiverSource *S) { return; } td::BufferSlice data = R.move_as_ok(); - auto X = fetch_tl_object(data.clone(), true); + auto X = fetch_tl_object(data.clone(), true); if (X.is_error()) { VLOG(CATCHAIN_WARNING) << print_id << ": received incorrect answer to synchronize query from " << src << ": " << X.move_as_error(); @@ -847,7 +847,7 @@ void CatChainReceiverImpl::synchronize_with(CatChainReceiverSource *S) { } auto A = X.move_as_ok(); - if (A->get_id() == ton_api::catchain_differenceFork::ID) { + if (A->get_id() == ion_api::catchain_differenceFork::ID) { td::actor::send_closure(SelfId, &CatChainReceiverImpl::got_fork_proof, std::move(data)); } // use answer ? @@ -856,7 +856,7 @@ void CatChainReceiverImpl::synchronize_with(CatChainReceiverSource *S) { td::actor::send_closure(overlay_manager_, &overlay::Overlays::send_query, S->get_adnl_id(), get_source(local_idx_)->get_adnl_id(), overlay_id_, "sync", std::move(P), td::Timestamp::in(GET_DIFFERENCE_TIMEOUT), - serialize_tl_object(create_tl_object(std::move(rt)), true)); + serialize_tl_object(create_tl_object(std::move(rt)), true)); if (S->delivered_height() < S->received_height()) { CatChainReceivedBlock *B = S->get_block(S->delivered_height() + 1); @@ -874,7 +874,7 @@ void CatChainReceiverImpl::synchronize_with(CatChainReceiverSource *S) { td::actor::send_closure(SelfId, &CatChainReceiverImpl::receive_block_answer, src, R.move_as_ok()); } }); - td::BufferSlice query = serialize_tl_object(create_tl_object(hash), true); + td::BufferSlice query = serialize_tl_object(create_tl_object(hash), true); td::actor::send_closure(overlay_manager_, &overlay::Overlays::send_query, S->get_adnl_id(), get_source(local_idx_)->get_adnl_id(), overlay_id_, "sync blocks", std::move(PP), td::Timestamp::in(GET_BLOCK_TIMEOUT), std::move(query)); @@ -1088,4 +1088,4 @@ td::uint64 get_max_block_height(const CatChainOptions& opts, size_t sources_cnt) } // namespace catchain -} // namespace ton +} // namespace ion diff --git a/catchain/catchain-receiver.h b/catchain/catchain-receiver.h index 75c873511..b1d87d43e 100644 --- a/catchain/catchain-receiver.h +++ b/catchain/catchain-receiver.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -20,12 +20,12 @@ #include "adnl/adnl.h" #include "adnl/utils.hpp" -#include "auto/tl/ton_api.h" +#include "auto/tl/ion_api.h" #include "catchain-types.h" #include "catchain-receiver-interface.h" -namespace ton { +namespace ion { namespace catchain { @@ -45,9 +45,9 @@ class CatChainReceiver : public CatChainReceiverInterface { PublicKeyHash local_id_; }; virtual PrintId print_id() const = 0; - virtual CatChainReceivedBlock *create_block(tl_object_ptr block, + virtual CatChainReceivedBlock *create_block(tl_object_ptr block, td::SharedSlice payload) = 0; - virtual CatChainReceivedBlock *create_block(tl_object_ptr block) = 0; + virtual CatChainReceivedBlock *create_block(tl_object_ptr block) = 0; virtual CatChainReceiverSource *get_source(td::uint32 source_id) const = 0; virtual PublicKeyHash get_source_hash(td::uint32 source_id) const = 0; virtual td::uint32 get_forks_cnt() const = 0; @@ -61,8 +61,8 @@ class CatChainReceiver : public CatChainReceiverInterface { virtual const CatChainOptions &opts() const = 0; - virtual td::Status validate_block_sync(const tl_object_ptr &dep) const = 0; - virtual td::Status validate_block_sync(const tl_object_ptr &block, + virtual td::Status validate_block_sync(const tl_object_ptr &dep) const = 0; + virtual td::Status validate_block_sync(const tl_object_ptr &block, const td::Slice &payload) const = 0; virtual ~CatChainReceiver() = default; @@ -72,16 +72,16 @@ td::uint64 get_max_block_height(const CatChainOptions& opts, size_t sources_cnt) } // namespace catchain -} // namespace ton +} // namespace ion namespace td { -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::catchain::CatChainReceiver::PrintId &print_id) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::catchain::CatChainReceiver::PrintId &print_id) { sb << "[catchainreceiver " << print_id.instance_ << "@" << print_id.local_id_ << "]"; return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::catchain::CatChainReceiver *catchain) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::catchain::CatChainReceiver *catchain) { sb << catchain->print_id(); return sb; } diff --git a/catchain/catchain-receiver.hpp b/catchain/catchain-receiver.hpp index 5c4d37648..b2bcd7ce9 100644 --- a/catchain/catchain-receiver.hpp +++ b/catchain/catchain-receiver.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -29,7 +29,7 @@ #include "td/db/KeyValueAsync.h" -namespace ton { +namespace ion { namespace catchain { @@ -69,8 +69,8 @@ class CatChainReceiverImpl final : public CatChainReceiver { void receive_message_from_overlay(adnl::AdnlNodeIdShort src, td::BufferSlice data); void receive_query_from_overlay(adnl::AdnlNodeIdShort src, td::BufferSlice data, td::Promise promise); - void process_query(adnl::AdnlNodeIdShort src, ton_api::catchain_getBlock query, td::Promise promise); - void process_query(adnl::AdnlNodeIdShort src, ton_api::catchain_getDifference query, + void process_query(adnl::AdnlNodeIdShort src, ion_api::catchain_getBlock query, td::Promise promise); + void process_query(adnl::AdnlNodeIdShort src, ion_api::catchain_getDifference query, td::Promise promise); template void process_query(adnl::AdnlNodeIdShort src, const T &query, td::Promise promise) { @@ -79,14 +79,14 @@ class CatChainReceiverImpl final : public CatChainReceiver { } void receive_broadcast_from_overlay(const PublicKeyHash &src, td::BufferSlice data); - void receive_block(adnl::AdnlNodeIdShort src, tl_object_ptr block, td::BufferSlice payload); + void receive_block(adnl::AdnlNodeIdShort src, tl_object_ptr block, td::BufferSlice payload); void receive_block_answer(adnl::AdnlNodeIdShort src, td::BufferSlice); - CatChainReceivedBlock *create_block(tl_object_ptr block, td::SharedSlice payload) override; - CatChainReceivedBlock *create_block(tl_object_ptr block) override; + CatChainReceivedBlock *create_block(tl_object_ptr block, td::SharedSlice payload) override; + CatChainReceivedBlock *create_block(tl_object_ptr block) override; - td::Status validate_block_sync(const tl_object_ptr &dep) const override; - td::Status validate_block_sync(const tl_object_ptr &block, + td::Status validate_block_sync(const tl_object_ptr &dep) const override; + td::Status validate_block_sync(const tl_object_ptr &block, const td::Slice &payload) const override; void send_fec_broadcast(td::BufferSlice data) override; @@ -99,12 +99,12 @@ class CatChainReceiverImpl final : public CatChainReceiver { void run_scheduler(); void add_block(td::BufferSlice data, std::vector deps) override; - void add_block_cont(tl_object_ptr block, td::BufferSlice payload); - void add_block_cont_2(tl_object_ptr block, td::BufferSlice payload); - void add_block_cont_3(tl_object_ptr block, td::BufferSlice payload); + void add_block_cont(tl_object_ptr block, td::BufferSlice payload); + void add_block_cont_2(tl_object_ptr block, td::BufferSlice payload); + void add_block_cont_3(tl_object_ptr block, td::BufferSlice payload); void debug_add_fork(td::BufferSlice payload, CatChainBlockHeight height, std::vector deps) override; - void debug_add_fork_cont(tl_object_ptr block, td::BufferSlice payload); + void debug_add_fork_cont(tl_object_ptr block, td::BufferSlice payload); void on_blame(td::uint32 src) override { callback_->blame(src); } @@ -228,11 +228,11 @@ class CatChainReceiverImpl final : public CatChainReceiver { } // namespace catchain -} // namespace ton +} // namespace ion namespace td { -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::catchain::CatChainReceiverImpl *catchain) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::catchain::CatChainReceiverImpl *catchain) { sb << catchain->print_id(); return sb; } diff --git a/catchain/catchain-types.h b/catchain/catchain-types.h index 4031acc51..c41e26fbc 100644 --- a/catchain/catchain-types.h +++ b/catchain/catchain-types.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -20,9 +20,9 @@ #include "td/utils/int_types.h" #include "adnl/adnl-node-id.hpp" -#include "ton/ton-types.h" +#include "ion/ion-types.h" -namespace ton { +namespace ion { namespace catchain { @@ -38,4 +38,4 @@ struct CatChainNode { } // namespace catchain -} // namespace ton +} // namespace ion diff --git a/catchain/catchain.cpp b/catchain/catchain.cpp index 53ae16b52..419108512 100644 --- a/catchain/catchain.cpp +++ b/catchain/catchain.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -22,7 +22,7 @@ #include #include "catchain-receiver.h" -namespace ton { +namespace ion { namespace catchain { @@ -326,4 +326,4 @@ void CatChainImpl::destroy() { } // namespace catchain -} // namespace ton +} // namespace ion diff --git a/catchain/catchain.h b/catchain/catchain.h index c5c8af28d..981a02c6f 100644 --- a/catchain/catchain.h +++ b/catchain/catchain.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -23,7 +23,7 @@ #include "overlay/overlays.h" #include "catchain-types.h" -namespace ton { +namespace ion { namespace catchain { @@ -111,16 +111,16 @@ class CatChain : public td::actor::Actor { } // namespace catchain -} // namespace ton +} // namespace ion namespace td { -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::catchain::CatChain::PrintId &print_id) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::catchain::CatChain::PrintId &print_id) { sb << "[catchain " << print_id.instance_ << "@" << print_id.local_id_ << "]"; return sb; } -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::catchain::CatChain *catchain) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::catchain::CatChain *catchain) { sb << catchain->print_id(); return sb; } diff --git a/catchain/catchain.hpp b/catchain/catchain.hpp index 586cf4744..88e912b74 100644 --- a/catchain/catchain.hpp +++ b/catchain/catchain.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -25,7 +25,7 @@ #include "catchain-receiver-interface.h" #include "td/utils/DecTree.h" -namespace ton { +namespace ion { namespace catchain { @@ -137,11 +137,11 @@ class CatChainImpl : public CatChain { } // namespace catchain -} // namespace ton +} // namespace ion namespace td { -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::catchain::CatChainImpl *catchain) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::catchain::CatChainImpl *catchain) { sb << catchain->print_id(); return sb; } diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 88a3671b3..8473b176f 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -19,4 +19,4 @@ target_include_directories(common PUBLIC $/.. ${OPENSSL_INCLUDE_DIR} ) -target_link_libraries(common PRIVATE tdutils ton_crypto ) +target_link_libraries(common PRIVATE tdutils ion_crypto ) diff --git a/common/checksum.h b/common/checksum.h index ff6922395..f7dfe6ccb 100644 --- a/common/checksum.h +++ b/common/checksum.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/common/delay.h b/common/delay.h index 3df8e7d86..ffd401eb8 100644 --- a/common/delay.h +++ b/common/delay.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -20,7 +20,7 @@ #include "td/actor/actor.h" -namespace ton { +namespace ion { template class DelayedAction : public td::actor::Actor { @@ -74,4 +74,4 @@ template void async_apply(td::Slice name, PromiseT &&promise, ValueT &&value) { AsyncApply::create(name, std::forward(promise), std::forward(value)); } -} // namespace ton +} // namespace ion diff --git a/common/errorcode.h b/common/errorcode.h index b95e7fc2b..0e81e1d3c 100644 --- a/common/errorcode.h +++ b/common/errorcode.h @@ -1,24 +1,24 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #pragma once -namespace ton { +namespace ion { enum ErrorCode : int { failure = 601, diff --git a/common/errorlog.cpp b/common/errorlog.cpp index a06166986..4d59a1a87 100644 --- a/common/errorlog.cpp +++ b/common/errorlog.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -26,7 +26,7 @@ #include -namespace ton { +namespace ion { namespace errorlog { @@ -71,4 +71,4 @@ void ErrorLog::log_file(td::BufferSlice data) { } // namespace errorlog -} // namespace ton +} // namespace ion diff --git a/common/errorlog.h b/common/errorlog.h index 884bfc4d6..28f3605a4 100644 --- a/common/errorlog.h +++ b/common/errorlog.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include #include "td/utils/buffer.h" -namespace ton { +namespace ion { namespace errorlog { @@ -34,4 +34,4 @@ class ErrorLog { } // namespace errorlog -} // namespace ton +} // namespace ion diff --git a/common/global-version.h b/common/global-version.h index 533e5e8d7..855186ae4 100644 --- a/common/global-version.h +++ b/common/global-version.h @@ -1,22 +1,22 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #pragma once -namespace ton { +namespace ion { // See doc/GlobalVersions.md const int SUPPORTED_VERSION = 9; diff --git a/common/int-to-string.hpp b/common/int-to-string.hpp index 88aecc654..d78215e60 100644 --- a/common/int-to-string.hpp +++ b/common/int-to-string.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "td/utils/int_types.h" #include "td/utils/Slice.h" -namespace ton { +namespace ion { template typename std::enable_if_t::value, td::MutableSlice> store_int_to_slice(td::MutableSlice S, @@ -39,4 +39,4 @@ typename std::enable_if_t::value, T> fetch_int_from_slice(td return v; } -} // namespace ton +} // namespace ion diff --git a/common/io.hpp b/common/io.hpp index e328636f9..92b235bdf 100644 --- a/common/io.hpp +++ b/common/io.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -38,7 +38,7 @@ StringBuilder &operator<<(StringBuilder &stream, const td::BitArray &x) { return stream << td::base64_encode(as_slice(x)); } -inline StringBuilder &operator<<(StringBuilder &stream, const ton::PublicKeyHash &value) { +inline StringBuilder &operator<<(StringBuilder &stream, const ion::PublicKeyHash &value) { return stream << value.bits256_value(); } diff --git a/common/status.h b/common/status.h index dacc7ee53..e94234c7f 100644 --- a/common/status.h +++ b/common/status.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/create-hardfork/CMakeLists.txt b/create-hardfork/CMakeLists.txt index 3024603c2..41a598d4e 100644 --- a/create-hardfork/CMakeLists.txt +++ b/create-hardfork/CMakeLists.txt @@ -10,7 +10,7 @@ set(CREATE_HARDFORK_SOURCE ) add_executable(create-hardfork ${CREATE_HARDFORK_SOURCE}) -target_link_libraries(create-hardfork overlay tdutils tdactor adnl tl_api dht rldp catchain validatorsession full-node validator-hardfork ton_validator +target_link_libraries(create-hardfork overlay tdutils tdactor adnl tl_api dht rldp catchain validatorsession full-node validator-hardfork ion_validator validator-hardfork fift-lib memprof git ${JEMALLOC_LIBRARIES}) install(TARGETS create-hardfork RUNTIME DESTINATION bin) diff --git a/create-hardfork/create-hardfork.cpp b/create-hardfork/create-hardfork.cpp index 501ce3b93..b2bf13dd2 100644 --- a/create-hardfork/create-hardfork.cpp +++ b/create-hardfork/create-hardfork.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -27,7 +27,7 @@ */ #include "adnl/adnl.h" #include "adnl/utils.hpp" -#include "auto/tl/ton_api_json.h" +#include "auto/tl/ion_api_json.h" #include "dht/dht.h" #include "overlay/overlays.h" #include "td/utils/OptionParser.h" @@ -43,9 +43,9 @@ #include "td/utils/filesystem.h" #include "td/utils/port/path.h" -#include "ton/ton-types.h" -#include "ton/ton-tl.hpp" -#include "ton/ton-io.hpp" +#include "ion/ion-types.h" +#include "ion/ion-tl.hpp" +#include "ion/ion-io.hpp" #include "validator/fabric.h" #include "validator/impl/collator.h" @@ -78,20 +78,20 @@ struct IntError { class HardforkCreator : public td::actor::Actor { private: - td::actor::ActorOwn validator_manager_; + td::actor::ActorOwn validator_manager_; - std::string db_root_ = "/var/ton-work/db/"; + std::string db_root_ = "/var/ion-work/db/"; std::string global_config_; - td::Ref opts_; + td::Ref opts_; td::BufferSlice bs_; std::vector ext_msgs_; std::vector top_shard_descrs_; bool need_save_file_{false}; bool tdescr_save_{false}; std::string tdescr_pfx_; - ton::BlockIdExt shard_top_block_id_; + ion::BlockIdExt shard_top_block_id_; - ton::ShardIdFull shard_{ton::masterchainId}; + ion::ShardIdFull shard_{ion::masterchainId}; public: void set_db_root(std::string db_root) { @@ -100,11 +100,11 @@ class HardforkCreator : public td::actor::Actor { void set_global_config_path(std::string path) { global_config_ = path; } - void set_shard(ton::ShardIdFull shard) { + void set_shard(ion::ShardIdFull shard) { LOG(DEBUG) << "setting shard to " << shard.to_str(); shard_ = shard; } - void set_shard_top_block(ton::BlockIdExt block_id) { + void set_shard_top_block(ion::BlockIdExt block_id) { shard_top_block_id_ = block_id; } void set_top_descr_prefix(std::string tdescr_pfx) { @@ -112,7 +112,7 @@ class HardforkCreator : public td::actor::Actor { tdescr_save_ = true; } void set_collator_flags(int flags) { - ton::collator_settings |= flags; + ion::collator_settings |= flags; } void start_up() override { } @@ -152,35 +152,35 @@ class HardforkCreator : public td::actor::Actor { td::Status create_validator_options() { if(!global_config_.length()) { - opts_ = ton::validator::ValidatorManagerOptions::create( - ton::BlockIdExt{ton::masterchainId, ton::shardIdAll, 0, ton::RootHash::zero(), ton::FileHash::zero()}, - ton::BlockIdExt{ton::masterchainId, ton::shardIdAll, 0, ton::RootHash::zero(), ton::FileHash::zero()}); + opts_ = ion::validator::ValidatorManagerOptions::create( + ion::BlockIdExt{ion::masterchainId, ion::shardIdAll, 0, ion::RootHash::zero(), ion::FileHash::zero()}, + ion::BlockIdExt{ion::masterchainId, ion::shardIdAll, 0, ion::RootHash::zero(), ion::FileHash::zero()}); return td::Status::OK(); } TRY_RESULT_PREFIX(conf_data, td::read_file(global_config_), "failed to read: "); TRY_RESULT_PREFIX(conf_json, td::json_decode(conf_data.as_slice()), "failed to parse json: "); - ton::ton_api::config_global conf; - TRY_STATUS_PREFIX(ton::ton_api::from_json(conf, conf_json.get_object()), "json does not fit TL scheme: "); + ion::ion_api::config_global conf; + TRY_STATUS_PREFIX(ion::ion_api::from_json(conf, conf_json.get_object()), "json does not fit TL scheme: "); - auto zero_state = ton::create_block_id(conf.validator_->zero_state_); - ton::BlockIdExt init_block; + auto zero_state = ion::create_block_id(conf.validator_->zero_state_); + ion::BlockIdExt init_block; if (!conf.validator_->init_block_) { LOG(INFO) << "no init block in config. using zero state"; init_block = zero_state; } else { - init_block = ton::create_block_id(conf.validator_->init_block_); + init_block = ion::create_block_id(conf.validator_->init_block_); } - opts_ = ton::validator::ValidatorManagerOptions::create(zero_state, init_block); - std::vector h; + opts_ = ion::validator::ValidatorManagerOptions::create(zero_state, init_block); + std::vector h; for (auto &x : conf.validator_->hardforks_) { - auto b = ton::create_block_id(x); + auto b = ion::create_block_id(x); if (!b.is_masterchain()) { - return td::Status::Error(ton::ErrorCode::error, + return td::Status::Error(ion::ErrorCode::error, "[validator/hardforks] section contains not masterchain block id"); } if (!b.is_valid_full()) { - return td::Status::Error(ton::ErrorCode::error, "[validator/hardforks] section contains invalid block_id"); + return td::Status::Error(ion::ErrorCode::error, "[validator/hardforks] section contains invalid block_id"); } for (auto &y : h) { if (y.is_valid() && y.seqno() >= b.seqno()) { @@ -195,7 +195,7 @@ class HardforkCreator : public td::actor::Actor { void run() { td::mkdir(db_root_).ensure(); - ton::errorlog::ErrorLog::create(db_root_); + ion::errorlog::ErrorLog::create(db_root_); if (!shard_.is_masterchain() && need_save_file_) { td::mkdir(db_root_ + "/static").ensure(); do_save_file(); @@ -210,76 +210,76 @@ class HardforkCreator : public td::actor::Actor { auto opts = opts_; opts.write().set_initial_sync_disabled(true); validator_manager_ = - ton::validator::ValidatorManagerHardforkFactory::create(opts, shard_, shard_top_block_id_, db_root_); + ion::validator::ValidatorManagerHardforkFactory::create(opts, shard_, shard_top_block_id_, db_root_); for (auto &msg : ext_msgs_) { - td::actor::send_closure(validator_manager_, &ton::validator::ValidatorManager::new_external_message, + td::actor::send_closure(validator_manager_, &ion::validator::ValidatorManager::new_external_message, std::move(msg), 0); } for (auto &topmsg : top_shard_descrs_) { - td::actor::send_closure(validator_manager_, &ton::validator::ValidatorManager::new_shard_block, ton::BlockIdExt{}, + td::actor::send_closure(validator_manager_, &ion::validator::ValidatorManager::new_shard_block, ion::BlockIdExt{}, 0, std::move(topmsg)); } - class Callback : public ton::validator::ValidatorManagerInterface::Callback { + class Callback : public ion::validator::ValidatorManagerInterface::Callback { private: - td::actor::ActorId id_; + td::actor::ActorId id_; bool tdescr_save_; std::string tdescr_pfx_; int tdescr_cnt_ = 0; public: - Callback(td::actor::ActorId id, bool tdescr_save = false, + Callback(td::actor::ActorId id, bool tdescr_save = false, std::string tdescr_pfx = "") : id_(id), tdescr_save_(tdescr_save), tdescr_pfx_(tdescr_pfx) { } - void initial_read_complete(ton::validator::BlockHandle handle) override { - td::actor::send_closure(id_, &ton::validator::ValidatorManager::sync_complete, + void initial_read_complete(ion::validator::BlockHandle handle) override { + td::actor::send_closure(id_, &ion::validator::ValidatorManager::sync_complete, td::PromiseCreator::lambda([](td::Unit) {})); } - void add_shard(ton::ShardIdFull) override { + void add_shard(ion::ShardIdFull) override { } - void del_shard(ton::ShardIdFull) override { + void del_shard(ion::ShardIdFull) override { } - void send_ihr_message(ton::AccountIdPrefixFull dst, td::BufferSlice data) override { + void send_ihr_message(ion::AccountIdPrefixFull dst, td::BufferSlice data) override { } - void send_ext_message(ton::AccountIdPrefixFull dst, td::BufferSlice data) override { + void send_ext_message(ion::AccountIdPrefixFull dst, td::BufferSlice data) override { } - void send_shard_block_info(ton::BlockIdExt block_id, ton::CatchainSeqno cc_seqno, td::BufferSlice data) override { + void send_shard_block_info(ion::BlockIdExt block_id, ion::CatchainSeqno cc_seqno, td::BufferSlice data) override { } - void send_block_candidate(ton::BlockIdExt block_id, ton::CatchainSeqno cc_seqno, td::uint32 validator_set_hash, + void send_block_candidate(ion::BlockIdExt block_id, ion::CatchainSeqno cc_seqno, td::uint32 validator_set_hash, td::BufferSlice data) override { } - void send_broadcast(ton::BlockBroadcast broadcast, int mode) override { + void send_broadcast(ion::BlockBroadcast broadcast, int mode) override { } - void download_block(ton::BlockIdExt block_id, td::uint32 priority, td::Timestamp timeout, - td::Promise promise) override { + void download_block(ion::BlockIdExt block_id, td::uint32 priority, td::Timestamp timeout, + td::Promise promise) override { } - void download_zero_state(ton::BlockIdExt block_id, td::uint32 priority, td::Timestamp timeout, + void download_zero_state(ion::BlockIdExt block_id, td::uint32 priority, td::Timestamp timeout, td::Promise promise) override { } - void download_persistent_state(ton::BlockIdExt block_id, ton::BlockIdExt masterchain_block_id, + void download_persistent_state(ion::BlockIdExt block_id, ion::BlockIdExt masterchain_block_id, td::uint32 priority, td::Timestamp timeout, td::Promise promise) override { } - void download_block_proof(ton::BlockIdExt block_id, td::uint32 priority, td::Timestamp timeout, + void download_block_proof(ion::BlockIdExt block_id, td::uint32 priority, td::Timestamp timeout, td::Promise promise) override { } - void download_block_proof_link(ton::BlockIdExt block_id, td::uint32 priority, td::Timestamp timeout, + void download_block_proof_link(ion::BlockIdExt block_id, td::uint32 priority, td::Timestamp timeout, td::Promise promise) override { } - void get_next_key_blocks(ton::BlockIdExt block_id, td::Timestamp timeout, - td::Promise> promise) override { + void get_next_key_blocks(ion::BlockIdExt block_id, td::Timestamp timeout, + td::Promise> promise) override { } - void download_archive(ton::BlockSeqno masterchain_seqno, std::string tmp_dir, td::Timestamp timeout, + void download_archive(ion::BlockSeqno masterchain_seqno, std::string tmp_dir, td::Timestamp timeout, td::Promise promise) override { } - void new_key_block(ton::validator::BlockHandle handle) override { + void new_key_block(ion::validator::BlockHandle handle) override { } }; - td::actor::send_closure(validator_manager_, &ton::validator::ValidatorManagerInterface::install_callback, + td::actor::send_closure(validator_manager_, &ion::validator::ValidatorManagerInterface::install_callback, std::make_unique(validator_manager_.get(), tdescr_save_, tdescr_pfx_), td::PromiseCreator::lambda([](td::Unit) {})); } @@ -341,7 +341,7 @@ int main(int argc, char *argv[]) { SET_VERBOSITY_LEVEL(v); }); p.add_checked_option('w', "workchain", "[:]\tcollate block in this workchain", [&](td::Slice arg) { - ton::ShardId shard = 0; + ion::ShardId shard = 0; auto pos = std::min(arg.find(':'), arg.size()); TRY_RESULT(workchain, td::to_integer_safe(arg.substr(0, pos))); int s = 60; @@ -350,16 +350,16 @@ int main(int argc, char *argv[]) { if (x < 0 || s < 0) { return td::Status::Error("cannot parse hexadecimal shard id (prefix)"); } - shard |= (ton::ShardId(x) << s); + shard |= (ion::ShardId(x) << s); s -= 4; } td::actor::send_closure(x, &HardforkCreator::set_shard, - ton::ShardIdFull{workchain, shard ? shard : ton::shardIdAll}); + ion::ShardIdFull{workchain, shard ? shard : ion::shardIdAll}); return td::Status::OK(); }); p.add_checked_option('T', "top-block", "BlockIdExt of top block (new block will be generated atop of it)", [&](td::Slice arg) { - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; if (block::parse_block_id_ext(arg, block_id)) { LOG(INFO) << "setting previous block to " << block_id.to_str(); td::actor::send_closure(x, &HardforkCreator::set_shard_top_block, block_id); diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index c2a737149..00c8b43cc 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -4,7 +4,7 @@ if (NOT OPENSSL_FOUND) find_package(OpenSSL REQUIRED) endif() -set(TON_CRYPTO_CORE_SOURCE +set(ION_CRYPTO_CORE_SOURCE Ed25519.cpp common/bigint.cpp common/refcnt.cpp @@ -97,7 +97,7 @@ set(TON_CRYPTO_CORE_SOURCE ellcurve/p256.h ellcurve/p256.cpp) -set(TON_CRYPTO_SOURCE +set(ION_CRYPTO_SOURCE vm/stack.cpp vm/atom.cpp vm/continuation.cpp @@ -112,7 +112,7 @@ set(TON_CRYPTO_SOURCE vm/contops.cpp vm/dictops.cpp vm/debugops.cpp - vm/tonops.cpp + vm/ionops.cpp vm/utils.cpp vm/vm.cpp vm/bls.cpp @@ -136,13 +136,13 @@ set(TON_CRYPTO_SOURCE vm/stack.hpp vm/stackops.h vm/tupleops.h - vm/tonops.h + vm/ionops.h vm/vmstate.h vm/utils.h vm/vm.h vm/bls.h) -set(TON_DB_SOURCE +set(ION_DB_SOURCE vm/db/DynamicBagOfCellsDb.cpp vm/db/CellStorage.cpp vm/db/TonDb.cpp @@ -259,7 +259,7 @@ set(ED25519_TEST_SOURCE PARENT_SCOPE ) -set(TONDB_TEST_SOURCE +set(IONDB_TEST_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/test/test-db.cpp PARENT_SCOPE ) @@ -269,7 +269,7 @@ set(CELLS_TEST_SOURCE PARENT_SCOPE ) -set(TONVM_TEST_SOURCE +set(IONVM_TEST_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/test/vm.cpp PARENT_SCOPE ) @@ -291,35 +291,35 @@ set(BIGINT_TEST_SOURCE set(USE_EMSCRIPTEN ${USE_EMSCRIPTEN} PARENT_SCOPE) -add_library(ton_crypto_core STATIC ${TON_CRYPTO_CORE_SOURCE}) -target_include_directories(ton_crypto_core PUBLIC $ +add_library(ion_crypto_core STATIC ${ION_CRYPTO_CORE_SOURCE}) +target_include_directories(ion_crypto_core PUBLIC $ $) -target_link_libraries(ton_crypto_core PUBLIC ${OPENSSL_CRYPTO_LIBRARY} tdutils tddb_utils) +target_link_libraries(ion_crypto_core PUBLIC ${OPENSSL_CRYPTO_LIBRARY} tdutils tddb_utils) if (NOT WIN32) - target_link_libraries(ton_crypto_core PUBLIC dl z) + target_link_libraries(ion_crypto_core PUBLIC dl z) endif() -target_include_directories(ton_crypto_core SYSTEM PUBLIC $) +target_include_directories(ion_crypto_core SYSTEM PUBLIC $) -add_library(ton_crypto STATIC ${TON_CRYPTO_SOURCE}) -target_include_directories(ton_crypto PUBLIC $ $) -target_link_libraries(ton_crypto PUBLIC ${OPENSSL_CRYPTO_LIBRARY} ton_crypto_core ton_block) +add_library(ion_crypto STATIC ${ION_CRYPTO_SOURCE}) +target_include_directories(ion_crypto PUBLIC $ $) +target_link_libraries(ion_crypto PUBLIC ${OPENSSL_CRYPTO_LIBRARY} ion_crypto_core ion_block) if (USE_EMSCRIPTEN) - target_link_options(ton_crypto PRIVATE -fexceptions) - target_compile_options(ton_crypto PRIVATE -fexceptions) + target_link_options(ion_crypto PRIVATE -fexceptions) + target_compile_options(ion_crypto PRIVATE -fexceptions) endif() if (NOT WIN32) find_library(DL dl) if (DL) - target_link_libraries(ton_crypto PUBLIC dl z) + target_link_libraries(ion_crypto PUBLIC dl z) else() - target_link_libraries(ton_crypto PUBLIC z) + target_link_libraries(ion_crypto PUBLIC z) endif() endif() -target_include_directories(ton_crypto SYSTEM PUBLIC $) +target_include_directories(ion_crypto SYSTEM PUBLIC $) -add_dependencies(ton_crypto blst) -target_include_directories(ton_crypto PRIVATE ${BLST_INCLUDE_DIR}) -target_link_libraries(ton_crypto PRIVATE ${BLST_LIB}) +add_dependencies(ion_crypto blst) +target_include_directories(ion_crypto PRIVATE ${BLST_INCLUDE_DIR}) +target_link_libraries(ion_crypto PRIVATE ${BLST_LIB}) if (NOT USE_EMSCRIPTEN) find_package(Secp256k1 REQUIRED) @@ -327,39 +327,39 @@ endif() if (MSVC) find_package(Sodium REQUIRED) - target_compile_definitions(ton_crypto PUBLIC SODIUM_STATIC) - target_include_directories(ton_crypto_core PUBLIC $) - target_link_libraries(ton_crypto PUBLIC ${SECP256K1_LIBRARY}) + target_compile_definitions(ion_crypto PUBLIC SODIUM_STATIC) + target_include_directories(ion_crypto_core PUBLIC $) + target_link_libraries(ion_crypto PUBLIC ${SECP256K1_LIBRARY}) elseif (ANDROID OR EMSCRIPTEN) - target_include_directories(ton_crypto_core PUBLIC $) - target_link_libraries(ton_crypto PUBLIC $) + target_include_directories(ion_crypto_core PUBLIC $) + target_link_libraries(ion_crypto PUBLIC $) else() if (NOT SODIUM_FOUND) find_package(Sodium REQUIRED) else() message(STATUS "Using Sodium ${SODIUM_LIBRARY_RELEASE}") endif() - target_compile_definitions(ton_crypto PUBLIC SODIUM_STATIC) - target_include_directories(ton_crypto_core PUBLIC $) - target_link_libraries(ton_crypto PUBLIC ${SECP256K1_LIBRARY}) + target_compile_definitions(ion_crypto PUBLIC SODIUM_STATIC) + target_include_directories(ion_crypto_core PUBLIC $) + target_link_libraries(ion_crypto PUBLIC ${SECP256K1_LIBRARY}) endif() -target_link_libraries(ton_crypto_core PUBLIC ${SECP256K1_LIBRARY}) -target_include_directories(ton_crypto_core PUBLIC $) -target_link_libraries(ton_crypto PUBLIC ${SODIUM_LIBRARY_RELEASE}) +target_link_libraries(ion_crypto_core PUBLIC ${SECP256K1_LIBRARY}) +target_include_directories(ion_crypto_core PUBLIC $) +target_link_libraries(ion_crypto PUBLIC ${SODIUM_LIBRARY_RELEASE}) -add_library(ton_db STATIC ${TON_DB_SOURCE}) -target_include_directories(ton_db PUBLIC $ +add_library(ion_db STATIC ${ION_DB_SOURCE}) +target_include_directories(ion_db PUBLIC $ $) -target_link_libraries(ton_db PUBLIC tdutils tddb ton_crypto) +target_link_libraries(ion_db PUBLIC tdutils tddb ion_crypto) add_executable(test-ed25519-crypto test/test-ed25519-crypto.cpp) target_include_directories(test-ed25519-crypto PUBLIC $) -target_link_libraries(test-ed25519-crypto PUBLIC ton_crypto) +target_link_libraries(test-ed25519-crypto PUBLIC ion_crypto) add_library(fift-lib STATIC ${FIFT_SOURCE}) target_include_directories(fift-lib PUBLIC $) -target_link_libraries(fift-lib PUBLIC ton_crypto) +target_link_libraries(fift-lib PUBLIC ion_crypto) if (USE_EMSCRIPTEN) target_link_options(fift-lib PRIVATE -fexceptions) @@ -375,20 +375,20 @@ endif() add_library(src_parser ${PARSER_SOURCE}) target_include_directories(src_parser PUBLIC $) -target_link_libraries(src_parser PUBLIC ton_crypto_core) +target_link_libraries(src_parser PUBLIC ion_crypto_core) -add_library(ton_block STATIC ${BLOCK_SOURCE}) -target_include_directories(ton_block PUBLIC $ +add_library(ion_block STATIC ${BLOCK_SOURCE}) +target_include_directories(ion_block PUBLIC $ $ $) -target_link_libraries(ton_block PUBLIC ton_crypto_core tdactor tl_api) +target_link_libraries(ion_block PUBLIC ion_crypto_core tdactor tl_api) if (USE_EMSCRIPTEN) - target_link_options(ton_block PRIVATE -fexceptions) - target_compile_options(ton_block PRIVATE -fexceptions) + target_link_options(ion_block PRIVATE -fexceptions) + target_compile_options(ion_block PRIVATE -fexceptions) endif() add_executable(func func/func-main.cpp ${FUNC_LIB_SOURCE}) target_include_directories(func PUBLIC $) -target_link_libraries(func PUBLIC ton_crypto src_parser git) +target_link_libraries(func PUBLIC ion_crypto src_parser git) if (WINGETOPT_FOUND) target_link_libraries_system(func wingetopt) endif() @@ -424,10 +424,10 @@ endif() add_library(pow-miner-lib util/Miner.cpp util/Miner.h) target_include_directories(pow-miner-lib PUBLIC $) -target_link_libraries(pow-miner-lib PUBLIC ton_crypto) +target_link_libraries(pow-miner-lib PUBLIC ion_crypto) add_executable(pow-miner util/pow-miner.cpp) -target_link_libraries(pow-miner PRIVATE ton_crypto pow-miner-lib git) +target_link_libraries(pow-miner PRIVATE ion_crypto pow-miner-lib git) if (WINGETOPT_FOUND) target_link_libraries_system(fift wingetopt) @@ -435,15 +435,15 @@ if (WINGETOPT_FOUND) endif() add_executable(mintless-proof-generator util/mintless-proof-generator.cpp) -target_link_libraries(mintless-proof-generator PRIVATE ton_crypto git ${JEMALLOC_LIBRARIES}) +target_link_libraries(mintless-proof-generator PRIVATE ion_crypto git ${JEMALLOC_LIBRARIES}) if (JEMALLOC_FOUND) target_include_directories(mintless-proof-generator PRIVATE ${JEMALLOC_INCLUDE_DIR}) - target_compile_definitions(mintless-proof-generator PRIVATE -DTON_USE_JEMALLOC=1) + target_compile_definitions(mintless-proof-generator PRIVATE -DION_USE_JEMALLOC=1) endif() set(TURN_OFF_LSAN cd .) -if (TON_USE_ASAN AND NOT WIN32) +if (ION_USE_ASAN AND NOT WIN32) set(TURN_OFF_LSAN export LSAN_OPTIONS=detect_leaks=0) endif() @@ -469,7 +469,7 @@ if (NOT CMAKE_CROSSCOMPILING OR USE_EMSCRIPTEN) ) endif() add_custom_target(tlb_generate_block DEPENDS ${TLB_BLOCK_AUTO}) - add_dependencies(ton_block tlb_generate_block) + add_dependencies(ion_block tlb_generate_block) add_custom_target(gen_fif ALL) function(GenFif) @@ -531,7 +531,7 @@ endif() add_library(smc-envelope STATIC ${SMC_ENVELOPE_SOURCE}) target_include_directories(smc-envelope PUBLIC $) -target_link_libraries(smc-envelope PUBLIC ton_crypto PRIVATE tdutils ton_block) +target_link_libraries(smc-envelope PUBLIC ion_crypto PRIVATE tdutils ion_block) if (NOT CMAKE_CROSSCOMPILING) add_dependencies(smc-envelope gen_fif) endif() @@ -540,12 +540,12 @@ add_executable(create-state block/create-state.cpp) target_include_directories(create-state PUBLIC $ $) if (INTERNAL_COMPILE) - target_link_libraries(create-state PUBLIC ton_crypto fift-lib tonlib git) + target_link_libraries(create-state PUBLIC ion_crypto fift-lib tonlib git) else() if (TONLIB_COMPILE) - target_link_libraries(create-state PUBLIC ton_crypto fift-lib tonlib git) + target_link_libraries(create-state PUBLIC ion_crypto fift-lib tonlib git) else() - target_link_libraries(create-state PUBLIC ton_crypto fift-lib git) + target_link_libraries(create-state PUBLIC ion_crypto fift-lib git) endif() endif() if (WINGETOPT_FOUND) @@ -555,7 +555,7 @@ endif() add_executable(dump-block block/dump-block.cpp) target_include_directories(dump-block PUBLIC $ $) -target_link_libraries(dump-block PUBLIC ton_crypto fift-lib git) +target_link_libraries(dump-block PUBLIC ion_crypto fift-lib git) if (WINGETOPT_FOUND) target_link_libraries_system(dump-block wingetopt) endif() @@ -563,7 +563,7 @@ endif() add_executable(adjust-block block/adjust-block.cpp) target_include_directories(adjust-block PUBLIC $ $) -target_link_libraries(adjust-block PUBLIC ton_crypto fift-lib git) +target_link_libraries(adjust-block PUBLIC ion_crypto fift-lib git) if (WINGETOPT_FOUND) target_link_libraries_system(dump-block wingetopt) target_link_libraries_system(adjust-block wingetopt) @@ -572,11 +572,11 @@ endif() add_executable(test-weight-distr block/test-weight-distr.cpp) target_include_directories(test-weight-distr PUBLIC $ $) -target_link_libraries(test-weight-distr PUBLIC ton_crypto fift-lib git) +target_link_libraries(test-weight-distr PUBLIC ion_crypto fift-lib git) if (WINGETOPT_FOUND) target_link_libraries_system(test-weight-distr wingetopt) endif() install(TARGETS fift func create-state tlbc RUNTIME DESTINATION bin) install(DIRECTORY fift/lib/ DESTINATION lib/fift) -install(DIRECTORY smartcont DESTINATION share/ton) +install(DIRECTORY smartcont DESTINATION share/ion) diff --git a/crypto/Ed25519.cpp b/crypto/Ed25519.cpp index c263a0cf1..396cd7fe9 100644 --- a/crypto/Ed25519.cpp +++ b/crypto/Ed25519.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/Ed25519.h b/crypto/Ed25519.h index a3340d2ec..733f9bb1e 100644 --- a/crypto/Ed25519.h +++ b/crypto/Ed25519.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/block/Binlog.cpp b/crypto/block/Binlog.cpp index b774e6931..6c56dd21e 100644 --- a/crypto/block/Binlog.cpp +++ b/crypto/block/Binlog.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/block/Binlog.h b/crypto/block/Binlog.h index 64142fe80..0b5500ac4 100644 --- a/crypto/block/Binlog.h +++ b/crypto/block/Binlog.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/block/adjust-block.cpp b/crypto/block/adjust-block.cpp index 16c77691b..f63005cd0 100644 --- a/crypto/block/adjust-block.cpp +++ b/crypto/block/adjust-block.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -61,13 +61,13 @@ static inline void fail_unless(td::Status res) { } } -td::Ref load_block(std::string filename, ton::BlockIdExt& id) { +td::Ref load_block(std::string filename, ion::BlockIdExt& id) { std::cerr << "loading block from bag-of-cell file " << filename << std::endl; auto bytes_res = block::load_binary_file(filename); if (bytes_res.is_error()) { throw IntError{PSTRING() << "cannot load file `" << filename << "` : " << bytes_res.move_as_error()}; } - ton::FileHash fhash; + ion::FileHash fhash; td::sha256(bytes_res.ok(), fhash.as_slice()); vm::BagOfCells boc; auto res = boc.deserialize(bytes_res.move_as_ok()); @@ -78,8 +78,8 @@ td::Ref load_block(std::string filename, ton::BlockIdExt& id) { throw IntError{"cannot deserialize bag-of-cells"}; } auto root = boc.get_root_cell(); - std::vector prev; - ton::BlockIdExt mc_blkid; + std::vector prev; + ion::BlockIdExt mc_blkid; bool after_split; fail_unless(block::unpack_block_prev_blk_try(root, id, prev, mc_blkid, after_split, &id)); id.file_hash = fhash; @@ -87,7 +87,7 @@ td::Ref load_block(std::string filename, ton::BlockIdExt& id) { return root; } -bool save_block(std::string filename, Ref root, ton::BlockIdExt& id) { +bool save_block(std::string filename, Ref root, ion::BlockIdExt& id) { std::cerr << "saving block into bag-of-cell file " << filename << std::endl; if (root.is_null()) { throw IntError{"new block has no root"}; @@ -107,9 +107,9 @@ bool save_block(std::string filename, Ref root, ton::BlockIdExt& id) { return true; } -Ref adjust_block(Ref root, int vseqno_incr, const ton::BlockIdExt& id) { - std::vector prev; - ton::BlockIdExt mc_blkid; +Ref adjust_block(Ref root, int vseqno_incr, const ion::BlockIdExt& id) { + std::vector prev; + ion::BlockIdExt mc_blkid; bool after_split; fail_unless(block::unpack_block_prev_blk_try(root, id, prev, mc_blkid, after_split)); std::cerr << "unpacked header of block " << id.to_str() << std::endl; @@ -174,7 +174,7 @@ int main(int argc, char* const argv[]) { in_fname = argv[optind]; out_fname = argv[optind + 1]; try { - ton::BlockIdExt old_id, new_id; + ion::BlockIdExt old_id, new_id; auto root = load_block(in_fname, old_id); if (root.is_null()) { return fatal("cannot load BoC from file "s + in_fname); diff --git a/crypto/block/block-binlog.h b/crypto/block/block-binlog.h index 904f4c732..2bac2c0fb 100644 --- a/crypto/block/block-binlog.h +++ b/crypto/block/block-binlog.h @@ -1,24 +1,24 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #pragma once #include "td/utils/int_types.h" -#include "ton/ton-types.h" +#include "ion/ion-types.h" #include @@ -66,7 +66,7 @@ struct NewBlock { unsigned char file_hash[32]; unsigned char root_hash[32]; unsigned char last_bytes[8]; - NewBlock(const ton::BlockId& block, const RootHash& rhash, const FileHash& fhash, unsigned long long _fsize, + NewBlock(const ion::BlockId& block, const RootHash& rhash, const FileHash& fhash, unsigned long long _fsize, unsigned _flags) : tag_field(tag) , flags(_flags) @@ -91,7 +91,7 @@ struct NewState { unsigned char file_hash[32]; unsigned char root_hash[32]; unsigned char last_bytes[8]; - NewState(const ton::BlockId& state, const RootHash& rhash, const FileHash& fhash, unsigned long long _fsize, + NewState(const ion::BlockId& state, const RootHash& rhash, const FileHash& fhash, unsigned long long _fsize, unsigned _flags) : tag_field(tag) , flags(_flags) diff --git a/crypto/block/block-db-impl.h b/crypto/block/block-db-impl.h index 07869ca95..a32d6e47a 100644 --- a/crypto/block/block-db-impl.h +++ b/crypto/block/block-db-impl.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -70,11 +70,11 @@ class BlockDbImpl final : public BlockDb { std::string base_dir; std::string binlog_name; BinlogBuffer bb; - ton::Bits256 zstate_rhash, zstate_fhash; + ion::Bits256 zstate_rhash, zstate_fhash; unsigned created_at; - std::map file_cache; - std::map> block_info; - std::map> state_info; + std::map file_cache; + std::map> block_info; + std::map> state_info; // td::Result do_init(); @@ -116,18 +116,18 @@ class BlockDbImpl final : public BlockDb { td::Status save_db_file(const FileHash& file_hash, const td::BufferSlice& data, int fmode = 0); td::Status load_data(FileInfo& file_info, bool force = false); // actor BlockDb implementation - void get_top_block_id(ton::ShardIdFull shard, int authority, td::Promise promise) override; - void get_top_block_state_id(ton::ShardIdFull shard, int authority, td::Promise promise) override; - void get_block_by_id(ton::BlockId blk_id, bool need_data, td::Promise> promise) override; - void get_state_by_id(ton::BlockId blk_id, bool need_data, td::Promise> promise) override; - void get_out_queue_info_by_id(ton::BlockId blk_id, td::Promise> promise) override; + void get_top_block_id(ion::ShardIdFull shard, int authority, td::Promise promise) override; + void get_top_block_state_id(ion::ShardIdFull shard, int authority, td::Promise promise) override; + void get_block_by_id(ion::BlockId blk_id, bool need_data, td::Promise> promise) override; + void get_state_by_id(ion::BlockId blk_id, bool need_data, td::Promise> promise) override; + void get_out_queue_info_by_id(ion::BlockId blk_id, td::Promise> promise) override; void get_object_by_file_hash(FileHash file_hash, bool need_data, bool force_file_load, td::Promise> promise) override; void get_object_by_root_hash(RootHash root_hash, bool need_data, bool force_file_load, td::Promise> promise) override; - void save_new_block(ton::BlockIdExt blk_id, td::BufferSlice data, int authority, + void save_new_block(ion::BlockIdExt blk_id, td::BufferSlice data, int authority, td::Promise promise) override; - void save_new_state(ton::BlockIdExt state_id, td::BufferSlice data, int authority, + void save_new_state(ion::BlockIdExt state_id, td::BufferSlice data, int authority, td::Promise promise) override; bool file_cache_insert(const FileHash& file_hash, const td::BufferSlice& data, int mode = 0); }; diff --git a/crypto/block/block-db.cpp b/crypto/block/block-db.cpp index 21c7c0a0a..c409c43bd 100644 --- a/crypto/block/block-db.cpp +++ b/crypto/block/block-db.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -111,13 +111,13 @@ td::Status save_binary_file(std::string filename, const td::BufferSlice& data, u } FileHash compute_file_hash(const td::BufferSlice& data) { - ton::Bits256 data_hash; + ion::Bits256 data_hash; td::sha256(data, td::MutableSlice{data_hash.data(), 32}); return data_hash; } FileHash compute_file_hash(td::Slice data) { - ton::Bits256 data_hash; + ion::Bits256 data_hash; td::sha256(data, td::MutableSlice{data_hash.data(), 32}); return data_hash; } @@ -484,11 +484,11 @@ int BlockBinlogCallback::replay(const log::SetZeroState& lev, unsigned long long // LOG(DEBUG) << "db.zstate_rhash = " << db.zstate_rhash.to_hex(); if (db.zstate_rhash != td::ConstBitPtr{lev.root_hash}) { throw BinlogBuffer::InterpretError{std::string{"SetZeroState: zerostate root hash mismatch: in binlog "} + - ton::Bits256{lev.root_hash}.to_hex() + ", required " + db.zstate_rhash.to_hex()}; + ion::Bits256{lev.root_hash}.to_hex() + ", required " + db.zstate_rhash.to_hex()}; } db.zerostate = td::Ref{true, FileType::state, - ton::BlockId{ton::masterchainId, 1ULL << 63, 0}, + ion::BlockId{ion::masterchainId, 1ULL << 63, 0}, 0, td::as(lev.file_hash), td::as(lev.root_hash), @@ -498,10 +498,10 @@ int BlockBinlogCallback::replay(const log::SetZeroState& lev, unsigned long long int BlockBinlogCallback::replay(const log::NewBlock& lev, unsigned long long log_pos) const { LOG(DEBUG) << "in replay(NewBlock)"; - if (!lev.seqno || lev.workchain == ton::workchainInvalid) { + if (!lev.seqno || lev.workchain == ion::workchainInvalid) { return -1; } - ton::BlockId blkid{lev.workchain, lev.shard, lev.seqno}; + ion::BlockId blkid{lev.workchain, lev.shard, lev.seqno}; auto blk_info = td::Ref{true, FileType::block, blkid, @@ -520,10 +520,10 @@ int BlockBinlogCallback::replay(const log::NewBlock& lev, unsigned long long log int BlockBinlogCallback::replay(const log::NewState& lev, unsigned long long log_pos) const { LOG(DEBUG) << "in replay(NewState)"; - if (!lev.seqno || lev.workchain == ton::workchainInvalid) { + if (!lev.seqno || lev.workchain == ion::workchainInvalid) { return -1; } - ton::BlockId id{lev.workchain, lev.shard, lev.seqno}; + ion::BlockId id{lev.workchain, lev.shard, lev.seqno}; auto state_info = td::Ref{true, FileType::state, id, @@ -582,24 +582,24 @@ td::Status BlockDbImpl::update_state_info(Ref state) { } } -void BlockDbImpl::get_top_block_id(ton::ShardIdFull shard, int authority, td::Promise promise) { +void BlockDbImpl::get_top_block_id(ion::ShardIdFull shard, int authority, td::Promise promise) { LOG(DEBUG) << "in BlockDb::get_top_block_id()"; - auto it = block_info.upper_bound(ton::BlockId{shard, std::numeric_limits::max()}); - if (it != block_info.begin() && ton::ShardIdFull{(--it)->first} == shard) { + auto it = block_info.upper_bound(ion::BlockId{shard, std::numeric_limits::max()}); + if (it != block_info.begin() && ion::ShardIdFull{(--it)->first} == shard) { promise(it->second->blk); return; } if (shard.is_masterchain()) { - promise(ton::BlockIdExt{ton::BlockId{ton::masterchainId, 1ULL << 63, 0}}); + promise(ion::BlockIdExt{ion::BlockId{ion::masterchainId, 1ULL << 63, 0}}); return; } promise(td::Status::Error(-666)); } -void BlockDbImpl::get_top_block_state_id(ton::ShardIdFull shard, int authority, td::Promise promise) { +void BlockDbImpl::get_top_block_state_id(ion::ShardIdFull shard, int authority, td::Promise promise) { LOG(DEBUG) << "in BlockDb::get_top_block_state_id()"; - auto it = state_info.upper_bound(ton::BlockId{shard, std::numeric_limits::max()}); - if (it != state_info.begin() && ton::ShardIdFull{(--it)->first} == shard) { + auto it = state_info.upper_bound(ion::BlockId{shard, std::numeric_limits::max()}); + if (it != state_info.begin() && ion::ShardIdFull{(--it)->first} == shard) { promise(it->second->blk); return; } @@ -610,7 +610,7 @@ void BlockDbImpl::get_top_block_state_id(ton::ShardIdFull shard, int authority, promise(td::Status::Error(-666, "no state for given workchain found in database")); } -void BlockDbImpl::get_block_by_id(ton::BlockId blk_id, bool need_data, td::Promise> promise) { +void BlockDbImpl::get_block_by_id(ion::BlockId blk_id, bool need_data, td::Promise> promise) { LOG(DEBUG) << "in BlockDb::get_block_by_id({" << blk_id.workchain << ", " << blk_id.shard << ", " << blk_id.seqno << "}, " << need_data << ")"; auto it = block_info.find(blk_id); @@ -629,7 +629,7 @@ void BlockDbImpl::get_block_by_id(ton::BlockId blk_id, bool need_data, td::Promi promise(td::Status::Error(-666, "block not found in database")); } -void BlockDbImpl::get_state_by_id(ton::BlockId blk_id, bool need_data, td::Promise> promise) { +void BlockDbImpl::get_state_by_id(ion::BlockId blk_id, bool need_data, td::Promise> promise) { LOG(DEBUG) << "in BlockDb::get_state_by_id({" << blk_id.workchain << ", " << blk_id.shard << ", " << blk_id.seqno << "}, " << need_data << ")"; auto it = state_info.find(blk_id); @@ -661,7 +661,7 @@ void BlockDbImpl::get_state_by_id(ton::BlockId blk_id, bool need_data, td::Promi promise(td::Status::Error(-666, "requested state not found in database")); } -void BlockDbImpl::get_out_queue_info_by_id(ton::BlockId blk_id, td::Promise> promise) { +void BlockDbImpl::get_out_queue_info_by_id(ion::BlockId blk_id, td::Promise> promise) { LOG(DEBUG) << "in BlockDb::get_out_queue_info_by_id({" << blk_id.workchain << ", " << blk_id.shard << ", " << blk_id.seqno << ")"; auto it = state_info.find(blk_id); @@ -755,7 +755,7 @@ void BlockDbImpl::get_object_by_root_hash(RootHash root_hash, bool need_data, bo promise(td::Status::Error(-666)); } -void BlockDbImpl::save_new_block(ton::BlockIdExt id, td::BufferSlice data, int authority, +void BlockDbImpl::save_new_block(ion::BlockIdExt id, td::BufferSlice data, int authority, td::Promise promise) { // TODO: add verification that data is a BoC with correct root hash, and that it is a Block corresponding to blk_id // ... @@ -778,7 +778,7 @@ void BlockDbImpl::save_new_block(ton::BlockIdExt id, td::BufferSlice data, int a promise(td::Unit{}); } -void BlockDbImpl::save_new_state(ton::BlockIdExt id, td::BufferSlice data, int authority, +void BlockDbImpl::save_new_state(ion::BlockIdExt id, td::BufferSlice data, int authority, td::Promise promise) { // TODO: add verification that data is a BoC with correct root hash, and that it is a Block corresponding to blk_id // ... diff --git a/crypto/block/block-db.h b/crypto/block/block-db.h index cd9498fbf..aa38521c4 100644 --- a/crypto/block/block-db.h +++ b/crypto/block/block-db.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -20,14 +20,14 @@ #include "td/utils/int_types.h" #include "td/utils/buffer.h" #include "td/actor/actor.h" -#include "ton/ton-types.h" +#include "ion/ion-types.h" #include "crypto/common/refcnt.hpp" #include "crypto/vm/cells.h" namespace block { -using FileHash = ton::Bits256; -using RootHash = ton::Bits256; +using FileHash = ion::Bits256; +using RootHash = ion::Bits256; using td::Ref; struct ZerostateInfo { @@ -75,7 +75,7 @@ enum class FileType { }; struct FileInfo : public td::CntObject { - ton::BlockIdExt blk; + ion::BlockIdExt blk; FileType type; int status; long long file_size; @@ -84,15 +84,15 @@ struct FileInfo : public td::CntObject { blk.file_hash.set_zero(); blk.root_hash.set_zero(); } - FileInfo(FileType _type, const ton::BlockId& _id, int _status, const FileHash& _fhash, long long _fsize = -1) + FileInfo(FileType _type, const ion::BlockId& _id, int _status, const FileHash& _fhash, long long _fsize = -1) : blk(_id, _fhash), type(_type), status(_status), file_size(_fsize) { blk.root_hash.set_zero(); } - FileInfo(FileType _type, const ton::BlockId& _id, int _status, const FileHash& _fhash, const RootHash& _rhash, + FileInfo(FileType _type, const ion::BlockId& _id, int _status, const FileHash& _fhash, const RootHash& _rhash, long long _fsize = -1) : blk(_id, _rhash, _fhash), type(_type), status(_status), file_size(_fsize) { } - FileInfo(FileType _type, const ton::BlockId& _id, int _status, const FileHash& _fhash, const RootHash& _rhash, + FileInfo(FileType _type, const ion::BlockId& _id, int _status, const FileHash& _fhash, const RootHash& _rhash, td::BufferSlice _data) : blk(_id, _rhash, _fhash), type(_type), status(_status), file_size(_data.size()), data(std::move(_data)) { } @@ -105,19 +105,19 @@ struct FileInfo : public td::CntObject { }; struct OutputQueueInfoDescr : public td::CntObject { - ton::BlockId id; + ion::BlockId id; RootHash block_hash; RootHash state_hash; RootHash output_queue_info_hash; td::Ref queue_info; - OutputQueueInfoDescr(ton::BlockId _id, const RootHash& _bhash, const RootHash& _shash, Ref _qinfo) + OutputQueueInfoDescr(ion::BlockId _id, const RootHash& _bhash, const RootHash& _shash, Ref _qinfo) : id(_id) , block_hash(_bhash) , state_hash(_shash) , output_queue_info_hash(_qinfo->get_hash().bits()) , queue_info(std::move(_qinfo)) { } - OutputQueueInfoDescr(ton::BlockId _id, td::ConstBitPtr _bhash, td::ConstBitPtr _shash, Ref _qinfo) + OutputQueueInfoDescr(ion::BlockId _id, td::ConstBitPtr _bhash, td::ConstBitPtr _shash, Ref _qinfo) : id(_id) , block_hash(_bhash) , state_hash(_shash) @@ -135,18 +135,18 @@ class BlockDb : public td::actor::Actor { bool _allow_uninit = false, int _depth = 4, std::string _binlog_name = ""); // authority: 0 = standard (inclusion in mc block), 1 = validator (by 2/3 validator signatures) - virtual void get_top_block_id(ton::ShardIdFull shard, int authority, td::Promise promise) = 0; - virtual void get_top_block_state_id(ton::ShardIdFull shard, int authority, td::Promise promise) = 0; - virtual void get_block_by_id(ton::BlockId blk_id, bool need_data, td::Promise> promise) = 0; - virtual void get_state_by_id(ton::BlockId blk_id, bool need_data, td::Promise> promise) = 0; - virtual void get_out_queue_info_by_id(ton::BlockId blk_id, td::Promise> promise) = 0; + virtual void get_top_block_id(ion::ShardIdFull shard, int authority, td::Promise promise) = 0; + virtual void get_top_block_state_id(ion::ShardIdFull shard, int authority, td::Promise promise) = 0; + virtual void get_block_by_id(ion::BlockId blk_id, bool need_data, td::Promise> promise) = 0; + virtual void get_state_by_id(ion::BlockId blk_id, bool need_data, td::Promise> promise) = 0; + virtual void get_out_queue_info_by_id(ion::BlockId blk_id, td::Promise> promise) = 0; virtual void get_object_by_file_hash(FileHash file_hash, bool need_data, bool force_file_load, td::Promise> promise) = 0; virtual void get_object_by_root_hash(RootHash root_hash, bool need_data, bool force_file_load, td::Promise> promise) = 0; - virtual void save_new_block(ton::BlockIdExt blk_id, td::BufferSlice data, int authority, + virtual void save_new_block(ion::BlockIdExt blk_id, td::BufferSlice data, int authority, td::Promise promise) = 0; - virtual void save_new_state(ton::BlockIdExt state_id, td::BufferSlice data, int authority, + virtual void save_new_state(ion::BlockIdExt state_id, td::BufferSlice data, int authority, td::Promise promise) = 0; }; diff --git a/crypto/block/block-parse.cpp b/crypto/block/block-parse.cpp index 50851c795..f56886e42 100644 --- a/crypto/block/block-parse.cpp +++ b/crypto/block/block-parse.cpp @@ -1,25 +1,25 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "td/utils/bits.h" #include "block/block-parse.h" #include "block/block-auto.h" -#include "ton/ton-shard.h" +#include "ion/ion-shard.h" #include "common/util.h" #include "td/utils/crypto.h" @@ -114,11 +114,11 @@ bool MsgAddressInt::skip_get_depth(vm::CellSlice& cs, int& depth) const { return false; } -ton::AccountIdPrefixFull MsgAddressInt::get_prefix(vm::CellSlice&& cs) { +ion::AccountIdPrefixFull MsgAddressInt::get_prefix(vm::CellSlice&& cs) { if (!cs.have(3 + 8 + 64)) { return {}; } - ton::WorkchainId workchain; + ion::WorkchainId workchain; unsigned long long prefix; int t = (int)cs.prefetch_ulong(2 + 1 + 5); switch (t >> 5) { @@ -167,11 +167,11 @@ ton::AccountIdPrefixFull MsgAddressInt::get_prefix(vm::CellSlice&& cs) { return {}; } -ton::AccountIdPrefixFull MsgAddressInt::get_prefix(const vm::CellSlice& cs) { +ion::AccountIdPrefixFull MsgAddressInt::get_prefix(const vm::CellSlice& cs) { return get_prefix(vm::CellSlice{cs}); } -ton::AccountIdPrefixFull MsgAddressInt::get_prefix(Ref cs_ref) { +ion::AccountIdPrefixFull MsgAddressInt::get_prefix(Ref cs_ref) { if (cs_ref->is_unique()) { return get_prefix(std::move(cs_ref.unique_write())); } else { @@ -179,8 +179,8 @@ ton::AccountIdPrefixFull MsgAddressInt::get_prefix(Ref cs_ref) { } } -bool MsgAddressInt::extract_std_address(Ref cs_ref, ton::WorkchainId& workchain, - ton::StdSmcAddress& addr, bool rewrite) const { +bool MsgAddressInt::extract_std_address(Ref cs_ref, ion::WorkchainId& workchain, + ion::StdSmcAddress& addr, bool rewrite) const { if (cs_ref.is_null()) { return false; } else if (cs_ref->is_unique()) { @@ -191,7 +191,7 @@ bool MsgAddressInt::extract_std_address(Ref cs_ref, ton::Workchai } } -bool MsgAddressInt::extract_std_address(vm::CellSlice& cs, ton::WorkchainId& workchain, ton::StdSmcAddress& addr, +bool MsgAddressInt::extract_std_address(vm::CellSlice& cs, ion::WorkchainId& workchain, ion::StdSmcAddress& addr, bool do_rewrite) const { if (!cs.have(3 + 8 + 64)) { return {}; @@ -249,8 +249,8 @@ bool MsgAddressInt::extract_std_address(vm::CellSlice& cs, block::StdAddress& ad return extract_std_address(cs, addr.workchain, addr.addr, rewrite); } -bool MsgAddressInt::store_std_address(vm::CellBuilder& cb, ton::WorkchainId workchain, - const ton::StdSmcAddress& addr) const { +bool MsgAddressInt::store_std_address(vm::CellBuilder& cb, ion::WorkchainId workchain, + const ion::StdSmcAddress& addr) const { if (workchain >= -128 && workchain < 128) { return cb.store_long_bool(4, 3) // addr_std$10 anycast:(Maybe Anycast) && cb.store_long_bool(workchain, 8) // workchain_id:int8 @@ -262,7 +262,7 @@ bool MsgAddressInt::store_std_address(vm::CellBuilder& cb, ton::WorkchainId work } } -Ref MsgAddressInt::pack_std_address(ton::WorkchainId workchain, const ton::StdSmcAddress& addr) const { +Ref MsgAddressInt::pack_std_address(ion::WorkchainId workchain, const ion::StdSmcAddress& addr) const { vm::CellBuilder cb; if (store_std_address(cb, workchain, addr)) { return vm::load_cell_slice_ref(cb.finalize()); @@ -2191,13 +2191,13 @@ bool OutMsgQueueInfo::validate_skip(int* ops, vm::CellSlice& cs, bool weak) cons const OutMsgQueueInfo t_OutMsgQueueInfo; const RefTo t_Ref_OutMsgQueueInfo; -bool ExtBlkRef::unpack(vm::CellSlice& cs, ton::BlockIdExt& blkid, ton::LogicalTime* end_lt) const { +bool ExtBlkRef::unpack(vm::CellSlice& cs, ion::BlockIdExt& blkid, ion::LogicalTime* end_lt) const { block::gen::ExtBlkRef::Record data; if (!tlb::unpack(cs, data)) { blkid.invalidate(); return false; } - blkid.id = ton::BlockId{ton::masterchainId, ton::shardIdAll, data.seq_no}; + blkid.id = ion::BlockId{ion::masterchainId, ion::shardIdAll, data.seq_no}; blkid.root_hash = data.root_hash; blkid.file_hash = data.file_hash; if (end_lt) { @@ -2206,13 +2206,13 @@ bool ExtBlkRef::unpack(vm::CellSlice& cs, ton::BlockIdExt& blkid, ton::LogicalTi return true; } -bool ExtBlkRef::unpack(Ref cs_ref, ton::BlockIdExt& blkid, ton::LogicalTime* end_lt) const { +bool ExtBlkRef::unpack(Ref cs_ref, ion::BlockIdExt& blkid, ion::LogicalTime* end_lt) const { block::gen::ExtBlkRef::Record data; if (!tlb::csr_unpack_safe(std::move(cs_ref), data)) { blkid.invalidate(); return false; } - blkid.id = ton::BlockId{ton::masterchainId, ton::shardIdAll, data.seq_no}; + blkid.id = ion::BlockId{ion::masterchainId, ion::shardIdAll, data.seq_no}; blkid.root_hash = data.root_hash; blkid.file_hash = data.file_hash; if (end_lt) { @@ -2221,19 +2221,19 @@ bool ExtBlkRef::unpack(Ref cs_ref, ton::BlockIdExt& blkid, ton::L return true; } -bool ExtBlkRef::store(vm::CellBuilder& cb, const ton::BlockIdExt& blkid, ton::LogicalTime end_lt) const { +bool ExtBlkRef::store(vm::CellBuilder& cb, const ion::BlockIdExt& blkid, ion::LogicalTime end_lt) const { return cb.store_long_bool(end_lt, 64) // ext_blk_ref$_ end_lt:uint64 && cb.store_long_bool(blkid.seqno(), 32) // seq_no:uint32 && cb.store_bits_bool(blkid.root_hash) // root_hash:bits256 && cb.store_bits_bool(blkid.file_hash); // file_hash:bits256 = ExtBlkRef; } -Ref ExtBlkRef::pack_cell(const ton::BlockIdExt& blkid, ton::LogicalTime end_lt) const { +Ref ExtBlkRef::pack_cell(const ion::BlockIdExt& blkid, ion::LogicalTime end_lt) const { vm::CellBuilder cb; return store(cb, blkid, end_lt) ? cb.finalize() : Ref{}; } -bool ExtBlkRef::pack_to(Ref& cell, const ton::BlockIdExt& blkid, ton::LogicalTime end_lt) const { +bool ExtBlkRef::pack_to(Ref& cell, const ion::BlockIdExt& blkid, ion::LogicalTime end_lt) const { vm::CellBuilder cb; return store(cb, blkid, end_lt) && cb.finalize_to(cell); } @@ -2245,7 +2245,7 @@ bool ShardIdent::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const { int shard_pfx_len, workchain_id; unsigned long long shard_pfx; if (cs.fetch_ulong(2) == 0 && cs.fetch_uint_to(6, shard_pfx_len) && cs.fetch_int_to(32, workchain_id) && - workchain_id != ton::workchainInvalid && cs.fetch_uint_to(64, shard_pfx)) { + workchain_id != ion::workchainInvalid && cs.fetch_uint_to(64, shard_pfx)) { auto pow2 = (1ULL << (63 - shard_pfx_len)); if (!(shard_pfx & (pow2 - 1))) { return true; @@ -2255,7 +2255,7 @@ bool ShardIdent::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const { } bool ShardIdent::Record::check() const { - return workchain_id != ton::workchainInvalid && !(shard_prefix & ((1ULL << (63 - shard_pfx_bits)) - 1)); + return workchain_id != ion::workchainInvalid && !(shard_prefix & ((1ULL << (63 - shard_pfx_bits)) - 1)); } bool ShardIdent::unpack(vm::CellSlice& cs, ShardIdent::Record& data) const { @@ -2273,7 +2273,7 @@ bool ShardIdent::pack(vm::CellBuilder& cb, const Record& data) const { cb.store_long_rchk_bool(data.workchain_id, 32) && cb.store_ulong_rchk_bool(data.shard_prefix, 64); } -bool ShardIdent::unpack(vm::CellSlice& cs, ton::WorkchainId& workchain, ton::ShardId& shard) const { +bool ShardIdent::unpack(vm::CellSlice& cs, ion::WorkchainId& workchain, ion::ShardId& shard) const { int bits; unsigned long long pow2; auto assign = [](auto& a, auto b) { return a = b; }; @@ -2283,16 +2283,16 @@ bool ShardIdent::unpack(vm::CellSlice& cs, ton::WorkchainId& workchain, ton::Sha && assign(pow2, (1ULL << (63 - bits))) // (power) && cs.fetch_int_to(32, workchain) // workchain_id:int32 && cs.fetch_uint_to(64, shard) // shard_prefix:uint64 - && workchain != ton::workchainInvalid && !(shard & (2 * pow2 - 1)) && assign_or(shard, pow2); + && workchain != ion::workchainInvalid && !(shard & (2 * pow2 - 1)) && assign_or(shard, pow2); } -bool ShardIdent::unpack(vm::CellSlice& cs, ton::ShardIdFull& data) const { +bool ShardIdent::unpack(vm::CellSlice& cs, ion::ShardIdFull& data) const { return unpack(cs, data.workchain, data.shard); } -bool ShardIdent::pack(vm::CellBuilder& cb, ton::WorkchainId workchain, ton::ShardId shard) const { - int bits = ton::shard_prefix_length(shard); - return workchain != ton::workchainInvalid // check workchain +bool ShardIdent::pack(vm::CellBuilder& cb, ion::WorkchainId workchain, ion::ShardId shard) const { + int bits = ion::shard_prefix_length(shard); + return workchain != ion::workchainInvalid // check workchain && shard // check shard && cb.store_long_bool(0, 2) // shard_ident$00 && cb.store_uint_leq(60, bits) // shard_pfx_bits:(#<= 60) @@ -2300,7 +2300,7 @@ bool ShardIdent::pack(vm::CellBuilder& cb, ton::WorkchainId workchain, ton::Shar && cb.store_long_bool(shard & (shard - 1), 64); // shard_prefix:uint64 } -bool ShardIdent::pack(vm::CellBuilder& cb, ton::ShardIdFull data) const { +bool ShardIdent::pack(vm::CellBuilder& cb, ion::ShardIdFull data) const { return pack(cb, data.workchain, data.shard); } @@ -2310,14 +2310,14 @@ bool BlockIdExt::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const { return t_ShardIdent.validate_skip(ops, cs, weak) && cs.advance(32 + 256 * 2); } -bool BlockIdExt::unpack(vm::CellSlice& cs, ton::BlockIdExt& data) const { +bool BlockIdExt::unpack(vm::CellSlice& cs, ion::BlockIdExt& data) const { return t_ShardIdent.unpack(cs, data.id.workchain, data.id.shard) // block_id_ext$_ shard_id:ShardIdent && cs.fetch_uint_to(32, data.id.seqno) // seq_no:uint32 && cs.fetch_bits_to(data.root_hash) // root_hash:bits256 && cs.fetch_bits_to(data.file_hash); // file_hash:bits256 } -bool BlockIdExt::pack(vm::CellBuilder& cb, const ton::BlockIdExt& data) const { +bool BlockIdExt::pack(vm::CellBuilder& cb, const ion::BlockIdExt& data) const { return t_ShardIdent.pack(cb, data.id.workchain, data.id.shard) // block_id_ext$_ shard_id:ShardIdent && cb.store_long_bool(data.id.seqno, 32) // seq_no:uint32 && cb.store_bits_bool(data.root_hash) // root_hash:bits256 diff --git a/crypto/block/block-parse.h b/crypto/block/block-parse.h index 65f8b91fe..a493c4737 100644 --- a/crypto/block/block-parse.h +++ b/crypto/block/block-parse.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -27,7 +27,7 @@ #include "tl/tlblib.hpp" #include "td/utils/bits.h" #include "td/utils/StringBuilder.h" -#include "ton/ton-types.h" +#include "ion/ion-types.h" #include "block-auto.h" namespace block { @@ -282,27 +282,27 @@ struct MsgAddressInt final : TLB_Complex { int get_tag(const vm::CellSlice& cs) const override { return (int)cs.prefetch_ulong(2); } - static ton::AccountIdPrefixFull get_prefix(vm::CellSlice&& cs); - static ton::AccountIdPrefixFull get_prefix(const vm::CellSlice& cs); - static ton::AccountIdPrefixFull get_prefix(Ref cs_ref); - static bool get_prefix_to(vm::CellSlice&& cs, ton::AccountIdPrefixFull& pfx) { + static ion::AccountIdPrefixFull get_prefix(vm::CellSlice&& cs); + static ion::AccountIdPrefixFull get_prefix(const vm::CellSlice& cs); + static ion::AccountIdPrefixFull get_prefix(Ref cs_ref); + static bool get_prefix_to(vm::CellSlice&& cs, ion::AccountIdPrefixFull& pfx) { return (pfx = get_prefix(std::move(cs))).is_valid(); } - static bool get_prefix_to(const vm::CellSlice& cs, ton::AccountIdPrefixFull& pfx) { + static bool get_prefix_to(const vm::CellSlice& cs, ion::AccountIdPrefixFull& pfx) { return (pfx = get_prefix(cs)).is_valid(); } - static bool get_prefix_to(Ref cs_ref, ton::AccountIdPrefixFull& pfx) { + static bool get_prefix_to(Ref cs_ref, ion::AccountIdPrefixFull& pfx) { return cs_ref.not_null() && (pfx = get_prefix(std::move(cs_ref))).is_valid(); } bool skip_get_depth(vm::CellSlice& cs, int& depth) const; - bool extract_std_address(Ref cs_ref, ton::WorkchainId& workchain, ton::StdSmcAddress& addr, + bool extract_std_address(Ref cs_ref, ion::WorkchainId& workchain, ion::StdSmcAddress& addr, bool rewrite = true) const; - bool extract_std_address(vm::CellSlice& cs, ton::WorkchainId& workchain, ton::StdSmcAddress& addr, + bool extract_std_address(vm::CellSlice& cs, ion::WorkchainId& workchain, ion::StdSmcAddress& addr, bool rewrite = true) const; bool extract_std_address(Ref cs_ref, block::StdAddress& addr, bool rewrite = true) const; bool extract_std_address(vm::CellSlice& cs, block::StdAddress& addr, bool rewrite = true) const; - bool store_std_address(vm::CellBuilder& cb, ton::WorkchainId workchain, const ton::StdSmcAddress& addr) const; - Ref pack_std_address(ton::WorkchainId workchain, const ton::StdSmcAddress& addr) const; + bool store_std_address(vm::CellBuilder& cb, ion::WorkchainId workchain, const ion::StdSmcAddress& addr) const; + Ref pack_std_address(ion::WorkchainId workchain, const ion::StdSmcAddress& addr) const; bool store_std_address(vm::CellBuilder& cb, const block::StdAddress& addr) const; Ref pack_std_address(const block::StdAddress& addr) const; @@ -470,7 +470,7 @@ struct MsgEnvelope final : TLB_Complex { int cur_addr, next_addr; td::RefInt256 fwd_fee_remaining; Ref msg; - td::optional emitted_lt; + td::optional emitted_lt; td::optional metadata; }; bool unpack(vm::CellSlice& cs, Record& data) const; @@ -561,8 +561,8 @@ struct ShardAccount final : TLB_Complex { struct Record { using Type = ShardAccount; Ref account; - ton::LogicalTime last_trans_lt; - ton::Bits256 last_trans_hash; + ion::LogicalTime last_trans_lt; + ion::Bits256 last_trans_hash; bool valid{false}; bool is_zero{false}; bool reset(); @@ -976,11 +976,11 @@ struct ExtBlkRef final : TLB { int get_size(const vm::CellSlice& cs) const override { return fixed_size; } - bool unpack(vm::CellSlice& cs, ton::BlockIdExt& blkid, ton::LogicalTime* end_lt = nullptr) const; - bool unpack(Ref cs_ref, ton::BlockIdExt& blkid, ton::LogicalTime* end_lt = nullptr) const; - bool store(vm::CellBuilder& cb, const ton::BlockIdExt& blkid, ton::LogicalTime end_lt) const; - Ref pack_cell(const ton::BlockIdExt& blkid, ton::LogicalTime end_lt) const; - bool pack_to(Ref& cell, const ton::BlockIdExt& blkid, ton::LogicalTime end_lt) const; + bool unpack(vm::CellSlice& cs, ion::BlockIdExt& blkid, ion::LogicalTime* end_lt = nullptr) const; + bool unpack(Ref cs_ref, ion::BlockIdExt& blkid, ion::LogicalTime* end_lt = nullptr) const; + bool store(vm::CellBuilder& cb, const ion::BlockIdExt& blkid, ion::LogicalTime end_lt) const; + Ref pack_cell(const ion::BlockIdExt& blkid, ion::LogicalTime end_lt) const; + bool pack_to(Ref& cell, const ion::BlockIdExt& blkid, ion::LogicalTime end_lt) const; }; extern const ExtBlkRef t_ExtBlkRef; @@ -1007,17 +1007,17 @@ struct ShardIdent final : TLB_Complex { } bool unpack(vm::CellSlice& cs, Record& data) const; bool pack(vm::CellBuilder& cb, const Record& data) const; - bool unpack(vm::CellSlice& cs, ton::ShardIdFull& data) const; - bool pack(vm::CellBuilder& cb, ton::ShardIdFull data) const; - bool unpack(vm::CellSlice& cs, ton::WorkchainId& workchain, ton::ShardId& shard) const; - bool pack(vm::CellBuilder& cb, ton::WorkchainId workchain, ton::ShardId shard) const; + bool unpack(vm::CellSlice& cs, ion::ShardIdFull& data) const; + bool pack(vm::CellBuilder& cb, ion::ShardIdFull data) const; + bool unpack(vm::CellSlice& cs, ion::WorkchainId& workchain, ion::ShardId& shard) const; + bool pack(vm::CellBuilder& cb, ion::WorkchainId workchain, ion::ShardId shard) const; }; struct ShardIdent::Record { int shard_pfx_bits; int workchain_id; unsigned long long shard_prefix; - Record() : shard_pfx_bits(-1), workchain_id(ton::workchainInvalid), shard_prefix(0) { + Record() : shard_pfx_bits(-1), workchain_id(ion::workchainInvalid), shard_prefix(0) { } Record(int _pfxlen, int _wcid, unsigned long long _pfx) : shard_pfx_bits(_pfxlen), workchain_id(_wcid), shard_prefix(_pfx) { @@ -1041,8 +1041,8 @@ struct BlockIdExt final : TLB_Complex { return cs.advance(get_size(cs)); } bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override; - bool unpack(vm::CellSlice& cs, ton::BlockIdExt& data) const; - bool pack(vm::CellBuilder& cb, const ton::BlockIdExt& data) const; + bool unpack(vm::CellSlice& cs, ion::BlockIdExt& data) const; + bool pack(vm::CellBuilder& cb, const ion::BlockIdExt& data) const; }; extern const BlockIdExt t_BlockIdExt; diff --git a/crypto/block/block.cpp b/crypto/block/block.cpp index 6b9ca8bf0..c272400a8 100644 --- a/crypto/block/block.cpp +++ b/crypto/block/block.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "block/block-auto.h" #include "block/block-parse.h" #include "block/mc-config.h" -#include "ton/ton-shard.h" +#include "ion/ion-shard.h" #include "common/bigexp.h" #include "common/util.h" #include "td/utils/crypto.h" @@ -83,7 +83,7 @@ std::string PublicKey::serialize(bool base64_url) { return res; } -bool pack_std_smc_addr_to(char result[48], bool base64_url, ton::WorkchainId wc, const ton::StdSmcAddress& addr, +bool pack_std_smc_addr_to(char result[48], bool base64_url, ion::WorkchainId wc, const ion::StdSmcAddress& addr, bool bounceable, bool testnet) { if (wc < -128 || wc >= 128) { return false; @@ -99,7 +99,7 @@ bool pack_std_smc_addr_to(char result[48], bool base64_url, ton::WorkchainId wc, return true; } -std::string pack_std_smc_addr(bool base64_url, ton::WorkchainId wc, const ton::StdSmcAddress& addr, bool bounceable, +std::string pack_std_smc_addr(bool base64_url, ion::WorkchainId wc, const ion::StdSmcAddress& addr, bool bounceable, bool testnet) { char result[48]; if (pack_std_smc_addr_to(result, base64_url, wc, addr, bounceable, testnet)) { @@ -109,10 +109,10 @@ std::string pack_std_smc_addr(bool base64_url, ton::WorkchainId wc, const ton::S } } -bool unpack_std_smc_addr(const char packed[48], ton::WorkchainId& wc, ton::StdSmcAddress& addr, bool& bounceable, +bool unpack_std_smc_addr(const char packed[48], ion::WorkchainId& wc, ion::StdSmcAddress& addr, bool& bounceable, bool& testnet) { unsigned char buffer[36]; - wc = ton::workchainInvalid; + wc = ion::workchainInvalid; if (!buff_base64_decode(td::MutableSlice{buffer, 36}, td::Slice{packed, 48}, true)) { return false; } @@ -130,12 +130,12 @@ bool unpack_std_smc_addr(const char packed[48], ton::WorkchainId& wc, ton::StdSm return true; } -bool unpack_std_smc_addr(td::Slice packed, ton::WorkchainId& wc, ton::StdSmcAddress& addr, bool& bounceable, +bool unpack_std_smc_addr(td::Slice packed, ion::WorkchainId& wc, ion::StdSmcAddress& addr, bool& bounceable, bool& testnet) { return packed.size() == 48 && unpack_std_smc_addr(packed.data(), wc, addr, bounceable, testnet); } -bool unpack_std_smc_addr(std::string packed, ton::WorkchainId& wc, ton::StdSmcAddress& addr, bool& bounceable, +bool unpack_std_smc_addr(std::string packed, ion::WorkchainId& wc, ion::StdSmcAddress& addr, bool& bounceable, bool& testnet) { return packed.size() == 48 && unpack_std_smc_addr(packed.data(), wc, addr, bounceable, testnet); } @@ -201,12 +201,12 @@ bool StdAddress::parse_addr(td::Slice acc_string) { return invalidate(); } auto tmp = acc_string.substr(0, pos); - auto r_wc = td::to_integer_safe(tmp); + auto r_wc = td::to_integer_safe(tmp); if (r_wc.is_error()) { return invalidate(); } workchain = r_wc.move_as_ok(); - if (workchain == ton::workchainInvalid) { + if (workchain == ion::workchainInvalid) { return invalidate(); } ++pos; @@ -231,7 +231,7 @@ bool StdAddress::parse_addr(td::Slice acc_string) { return true; } -bool parse_std_account_addr(td::Slice acc_string, ton::WorkchainId& wc, ton::StdSmcAddress& addr, bool* bounceable, +bool parse_std_account_addr(td::Slice acc_string, ion::WorkchainId& wc, ion::StdSmcAddress& addr, bool* bounceable, bool* testnet_only) { StdAddress a; if (!a.parse_addr(acc_string)) { @@ -265,24 +265,24 @@ void ShardId::init() { } } -ShardId::ShardId(ton::WorkchainId wc_id, unsigned long long sh_pfx) : workchain_id(wc_id), shard_pfx(sh_pfx) { +ShardId::ShardId(ion::WorkchainId wc_id, unsigned long long sh_pfx) : workchain_id(wc_id), shard_pfx(sh_pfx) { init(); } -ShardId::ShardId(ton::ShardIdFull ton_shard_id) : workchain_id(ton_shard_id.workchain), shard_pfx(ton_shard_id.shard) { +ShardId::ShardId(ion::ShardIdFull ion_shard_id) : workchain_id(ion_shard_id.workchain), shard_pfx(ion_shard_id.shard) { init(); } -ShardId::ShardId(ton::BlockId ton_block_id) : workchain_id(ton_block_id.workchain), shard_pfx(ton_block_id.shard) { +ShardId::ShardId(ion::BlockId ion_block_id) : workchain_id(ion_block_id.workchain), shard_pfx(ion_block_id.shard) { init(); } -ShardId::ShardId(const ton::BlockIdExt& ton_block_id) - : workchain_id(ton_block_id.id.workchain), shard_pfx(ton_block_id.id.shard) { +ShardId::ShardId(const ion::BlockIdExt& ion_block_id) + : workchain_id(ion_block_id.id.workchain), shard_pfx(ion_block_id.id.shard) { init(); } -ShardId::ShardId(ton::WorkchainId wc_id, unsigned long long sh_pfx, int sh_pfx_len) +ShardId::ShardId(ion::WorkchainId wc_id, unsigned long long sh_pfx, int sh_pfx_len) : workchain_id(wc_id), shard_pfx_len(sh_pfx_len) { if (sh_pfx_len < 0) { shard_pfx_len = 0; @@ -302,7 +302,7 @@ std::ostream& operator<<(std::ostream& os, const ShardId& shard_id) { } void ShardId::show(std::ostream& os) const { - if (workchain_id == ton::workchainInvalid) { + if (workchain_id == ion::workchainInvalid) { os << '?'; return; } @@ -327,7 +327,7 @@ std::string ShardId::to_str() const { } bool ShardId::serialize(vm::CellBuilder& cb) const { - if (workchain_id == ton::workchainInvalid || cb.remaining_bits() < 104) { + if (workchain_id == ion::workchainInvalid || cb.remaining_bits() < 104) { return false; } return cb.store_long_bool(0, 2) && cb.store_ulong_rchk_bool(shard_pfx_len, 6) && @@ -336,7 +336,7 @@ bool ShardId::serialize(vm::CellBuilder& cb) const { bool ShardId::deserialize(vm::CellSlice& cs) { if (cs.fetch_ulong(2) == 0 && cs.fetch_uint_to(6, shard_pfx_len) && cs.fetch_int_to(32, workchain_id) && - workchain_id != ton::workchainInvalid && cs.fetch_uint_to(64, shard_pfx)) { + workchain_id != ion::workchainInvalid && cs.fetch_uint_to(64, shard_pfx)) { auto pow2 = (1ULL << (63 - shard_pfx_len)); if (!(shard_pfx & (pow2 - 1))) { shard_pfx |= pow2; @@ -348,7 +348,7 @@ bool ShardId::deserialize(vm::CellSlice& cs) { return false; } -MsgProcessedUptoCollection::MsgProcessedUptoCollection(ton::ShardIdFull _owner, Ref cs_ref) +MsgProcessedUptoCollection::MsgProcessedUptoCollection(ion::ShardIdFull _owner, Ref cs_ref) : owner(_owner) { vm::Dictionary dict{std::move(cs_ref), 96}; valid = dict.check_for_each([&](Ref value, td::ConstBitPtr key, int n) -> bool { @@ -361,29 +361,29 @@ MsgProcessedUptoCollection::MsgProcessedUptoCollection(ton::ShardIdFull _owner, z.mc_seqno = (unsigned)((key + 64).get_uint(32)); z.last_inmsg_lt = value.write().fetch_ulong(64); // std::cerr << "ProcessedUpto shard " << std::hex << z.shard << std::dec << std::endl; - return value.write().fetch_bits_to(z.last_inmsg_hash) && z.shard && ton::shard_contains(owner.shard, z.shard); + return value.write().fetch_bits_to(z.last_inmsg_hash) && z.shard && ion::shard_contains(owner.shard, z.shard); }); } -std::unique_ptr MsgProcessedUptoCollection::unpack(ton::ShardIdFull _owner, +std::unique_ptr MsgProcessedUptoCollection::unpack(ion::ShardIdFull _owner, Ref cs_ref) { auto v = std::make_unique(_owner, std::move(cs_ref)); return v && v->valid ? std::move(v) : std::unique_ptr{}; } bool MsgProcessedUpto::contains(const MsgProcessedUpto& other) const& { - return ton::shard_is_ancestor(shard, other.shard) && mc_seqno >= other.mc_seqno && + return ion::shard_is_ancestor(shard, other.shard) && mc_seqno >= other.mc_seqno && (last_inmsg_lt > other.last_inmsg_lt || (last_inmsg_lt == other.last_inmsg_lt && !(last_inmsg_hash < other.last_inmsg_hash))); } -bool MsgProcessedUpto::contains(ton::ShardId other_shard, ton::LogicalTime other_lt, td::ConstBitPtr other_hash, - ton::BlockSeqno other_mc_seqno) const& { - return ton::shard_is_ancestor(shard, other_shard) && mc_seqno >= other_mc_seqno && +bool MsgProcessedUpto::contains(ion::ShardId other_shard, ion::LogicalTime other_lt, td::ConstBitPtr other_hash, + ion::BlockSeqno other_mc_seqno) const& { + return ion::shard_is_ancestor(shard, other_shard) && mc_seqno >= other_mc_seqno && (last_inmsg_lt > other_lt || (last_inmsg_lt == other_lt && !(last_inmsg_hash < other_hash))); } -bool MsgProcessedUptoCollection::insert(ton::BlockSeqno mc_seqno, ton::LogicalTime last_proc_lt, +bool MsgProcessedUptoCollection::insert(ion::BlockSeqno mc_seqno, ion::LogicalTime last_proc_lt, td::ConstBitPtr last_proc_hash) { if (!last_proc_lt) { return false; @@ -397,7 +397,7 @@ bool MsgProcessedUptoCollection::insert(ton::BlockSeqno mc_seqno, ton::LogicalTi return true; } -bool MsgProcessedUptoCollection::insert_infty(ton::BlockSeqno mc_seqno, ton::LogicalTime last_proc_lt) { +bool MsgProcessedUptoCollection::insert_infty(ion::BlockSeqno mc_seqno, ion::LogicalTime last_proc_lt) { return insert(mc_seqno, last_proc_lt, td::Bits256::ones().bits()); } @@ -459,8 +459,8 @@ const MsgProcessedUpto* MsgProcessedUptoCollection::is_simple_update_of(const Ms return found; } -ton::BlockSeqno MsgProcessedUptoCollection::min_mc_seqno() const { - ton::BlockSeqno min_mc_seqno = ~0U; +ion::BlockSeqno MsgProcessedUptoCollection::min_mc_seqno() const { + ion::BlockSeqno min_mc_seqno = ~0U; for (const auto& z : list) { min_mc_seqno = std::min(min_mc_seqno, z.mc_seqno); } @@ -510,8 +510,8 @@ bool MsgProcessedUptoCollection::pack(vm::CellBuilder& cb) { return std::move(dict).append_dict_to_bool(cb); } -bool MsgProcessedUptoCollection::split(ton::ShardIdFull new_owner) { - if (!ton::shard_is_ancestor(owner, new_owner)) { +bool MsgProcessedUptoCollection::split(ion::ShardIdFull new_owner) { + if (!ion::shard_is_ancestor(owner, new_owner)) { return false; } if (owner == new_owner) { @@ -519,8 +519,8 @@ bool MsgProcessedUptoCollection::split(ton::ShardIdFull new_owner) { } std::size_t n = list.size(), i, j = 0; for (i = 0; i < n; i++) { - if (ton::shard_intersects(list[i].shard, new_owner.shard)) { - list[i].shard = ton::shard_intersection(list[i].shard, new_owner.shard); + if (ion::shard_intersects(list[i].shard, new_owner.shard)) { + list[i].shard = ion::shard_intersection(list[i].shard, new_owner.shard); if (j < i) { list[j] = std::move(list[i]); } @@ -533,12 +533,12 @@ bool MsgProcessedUptoCollection::split(ton::ShardIdFull new_owner) { } bool MsgProcessedUptoCollection::combine_with(const MsgProcessedUptoCollection& other) { - if (!(other.owner == owner || ton::shard_is_sibling(other.owner, owner))) { + if (!(other.owner == owner || ion::shard_is_sibling(other.owner, owner))) { return false; } list.insert(list.end(), other.list.begin(), other.list.end()); if (owner != other.owner) { - owner = ton::shard_parent(owner); + owner = ion::shard_parent(owner); } return compactify(); } @@ -549,13 +549,13 @@ bool MsgProcessedUpto::already_processed(const EnqueuedMsgDescr& msg) const { if (msg.lt_ > last_inmsg_lt) { return false; } - if (!ton::shard_contains(shard, msg.next_prefix_.account_id_prefix)) { + if (!ion::shard_contains(shard, msg.next_prefix_.account_id_prefix)) { return false; } if (msg.lt_ == last_inmsg_lt && last_inmsg_hash < msg.hash_) { return false; } - if (msg.same_workchain() && ton::shard_contains(shard, msg.cur_prefix_.account_id_prefix)) { + if (msg.same_workchain() && ion::shard_contains(shard, msg.cur_prefix_.account_id_prefix)) { // this branch is needed only for messages generated in the same shard // (such messages could have been processed without a reference from the masterchain) // ? enable this branch only if an extra boolean parameter is set ? @@ -569,7 +569,7 @@ bool MsgProcessedUpto::already_processed(const EnqueuedMsgDescr& msg) const { bool MsgProcessedUptoCollection::already_processed(const EnqueuedMsgDescr& msg) const { // LOG(DEBUG) << "checking message with cur_addr=" << msg.cur_prefix_.to_str() // << " next_addr=" << msg.next_prefix_.to_str() << " against ProcessedUpto of neighbor " << owner.to_str(); - if (!ton::shard_contains(owner, msg.next_prefix_)) { + if (!ion::shard_contains(owner, msg.next_prefix_)) { return false; } for (const auto& rec : list) { @@ -589,7 +589,7 @@ bool MsgProcessedUptoCollection::can_check_processed() const { return true; } -bool MsgProcessedUptoCollection::for_each_mcseqno(std::function func) const { +bool MsgProcessedUptoCollection::for_each_mcseqno(std::function func) const { for (const auto& entry : list) { if (!func(entry.mc_seqno)) { return false; @@ -599,7 +599,7 @@ bool MsgProcessedUptoCollection::for_each_mcseqno(std::function= ParamLimits::limits_cnt || (limits.gas.fits(cls, gas_used + more_gas) && limits.lt_delta.fits(cls, std::max(cur_lt, end_lt) - limits.start_lt) && @@ -744,7 +744,7 @@ bool BlockLimitStatus::would_fit(unsigned cls, ton::LogicalTime end_lt, td::uint // total_balance{,_extra}, total_validator_fees // SETS: out_msg_queue, processed_upto_, ihr_pending (via unpack_out_msg_queue_info) // SETS: utime_, lt_ -td::Status ShardState::unpack_state(ton::BlockIdExt blkid, Ref prev_state_root) { +td::Status ShardState::unpack_state(ion::BlockIdExt blkid, Ref prev_state_root) { if (!blkid.is_valid()) { return td::Status::Error(-666, "invalid block id supplied to ShardState::unpack"); } @@ -759,7 +759,7 @@ td::Status ShardState::unpack_state(ton::BlockIdExt blkid, Ref prev_st return td::Status::Error( -666, PSTRING() << "shardchain state for " << blkid.to_str() << " has incorrect seqno " << state.seq_no); } - auto shard1 = ton::ShardIdFull(block::ShardId{state.shard_id}); + auto shard1 = ion::ShardIdFull(block::ShardId{state.shard_id}); if (shard1 != blkid.shard_full()) { return td::Status::Error(-666, "shardchain state for "s + blkid.to_str() + " corresponds to incorrect workchain or shard " + shard1.to_str()); @@ -863,7 +863,7 @@ td::Status ShardState::unpack_out_msg_queue_info(Ref out_msg_queue_inf return td::Status::Error( -666, "ProcessedInfo in the state of "s + id_.to_str() + " is invalid according to automated validity checks"); } - processed_upto_ = block::MsgProcessedUptoCollection::unpack(ton::ShardIdFull(id_), std::move(qinfo.proc_info)); + processed_upto_ = block::MsgProcessedUptoCollection::unpack(ion::ShardIdFull(id_), std::move(qinfo.proc_info)); ihr_pending_ = std::make_unique(320); if (qinfo.extra.write().fetch_long(1)) { block::gen::OutMsgQueueExtra::Record extra; @@ -888,9 +888,9 @@ td::Status ShardState::unpack_out_msg_queue_info(Ref out_msg_queue_inf } // UPDATES: prev_state_utime_, prev_state_lt_ -bool ShardState::update_prev_utime_lt(ton::UnixTime& prev_utime, ton::LogicalTime& prev_lt) const { - prev_utime = std::max(prev_utime, utime_); - prev_lt = std::max(prev_lt, lt_); +bool ShardState::update_prev_utime_lt(ion::UnixTime& prev_utime, ion::LogicalTime& prev_lt) const { + prev_utime = std::max(prev_utime, utime_); + prev_lt = std::max(prev_lt, lt_); return true; } @@ -911,7 +911,7 @@ td::Status ShardState::check_global_id(int req_global_id) const { return td::Status::OK(); } -td::Status ShardState::check_mc_blk_seqno(ton::BlockSeqno last_mc_block_seqno) const { +td::Status ShardState::check_mc_blk_seqno(ion::BlockSeqno last_mc_block_seqno) const { if (mc_blk_seqno_ > last_mc_block_seqno) { return td::Status::Error( -666, PSTRING() << "previous block refers to masterchain block with seqno " << mc_blk_seqno_ @@ -920,9 +920,9 @@ td::Status ShardState::check_mc_blk_seqno(ton::BlockSeqno last_mc_block_seqno) c return td::Status::OK(); } -td::Status ShardState::unpack_state_ext(ton::BlockIdExt id, Ref state_root, int global_id, - ton::BlockSeqno prev_mc_block_seqno, bool after_split, bool clear_history, - std::function for_each_mcseqno_func) { +td::Status ShardState::unpack_state_ext(ion::BlockIdExt id, Ref state_root, int global_id, + ion::BlockSeqno prev_mc_block_seqno, bool after_split, bool clear_history, + std::function for_each_mcseqno_func) { TRY_STATUS(unpack_state(id, std::move(state_root))); TRY_STATUS(check_global_id(global_id)); TRY_STATUS(check_mc_blk_seqno(prev_mc_block_seqno)); @@ -940,10 +940,10 @@ td::Status ShardState::merge_with(ShardState& sib) { if (!is_valid() || !sib.is_valid()) { return td::Status::Error(-666, "cannot merge invalid or uninitialized states"); } - if (!ton::shard_is_sibling(id_.shard_full(), sib.id_.shard_full())) { + if (!ion::shard_is_sibling(id_.shard_full(), sib.id_.shard_full())) { return td::Status::Error(-666, "cannot merge non-sibling states of "s + id_.to_str() + " and " + sib.id_.to_str()); } - ton::ShardIdFull shard = ton::shard_parent(id_.shard_full()); + ion::ShardIdFull shard = ion::shard_parent(id_.shard_full()); // 2. compute total_balance and total_validator_fees total_balance_ += std::move(sib.total_balance_); if (!total_balance_.is_valid()) { @@ -1034,9 +1034,9 @@ td::Status ShardState::merge_with(ShardState& sib) { } td::Result> ShardState::compute_split_out_msg_queue( - ton::ShardIdFull subshard) { + ion::ShardIdFull subshard) { auto shard = id_.shard_full(); - if (!ton::shard_is_parent(shard, subshard)) { + if (!ion::shard_is_parent(shard, subshard)) { return td::Status::Error(-666, "cannot split subshard "s + subshard.to_str() + " from state of " + id_.to_str() + " because it is not a parent"); } @@ -1051,8 +1051,8 @@ td::Result> ShardState::compute_split_o } td::Result> ShardState::compute_split_processed_upto( - ton::ShardIdFull subshard) { - if (!ton::shard_is_parent(id_.shard_full(), subshard)) { + ion::ShardIdFull subshard) { + if (!ion::shard_is_parent(id_.shard_full(), subshard)) { return td::Status::Error(-666, "cannot split subshard "s + subshard.to_str() + " from state of " + id_.to_str() + " because it is not a parent"); } @@ -1064,8 +1064,8 @@ td::Result> ShardState::compu return std::move(sub_processed_upto); } -td::Status ShardState::split(ton::ShardIdFull subshard) { - if (!ton::shard_is_parent(id_.shard_full(), subshard)) { +td::Status ShardState::split(ion::ShardIdFull subshard) { + if (!ion::shard_is_parent(id_.shard_full(), subshard)) { return td::Status::Error(-666, "cannot split subshard "s + subshard.to_str() + " from state of " + id_.to_str() + " because it is not a parent"); } @@ -1080,7 +1080,7 @@ td::Status ShardState::split(ton::ShardIdFull subshard) { // 2. out_msg_queue LOG(DEBUG) << "splitting OutMsgQueue"; auto shard1 = id_.shard_full(); - CHECK(ton::shard_is_parent(shard1, subshard)); + CHECK(ion::shard_is_parent(shard1, subshard)); CHECK(out_msg_queue_); td::uint64 queue_size; int res1 = block::filter_out_msg_queue(*out_msg_queue_, shard1, subshard, &queue_size); @@ -1129,7 +1129,7 @@ td::Status ShardState::split(ton::ShardIdFull subshard) { return td::Status::OK(); } -int filter_out_msg_queue(vm::AugmentedDictionary& out_queue, ton::ShardIdFull old_shard, ton::ShardIdFull subshard, +int filter_out_msg_queue(vm::AugmentedDictionary& out_queue, ion::ShardIdFull old_shard, ion::ShardIdFull subshard, td::uint64* queue_size) { if (queue_size) { *queue_size = 0; @@ -1152,12 +1152,12 @@ int filter_out_msg_queue(vm::AugmentedDictionary& out_queue, ton::ShardIdFull ol << " has invalid source or destination address"; return -1; } - if (!ton::shard_contains(old_shard, cur_prefix)) { + if (!ion::shard_contains(old_shard, cur_prefix)) { LOG(ERROR) << "OutMsgQueue message with key " << key.to_hex(key_len) << " does not contain current address belonging to shard " << old_shard.to_str(); return -1; } - bool res = ton::shard_contains(subshard, cur_prefix); + bool res = ion::shard_contains(subshard, cur_prefix); if (res && queue_size) { ++*queue_size; } @@ -1497,7 +1497,7 @@ std::ostream& operator<<(std::ostream& os, const ValueFlow& vflow) { return os; } -bool DiscountedCounter::increase_by(unsigned count, ton::UnixTime now) { +bool DiscountedCounter::increase_by(unsigned count, ion::UnixTime now) { if (!validate()) { return false; } @@ -1855,7 +1855,7 @@ bool sub_extra_currency(Ref extra1, Ref extra2, Ref= 32) { unsigned long long mask = (std::numeric_limits::max() >> (d - 32)); - return ton::AccountIdPrefixFull{dest.workchain, (dest.account_id_prefix & ~mask) | (src.account_id_prefix & mask)}; + return ion::AccountIdPrefixFull{dest.workchain, (dest.account_id_prefix & ~mask) | (src.account_id_prefix & mask)}; } else { int mask = (int)(~0U >> d); - return ton::AccountIdPrefixFull{(dest.workchain & ~mask) | (src.workchain & mask), src.account_id_prefix}; + return ion::AccountIdPrefixFull{(dest.workchain & ~mask) | (src.workchain & mask), src.account_id_prefix}; } } -bool interpolate_addr_to(const ton::AccountIdPrefixFull& src, const ton::AccountIdPrefixFull& dest, int d, - ton::AccountIdPrefixFull& res) { +bool interpolate_addr_to(const ion::AccountIdPrefixFull& src, const ion::AccountIdPrefixFull& dest, int d, + ion::AccountIdPrefixFull& res) { res = interpolate_addr(src, dest, d); return true; } // result: (transit_addr_dest_bits, nh_addr_dest_bits) -std::pair perform_hypercube_routing(ton::AccountIdPrefixFull src, ton::AccountIdPrefixFull dest, - ton::ShardIdFull cur, int used_dest_bits) { - ton::AccountIdPrefixFull transit = interpolate_addr(src, dest, used_dest_bits); - if (!ton::shard_contains(cur, transit)) { +std::pair perform_hypercube_routing(ion::AccountIdPrefixFull src, ion::AccountIdPrefixFull dest, + ion::ShardIdFull cur, int used_dest_bits) { + ion::AccountIdPrefixFull transit = interpolate_addr(src, dest, used_dest_bits); + if (!ion::shard_contains(cur, transit)) { return {-1, -1}; } - if (ton::shard_contains(cur, dest)) { + if (ion::shard_contains(cur, dest)) { // if destination is in this shard, set cur:=next_hop:=dest return {96, 96}; } - if (transit.workchain == ton::masterchainId || dest.workchain == ton::masterchainId) { + if (transit.workchain == ion::masterchainId || dest.workchain == ion::masterchainId) { return {used_dest_bits, 96}; // route messages to/from masterchain directly } if (transit.workchain != dest.workchain) { @@ -1920,14 +1920,14 @@ bool compute_out_msg_queue_key(Ref msg_env, td::BitArray<352>& key) { return true; } -bool unpack_block_prev_blk(Ref block_root, const ton::BlockIdExt& id, std::vector& prev, - ton::BlockIdExt& mc_blkid, bool& after_split, ton::BlockIdExt* fetch_blkid) { +bool unpack_block_prev_blk(Ref block_root, const ion::BlockIdExt& id, std::vector& prev, + ion::BlockIdExt& mc_blkid, bool& after_split, ion::BlockIdExt* fetch_blkid) { return unpack_block_prev_blk_ext(std::move(block_root), id, prev, mc_blkid, after_split, fetch_blkid).is_ok(); } -td::Status unpack_block_prev_blk_try(Ref block_root, const ton::BlockIdExt& id, - std::vector& prev, ton::BlockIdExt& mc_blkid, bool& after_split, - ton::BlockIdExt* fetch_blkid) { +td::Status unpack_block_prev_blk_try(Ref block_root, const ion::BlockIdExt& id, + std::vector& prev, ion::BlockIdExt& mc_blkid, bool& after_split, + ion::BlockIdExt* fetch_blkid) { try { return unpack_block_prev_blk_ext(std::move(block_root), id, prev, mc_blkid, after_split, fetch_blkid); } catch (vm::VmError err) { @@ -1937,24 +1937,24 @@ td::Status unpack_block_prev_blk_try(Ref block_root, const ton::BlockI } } -td::Status unpack_block_prev_blk_ext(Ref block_root, const ton::BlockIdExt& id, - std::vector& prev, ton::BlockIdExt& mc_blkid, bool& after_split, - ton::BlockIdExt* fetch_blkid) { +td::Status unpack_block_prev_blk_ext(Ref block_root, const ion::BlockIdExt& id, + std::vector& prev, ion::BlockIdExt& mc_blkid, bool& after_split, + ion::BlockIdExt* fetch_blkid) { block::gen::Block::Record blk; block::gen::BlockInfo::Record info; block::gen::ExtBlkRef::Record mcref; // _ ExtBlkRef = BlkMasterInfo; - ton::ShardIdFull shard; + ion::ShardIdFull shard; if (!(tlb::unpack_cell(block_root, blk) && tlb::unpack_cell(blk.info, info) && !info.version && block::tlb::t_ShardIdent.unpack(info.shard.write(), shard) && (!info.not_master || tlb::unpack_cell(info.master_ref, mcref)))) { return td::Status::Error("cannot unpack block header"); } if (fetch_blkid) { - fetch_blkid->id = ton::BlockId{shard, (unsigned)info.seq_no}; + fetch_blkid->id = ion::BlockId{shard, (unsigned)info.seq_no}; fetch_blkid->root_hash = block_root->get_hash().bits(); fetch_blkid->file_hash.clear(); } else { - ton::BlockId hdr_id{shard, (unsigned)info.seq_no}; + ion::BlockId hdr_id{shard, (unsigned)info.seq_no}; if (id.id != hdr_id) { return td::Status::Error("block header contains block id "s + hdr_id.to_str() + ", expected " + id.id.to_str()); } @@ -1981,9 +1981,9 @@ td::Status unpack_block_prev_blk_ext(Ref block_root, const ton::BlockI } } prev.clear(); - ton::BlockSeqno prev_seqno = prev1.seq_no; + ion::BlockSeqno prev_seqno = prev1.seq_no; if (!info.after_merge) { - prev.emplace_back(shard.workchain, info.after_split ? ton::shard_parent(shard.shard) : shard.shard, prev1.seq_no, + prev.emplace_back(shard.workchain, info.after_split ? ion::shard_parent(shard.shard) : shard.shard, prev1.seq_no, prev1.root_hash, prev1.file_hash); if (info.after_split && !prev1.seq_no) { return td::Status::Error("shardchains cannot be split immediately after initial state"); @@ -1992,9 +1992,9 @@ td::Status unpack_block_prev_blk_ext(Ref block_root, const ton::BlockI if (info.after_split) { return td::Status::Error("shardchains cannot be simultaneously split and merged at the same block"); } - prev.emplace_back(shard.workchain, ton::shard_child(shard.shard, true), prev1.seq_no, prev1.root_hash, + prev.emplace_back(shard.workchain, ion::shard_child(shard.shard, true), prev1.seq_no, prev1.root_hash, prev1.file_hash); - prev.emplace_back(shard.workchain, ton::shard_child(shard.shard, false), prev2.seq_no, prev2.root_hash, + prev.emplace_back(shard.workchain, ion::shard_child(shard.shard, false), prev2.seq_no, prev2.root_hash, prev2.file_hash); prev_seqno = std::max(prev1.seq_no, prev2.seq_no); if (!prev1.seq_no || !prev2.seq_no) { @@ -2007,7 +2007,7 @@ td::Status unpack_block_prev_blk_ext(Ref block_root, const ton::BlockI if (shard.is_masterchain()) { mc_blkid = prev.at(0); } else { - mc_blkid = ton::BlockIdExt{ton::masterchainId, ton::shardIdAll, mcref.seq_no, mcref.root_hash, mcref.file_hash}; + mc_blkid = ion::BlockIdExt{ion::masterchainId, ion::shardIdAll, mcref.seq_no, mcref.root_hash, mcref.file_hash}; } if (shard.is_masterchain() && info.vert_seqno_incr && !info.key_block) { return td::Status::Error("non-key masterchain block cannot have vert_seqno_incr set"); @@ -2015,15 +2015,15 @@ td::Status unpack_block_prev_blk_ext(Ref block_root, const ton::BlockI return td::Status::OK(); } -td::Status check_block_header(Ref block_root, const ton::BlockIdExt& id, ton::Bits256* store_shard_hash_to) { +td::Status check_block_header(Ref block_root, const ion::BlockIdExt& id, ion::Bits256* store_shard_hash_to) { block::gen::Block::Record blk; block::gen::BlockInfo::Record info; - ton::ShardIdFull shard; + ion::ShardIdFull shard; if (!(tlb::unpack_cell(block_root, blk) && tlb::unpack_cell(blk.info, info) && !info.version && block::tlb::t_ShardIdent.unpack(info.shard.write(), shard))) { return td::Status::Error("cannot unpack block header"); } - ton::BlockId hdr_id{shard, (unsigned)info.seq_no}; + ion::BlockId hdr_id{shard, (unsigned)info.seq_no}; if (id.id != hdr_id) { return td::Status::Error("block header contains block id "s + hdr_id.to_str() + ", expected " + id.id.to_str()); } @@ -2068,37 +2068,37 @@ std::unique_ptr get_prev_blocks_dict(Ref stat return std::make_unique(extra_info.r1.prev_blocks, 32, block::tlb::aug_OldMcBlocksInfo); } -bool get_old_mc_block_id(vm::AugmentedDictionary* prev_blocks_dict, ton::BlockSeqno seqno, ton::BlockIdExt& blkid, - ton::LogicalTime* end_lt) { +bool get_old_mc_block_id(vm::AugmentedDictionary* prev_blocks_dict, ion::BlockSeqno seqno, ion::BlockIdExt& blkid, + ion::LogicalTime* end_lt) { return prev_blocks_dict && get_old_mc_block_id(*prev_blocks_dict, seqno, blkid, end_lt); } -bool get_old_mc_block_id(vm::AugmentedDictionary& prev_blocks_dict, ton::BlockSeqno seqno, ton::BlockIdExt& blkid, - ton::LogicalTime* end_lt) { +bool get_old_mc_block_id(vm::AugmentedDictionary& prev_blocks_dict, ion::BlockSeqno seqno, ion::BlockIdExt& blkid, + ion::LogicalTime* end_lt) { return unpack_old_mc_block_id(prev_blocks_dict.lookup(td::BitArray<32>{seqno}), seqno, blkid, end_lt); } -bool unpack_old_mc_block_id(Ref old_blk_info, ton::BlockSeqno seqno, ton::BlockIdExt& blkid, - ton::LogicalTime* end_lt) { +bool unpack_old_mc_block_id(Ref old_blk_info, ion::BlockSeqno seqno, ion::BlockIdExt& blkid, + ion::LogicalTime* end_lt) { return old_blk_info.not_null() && old_blk_info.write().advance(1) && block::tlb::t_ExtBlkRef.unpack(std::move(old_blk_info), blkid, end_lt) && blkid.seqno() == seqno; } -bool check_old_mc_block_id(vm::AugmentedDictionary* prev_blocks_dict, const ton::BlockIdExt& blkid) { +bool check_old_mc_block_id(vm::AugmentedDictionary* prev_blocks_dict, const ion::BlockIdExt& blkid) { return prev_blocks_dict && check_old_mc_block_id(*prev_blocks_dict, blkid); } -bool check_old_mc_block_id(vm::AugmentedDictionary& prev_blocks_dict, const ton::BlockIdExt& blkid) { +bool check_old_mc_block_id(vm::AugmentedDictionary& prev_blocks_dict, const ion::BlockIdExt& blkid) { if (!blkid.id.is_masterchain_ext()) { return false; } - ton::BlockIdExt old_blkid; + ion::BlockIdExt old_blkid; return unpack_old_mc_block_id(prev_blocks_dict.lookup(td::BitArray<32>{blkid.id.seqno}), blkid.id.seqno, old_blkid) && old_blkid == blkid; } -td::Result> get_block_transaction(Ref block_root, ton::WorkchainId workchain, - const ton::StdSmcAddress& addr, ton::LogicalTime lt) { +td::Result> get_block_transaction(Ref block_root, ion::WorkchainId workchain, + const ion::StdSmcAddress& addr, ion::LogicalTime lt) { block::gen::Block::Record block; block::gen::BlockInfo::Record info; if (!(tlb::unpack_cell(std::move(block_root), block) && tlb::unpack_cell(std::move(block.info), info))) { @@ -2128,8 +2128,8 @@ td::Result> get_block_transaction(Ref block_root, ton::W return Ref{}; } -td::Result> get_block_transaction_try(Ref block_root, ton::WorkchainId workchain, - const ton::StdSmcAddress& addr, ton::LogicalTime lt) { +td::Result> get_block_transaction_try(Ref block_root, ion::WorkchainId workchain, + const ion::StdSmcAddress& addr, ion::LogicalTime lt) { try { return get_block_transaction(std::move(block_root), workchain, addr, lt); } catch (vm::VmError err) { @@ -2176,7 +2176,7 @@ bool is_transaction_out_msg(Ref trans_ref, Ref msg) { } // transaction$0111 account_addr:bits256 lt:uint64 ... -bool get_transaction_id(Ref trans_ref, ton::StdSmcAddress& account_addr, ton::LogicalTime& lt) { +bool get_transaction_id(Ref trans_ref, ion::StdSmcAddress& account_addr, ion::LogicalTime& lt) { if (trans_ref.is_null()) { return false; } @@ -2186,22 +2186,22 @@ bool get_transaction_id(Ref trans_ref, ton::StdSmcAddress& account_add && cs.fetch_uint_to(64, lt); // lt:uint64 } -bool get_transaction_owner(Ref trans_ref, ton::StdSmcAddress& addr) { - ton::LogicalTime lt; +bool get_transaction_owner(Ref trans_ref, ion::StdSmcAddress& addr) { + ion::LogicalTime lt; return get_transaction_id(std::move(trans_ref), addr, lt); } -td::uint32 compute_validator_set_hash(ton::CatchainSeqno cc_seqno, ton::ShardIdFull from, - const std::vector& nodes) { +td::uint32 compute_validator_set_hash(ion::CatchainSeqno cc_seqno, ion::ShardIdFull from, + const std::vector& nodes) { /* - std::vector> s_vec; + std::vector> s_vec; for (auto& n : nodes) { auto id = ValidatorFullId{n.key}.short_id(); - s_vec.emplace_back(create_tl_object(id, n.weight)); + s_vec.emplace_back(create_tl_object(id, n.weight)); } - auto obj = create_tl_object(cc_seqno, std::move(s_vec)); + auto obj = create_tl_object(cc_seqno, std::move(s_vec)); auto B = serialize_tl_object(obj, true); return td::crc32c(B.as_slice()); */ @@ -2302,7 +2302,7 @@ bool parse_hex_hash(td::Slice str, td::Bits256& hash) { return parse_hex_hash(str.begin(), str.end(), hash); } -bool parse_block_id_ext(const char* str, const char* end, ton::BlockIdExt& blkid) { +bool parse_block_id_ext(const char* str, const char* end, ion::BlockIdExt& blkid) { blkid.invalidate(); if (!str || !end || str >= end || end - str > 255) { return false; @@ -2319,19 +2319,19 @@ bool parse_block_id_ext(const char* str, const char* end, ton::BlockIdExt& blkid if (std::sscanf(str, "(%d,%llx,%u):%n", &wc, &shard, &seqno, &pos) < 3 || pos <= 0 || pos >= end - str) { return false; } - if (!shard || wc == ton::workchainInvalid) { + if (!shard || wc == ion::workchainInvalid) { return false; } str += pos; if (end - str != 64 * 2 + 1 || str[64] != ':') { return false; } - blkid.id = ton::BlockId{wc, shard, seqno}; + blkid.id = ion::BlockId{wc, shard, seqno}; return (parse_hex_hash(str, str + 64, blkid.root_hash) && parse_hex_hash(str + 65, end, blkid.file_hash)) || blkid.invalidate(); } -bool parse_block_id_ext(td::Slice str, ton::BlockIdExt& blkid) { +bool parse_block_id_ext(td::Slice str, ion::BlockIdExt& blkid) { return parse_block_id_ext(str.begin(), str.end(), blkid); } @@ -2365,7 +2365,7 @@ Ref pack_account_dispatch_queue(const vm::Dictionary& dict, td::u } Ref get_dispatch_queue_min_lt_account(const vm::AugmentedDictionary& dispatch_queue, - ton::StdSmcAddress& addr) { + ion::StdSmcAddress& addr) { // TODO: This can be done more effectively vm::AugmentedDictionary queue{dispatch_queue.get_root(), 256, tlb::aug_DispatchQueue}; if (queue.is_empty()) { @@ -2375,7 +2375,7 @@ Ref get_dispatch_queue_min_lt_account(const vm::AugmentedDictiona if (root_extra.is_null()) { return {}; } - ton::LogicalTime min_lt = root_extra->prefetch_long(64); + ion::LogicalTime min_lt = root_extra->prefetch_long(64); while (true) { td::Bits256 key; int pfx_len = queue.get_common_prefix(key.bits(), 256); @@ -2395,7 +2395,7 @@ Ref get_dispatch_queue_min_lt_account(const vm::AugmentedDictiona if (root_extra.is_null()) { return {}; } - ton::LogicalTime cut_min_lt = root_extra->prefetch_long(64); + ion::LogicalTime cut_min_lt = root_extra->prefetch_long(64); if (cut_min_lt != min_lt) { key[pfx_len] = true; } @@ -2405,8 +2405,8 @@ Ref get_dispatch_queue_min_lt_account(const vm::AugmentedDictiona } } -bool remove_dispatch_queue_entry(vm::AugmentedDictionary& dispatch_queue, const ton::StdSmcAddress& addr, - ton::LogicalTime lt) { +bool remove_dispatch_queue_entry(vm::AugmentedDictionary& dispatch_queue, const ion::StdSmcAddress& addr, + ion::LogicalTime lt) { auto account_dispatch_queue = dispatch_queue.lookup(addr); if (account_dispatch_queue.is_null()) { return false; diff --git a/crypto/block/block.h b/crypto/block/block.h index 0247d79cb..b94688930 100644 --- a/crypto/block/block.h +++ b/crypto/block/block.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -28,7 +28,7 @@ #include "td/utils/bits.h" #include "td/utils/CancellationToken.h" #include "td/utils/StringBuilder.h" -#include "ton/ton-types.h" +#include "ion/ion-types.h" namespace block { @@ -45,24 +45,24 @@ struct PublicKey { }; struct StdAddress { - ton::WorkchainId workchain{ton::workchainInvalid}; + ion::WorkchainId workchain{ion::workchainInvalid}; bool bounceable{true}; // addresses must be bounceable by default bool testnet{false}; - ton::StdSmcAddress addr; + ion::StdSmcAddress addr; StdAddress() = default; - StdAddress(ton::WorkchainId _wc, const ton::StdSmcAddress& _addr, bool _bounce = true, bool _testnet = false) + StdAddress(ion::WorkchainId _wc, const ion::StdSmcAddress& _addr, bool _bounce = true, bool _testnet = false) : workchain(_wc), bounceable(_bounce), testnet(_testnet), addr(_addr) { } - StdAddress(ton::WorkchainId _wc, td::ConstBitPtr _addr, bool _bounce = true, bool _testnet = false) + StdAddress(ion::WorkchainId _wc, td::ConstBitPtr _addr, bool _bounce = true, bool _testnet = false) : workchain(_wc), bounceable(_bounce), testnet(_testnet), addr(_addr) { } explicit StdAddress(std::string serialized); explicit StdAddress(td::Slice from); bool is_valid() const { - return workchain != ton::workchainInvalid; + return workchain != ion::workchainInvalid; } bool invalidate() { - workchain = ton::workchainInvalid; + workchain = ion::workchainInvalid; return false; } std::string rserialize(bool base64_url = false) const; @@ -81,21 +81,21 @@ inline td::StringBuilder& operator<<(td::StringBuilder& sb, const StdAddress& ad return sb << addr.workchain << " : " << addr.addr.to_hex(); } -bool parse_std_account_addr(td::Slice acc_string, ton::WorkchainId& wc, ton::StdSmcAddress& addr, +bool parse_std_account_addr(td::Slice acc_string, ion::WorkchainId& wc, ion::StdSmcAddress& addr, bool* bounceable = nullptr, bool* testnet_only = nullptr); struct ShardId { - ton::WorkchainId workchain_id; + ion::WorkchainId workchain_id; int shard_pfx_len; unsigned long long shard_pfx; - ShardId(ton::WorkchainId wc_id = ton::workchainInvalid) + ShardId(ion::WorkchainId wc_id = ion::workchainInvalid) : workchain_id(wc_id), shard_pfx_len(0), shard_pfx(1ULL << 63) { } - ShardId(ton::WorkchainId wc_id, unsigned long long sh_pfx); - ShardId(ton::ShardIdFull ton_shard); - ShardId(ton::BlockId ton_block); - ShardId(const ton::BlockIdExt& ton_block); - ShardId(ton::WorkchainId wc_id, unsigned long long sh_pfx, int sh_pfx_len); + ShardId(ion::WorkchainId wc_id, unsigned long long sh_pfx); + ShardId(ion::ShardIdFull ion_shard); + ShardId(ion::BlockId ion_block); + ShardId(const ion::BlockIdExt& ion_block); + ShardId(ion::WorkchainId wc_id, unsigned long long sh_pfx, int sh_pfx_len); ShardId(vm::CellSlice& cs) { deserialize(cs); } @@ -103,18 +103,18 @@ struct ShardId { vm::CellSlice cs{*cs_ref}; deserialize(cs); } - explicit operator ton::ShardIdFull() const { - return ton::ShardIdFull{workchain_id, shard_pfx}; + explicit operator ion::ShardIdFull() const { + return ion::ShardIdFull{workchain_id, shard_pfx}; } bool operator==(const ShardId& other) const { return workchain_id == other.workchain_id && shard_pfx == other.shard_pfx; } void invalidate() { - workchain_id = ton::workchainInvalid; + workchain_id = ion::workchainInvalid; shard_pfx_len = 0; } bool is_valid() const { - return workchain_id != ton::workchainInvalid; + return workchain_id != ion::workchainInvalid; } void show(std::ostream& os) const; std::string to_str() const; @@ -126,15 +126,15 @@ struct ShardId { }; struct EnqueuedMsgDescr { - ton::AccountIdPrefixFull src_prefix_, cur_prefix_, next_prefix_, dest_prefix_; - ton::LogicalTime lt_; - ton::LogicalTime enqueued_lt_; - ton::Bits256 hash_; + ion::AccountIdPrefixFull src_prefix_, cur_prefix_, next_prefix_, dest_prefix_; + ion::LogicalTime lt_; + ion::LogicalTime enqueued_lt_; + ion::Bits256 hash_; Ref msg_; Ref msg_env_; EnqueuedMsgDescr() = default; - EnqueuedMsgDescr(ton::AccountIdPrefixFull cur_pfx, ton::AccountIdPrefixFull next_pfx, ton::LogicalTime lt, - ton::LogicalTime enqueued_lt, td::ConstBitPtr hash) + EnqueuedMsgDescr(ion::AccountIdPrefixFull cur_pfx, ion::AccountIdPrefixFull next_pfx, ion::LogicalTime lt, + ion::LogicalTime enqueued_lt, td::ConstBitPtr hash) : cur_prefix_(cur_pfx), next_prefix_(next_pfx), lt_(lt), enqueued_lt_(enqueued_lt), hash_(hash) { } bool is_valid() const { @@ -142,7 +142,7 @@ struct EnqueuedMsgDescr { } bool check_key(td::ConstBitPtr key) const; bool invalidate() { - next_prefix_.workchain = cur_prefix_.workchain = ton::workchainInvalid; + next_prefix_.workchain = cur_prefix_.workchain = ion::workchainInvalid; return false; } bool unpack(vm::CellSlice& cs); @@ -151,24 +151,24 @@ struct EnqueuedMsgDescr { } }; -using compute_shard_end_lt_func_t = std::function; +using compute_shard_end_lt_func_t = std::function; struct MsgProcessedUpto { - ton::ShardId shard; - ton::BlockSeqno mc_seqno; - ton::LogicalTime last_inmsg_lt; - ton::Bits256 last_inmsg_hash; + ion::ShardId shard; + ion::BlockSeqno mc_seqno; + ion::LogicalTime last_inmsg_lt; + ion::Bits256 last_inmsg_hash; compute_shard_end_lt_func_t compute_shard_end_lt; MsgProcessedUpto() = default; - MsgProcessedUpto(ton::ShardId _shard, ton::BlockSeqno _mcseqno, ton::LogicalTime _lt, td::ConstBitPtr _hash) + MsgProcessedUpto(ion::ShardId _shard, ion::BlockSeqno _mcseqno, ion::LogicalTime _lt, td::ConstBitPtr _hash) : shard(_shard), mc_seqno(_mcseqno), last_inmsg_lt(_lt), last_inmsg_hash(_hash) { } bool operator<(const MsgProcessedUpto& other) const& { return shard < other.shard || (shard == other.shard && mc_seqno < other.mc_seqno); } bool contains(const MsgProcessedUpto& other) const&; - bool contains(ton::ShardId other_shard, ton::LogicalTime other_lt, td::ConstBitPtr other_hash, - ton::BlockSeqno other_mc_seqno) const&; + bool contains(ion::ShardId other_shard, ion::LogicalTime other_lt, td::ConstBitPtr other_hash, + ion::BlockSeqno other_mc_seqno) const&; // NB: this is for checking whether we have already imported an internal message bool already_processed(const EnqueuedMsgDescr& msg) const; bool can_check_processed() const { @@ -183,31 +183,31 @@ static inline std::ostream& operator<<(std::ostream& os, const MsgProcessedUpto& } struct MsgProcessedUptoCollection { - ton::ShardIdFull owner; + ion::ShardIdFull owner; bool valid{false}; std::vector list; - MsgProcessedUptoCollection(ton::ShardIdFull _owner) : owner(_owner) { + MsgProcessedUptoCollection(ion::ShardIdFull _owner) : owner(_owner) { } - MsgProcessedUptoCollection(ton::ShardIdFull _owner, Ref cs_ref); - static std::unique_ptr unpack(ton::ShardIdFull _owner, Ref cs_ref); + MsgProcessedUptoCollection(ion::ShardIdFull _owner, Ref cs_ref); + static std::unique_ptr unpack(ion::ShardIdFull _owner, Ref cs_ref); bool is_valid() const { return valid; } - bool insert(ton::BlockSeqno mc_seqno, ton::LogicalTime last_proc_lt, td::ConstBitPtr last_proc_hash); - bool insert_infty(ton::BlockSeqno mc_seqno, ton::LogicalTime last_proc_lt = ~0ULL); + bool insert(ion::BlockSeqno mc_seqno, ion::LogicalTime last_proc_lt, td::ConstBitPtr last_proc_hash); + bool insert_infty(ion::BlockSeqno mc_seqno, ion::LogicalTime last_proc_lt = ~0ULL); bool compactify(); bool pack(vm::CellBuilder& cb); bool is_reduced() const; bool contains(const MsgProcessedUpto& other) const; bool contains(const MsgProcessedUptoCollection& other) const; const MsgProcessedUpto* is_simple_update_of(const MsgProcessedUptoCollection& other, bool& ok) const; - ton::BlockSeqno min_mc_seqno() const; - bool split(ton::ShardIdFull new_owner); + ion::BlockSeqno min_mc_seqno() const; + bool split(ion::ShardIdFull new_owner); bool combine_with(const MsgProcessedUptoCollection& other); // NB: this is for checking whether we have already imported an internal message bool already_processed(const EnqueuedMsgDescr& msg) const; bool can_check_processed() const; - bool for_each_mcseqno(std::function) const; + bool for_each_mcseqno(std::function) const; std::ostream& print(std::ostream& os) const; std::string to_str() const; }; @@ -252,24 +252,24 @@ struct ParamLimits { struct BlockLimits { ParamLimits bytes, gas, lt_delta; - ton::LogicalTime start_lt{0}; + ion::LogicalTime start_lt{0}; const vm::CellUsageTree* usage_tree{nullptr}; bool deserialize(vm::CellSlice& cs); int classify_size(td::uint64 size) const; int classify_gas(td::uint64 gas) const; - int classify_lt(ton::LogicalTime lt) const; - int classify(td::uint64 size, td::uint64 gas, ton::LogicalTime lt) const; - bool fits(unsigned cls, td::uint64 size, td::uint64 gas, ton::LogicalTime lt) const; + int classify_lt(ion::LogicalTime lt) const; + int classify(td::uint64 size, td::uint64 gas, ion::LogicalTime lt) const; + bool fits(unsigned cls, td::uint64 size, td::uint64 gas, ion::LogicalTime lt) const; }; struct BlockLimitStatus { const BlockLimits& limits; - ton::LogicalTime cur_lt; + ion::LogicalTime cur_lt; td::uint64 gas_used{}; vm::NewCellStorageStat st_stat; unsigned accounts{}, transactions{}, extra_out_msgs{}; unsigned public_library_diff{}; - BlockLimitStatus(const BlockLimits& limits_, ton::LogicalTime lt = 0) + BlockLimitStatus(const BlockLimits& limits_, ion::LogicalTime lt = 0) : limits(limits_), cur_lt(std::max(limits_.start_lt, lt)) { } void reset() { @@ -283,7 +283,7 @@ struct BlockLimitStatus { td::uint64 estimate_block_size(const vm::NewCellStorageStat::Stat* extra = nullptr) const; int classify() const; bool fits(unsigned cls) const; - bool would_fit(unsigned cls, ton::LogicalTime end_lt, td::uint64 more_gas, + bool would_fit(unsigned cls, ion::LogicalTime end_lt, td::uint64 more_gas, const vm::NewCellStorageStat::Stat* extra = nullptr) const; bool add_cell(Ref cell) { st_stat.add_cell(std::move(cell)); @@ -293,7 +293,7 @@ struct BlockLimitStatus { st_stat.add_proof(std::move(cell), limits.usage_tree); return true; } - bool update_lt(ton::LogicalTime lt) { + bool update_lt(ion::LogicalTime lt) { cur_lt = std::max(lt, cur_lt); return true; } @@ -405,14 +405,14 @@ std::ostream& operator<<(std::ostream& os, const CurrencyCollection& cc); struct ShardState { enum { verbosity = 0 }; - ton::BlockIdExt id_; + ion::BlockIdExt id_; Ref root_; int global_id_; - ton::UnixTime utime_; - ton::LogicalTime lt_; - ton::BlockSeqno mc_blk_seqno_, min_ref_mc_seqno_, vert_seqno_; - ton::BlockIdExt mc_blk_ref_; - ton::LogicalTime mc_blk_lt_; + ion::UnixTime utime_; + ion::LogicalTime lt_; + ion::BlockSeqno mc_blk_seqno_, min_ref_mc_seqno_, vert_seqno_; + ion::BlockIdExt mc_blk_ref_; + ion::LogicalTime mc_blk_lt_; bool before_split_{false}; std::unique_ptr account_dict_; std::unique_ptr shard_libraries_; @@ -436,15 +436,15 @@ struct ShardState { id_.invalidate(); return false; } - td::Status unpack_state(ton::BlockIdExt id, Ref state_root); - td::Status unpack_state_ext(ton::BlockIdExt id, Ref state_root, int global_id, - ton::BlockSeqno prev_mc_block_seqno, bool after_split, bool clear_history, - std::function for_each_mcseqno); + td::Status unpack_state(ion::BlockIdExt id, Ref state_root); + td::Status unpack_state_ext(ion::BlockIdExt id, Ref state_root, int global_id, + ion::BlockSeqno prev_mc_block_seqno, bool after_split, bool clear_history, + std::function for_each_mcseqno); td::Status merge_with(ShardState& sib); - td::Result> compute_split_out_msg_queue(ton::ShardIdFull subshard); + td::Result> compute_split_out_msg_queue(ion::ShardIdFull subshard); td::Result> compute_split_processed_upto( - ton::ShardIdFull subshard); - td::Status split(ton::ShardIdFull subshard); + ion::ShardIdFull subshard); + td::Status split(ion::ShardIdFull subshard); td::Status unpack_out_msg_queue_info(Ref out_msg_queue_info); bool clear_load_history() { overload_history_ = underload_history_ = 0; @@ -455,10 +455,10 @@ struct ShardState { } td::Status check_before_split(bool before_split) const; td::Status check_global_id(int req_global_id) const; - td::Status check_mc_blk_seqno(ton::BlockSeqno last_mc_block_seqno) const; - bool update_prev_utime_lt(ton::UnixTime& prev_utime, ton::LogicalTime& prev_lt) const; + td::Status check_mc_blk_seqno(ion::BlockSeqno last_mc_block_seqno) const; + bool update_prev_utime_lt(ion::UnixTime& prev_utime, ion::LogicalTime& prev_lt) const; - bool for_each_mcseqno(std::function func) const { + bool for_each_mcseqno(std::function func) const { return processed_upto_ && processed_upto_->for_each_mcseqno(std::move(func)); } }; @@ -503,7 +503,7 @@ std::ostream& operator<<(std::ostream& os, const ValueFlow& vflow); struct DiscountedCounter { struct SetZero {}; bool valid; - ton::UnixTime last_updated; + ion::UnixTime last_updated; td::uint64 total; td::uint64 cnt2048; td::uint64 cnt65536; @@ -511,7 +511,7 @@ struct DiscountedCounter { } DiscountedCounter(SetZero) : valid(true), last_updated(0), total(0), cnt2048(0), cnt65536(0) { } - DiscountedCounter(ton::UnixTime _lastupd, td::uint64 _total, td::uint64 _cnt2048, td::uint64 _cnt65536) + DiscountedCounter(ion::UnixTime _lastupd, td::uint64 _total, td::uint64 _cnt2048, td::uint64 _cnt65536) : valid(true), last_updated(_lastupd), total(_total), cnt2048(_cnt2048), cnt65536(_cnt65536) { } static DiscountedCounter Zero() { @@ -542,11 +542,11 @@ struct DiscountedCounter { return last_updated == other.last_updated && total == other.total && cnt2048 <= other.cnt2048 + 1 && other.cnt2048 <= cnt2048 + 1 && cnt65536 <= other.cnt65536 + 1 && other.cnt65536 <= cnt65536 + 1; } - bool modified_since(ton::UnixTime utime) const { + bool modified_since(ion::UnixTime utime) const { return last_updated >= utime; } bool validate(); - bool increase_by(unsigned count, ton::UnixTime now); + bool increase_by(unsigned count, ion::UnixTime now); bool fetch(vm::CellSlice& cs); bool unpack(Ref csr); bool store(vm::CellBuilder& cb) const; @@ -565,13 +565,13 @@ bool store_CreatorStats(vm::CellBuilder& cb, const DiscountedCounter& mc_cnt, co bool unpack_CreatorStats(Ref cs, DiscountedCounter& mc_cnt, DiscountedCounter& shard_cnt); struct BlockProofLink { - ton::BlockIdExt from, to; + ion::BlockIdExt from, to; bool is_key{false}, is_fwd{false}; Ref dest_proof, state_proof, proof; - ton::CatchainSeqno cc_seqno{0}; + ion::CatchainSeqno cc_seqno{0}; td::uint32 validator_set_hash{0}; - std::vector signatures; - BlockProofLink(ton::BlockIdExt _from, ton::BlockIdExt _to, bool _iskey = false) + std::vector signatures; + BlockProofLink(ion::BlockIdExt _from, ion::BlockIdExt _to, bool _iskey = false) : from(_from), to(_to), is_key(_iskey), is_fwd(to.seqno() > from.seqno()) { } bool incomplete() const { @@ -581,18 +581,18 @@ struct BlockProofLink { }; struct BlockProofChain { - ton::BlockIdExt from, to; + ion::BlockIdExt from, to; int mode; td::uint32 last_utime{0}; bool complete{false}, has_key_block{false}, has_utime{false}, valid{false}; - ton::BlockIdExt key_blkid; + ion::BlockIdExt key_blkid; std::vector links; std::size_t link_count() const { return links.size(); } - BlockProofChain(ton::BlockIdExt _from, ton::BlockIdExt _to, int _mode = 0) : from(_from), to(_to), mode(_mode) { + BlockProofChain(ion::BlockIdExt _from, ion::BlockIdExt _to, int _mode = 0) : from(_from), to(_to), mode(_mode) { } - BlockProofLink& new_link(const ton::BlockIdExt& cur, const ton::BlockIdExt& next, bool iskey = false) { + BlockProofLink& new_link(const ion::BlockIdExt& cur, const ion::BlockIdExt& next, bool iskey = false) { links.emplace_back(cur, next, iskey); return links.back(); } @@ -664,20 +664,20 @@ class MtCarloComputeShare { void gen_vset(); }; -int filter_out_msg_queue(vm::AugmentedDictionary& out_queue, ton::ShardIdFull old_shard, ton::ShardIdFull subshard, +int filter_out_msg_queue(vm::AugmentedDictionary& out_queue, ion::ShardIdFull old_shard, ion::ShardIdFull subshard, td::uint64* queue_size = nullptr); std::ostream& operator<<(std::ostream& os, const ShardId& shard_id); -bool pack_std_smc_addr_to(char result[48], bool base64_url, ton::WorkchainId wc, const ton::StdSmcAddress& addr, +bool pack_std_smc_addr_to(char result[48], bool base64_url, ion::WorkchainId wc, const ion::StdSmcAddress& addr, bool bounceable, bool testnet); -std::string pack_std_smc_addr(bool base64_url, ton::WorkchainId wc, const ton::StdSmcAddress& addr, bool bounceable, +std::string pack_std_smc_addr(bool base64_url, ion::WorkchainId wc, const ion::StdSmcAddress& addr, bool bounceable, bool testnet); -bool unpack_std_smc_addr(const char packed[48], ton::WorkchainId& wc, ton::StdSmcAddress& addr, bool& bounceable, +bool unpack_std_smc_addr(const char packed[48], ion::WorkchainId& wc, ion::StdSmcAddress& addr, bool& bounceable, bool& testnet); -bool unpack_std_smc_addr(td::Slice packed, ton::WorkchainId& wc, ton::StdSmcAddress& addr, bool& bounceable, +bool unpack_std_smc_addr(td::Slice packed, ion::WorkchainId& wc, ion::StdSmcAddress& addr, bool& bounceable, bool& testnet); -bool unpack_std_smc_addr(std::string packed, ton::WorkchainId& wc, ton::StdSmcAddress& addr, bool& bounceable, +bool unpack_std_smc_addr(std::string packed, ion::WorkchainId& wc, ion::StdSmcAddress& addr, bool& bounceable, bool& testnet); bool store_UInt7(vm::CellBuilder& cb, unsigned long long value); @@ -697,52 +697,52 @@ bool config_params_present(vm::Dictionary& dict, Ref param_dict_root); bool add_extra_currency(Ref extra1, Ref extra2, Ref& res); bool sub_extra_currency(Ref extra1, Ref extra2, Ref& res); -ton::AccountIdPrefixFull interpolate_addr(const ton::AccountIdPrefixFull& src, const ton::AccountIdPrefixFull& dest, +ion::AccountIdPrefixFull interpolate_addr(const ion::AccountIdPrefixFull& src, const ion::AccountIdPrefixFull& dest, int used_dest_bits); -bool interpolate_addr_to(const ton::AccountIdPrefixFull& src, const ton::AccountIdPrefixFull& dest, int used_dest_bits, - ton::AccountIdPrefixFull& res); +bool interpolate_addr_to(const ion::AccountIdPrefixFull& src, const ion::AccountIdPrefixFull& dest, int used_dest_bits, + ion::AccountIdPrefixFull& res); // result: (transit_addr_dest_bits, nh_addr_dest_bits) -std::pair perform_hypercube_routing(ton::AccountIdPrefixFull src, ton::AccountIdPrefixFull dest, - ton::ShardIdFull cur, int used_dest_bits = 0); +std::pair perform_hypercube_routing(ion::AccountIdPrefixFull src, ion::AccountIdPrefixFull dest, + ion::ShardIdFull cur, int used_dest_bits = 0); bool compute_out_msg_queue_key(Ref msg_env, td::BitArray<352>& key); -bool unpack_block_prev_blk(Ref block_root, const ton::BlockIdExt& id, std::vector& prev, - ton::BlockIdExt& mc_blkid, bool& after_split, ton::BlockIdExt* fetch_blkid = nullptr); -td::Status unpack_block_prev_blk_ext(Ref block_root, const ton::BlockIdExt& id, - std::vector& prev, ton::BlockIdExt& mc_blkid, bool& after_split, - ton::BlockIdExt* fetch_blkid = nullptr); -td::Status unpack_block_prev_blk_try(Ref block_root, const ton::BlockIdExt& id, - std::vector& prev, ton::BlockIdExt& mc_blkid, bool& after_split, - ton::BlockIdExt* fetch_blkid = nullptr); -td::Status check_block_header(Ref block_root, const ton::BlockIdExt& id, - ton::Bits256* store_shard_hash_to = nullptr); +bool unpack_block_prev_blk(Ref block_root, const ion::BlockIdExt& id, std::vector& prev, + ion::BlockIdExt& mc_blkid, bool& after_split, ion::BlockIdExt* fetch_blkid = nullptr); +td::Status unpack_block_prev_blk_ext(Ref block_root, const ion::BlockIdExt& id, + std::vector& prev, ion::BlockIdExt& mc_blkid, bool& after_split, + ion::BlockIdExt* fetch_blkid = nullptr); +td::Status unpack_block_prev_blk_try(Ref block_root, const ion::BlockIdExt& id, + std::vector& prev, ion::BlockIdExt& mc_blkid, bool& after_split, + ion::BlockIdExt* fetch_blkid = nullptr); +td::Status check_block_header(Ref block_root, const ion::BlockIdExt& id, + ion::Bits256* store_shard_hash_to = nullptr); std::unique_ptr get_block_create_stats_dict(Ref state_root); std::unique_ptr get_prev_blocks_dict(Ref state_root); -bool get_old_mc_block_id(vm::AugmentedDictionary* prev_blocks_dict, ton::BlockSeqno seqno, ton::BlockIdExt& blkid, - ton::LogicalTime* end_lt = nullptr); -bool get_old_mc_block_id(vm::AugmentedDictionary& prev_blocks_dict, ton::BlockSeqno seqno, ton::BlockIdExt& blkid, - ton::LogicalTime* end_lt = nullptr); -bool unpack_old_mc_block_id(Ref old_blk_info, ton::BlockSeqno seqno, ton::BlockIdExt& blkid, - ton::LogicalTime* end_lt = nullptr); -bool check_old_mc_block_id(vm::AugmentedDictionary* prev_blocks_dict, const ton::BlockIdExt& blkid); -bool check_old_mc_block_id(vm::AugmentedDictionary& prev_blocks_dict, const ton::BlockIdExt& blkid); - -td::Result> get_block_transaction(Ref block_root, ton::WorkchainId workchain, - const ton::StdSmcAddress& addr, ton::LogicalTime lt); -td::Result> get_block_transaction_try(Ref block_root, ton::WorkchainId workchain, - const ton::StdSmcAddress& addr, ton::LogicalTime lt); +bool get_old_mc_block_id(vm::AugmentedDictionary* prev_blocks_dict, ion::BlockSeqno seqno, ion::BlockIdExt& blkid, + ion::LogicalTime* end_lt = nullptr); +bool get_old_mc_block_id(vm::AugmentedDictionary& prev_blocks_dict, ion::BlockSeqno seqno, ion::BlockIdExt& blkid, + ion::LogicalTime* end_lt = nullptr); +bool unpack_old_mc_block_id(Ref old_blk_info, ion::BlockSeqno seqno, ion::BlockIdExt& blkid, + ion::LogicalTime* end_lt = nullptr); +bool check_old_mc_block_id(vm::AugmentedDictionary* prev_blocks_dict, const ion::BlockIdExt& blkid); +bool check_old_mc_block_id(vm::AugmentedDictionary& prev_blocks_dict, const ion::BlockIdExt& blkid); + +td::Result> get_block_transaction(Ref block_root, ion::WorkchainId workchain, + const ion::StdSmcAddress& addr, ion::LogicalTime lt); +td::Result> get_block_transaction_try(Ref block_root, ion::WorkchainId workchain, + const ion::StdSmcAddress& addr, ion::LogicalTime lt); bool get_transaction_in_msg(Ref trans_ref, Ref& in_msg); bool is_transaction_in_msg(Ref trans_ref, Ref msg); bool is_transaction_out_msg(Ref trans_ref, Ref msg); -bool get_transaction_id(Ref trans_ref, ton::StdSmcAddress& account_addr, ton::LogicalTime& lt); -bool get_transaction_owner(Ref trans_ref, ton::StdSmcAddress& addr); +bool get_transaction_id(Ref trans_ref, ion::StdSmcAddress& account_addr, ion::LogicalTime& lt); +bool get_transaction_owner(Ref trans_ref, ion::StdSmcAddress& addr); -td::uint32 compute_validator_set_hash(ton::CatchainSeqno cc_seqno, ton::ShardIdFull from, - const std::vector& nodes); +td::uint32 compute_validator_set_hash(ion::CatchainSeqno cc_seqno, ion::ShardIdFull from, + const std::vector& nodes); td::Result> get_config_data_from_smc(Ref acc_root); td::Result> get_config_data_from_smc(Ref acc_csr); @@ -753,21 +753,21 @@ bool is_public_library(td::ConstBitPtr key, Ref val); bool parse_hex_hash(const char* str, const char* end, td::Bits256& hash); bool parse_hex_hash(td::Slice str, td::Bits256& hash); -bool parse_block_id_ext(const char* str, const char* end, ton::BlockIdExt& blkid); -bool parse_block_id_ext(td::Slice str, ton::BlockIdExt& blkid); +bool parse_block_id_ext(const char* str, const char* end, ion::BlockIdExt& blkid); +bool parse_block_id_ext(td::Slice str, ion::BlockIdExt& blkid); bool unpack_account_dispatch_queue(Ref csr, vm::Dictionary& dict, td::uint64& dict_size); Ref pack_account_dispatch_queue(const vm::Dictionary& dict, td::uint64 dict_size); Ref get_dispatch_queue_min_lt_account(const vm::AugmentedDictionary& dispatch_queue, - ton::StdSmcAddress& addr); -bool remove_dispatch_queue_entry(vm::AugmentedDictionary& dispatch_queue, const ton::StdSmcAddress& addr, - ton::LogicalTime lt); + ion::StdSmcAddress& addr); +bool remove_dispatch_queue_entry(vm::AugmentedDictionary& dispatch_queue, const ion::StdSmcAddress& addr, + ion::LogicalTime lt); struct MsgMetadata { td::uint32 depth; - ton::WorkchainId initiator_wc; - ton::StdSmcAddress initiator_addr; - ton::LogicalTime initiator_lt; + ion::WorkchainId initiator_wc; + ion::StdSmcAddress initiator_addr; + ion::LogicalTime initiator_lt; bool unpack(vm::CellSlice& cs); bool pack(vm::CellBuilder& cb) const; diff --git a/crypto/block/block.tlb b/crypto/block/block.tlb index 6f9754267..95abc8f7b 100644 --- a/crypto/block/block.tlb +++ b/crypto/block/block.tlb @@ -95,7 +95,7 @@ phme_root$1 {n:#} {X:Type} root:^(PfxHashmap n X) * */ // -// TON BLOCK LAYOUT +// ION BLOCK LAYOUT // addr_none$00 = MsgAddressExt; addr_extern$01 len:(## 9) external_address:(bits len) @@ -626,7 +626,7 @@ _ config_addr:bits256 = ConfigParam 0; _ elector_addr:bits256 = ConfigParam 1; _ minter_addr:bits256 = ConfigParam 2; // ConfigParam 0 is used if absent _ fee_collector_addr:bits256 = ConfigParam 3; // ConfigParam 1 is used if absent -_ dns_root_addr:bits256 = ConfigParam 4; // root TON DNS resolver +_ dns_root_addr:bits256 = ConfigParam 4; // root ION DNS resolver burning_config#01 blackhole_addr:(Maybe bits256) @@ -817,19 +817,19 @@ _ OracleBridgeParams = ConfigParam 71; // Ethereum bridge _ OracleBridgeParams = ConfigParam 72; // Binance Smart Chain bridge _ OracleBridgeParams = ConfigParam 73; // Polygon bridge -// Note that chains in which bridge, minter and jetton-wallet operate are fixated -jetton_bridge_prices#_ bridge_burn_fee:Coins bridge_mint_fee:Coins - wallet_min_tons_for_storage:Coins +// Note that chains in which bridge, minter and jetion-wallet operate are fixated +jetion_bridge_prices#_ bridge_burn_fee:Coins bridge_mint_fee:Coins + wallet_min_ions_for_storage:Coins wallet_gas_consumption:Coins - minter_min_tons_for_storage:Coins - discover_gas_consumption:Coins = JettonBridgePrices; + minter_min_ions_for_storage:Coins + discover_gas_consumption:Coins = JetionBridgePrices; -jetton_bridge_params_v0#00 bridge_address:bits256 oracles_address:bits256 oracles:(HashmapE 256 uint256) state_flags:uint8 burn_bridge_fee:Coins = JettonBridgeParams; -jetton_bridge_params_v1#01 bridge_address:bits256 oracles_address:bits256 oracles:(HashmapE 256 uint256) state_flags:uint8 prices:^JettonBridgePrices external_chain_address:bits256 = JettonBridgeParams; +jetion_bridge_params_v0#00 bridge_address:bits256 oracles_address:bits256 oracles:(HashmapE 256 uint256) state_flags:uint8 burn_bridge_fee:Coins = JetionBridgeParams; +jetion_bridge_params_v1#01 bridge_address:bits256 oracles_address:bits256 oracles:(HashmapE 256 uint256) state_flags:uint8 prices:^JetionBridgePrices external_chain_address:bits256 = JetionBridgeParams; -_ JettonBridgeParams = ConfigParam 79; // ETH->TON token bridge -_ JettonBridgeParams = ConfigParam 81; // BNB->TON token bridge -_ JettonBridgeParams = ConfigParam 82; // Polygon->TON token bridge +_ JetionBridgeParams = ConfigParam 79; // ETH->ION token bridge +_ JetionBridgeParams = ConfigParam 81; // BNB->ION token bridge +_ JetionBridgeParams = ConfigParam 82; // Polygon->ION token bridge // diff --git a/crypto/block/check-proof.cpp b/crypto/block/check-proof.cpp index 431a03fec..10a25ac8a 100644 --- a/crypto/block/check-proof.cpp +++ b/crypto/block/check-proof.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -22,7 +22,7 @@ #include "block/block-auto.h" #include "block/mc-config.h" -#include "ton/ton-shard.h" +#include "ion/ion-shard.h" #include "vm/cells/MerkleProof.h" #include "openssl/digest.hpp" @@ -31,15 +31,15 @@ namespace block { using namespace std::literals::string_literals; -td::Status check_block_header_proof(td::Ref root, ton::BlockIdExt blkid, ton::Bits256* store_state_hash_to, - bool check_state_hash, td::uint32* save_utime, ton::LogicalTime* save_lt) { - ton::RootHash vhash{root->get_hash().bits()}; +td::Status check_block_header_proof(td::Ref root, ion::BlockIdExt blkid, ion::Bits256* store_state_hash_to, + bool check_state_hash, td::uint32* save_utime, ion::LogicalTime* save_lt) { + ion::RootHash vhash{root->get_hash().bits()}; if (vhash != blkid.root_hash) { return td::Status::Error(PSTRING() << " block header for block " << blkid.to_str() << " has incorrect root hash " << vhash.to_hex() << " instead of " << blkid.root_hash.to_hex()); } - std::vector prev; - ton::BlockIdExt mc_blkid; + std::vector prev; + ion::BlockIdExt mc_blkid; bool after_split; TRY_STATUS(block::unpack_block_prev_blk_try(root, blkid, prev, mc_blkid, after_split)); block::gen::Block::Record blk; @@ -71,7 +71,7 @@ td::Status check_block_header_proof(td::Ref root, ton::BlockIdExt blki return td::Status::OK(); } -td::Result check_state_proof(ton::BlockIdExt blkid, td::Slice proof) { +td::Result check_state_proof(ion::BlockIdExt blkid, td::Slice proof) { TRY_RESULT(proof_root, vm::std_boc_deserialize(proof)); auto virt_root = vm::MerkleProof::virtualize(std::move(proof_root), 1); if (virt_root.is_null()) { @@ -82,7 +82,7 @@ td::Result check_state_proof(ton::BlockIdExt blkid, td::Slice proof return state_hash; } -td::Result> check_extract_state_proof(ton::BlockIdExt blkid, td::Slice proof, td::Slice data) { +td::Result> check_extract_state_proof(ion::BlockIdExt blkid, td::Slice proof, td::Slice data) { try { TRY_RESULT(state_hash, check_state_proof(blkid, proof)); TRY_RESULT(state_root, vm::std_boc_deserialize(data)); @@ -101,7 +101,7 @@ td::Result> check_extract_state_proof(ton::BlockIdExt blkid, td::S } } -td::Status check_shard_proof(ton::BlockIdExt blk, ton::BlockIdExt shard_blk, td::Slice shard_proof) { +td::Status check_shard_proof(ion::BlockIdExt blk, ion::BlockIdExt shard_blk, td::Slice shard_proof) { if (blk == shard_blk) { if (!shard_proof.empty()) { LOG(WARNING) << "Unexpected non-empty shard proof"; @@ -122,7 +122,7 @@ td::Status check_shard_proof(ton::BlockIdExt blk, ton::BlockIdExt shard_blk, td: if (mc_state_root.is_null()) { return td::Status::Error("shard configuration proof is invalid"); } - ton::Bits256 mc_state_hash = mc_state_root->get_hash().bits(); + ion::Bits256 mc_state_hash = mc_state_root->get_hash().bits(); TRY_STATUS_PREFIX( check_block_header_proof(vm::MerkleProof::virtualize(std::move(P_roots[0]), 1), blk, &mc_state_hash, true), "error in shard configuration block header proof :"); @@ -135,7 +135,7 @@ td::Status check_shard_proof(ton::BlockIdExt blk, ton::BlockIdExt shard_blk, td: return td::Status::Error("cannot extract shard configuration dictionary from proof"); } vm::CellSlice cs; - ton::ShardIdFull true_shard; + ion::ShardIdFull true_shard; if (!block::ShardConfig::get_shard_hash_raw_from(*shards_dict, cs, shard_blk.shard_full(), true_shard)) { return td::Status::Error(PSLICE() << "masterchain state contains no information for shard " << shard_blk.shard_full().to_str()); @@ -158,9 +158,9 @@ td::Status check_shard_proof(ton::BlockIdExt blk, ton::BlockIdExt shard_blk, td: return td::Status::OK(); } -td::Status check_account_proof(td::Slice proof, ton::BlockIdExt shard_blk, const block::StdAddress& addr, - td::Ref root, ton::LogicalTime* last_trans_lt, ton::Bits256* last_trans_hash, - td::uint32* save_utime, ton::LogicalTime* save_lt) { +td::Status check_account_proof(td::Slice proof, ion::BlockIdExt shard_blk, const block::StdAddress& addr, + td::Ref root, ion::LogicalTime* last_trans_lt, ion::Bits256* last_trans_hash, + td::uint32* save_utime, ion::LogicalTime* save_lt) { TRY_RESULT_PREFIX(Q_roots, vm::std_boc_deserialize_multi(std::move(proof)), "cannot deserialize account proof"); if (Q_roots.size() != 2) { return td::Status::Error(PSLICE() << "account state proof must have exactly two roots"); @@ -175,7 +175,7 @@ td::Status check_account_proof(td::Slice proof, ton::BlockIdExt shard_blk, const if (state_root.is_null()) { return td::Status::Error("account state proof is invalid"); } - ton::Bits256 state_hash = state_root->get_hash().bits(); + ion::Bits256 state_hash = state_root->get_hash().bits(); TRY_STATUS_PREFIX(check_block_header_proof(vm::MerkleProof::virtualize(std::move(Q_roots[0]), 1), shard_blk, &state_hash, true, save_utime, save_lt), "error in account shard block header proof : "); @@ -218,7 +218,7 @@ td::Status check_account_proof(td::Slice proof, ton::BlockIdExt shard_blk, const return td::Status::OK(); } -td::Result AccountState::validate(ton::BlockIdExt ref_blk, block::StdAddress addr) const { +td::Result AccountState::validate(ion::BlockIdExt ref_blk, block::StdAddress addr) const { TRY_RESULT_PREFIX(true_root, vm::std_boc_deserialize(state.as_slice(), true), "cannot deserialize account state"); Ref root; @@ -240,7 +240,7 @@ td::Result AccountState::validate(ton::BlockIdExt ref_blk, b return td::Status::Error(PSLICE() << "shard block id " << shard_blk.to_str() << " in answer is invalid"); } - if (!ton::shard_contains(shard_blk.shard_full(), ton::extract_addr_prefix(addr.workchain, addr.addr))) { + if (!ion::shard_contains(shard_blk.shard_full(), ion::extract_addr_prefix(addr.workchain, addr.addr))) { return td::Status::Error(PSLICE() << "received data from shard block " << shard_blk.to_str() << " that cannot contain requested account"); } @@ -360,8 +360,8 @@ td::Result BlockTransactionList::validate(bool check block::tlb::aug_ShardAccountBlocks}; bool eof = false; - ton::LogicalTime reverse = reverse_mode ? ~0ULL : 0; - ton::LogicalTime trans_lt = static_cast(start_lt); + ion::LogicalTime reverse = reverse_mode ? ~0ULL : 0; + ion::LogicalTime trans_lt = static_cast(start_lt); td::Bits256 cur_addr = start_addr; bool allow_same = true; int count = 0; @@ -456,7 +456,7 @@ td::Status BlockProofLink::validate(td::uint32* save_utime) const { if (vs_root.is_null()) { return td::Status::Error("BlockProofLink contains an invalid Merkle proof for source block "s + from.to_str()); } - ton::Bits256 state_hash; + ion::Bits256 state_hash; if (from.seqno()) { TRY_STATUS(check_block_header(vs_root, from, is_fwd ? nullptr : &state_hash)); } @@ -509,7 +509,7 @@ td::Status BlockProofLink::validate(td::uint32* save_utime) const { } auto config = cfg_res.move_as_ok(); // compute validator set - ton::ShardIdFull shard{ton::masterchainId}; + ion::ShardIdFull shard{ion::masterchainId}; auto nodes = config->compute_validator_set(shard, info.gen_utime, info.gen_catchain_seqno); if (nodes.empty()) { return td::Status::Error(PSTRING() @@ -560,7 +560,7 @@ td::Status BlockProofChain::validate(td::CancellationToken cancellation_token) { valid = true; return td::Status::OK(); } - ton::BlockIdExt cur = from; + ion::BlockIdExt cur = from; int i = 0; for (const auto& link : links) { ++i; @@ -604,8 +604,8 @@ td::Bits256 compute_node_id_short(td::Bits256 ed25519_pubkey) { return hash; } -td::Status check_block_signatures(const std::vector& nodes, - const std::vector& signatures, const ton::BlockIdExt& blkid) { +td::Status check_block_signatures(const std::vector& nodes, + const std::vector& signatures, const ion::BlockIdExt& blkid) { if (nodes.empty()) { return td::Status::Error("empty validator public keys set"); } @@ -614,13 +614,13 @@ td::Status check_block_signatures(const std::vector& nodes, } // compute the string to be signed and its hash unsigned char to_sign[68]; - td::as(to_sign) = 0xc50b6e70; // ton.blockId root_cell_hash:int256 file_hash:int256 = ton.BlockId; + td::as(to_sign) = 0xc50b6e70; // ion.blockId root_cell_hash:int256 file_hash:int256 = ion.BlockId; memcpy(to_sign + 4, blkid.root_hash.data(), 32); memcpy(to_sign + 36, blkid.file_hash.data(), 32); // unsigned char hash[32]; // digest::hash_str(hash, (void*)to_sign, sizeof(to_sign)); - ton::ValidatorWeight total_weight = 0, signed_weight = 0; + ion::ValidatorWeight total_weight = 0, signed_weight = 0; std::vector> node_map; for (unsigned i = 0; i < nodes.size(); i++) { total_weight += nodes[i].weight; diff --git a/crypto/block/check-proof.h b/crypto/block/check-proof.h index 497a4ebaa..7be76b47a 100644 --- a/crypto/block/check-proof.h +++ b/crypto/block/check-proof.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -24,23 +24,23 @@ namespace block { using td::Ref; -td::Status check_block_header_proof(td::Ref root, ton::BlockIdExt blkid, - ton::Bits256* store_state_hash_to = nullptr, bool check_state_hash = false, - td::uint32* save_utime = nullptr, ton::LogicalTime* save_lt = nullptr); -td::Status check_shard_proof(ton::BlockIdExt blk, ton::BlockIdExt shard_blk, td::Slice shard_proof); -td::Status check_account_proof(td::Slice proof, ton::BlockIdExt shard_blk, const block::StdAddress& addr, - td::Ref root, ton::LogicalTime* last_trans_lt = nullptr, - ton::Bits256* last_trans_hash = nullptr, td::uint32* save_utime = nullptr, - ton::LogicalTime* save_lt = nullptr); -td::Result check_state_proof(ton::BlockIdExt blkid, td::Slice proof); -td::Result> check_extract_state_proof(ton::BlockIdExt blkid, td::Slice proof, td::Slice data); +td::Status check_block_header_proof(td::Ref root, ion::BlockIdExt blkid, + ion::Bits256* store_state_hash_to = nullptr, bool check_state_hash = false, + td::uint32* save_utime = nullptr, ion::LogicalTime* save_lt = nullptr); +td::Status check_shard_proof(ion::BlockIdExt blk, ion::BlockIdExt shard_blk, td::Slice shard_proof); +td::Status check_account_proof(td::Slice proof, ion::BlockIdExt shard_blk, const block::StdAddress& addr, + td::Ref root, ion::LogicalTime* last_trans_lt = nullptr, + ion::Bits256* last_trans_hash = nullptr, td::uint32* save_utime = nullptr, + ion::LogicalTime* save_lt = nullptr); +td::Result check_state_proof(ion::BlockIdExt blkid, td::Slice proof); +td::Result> check_extract_state_proof(ion::BlockIdExt blkid, td::Slice proof, td::Slice data); -td::Status check_block_signatures(const std::vector& nodes, - const std::vector& signatures, const ton::BlockIdExt& blkid); +td::Status check_block_signatures(const std::vector& nodes, + const std::vector& signatures, const ion::BlockIdExt& blkid); struct AccountState { - ton::BlockIdExt blk; - ton::BlockIdExt shard_blk; + ion::BlockIdExt blk; + ion::BlockIdExt shard_blk; td::BufferSlice shard_proof; td::BufferSlice proof; td::BufferSlice state; @@ -48,40 +48,40 @@ struct AccountState { struct Info { td::Ref root, true_root; - ton::LogicalTime last_trans_lt{0}; - ton::Bits256 last_trans_hash; - ton::LogicalTime gen_lt{0}; + ion::LogicalTime last_trans_lt{0}; + ion::Bits256 last_trans_hash; + ion::LogicalTime gen_lt{0}; td::uint32 gen_utime{0}; }; - td::Result validate(ton::BlockIdExt ref_blk, block::StdAddress addr) const; + td::Result validate(ion::BlockIdExt ref_blk, block::StdAddress addr) const; }; struct Transaction { - ton::BlockIdExt blkid; - ton::LogicalTime lt; - ton::Bits256 hash; + ion::BlockIdExt blkid; + ion::LogicalTime lt; + ion::Bits256 hash; td::Ref root; struct Info { - ton::BlockIdExt blkid; + ion::BlockIdExt blkid; td::uint32 now; - ton::LogicalTime prev_trans_lt; - ton::Bits256 prev_trans_hash; + ion::LogicalTime prev_trans_lt; + ion::Bits256 prev_trans_hash; td::Ref transaction; }; td::Result validate(); }; struct TransactionList { - ton::LogicalTime lt; - ton::Bits256 hash; - std::vector blkids; + ion::LogicalTime lt; + ion::Bits256 hash; + std::vector blkids; td::BufferSlice transactions_boc; struct Info { - ton::LogicalTime lt; - ton::Bits256 hash; + ion::LogicalTime lt; + ion::Bits256 hash; std::vector transactions; }; @@ -89,31 +89,31 @@ struct TransactionList { }; struct BlockTransaction { - ton::BlockIdExt blkid; + ion::BlockIdExt blkid; td::Ref root; td::Ref proof; struct Info { - ton::BlockIdExt blkid; + ion::BlockIdExt blkid; td::uint32 now; - ton::LogicalTime lt; - ton::Bits256 hash; + ion::LogicalTime lt; + ion::Bits256 hash; td::Ref transaction; }; td::Result validate(bool check_proof) const; }; struct BlockTransactionList { - ton::BlockIdExt blkid; + ion::BlockIdExt blkid; td::BufferSlice transactions_boc; td::BufferSlice proof_boc; - ton::LogicalTime start_lt; + ion::LogicalTime start_lt; td::Bits256 start_addr; bool reverse_mode; int req_count; struct Info { - ton::BlockIdExt blkid; + ion::BlockIdExt blkid; std::vector transactions; }; diff --git a/crypto/block/create-state.cpp b/crypto/block/create-state.cpp index c8c8b970d..2e9f2798c 100644 --- a/crypto/block/create-state.cpp +++ b/crypto/block/create-state.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -120,7 +120,7 @@ Ref config_param_root; bool config_addr_set; vm::Dictionary config_dict{32}; -ton::UnixTime now; +ion::UnixTime now; bool set_config_smc(const SmcDescr& smc) { if (config_addr_set || smc.preinit_only || workchain_id != wc_master || smc.split_depth) { @@ -425,7 +425,7 @@ bool store_validator_list_hash(vm::CellBuilder& cb) { auto vset = res.move_as_ok(); LOG_CHECK(vset) << "unpacked validator set is empty"; auto ccvc = block::Config::unpack_catchain_validators_config(config_dict.lookup_ref(td::BitArray<32>{28})); - ton::ShardIdFull shard{ton::masterchainId}; + ion::ShardIdFull shard{ion::masterchainId}; auto nodes = block::Config::do_compute_validator_set(ccvc, shard, *vset, 0); LOG_CHECK(!nodes.empty()) << "validator node list in unpacked validator set is empty"; auto vset_hash = block::compute_validator_set_hash(0, shard, std::move(nodes)); @@ -458,7 +458,7 @@ bool store_custom(vm::CellBuilder& cb) { Ref create_state() { vm::CellBuilder cb, cb2; - now = static_cast(time(0)); + now = static_cast(time(0)); bool ok = true; PDO(workchain_id != wc_undef); THRERR("workchain_id is unset, cannot generate state"); @@ -797,7 +797,7 @@ void init_words_tlb(fift::Dictionary& d) { void usage(const char* progname) { std::cerr - << "Creates initial state for a TON blockchain, using configuration defined by Fift-language source files\n"; + << "Creates initial state for a ION blockchain, using configuration defined by Fift-language source files\n"; std::cerr << "usage: " << progname << " [-i] [-n] [-I ] {-L } ...\n"; @@ -844,7 +844,7 @@ int main(int argc, char* const argv[]) { bool fift_preload = true, no_env = false, script_mode = false; std::vector library_source_files, source_list; std::vector source_include_path; - std::string ton_db_path; + std::string ion_db_path; fift::Fift::Config config; @@ -910,7 +910,7 @@ int main(int argc, char* const argv[]) { fift::init_words_common(config.dictionary); fift::init_words_vm(config.dictionary); - fift::init_words_ton(config.dictionary); + fift::init_words_ion(config.dictionary); init_words_custom(config.dictionary); init_words_tlb(config.dictionary); diff --git a/crypto/block/dump-block.cpp b/crypto/block/dump-block.cpp index e7a196775..da108aec1 100644 --- a/crypto/block/dump-block.cpp +++ b/crypto/block/dump-block.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -75,7 +75,7 @@ td::Ref load_boc(std::string filename) { std::vector> loaded_boc; void test1() { - block::ShardId id{ton::masterchainId}, id2{ton::basechainId, 0x11efULL << 48}; + block::ShardId id{ion::masterchainId}, id2{ion::basechainId, 0x11efULL << 48}; std::cout << '[' << id << "][" << id2 << ']' << std::endl; vm::CellBuilder cb; cb << id << id2; @@ -223,9 +223,9 @@ td::Status test_vset() { return td::Status::Error("cannot unpack ShardConfig"); } std::cerr << "ShardHashes initialized\n"; - ton::ShardIdFull shard{0, 0x6e80000000000000}; - ton::CatchainSeqno cc_seqno = std::max(48763, 48763) + 1 + 1; - ton::UnixTime now = 1586169666; + ion::ShardIdFull shard{0, 0x6e80000000000000}; + ion::CatchainSeqno cc_seqno = std::max(48763, 48763) + 1 + 1; + ion::UnixTime now = 1586169666; cc_seqno = shards.get_shard_cc_seqno(shard); std::cerr << "shard=" << shard.to_str() << " cc_seqno=" << cc_seqno << " time=" << now << std::endl; if (cc_seqno == ~0U) { diff --git a/crypto/block/mc-config.cpp b/crypto/block/mc-config.cpp index 56ee85ae3..f9604a08e 100644 --- a/crypto/block/mc-config.cpp +++ b/crypto/block/mc-config.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -33,8 +33,8 @@ #include "vm/dict.h" #include "td/utils/bits.h" #include "td/utils/uint128.h" -#include "ton/ton-types.h" -#include "ton/ton-shard.h" +#include "ion/ion-types.h" +#include "ion/ion-shard.h" #include "openssl/digest.hpp" #include #include @@ -133,7 +133,7 @@ td::Status ConfigInfo::unpack() { } global_id_ = root_info.global_id; block::ShardId shard_id{root_info.shard_id}; - block_id.id = ton::BlockId{ton::ShardIdFull(shard_id), (unsigned)root_info.seq_no}; + block_id.id = ion::BlockId{ion::ShardIdFull(shard_id), (unsigned)root_info.seq_no}; block_id.root_hash.set_zero(); block_id.file_hash.set_zero(); vert_seqno = root_info.vert_seq_no; @@ -183,7 +183,7 @@ td::Status ConfigInfo::unpack() { if (!(cs.advance(1) && tlb::unpack_exact(cs, ext_ref))) { return td::Status::Error("cannot unpack last_key_block from masterchain state"); } - last_key_block_.id = ton::BlockId{ton::masterchainId, ton::shardIdAll, ext_ref.seq_no}; + last_key_block_.id = ion::BlockId{ion::masterchainId, ion::shardIdAll, ext_ref.seq_no}; last_key_block_.root_hash = ext_ref.root_hash; last_key_block_.file_hash = ext_ref.file_hash; last_key_block_lt_ = ext_ref.end_lt; @@ -209,7 +209,7 @@ td::Status ConfigInfo::unpack() { zerostate_id_.root_hash.set_zero(); zerostate_id_.file_hash.set_zero(); } - zerostate_id_.workchain = ton::masterchainId; + zerostate_id_.workchain = ion::masterchainId; if (mode & needPrevBlocks) { prev_blocks_dict_ = std::move(prev_blocks_dict); } @@ -307,9 +307,9 @@ td::Status Config::visit_validator_params() const { return td::Status::OK(); } -ton::ValidatorSessionConfig Config::get_consensus_config() const { +ion::ValidatorSessionConfig Config::get_consensus_config() const { auto cc = get_config_param(29); - ton::ValidatorSessionConfig c; + ion::ValidatorSessionConfig c; auto set_v1 = [&](auto& r) { c.catchain_opts.idle_timeout = r.consensus_timeout_ms * 0.001; c.catchain_opts.max_deps = r.catchain_max_deps; @@ -354,7 +354,7 @@ ton::ValidatorSessionConfig Config::get_consensus_config() const { set_v1(r1); } } - if (c.proto_version >= ton::ValidatorSessionConfig::BLOCK_HASH_COVERS_DATA_FROM_VERSION) { + if (c.proto_version >= ion::ValidatorSessionConfig::BLOCK_HASH_COVERS_DATA_FROM_VERSION) { c.catchain_opts.block_hash_covers_data = true; } return c; @@ -447,7 +447,7 @@ const vm::AugmentedDictionary& ConfigInfo::get_accounts_dict() const { return *accounts_dict; } -bool ConfigInfo::get_last_key_block(ton::BlockIdExt& blkid, ton::LogicalTime& blklt, bool strict) const { +bool ConfigInfo::get_last_key_block(ion::BlockIdExt& blkid, ion::LogicalTime& blklt, bool strict) const { if (strict || !is_key_state_) { blkid = last_key_block_; blklt = last_key_block_lt_; @@ -468,7 +468,7 @@ td::Result>> Config::unp WorkchainSet wc_list; LOG(DEBUG) << "workchain description dictionary created"; if (!(wc_dict->check_for_each([&wc_list](Ref cs_ref, td::ConstBitPtr key, int n) -> bool { - ton::WorkchainId wc = ton::WorkchainId(key.get_int(32)); + ion::WorkchainId wc = ion::WorkchainId(key.get_int(32)); Ref wc_info{true}; return wc_info.unique_write().unpack(wc, cs_ref.write()) && wc_list.emplace(wc, std::move(wc_info)).second; }))) { @@ -548,7 +548,7 @@ td::Result> Config::unpack_validator_set(Ref Config::do_get_gas_limits_prices(vm::CellSlice cs, i return res; } -td::Result Config::get_dns_root_addr() const { +td::Result Config::get_dns_root_addr() const { auto cell = get_config_param(4); if (cell.is_null()) { return td::Status::Error(PSLICE() << "configuration parameter " << 4 << " with dns root address is absent"); @@ -688,7 +688,7 @@ td::Result Config::get_dns_root_addr() const { if (cs.size() != 0x100) { return td::Status::Error(PSLICE() << "configuration parameter " << 4 << " with dns root address has wrong size"); } - ton::StdSmcAddress res; + ion::StdSmcAddress res; CHECK(cs.fetch_bits_to(res)); return res; } @@ -750,13 +750,13 @@ bool McShardHash::basic_info_equal(const McShardHash& other, bool compare_fees, (!compare_fees || (fees_collected_ == other.fees_collected_ && funds_created_ == other.funds_created_)); } -void McShardHash::set_fsm(FsmState fsm, ton::UnixTime fsm_utime, ton::UnixTime fsm_interval) { +void McShardHash::set_fsm(FsmState fsm, ion::UnixTime fsm_utime, ion::UnixTime fsm_interval) { fsm_ = fsm; fsm_utime_ = fsm_utime; fsm_interval_ = fsm_interval; } -Ref McShardHash::unpack(vm::CellSlice& cs, ton::ShardIdFull id) { +Ref McShardHash::unpack(vm::CellSlice& cs, ion::ShardIdFull id) { int tag = gen::t_ShardDescr.get_tag(cs); if (tag < 0) { return {}; @@ -766,7 +766,7 @@ Ref McShardHash::unpack(vm::CellSlice& cs, ton::ShardIdFull id) { if (!(fees_collected.unpack(std::move(fees)) && funds_created.unpack(std::move(funds)))) { return Ref{}; } - return td::make_ref(ton::BlockId{id, (unsigned)descr.seq_no}, descr.start_lt, descr.end_lt, + return td::make_ref(ion::BlockId{id, (unsigned)descr.seq_no}, descr.start_lt, descr.end_lt, descr.gen_utime, descr.root_hash, descr.file_hash, fees_collected, funds_created, descr.reg_mc_seqno, descr.min_ref_mc_seqno, descr.next_catchain_seqno, descr.next_validator_shard, /* descr.nx_cc_updated */ false, descr.before_split, @@ -855,7 +855,7 @@ bool McShardHash::pack(vm::CellBuilder& cb) const { && cb.store_builder_ref_bool(std::move(cb2)); // = ShardDescr; } -Ref McShardHash::from_block(Ref block_root, const ton::FileHash& fhash, bool init_fees) { +Ref McShardHash::from_block(Ref block_root, const ion::FileHash& fhash, bool init_fees) { if (block_root.is_null()) { return {}; } @@ -866,7 +866,7 @@ Ref McShardHash::from_block(Ref block_root, const ton::Fi shard.deserialize(info.shard.write()))) { return {}; } - ton::RootHash rhash = block_root->get_hash().bits(); + ion::RootHash rhash = block_root->get_hash().bits(); CurrencyCollection fees_collected, funds_created; if (init_fees) { block::ValueFlow flow; @@ -876,7 +876,7 @@ Ref McShardHash::from_block(Ref block_root, const ton::Fi fees_collected = flow.fees_collected; funds_created = flow.created; } - return Ref(true, ton::BlockId{ton::ShardIdFull(shard), (unsigned)info.seq_no}, info.start_lt, + return Ref(true, ion::BlockId{ion::ShardIdFull(shard), (unsigned)info.seq_no}, info.start_lt, info.end_lt, info.gen_utime, rhash, fhash, fees_collected, funds_created, ~0U, info.min_ref_mc_seqno, info.gen_catchain_seqno, shard.shard_pfx, false, info.before_split, false, info.want_split, info.want_merge); @@ -900,7 +900,7 @@ McShardDescr& McShardDescr::operator=(const McShardDescr& other) { } Ref McShardDescr::from_block(Ref block_root, Ref state_root, - const ton::FileHash& fhash, bool init_fees) { + const ion::FileHash& fhash, bool init_fees) { if (block_root.is_null()) { return {}; } @@ -921,7 +921,7 @@ Ref McShardDescr::from_block(Ref block_root, Refget_hash().bits(); + ion::RootHash rhash = block_root->get_hash().bits(); CurrencyCollection fees_collected, funds_created; if (init_fees) { block::ValueFlow flow; @@ -931,7 +931,7 @@ Ref McShardDescr::from_block(Ref block_root, Ref(true, ton::BlockId{ton::ShardIdFull(shard), (unsigned)info.seq_no}, info.start_lt, + auto res = Ref(true, ion::BlockId{ion::ShardIdFull(shard), (unsigned)info.seq_no}, info.start_lt, info.end_lt, info.gen_utime, rhash, fhash, fees_collected, funds_created, ~0U, info.min_ref_mc_seqno, info.gen_catchain_seqno, shard.shard_pfx, false, info.before_split, false, info.want_split, info.want_merge); @@ -941,7 +941,7 @@ Ref McShardDescr::from_block(Ref block_root, Ref McShardDescr::from_state(ton::BlockIdExt blkid, Ref state_root) { +Ref McShardDescr::from_state(ion::BlockIdExt blkid, Ref state_root) { if (state_root.is_null()) { return {}; } @@ -953,7 +953,7 @@ Ref McShardDescr::from_state(ton::BlockIdExt blkid, Ref LOG(DEBUG) << "cannot create McShardDescr from a shardchain state"; return {}; } - if (ton::ShardIdFull(shard) != ton::ShardIdFull(blkid) || info.seq_no != blkid.seqno()) { + if (ion::ShardIdFull(shard) != ion::ShardIdFull(blkid) || info.seq_no != blkid.seqno()) { LOG(DEBUG) << "shard id mismatch, cannot construct McShardDescr"; return {}; } @@ -1019,8 +1019,8 @@ ShardConfig::ShardConfig(const ShardConfig& other) init(); } -bool ShardConfig::get_shard_hash_raw_from(vm::Dictionary& dict, vm::CellSlice& cs, ton::ShardIdFull id, - ton::ShardIdFull& true_id, bool exact, Ref* leaf) { +bool ShardConfig::get_shard_hash_raw_from(vm::Dictionary& dict, vm::CellSlice& cs, ion::ShardIdFull id, + ion::ShardIdFull& true_id, bool exact, Ref* leaf) { if (id.is_masterchain() || !id.is_valid()) { return false; } @@ -1039,7 +1039,7 @@ bool ShardConfig::get_shard_hash_raw_from(vm::Dictionary& dict, vm::CellSlice& c if (len && exact) { return false; } - true_id = ton::ShardIdFull{id.workchain, (id.shard | m) - (m >> 1)}; + true_id = ion::ShardIdFull{id.workchain, (id.shard | m) - (m >> 1)}; if (leaf) { *leaf = std::move(root); } @@ -1055,16 +1055,16 @@ bool ShardConfig::get_shard_hash_raw_from(vm::Dictionary& dict, vm::CellSlice& c } } -bool ShardConfig::get_shard_hash_raw(vm::CellSlice& cs, ton::ShardIdFull id, ton::ShardIdFull& true_id, +bool ShardConfig::get_shard_hash_raw(vm::CellSlice& cs, ion::ShardIdFull id, ion::ShardIdFull& true_id, bool exact) const { return shard_hashes_dict_ && get_shard_hash_raw_from(*shard_hashes_dict_, cs, id, true_id, exact); } -Ref ShardConfig::get_shard_hash(ton::ShardIdFull id, bool exact) const { +Ref ShardConfig::get_shard_hash(ion::ShardIdFull id, bool exact) const { if (id.is_masterchain()) { - return (!exact || id.shard == ton::shardIdAll) ? get_mc_hash() : Ref{}; + return (!exact || id.shard == ion::shardIdAll) ? get_mc_hash() : Ref{}; } - ton::ShardIdFull true_id; + ion::ShardIdFull true_id; vm::CellSlice cs; if (get_shard_hash_raw(cs, id, true_id, exact)) { // block::gen::t_ShardDescr.print(std::cerr, vm::CellSlice{cs}); @@ -1074,13 +1074,13 @@ Ref ShardConfig::get_shard_hash(ton::ShardIdFull id, bool exact) co } } -bool McShardHash::extract_cc_seqno(vm::CellSlice& cs, ton::CatchainSeqno* cc) { +bool McShardHash::extract_cc_seqno(vm::CellSlice& cs, ion::CatchainSeqno* cc) { auto get = [&cs, cc](auto& rec) { if (tlb::unpack_exact(cs, rec)) { *cc = rec.next_catchain_seqno; return true; } else { - *cc = std::numeric_limits::max(); + *cc = std::numeric_limits::max(); return false; } }; @@ -1093,35 +1093,35 @@ bool McShardHash::extract_cc_seqno(vm::CellSlice& cs, ton::CatchainSeqno* cc) { } } -ton::CatchainSeqno ShardConfig::get_shard_cc_seqno(ton::ShardIdFull shard) const { +ion::CatchainSeqno ShardConfig::get_shard_cc_seqno(ion::ShardIdFull shard) const { if (shard.is_masterchain() || !shard.is_valid()) { - return std::numeric_limits::max(); + return std::numeric_limits::max(); } - ton::ShardIdFull true_id; - ton::CatchainSeqno cc_seqno, cc_seqno2; + ion::ShardIdFull true_id; + ion::CatchainSeqno cc_seqno, cc_seqno2; vm::CellSlice cs; if (!(get_shard_hash_raw(cs, shard - 1, true_id, false) && - (ton::shard_is_ancestor(true_id, shard) || ton::shard_is_parent(shard, true_id)) && + (ion::shard_is_ancestor(true_id, shard) || ion::shard_is_parent(shard, true_id)) && McShardHash::extract_cc_seqno(cs, &cc_seqno))) { - return std::numeric_limits::max(); + return std::numeric_limits::max(); } - if (ton::shard_is_ancestor(true_id, shard)) { + if (ion::shard_is_ancestor(true_id, shard)) { return cc_seqno; } - if (!(get_shard_hash_raw(cs, shard + 1, true_id, false) && ton::shard_is_parent(shard, true_id) && + if (!(get_shard_hash_raw(cs, shard + 1, true_id, false) && ion::shard_is_parent(shard, true_id) && McShardHash::extract_cc_seqno(cs, &cc_seqno2))) { - return std::numeric_limits::max(); + return std::numeric_limits::max(); } return std::max(cc_seqno, cc_seqno2) + 1; } -ton::LogicalTime ShardConfig::get_shard_end_lt_ext(ton::AccountIdPrefixFull acc, ton::ShardIdFull& actual_shard) const { +ion::LogicalTime ShardConfig::get_shard_end_lt_ext(ion::AccountIdPrefixFull acc, ion::ShardIdFull& actual_shard) const { if (!acc.is_valid()) { - actual_shard.workchain = ton::workchainInvalid; + actual_shard.workchain = ion::workchainInvalid; return 0; } if (acc.is_masterchain()) { - actual_shard = ton::ShardIdFull(ton::masterchainId); + actual_shard = ion::ShardIdFull(ion::masterchainId); CHECK(mc_shard_hash_.not_null()); return mc_shard_hash_->end_lt_; } @@ -1134,17 +1134,17 @@ ton::LogicalTime ShardConfig::get_shard_end_lt_ext(ton::AccountIdPrefixFull acc, : 0; } -ton::LogicalTime ShardConfig::get_shard_end_lt(ton::AccountIdPrefixFull acc) const { - ton::ShardIdFull tmp; +ion::LogicalTime ShardConfig::get_shard_end_lt(ion::AccountIdPrefixFull acc) const { + ion::ShardIdFull tmp; return get_shard_end_lt_ext(acc, tmp); } -bool ShardConfig::contains(ton::BlockIdExt blkid) const { +bool ShardConfig::contains(ion::BlockIdExt blkid) const { auto entry = get_shard_hash(blkid.shard_full()); return entry.not_null() && entry->blk_ == blkid; } -static int process_workchain_shard_hashes(Ref& branch, ton::ShardIdFull shard, +static int process_workchain_shard_hashes(Ref& branch, ion::ShardIdFull shard, std::function& func) { auto cs = vm::load_cell_slice(branch); int f = (int)cs.fetch_ulong(1); @@ -1153,11 +1153,11 @@ static int process_workchain_shard_hashes(Ref& branch, ton::ShardIdFul return -1; } auto left = cs.prefetch_ref(0), right = cs.prefetch_ref(1); - int r = process_workchain_shard_hashes(left, ton::shard_child(shard, true), func); + int r = process_workchain_shard_hashes(left, ion::shard_child(shard, true), func); if (r < 0) { return r; } - r |= process_workchain_shard_hashes(right, ton::shard_child(shard, false), func); + r |= process_workchain_shard_hashes(right, ion::shard_child(shard, false), func); if (r <= 0) { return r; } @@ -1191,14 +1191,14 @@ bool ShardConfig::process_shard_hashes(std::function func) { [&ok, &func](vm::CellBuilder& cb, Ref csr, td::ConstBitPtr key, int n) -> bool { Ref root; ok = ok && (n == 32) && csr->size_ext() == 0x10000 && std::move(csr)->prefetch_ref_to(root) && - process_workchain_shard_hashes(root, ton::ShardIdFull{(int)key.get_int(32)}, func) >= 0 && + process_workchain_shard_hashes(root, ion::ShardIdFull{(int)key.get_int(32)}, func) >= 0 && cb.store_ref_bool(std::move(root)); return true; }); return ok; } -static int process_workchain_sibling_shard_hashes(Ref& branch, Ref sibling, ton::ShardIdFull shard, +static int process_workchain_sibling_shard_hashes(Ref& branch, Ref sibling, ion::ShardIdFull shard, std::function& func) { auto cs = vm::load_cell_slice(branch); int f = (int)cs.fetch_ulong(1); @@ -1208,11 +1208,11 @@ static int process_workchain_sibling_shard_hashes(Ref& branch, Ref& branch, Ref bool { Ref root; ok = ok && (n == 32) && csr->size_ext() == 0x10000 && std::move(csr)->prefetch_ref_to(root) && - process_workchain_sibling_shard_hashes(root, Ref{}, ton::ShardIdFull{(int)key.get_int(32)}, func) >= + process_workchain_sibling_shard_hashes(root, Ref{}, ion::ShardIdFull{(int)key.get_int(32)}, func) >= 0; bool f = cb.store_ref_bool(std::move(root)); ok &= f; @@ -1265,19 +1265,19 @@ bool ShardConfig::process_sibling_shard_hashes(std::function ShardConfig::get_shard_hash_ids( - const std::function& filter) const { +std::vector ShardConfig::get_shard_hash_ids( + const std::function& filter) const { if (!shard_hashes_dict_) { return {}; } - std::vector res; + std::vector res; bool mcout = mc_shard_hash_.is_null() || !mc_shard_hash_->seqno(); // include masterchain as a shard if seqno > 0 bool ok = shard_hashes_dict_->check_for_each( [&res, &mcout, mc_shard_hash_ = mc_shard_hash_, &filter](Ref cs_ref, td::ConstBitPtr key, int n) -> bool { int workchain = (int)key.get_int(n); if (workchain >= 0 && !mcout) { - if (filter(ton::ShardIdFull{ton::masterchainId}, true)) { + if (filter(ion::ShardIdFull{ion::masterchainId}, true)) { res.emplace_back(mc_shard_hash_->blk_.id); } mcout = true; @@ -1286,7 +1286,7 @@ std::vector ShardConfig::get_shard_hash_ids( return false; } std::stack, unsigned long long>> stack; - stack.emplace(cs_ref->prefetch_ref(), ton::shardIdAll); + stack.emplace(cs_ref->prefetch_ref(), ion::shardIdAll); while (!stack.empty()) { vm::CellSlice cs{vm::NoVmOrd(), std::move(stack.top().first)}; unsigned long long shard = stack.top().second; @@ -1295,7 +1295,7 @@ std::vector ShardConfig::get_shard_hash_ids( if (t < 0) { return false; } - if (!filter(ton::ShardIdFull{workchain, shard}, !t)) { + if (!filter(ion::ShardIdFull{workchain, shard}, !t)) { continue; } if (!t) { @@ -1318,33 +1318,33 @@ std::vector ShardConfig::get_shard_hash_ids( if (!ok) { return {}; } - if (!mcout && filter(ton::ShardIdFull{ton::masterchainId}, true)) { + if (!mcout && filter(ion::ShardIdFull{ion::masterchainId}, true)) { res.emplace_back(mc_shard_hash_->blk_.id); } return res; } -std::vector ShardConfig::get_shard_hash_ids(bool skip_mc) const { +std::vector ShardConfig::get_shard_hash_ids(bool skip_mc) const { return get_shard_hash_ids( - [skip_mc](ton::ShardIdFull shard, bool) -> bool { return !(skip_mc && shard.is_masterchain()); }); + [skip_mc](ion::ShardIdFull shard, bool) -> bool { return !(skip_mc && shard.is_masterchain()); }); } -std::vector ShardConfig::get_intersecting_shard_hash_ids(ton::ShardIdFull myself) const { +std::vector ShardConfig::get_intersecting_shard_hash_ids(ion::ShardIdFull myself) const { return get_shard_hash_ids( - [myself](ton::ShardIdFull shard, bool) -> bool { return ton::shard_intersects(myself, shard); }); + [myself](ion::ShardIdFull shard, bool) -> bool { return ion::shard_intersects(myself, shard); }); } -std::vector ShardConfig::get_neighbor_shard_hash_ids(ton::ShardIdFull myself) const { - return get_shard_hash_ids([myself](ton::ShardIdFull shard, bool) -> bool { return is_neighbor(myself, shard); }); +std::vector ShardConfig::get_neighbor_shard_hash_ids(ion::ShardIdFull myself) const { + return get_shard_hash_ids([myself](ion::ShardIdFull shard, bool) -> bool { return is_neighbor(myself, shard); }); } -std::vector ShardConfig::get_proper_neighbor_shard_hash_ids(ton::ShardIdFull myself) const { - return get_shard_hash_ids([myself](ton::ShardIdFull shard, bool leaf) -> bool { - return is_neighbor(myself, shard) && !(leaf && ton::shard_intersects(myself, shard)); +std::vector ShardConfig::get_proper_neighbor_shard_hash_ids(ion::ShardIdFull myself) const { + return get_shard_hash_ids([myself](ion::ShardIdFull shard, bool leaf) -> bool { + return is_neighbor(myself, shard) && !(leaf && ion::shard_intersects(myself, shard)); }); } -bool ShardConfig::is_neighbor(ton::ShardIdFull x, ton::ShardIdFull y) { +bool ShardConfig::is_neighbor(ion::ShardIdFull x, ion::ShardIdFull y) { if (x.is_masterchain() || y.is_masterchain()) { return true; } @@ -1362,18 +1362,18 @@ bool ShardConfig::is_neighbor(ton::ShardIdFull x, ton::ShardIdFull y) { return c1 + c2 == 15; } -bool ShardConfig::has_workchain(ton::WorkchainId workchain) const { +bool ShardConfig::has_workchain(ion::WorkchainId workchain) const { return shard_hashes_dict_ && shard_hashes_dict_->key_exists(td::BitArray<32>{workchain}); } -std::vector ShardConfig::get_workchains() const { +std::vector ShardConfig::get_workchains() const { if (!shard_hashes_dict_) { return {}; } - std::vector res; + std::vector res; if (!shard_hashes_dict_->check_for_each([&res](Ref val, td::ConstBitPtr key, int n) { CHECK(n == 32); - ton::WorkchainId w = (int)key.get_int(32); + ion::WorkchainId w = (int)key.get_int(32); res.push_back(w); return true; })) { @@ -1382,8 +1382,8 @@ std::vector ShardConfig::get_workchains() const { return res; } -bool ShardConfig::new_workchain(ton::WorkchainId workchain, ton::BlockSeqno reg_mc_seqno, - const ton::RootHash& zerostate_root_hash, const ton::FileHash& zerostate_file_hash) { +bool ShardConfig::new_workchain(ion::WorkchainId workchain, ion::BlockSeqno reg_mc_seqno, + const ion::RootHash& zerostate_root_hash, const ion::FileHash& zerostate_file_hash) { if (!shard_hashes_dict_ || has_workchain(workchain)) { return false; } @@ -1409,8 +1409,8 @@ bool ShardConfig::new_workchain(ton::WorkchainId workchain, ton::BlockSeqno reg_ } td::Result ShardConfig::may_update_shard_block_info(Ref new_info, - const std::vector& old_blkids, - ton::LogicalTime lt_limit, Ref* ancestor) const { + const std::vector& old_blkids, + ion::LogicalTime lt_limit, Ref* ancestor) const { if (!shard_hashes_dict_) { return td::Status::Error(-666, "no shard top block dictionary present"); } @@ -1421,7 +1421,7 @@ td::Result ShardConfig::may_update_shard_block_info(Ref new_i return td::Status::Error(-666, "new top shard block description is invalid"); } auto wc = new_info->shard().workchain; - if (wc == ton::workchainInvalid || wc == ton::masterchainId) { + if (wc == ion::workchainInvalid || wc == ion::masterchainId) { return td::Status::Error(-666, "new top shard block description belongs to an invalid workchain"); } if (!has_workchain(wc)) { @@ -1430,13 +1430,13 @@ td::Result ShardConfig::may_update_shard_block_info(Ref new_i if (old_blkids.size() != 1 && old_blkids.size() != 2) { return td::Status::Error(-666, "must have either one or two start blocks in a top shard block update"); } - bool before_split = ton::shard_is_parent(old_blkids[0].shard_full(), new_info->shard()); + bool before_split = ion::shard_is_parent(old_blkids[0].shard_full(), new_info->shard()); bool before_merge = (old_blkids.size() == 2); if (before_merge) { - if (!ton::shard_is_sibling(old_blkids[0].shard_full(), old_blkids[1].shard_full())) { + if (!ion::shard_is_sibling(old_blkids[0].shard_full(), old_blkids[1].shard_full())) { return td::Status::Error(-666, "the two start blocks of a top shard block update must be siblings"); } - if (!ton::shard_is_parent(new_info->shard(), old_blkids[0].shard_full())) { + if (!ion::shard_is_parent(new_info->shard(), old_blkids[0].shard_full())) { return td::Status::Error( -666, std::string{"the two start blocks of a top shard block update do not merge into expected final shard "} + @@ -1449,7 +1449,7 @@ td::Result ShardConfig::may_update_shard_block_info(Ref new_i if (ancestor) { ancestor->clear(); } - ton::CatchainSeqno old_cc_seqno = 0; + ion::CatchainSeqno old_cc_seqno = 0; for (const auto& ob : old_blkids) { auto odef = get_shard_hash(ob.shard_full()); if (odef.is_null() || odef->blk_ != ob) { @@ -1526,7 +1526,7 @@ td::Result ShardConfig::may_update_shard_block_info(Ref new_i } td::Result ShardConfig::update_shard_block_info(Ref new_info, - const std::vector& old_blkids) { + const std::vector& old_blkids) { Ref ancestor; auto res = may_update_shard_block_info(new_info, old_blkids, ~0ULL, &ancestor); if (res.is_error()) { @@ -1553,7 +1553,7 @@ td::Result ShardConfig::update_shard_block_info(Ref new_info, } td::Result ShardConfig::update_shard_block_info2(Ref new_info1, Ref new_info2, - const std::vector& old_blkids) { + const std::vector& old_blkids) { auto res1 = may_update_shard_block_info(new_info1, old_blkids); if (res1.is_error()) { return res1; @@ -1590,7 +1590,7 @@ bool ShardConfig::do_update_shard_info(Ref new_info) { } bool ShardConfig::do_update_shard_info2(Ref new_info1, Ref new_info2) { - if (new_info1.is_null() || new_info2.is_null() || !ton::shard_is_sibling(new_info1->shard(), new_info2->shard())) { + if (new_info1.is_null() || new_info2.is_null() || !ion::shard_is_sibling(new_info1->shard(), new_info2->shard())) { return false; } if (new_info1->blk_.id.shard > new_info2->blk_.id.shard) { @@ -1607,14 +1607,14 @@ bool ShardConfig::do_update_shard_info2(Ref new_info1, Refpack(cb1) // leaf:ShardDescr && cb1.finalize_to(ref) // ) -> ref && cb.store_ref_bool(std::move(ref)) // right:^(BinTree ShardDescr) - && cb.finalize_to(ref) && set_shard_info(ton::shard_parent(new_info1->shard()), std::move(ref)); + && cb.finalize_to(ref) && set_shard_info(ion::shard_parent(new_info1->shard()), std::move(ref)); } -static bool btree_set(Ref& root, ton::ShardId shard, Ref value) { +static bool btree_set(Ref& root, ion::ShardId shard, Ref value) { if (!shard) { return false; } - if (shard == ton::shardIdAll) { + if (shard == ion::shardIdAll) { root = value; return true; } @@ -1633,7 +1633,7 @@ static bool btree_set(Ref& root, ton::ShardId shard, Ref val && cb.finalize_to(root); // = BinTree ShardDescr } -bool ShardConfig::set_shard_info(ton::ShardIdFull shard, Ref value) { +bool ShardConfig::set_shard_info(ion::ShardIdFull shard, Ref value) { if (!gen::t_BinTree_ShardDescr.validate_ref(1024, value)) { LOG(ERROR) << "attempting to store an invalid (BinTree ShardDescr) at shard configuration position " << shard.to_str(); @@ -1659,16 +1659,16 @@ bool ShardConfig::set_shard_info(ton::ShardIdFull shard, Ref value) { return true; } -bool Config::is_special_smartcontract(const ton::StdSmcAddress& addr) const { +bool Config::is_special_smartcontract(const ion::StdSmcAddress& addr) const { CHECK(special_smc_dict); return special_smc_dict->lookup(addr).not_null() || addr == config_addr; } -td::Result> Config::get_special_smartcontracts(bool without_config) const { +td::Result> Config::get_special_smartcontracts(bool without_config) const { if (!special_smc_dict) { return td::Status::Error(-666, "configuration loaded without fundamental smart contract list"); } - std::vector res; + std::vector res; if (!special_smc_dict->check_for_each([&res, &without_config, conf_addr = config_addr.bits()]( Ref cs_ref, td::ConstBitPtr key, int n) { if (cs_ref->size_ext() || n != 256) { @@ -1688,7 +1688,7 @@ td::Result> Config::get_special_smartcontracts(b return std::move(res); } -td::Result>> ConfigInfo::get_special_ticktock_smartcontracts( +td::Result>> ConfigInfo::get_special_ticktock_smartcontracts( int tick_tock) const { if (!special_smc_dict) { return td::Status::Error(-666, "configuration loaded without fundamental smart contract list"); @@ -1696,7 +1696,7 @@ td::Result>> ConfigInfo::get_spec if (!accounts_dict) { return td::Status::Error(-666, "state loaded without accounts information"); } - std::vector> res; + std::vector> res; if (!special_smc_dict->check_for_each( [this, &res, tick_tock](Ref cs_ref, td::ConstBitPtr key, int n) -> bool { if (cs_ref->size_ext() || n != 256) { @@ -1740,17 +1740,17 @@ int ConfigInfo::get_smc_tick_tock(td::ConstBitPtr smc_addr) const { : -2; } -ton::CatchainSeqno ConfigInfo::get_shard_cc_seqno(ton::ShardIdFull shard) const { +ion::CatchainSeqno ConfigInfo::get_shard_cc_seqno(ion::ShardIdFull shard) const { return shard.is_masterchain() ? cc_seqno_ : ShardConfig::get_shard_cc_seqno(shard); } -std::vector Config::compute_validator_set(ton::ShardIdFull shard, const block::ValidatorSet& vset, - ton::UnixTime time, ton::CatchainSeqno cc_seqno) const { +std::vector Config::compute_validator_set(ion::ShardIdFull shard, const block::ValidatorSet& vset, + ion::UnixTime time, ion::CatchainSeqno cc_seqno) const { return do_compute_validator_set(get_catchain_validators_config(), shard, vset, cc_seqno); } -std::vector Config::compute_validator_set(ton::ShardIdFull shard, ton::UnixTime time, - ton::CatchainSeqno cc_seqno) const { +std::vector Config::compute_validator_set(ion::ShardIdFull shard, ion::UnixTime time, + ion::CatchainSeqno cc_seqno) const { if (!cur_validators_) { LOG(DEBUG) << "failed to compute validator set: cur_validators_ is empty"; return {}; @@ -1759,14 +1759,14 @@ std::vector Config::compute_validator_set(ton::ShardIdFull } } -std::vector ConfigInfo::compute_validator_set_cc(ton::ShardIdFull shard, +std::vector ConfigInfo::compute_validator_set_cc(ion::ShardIdFull shard, const block::ValidatorSet& vset, - ton::UnixTime time, - ton::CatchainSeqno* cc_seqno_delta) const { + ion::UnixTime time, + ion::CatchainSeqno* cc_seqno_delta) const { if (cc_seqno_delta && (*cc_seqno_delta & -2)) { return {}; } - ton::CatchainSeqno cc_seqno = get_shard_cc_seqno(shard); + ion::CatchainSeqno cc_seqno = get_shard_cc_seqno(shard); if (cc_seqno == ~0U) { return {}; } @@ -1776,8 +1776,8 @@ std::vector ConfigInfo::compute_validator_set_cc(ton::Shard return do_compute_validator_set(get_catchain_validators_config(), shard, vset, cc_seqno); } -std::vector ConfigInfo::compute_validator_set_cc(ton::ShardIdFull shard, ton::UnixTime time, - ton::CatchainSeqno* cc_seqno_delta) const { +std::vector ConfigInfo::compute_validator_set_cc(ion::ShardIdFull shard, ion::UnixTime time, + ion::CatchainSeqno* cc_seqno_delta) const { auto vset = get_cur_validator_set(); if (!vset) { return {}; @@ -1822,8 +1822,8 @@ const ValidatorDescr& ValidatorSet::at_weight(td::uint64 weight_pos) const { return *--it; } -std::vector ValidatorSet::export_validator_set() const { - std::vector l; +std::vector ValidatorSet::export_validator_set() const { + std::vector l; l.reserve(list.size()); for (const auto& node : list) { l.emplace_back(node.pubkey, node.weight, node.adnl_addr); @@ -1831,8 +1831,8 @@ std::vector ValidatorSet::export_validator_set() const { return l; } -std::map ValidatorSet::compute_validator_map() const { - std::map res; +std::map ValidatorSet::compute_validator_map() const { + std::map res; for (int i = 0; i < (int)list.size(); i++) { res.emplace(list[i].pubkey.as_bits256(), i); } @@ -1856,11 +1856,11 @@ int ValidatorSet::lookup_public_key(td::ConstBitPtr pubkey) const { return -1; } -std::vector Config::do_compute_validator_set(const CatchainValidatorsConfig& ccv_conf, - ton::ShardIdFull shard, const ValidatorSet& vset, - ton::CatchainSeqno cc_seqno) { +std::vector Config::do_compute_validator_set(const CatchainValidatorsConfig& ccv_conf, + ion::ShardIdFull shard, const ValidatorSet& vset, + ion::CatchainSeqno cc_seqno) { // LOG(DEBUG) << "in Config::do_compute_validator_set() for " << shard.to_str() << " ; cc_seqno=" << cc_seqno; - std::vector nodes; + std::vector nodes; bool is_mc = shard.is_masterchain(); unsigned count = std::min(is_mc ? vset.main : ccv_conf.shard_val_num, vset.total); CHECK((unsigned)vset.total == vset.list.size()); @@ -1920,7 +1920,7 @@ std::vector Config::do_compute_validator_set(const Catchain return nodes; } -std::vector Config::compute_total_validator_set(int next) const { +std::vector Config::compute_total_validator_set(int next) const { auto res = unpack_validator_set(get_config_param(next < 0 ? 32 : (next ? 36 : 34))); if (res.is_error()) { return {}; @@ -1969,7 +1969,7 @@ td::Result Config::do_get_size_limits_config(td::Ref Config::get_suspended_addresses(ton::UnixTime now) const { +std::unique_ptr Config::get_suspended_addresses(ion::UnixTime now) const { td::Ref param = get_config_param(44); gen::SuspendedAddressList::Record rec; if (param.is_null() || !tlb::unpack_cell(param, rec) || rec.suspended_until <= now) { @@ -1996,7 +1996,7 @@ BurningConfig Config::get_burning_config() const { return c; } -td::Ref Config::get_unpacked_config_tuple(ton::UnixTime now) const { +td::Ref Config::get_unpacked_config_tuple(ion::UnixTime now) const { auto get_param = [&](td::int32 idx) -> vm::StackEntry { auto cell = get_config_param(idx); if (cell.is_null()) { @@ -2043,22 +2043,22 @@ PrecompiledContractsConfig Config::get_precompiled_contracts_config() const { return c; } -td::Result> Config::unpack_validator_set_start_stop(Ref vset_root) { +td::Result> Config::unpack_validator_set_start_stop(Ref vset_root) { if (vset_root.is_null()) { return td::Status::Error("validator set absent"); } gen::ValidatorSet::Record_validators_ext rec; if (tlb::unpack_cell(vset_root, rec)) { - return std::pair(rec.utime_since, rec.utime_until); + return std::pair(rec.utime_since, rec.utime_until); } gen::ValidatorSet::Record_validators rec0; if (tlb::unpack_cell(std::move(vset_root), rec0)) { - return std::pair(rec0.utime_since, rec0.utime_until); + return std::pair(rec0.utime_since, rec0.utime_until); } return td::Status::Error("validator set is invalid"); } -std::pair Config::get_validator_set_start_stop(int next) const { +std::pair Config::get_validator_set_start_stop(int next) const { auto res = unpack_validator_set_start_stop(get_config_param(next < 0 ? 32 : (next ? 36 : 34))); if (res.is_error()) { return {0, 0}; @@ -2067,9 +2067,9 @@ std::pair Config::get_validator_set_start_stop(int } } -bool WorkchainInfo::unpack(ton::WorkchainId wc, vm::CellSlice& cs) { - workchain = ton::workchainInvalid; - if (wc == ton::workchainInvalid) { +bool WorkchainInfo::unpack(ion::WorkchainId wc, vm::CellSlice& cs) { + workchain = ion::workchainInvalid; + if (wc == ion::workchainInvalid) { return false; } auto unpack_v1 = [this](auto& info) { @@ -2131,7 +2131,7 @@ bool WorkchainInfo::unpack(ton::WorkchainId wc, vm::CellSlice& cs) { return true; } -Ref Config::get_workchain_info(ton::WorkchainId workchain_id) const { +Ref Config::get_workchain_info(ion::WorkchainId workchain_id) const { if (!workchains_dict_) { return {}; } @@ -2143,7 +2143,7 @@ Ref Config::get_workchain_info(ton::WorkchainId workchain_id) con } } -bool ConfigInfo::get_old_mc_block_id(ton::BlockSeqno seqno, ton::BlockIdExt& blkid, ton::LogicalTime* end_lt) const { +bool ConfigInfo::get_old_mc_block_id(ion::BlockSeqno seqno, ion::BlockIdExt& blkid, ion::LogicalTime* end_lt) const { if (block_id.is_valid() && seqno == block_id.id.seqno) { blkid = block_id; if (end_lt) { @@ -2155,14 +2155,14 @@ bool ConfigInfo::get_old_mc_block_id(ton::BlockSeqno seqno, ton::BlockIdExt& blk } } -bool ConfigInfo::check_old_mc_block_id(const ton::BlockIdExt& blkid, bool strict) const { +bool ConfigInfo::check_old_mc_block_id(const ion::BlockIdExt& blkid, bool strict) const { return (!strict && blkid.id.seqno == block_id.id.seqno && block_id.is_valid()) ? blkid == block_id : block::check_old_mc_block_id(prev_blocks_dict_.get(), blkid); } // returns block with min block.seqno and req_lt <= block.end_lt -bool ConfigInfo::get_mc_block_by_lt(ton::LogicalTime req_lt, ton::BlockIdExt& blkid, ton::LogicalTime* end_lt) const { +bool ConfigInfo::get_mc_block_by_lt(ion::LogicalTime req_lt, ion::BlockIdExt& blkid, ion::LogicalTime* end_lt) const { if (req_lt > lt) { return false; } @@ -2195,7 +2195,7 @@ bool ConfigInfo::get_mc_block_by_lt(ton::LogicalTime req_lt, ton::BlockIdExt& bl } // returns key block with max block.seqno and block.seqno <= req_seqno -bool ConfigInfo::get_prev_key_block(ton::BlockSeqno req_seqno, ton::BlockIdExt& blkid, ton::LogicalTime* end_lt) const { +bool ConfigInfo::get_prev_key_block(ion::BlockSeqno req_seqno, ion::BlockIdExt& blkid, ion::LogicalTime* end_lt) const { if (block_id.is_valid() && is_key_state_ && block_id.seqno() <= req_seqno) { blkid = block_id; if (end_lt) { @@ -2234,7 +2234,7 @@ bool ConfigInfo::get_prev_key_block(ton::BlockSeqno req_seqno, ton::BlockIdExt& } // returns key block with min block.seqno and block.seqno >= req_seqno -bool ConfigInfo::get_next_key_block(ton::BlockSeqno req_seqno, ton::BlockIdExt& blkid, ton::LogicalTime* end_lt) const { +bool ConfigInfo::get_next_key_block(ion::BlockSeqno req_seqno, ion::BlockIdExt& blkid, ion::LogicalTime* end_lt) const { td::BitArray<32> key; auto found = prev_blocks_dict_->traverse_extra( key.bits(), 32, @@ -2293,7 +2293,7 @@ td::Result> ConfigInfo::get_prev_blocks_info() const { // [ wc:Integer shard:Integer seqno:Integer root_hash:Integer file_hash:Integer] = BlockId; // [ last_mc_blocks:[BlockId...] // prev_key_block:BlockId ] : PrevBlocksInfo - auto block_id_to_tuple = [](const ton::BlockIdExt& block_id) -> vm::Ref { + auto block_id_to_tuple = [](const ion::BlockIdExt& block_id) -> vm::Ref { td::RefInt256 shard = td::make_refint(block_id.id.shard); if (shard->sgn() < 0) { shard &= ((td::make_refint(1) << 64) - 1); @@ -2305,17 +2305,17 @@ td::Result> ConfigInfo::get_prev_blocks_info() const { std::vector last_mc_blocks; last_mc_blocks.push_back(block_id_to_tuple(block_id)); - for (ton::BlockSeqno seqno = block_id.id.seqno; seqno > 0 && last_mc_blocks.size() < 16;) { + for (ion::BlockSeqno seqno = block_id.id.seqno; seqno > 0 && last_mc_blocks.size() < 16;) { --seqno; - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; if (!get_old_mc_block_id(seqno, block_id)) { return td::Status::Error("cannot fetch old mc block"); } last_mc_blocks.push_back(block_id_to_tuple(block_id)); } - ton::BlockIdExt last_key_block; - ton::LogicalTime last_key_block_lt; + ion::BlockIdExt last_key_block; + ion::LogicalTime last_key_block_lt; if (!get_last_key_block(last_key_block, last_key_block_lt)) { return td::Status::Error("cannot fetch last key block"); } diff --git a/crypto/block/mc-config.h b/crypto/block/mc-config.h index 7cb6613d7..faddd2838 100644 --- a/crypto/block/mc-config.h +++ b/crypto/block/mc-config.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -20,8 +20,8 @@ #include "common/refcnt.hpp" #include "vm/db/StaticBagOfCellsDb.h" #include "vm/dict.h" -#include "ton/ton-types.h" -#include "ton/ton-shard.h" +#include "ion/ion-types.h" +#include "ion/ion-shard.h" #include "common/bitstring.h" #include "block.h" @@ -35,7 +35,7 @@ namespace block { using td::Ref; struct ValidatorDescr { - ton::Ed25519_PublicKey pubkey; + ion::Ed25519_PublicKey pubkey; td::Bits256 adnl_addr; td::uint64 weight; td::uint64 cum_weight; @@ -46,7 +46,7 @@ struct ValidatorDescr { ValidatorDescr(const td::Bits256& _pubkey, td::uint64 _weight, td::uint64 _cum_weight, const td::Bits256& _adnl_addr) : pubkey(_pubkey), adnl_addr(_adnl_addr), weight(_weight), cum_weight(_cum_weight) { } - ValidatorDescr(const ton::Ed25519_PublicKey& _pubkey, td::uint64 _weight, td::uint64 _cum_weight) + ValidatorDescr(const ion::Ed25519_PublicKey& _pubkey, td::uint64 _weight, td::uint64 _cum_weight) : pubkey(_pubkey), weight(_weight), cum_weight(_cum_weight) { adnl_addr.set_zero(); } @@ -70,8 +70,8 @@ struct ValidatorSet { return list[i]; } const ValidatorDescr& at_weight(td::uint64 weight_pos) const; - std::vector export_validator_set() const; - std::map compute_validator_map() const; + std::vector export_validator_set() const; + std::map compute_validator_map() const; std::vector export_scaled_validator_weights() const; int lookup_public_key(td::ConstBitPtr pubkey) const; int lookup_public_key(const td::Bits256& pubkey) const { @@ -88,24 +88,24 @@ struct validator_set_descr { td::int32 workchain; td::uint32 cc_seqno; validator_set_descr() = default; - validator_set_descr(ton::ShardIdFull shard_id, ton::CatchainSeqno cc_seqno_, bool flag) + validator_set_descr(ion::ShardIdFull shard_id, ion::CatchainSeqno cc_seqno_, bool flag) : shard(td::bswap64(shard_id.shard)) , workchain(td::bswap32(shard_id.workchain)) , cc_seqno(td::bswap32(cc_seqno_)) { } - validator_set_descr(ton::ShardIdFull shard_id, ton::CatchainSeqno cc_seqno_) + validator_set_descr(ion::ShardIdFull shard_id, ion::CatchainSeqno cc_seqno_) : validator_set_descr(shard_id, cc_seqno_, false) { std::memset(seed, 0, 32); } - validator_set_descr(ton::ShardIdFull shard_id, ton::CatchainSeqno cc_seqno_, const unsigned char seed_[32]) + validator_set_descr(ion::ShardIdFull shard_id, ion::CatchainSeqno cc_seqno_, const unsigned char seed_[32]) : validator_set_descr(shard_id, cc_seqno_, false) { std::memcpy(seed, seed_, 32); } - validator_set_descr(ton::ShardIdFull shard_id, ton::CatchainSeqno cc_seqno_, td::ConstBitPtr seed_) + validator_set_descr(ion::ShardIdFull shard_id, ion::CatchainSeqno cc_seqno_, td::ConstBitPtr seed_) : validator_set_descr(shard_id, cc_seqno_, false) { td::BitPtr{seed}.copy_from(seed_, 256); } - validator_set_descr(ton::ShardIdFull shard_id, ton::CatchainSeqno cc_seqno_, const td::Bits256& seed_) + validator_set_descr(ion::ShardIdFull shard_id, ion::CatchainSeqno cc_seqno_, const td::Bits256& seed_) : validator_set_descr(shard_id, cc_seqno_, false) { td::BitPtr{seed}.copy_from(seed_.cbits(), 256); } @@ -124,15 +124,15 @@ class ValidatorSetPRNG { public: ValidatorSetPRNG() = default; - ValidatorSetPRNG(ton::ShardIdFull shard_id, ton::CatchainSeqno cc_seqno_) : data(shard_id, cc_seqno_) { + ValidatorSetPRNG(ion::ShardIdFull shard_id, ion::CatchainSeqno cc_seqno_) : data(shard_id, cc_seqno_) { } - ValidatorSetPRNG(ton::ShardIdFull shard_id, ton::CatchainSeqno cc_seqno_, const unsigned char seed_[32]) + ValidatorSetPRNG(ion::ShardIdFull shard_id, ion::CatchainSeqno cc_seqno_, const unsigned char seed_[32]) : data(shard_id, cc_seqno_, seed_) { } - ValidatorSetPRNG(ton::ShardIdFull shard_id, ton::CatchainSeqno cc_seqno_, td::ConstBitPtr seed_) + ValidatorSetPRNG(ion::ShardIdFull shard_id, ion::CatchainSeqno cc_seqno_, td::ConstBitPtr seed_) : data(shard_id, cc_seqno_, std::move(seed_)) { } - ValidatorSetPRNG(ton::ShardIdFull shard_id, ton::CatchainSeqno cc_seqno_, const td::Bits256& seed_) + ValidatorSetPRNG(ion::ShardIdFull shard_id, ion::CatchainSeqno cc_seqno_, const td::Bits256& seed_) : data(shard_id, cc_seqno_, seed_) { } td::uint64 next_ulong(); @@ -146,36 +146,36 @@ class ValidatorSetPRNG { class McShardHashI : public td::CntObject { public: enum class FsmState { fsm_none, fsm_split, fsm_merge }; - virtual ton::BlockIdExt top_block_id() const = 0; - virtual ton::LogicalTime start_lt() const = 0; - virtual ton::LogicalTime end_lt() const = 0; - virtual ton::UnixTime fsm_utime() const = 0; + virtual ion::BlockIdExt top_block_id() const = 0; + virtual ion::LogicalTime start_lt() const = 0; + virtual ion::LogicalTime end_lt() const = 0; + virtual ion::UnixTime fsm_utime() const = 0; virtual FsmState fsm_state() const = 0; - virtual ton::ShardIdFull shard() const = 0; + virtual ion::ShardIdFull shard() const = 0; virtual bool before_split() const = 0; virtual bool before_merge() const = 0; }; struct McShardHash : public McShardHashI { - ton::BlockIdExt blk_; - ton::LogicalTime start_lt_, end_lt_; - ton::UnixTime gen_utime_{0}; - ton::UnixTime fsm_utime_{0}; - ton::UnixTime fsm_interval_{0}; - ton::BlockSeqno min_ref_mc_seqno_{std::numeric_limits::max()}; - ton::BlockSeqno reg_mc_seqno_{std::numeric_limits::max()}; + ion::BlockIdExt blk_; + ion::LogicalTime start_lt_, end_lt_; + ion::UnixTime gen_utime_{0}; + ion::UnixTime fsm_utime_{0}; + ion::UnixTime fsm_interval_{0}; + ion::BlockSeqno min_ref_mc_seqno_{std::numeric_limits::max()}; + ion::BlockSeqno reg_mc_seqno_{std::numeric_limits::max()}; FsmState fsm_{FsmState::fsm_none}; bool disabled_{false}; bool before_split_{false}, before_merge_{false}, want_split_{false}, want_merge_{false}; - ton::CatchainSeqno next_catchain_seqno_{std::numeric_limits::max()}; - ton::ShardId next_validator_shard_{ton::shardIdAll}; + ion::CatchainSeqno next_catchain_seqno_{std::numeric_limits::max()}; + ion::ShardId next_validator_shard_{ion::shardIdAll}; CurrencyCollection fees_collected_, funds_created_; - McShardHash(const ton::BlockId& id, ton::LogicalTime start_lt, ton::LogicalTime end_lt, ton::UnixTime gen_utime, - const ton::BlockHash& root_hash, const ton::FileHash& file_hash, CurrencyCollection fees_collected = {}, + McShardHash(const ion::BlockId& id, ion::LogicalTime start_lt, ion::LogicalTime end_lt, ion::UnixTime gen_utime, + const ion::BlockHash& root_hash, const ion::FileHash& file_hash, CurrencyCollection fees_collected = {}, CurrencyCollection funds_created = {}, - ton::BlockSeqno reg_mc_seqno = std::numeric_limits::max(), - ton::BlockSeqno min_ref_mc_seqno = std::numeric_limits::max(), - ton::CatchainSeqno cc_seqno = std::numeric_limits::max(), ton::ShardId val_shard = 0, + ion::BlockSeqno reg_mc_seqno = std::numeric_limits::max(), + ion::BlockSeqno min_ref_mc_seqno = std::numeric_limits::max(), + ion::CatchainSeqno cc_seqno = std::numeric_limits::max(), ion::ShardId val_shard = 0, bool nx_cc_updated = false, bool before_split = false, bool before_merge = false, bool want_split = false, bool want_merge = false) : blk_(id, root_hash, file_hash) @@ -193,7 +193,7 @@ struct McShardHash : public McShardHashI { , fees_collected_(fees_collected) , funds_created_(funds_created) { } - McShardHash(const ton::BlockIdExt& blk, ton::LogicalTime start_lt, ton::LogicalTime end_lt) + McShardHash(const ion::BlockIdExt& blk, ion::LogicalTime start_lt, ion::LogicalTime end_lt) : blk_(blk), start_lt_(start_lt), end_lt_(end_lt) { } McShardHash(const McShardHash&) = default; @@ -201,23 +201,23 @@ struct McShardHash : public McShardHashI { bool is_valid() const { return blk_.is_valid(); } - ton::BlockIdExt top_block_id() const override final { + ion::BlockIdExt top_block_id() const override final { return blk_; } // ZeroStateIdExt zero_state() const override; - ton::LogicalTime start_lt() const override final { + ion::LogicalTime start_lt() const override final { return start_lt_; } - ton::LogicalTime end_lt() const override final { + ion::LogicalTime end_lt() const override final { return end_lt_; } - ton::UnixTime fsm_utime() const override final { + ion::UnixTime fsm_utime() const override final { return fsm_utime_; } - ton::UnixTime fsm_utime_end() const { + ion::UnixTime fsm_utime_end() const { return fsm_utime_ + fsm_interval_; } - ton::UnixTime created_at() const { + ion::UnixTime created_at() const { return gen_utime_; } FsmState fsm_state() const override final { @@ -232,14 +232,14 @@ struct McShardHash : public McShardHashI { bool is_fsm_merge() const { return fsm_ == FsmState::fsm_merge; } - ton::ShardIdFull shard() const override final { - return ton::ShardIdFull(blk_); + ion::ShardIdFull shard() const override final { + return ion::ShardIdFull(blk_); } - ton::WorkchainId workchain() const { + ion::WorkchainId workchain() const { return blk_.id.workchain; } - bool contains(const ton::AccountIdPrefixFull& pfx) const { - return ton::shard_contains(shard(), pfx); + bool contains(const ion::AccountIdPrefixFull& pfx) const { + return ion::shard_contains(shard(), pfx); } bool before_split() const override final { return before_split_; @@ -254,10 +254,10 @@ struct McShardHash : public McShardHashI { blk_.invalidate(); disabled_ = true; } - ton::BlockSeqno seqno() const { + ion::BlockSeqno seqno() const { return blk_.id.seqno; } - bool set_reg_mc_seqno(ton::BlockSeqno reg_mc_seqno) { + bool set_reg_mc_seqno(ion::BlockSeqno reg_mc_seqno) { reg_mc_seqno_ = reg_mc_seqno; return true; } @@ -266,11 +266,11 @@ struct McShardHash : public McShardHashI { void clear_fsm() { fsm_ = FsmState::fsm_none; } - void set_fsm(FsmState fsm, ton::UnixTime fsm_utime, ton::UnixTime fsm_interval); - void set_fsm_split(ton::UnixTime fsm_utime, ton::UnixTime fsm_interval) { + void set_fsm(FsmState fsm, ion::UnixTime fsm_utime, ion::UnixTime fsm_interval); + void set_fsm_split(ion::UnixTime fsm_utime, ion::UnixTime fsm_interval) { set_fsm(FsmState::fsm_split, fsm_utime, fsm_interval); } - void set_fsm_merge(ton::UnixTime fsm_utime, ton::UnixTime fsm_interval) { + void set_fsm_merge(ion::UnixTime fsm_utime, ion::UnixTime fsm_interval) { set_fsm(FsmState::fsm_merge, fsm_utime, fsm_interval); } bool fsm_equal(const McShardHash& other) const { @@ -278,9 +278,9 @@ struct McShardHash : public McShardHashI { (is_fsm_none() || (fsm_utime_ == other.fsm_utime_ && fsm_interval_ == other.fsm_interval_)); } bool pack(vm::CellBuilder& cb) const; - static Ref unpack(vm::CellSlice& cs, ton::ShardIdFull id); - static Ref from_block(Ref block_root, const ton::FileHash& _fhash, bool init_fees = false); - static bool extract_cc_seqno(vm::CellSlice& cs, ton::CatchainSeqno* cc); + static Ref unpack(vm::CellSlice& cs, ion::ShardIdFull id); + static Ref from_block(Ref block_root, const ion::FileHash& _fhash, bool init_fees = false); + static bool extract_cc_seqno(vm::CellSlice& cs, ion::CatchainSeqno* cc); McShardHash* make_copy() const override { return new McShardHash(*this); } @@ -292,19 +292,19 @@ struct McShardDescr final : public McShardHash { Ref outmsg_root; std::unique_ptr out_msg_queue; std::shared_ptr processed_upto; - McShardDescr(const ton::BlockId& id, ton::LogicalTime start_lt, ton::LogicalTime end_lt, ton::UnixTime gen_utime, - const ton::BlockHash& root_hash, const ton::FileHash& file_hash, CurrencyCollection fees_collected = {}, + McShardDescr(const ion::BlockId& id, ion::LogicalTime start_lt, ion::LogicalTime end_lt, ion::UnixTime gen_utime, + const ion::BlockHash& root_hash, const ion::FileHash& file_hash, CurrencyCollection fees_collected = {}, CurrencyCollection funds_created = {}, - ton::BlockSeqno reg_mc_seqno = std::numeric_limits::max(), - ton::BlockSeqno min_ref_mc_seqno = std::numeric_limits::max(), - ton::CatchainSeqno cc_seqno = std::numeric_limits::max(), - ton::ShardId val_shard = ton::shardIdAll, bool nx_cc_updated = false, bool before_split = false, + ion::BlockSeqno reg_mc_seqno = std::numeric_limits::max(), + ion::BlockSeqno min_ref_mc_seqno = std::numeric_limits::max(), + ion::CatchainSeqno cc_seqno = std::numeric_limits::max(), + ion::ShardId val_shard = ion::shardIdAll, bool nx_cc_updated = false, bool before_split = false, bool before_merge = false, bool want_split = false, bool want_merge = false) : McShardHash(id, start_lt, end_lt, gen_utime, root_hash, file_hash, fees_collected, funds_created, reg_mc_seqno, min_ref_mc_seqno, cc_seqno, val_shard, nx_cc_updated, before_split, before_merge, want_split, want_merge) { } - McShardDescr(const ton::BlockIdExt& blk, ton::LogicalTime start_lt, ton::LogicalTime end_lt) + McShardDescr(const ion::BlockIdExt& blk, ion::LogicalTime start_lt, ion::LogicalTime end_lt) : McShardHash(blk, start_lt, end_lt) { } McShardDescr(const McShardHash& shard_hash) : McShardHash(shard_hash) { @@ -315,19 +315,19 @@ struct McShardDescr final : public McShardHash { McShardDescr& operator=(McShardDescr&& other) = default; bool set_queue_root(Ref queue_root); void disable(); - static Ref from_block(Ref block_root, Ref state_root, const ton::FileHash& _fhash, + static Ref from_block(Ref block_root, Ref state_root, const ion::FileHash& _fhash, bool init_fees = false); - static Ref from_state(ton::BlockIdExt blkid, Ref state_root); + static Ref from_state(ion::BlockIdExt blkid, Ref state_root); }; struct StoragePrices { - ton::UnixTime valid_since{0}; + ion::UnixTime valid_since{0}; td::uint64 bit_price{0}; td::uint64 cell_price{0}; td::uint64 mc_bit_price{0}; td::uint64 mc_cell_price{0}; StoragePrices() = default; - StoragePrices(ton::UnixTime _valid_since, td::uint64 _bprice, td::uint64 _cprice, td::uint64 _mc_bprice, + StoragePrices(ion::UnixTime _valid_since, td::uint64 _bprice, td::uint64 _cprice, td::uint64 _mc_bprice, td::uint64 _mc_cprice) : valid_since(_valid_since) , bit_price(_bprice) @@ -335,8 +335,8 @@ struct StoragePrices { , mc_bit_price(_mc_bprice) , mc_cell_price(_mc_cprice) { } - static td::RefInt256 compute_storage_fees(ton::UnixTime now, const std::vector& pricing, - const vm::CellStorageStat& storage_stat, ton::UnixTime last_paid, + static td::RefInt256 compute_storage_fees(ion::UnixTime now, const std::vector& pricing, + const vm::CellStorageStat& storage_stat, ion::UnixTime last_paid, bool is_special, bool is_masterchain); }; @@ -413,8 +413,8 @@ struct CatchainValidatorsConfig { }; struct WorkchainInfo : public td::CntObject { - ton::WorkchainId workchain{ton::workchainInvalid}; - ton::UnixTime enabled_since; + ion::WorkchainId workchain{ion::workchainInvalid}; + ion::UnixTime enabled_since; td::uint32 monitor_min_split; td::uint32 min_split, max_split; bool basic; @@ -422,8 +422,8 @@ struct WorkchainInfo : public td::CntObject { bool accept_msgs; int flags; td::uint32 version; - ton::RootHash zerostate_root_hash; - ton::FileHash zerostate_file_hash; + ion::RootHash zerostate_root_hash; + ion::FileHash zerostate_file_hash; int min_addr_len, max_addr_len, addr_len_step; // Default values are used when split_merge_timings is not set in config @@ -433,14 +433,14 @@ struct WorkchainInfo : public td::CntObject { unsigned max_split_merge_delay = 1000; // end of split/merge interval must be at most 1000 seconds in the future bool is_valid() const { - return workchain != ton::workchainInvalid; + return workchain != ion::workchainInvalid; } bool is_valid_addr_len(int addr_len) const { return addr_len >= min_addr_len && addr_len <= max_addr_len && (addr_len == min_addr_len || addr_len == max_addr_len || (addr_len_step > 0 && !((addr_len - min_addr_len) % addr_len_step))); } - bool unpack(ton::WorkchainId wc, vm::CellSlice& cs); + bool unpack(ion::WorkchainId wc, vm::CellSlice& cs); }; using WorkchainSet = std::map>; @@ -449,7 +449,7 @@ class ShardConfig { Ref shard_hashes_; Ref mc_shard_hash_; std::unique_ptr shard_hashes_dict_; - std::set shards_updated_; + std::set shards_updated_; bool valid_{false}; public: @@ -467,50 +467,50 @@ class ShardConfig { bool unpack(Ref shard_hashes, Ref mc_shard_hash = {}); bool unpack(Ref shard_hashes, Ref mc_shard_hash = {}); Ref get_root_csr() const; - bool has_workchain(ton::WorkchainId workchain) const; - std::vector get_workchains() const; - Ref get_shard_hash(ton::ShardIdFull id, bool exact = true) const; - bool contains(ton::BlockIdExt blkid) const; - bool get_shard_hash_raw(vm::CellSlice& cs, ton::ShardIdFull id, ton::ShardIdFull& true_id, bool exact = true) const; - ton::LogicalTime get_shard_end_lt(ton::AccountIdPrefixFull acc) const; - ton::LogicalTime get_shard_end_lt_ext(ton::AccountIdPrefixFull acc, ton::ShardIdFull& actual_shard) const; - static bool get_shard_hash_raw_from(vm::Dictionary& shard_hashes_dict, vm::CellSlice& cs, ton::ShardIdFull id, - ton::ShardIdFull& true_id, bool exact = true, Ref* leaf = nullptr); - std::vector get_shard_hash_ids(bool skip_mc = false) const; - std::vector get_shard_hash_ids(const std::function& filter) const; - std::vector get_intersecting_shard_hash_ids(ton::ShardIdFull myself) const; - std::vector get_neighbor_shard_hash_ids(ton::ShardIdFull myself) const; - std::vector get_proper_neighbor_shard_hash_ids(ton::ShardIdFull myself) const; + bool has_workchain(ion::WorkchainId workchain) const; + std::vector get_workchains() const; + Ref get_shard_hash(ion::ShardIdFull id, bool exact = true) const; + bool contains(ion::BlockIdExt blkid) const; + bool get_shard_hash_raw(vm::CellSlice& cs, ion::ShardIdFull id, ion::ShardIdFull& true_id, bool exact = true) const; + ion::LogicalTime get_shard_end_lt(ion::AccountIdPrefixFull acc) const; + ion::LogicalTime get_shard_end_lt_ext(ion::AccountIdPrefixFull acc, ion::ShardIdFull& actual_shard) const; + static bool get_shard_hash_raw_from(vm::Dictionary& shard_hashes_dict, vm::CellSlice& cs, ion::ShardIdFull id, + ion::ShardIdFull& true_id, bool exact = true, Ref* leaf = nullptr); + std::vector get_shard_hash_ids(bool skip_mc = false) const; + std::vector get_shard_hash_ids(const std::function& filter) const; + std::vector get_intersecting_shard_hash_ids(ion::ShardIdFull myself) const; + std::vector get_neighbor_shard_hash_ids(ion::ShardIdFull myself) const; + std::vector get_proper_neighbor_shard_hash_ids(ion::ShardIdFull myself) const; static std::unique_ptr extract_shard_hashes_dict(Ref mc_state_root); bool process_shard_hashes(std::function func); bool process_sibling_shard_hashes(std::function func); // may become non-static const in the future - static bool is_neighbor(ton::ShardIdFull x, ton::ShardIdFull y); + static bool is_neighbor(ion::ShardIdFull x, ion::ShardIdFull y); Ref get_mc_hash() const { return mc_shard_hash_; } void set_mc_hash(Ref mc_shard_hash) { mc_shard_hash_ = std::move(mc_shard_hash); } - ton::CatchainSeqno get_shard_cc_seqno(ton::ShardIdFull shard) const; + ion::CatchainSeqno get_shard_cc_seqno(ion::ShardIdFull shard) const; block::compute_shard_end_lt_func_t get_compute_shard_end_lt_func() const { return std::bind(&ShardConfig::get_shard_end_lt, *this, std::placeholders::_1); } - bool new_workchain(ton::WorkchainId workchain, ton::BlockSeqno reg_mc_seqno, const ton::RootHash& zerostate_root_hash, - const ton::FileHash& zerostate_file_hash); - td::Result update_shard_block_info(Ref new_info, const std::vector& old_blkids); + bool new_workchain(ion::WorkchainId workchain, ion::BlockSeqno reg_mc_seqno, const ion::RootHash& zerostate_root_hash, + const ion::FileHash& zerostate_file_hash); + td::Result update_shard_block_info(Ref new_info, const std::vector& old_blkids); td::Result update_shard_block_info2(Ref new_info1, Ref new_info2, - const std::vector& old_blkids); + const std::vector& old_blkids); td::Result may_update_shard_block_info(Ref new_info, - const std::vector& old_blkids, - ton::LogicalTime lt_limit = std::numeric_limits::max(), + const std::vector& old_blkids, + ion::LogicalTime lt_limit = std::numeric_limits::max(), Ref* ancestor = nullptr) const; private: bool init(); bool do_update_shard_info(Ref new_info); bool do_update_shard_info2(Ref new_info1, Ref new_info2); - bool set_shard_info(ton::ShardIdFull shard, Ref value); + bool set_shard_info(ion::ShardIdFull shard, Ref value); }; struct BurningConfig { @@ -552,7 +552,7 @@ class Config { static constexpr int needWorkchainInfo = 256; static constexpr int needCapabilities = 512; int mode{0}; - ton::BlockIdExt block_id; + ion::BlockIdExt block_id; private: td::BitArray<256> config_addr; @@ -568,10 +568,10 @@ class Config { std::unique_ptr special_smc_dict; public: - static constexpr ton::LogicalTime get_lt_align() { + static constexpr ion::LogicalTime get_lt_align() { return 1000000; } - static constexpr ton::LogicalTime get_max_lt_growth() { + static constexpr ion::LogicalTime get_max_lt_growth() { return 10 * get_lt_align() - 1; } Ref get_config_param(int idx) const; @@ -598,10 +598,10 @@ class Config { return has_capabilities() && (capabilities_ & cap_set) == cap_set; } bool ihr_enabled() const { - return has_capability(ton::capIhrEnabled); + return has_capability(ion::capIhrEnabled); } bool create_stats_enabled() const { - return has_capability(ton::capCreateStatsEnabled); + return has_capability(ion::capCreateStatsEnabled); } std::unique_ptr get_param_dict(int idx) const; td::Result> unpack_param_list(int idx) const; @@ -618,10 +618,10 @@ class Config { return unpack_param_list(10); } bool all_mandatory_params_defined(int* bad_idx_ptr = nullptr) const; - td::Result get_dns_root_addr() const; - bool set_block_id_ext(const ton::BlockIdExt& block_id_ext); - td::Result> get_special_smartcontracts(bool without_config = false) const; - bool is_special_smartcontract(const ton::StdSmcAddress& addr) const; + td::Result get_dns_root_addr() const; + bool set_block_id_ext(const ion::BlockIdExt& block_id_ext); + td::Result> get_special_smartcontracts(bool without_config = false) const; + bool is_special_smartcontract(const ion::StdSmcAddress& addr) const; static td::Result> unpack_validator_set(Ref valset_root); td::Result> get_storage_prices() const; static td::Result do_get_one_storage_prices(vm::CellSlice cs); @@ -645,24 +645,24 @@ class Config { const ValidatorSet* get_cur_validator_set() const { return cur_validators_.get(); } - std::pair get_validator_set_start_stop(int next = 0) const; - ton::ValidatorSessionConfig get_consensus_config() const; + std::pair get_validator_set_start_stop(int next = 0) const; + ion::ValidatorSessionConfig get_consensus_config() const; bool foreach_config_param(std::function)> scan_func) const; - Ref get_workchain_info(ton::WorkchainId workchain_id) const; - std::vector compute_validator_set(ton::ShardIdFull shard, const block::ValidatorSet& vset, - ton::UnixTime time, ton::CatchainSeqno cc_seqno) const; - std::vector compute_validator_set(ton::ShardIdFull shard, ton::UnixTime time, - ton::CatchainSeqno cc_seqno) const; - std::vector compute_total_validator_set(int next) const; + Ref get_workchain_info(ion::WorkchainId workchain_id) const; + std::vector compute_validator_set(ion::ShardIdFull shard, const block::ValidatorSet& vset, + ion::UnixTime time, ion::CatchainSeqno cc_seqno) const; + std::vector compute_validator_set(ion::ShardIdFull shard, ion::UnixTime time, + ion::CatchainSeqno cc_seqno) const; + std::vector compute_total_validator_set(int next) const; td::Result get_size_limits_config() const; static td::Result do_get_size_limits_config(td::Ref cs); - std::unique_ptr get_suspended_addresses(ton::UnixTime now) const; + std::unique_ptr get_suspended_addresses(ion::UnixTime now) const; BurningConfig get_burning_config() const; - td::Ref get_unpacked_config_tuple(ton::UnixTime now) const; + td::Ref get_unpacked_config_tuple(ion::UnixTime now) const; PrecompiledContractsConfig get_precompiled_contracts_config() const; - static std::vector do_compute_validator_set(const CatchainValidatorsConfig& ccv_conf, - ton::ShardIdFull shard, const ValidatorSet& vset, - ton::CatchainSeqno cc_seqno); + static std::vector do_compute_validator_set(const CatchainValidatorsConfig& ccv_conf, + ion::ShardIdFull shard, const ValidatorSet& vset, + ion::CatchainSeqno cc_seqno); static td::Result> unpack_config(Ref config_root, const td::Bits256& config_addr = td::Bits256::zero(), @@ -670,7 +670,7 @@ class Config { static td::Result> unpack_config(Ref config_csr, int mode = 0); static td::Result> extract_from_state(Ref mc_state_root, int mode = 0); static td::Result> extract_from_key_block(Ref key_block_root, int mode = 0); - static td::Result> unpack_validator_set_start_stop(Ref root); + static td::Result> unpack_validator_set_start_stop(Ref root); static td::Result> unpack_param_dict(vm::Dictionary& dict); static td::Result> unpack_param_dict(Ref dict_root); @@ -692,12 +692,12 @@ class ConfigInfo : public Config, public ShardConfig { static constexpr int needShardHashes = 8; static constexpr int needAccountsRoot = 64; static constexpr int needPrevBlocks = 128; - ton::BlockSeqno vert_seqno{~0U}; + ion::BlockSeqno vert_seqno{~0U}; int global_id_{0}; - ton::UnixTime utime{0}; - ton::LogicalTime lt{0}; - ton::BlockSeqno min_ref_mc_seqno_{std::numeric_limits::max()}; - ton::CatchainSeqno cc_seqno_{std::numeric_limits::max()}; + ion::UnixTime utime{0}; + ion::LogicalTime lt{0}; + ion::BlockSeqno min_ref_mc_seqno_{std::numeric_limits::max()}; + ion::CatchainSeqno cc_seqno_{std::numeric_limits::max()}; int shard_cc_updated{-1}; bool nx_cc_updated; bool is_key_state_{false}; @@ -707,9 +707,9 @@ class ConfigInfo : public Config, public ShardConfig { Ref lib_root_; Ref state_extra_root_; Ref accounts_root; - ton::ZeroStateIdExt zerostate_id_; - ton::BlockIdExt last_key_block_; - ton::LogicalTime last_key_block_lt_; + ion::ZeroStateIdExt zerostate_id_; + ion::BlockIdExt last_key_block_; + ion::LogicalTime last_key_block_lt_; Ref shard_hashes; std::unique_ptr shard_hashes_dict; std::unique_ptr accounts_dict; @@ -717,17 +717,17 @@ class ConfigInfo : public Config, public ShardConfig { std::unique_ptr libraries_dict_; public: - bool set_block_id_ext(const ton::BlockIdExt& block_id_ext); + bool set_block_id_ext(const ion::BlockIdExt& block_id_ext); bool rotated_all_shards() const { return nx_cc_updated; } int get_global_blockchain_id() const { return global_id_; } - ton::ZeroStateIdExt get_zerostate_id() const { + ion::ZeroStateIdExt get_zerostate_id() const { return zerostate_id_; } - Ref lookup_library(const ton::Bits256& root_hash) const { + Ref lookup_library(const ion::Bits256& root_hash) const { return lookup_library(root_hash.bits()); } Ref lookup_library(td::ConstBitPtr root_hash) const; @@ -740,27 +740,27 @@ class ConfigInfo : public Config, public ShardConfig { Ref get_state_extra_root() const { return state_extra_root_; } - ton::BlockSeqno get_vert_seqno() const { + ion::BlockSeqno get_vert_seqno() const { return vert_seqno; } - ton::CatchainSeqno get_shard_cc_seqno(ton::ShardIdFull shard) const; - bool get_last_key_block(ton::BlockIdExt& blkid, ton::LogicalTime& blklt, bool strict = false) const; - bool get_old_mc_block_id(ton::BlockSeqno seqno, ton::BlockIdExt& blkid, ton::LogicalTime* end_lt = nullptr) const; - bool check_old_mc_block_id(const ton::BlockIdExt& blkid, bool strict = false) const; + ion::CatchainSeqno get_shard_cc_seqno(ion::ShardIdFull shard) const; + bool get_last_key_block(ion::BlockIdExt& blkid, ion::LogicalTime& blklt, bool strict = false) const; + bool get_old_mc_block_id(ion::BlockSeqno seqno, ion::BlockIdExt& blkid, ion::LogicalTime* end_lt = nullptr) const; + bool check_old_mc_block_id(const ion::BlockIdExt& blkid, bool strict = false) const; // returns block with min seqno and req_lt <= block.end_lt - bool get_mc_block_by_lt(ton::LogicalTime lt, ton::BlockIdExt& blkid, ton::LogicalTime* end_lt = nullptr) const; - bool get_prev_key_block(ton::BlockSeqno req_seqno, ton::BlockIdExt& blkid, ton::LogicalTime* end_lt = nullptr) const; - bool get_next_key_block(ton::BlockSeqno req_seqno, ton::BlockIdExt& blkid, ton::LogicalTime* end_lt = nullptr) const; - td::Result>> get_special_ticktock_smartcontracts( + bool get_mc_block_by_lt(ion::LogicalTime lt, ion::BlockIdExt& blkid, ion::LogicalTime* end_lt = nullptr) const; + bool get_prev_key_block(ion::BlockSeqno req_seqno, ion::BlockIdExt& blkid, ion::LogicalTime* end_lt = nullptr) const; + bool get_next_key_block(ion::BlockSeqno req_seqno, ion::BlockIdExt& blkid, ion::LogicalTime* end_lt = nullptr) const; + td::Result>> get_special_ticktock_smartcontracts( int tick_tock = 3) const; int get_smc_tick_tock(td::ConstBitPtr smc_addr) const; std::unique_ptr create_accounts_dict() const; const vm::AugmentedDictionary& get_accounts_dict() const; - std::vector compute_validator_set_cc(ton::ShardIdFull shard, const block::ValidatorSet& vset, - ton::UnixTime time, - ton::CatchainSeqno* cc_seqno_delta = nullptr) const; - std::vector compute_validator_set_cc(ton::ShardIdFull shard, ton::UnixTime time, - ton::CatchainSeqno* cc_seqno_delta = nullptr) const; + std::vector compute_validator_set_cc(ion::ShardIdFull shard, const block::ValidatorSet& vset, + ion::UnixTime time, + ion::CatchainSeqno* cc_seqno_delta = nullptr) const; + std::vector compute_validator_set_cc(ion::ShardIdFull shard, ion::UnixTime time, + ion::CatchainSeqno* cc_seqno_delta = nullptr) const; td::Result> get_prev_blocks_info() const; static td::Result> extract_config(std::shared_ptr static_boc, int mode = 0); diff --git a/crypto/block/output-queue-merger.cpp b/crypto/block/output-queue-merger.cpp index aa425f6b8..170db5c1c 100644 --- a/crypto/block/output-queue-merger.cpp +++ b/crypto/block/output-queue-merger.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -57,7 +57,7 @@ bool OutputQueueMerger::MsgKeyValue::invalidate() { return false; } -ton::LogicalTime OutputQueueMerger::MsgKeyValue::get_node_lt(Ref node, int key_pfx_len) { +ion::LogicalTime OutputQueueMerger::MsgKeyValue::get_node_lt(Ref node, int key_pfx_len) { if (node.is_null() || (unsigned)key_pfx_len > (unsigned)max_key_len) { return std::numeric_limits::max(); } @@ -146,12 +146,12 @@ bool OutputQueueMerger::add_root(int src, Ref outmsg_root) { return true; } -OutputQueueMerger::OutputQueueMerger(ton::ShardIdFull _queue_for, std::vector _neighbors) +OutputQueueMerger::OutputQueueMerger(ion::ShardIdFull _queue_for, std::vector _neighbors) : queue_for(_queue_for), neighbors(std::move(_neighbors)), eof(false), failed(false) { init(); } -OutputQueueMerger::OutputQueueMerger(ton::ShardIdFull _queue_for, std::vector _neighbors) +OutputQueueMerger::OutputQueueMerger(ion::ShardIdFull _queue_for, std::vector _neighbors) : queue_for(_queue_for), eof(false), failed(false) { for (auto& nb : _neighbors) { neighbors.emplace_back(nb.top_block_id(), nb.outmsg_root, nb.is_disabled()); diff --git a/crypto/block/output-queue-merger.h b/crypto/block/output-queue-merger.h index 07533f243..8e91f5f7c 100644 --- a/crypto/block/output-queue-merger.h +++ b/crypto/block/output-queue-merger.h @@ -1,23 +1,23 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #pragma once -#include "ton/ton-types.h" +#include "ion/ion-types.h" #include "vm/cells/CellSlice.h" #include "block/mc-config.h" @@ -45,29 +45,29 @@ struct OutputQueueMerger { protected: friend struct OutputQueueMerger; - static ton::LogicalTime get_node_lt(Ref node, int key_pfx_len); + static ion::LogicalTime get_node_lt(Ref node, int key_pfx_len); bool replace_with_child(bool child_idx); bool replace_by_prefix(td::ConstBitPtr req_pfx, int req_pfx_len); bool unpack_node(td::ConstBitPtr key_pfx, int key_pfx_len, Ref node); bool split(MsgKeyValue& second); }; struct Neighbor { - ton::BlockIdExt block_id_; + ion::BlockIdExt block_id_; td::Ref outmsg_root_; bool disabled_; Neighbor() = default; - Neighbor(ton::BlockIdExt block_id, td::Ref outmsg_root, bool disabled = false) + Neighbor(ion::BlockIdExt block_id, td::Ref outmsg_root, bool disabled = false) : block_id_(block_id), outmsg_root_(std::move(outmsg_root)), disabled_(disabled) { } }; // - ton::ShardIdFull queue_for; + ion::ShardIdFull queue_for; std::vector> msg_list; std::vector neighbors; public: - OutputQueueMerger(ton::ShardIdFull _queue_for, std::vector _neighbors); - OutputQueueMerger(ton::ShardIdFull _queue_for, std::vector _neighbors); + OutputQueueMerger(ion::ShardIdFull _queue_for, std::vector _neighbors); + OutputQueueMerger(ion::ShardIdFull _queue_for, std::vector _neighbors); bool is_eof() const { return eof; } diff --git a/crypto/block/precompiled-smc/PrecompiledSmartContract.cpp b/crypto/block/precompiled-smc/PrecompiledSmartContract.cpp index 6797216df..3f034dbfa 100644 --- a/crypto/block/precompiled-smc/PrecompiledSmartContract.cpp +++ b/crypto/block/precompiled-smc/PrecompiledSmartContract.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #include "common.h" #include @@ -22,7 +22,7 @@ namespace block::precompiled { using namespace vm; -Result PrecompiledSmartContract::run(td::Ref my_address, ton::UnixTime now, ton::LogicalTime cur_lt, +Result PrecompiledSmartContract::run(td::Ref my_address, ion::UnixTime now, ion::LogicalTime cur_lt, CurrencyCollection balance, td::Ref c4, vm::CellSlice msg_body, td::Ref msg, CurrencyCollection msg_balance, bool is_external, std::vector> libraries, int global_version, @@ -91,7 +91,7 @@ void PrecompiledSmartContract::raw_reserve(const td::RefInt256 &amount, int mode c5_ = cb.finalize_novm(); } -td::RefInt256 PrecompiledSmartContract::get_compute_fee(ton::WorkchainId wc, td::uint64 gas_used) { +td::RefInt256 PrecompiledSmartContract::get_compute_fee(ion::WorkchainId wc, td::uint64 gas_used) { if (gas_used >= (1ULL << 63)) { throw VmError{Excno::range_chk}; } @@ -99,7 +99,7 @@ td::RefInt256 PrecompiledSmartContract::get_compute_fee(ton::WorkchainId wc, td: return util::check_finite(prices.compute_gas_price(gas_used)); } -td::RefInt256 PrecompiledSmartContract::get_forward_fee(ton::WorkchainId wc, td::uint64 bits, td::uint64 cells) { +td::RefInt256 PrecompiledSmartContract::get_forward_fee(ion::WorkchainId wc, td::uint64 bits, td::uint64 cells) { if (bits >= (1ULL << 63) || cells >= (1ULL << 63)) { throw VmError{Excno::range_chk}; } @@ -107,7 +107,7 @@ td::RefInt256 PrecompiledSmartContract::get_forward_fee(ton::WorkchainId wc, td: return util::check_finite(prices.compute_fwd_fees256(cells, bits)); } -td::RefInt256 PrecompiledSmartContract::get_storage_fee(ton::WorkchainId wc, td::uint64 duration, td::uint64 bits, +td::RefInt256 PrecompiledSmartContract::get_storage_fee(ion::WorkchainId wc, td::uint64 duration, td::uint64 bits, td::uint64 cells) { if (bits >= (1ULL << 63) || cells >= (1ULL << 63) || duration >= (1ULL << 63)) { throw VmError{Excno::range_chk}; @@ -116,7 +116,7 @@ td::RefInt256 PrecompiledSmartContract::get_storage_fee(ton::WorkchainId wc, td: return util::check_finite(util::calculate_storage_fee(maybe_prices, wc, duration, bits, cells)); } -td::RefInt256 PrecompiledSmartContract::get_simple_compute_fee(ton::WorkchainId wc, td::uint64 gas_used) { +td::RefInt256 PrecompiledSmartContract::get_simple_compute_fee(ion::WorkchainId wc, td::uint64 gas_used) { if (gas_used >= (1ULL << 63)) { throw VmError{Excno::range_chk}; } @@ -124,7 +124,7 @@ td::RefInt256 PrecompiledSmartContract::get_simple_compute_fee(ton::WorkchainId return util::check_finite(td::rshift(td::make_refint(prices.gas_price) * gas_used, 16, 1)); } -td::RefInt256 PrecompiledSmartContract::get_simple_forward_fee(ton::WorkchainId wc, td::uint64 bits, td::uint64 cells) { +td::RefInt256 PrecompiledSmartContract::get_simple_forward_fee(ion::WorkchainId wc, td::uint64 bits, td::uint64 cells) { if (bits >= (1ULL << 63) || cells >= (1ULL << 63)) { throw VmError{Excno::range_chk}; } @@ -133,7 +133,7 @@ td::RefInt256 PrecompiledSmartContract::get_simple_forward_fee(ton::WorkchainId td::rshift(td::make_refint(prices.bit_price) * bits + td::make_refint(prices.cell_price) * cells, 16, 1)); } -td::RefInt256 PrecompiledSmartContract::get_original_fwd_fee(ton::WorkchainId wc, const td::RefInt256 &x) { +td::RefInt256 PrecompiledSmartContract::get_original_fwd_fee(ion::WorkchainId wc, const td::RefInt256 &x) { if (x->sgn() < 0) { throw VmError{Excno::range_chk, "fwd_fee is negative"}; } diff --git a/crypto/block/precompiled-smc/PrecompiledSmartContract.h b/crypto/block/precompiled-smc/PrecompiledSmartContract.h index 509ebf793..8cbc502fd 100644 --- a/crypto/block/precompiled-smc/PrecompiledSmartContract.h +++ b/crypto/block/precompiled-smc/PrecompiledSmartContract.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #pragma once #include "common/refcnt.hpp" @@ -24,7 +24,7 @@ #include #include "tl/tlblib.hpp" #include "td/utils/bits.h" -#include "ton/ton-types.h" +#include "ion/ion-types.h" #include "block/block.h" #include "block/mc-config.h" @@ -74,7 +74,7 @@ class PrecompiledSmartContract { return 6; } - Result run(td::Ref my_address, ton::UnixTime now, ton::LogicalTime cur_lt, CurrencyCollection balance, + Result run(td::Ref my_address, ion::UnixTime now, ion::LogicalTime cur_lt, CurrencyCollection balance, td::Ref c4, vm::CellSlice msg_body, td::Ref msg, CurrencyCollection msg_balance, bool is_external, std::vector> libraries, int global_version, td::uint16 max_data_depth, td::Ref my_code, td::Ref unpacked_config, td::RefInt256 due_payment, td::uint64 precompiled_gas_usage); @@ -88,8 +88,8 @@ class PrecompiledSmartContract { protected: td::Ref my_address_; - ton::UnixTime now_; - ton::LogicalTime cur_lt_; + ion::UnixTime now_; + ion::LogicalTime cur_lt_; CurrencyCollection balance_; vm::CellSlice in_msg_body_; td::Ref in_msg_; @@ -106,12 +106,12 @@ class PrecompiledSmartContract { void send_raw_message(const td::Ref& msg, int mode); void raw_reserve(const td::RefInt256& amount, int mode); - td::RefInt256 get_compute_fee(ton::WorkchainId wc, td::uint64 gas_used); - td::RefInt256 get_forward_fee(ton::WorkchainId wc, td::uint64 bits, td::uint64 cells); - td::RefInt256 get_storage_fee(ton::WorkchainId wc, td::uint64 duration, td::uint64 bits, td::uint64 cells); - td::RefInt256 get_simple_compute_fee(ton::WorkchainId wc, td::uint64 gas_used); - td::RefInt256 get_simple_forward_fee(ton::WorkchainId wc, td::uint64 bits, td::uint64 cells); - td::RefInt256 get_original_fwd_fee(ton::WorkchainId wc, const td::RefInt256& x); + td::RefInt256 get_compute_fee(ion::WorkchainId wc, td::uint64 gas_used); + td::RefInt256 get_forward_fee(ion::WorkchainId wc, td::uint64 bits, td::uint64 cells); + td::RefInt256 get_storage_fee(ion::WorkchainId wc, td::uint64 duration, td::uint64 bits, td::uint64 cells); + td::RefInt256 get_simple_compute_fee(ion::WorkchainId wc, td::uint64 gas_used); + td::RefInt256 get_simple_forward_fee(ion::WorkchainId wc, td::uint64 bits, td::uint64 cells); + td::RefInt256 get_original_fwd_fee(ion::WorkchainId wc, const td::RefInt256& x); virtual Result do_run() = 0; }; diff --git a/crypto/block/precompiled-smc/common.h b/crypto/block/precompiled-smc/common.h index 0406d7dee..67b590c51 100644 --- a/crypto/block/precompiled-smc/common.h +++ b/crypto/block/precompiled-smc/common.h @@ -1,21 +1,21 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #pragma once #include "PrecompiledSmartContract.h" #include "vm/arithops.h" #include "vm/cellops.h" -#include "vm/tonops.h" \ No newline at end of file +#include "vm/ionops.h" \ No newline at end of file diff --git a/crypto/block/test-block.cpp b/crypto/block/test-block.cpp index 6e10ebe9a..1691a1e41 100644 --- a/crypto/block/test-block.cpp +++ b/crypto/block/test-block.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -64,7 +64,7 @@ td::Ref load_boc(std::string filename) { } void test1() { - block::ShardId id{ton::masterchainId}, id2{ton::basechainId, 0x11efULL << 48}; + block::ShardId id{ion::masterchainId}, id2{ion::basechainId, 0x11efULL << 48}; std::cout << '[' << id << "][" << id2 << ']' << std::endl; vm::CellBuilder cb; cb << id << id2; diff --git a/crypto/block/test-weight-distr.cpp b/crypto/block/test-weight-distr.cpp index a94b791cd..435cc70c8 100644 --- a/crypto/block/test-weight-distr.cpp +++ b/crypto/block/test-weight-distr.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. diff --git a/crypto/block/transaction.cpp b/crypto/block/transaction.cpp index a32bad52f..7a62fc677 100644 --- a/crypto/block/transaction.cpp +++ b/crypto/block/transaction.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -23,7 +23,7 @@ #include "crypto/openssl/rand.hpp" #include "td/utils/bits.h" #include "td/utils/uint128.h" -#include "ton/ton-shard.h" +#include "ion/ion-shard.h" #include "vm/vm.h" #include "td/utils/Timer.h" @@ -108,7 +108,7 @@ Ref ComputePhaseConfig::lookup_library(td::ConstBitPtr key) const { * * @returns True if the address was successfully set, false otherwise. */ -bool Account::set_address(ton::WorkchainId wc, td::ConstBitPtr new_addr) { +bool Account::set_address(ion::WorkchainId wc, td::ConstBitPtr new_addr) { workchain = wc; addr = new_addr; return true; @@ -193,7 +193,7 @@ bool Account::store_maybe_anycast(vm::CellBuilder& cb) const { */ bool Account::unpack_address(vm::CellSlice& addr_cs) { int addr_tag = block::gen::t_MsgAddressInt.get_tag(addr_cs); - int new_wc = ton::workchainInvalid; + int new_wc = ion::workchainInvalid; switch (addr_tag) { case block::gen::MsgAddressInt::addr_std: if (!(addr_cs.advance(2) && parse_maybe_anycast(addr_cs) && addr_cs.fetch_int_to(8, new_wc) && @@ -208,15 +208,15 @@ bool Account::unpack_address(vm::CellSlice& addr_cs) { return false; } addr_cs.clear(); - if (new_wc == ton::workchainInvalid) { + if (new_wc == ion::workchainInvalid) { return false; } - if (workchain == ton::workchainInvalid) { + if (workchain == ion::workchainInvalid) { workchain = new_wc; addr = addr_orig; addr.bits().copy_from(addr_rewrite.cbits(), split_depth_); } else if (split_depth_) { - ton::StdSmcAddress new_addr = addr_orig; + ion::StdSmcAddress new_addr = addr_orig; new_addr.bits().copy_from(addr_rewrite.cbits(), split_depth_); if (new_addr != addr) { LOG(ERROR) << "error unpacking account " << workchain << ":" << addr.to_hex() @@ -324,7 +324,7 @@ bool Account::compute_my_addr(bool force) { if (!force && my_addr.not_null() && my_addr_exact.not_null()) { return true; } - if (workchain == ton::workchainInvalid) { + if (workchain == ion::workchainInvalid) { my_addr.clear(); return false; } @@ -439,7 +439,7 @@ bool Account::init_rewrite_addr(int split_depth, td::ConstBitPtr orig_addr_rewri * * @returns True if the unpacking is successful, false otherwise. */ -bool Account::unpack(Ref shard_account, ton::UnixTime now, bool special) { +bool Account::unpack(Ref shard_account, ion::UnixTime now, bool special) { LOG(DEBUG) << "unpacking " << (special ? "special " : "") << "account " << addr.to_hex(); if (shard_account.is_null()) { LOG(ERROR) << "account " << addr.to_hex() << " does not have a valid ShardAccount to unpack"; @@ -514,9 +514,9 @@ bool Account::unpack(Ref shard_account, ton::UnixTime now, bool s * * @returns True if the initialization is successful, false otherwise. */ -bool Account::init_new(ton::UnixTime now) { +bool Account::init_new(ion::UnixTime now) { // only workchain and addr are initialized at this point - if (workchain == ton::workchainInvalid) { + if (workchain == ion::workchainInvalid) { return false; } addr_orig = addr; @@ -605,8 +605,8 @@ bool Account::deactivate() { * * @returns True if the account belongs to the shard, False otherwise. */ -bool Account::belongs_to_shard(ton::ShardIdFull shard) const { - return workchain == shard.workchain && ton::shard_is_ancestor(shard.shard, addr); +bool Account::belongs_to_shard(ion::ShardIdFull shard) const { + return workchain == shard.workchain && ion::shard_is_ancestor(shard.shard, addr); } /** @@ -618,7 +618,7 @@ bool Account::belongs_to_shard(ton::ShardIdFull shard) const { * @param storage Account storage statistics. * @param is_mc A flag indicating whether the account is in the masterchain. */ -void add_partial_storage_payment(td::BigInt256& payment, ton::UnixTime delta, const block::StoragePrices& prices, +void add_partial_storage_payment(td::BigInt256& payment, ion::UnixTime delta, const block::StoragePrices& prices, const vm::CellStorageStat& storage, bool is_mc) { td::BigInt256 c{(long long)storage.cells}, b{(long long)storage.bits}; if (is_mc) { @@ -648,8 +648,8 @@ void add_partial_storage_payment(td::BigInt256& payment, ton::UnixTime delta, co * * @returns The computed storage fees as RefInt256. */ -td::RefInt256 StoragePrices::compute_storage_fees(ton::UnixTime now, const std::vector& pricing, - const vm::CellStorageStat& storage_stat, ton::UnixTime last_paid, +td::RefInt256 StoragePrices::compute_storage_fees(ion::UnixTime now, const std::vector& pricing, + const vm::CellStorageStat& storage_stat, ion::UnixTime last_paid, bool is_special, bool is_masterchain) { if (now <= last_paid || !last_paid || is_special || pricing.empty() || now <= pricing[0].valid_since) { return td::zero_refint(); @@ -661,10 +661,10 @@ td::RefInt256 StoragePrices::compute_storage_fees(ton::UnixTime now, const std:: if (i) { --i; } - ton::UnixTime upto = std::max(last_paid, pricing[0].valid_since); + ion::UnixTime upto = std::max(last_paid, pricing[0].valid_since); td::RefInt256 total{true, 0}; for (; i < n && upto < now; i++) { - ton::UnixTime valid_until = (i < n - 1 ? std::min(now, pricing[i + 1].valid_since) : now); + ion::UnixTime valid_until = (i < n - 1 ? std::min(now, pricing[i + 1].valid_since) : now); if (upto < valid_until) { assert(upto >= pricing[i].valid_since); add_partial_storage_payment(total.unique_write(), valid_until - upto, pricing[i], storage_stat, is_masterchain); @@ -682,7 +682,7 @@ td::RefInt256 StoragePrices::compute_storage_fees(ton::UnixTime now, const std:: * * @returns The computed storage fees as RefInt256. */ -td::RefInt256 Account::compute_storage_fees(ton::UnixTime now, const std::vector& pricing) const { +td::RefInt256 Account::compute_storage_fees(ion::UnixTime now, const std::vector& pricing) const { return StoragePrices::compute_storage_fees(now, pricing, storage_stat, last_paid, is_special, is_masterchain()); } @@ -698,7 +698,7 @@ namespace transaction { * * @returns None */ -Transaction::Transaction(const Account& _account, int ttype, ton::LogicalTime req_start_lt, ton::UnixTime _now, +Transaction::Transaction(const Account& _account, int ttype, ion::LogicalTime req_start_lt, ion::UnixTime _now, Ref _inmsg) : trans_type(ttype) , is_first(_account.transactions.empty()) @@ -863,11 +863,11 @@ bool Transaction::unpack_input_msg(bool ihr_delivered, const ActionPhaseConfig* return false; } total_fees += in_fwd_fee; - if (account.workchain == ton::masterchainId && cfg->mc_blackhole_addr && + if (account.workchain == ion::masterchainId && cfg->mc_blackhole_addr && cfg->mc_blackhole_addr.value() == account.addr) { blackhole_burned.grams = msg_balance_remaining.grams; msg_balance_remaining.grams = td::zero_refint(); - LOG(DEBUG) << "Burning " << blackhole_burned.grams << " nanoton (blackhole address)"; + LOG(DEBUG) << "Burning " << blackhole_burned.grams << " nanoion (blackhole address)"; } return true; } @@ -1066,7 +1066,7 @@ bool ComputePhaseConfig::parse_GasLimitsPrices_internal(Ref cs, t * * @returns True if the address is suspended, False otherwise. */ -bool ComputePhaseConfig::is_address_suspended(ton::WorkchainId wc, td::Bits256 addr) const { +bool ComputePhaseConfig::is_address_suspended(ion::WorkchainId wc, td::Bits256 addr) const { if (!suspended_addresses) { return false; } @@ -1162,12 +1162,12 @@ namespace transaction { * * @returns True if gas_limit override is required, false otherwise */ -static bool override_gas_limit(const ComputePhaseConfig& cfg, ton::UnixTime now, const Account& account) { +static bool override_gas_limit(const ComputePhaseConfig& cfg, ion::UnixTime now, const Account& account) { if (!cfg.special_gas_full) { return false; } - ton::UnixTime until = 1709164800; // 2024-02-29 00:00:00 UTC - ton::WorkchainId wc = 0; + ion::UnixTime until = 1709164800; // 2024-02-29 00:00:00 UTC + ion::WorkchainId wc = 0; const char* addr_hex = "FFBFD8F5AE5B2E1C7C3614885CB02145483DFAEE575F0DD08A72C366369211CD"; return now < until && account.workchain == wc && account.addr.to_hex() == addr_hex; } @@ -2019,7 +2019,7 @@ int Transaction::try_action_change_library(vm::CellSlice& cs, ActionPhase& ap, c return -1; } Ref lib_ref = rec.libref->prefetch_ref(); - ton::Bits256 hash; + ion::Bits256 hash; if (lib_ref.not_null()) { hash = lib_ref->get_hash().bits(); } else { @@ -2236,7 +2236,7 @@ bool Transaction::check_rewrite_dest_addr(Ref& dest_addr, const A LOG(DEBUG) << "destination address does not have a MsgAddressInt tag"; return false; } - if (rec.workchain_id != ton::masterchainId) { + if (rec.workchain_id != ion::masterchainId) { // recover destination workchain info from configuration auto it = cfg.workchains->find(rec.workchain_id); if (it == cfg.workchains->end()) { @@ -2276,7 +2276,7 @@ bool Transaction::check_rewrite_dest_addr(Ref& dest_addr, const A } } if (is_mc) { - *is_mc = (rec.workchain_id == ton::masterchainId); + *is_mc = (rec.workchain_id == ion::masterchainId); } if (!repack) { return true; @@ -3603,7 +3603,7 @@ void Transaction::extract_out_msgs(std::vector& list) { * @param trans_root The root of the transaction cell. * @param trans_lt The logical time of the transaction. */ -void Account::push_transaction(Ref trans_root, ton::LogicalTime trans_lt) { +void Account::push_transaction(Ref trans_root, ion::LogicalTime trans_lt) { transactions.emplace_back(trans_lt, std::move(trans_root)); } @@ -3676,7 +3676,7 @@ td::Status FetchConfigParams::fetch_config_params( const block::ConfigInfo& config, Ref* old_mparams, std::vector* storage_prices, StoragePhaseConfig* storage_phase_cfg, td::BitArray<256>* rand_seed, ComputePhaseConfig* compute_phase_cfg, ActionPhaseConfig* action_phase_cfg, td::RefInt256* masterchain_create_fee, td::RefInt256* basechain_create_fee, - ton::WorkchainId wc, ton::UnixTime now) { + ion::WorkchainId wc, ion::UnixTime now) { auto prev_blocks_info = config.get_prev_blocks_info(); if (prev_blocks_info.is_error()) { return prev_blocks_info.move_as_error_prefix( @@ -3707,8 +3707,8 @@ td::Status FetchConfigParams::fetch_config_params( const block::Config& config, td::Ref prev_blocks_info, Ref* old_mparams, std::vector* storage_prices, StoragePhaseConfig* storage_phase_cfg, td::BitArray<256>* rand_seed, ComputePhaseConfig* compute_phase_cfg, ActionPhaseConfig* action_phase_cfg, - td::RefInt256* masterchain_create_fee, td::RefInt256* basechain_create_fee, ton::WorkchainId wc, - ton::UnixTime now) { + td::RefInt256* masterchain_create_fee, td::RefInt256* basechain_create_fee, ion::WorkchainId wc, + ion::UnixTime now) { *old_mparams = config.get_config_param(9); { auto res = config.get_storage_prices(); @@ -3725,7 +3725,7 @@ td::Status FetchConfigParams::fetch_config_params( TRY_RESULT(size_limits, config.get_size_limits_config()); { // compute compute_phase_cfg / storage_phase_cfg - auto cell = config.get_config_param(wc == ton::masterchainId ? 20 : 21); + auto cell = config.get_config_param(wc == ion::masterchainId ? 20 : 21); if (cell.is_null()) { return td::Status::Error(-668, "cannot fetch current gas prices and limits from masterchain configuration"); } @@ -3772,7 +3772,7 @@ td::Status FetchConfigParams::fetch_config_params( block::MsgPrices{rec.lump_price, rec.bit_price, rec.cell_price, rec.ihr_price_factor, (unsigned)rec.first_frac, (unsigned)rec.next_frac}; action_phase_cfg->workchains = &config.get_workchain_list(); - action_phase_cfg->bounce_msg_body = (config.has_capability(ton::capBounceMsgBody) ? 256 : 0); + action_phase_cfg->bounce_msg_body = (config.has_capability(ion::capBounceMsgBody) ? 256 : 0); action_phase_cfg->size_limits = size_limits; action_phase_cfg->action_fine_enabled = config.get_global_version() >= 4; action_phase_cfg->bounce_on_fail_enabled = config.get_global_version() >= 4; diff --git a/crypto/block/transaction.h b/crypto/block/transaction.h index 20d7cb291..caee94be1 100644 --- a/crypto/block/transaction.h +++ b/crypto/block/transaction.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -26,14 +26,14 @@ #include #include "tl/tlblib.hpp" #include "td/utils/bits.h" -#include "ton/ton-types.h" +#include "ion/ion-types.h" #include "block/block.h" #include "block/mc-config.h" #include "precompiled-smc/PrecompiledSmartContract.h" namespace block { using td::Ref; -using LtCellRef = std::pair>; +using LtCellRef = std::pair>; struct Account; @@ -63,13 +63,13 @@ struct LtCellCompare { }; struct NewOutMsg { - ton::LogicalTime lt; + ion::LogicalTime lt; Ref msg; Ref trans; unsigned msg_idx; td::optional metadata; td::Ref msg_env_from_dispatch_queue; // Not null if from dispatch queue; in this case lt is emitted_lt - NewOutMsg(ton::LogicalTime _lt, Ref _msg, Ref _trans, unsigned _msg_idx) + NewOutMsg(ion::LogicalTime _lt, Ref _msg, Ref _trans, unsigned _msg_idx) : lt(_lt), msg(std::move(_msg)), trans(std::move(_trans)), msg_idx(_msg_idx) { } bool operator<(const NewOutMsg& other) const& { @@ -96,7 +96,7 @@ struct StoragePhaseConfig { struct StoragePhase { td::RefInt256 fees_collected; td::RefInt256 fees_due; - ton::UnixTime last_paid_updated; + ion::UnixTime last_paid_updated; bool frozen{false}; bool deleted{false}; bool is_special{false}; @@ -150,7 +150,7 @@ struct ComputePhaseConfig { } bool parse_GasLimitsPrices(Ref cs, td::RefInt256& freeze_due_limit, td::RefInt256& delete_due_limit); bool parse_GasLimitsPrices(Ref cell, td::RefInt256& freeze_due_limit, td::RefInt256& delete_due_limit); - bool is_address_suspended(ton::WorkchainId wc, td::Bits256 addr) const; + bool is_address_suspended(ion::WorkchainId wc, td::Bits256 addr) const; private: bool parse_GasLimitsPrices_internal(Ref cs, td::RefInt256& freeze_due_limit, @@ -194,7 +194,7 @@ struct ComputePhase { int exit_code; int exit_arg; int vm_steps; - ton::Bits256 vm_init_state_hash, vm_final_state_hash; + ion::Bits256 vm_init_state_hash, vm_final_state_hash; Ref in_msg; Ref new_data; Ref actions; @@ -225,7 +225,7 @@ struct ActionPhase { block::CurrencyCollection remaining_balance, reserved_balance; std::vector> action_list; // processed in reverse order std::vector> out_msgs; - ton::LogicalTime end_lt; + ion::LogicalTime end_lt; unsigned long long tot_msg_bits{0}, tot_msg_cells{0}; td::RefInt256 action_fine; bool need_bounce_on_fail = false; @@ -249,18 +249,18 @@ struct Account { bool split_depth_set_{false}; unsigned char split_depth_{0}; int verbosity{3 * 0}; - ton::UnixTime now_{0}; - ton::WorkchainId workchain{ton::workchainInvalid}; + ion::UnixTime now_{0}; + ion::WorkchainId workchain{ion::workchainInvalid}; td::BitArray<32> addr_rewrite; // rewrite (anycast) data, split_depth bits - ton::StdSmcAddress addr; // rewritten address (by replacing a prefix of `addr_orig` with `addr_rewrite`); it is the key in ShardAccounts - ton::StdSmcAddress addr_orig; // address indicated in smart-contract data (must coincide with hash of StateInit) + ion::StdSmcAddress addr; // rewritten address (by replacing a prefix of `addr_orig` with `addr_rewrite`); it is the key in ShardAccounts + ion::StdSmcAddress addr_orig; // address indicated in smart-contract data (must coincide with hash of StateInit) Ref my_addr; // address as stored in the smart contract (MsgAddressInt); corresponds to `addr_orig` + anycast info Ref my_addr_exact; // exact address without anycast info; corresponds to `addr` and has no anycast (rewrite) info - ton::LogicalTime last_trans_end_lt_; - ton::LogicalTime last_trans_lt_; - ton::Bits256 last_trans_hash_; - ton::LogicalTime block_lt; - ton::UnixTime last_paid; + ion::LogicalTime last_trans_end_lt_; + ion::LogicalTime last_trans_lt_; + ion::Bits256 last_trans_hash_; + ion::LogicalTime block_lt; + ion::UnixTime last_paid; vm::CellStorageStat storage_stat; block::CurrencyCollection balance; td::RefInt256 due_payment; @@ -268,33 +268,33 @@ struct Account { Ref total_state; // ^Account Ref storage; // AccountStorage Ref inner_state; // StateInit - ton::Bits256 state_hash; // hash of StateInit for frozen accounts + ion::Bits256 state_hash; // hash of StateInit for frozen accounts Ref code, data, library, orig_library; std::vector transactions; Account() = default; - Account(ton::WorkchainId wc, td::ConstBitPtr _addr) : workchain(wc), addr(_addr) { + Account(ion::WorkchainId wc, td::ConstBitPtr _addr) : workchain(wc), addr(_addr) { } - Account(ton::WorkchainId wc, td::ConstBitPtr _addr, int depth) + Account(ion::WorkchainId wc, td::ConstBitPtr _addr, int depth) : split_depth_set_(true), split_depth_((unsigned char)depth), workchain(wc), addr(_addr) { } block::CurrencyCollection get_balance() const { return balance; } - bool set_address(ton::WorkchainId wc, td::ConstBitPtr new_addr); - bool unpack(Ref account, ton::UnixTime now, bool special); - bool init_new(ton::UnixTime now); + bool set_address(ion::WorkchainId wc, td::ConstBitPtr new_addr); + bool unpack(Ref account, ion::UnixTime now, bool special); + bool init_new(ion::UnixTime now); bool deactivate(); bool recompute_tmp_addr(Ref& tmp_addr, int split_depth, td::ConstBitPtr orig_addr_rewrite) const; - td::RefInt256 compute_storage_fees(ton::UnixTime now, const std::vector& pricing) const; + td::RefInt256 compute_storage_fees(ion::UnixTime now, const std::vector& pricing) const; bool is_masterchain() const { - return workchain == ton::masterchainId; + return workchain == ion::masterchainId; } - bool belongs_to_shard(ton::ShardIdFull shard) const; + bool belongs_to_shard(ion::ShardIdFull shard) const; bool store_acc_status(vm::CellBuilder& cb, int status) const; bool store_acc_status(vm::CellBuilder& cb) const { return store_acc_status(cb, status); } - void push_transaction(Ref trans_root, ton::LogicalTime trans_lt); + void push_transaction(Ref trans_root, ion::LogicalTime trans_lt); bool libraries_changed() const; bool create_account_block(vm::CellBuilder& cb); // stores an AccountBlock with all transactions @@ -341,20 +341,20 @@ struct Transaction { bool new_tick; bool new_tock; signed char new_split_depth{-1}; - ton::UnixTime now; + ion::UnixTime now; int acc_status; int verbosity{3 * 0}; int in_msg_type{0}; const Account& account; // only `commit` method modifies the account Ref my_addr, my_addr_exact; // almost the same as in account.* - ton::LogicalTime start_lt, end_lt; + ion::LogicalTime start_lt, end_lt; block::CurrencyCollection balance, original_balance; block::CurrencyCollection msg_balance_remaining; td::RefInt256 due_payment; td::RefInt256 in_fwd_fee, msg_fwd_fees; block::CurrencyCollection total_fees{0}; block::CurrencyCollection blackhole_burned{0}; - ton::UnixTime last_paid; + ion::UnixTime last_paid; Ref root; Ref new_total_state; Ref new_storage; @@ -373,7 +373,7 @@ struct Transaction { std::unique_ptr bounce_phase; vm::CellStorageStat new_storage_stat; bool gas_limit_overridden{false}; - Transaction(const Account& _account, int ttype, ton::LogicalTime req_start_lt, ton::UnixTime _now, + Transaction(const Account& _account, int ttype, ion::LogicalTime req_start_lt, ion::UnixTime _now, Ref _inmsg = {}); bool unpack_input_msg(bool ihr_delivered, const ActionPhaseConfig* cfg); bool check_in_msg_state_hash(); @@ -428,13 +428,13 @@ struct FetchConfigParams { StoragePhaseConfig* storage_phase_cfg, td::BitArray<256>* rand_seed, ComputePhaseConfig* compute_phase_cfg, ActionPhaseConfig* action_phase_cfg, td::RefInt256* masterchain_create_fee, td::RefInt256* basechain_create_fee, - ton::WorkchainId wc, ton::UnixTime now); + ion::WorkchainId wc, ion::UnixTime now); static td::Status fetch_config_params(const block::Config& config, Ref prev_blocks_info, Ref* old_mparams, std::vector* storage_prices, StoragePhaseConfig* storage_phase_cfg, td::BitArray<256>* rand_seed, ComputePhaseConfig* compute_phase_cfg, ActionPhaseConfig* action_phase_cfg, td::RefInt256* masterchain_create_fee, td::RefInt256* basechain_create_fee, - ton::WorkchainId wc, ton::UnixTime now); + ion::WorkchainId wc, ion::UnixTime now); }; } // namespace block diff --git a/crypto/common/AtomicRef.h b/crypto/common/AtomicRef.h index e82bcda49..6f3091061 100644 --- a/crypto/common/AtomicRef.h +++ b/crypto/common/AtomicRef.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/common/bigexp.cpp b/crypto/common/bigexp.cpp index 365f0595b..8bbfcf24b 100644 --- a/crypto/common/bigexp.cpp +++ b/crypto/common/bigexp.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/common/bigexp.h b/crypto/common/bigexp.h index 54dee48aa..fe0dc7290 100644 --- a/crypto/common/bigexp.h +++ b/crypto/common/bigexp.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/common/bigint.cpp b/crypto/common/bigint.cpp index 41780fb9b..82644158a 100644 --- a/crypto/common/bigint.cpp +++ b/crypto/common/bigint.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/common/bigint.hpp b/crypto/common/bigint.hpp index 4061f82d3..43da90b31 100644 --- a/crypto/common/bigint.hpp +++ b/crypto/common/bigint.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/common/bitstring.cpp b/crypto/common/bitstring.cpp index 52e57c9a8..63f7f88a1 100644 --- a/crypto/common/bitstring.cpp +++ b/crypto/common/bitstring.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/common/bitstring.h b/crypto/common/bitstring.h index 257764788..a9030366a 100644 --- a/crypto/common/bitstring.h +++ b/crypto/common/bitstring.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/common/linalloc.hpp b/crypto/common/linalloc.hpp index da2ed05b0..4b912fd21 100644 --- a/crypto/common/linalloc.hpp +++ b/crypto/common/linalloc.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2020 Telegram Systems LLP */ diff --git a/crypto/common/promiseop.hpp b/crypto/common/promiseop.hpp index 1e14bc7d7..9b5865d63 100644 --- a/crypto/common/promiseop.hpp +++ b/crypto/common/promiseop.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2020 Telegram Systems LLP */ diff --git a/crypto/common/refcnt.cpp b/crypto/common/refcnt.cpp index c6d1b8884..1ac240463 100644 --- a/crypto/common/refcnt.cpp +++ b/crypto/common/refcnt.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/common/refcnt.hpp b/crypto/common/refcnt.hpp index 953cc7797..776a1cbb7 100644 --- a/crypto/common/refcnt.hpp +++ b/crypto/common/refcnt.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/common/refint.cpp b/crypto/common/refint.cpp index a2ccdaa69..c10def286 100644 --- a/crypto/common/refint.cpp +++ b/crypto/common/refint.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/common/refint.h b/crypto/common/refint.h index e3305c2f9..83b956c7c 100644 --- a/crypto/common/refint.h +++ b/crypto/common/refint.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/common/util.cpp b/crypto/common/util.cpp index d1b24a76b..e08c07294 100644 --- a/crypto/common/util.cpp +++ b/crypto/common/util.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/common/util.h b/crypto/common/util.h index c56677b6a..268b12761 100644 --- a/crypto/common/util.h +++ b/crypto/common/util.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/ellcurve/Ed25519.cpp b/crypto/ellcurve/Ed25519.cpp index a38eb079e..d33efa434 100644 --- a/crypto/ellcurve/Ed25519.cpp +++ b/crypto/ellcurve/Ed25519.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/ellcurve/Ed25519.h b/crypto/ellcurve/Ed25519.h index 4b9e6348f..e22f3c3aa 100644 --- a/crypto/ellcurve/Ed25519.h +++ b/crypto/ellcurve/Ed25519.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/ellcurve/Fp25519.cpp b/crypto/ellcurve/Fp25519.cpp index 7b248f64a..91a749241 100644 --- a/crypto/ellcurve/Fp25519.cpp +++ b/crypto/ellcurve/Fp25519.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/ellcurve/Fp25519.h b/crypto/ellcurve/Fp25519.h index b6b63be5e..e9297e548 100644 --- a/crypto/ellcurve/Fp25519.h +++ b/crypto/ellcurve/Fp25519.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/ellcurve/Montgomery.cpp b/crypto/ellcurve/Montgomery.cpp index ed71910d5..576bb6bf3 100644 --- a/crypto/ellcurve/Montgomery.cpp +++ b/crypto/ellcurve/Montgomery.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/ellcurve/Montgomery.h b/crypto/ellcurve/Montgomery.h index 94d852c06..b2b9a2660 100644 --- a/crypto/ellcurve/Montgomery.h +++ b/crypto/ellcurve/Montgomery.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/ellcurve/TwEdwards.cpp b/crypto/ellcurve/TwEdwards.cpp index eb131f702..54747e5ac 100644 --- a/crypto/ellcurve/TwEdwards.cpp +++ b/crypto/ellcurve/TwEdwards.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/ellcurve/TwEdwards.h b/crypto/ellcurve/TwEdwards.h index c720ecca9..425d4e69c 100644 --- a/crypto/ellcurve/TwEdwards.h +++ b/crypto/ellcurve/TwEdwards.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/ellcurve/p256.cpp b/crypto/ellcurve/p256.cpp index de5393723..78857dd73 100644 --- a/crypto/ellcurve/p256.cpp +++ b/crypto/ellcurve/p256.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #include "p256.h" diff --git a/crypto/ellcurve/p256.h b/crypto/ellcurve/p256.h index 22d08be43..bff2477c8 100644 --- a/crypto/ellcurve/p256.h +++ b/crypto/ellcurve/p256.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #pragma once diff --git a/crypto/ellcurve/secp256k1.cpp b/crypto/ellcurve/secp256k1.cpp index e890117a4..2bcf2ad36 100644 --- a/crypto/ellcurve/secp256k1.cpp +++ b/crypto/ellcurve/secp256k1.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #include "secp256k1.h" diff --git a/crypto/ellcurve/secp256k1.h b/crypto/ellcurve/secp256k1.h index 80ab6a873..bafb23c98 100644 --- a/crypto/ellcurve/secp256k1.h +++ b/crypto/ellcurve/secp256k1.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #pragma once diff --git a/crypto/fift/Continuation.cpp b/crypto/fift/Continuation.cpp index e895082fd..17e489537 100644 --- a/crypto/fift/Continuation.cpp +++ b/crypto/fift/Continuation.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2020 Telegram Systems LLP */ diff --git a/crypto/fift/Continuation.h b/crypto/fift/Continuation.h index 6623b6427..f68efecac 100644 --- a/crypto/fift/Continuation.h +++ b/crypto/fift/Continuation.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2020 Telegram Systems LLP */ diff --git a/crypto/fift/Dictionary.cpp b/crypto/fift/Dictionary.cpp index d2eae0a31..cbe371de4 100644 --- a/crypto/fift/Dictionary.cpp +++ b/crypto/fift/Dictionary.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/fift/Dictionary.h b/crypto/fift/Dictionary.h index b24bc7426..896a96f35 100644 --- a/crypto/fift/Dictionary.h +++ b/crypto/fift/Dictionary.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/fift/Fift.cpp b/crypto/fift/Fift.cpp index e0faca57c..c11a20095 100644 --- a/crypto/fift/Fift.cpp +++ b/crypto/fift/Fift.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/fift/Fift.h b/crypto/fift/Fift.h index a17727993..3ba45360a 100644 --- a/crypto/fift/Fift.h +++ b/crypto/fift/Fift.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/fift/HashMap.cpp b/crypto/fift/HashMap.cpp index a4ca0e9b3..da4cce91f 100644 --- a/crypto/fift/HashMap.cpp +++ b/crypto/fift/HashMap.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #include "HashMap.h" #include "td/utils/Random.h" diff --git a/crypto/fift/HashMap.h b/crypto/fift/HashMap.h index d3d9ffbef..00216ec9d 100644 --- a/crypto/fift/HashMap.h +++ b/crypto/fift/HashMap.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #pragma once #include "common/refcnt.hpp" diff --git a/crypto/fift/IntCtx.cpp b/crypto/fift/IntCtx.cpp index 2cac88491..aaf0f7759 100644 --- a/crypto/fift/IntCtx.cpp +++ b/crypto/fift/IntCtx.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/fift/IntCtx.h b/crypto/fift/IntCtx.h index 5d574ae5f..0c1f9d7c7 100644 --- a/crypto/fift/IntCtx.h +++ b/crypto/fift/IntCtx.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -152,7 +152,7 @@ struct IntCtx { std::ostream* output_stream{nullptr}; // move to OutCtx? std::ostream* error_stream{nullptr}; - vm::TonDb* ton_db{nullptr}; + vm::TonDb* ion_db{nullptr}; SourceLookup* source_lookup{nullptr}; int* now{nullptr}; diff --git a/crypto/fift/SourceLookup.cpp b/crypto/fift/SourceLookup.cpp index cd80e3140..055022301 100644 --- a/crypto/fift/SourceLookup.cpp +++ b/crypto/fift/SourceLookup.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/fift/SourceLookup.h b/crypto/fift/SourceLookup.h index 816ad6679..7b2620dc6 100644 --- a/crypto/fift/SourceLookup.h +++ b/crypto/fift/SourceLookup.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/fift/fift-main.cpp b/crypto/fift/fift-main.cpp index cdc36fc07..16b2eb4cf 100644 --- a/crypto/fift/fift-main.cpp +++ b/crypto/fift/fift-main.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -153,7 +153,7 @@ int main(int argc, char* const argv[]) { fift::init_words_common(config.dictionary); fift::init_words_vm(config.dictionary, true); // enable vm debug - fift::init_words_ton(config.dictionary); + fift::init_words_ion(config.dictionary); if (script_mode) { fift::import_cmdline_args(config.dictionary, source_list.empty() ? "" : source_list[0], argc - optind, diff --git a/crypto/fift/lib/Asm.fif b/crypto/fift/lib/Asm.fif index 964db4417..1455cec46 100644 --- a/crypto/fift/lib/Asm.fif +++ b/crypto/fift/lib/Asm.fif @@ -695,7 +695,7 @@ x{CF3D} @Defop BCHKBITSQ x{CF3E} @Defop BCHKREFSQ x{CF3F} @Defop BCHKBITREFSQ x{CF40} @Defop STZEROES -x{CF41} @Defop STONES +x{CF41} @Defop SIONES x{CF42} @Defop STSAME { tuck sbitrefs swap 22 + swap @havebitrefs not { swap PUSHSLICE STSLICER } @@ -706,7 +706,7 @@ x{CF42} @Defop STSAME } cond } : STSLICECONST x{CF81} @Defop STZERO -x{CF83} @Defop STONE +x{CF83} @Defop SIONE // cell deserialization (CellSlice primitives) x{D0} @Defop CTOS diff --git a/crypto/fift/lib/Color.fif b/crypto/fift/lib/Color.fif index bd8ed7af6..2072a6165 100644 --- a/crypto/fift/lib/Color.fif +++ b/crypto/fift/lib/Color.fif @@ -1,16 +1,22 @@ library Color { 27 emit } : esc - { char " word 27 chr swap $+ 1 ' type does create } :_ make-esc" - make-esc"[0m" ^reset - make-esc"[30m" ^black - make-esc"[31m" ^red - make-esc"[32m" ^green + +{ char " word 27 chr swap $+ 1 ' type does create } :_ make-esc" + +make-esc"[0m" ^reset + +make-esc"[30m" ^black + +make-esc"[31m" ^red + +make-esc"[32m" ^green make-esc"[33m" ^yellow make-esc"[34m" ^blue make-esc"[35m" ^magenta make-esc"[36m" ^cyan make-esc"[37m" ^white - // bold + +// bold make-esc"[30;1m" ^Black make-esc"[31;1m" ^Red make-esc"[32;1m" ^Green diff --git a/crypto/fift/lib/TonUtil.fif b/crypto/fift/lib/TonUtil.fif index f31b591eb..c995e5952 100644 --- a/crypto/fift/lib/TonUtil.fif +++ b/crypto/fift/lib/TonUtil.fif @@ -1,4 +1,4 @@ -library TonUtil // TON Blockchain Fift Library +library TonUtil // ION Blockchain Fift Library "Lists.fif" include -1 constant Masterchain diff --git a/crypto/fift/utils.cpp b/crypto/fift/utils.cpp index 6057b2dc0..65ce358ca 100644 --- a/crypto/fift/utils.cpp +++ b/crypto/fift/utils.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -115,7 +115,7 @@ class MemoryFileLoader : public fift::FileLoader { }; td::Result create_source_lookup(std::string&& main, bool need_preamble = true, bool need_asm = true, - bool need_ton_util = true, bool need_lisp = true, + bool need_ion_util = true, bool need_lisp = true, bool need_w3_code = true, bool need_fift_ext = true, bool need_disasm = true, std::string dir = "") { auto loader = std::make_unique(); @@ -128,7 +128,7 @@ td::Result create_source_lookup(std::string&& main, bool nee TRY_RESULT(f, load_Asm_fif(dir)); loader->add_file("/Asm.fif", std::move(f)); } - if (need_ton_util) { + if (need_ion_util) { { TRY_RESULT(f, load_Lists_fif(dir)); loader->add_file("/Lists.fif", std::move(f)); @@ -169,7 +169,7 @@ td::Result run_fift(fift::SourceLookup source_lookup, std::o config.source_lookup = std::move(source_lookup); fift::init_words_common(config.dictionary); fift::init_words_vm(config.dictionary); - fift::init_words_ton(config.dictionary); + fift::init_words_ion(config.dictionary); config.error_stream = stream; config.output_stream = stream; if (args.size() != 0) { @@ -205,9 +205,9 @@ td::Result mem_run_fift(SourceLookup source_lookup, std::vector create_mem_source_lookup(std::string main, std::string fift_dir, bool need_preamble, - bool need_asm, bool need_ton_util, bool need_lisp, + bool need_asm, bool need_ion_util, bool need_lisp, bool need_w3_code) { - return create_source_lookup(std::move(main), need_preamble, need_asm, need_ton_util, need_lisp, need_w3_code, false, false, + return create_source_lookup(std::move(main), need_preamble, need_asm, need_ion_util, need_lisp, need_w3_code, false, false, fift_dir); } diff --git a/crypto/fift/utils.h b/crypto/fift/utils.h index fab92c542..4d864afac 100644 --- a/crypto/fift/utils.h +++ b/crypto/fift/utils.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -37,7 +37,7 @@ struct CompiledProgramOutput { td::Result create_mem_source_lookup(std::string main, std::string fift_dir = "", bool need_preamble = true, bool need_asm = true, - bool need_ton_util = true, bool need_lisp = true, + bool need_ion_util = true, bool need_lisp = true, bool need_w3_code = true); td::Result mem_run_fift(std::string source, std::vector args = {}, std::string fift_dir = ""); td::Result mem_run_fift(SourceLookup source_lookup, std::vector args); diff --git a/crypto/fift/words.cpp b/crypto/fift/words.cpp index cbe1dbcad..a72b09ecb 100644 --- a/crypto/fift/words.cpp +++ b/crypto/fift/words.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -2665,7 +2665,7 @@ void interpret_run_vm(IntCtx& ctx, int mode) { bool with_data = mode & 4; Ref c7; Ref data, actions; - int global_version = (mode & 1024) ? ctx.stack.pop_smallint_range(ton::SUPPORTED_VERSION) : ton::SUPPORTED_VERSION; + int global_version = (mode & 1024) ? ctx.stack.pop_smallint_range(ion::SUPPORTED_VERSION) : ion::SUPPORTED_VERSION; long long gas_max = (mode & 128) ? ctx.stack.pop_long_range(vm::GasLimits::infty) : vm::GasLimits::infty; long long gas_limit = (mode & 8) ? ctx.stack.pop_long_range(vm::GasLimits::infty) : vm::GasLimits::infty; if (!(mode & 128)) { @@ -3390,7 +3390,7 @@ void init_words_common(Dictionary& d) { d.def_ctx_tail_word("$() ", interpret_get_cmdline_arg); } -void init_words_ton(Dictionary& d) { +void init_words_ion(Dictionary& d) { using namespace std::placeholders; d.def_stack_word("smca>$ ", interpret_pack_std_smc_addr); d.def_stack_word("$>smca ", interpret_unpack_std_smc_addr); diff --git a/crypto/fift/words.h b/crypto/fift/words.h index 65466b70c..276c144d4 100644 --- a/crypto/fift/words.h +++ b/crypto/fift/words.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -23,7 +23,7 @@ namespace fift { void init_words_common(Dictionary& dictionary); void init_words_vm(Dictionary& dictionary, bool debug_enabled = false); -void init_words_ton(Dictionary& dictionary); +void init_words_ion(Dictionary& dictionary); void import_cmdline_args(Dictionary& d, std::string arg0, int n, const char* const argv[]); diff --git a/crypto/func/abscode.cpp b/crypto/func/abscode.cpp index f1ffcfa49..2858d64fa 100644 --- a/crypto/func/abscode.cpp +++ b/crypto/func/abscode.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/func/analyzer.cpp b/crypto/func/analyzer.cpp index 9d59cf9ad..e8c7780dc 100644 --- a/crypto/func/analyzer.cpp +++ b/crypto/func/analyzer.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/func/asmops.cpp b/crypto/func/asmops.cpp index 71ee58f68..6af410485 100644 --- a/crypto/func/asmops.cpp +++ b/crypto/func/asmops.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/func/auto-tests/legacy_tester.py b/crypto/func/auto-tests/legacy_tester.py index 9a9905012..c388daf9b 100644 --- a/crypto/func/auto-tests/legacy_tester.py +++ b/crypto/func/auto-tests/legacy_tester.py @@ -29,15 +29,15 @@ ["storage/storage-contract.fc", 91377830060355733016937375216020277778264560226873154627574229667513068328151], ["storage/storage-provider.fc", 13618336676213331164384407184540461509022654507176709588621016553953760588122], ["nominator-pool/pool.fc", 69767057279163099864792356875696330339149706521019810113334238732928422055375], - ["jetton-minter/jetton-minter.fc", 9028309926287301331466371999814928201427184114165428257502393474125007156494], + ["jetion-minter/jetion-minter.fc", 9028309926287301331466371999814928201427184114165428257502393474125007156494], ["gg-marketplace/nft-marketplace-v2.fc", 92199806964112524639740773542356508485601908152150843819273107618799016205930], - ["jetton-wallet/jetton-wallet.fc", 86251125787443633057458168028617933212663498001665054651523310772884328206542], + ["jetion-wallet/jetion-wallet.fc", 86251125787443633057458168028617933212663498001665054651523310772884328206542], ["whales-nominators/nominators.fc", 8941364499854379927692172316865293429893094891593442801401542636695127885153], ["tact-examples/treasure_Treasure.code.fc", 13962538639825790677138656603323869918938565499584297120566680287245364723897], - ["tact-examples/jetton_SampleJetton.code.fc", 94076762218493729104783735200107713211245710256802265203823917715299139499110], - ["tact-examples/jetton_JettonDefaultWallet.code.fc", 29421313492520031238091587108198906058157443241743283101866538036369069620563], + ["tact-examples/jetion_SampleJetion.code.fc", 94076762218493729104783735200107713211245710256802265203823917715299139499110], + ["tact-examples/jetion_JetionDefaultWallet.code.fc", 29421313492520031238091587108198906058157443241743283101866538036369069620563], ["tact-examples/maps_MapTestContract.code.fc", 22556550222249123835909180266811414538971143565993192846012583552876721649744], ] diff --git a/crypto/func/auto-tests/legacy_tests.json b/crypto/func/auto-tests/legacy_tests.json index 61a433bb7..6336d3020 100644 --- a/crypto/func/auto-tests/legacy_tests.json +++ b/crypto/func/auto-tests/legacy_tests.json @@ -1 +1 @@ -[["elector/elector-code.fc", "115226404411715505328583639896096915745686314074575650766750648324043316883483"], ["config/config-code.fc", "10913070768607625342121305745084703121685937915388357634624451844356456145601"], ["eth-bridge-multisig/multisig-code.fc", "101509909129354488841890823627011033360100627957439967918234053299675481277954"], ["bsc-bridge-collector/votes-collector.fc", "62190447221288642706570413295807615918589884489514159926097051017036969900417"], ["uni-lock-wallet/uni-lockup-wallet.fc", "61959738324779104851267145467044677651344601417998258530238254441977103654381"], ["nft-collection/nft-collection-editable.fc", "45561997735512210616567774035540357815786262097548276229169737015839077731274"], ["dns-collection/nft-collection.fc", "107999822699841936063083742021519765435859194241091312445235370766165379261859"], ["tele-nft-item/nft-item.fc", "69777543125381987786450436977742010705076866061362104025338034583422166453344"], ["storage/storage-contract.fc", "91377830060355733016937375216020277778264560226873154627574229667513068328151"], ["storage/storage-provider.fc", "13618336676213331164384407184540461509022654507176709588621016553953760588122"], ["nominator-pool/pool.fc", "69767057279163099864792356875696330339149706521019810113334238732928422055375"], ["jetton-minter/jetton-minter.fc", "9028309926287301331466371999814928201427184114165428257502393474125007156494"], ["gg-marketplace/nft-marketplace-v2.fc", "92199806964112524639740773542356508485601908152150843819273107618799016205930"], ["jetton-wallet/jetton-wallet.fc", "86251125787443633057458168028617933212663498001665054651523310772884328206542"], ["whales-nominators/nominators.fc", "8941364499854379927692172316865293429893094891593442801401542636695127885153"], ["tact-examples/treasure_Treasure.code.fc", "13962538639825790677138656603323869918938565499584297120566680287245364723897"], ["tact-examples/jetton_SampleJetton.code.fc", "94076762218493729104783735200107713211245710256802265203823917715299139499110"], ["tact-examples/jetton_JettonDefaultWallet.code.fc", "29421313492520031238091587108198906058157443241743283101866538036369069620563"], ["tact-examples/maps_MapTestContract.code.fc", "22556550222249123835909180266811414538971143565993192846012583552876721649744"]] \ No newline at end of file +[["elector/elector-code.fc", "115226404411715505328583639896096915745686314074575650766750648324043316883483"], ["config/config-code.fc", "10913070768607625342121305745084703121685937915388357634624451844356456145601"], ["eth-bridge-multisig/multisig-code.fc", "101509909129354488841890823627011033360100627957439967918234053299675481277954"], ["bsc-bridge-collector/votes-collector.fc", "62190447221288642706570413295807615918589884489514159926097051017036969900417"], ["uni-lock-wallet/uni-lockup-wallet.fc", "61959738324779104851267145467044677651344601417998258530238254441977103654381"], ["nft-collection/nft-collection-editable.fc", "45561997735512210616567774035540357815786262097548276229169737015839077731274"], ["dns-collection/nft-collection.fc", "107999822699841936063083742021519765435859194241091312445235370766165379261859"], ["tele-nft-item/nft-item.fc", "69777543125381987786450436977742010705076866061362104025338034583422166453344"], ["storage/storage-contract.fc", "91377830060355733016937375216020277778264560226873154627574229667513068328151"], ["storage/storage-provider.fc", "13618336676213331164384407184540461509022654507176709588621016553953760588122"], ["nominator-pool/pool.fc", "69767057279163099864792356875696330339149706521019810113334238732928422055375"], ["jetion-minter/jetion-minter.fc", "9028309926287301331466371999814928201427184114165428257502393474125007156494"], ["gg-marketplace/nft-marketplace-v2.fc", "92199806964112524639740773542356508485601908152150843819273107618799016205930"], ["jetion-wallet/jetion-wallet.fc", "86251125787443633057458168028617933212663498001665054651523310772884328206542"], ["whales-nominators/nominators.fc", "8941364499854379927692172316865293429893094891593442801401542636695127885153"], ["tact-examples/treasure_Treasure.code.fc", "13962538639825790677138656603323869918938565499584297120566680287245364723897"], ["tact-examples/jetion_SampleJetion.code.fc", "94076762218493729104783735200107713211245710256802265203823917715299139499110"], ["tact-examples/jetion_JetionDefaultWallet.code.fc", "29421313492520031238091587108198906058157443241743283101866538036369069620563"], ["tact-examples/maps_MapTestContract.code.fc", "22556550222249123835909180266811414538971143565993192846012583552876721649744"]] \ No newline at end of file diff --git a/crypto/func/auto-tests/legacy_tests/dns-collection/dns-utils.fc b/crypto/func/auto-tests/legacy_tests/dns-collection/dns-utils.fc index 2b1061e9d..ec89eb6bc 100644 --- a/crypto/func/auto-tests/legacy_tests/dns-collection/dns-utils.fc +++ b/crypto/func/auto-tests/legacy_tests/dns-collection/dns-utils.fc @@ -1,8 +1,8 @@ const int one_month = 2592000; ;; 1 month in seconds = 60 * 60 * 24 * 30 const int one_year = 31622400; ;; 1 year in seconds = 60 * 60 * 24 * 366 const int auction_start_time = 1659171600; ;; GMT: Monday, 30 July 2022 г., 09:00:00 -const int one_ton = 1000000000; -const int dns_next_resolver_prefix = 0xba93; ;; dns_next_resolver prefix - https://github.com/ton-blockchain/ton/blob/7e3df93ca2ab336716a230fceb1726d81bac0a06/crypto/block/block.tlb#L819 +const int one_ion = 1000000000; +const int dns_next_resolver_prefix = 0xba93; ;; dns_next_resolver prefix - https://github.com/ice-blockchain/ion/blob/7e3df93ca2ab336716a230fceb1726d81bac0a06/crypto/block/block.tlb#L819 const int dns_config_id = 80; ;; dns black list config param; in testnet -80 @@ -18,7 +18,7 @@ slice zero_address() { return begin_cell().store_uint(0, 2).end_cell().begin_parse(); } -;; "ton\0test\0" -> "ton" +;; "ion\0test\0" -> "ion" int get_top_domain_bits(slice domain) { int i = 0; int need_break = 0; @@ -96,8 +96,8 @@ int check_domain_string(slice domain) { int get_min_price(int domain_bits_length, int now_time) { (int start_min_price, int end_min_price) = get_min_price_config(domain_bits_length / 8); - start_min_price *= one_ton; - end_min_price *= one_ton; + start_min_price *= one_ion; + end_min_price *= one_ion; int seconds = now_time - auction_start_time; int months = seconds / one_month; if (months > 21) { diff --git a/crypto/func/auto-tests/legacy_tests/jetton-minter/imports/constants.fc b/crypto/func/auto-tests/legacy_tests/jetion-minter/imports/constants.fc similarity index 87% rename from crypto/func/auto-tests/legacy_tests/jetton-minter/imports/constants.fc rename to crypto/func/auto-tests/legacy_tests/jetion-minter/imports/constants.fc index c260f95e6..f81049ddc 100644 --- a/crypto/func/auto-tests/legacy_tests/jetton-minter/imports/constants.fc +++ b/crypto/func/auto-tests/legacy_tests/jetion-minter/imports/constants.fc @@ -10,4 +10,4 @@ int error::access_denied() asm "102 PUSHINT"; int error::insufficient_balance() asm "103 PUSHINT"; ;; other -int const::min_tons_for_storage() asm "10000000 PUSHINT"; ;; 0.01 TON \ No newline at end of file +int const::min_ions_for_storage() asm "10000000 PUSHINT"; ;; 0.01 ION \ No newline at end of file diff --git a/crypto/func/auto-tests/legacy_tests/jetion-minter/imports/jetion-utils.fc b/crypto/func/auto-tests/legacy_tests/jetion-minter/imports/jetion-utils.fc new file mode 100644 index 000000000..1e3d5cf5a --- /dev/null +++ b/crypto/func/auto-tests/legacy_tests/jetion-minter/imports/jetion-utils.fc @@ -0,0 +1,30 @@ +cell pack_jetion_wallet_data(int balance, slice owner_address, slice jetion_master_address, cell jetion_wallet_code) inline { + return begin_cell() + .store_coins(balance) + .store_slice(owner_address) + .store_slice(jetion_master_address) + .store_ref(jetion_wallet_code) + .end_cell(); +} + +cell calculate_jetion_wallet_state_init(slice owner_address, slice jetion_master_address, cell jetion_wallet_code) inline { + return begin_cell() + .store_uint(0, 2) + .store_dict(jetion_wallet_code) + .store_dict(pack_jetion_wallet_data(0, owner_address, jetion_master_address, jetion_wallet_code)) + .store_uint(0, 1) + .end_cell(); +} + +slice calculate_jetion_wallet_address(cell state_init) inline { + return begin_cell().store_uint(4, 3) + .store_int(workchain(), 8) + .store_uint(cell_hash(state_init), 256) + .end_cell() + .begin_parse(); +} + +slice calculate_user_jetion_wallet_address(slice owner_address, slice jetion_master_address, cell jetion_wallet_code) inline { + return calculate_jetion_wallet_address(calculate_jetion_wallet_state_init(owner_address, jetion_master_address, jetion_wallet_code)); +} + diff --git a/crypto/func/auto-tests/legacy_tests/jetton-minter/imports/op-codes.fc b/crypto/func/auto-tests/legacy_tests/jetion-minter/imports/op-codes.fc similarity index 100% rename from crypto/func/auto-tests/legacy_tests/jetton-minter/imports/op-codes.fc rename to crypto/func/auto-tests/legacy_tests/jetion-minter/imports/op-codes.fc diff --git a/crypto/func/auto-tests/legacy_tests/jetton-minter/imports/params.fc b/crypto/func/auto-tests/legacy_tests/jetion-minter/imports/params.fc similarity index 100% rename from crypto/func/auto-tests/legacy_tests/jetton-minter/imports/params.fc rename to crypto/func/auto-tests/legacy_tests/jetion-minter/imports/params.fc diff --git a/crypto/func/auto-tests/legacy_tests/jetton-minter/imports/stdlib.fc b/crypto/func/auto-tests/legacy_tests/jetion-minter/imports/stdlib.fc similarity index 100% rename from crypto/func/auto-tests/legacy_tests/jetton-minter/imports/stdlib.fc rename to crypto/func/auto-tests/legacy_tests/jetion-minter/imports/stdlib.fc diff --git a/crypto/func/auto-tests/legacy_tests/jetton-minter/imports/utils.fc b/crypto/func/auto-tests/legacy_tests/jetion-minter/imports/utils.fc similarity index 100% rename from crypto/func/auto-tests/legacy_tests/jetton-minter/imports/utils.fc rename to crypto/func/auto-tests/legacy_tests/jetion-minter/imports/utils.fc diff --git a/crypto/func/auto-tests/legacy_tests/jetton-minter/jetton-minter.fc b/crypto/func/auto-tests/legacy_tests/jetion-minter/jetion-minter.fc similarity index 71% rename from crypto/func/auto-tests/legacy_tests/jetton-minter/jetton-minter.fc rename to crypto/func/auto-tests/legacy_tests/jetion-minter/jetion-minter.fc index 73776e646..b035f3aed 100644 --- a/crypto/func/auto-tests/legacy_tests/jetton-minter/jetton-minter.fc +++ b/crypto/func/auto-tests/legacy_tests/jetion-minter/jetion-minter.fc @@ -1,12 +1,12 @@ -;; Jettons minter smart contract +;; Jetions minter smart contract ;; storage scheme -;; storage#_ total_supply:Coins admin_address:MsgAddress content:^Cell jetton_wallet_code:^Cell = Storage; +;; storage#_ total_supply:Coins admin_address:MsgAddress content:^Cell jetion_wallet_code:^Cell = Storage; #include "imports/stdlib.fc"; #include "imports/params.fc"; #include "imports/constants.fc"; -#include "imports/jetton-utils.fc"; +#include "imports/jetion-utils.fc"; #include "imports/op-codes.fc"; #include "imports/utils.fc"; #pragma version >=0.2.0; @@ -17,23 +17,23 @@ ds~load_coins(), ;; total_supply ds~load_msg_addr(), ;; admin_address ds~load_ref(), ;; content - ds~load_ref() ;; jetton_wallet_code + ds~load_ref() ;; jetion_wallet_code ); } -() save_data(int total_supply, slice admin_address, cell content, cell jetton_wallet_code) impure inline { +() save_data(int total_supply, slice admin_address, cell content, cell jetion_wallet_code) impure inline { set_data(begin_cell() .store_coins(total_supply) .store_slice(admin_address) .store_ref(content) - .store_ref(jetton_wallet_code) + .store_ref(jetion_wallet_code) .end_cell() ); } -() mint_tokens(slice to_address, cell jetton_wallet_code, int amount, cell master_msg) impure { - cell state_init = calculate_jetton_wallet_state_init(to_address, my_address(), jetton_wallet_code); - slice to_wallet_address = calculate_jetton_wallet_address(state_init); +() mint_tokens(slice to_address, cell jetion_wallet_code, int amount, cell master_msg) impure { + cell state_init = calculate_jetion_wallet_state_init(to_address, my_address(), jetion_wallet_code); + slice to_wallet_address = calculate_jetion_wallet_address(state_init); var msg = begin_cell() .store_uint(0x18, 6) .store_slice(to_wallet_address) @@ -59,7 +59,7 @@ int op = in_msg_body~load_uint(32); int query_id = in_msg_body~load_uint(64); - (int total_supply, slice admin_address, cell content, cell jetton_wallet_code) = load_data(); + (int total_supply, slice admin_address, cell content, cell jetion_wallet_code) = load_data(); if (op == op::mint()) { throw_unless(73, equal_slices(sender_address, admin_address)); @@ -68,19 +68,19 @@ cell master_msg = in_msg_body~load_ref(); slice master_msg_cs = master_msg.begin_parse(); master_msg_cs~skip_bits(32 + 64); ;; op + query_id - int jetton_amount = master_msg_cs~load_coins(); - mint_tokens(to_address, jetton_wallet_code, amount, master_msg); - save_data(total_supply + jetton_amount, admin_address, content, jetton_wallet_code); + int jetion_amount = master_msg_cs~load_coins(); + mint_tokens(to_address, jetion_wallet_code, amount, master_msg); + save_data(total_supply + jetion_amount, admin_address, content, jetion_wallet_code); return (); } if (op == op::burn_notification()) { - int jetton_amount = in_msg_body~load_coins(); + int jetion_amount = in_msg_body~load_coins(); slice from_address = in_msg_body~load_msg_addr(); throw_unless(74, - equal_slices(calculate_user_jetton_wallet_address(from_address, my_address(), jetton_wallet_code), sender_address) + equal_slices(calculate_user_jetion_wallet_address(from_address, my_address(), jetion_wallet_code), sender_address) ); - save_data(total_supply - jetton_amount, admin_address, content, jetton_wallet_code); + save_data(total_supply - jetion_amount, admin_address, content, jetion_wallet_code); slice response_address = in_msg_body~load_msg_addr(); if (response_address.preload_uint(2) != 0) { var msg = begin_cell() @@ -98,25 +98,25 @@ if (op == 3) { ;; change admin throw_unless(73, equal_slices(sender_address, admin_address)); slice new_admin_address = in_msg_body~load_msg_addr(); - save_data(total_supply, new_admin_address, content, jetton_wallet_code); + save_data(total_supply, new_admin_address, content, jetion_wallet_code); return (); } if (op == 4) { ;; change content, delete this for immutable tokens throw_unless(73, equal_slices(sender_address, admin_address)); - save_data(total_supply, admin_address, in_msg_body~load_ref(), jetton_wallet_code); + save_data(total_supply, admin_address, in_msg_body~load_ref(), jetion_wallet_code); return (); } throw(0xffff); } -(int, int, slice, cell, cell) get_jetton_data() method_id { - (int total_supply, slice admin_address, cell content, cell jetton_wallet_code) = load_data(); - return (total_supply, -1, admin_address, content, jetton_wallet_code); +(int, int, slice, cell, cell) get_jetion_data() method_id { + (int total_supply, slice admin_address, cell content, cell jetion_wallet_code) = load_data(); + return (total_supply, -1, admin_address, content, jetion_wallet_code); } slice get_wallet_address(slice owner_address) method_id { - (int total_supply, slice admin_address, cell content, cell jetton_wallet_code) = load_data(); - return calculate_user_jetton_wallet_address(owner_address, my_address(), jetton_wallet_code); + (int total_supply, slice admin_address, cell content, cell jetion_wallet_code) = load_data(); + return calculate_user_jetion_wallet_address(owner_address, my_address(), jetion_wallet_code); } diff --git a/crypto/func/auto-tests/legacy_tests/jetton-wallet/imports/constants.fc b/crypto/func/auto-tests/legacy_tests/jetion-wallet/imports/constants.fc similarity index 84% rename from crypto/func/auto-tests/legacy_tests/jetton-wallet/imports/constants.fc rename to crypto/func/auto-tests/legacy_tests/jetion-wallet/imports/constants.fc index 02e239f73..ca0c99d48 100644 --- a/crypto/func/auto-tests/legacy_tests/jetton-wallet/imports/constants.fc +++ b/crypto/func/auto-tests/legacy_tests/jetion-wallet/imports/constants.fc @@ -10,8 +10,8 @@ int error::access_denied() asm "102 PUSHINT"; int error::insufficient_balance() asm "103 PUSHINT"; ;; other -int const::min_tons_for_storage() asm "10000000 PUSHINT"; ;; 0.01 TON +int const::min_ions_for_storage() asm "10000000 PUSHINT"; ;; 0.01 ION ;; 6905(computational_gas_price) * 1000(cur_gas_price) = 6905000 -;; ceil(6905000) = 10000000 ~= 0.01 TON +;; ceil(6905000) = 10000000 ~= 0.01 ION int const::provide_address_gas_consumption() asm "10000000 PUSHINT"; \ No newline at end of file diff --git a/crypto/func/auto-tests/legacy_tests/jetion-wallet/imports/jetion-utils.fc b/crypto/func/auto-tests/legacy_tests/jetion-wallet/imports/jetion-utils.fc new file mode 100644 index 000000000..1e3d5cf5a --- /dev/null +++ b/crypto/func/auto-tests/legacy_tests/jetion-wallet/imports/jetion-utils.fc @@ -0,0 +1,30 @@ +cell pack_jetion_wallet_data(int balance, slice owner_address, slice jetion_master_address, cell jetion_wallet_code) inline { + return begin_cell() + .store_coins(balance) + .store_slice(owner_address) + .store_slice(jetion_master_address) + .store_ref(jetion_wallet_code) + .end_cell(); +} + +cell calculate_jetion_wallet_state_init(slice owner_address, slice jetion_master_address, cell jetion_wallet_code) inline { + return begin_cell() + .store_uint(0, 2) + .store_dict(jetion_wallet_code) + .store_dict(pack_jetion_wallet_data(0, owner_address, jetion_master_address, jetion_wallet_code)) + .store_uint(0, 1) + .end_cell(); +} + +slice calculate_jetion_wallet_address(cell state_init) inline { + return begin_cell().store_uint(4, 3) + .store_int(workchain(), 8) + .store_uint(cell_hash(state_init), 256) + .end_cell() + .begin_parse(); +} + +slice calculate_user_jetion_wallet_address(slice owner_address, slice jetion_master_address, cell jetion_wallet_code) inline { + return calculate_jetion_wallet_address(calculate_jetion_wallet_state_init(owner_address, jetion_master_address, jetion_wallet_code)); +} + diff --git a/crypto/func/auto-tests/legacy_tests/jetton-wallet/imports/op-codes.fc b/crypto/func/auto-tests/legacy_tests/jetion-wallet/imports/op-codes.fc similarity index 100% rename from crypto/func/auto-tests/legacy_tests/jetton-wallet/imports/op-codes.fc rename to crypto/func/auto-tests/legacy_tests/jetion-wallet/imports/op-codes.fc diff --git a/crypto/func/auto-tests/legacy_tests/jetton-wallet/imports/params.fc b/crypto/func/auto-tests/legacy_tests/jetion-wallet/imports/params.fc similarity index 100% rename from crypto/func/auto-tests/legacy_tests/jetton-wallet/imports/params.fc rename to crypto/func/auto-tests/legacy_tests/jetion-wallet/imports/params.fc diff --git a/crypto/func/auto-tests/legacy_tests/jetton-wallet/imports/stdlib.fc b/crypto/func/auto-tests/legacy_tests/jetion-wallet/imports/stdlib.fc similarity index 100% rename from crypto/func/auto-tests/legacy_tests/jetton-wallet/imports/stdlib.fc rename to crypto/func/auto-tests/legacy_tests/jetion-wallet/imports/stdlib.fc diff --git a/crypto/func/auto-tests/legacy_tests/jetton-wallet/imports/utils.fc b/crypto/func/auto-tests/legacy_tests/jetion-wallet/imports/utils.fc similarity index 100% rename from crypto/func/auto-tests/legacy_tests/jetton-wallet/imports/utils.fc rename to crypto/func/auto-tests/legacy_tests/jetion-wallet/imports/utils.fc diff --git a/crypto/func/auto-tests/legacy_tests/jetton-wallet/jetton-wallet.fc b/crypto/func/auto-tests/legacy_tests/jetion-wallet/jetion-wallet.fc similarity index 71% rename from crypto/func/auto-tests/legacy_tests/jetton-wallet/jetton-wallet.fc rename to crypto/func/auto-tests/legacy_tests/jetion-wallet/jetion-wallet.fc index 01cc91bce..5347a547e 100644 --- a/crypto/func/auto-tests/legacy_tests/jetton-wallet/jetton-wallet.fc +++ b/crypto/func/auto-tests/legacy_tests/jetion-wallet/jetion-wallet.fc @@ -1,9 +1,9 @@ -;; Jetton Wallet Smart Contract +;; Jetion Wallet Smart Contract #include "imports/stdlib.fc"; #include "imports/params.fc"; #include "imports/constants.fc"; -#include "imports/jetton-utils.fc"; +#include "imports/jetion-utils.fc"; #include "imports/op-codes.fc"; #include "imports/utils.fc"; #pragma version >=0.2.0; @@ -20,12 +20,12 @@ This is suitable for most tokens, if you need tokens transferable between workch -} -const min_tons_for_storage = 10000000; ;; 0.01 TON -const gas_consumption = 10000000; ;; 0.01 TON +const min_ions_for_storage = 10000000; ;; 0.01 ION +const gas_consumption = 10000000; ;; 0.01 ION {- Storage - storage#_ balance:Coins owner_address:MsgAddressInt jetton_master_address:MsgAddressInt jetton_wallet_code:^Cell = Storage; + storage#_ balance:Coins owner_address:MsgAddressInt jetion_master_address:MsgAddressInt jetion_wallet_code:^Cell = Storage; -} (int, slice, slice, cell) load_data() inline { @@ -33,38 +33,38 @@ const gas_consumption = 10000000; ;; 0.01 TON return (ds~load_coins(), ds~load_msg_addr(), ds~load_msg_addr(), ds~load_ref()); } -() save_data (int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) impure inline { - set_data(pack_jetton_wallet_data(balance, owner_address, jetton_master_address, jetton_wallet_code)); +() save_data (int balance, slice owner_address, slice jetion_master_address, cell jetion_wallet_code) impure inline { + set_data(pack_jetion_wallet_data(balance, owner_address, jetion_master_address, jetion_wallet_code)); } {- transfer query_id:uint64 amount:(VarUInteger 16) destination:MsgAddress response_destination:MsgAddress custom_payload:(Maybe ^Cell) - forward_ton_amount:(VarUInteger 16) forward_payload:(Either Cell ^Cell) + forward_ion_amount:(VarUInteger 16) forward_payload:(Either Cell ^Cell) = InternalMsgBody; internal_transfer query_id:uint64 amount:(VarUInteger 16) from:MsgAddress response_address:MsgAddress - forward_ton_amount:(VarUInteger 16) + forward_ion_amount:(VarUInteger 16) forward_payload:(Either Cell ^Cell) = InternalMsgBody; -} () send_tokens (slice in_msg_body, slice sender_address, int msg_value, int fwd_fee) impure { int query_id = in_msg_body~load_uint(64); - int jetton_amount = in_msg_body~load_coins(); + int jetion_amount = in_msg_body~load_coins(); slice to_owner_address = in_msg_body~load_msg_addr(); force_chain(to_owner_address); - (int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) = load_data(); - balance -= jetton_amount; + (int balance, slice owner_address, slice jetion_master_address, cell jetion_wallet_code) = load_data(); + balance -= jetion_amount; throw_unless(705, equal_slices(owner_address, sender_address)); throw_unless(706, balance >= 0); - cell state_init = calculate_jetton_wallet_state_init(to_owner_address, jetton_master_address, jetton_wallet_code); - slice to_wallet_address = calculate_jetton_wallet_address(state_init); + cell state_init = calculate_jetion_wallet_state_init(to_owner_address, jetion_master_address, jetion_wallet_code); + slice to_wallet_address = calculate_jetion_wallet_address(state_init); slice response_address = in_msg_body~load_msg_addr(); cell custom_payload = in_msg_body~load_dict(); - int forward_ton_amount = in_msg_body~load_coins(); + int forward_ion_amount = in_msg_body~load_coins(); throw_unless(708, slice_bits(in_msg_body) >= 1); slice either_forward_payload = in_msg_body; var msg = begin_cell() @@ -76,64 +76,64 @@ const gas_consumption = 10000000; ;; 0.01 TON var msg_body = begin_cell() .store_uint(op::internal_transfer(), 32) .store_uint(query_id, 64) - .store_coins(jetton_amount) + .store_coins(jetion_amount) .store_slice(owner_address) .store_slice(response_address) - .store_coins(forward_ton_amount) + .store_coins(forward_ion_amount) .store_slice(either_forward_payload) .end_cell(); msg = msg.store_ref(msg_body); - int fwd_count = forward_ton_amount ? 2 : 1; + int fwd_count = forward_ion_amount ? 2 : 1; throw_unless(709, msg_value > - forward_ton_amount + + forward_ion_amount + ;; 3 messages: wal1->wal2, wal2->owner, wal2->response ;; but last one is optional (it is ok if it fails) fwd_count * fwd_fee + - (2 * gas_consumption + min_tons_for_storage)); ;; TODO(shahar) ? + (2 * gas_consumption + min_ions_for_storage)); ;; TODO(shahar) ? ;; universal message send fee calculation may be activated here ;; by using this instead of fwd_fee ;; msg_fwd_fee(to_wallet, msg_body, state_init, 15) send_raw_message(msg.end_cell(), 64); ;; revert on errors - save_data(balance, owner_address, jetton_master_address, jetton_wallet_code); + save_data(balance, owner_address, jetion_master_address, jetion_wallet_code); } {- internal_transfer query_id:uint64 amount:(VarUInteger 16) from:MsgAddress response_address:MsgAddress - forward_ton_amount:(VarUInteger 16) + forward_ion_amount:(VarUInteger 16) forward_payload:(Either Cell ^Cell) = InternalMsgBody; -} -() receive_tokens (slice in_msg_body, slice sender_address, int my_ton_balance, int fwd_fee, int msg_value) impure { +() receive_tokens (slice in_msg_body, slice sender_address, int my_ion_balance, int fwd_fee, int msg_value) impure { ;; NOTE we can not allow fails in action phase since in that case there will be ;; no bounce. Thus check and throw in computation phase. - (int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) = load_data(); + (int balance, slice owner_address, slice jetion_master_address, cell jetion_wallet_code) = load_data(); int query_id = in_msg_body~load_uint(64); - int jetton_amount = in_msg_body~load_coins(); - balance += jetton_amount; + int jetion_amount = in_msg_body~load_coins(); + balance += jetion_amount; slice from_address = in_msg_body~load_msg_addr(); slice response_address = in_msg_body~load_msg_addr(); throw_unless(707, - equal_slices(jetton_master_address, sender_address) + equal_slices(jetion_master_address, sender_address) | - equal_slices(calculate_user_jetton_wallet_address(from_address, jetton_master_address, jetton_wallet_code), sender_address) + equal_slices(calculate_user_jetion_wallet_address(from_address, jetion_master_address, jetion_wallet_code), sender_address) ); - int forward_ton_amount = in_msg_body~load_coins(); + int forward_ion_amount = in_msg_body~load_coins(); - int ton_balance_before_msg = my_ton_balance - msg_value; - int storage_fee = min_tons_for_storage - min(ton_balance_before_msg, min_tons_for_storage); + int ion_balance_before_msg = my_ion_balance - msg_value; + int storage_fee = min_ions_for_storage - min(ion_balance_before_msg, min_ions_for_storage); msg_value -= (storage_fee + gas_consumption); - if(forward_ton_amount) { - msg_value -= (forward_ton_amount + fwd_fee); + if(forward_ion_amount) { + msg_value -= (forward_ion_amount + fwd_fee); slice either_forward_payload = in_msg_body; var msg_body = begin_cell() .store_uint(op::transfer_notification(), 32) .store_uint(query_id, 64) - .store_coins(jetton_amount) + .store_coins(jetion_amount) .store_slice(from_address) .store_slice(either_forward_payload) .end_cell(); @@ -141,7 +141,7 @@ const gas_consumption = 10000000; ;; 0.01 TON var msg = begin_cell() .store_uint(0x10, 6) ;; we should not bounce here cause receiver can have uninitialized contract .store_slice(owner_address) - .store_coins(forward_ton_amount) + .store_coins(forward_ion_amount) .store_uint(1, 1 + 4 + 4 + 64 + 32 + 1 + 1) .store_ref(msg_body); @@ -159,19 +159,19 @@ const gas_consumption = 10000000; ;; 0.01 TON send_raw_message(msg.end_cell(), 2); } - save_data(balance, owner_address, jetton_master_address, jetton_wallet_code); + save_data(balance, owner_address, jetion_master_address, jetion_wallet_code); } () burn_tokens (slice in_msg_body, slice sender_address, int msg_value, int fwd_fee) impure { ;; NOTE we can not allow fails in action phase since in that case there will be ;; no bounce. Thus check and throw in computation phase. - (int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) = load_data(); + (int balance, slice owner_address, slice jetion_master_address, cell jetion_wallet_code) = load_data(); int query_id = in_msg_body~load_uint(64); - int jetton_amount = in_msg_body~load_coins(); + int jetion_amount = in_msg_body~load_coins(); slice response_address = in_msg_body~load_msg_addr(); ;; ignore custom payload ;; slice custom_payload = in_msg_body~load_dict(); - balance -= jetton_amount; + balance -= jetion_amount; throw_unless(705, equal_slices(owner_address, sender_address)); throw_unless(706, balance >= 0); throw_unless(707, msg_value > fwd_fee + 2 * gas_consumption); @@ -179,32 +179,32 @@ const gas_consumption = 10000000; ;; 0.01 TON var msg_body = begin_cell() .store_uint(op::burn_notification(), 32) .store_uint(query_id, 64) - .store_coins(jetton_amount) + .store_coins(jetion_amount) .store_slice(owner_address) .store_slice(response_address) .end_cell(); var msg = begin_cell() .store_uint(0x18, 6) - .store_slice(jetton_master_address) + .store_slice(jetion_master_address) .store_coins(0) .store_uint(1, 1 + 4 + 4 + 64 + 32 + 1 + 1) .store_ref(msg_body); send_raw_message(msg.end_cell(), 64); - save_data(balance, owner_address, jetton_master_address, jetton_wallet_code); + save_data(balance, owner_address, jetion_master_address, jetion_wallet_code); } () on_bounce (slice in_msg_body) impure { in_msg_body~skip_bits(32); ;; 0xFFFFFFFF - (int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) = load_data(); + (int balance, slice owner_address, slice jetion_master_address, cell jetion_wallet_code) = load_data(); int op = in_msg_body~load_uint(32); throw_unless(709, (op == op::internal_transfer()) | (op == op::burn_notification())); int query_id = in_msg_body~load_uint(64); - int jetton_amount = in_msg_body~load_coins(); - balance += jetton_amount; - save_data(balance, owner_address, jetton_master_address, jetton_wallet_code); + int jetion_amount = in_msg_body~load_coins(); + balance += jetion_amount; + save_data(balance, owner_address, jetion_master_address, jetion_wallet_code); } () recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure { diff --git a/crypto/func/auto-tests/legacy_tests/jetton-minter/imports/jetton-utils.fc b/crypto/func/auto-tests/legacy_tests/jetton-minter/imports/jetton-utils.fc deleted file mode 100644 index 296816a1f..000000000 --- a/crypto/func/auto-tests/legacy_tests/jetton-minter/imports/jetton-utils.fc +++ /dev/null @@ -1,30 +0,0 @@ -cell pack_jetton_wallet_data(int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) inline { - return begin_cell() - .store_coins(balance) - .store_slice(owner_address) - .store_slice(jetton_master_address) - .store_ref(jetton_wallet_code) - .end_cell(); -} - -cell calculate_jetton_wallet_state_init(slice owner_address, slice jetton_master_address, cell jetton_wallet_code) inline { - return begin_cell() - .store_uint(0, 2) - .store_dict(jetton_wallet_code) - .store_dict(pack_jetton_wallet_data(0, owner_address, jetton_master_address, jetton_wallet_code)) - .store_uint(0, 1) - .end_cell(); -} - -slice calculate_jetton_wallet_address(cell state_init) inline { - return begin_cell().store_uint(4, 3) - .store_int(workchain(), 8) - .store_uint(cell_hash(state_init), 256) - .end_cell() - .begin_parse(); -} - -slice calculate_user_jetton_wallet_address(slice owner_address, slice jetton_master_address, cell jetton_wallet_code) inline { - return calculate_jetton_wallet_address(calculate_jetton_wallet_state_init(owner_address, jetton_master_address, jetton_wallet_code)); -} - diff --git a/crypto/func/auto-tests/legacy_tests/jetton-wallet/imports/jetton-utils.fc b/crypto/func/auto-tests/legacy_tests/jetton-wallet/imports/jetton-utils.fc deleted file mode 100644 index 296816a1f..000000000 --- a/crypto/func/auto-tests/legacy_tests/jetton-wallet/imports/jetton-utils.fc +++ /dev/null @@ -1,30 +0,0 @@ -cell pack_jetton_wallet_data(int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) inline { - return begin_cell() - .store_coins(balance) - .store_slice(owner_address) - .store_slice(jetton_master_address) - .store_ref(jetton_wallet_code) - .end_cell(); -} - -cell calculate_jetton_wallet_state_init(slice owner_address, slice jetton_master_address, cell jetton_wallet_code) inline { - return begin_cell() - .store_uint(0, 2) - .store_dict(jetton_wallet_code) - .store_dict(pack_jetton_wallet_data(0, owner_address, jetton_master_address, jetton_wallet_code)) - .store_uint(0, 1) - .end_cell(); -} - -slice calculate_jetton_wallet_address(cell state_init) inline { - return begin_cell().store_uint(4, 3) - .store_int(workchain(), 8) - .store_uint(cell_hash(state_init), 256) - .end_cell() - .begin_parse(); -} - -slice calculate_user_jetton_wallet_address(slice owner_address, slice jetton_master_address, cell jetton_wallet_code) inline { - return calculate_jetton_wallet_address(calculate_jetton_wallet_state_init(owner_address, jetton_master_address, jetton_wallet_code)); -} - diff --git a/crypto/func/auto-tests/legacy_tests/nominator-pool/pool.fc b/crypto/func/auto-tests/legacy_tests/nominator-pool/pool.fc index 25d6cb389..37197c461 100644 --- a/crypto/func/auto-tests/legacy_tests/nominator-pool/pool.fc +++ b/crypto/func/auto-tests/legacy_tests/nominator-pool/pool.fc @@ -8,13 +8,13 @@ #include "stdlib.fc"; -int op::new_stake() asm "0x4e73744b PUSHINT"; ;; https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L621 -int op::new_stake_error() asm "0xee6f454c PUSHINT"; ;; return_stake https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L169 -int op::new_stake_ok() asm "0xf374484c PUSHINT"; ;; send_confirmation https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L173 +int op::new_stake() asm "0x4e73744b PUSHINT"; ;; https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L621 +int op::new_stake_error() asm "0xee6f454c PUSHINT"; ;; return_stake https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L169 +int op::new_stake_ok() asm "0xf374484c PUSHINT"; ;; send_confirmation https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L173 -int op::recover_stake() asm "0x47657424 PUSHINT"; ;; https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L625 -int op::recover_stake_error() asm "0xfffffffe PUSHINT"; ;; https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L407 -int op::recover_stake_ok() asm "0xf96f7324 PUSHINT"; ;; https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L426 +int op::recover_stake() asm "0x47657424 PUSHINT"; ;; https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L625 +int op::recover_stake_error() asm "0xfffffffe PUSHINT"; ;; https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L407 +int op::recover_stake_ok() asm "0xf96f7324 PUSHINT"; ;; https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L426 int ADDR_SIZE() asm "256 PUSHINT"; int BOUNCEABLE() asm "0x18 PUSHINT"; @@ -22,15 +22,15 @@ int NON_BOUNCEABLE() asm "0x10 PUSHINT"; int SEND_MODE_PAY_FEE_SEPARATELY() asm "1 PUSHINT"; ;; means that the sender wants to pay transfer fees separately int SEND_MODE_IGNORE_ERRORS() asm "2 PUSHINT"; ;; means that any errors arising while processing this message during the action phase should be ignored int SEND_MODE_REMAINING_AMOUNT() asm "64 PUSHINT"; ;; is used for messages that carry all the remaining value of the inbound message in addition to the value initially indicated in the new message -int ONE_TON() asm "1000000000 PUSHINT"; -int MIN_TONS_FOR_STORAGE() asm "10000000000 PUSHINT"; ;; 10 TON -int DEPOSIT_PROCESSING_FEE() asm "1000000000 PUSHINT"; ;; 1 TON -int MIN_STAKE_TO_SEND() asm "500000000000 PUSHINT"; ;; 500 TON +int ONE_ION() asm "1000000000 PUSHINT"; +int MIN_IONS_FOR_STORAGE() asm "10000000000 PUSHINT"; ;; 10 ION +int DEPOSIT_PROCESSING_FEE() asm "1000000000 PUSHINT"; ;; 1 ION +int MIN_STAKE_TO_SEND() asm "500000000000 PUSHINT"; ;; 500 ION int VOTES_LIFETIME() asm "2592000 PUSHINT"; ;; 30 days int binary_log_ceil(int x) asm "UBITSIZE"; -;; hex parse same with bridge https://github.com/ton-blockchain/bridge-func/blob/d03dbdbe9236e01efe7f5d344831bf770ac4c613/func/text_utils.fc +;; hex parse same with bridge https://github.com/ice-blockchain/bridge-func/blob/d03dbdbe9236e01efe7f5d344831bf770ac4c613/func/text_utils.fc (slice, int) ~load_hex_symbol(slice comment) { int n = comment~load_uint(8); n = n - 48; @@ -72,7 +72,7 @@ slice make_address(int wc, int addr) inline_ref { .store_uint(4, 3).store_int(wc, 8).store_uint(addr, ADDR_SIZE()).end_cell().begin_parse(); } -;; https://github.com/ton-blockchain/ton/blob/ae5c0720143e231c32c3d2034cfe4e533a16d969/crypto/block/block.tlb#L584 +;; https://github.com/ice-blockchain/ion/blob/ae5c0720143e231c32c3d2034cfe4e533a16d969/crypto/block/block.tlb#L584 int is_elector_address(int wc, int addr) inline_ref { return (wc == -1) & (config_param(1).begin_parse().preload_uint(ADDR_SIZE()) == addr); } @@ -82,11 +82,11 @@ slice elector_address() inline_ref { return make_address(-1, elector); } -;; https://github.com/ton-blockchain/ton/blob/ae5c0720143e231c32c3d2034cfe4e533a16d969/crypto/block/block.tlb#L721 +;; https://github.com/ice-blockchain/ion/blob/ae5c0720143e231c32c3d2034cfe4e533a16d969/crypto/block/block.tlb#L721 int max_recommended_punishment_for_validator_misbehaviour(int stake) inline_ref { cell cp = config_param(40); if (cell_null?(cp)) { - return 101000000000; ;; 101 TON - https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/lite-client/lite-client.cpp#L3678 + return 101000000000; ;; 101 ION - https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/lite-client/lite-client.cpp#L3678 } slice cs = cp.begin_parse(); @@ -103,7 +103,7 @@ int max_recommended_punishment_for_validator_misbehaviour(int stake) inline_ref cs~load_uint(16), cs~load_uint(16), cs~load_uint(16) ); - ;; https://github.com/ton-blockchain/ton/blob/master/lite-client/lite-client.cpp#L3721 + ;; https://github.com/ice-blockchain/ion/blob/master/lite-client/lite-client.cpp#L3721 int fine = default_flat_fine; int fine_part = default_proportional_fine; @@ -113,23 +113,23 @@ int max_recommended_punishment_for_validator_misbehaviour(int stake) inline_ref fine *= long_flat_mult; fine >>= 8; fine_part *= long_proportional_mult; fine_part >>= 8; - return min(stake, fine + muldiv(stake, fine_part, 1 << 32)); ;; https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L529 + return min(stake, fine + muldiv(stake, fine_part, 1 << 32)); ;; https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L529 } -;; https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/block/block.tlb#L632 -;; https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L118 +;; https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/block/block.tlb#L632 +;; https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L118 int get_validator_config() inline_ref { slice cs = config_param(15).begin_parse(); (int validators_elected_for, int elections_start_before, int elections_end_before, int stake_held_for) = (cs~load_uint(32), cs~load_uint(32), cs~load_uint(32), cs.preload_uint(32)); return stake_held_for; } -;; https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/block/block.tlb#L712 +;; https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/block/block.tlb#L712 (int, int, cell) get_current_validator_set() inline_ref { cell vset = config_param(34); ;; current validator set slice cs = vset.begin_parse(); - ;; https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/block/block.tlb#L579 - ;; https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/config-code.fc#L49 + ;; https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/block/block.tlb#L579 + ;; https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/config-code.fc#L49 throw_unless(9, cs~load_uint(8) == 0x12); ;; validators_ext#12 only int utime_since = cs~load_uint(32); ;; actual start unixtime of current validation round int utime_until = cs~load_uint(32); ;; supposed end unixtime of current validation round (utime_until = utime_since + validators_elected_for); unfreeze_at = utime_until + stake_held_for @@ -137,7 +137,7 @@ int get_validator_config() inline_ref { } ;; check the validity of the new_stake message -;; https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L208 +;; https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L208 int check_new_stake_msg(slice cs) impure inline_ref { var validator_pubkey = cs~load_uint(256); var stake_at = cs~load_uint(32); @@ -242,7 +242,7 @@ cell pack_config(int validator_address, int validator_reward_share, int max_nomi (int amount, int pending_deposit_amount) = unpack_nominator(nominator); int withdraw_amount = amount + pending_deposit_amount; - if (withdraw_amount > balance - MIN_TONS_FOR_STORAGE()) { + if (withdraw_amount > balance - MIN_IONS_FOR_STORAGE()) { return (nominators, withdraw_requests, balance, nominators_count); } @@ -251,7 +251,7 @@ cell pack_config(int validator_address, int validator_reward_share, int max_nomi nominators_count -= 1; balance -= withdraw_amount; - if (withdraw_amount >= ONE_TON()) { + if (withdraw_amount >= ONE_ION()) { send_msg(make_address(0, address), withdraw_amount, null(), NON_BOUNCEABLE(), 0); ;; non-bouneable, fee deducted from amount, revert on errors } return (nominators, withdraw_requests, balance, nominators_count); @@ -409,7 +409,7 @@ cell distribute_share(int reward, cell nominators) inline_ref { if (action == 119) { ;; "w" - withdraw request (any time) if (state == 0) { (nominators, withdraw_requests, int new_balance, nominators_count) = withdraw_nominator(sender_addr, nominators, withdraw_requests, balance, nominators_count); - if (new_balance - msg_value >= MIN_TONS_FOR_STORAGE()) { + if (new_balance - msg_value >= MIN_IONS_FOR_STORAGE()) { send_excesses(sender_address); } } else { @@ -439,7 +439,7 @@ cell distribute_share(int reward, cell nominators) inline_ref { if (~ found) { ;; require higher fee to prevent dictionary spam - int fee = ONE_TON(); + int fee = ONE_ION(); int power = cell_depth(config_proposal_votings); repeat (power) { fee = muldiv(fee, 15, 10); @@ -521,7 +521,7 @@ cell distribute_share(int reward, cell nominators) inline_ref { (nominators, withdraw_requests, nominators_count, int new_balance) = process_withdraw_requests(nominators, withdraw_requests, balance, nominators_count, limit); - if (new_balance - msg_value >= MIN_TONS_FOR_STORAGE()) { + if (new_balance - msg_value >= MIN_IONS_FOR_STORAGE()) { send_excesses(sender_address); } } @@ -531,7 +531,7 @@ cell distribute_share(int reward, cell nominators) inline_ref { (slice withdraw_request, int found) = withdraw_requests.udict_get?(ADDR_SIZE(), request_address); throw_unless(71, found); (nominators, withdraw_requests, int new_balance, nominators_count) = withdraw_nominator(request_address, nominators, withdraw_requests, balance, nominators_count); - if (new_balance - msg_value >= MIN_TONS_FOR_STORAGE()) { + if (new_balance - msg_value >= MIN_IONS_FOR_STORAGE()) { send_excesses(sender_address); } } @@ -575,13 +575,13 @@ cell distribute_share(int reward, cell nominators) inline_ref { ;; So we are waiting for the change of 3 validator sets. ;; ADDITIONAL NOTE: - ;; In a special case (if the network was down), the config theoretically can refuse the elector to save a new round after election - https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/config-code.fc#L494 - ;; and the elector will start a new election - https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L364 + ;; In a special case (if the network was down), the config theoretically can refuse the elector to save a new round after election - https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/config-code.fc#L494 + ;; and the elector will start a new election - https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L364 ;; in this case, our pool will have to skip the round, but it will be able to recover stake later throw_unless(111, validator_set_changes_count >= 2); throw_unless(112, (validator_set_changes_count > 2) | (now() - validator_set_change_time > stake_held_for + 60)); - ;; https://github.com/ton-blockchain/ton/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L887 + ;; https://github.com/ice-blockchain/ion/blob/b38d227a469666d83ac535ad2eea80cb49d911b8/crypto/smartcont/elector-code.fc#L887 cell payload = begin_cell().store_uint(op::recover_stake(), 32).store_uint(query_id, 64).end_cell(); send_msg(elector_address(), 0, payload, BOUNCEABLE(), SEND_MODE_REMAINING_AMOUNT()); ;; bounceable, carry all the remaining value of the inbound message, fee deducted from amount, revert on errors @@ -604,14 +604,14 @@ cell distribute_share(int reward, cell nominators) inline_ref { int total_nominators_amount = calculate_total_nominators_amount(nominators); ;; the validator can withdraw everything that does not belong to the nominators - throw_unless(76, request_amount <= balance - MIN_TONS_FOR_STORAGE() - total_nominators_amount); + throw_unless(76, request_amount <= balance - MIN_IONS_FOR_STORAGE() - total_nominators_amount); validator_amount -= request_amount; if (validator_amount < 0) { validator_amount = 0; } send_msg(make_address(-1, validator_address), request_amount, null(), NON_BOUNCEABLE(), 0); ;; non-bouneable, fee deducted from amount, revert on errors int new_balance = balance - request_amount; - if (new_balance - msg_value >= MIN_TONS_FOR_STORAGE()) { + if (new_balance - msg_value >= MIN_IONS_FOR_STORAGE()) { send_excesses(sender_address); } } @@ -623,7 +623,7 @@ cell distribute_share(int reward, cell nominators) inline_ref { throw_unless(80, query_id); ;; query_id must be greater then 0 to receive confirmation message from elector - throw_unless(86, msg_value >= ONE_TON()); ;; must be greater then new_stake sending to elector fee + throw_unless(86, msg_value >= ONE_ION()); ;; must be greater then new_stake sending to elector fee int value = in_msg_body~load_coins(); @@ -631,11 +631,11 @@ cell distribute_share(int reward, cell nominators) inline_ref { stake_at = check_new_stake_msg(in_msg_body); - stake_amount_sent = value - ONE_TON(); + stake_amount_sent = value - ONE_ION(); throw_unless(81, value >= MIN_STAKE_TO_SEND()); - throw_unless(82, value <= balance - MIN_TONS_FOR_STORAGE()); + throw_unless(82, value <= balance - MIN_IONS_FOR_STORAGE()); throw_unless(83, validator_amount >= min_validator_stake); diff --git a/crypto/func/auto-tests/legacy_tests/storage/stdlib.fc b/crypto/func/auto-tests/legacy_tests/storage/stdlib.fc index 781fdcbcc..01a74e25f 100644 --- a/crypto/func/auto-tests/legacy_tests/storage/stdlib.fc +++ b/crypto/func/auto-tests/legacy_tests/storage/stdlib.fc @@ -4,7 +4,7 @@ {- # Tuple manipulation primitives The names and the types are mostly self-explaining. - See [polymorhism with forall](https://ton.org/docs/#/func/functions?id=polymorphism-with-forall) + See [polymorhism with forall](https://ion.org/docs/#/func/functions?id=polymorphism-with-forall) for more info on the polymorphic functions. Note that currently values of atomic type `tuple` can't be cast to composite tuple type (e.g. `[int, cell]`) @@ -112,7 +112,7 @@ int now() asm "NOW"; slice my_address() asm "MYADDR"; ;;; Returns the balance of the smart contract as a tuple consisting of an int -;;; (balance in nanotoncoins) and a `cell` +;;; (balance in nanoioncoins) and a `cell` ;;; (a dictionary with 32-bit keys representing the balance of "extra currencies") ;;; at the start of Computation Phase. ;;; Note that RAW primitives such as [send_raw_message] do not update this field. @@ -229,7 +229,7 @@ cont bless(slice s) impure asm "BLESS"; ;;; In other words, the current smart contract agrees to buy some gas to finish the current transaction. ;;; This action is required to process external messages, which bring no value (hence no gas) with themselves. ;;; -;;; For more details check [accept_message effects](https://ton.org/docs/#/smart-contracts/accept). +;;; For more details check [accept_message effects](https://ion.org/docs/#/smart-contracts/accept). () accept_message() impure asm "ACCEPT"; ;;; Sets current gas limit `gl` to the minimum of limit and `gm`, and resets the gas credit `gc` to zero. @@ -246,7 +246,7 @@ cont bless(slice s) impure asm "BLESS"; ;;; Not implemented ;;() buy_gas(int gram) impure asm "BUYGAS"; -;;; Computes the amount of gas that can be bought for `amount` nanoTONs, +;;; Computes the amount of gas that can be bought for `amount` nanoIONs, ;;; and sets `gl` accordingly in the same way as [set_gas_limit]. () buy_gas(int amount) impure asm "BUYGAS"; @@ -267,17 +267,17 @@ int abs(int x) asm "ABS"; It is said that a primitive _loads_ some data, if it returns the data and the remainder of the slice - (so it can also be used as [modifying method](https://ton.org/docs/#/func/statements?id=modifying-methods)). + (so it can also be used as [modifying method](https://ion.org/docs/#/func/statements?id=modifying-methods)). It is said that a primitive _preloads_ some data, if it returns only the data - (it can be used as [non-modifying method](https://ton.org/docs/#/func/statements?id=non-modifying-methods)). + (it can be used as [non-modifying method](https://ion.org/docs/#/func/statements?id=non-modifying-methods)). Unless otherwise stated, loading and preloading primitives read the data from a prefix of the slice. -} ;;; Converts a `cell` [c] into a `slice`. Notice that [c] must be either an ordinary cell, -;;; or an exotic cell (see [TVM.pdf](https://ton-blockchain.github.io/docs/tvm.pdf), 3.1.2) +;;; or an exotic cell (see [TVM.pdf](https://ice-blockchain.github.io/docs/tvm.pdf), 3.1.2) ;;; which is automatically loaded to yield an ordinary cell `c'`, converted into a `slice` afterwards. slice begin_parse(cell c) asm "CTOS"; @@ -401,7 +401,7 @@ int builder_depth(builder b) asm "BDEPTH"; # Builder primitives It is said that a primitive _stores_ a value `x` into a builder `b` if it returns a modified version of the builder `b'` with the value `x` stored at the end of it. - It can be used as [non-modifying method](https://ton.org/docs/#/func/statements?id=non-modifying-methods). + It can be used as [non-modifying method](https://ion.org/docs/#/func/statements?id=non-modifying-methods). All the primitives below first check whether there is enough space in the `builder`, and only then check the range of the value being serialized. @@ -595,7 +595,7 @@ cell config_param(int x) asm "CONFIGOPTPARAM"; ;;; Checks whether c is a null. Note, that FunC also has polymorphic null? built-in. int cell_null?(cell c) asm "ISNULL"; -;;; Creates an output action which would reserve exactly amount nanotoncoins (if mode = 0), at most amount nanotoncoins (if mode = 2), or all but amount nanotoncoins (if mode = 1 or mode = 3), from the remaining balance of the account. It is roughly equivalent to creating an outbound message carrying amount nanotoncoins (or b − amount nanotoncoins, where b is the remaining balance) to oneself, so that the subsequent output actions would not be able to spend more money than the remainder. Bit +2 in mode means that the external action does not fail if the specified amount cannot be reserved; instead, all remaining balance is reserved. Bit +8 in mode means `amount <- -amount` before performing any further actions. Bit +4 in mode means that amount is increased by the original balance of the current account (before the compute phase), including all extra currencies, before performing any other checks and actions. Currently, amount must be a non-negative integer, and mode must be in the range 0..15. +;;; Creates an output action which would reserve exactly amount nanoioncoins (if mode = 0), at most amount nanoioncoins (if mode = 2), or all but amount nanoioncoins (if mode = 1 or mode = 3), from the remaining balance of the account. It is roughly equivalent to creating an outbound message carrying amount nanoioncoins (or b − amount nanoioncoins, where b is the remaining balance) to oneself, so that the subsequent output actions would not be able to spend more money than the remainder. Bit +2 in mode means that the external action does not fail if the specified amount cannot be reserved; instead, all remaining balance is reserved. Bit +8 in mode means `amount <- -amount` before performing any further actions. Bit +4 in mode means that amount is increased by the original balance of the current account (before the compute phase), including all extra currencies, before performing any other checks and actions. Currently, amount must be a non-negative integer, and mode must be in the range 0..15. () raw_reserve(int amount, int mode) impure asm "RAWRESERVE"; ;;; Similar to raw_reserve, but also accepts a dictionary extra_amount (represented by a cell or null) with extra currencies. In this way currencies other than TonCoin can be reserved. () raw_reserve_extra(int amount, cell extra_amount, int mode) impure asm "RAWRESERVEX"; diff --git a/crypto/func/auto-tests/legacy_tests/tact-examples/jetton_JettonDefaultWallet.code.fc b/crypto/func/auto-tests/legacy_tests/tact-examples/jetion_JetionDefaultWallet.code.fc similarity index 86% rename from crypto/func/auto-tests/legacy_tests/tact-examples/jetton_JettonDefaultWallet.code.fc rename to crypto/func/auto-tests/legacy_tests/tact-examples/jetion_JetionDefaultWallet.code.fc index 522fa9e11..54027b5f0 100644 --- a/crypto/func/auto-tests/legacy_tests/tact-examples/jetton_JettonDefaultWallet.code.fc +++ b/crypto/func/auto-tests/legacy_tests/tact-examples/jetion_JetionDefaultWallet.code.fc @@ -176,7 +176,7 @@ cell __gen_writecell_TokenExcesses((int) v) inline_ref { return __gen_write_TokenExcesses(begin_cell(), v).end_cell(); } -builder __gen_write_JettonDefaultWallet(builder build_0, (int, slice, slice) v) inline_ref { +builder __gen_write_JetionDefaultWallet(builder build_0, (int, slice, slice) v) inline_ref { var (v'balance, v'owner, v'master) = v; build_0 = build_0.store_int(v'balance, 257); build_0 = __tact_store_address(build_0, v'owner); @@ -184,7 +184,7 @@ builder __gen_write_JettonDefaultWallet(builder build_0, (int, slice, slice) v) return build_0; } -(slice, ((int, slice, slice))) __gen_read_JettonDefaultWallet(slice sc_0) inline_ref { +(slice, ((int, slice, slice))) __gen_read_JetionDefaultWallet(slice sc_0) inline_ref { var v'balance = sc_0~load_int(257); var v'owner = sc_0~__tact_load_address(); var v'master = sc_0~__tact_load_address(); @@ -196,21 +196,21 @@ _ __gen_StateInit_get_code((cell, cell) v) inline { return v'code; } -(int, slice, slice, cell) __gen_JettonWalletData_to_external(((int, slice, slice, cell)) v) { +(int, slice, slice, cell) __gen_JetionWalletData_to_external(((int, slice, slice, cell)) v) { var (v'balance, v'owner, v'master, v'walletCode) = v; return (v'balance, v'owner, v'master, v'walletCode); } -(int, slice, slice) __gen_load_JettonDefaultWallet() inline_ref { +(int, slice, slice) __gen_load_JetionDefaultWallet() inline_ref { slice sc = get_data().begin_parse(); __tact_context_sys = sc~load_ref(); - return sc~__gen_read_JettonDefaultWallet(); + return sc~__gen_read_JetionDefaultWallet(); } -() __gen_store_JettonDefaultWallet((int, slice, slice) v) impure inline_ref { +() __gen_store_JetionDefaultWallet((int, slice, slice) v) impure inline_ref { builder b = begin_cell(); b = b.store_ref(__tact_context_sys); - b = __gen_write_JettonDefaultWallet(b, v); + b = __gen_write_JetionDefaultWallet(b, v); set_data(b.end_cell()); } @@ -272,41 +272,41 @@ int $__gen_Context_readForwardFee((int, slice, int, slice) $self) impure { return (($sc~load_coins() * 3) / 2); } -cell $__gen_JettonDefaultWallet_init(cell sys', slice $master, slice $owner) { +cell $__gen_JetionDefaultWallet_init(cell sys', slice $master, slice $owner) { var (($self'balance, $self'owner, $self'master)) = (null(), null(), null()); $self'balance = 0; $self'owner = $owner; $self'master = $master; var b' = begin_cell(); b' = b'.store_ref(sys'); - b' = __gen_write_JettonDefaultWallet(b', ($self'balance, $self'owner, $self'master)); + b' = __gen_write_JetionDefaultWallet(b', ($self'balance, $self'owner, $self'master)); return b'.end_cell(); } -(cell, cell) $__gen_JettonDefaultWallet_init_child(cell sys', slice $master, slice $owner) { +(cell, cell) $__gen_JetionDefaultWallet_init_child(cell sys', slice $master, slice $owner) { slice sc' = sys'.begin_parse(); cell source = sc'~load_dict(); cell contracts = new_dict(); - ;; Contract Code: JettonDefaultWallet + ;; Contract Code: JetionDefaultWallet cell mine = __tact_dict_get_code(source, 55471); contracts = __tact_dict_set_code(contracts, 55471, mine); cell sys = begin_cell().store_dict(contracts).end_cell(); - return (mine, $__gen_JettonDefaultWallet_init(sys, $master, $owner)); + return (mine, $__gen_JetionDefaultWallet_init(sys, $master, $owner)); } -(int, slice, slice, cell) $__gen_JettonDefaultWallet_get_wallet_data((int, slice, slice) $self) impure { +(int, slice, slice, cell) $__gen_JetionDefaultWallet_get_wallet_data((int, slice, slice) $self) impure { var (($self'balance, $self'owner, $self'master)) = $self; - return ($self'balance, $self'owner, $self'master, __gen_StateInit_get_code($__gen_JettonDefaultWallet_init_child(__tact_context_sys, $self'master, $self'owner))); + return ($self'balance, $self'owner, $self'master, __gen_StateInit_get_code($__gen_JetionDefaultWallet_init_child(__tact_context_sys, $self'master, $self'owner))); } _ $__gen_get_get_wallet_data() method_id(97026) { - var self = __gen_load_JettonDefaultWallet(); - var res = $__gen_JettonDefaultWallet_get_wallet_data(self); - return __gen_JettonWalletData_to_external(res); + var self = __gen_load_JetionDefaultWallet(); + var res = $__gen_JetionDefaultWallet_get_wallet_data(self); + return __gen_JetionWalletData_to_external(res); } -(((int, slice, slice)), ()) $__gen_JettonDefaultWallet_receive_TokenTransfer((int, slice, slice) $self, (int, int, slice, slice, cell, int, slice) $msg) impure { +(((int, slice, slice)), ()) $__gen_JetionDefaultWallet_receive_TokenTransfer((int, slice, slice) $self, (int, int, slice, slice, cell, int, slice) $msg) impure { var ($self'balance, $self'owner, $self'master) = $self; var ($msg'queryId, $msg'amount, $msg'destination, $msg'responseDestination, $msg'customPayload, $msg'forwardTonAmount, $msg'forwardPayload) = $msg; var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); @@ -319,25 +319,25 @@ _ $__gen_get_get_wallet_data() method_id(97026) { $fwdCount = 2; } throw_unless(16059, ($ctx'value > ((($fwdCount * $fwdFee) + (2 * 10000000)) + 10000000))); - var ($init'code, $init'data) = $__gen_JettonDefaultWallet_init_child(__tact_context_sys, $self'master, $msg'destination); + var ($init'code, $init'data) = $__gen_JetionDefaultWallet_init_child(__tact_context_sys, $self'master, $msg'destination); slice $walletAddress = $contractAddress(($init'code, $init'data)); $send((true, $walletAddress, 0, 64, __gen_writecell_TokenTransferInternal(($msg'queryId, $msg'amount, $self'owner, $self'owner, $msg'forwardTonAmount, $msg'forwardPayload)), $init'code, $init'data)); return (($self'balance, $self'owner, $self'master), ()); } -(((int, slice, slice)), ()) $__gen_JettonDefaultWallet_receive_TokenTransferInternal((int, slice, slice) $self, (int, int, slice, slice, int, slice) $msg) impure { +(((int, slice, slice)), ()) $__gen_JetionDefaultWallet_receive_TokenTransferInternal((int, slice, slice) $self, (int, int, slice, slice, int, slice) $msg) impure { var ($self'balance, $self'owner, $self'master) = $self; var ($msg'queryId, $msg'amount, $msg'from, $msg'responseAddress, $msg'forwardTonAmount, $msg'forwardPayload) = $msg; var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); if (__tact_address_neq($ctx'sender, $self'master)) { - var ($sinit'code, $sinit'data) = $__gen_JettonDefaultWallet_init_child(__tact_context_sys, $self'master, $msg'from); + var ($sinit'code, $sinit'data) = $__gen_JetionDefaultWallet_init_child(__tact_context_sys, $self'master, $msg'from); throw_unless(4429, __tact_address_eq($contractAddress(($sinit'code, $sinit'data)), $ctx'sender)); } $self'balance = ($self'balance + $msg'amount); throw_unless(62972, ($self'balance >= 0)); int $msgValue = $ctx'value; - int $tonBalanceBeforeMsg = (__tact_my_balance() - $msgValue); - int $storageFee = (10000000 - min($tonBalanceBeforeMsg, 10000000)); + int $ionBalanceBeforeMsg = (__tact_my_balance() - $msgValue); + int $storageFee = (10000000 - min($ionBalanceBeforeMsg, 10000000)); $msgValue = ($msgValue - ($storageFee + 10000000)); if (($msg'forwardTonAmount > 0)) { int $fwdFee = $__gen_Context_readForwardFee(($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw)); @@ -350,7 +350,7 @@ _ $__gen_get_get_wallet_data() method_id(97026) { return (($self'balance, $self'owner, $self'master), ()); } -(((int, slice, slice)), ()) $__gen_JettonDefaultWallet_receive_TokenBurn((int, slice, slice) $self, (int, int, slice, slice) $msg) impure { +(((int, slice, slice)), ()) $__gen_JetionDefaultWallet_receive_TokenBurn((int, slice, slice) $self, (int, int, slice, slice) $msg) impure { var ($self'balance, $self'owner, $self'master) = $self; var ($msg'queryId, $msg'amount, $msg'owner, $msg'responseAddress) = $msg; var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); @@ -363,14 +363,14 @@ _ $__gen_get_get_wallet_data() method_id(97026) { return (($self'balance, $self'owner, $self'master), ()); } -((int, slice, slice), ()) $__gen_JettonDefaultWallet_receive_bounced((int, slice, slice) $self, slice $msg) impure { +((int, slice, slice), ()) $__gen_JetionDefaultWallet_receive_bounced((int, slice, slice) $self, slice $msg) impure { var ($self'balance, $self'owner, $self'master) = $self; $msg~skip_bits(32); int $op = $msg~load_uint(32); int $queryId = $msg~load_uint(64); - int $jettonAmount = $msg~load_coins(); + int $jetionAmount = $msg~load_coins(); throw_unless(13650, (($op == 395134233) | ($op == 2078119902))); - $self'balance = ($self'balance + $jettonAmount); + $self'balance = ($self'balance + $jetionAmount); return (($self'balance, $self'owner, $self'master), ()); } @@ -390,36 +390,36 @@ _ $__gen_get_get_wallet_data() method_id(97026) { ;; Handle bounced messages if (msg_bounced) { - var self = __gen_load_JettonDefaultWallet(); - self~$__gen_JettonDefaultWallet_receive_bounced(in_msg); - __gen_store_JettonDefaultWallet(self); + var self = __gen_load_JetionDefaultWallet(); + self~$__gen_JetionDefaultWallet_receive_bounced(in_msg); + __gen_store_JetionDefaultWallet(self); return (); } ;; Receive TokenTransfer message if (op == 260734629) { - var self = __gen_load_JettonDefaultWallet(); + var self = __gen_load_JetionDefaultWallet(); var msg = in_msg~__gen_read_TokenTransfer(); - self~$__gen_JettonDefaultWallet_receive_TokenTransfer(msg); - __gen_store_JettonDefaultWallet(self); + self~$__gen_JetionDefaultWallet_receive_TokenTransfer(msg); + __gen_store_JetionDefaultWallet(self); return (); } ;; Receive TokenTransferInternal message if (op == 395134233) { - var self = __gen_load_JettonDefaultWallet(); + var self = __gen_load_JetionDefaultWallet(); var msg = in_msg~__gen_read_TokenTransferInternal(); - self~$__gen_JettonDefaultWallet_receive_TokenTransferInternal(msg); - __gen_store_JettonDefaultWallet(self); + self~$__gen_JetionDefaultWallet_receive_TokenTransferInternal(msg); + __gen_store_JetionDefaultWallet(self); return (); } ;; Receive TokenBurn message if (op == 1499400124) { - var self = __gen_load_JettonDefaultWallet(); + var self = __gen_load_JetionDefaultWallet(); var msg = in_msg~__gen_read_TokenBurn(); - self~$__gen_JettonDefaultWallet_receive_TokenBurn(msg); - __gen_store_JettonDefaultWallet(self); + self~$__gen_JetionDefaultWallet_receive_TokenBurn(msg); + __gen_store_JetionDefaultWallet(self); return (); } @@ -428,9 +428,9 @@ _ $__gen_get_get_wallet_data() method_id(97026) { _ supported_interfaces() method_id { return ( - "org.ton.introspection.v0"H >> 128, - "org.ton.abi.ipfs.v0"H >> 128, - "org.ton.jetton.wallet"H >> 128 + "org.ion.introspection.v0"H >> 128, + "org.ion.abi.ipfs.v0"H >> 128, + "org.ion.jetion.wallet"H >> 128 ); } diff --git a/crypto/func/auto-tests/legacy_tests/tact-examples/jetton_SampleJetton.code.fc b/crypto/func/auto-tests/legacy_tests/tact-examples/jetion_SampleJetion.code.fc similarity index 81% rename from crypto/func/auto-tests/legacy_tests/tact-examples/jetton_SampleJetton.code.fc rename to crypto/func/auto-tests/legacy_tests/tact-examples/jetion_SampleJetion.code.fc index 30bff4e1f..415ca61b4 100644 --- a/crypto/func/auto-tests/legacy_tests/tact-examples/jetton_SampleJetton.code.fc +++ b/crypto/func/auto-tests/legacy_tests/tact-examples/jetion_SampleJetion.code.fc @@ -129,7 +129,7 @@ cell __gen_writecell_TokenExcesses((int) v) inline_ref { return (sc_0, (v'amount)); } -builder __gen_write_JettonDefaultWallet(builder build_0, (int, slice, slice) v) inline_ref { +builder __gen_write_JetionDefaultWallet(builder build_0, (int, slice, slice) v) inline_ref { var (v'balance, v'owner, v'master) = v; build_0 = build_0.store_int(v'balance, 257); build_0 = __tact_store_address(build_0, v'owner); @@ -137,7 +137,7 @@ builder __gen_write_JettonDefaultWallet(builder build_0, (int, slice, slice) v) return build_0; } -builder __gen_write_SampleJetton(builder build_0, (int, slice, cell, int) v) inline_ref { +builder __gen_write_SampleJetion(builder build_0, (int, slice, cell, int) v) inline_ref { var (v'totalSupply, v'owner, v'content, v'mintable) = v; build_0 = build_0.store_coins(v'totalSupply); build_0 = __tact_store_address(build_0, v'owner); @@ -146,7 +146,7 @@ builder __gen_write_SampleJetton(builder build_0, (int, slice, cell, int) v) inl return build_0; } -(slice, ((int, slice, cell, int))) __gen_read_SampleJetton(slice sc_0) inline_ref { +(slice, ((int, slice, cell, int))) __gen_read_SampleJetion(slice sc_0) inline_ref { var v'totalSupply = sc_0~load_coins(); var v'owner = sc_0~__tact_load_address(); var v'content = sc_0~load_int(1) ? sc_0~load_ref() : null(); @@ -164,21 +164,21 @@ _ __gen_Context_get_sender((int, slice, int, slice) v) inline { return v'sender; } -(int, int, slice, cell, cell) __gen_JettonData_to_external(((int, int, slice, cell, cell)) v) { +(int, int, slice, cell, cell) __gen_JetionData_to_external(((int, int, slice, cell, cell)) v) { var (v'totalSupply, v'mintable, v'owner, v'content, v'walletCode) = v; return (v'totalSupply, v'mintable, v'owner, v'content, v'walletCode); } -(int, slice, cell, int) __gen_load_SampleJetton() inline_ref { +(int, slice, cell, int) __gen_load_SampleJetion() inline_ref { slice sc = get_data().begin_parse(); __tact_context_sys = sc~load_ref(); - return sc~__gen_read_SampleJetton(); + return sc~__gen_read_SampleJetion(); } -() __gen_store_SampleJetton((int, slice, cell, int) v) impure inline_ref { +() __gen_store_SampleJetion((int, slice, cell, int) v) impure inline_ref { builder b = begin_cell(); b = b.store_ref(__tact_context_sys); - b = __gen_write_SampleJetton(b, v); + b = __gen_write_SampleJetion(b, v); set_data(b.end_cell()); } @@ -243,120 +243,120 @@ slice $contractAddress((cell, cell) $s) impure { send_raw_message($c, $params'mode); } -cell $__gen_JettonDefaultWallet_init(cell sys', slice $master, slice $owner) { +cell $__gen_JetionDefaultWallet_init(cell sys', slice $master, slice $owner) { var (($self'balance, $self'owner, $self'master)) = (null(), null(), null()); $self'balance = 0; $self'owner = $owner; $self'master = $master; var b' = begin_cell(); b' = b'.store_ref(sys'); - b' = __gen_write_JettonDefaultWallet(b', ($self'balance, $self'owner, $self'master)); + b' = __gen_write_JetionDefaultWallet(b', ($self'balance, $self'owner, $self'master)); return b'.end_cell(); } -(cell, cell) $__gen_JettonDefaultWallet_init_child(cell sys', slice $master, slice $owner) { +(cell, cell) $__gen_JetionDefaultWallet_init_child(cell sys', slice $master, slice $owner) { slice sc' = sys'.begin_parse(); cell source = sc'~load_dict(); cell contracts = new_dict(); - ;; Contract Code: JettonDefaultWallet + ;; Contract Code: JetionDefaultWallet cell mine = __tact_dict_get_code(source, 55471); contracts = __tact_dict_set_code(contracts, 55471, mine); cell sys = begin_cell().store_dict(contracts).end_cell(); - return (mine, $__gen_JettonDefaultWallet_init(sys, $master, $owner)); + return (mine, $__gen_JetionDefaultWallet_init(sys, $master, $owner)); } -((int, slice, cell, int), (cell, cell)) $__gen_SampleJetton_getJettonWalletInit((int, slice, cell, int) $self, slice $address) impure { +((int, slice, cell, int), (cell, cell)) $__gen_SampleJetion_getJetionWalletInit((int, slice, cell, int) $self, slice $address) impure { var (($self'totalSupply, $self'owner, $self'content, $self'mintable)) = $self; - return (($self'totalSupply, $self'owner, $self'content, $self'mintable), $__gen_JettonDefaultWallet_init_child(__tact_context_sys, my_address(), $address)); + return (($self'totalSupply, $self'owner, $self'content, $self'mintable), $__gen_JetionDefaultWallet_init_child(__tact_context_sys, my_address(), $address)); } -slice $__gen_SampleJetton_get_wallet_address((int, slice, cell, int) $self, slice $owner) impure { +slice $__gen_SampleJetion_get_wallet_address((int, slice, cell, int) $self, slice $owner) impure { var (($self'totalSupply, $self'owner, $self'content, $self'mintable)) = $self; - var ($winit'code, $winit'data) = ($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetton_getJettonWalletInit($owner); + var ($winit'code, $winit'data) = ($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetion_getJetionWalletInit($owner); return $contractAddress(($winit'code, $winit'data)); } _ $__gen_get_get_wallet_address(slice $$owner) method_id(103289) { slice $owner = $$owner; - var self = __gen_load_SampleJetton(); - var res = $__gen_SampleJetton_get_wallet_address(self, $owner); + var self = __gen_load_SampleJetion(); + var res = $__gen_SampleJetion_get_wallet_address(self, $owner); return res; } -(int, int, slice, cell, cell) $__gen_SampleJetton_get_jetton_data((int, slice, cell, int) $self) impure { +(int, int, slice, cell, cell) $__gen_SampleJetion_get_jetion_data((int, slice, cell, int) $self) impure { var (($self'totalSupply, $self'owner, $self'content, $self'mintable)) = $self; - cell $code = __gen_StateInit_get_code(($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetton_getJettonWalletInit(my_address())); + cell $code = __gen_StateInit_get_code(($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetion_getJetionWalletInit(my_address())); return ($self'totalSupply, $self'mintable, $self'owner, $self'content, $code); } -_ $__gen_get_get_jetton_data() method_id(106029) { - var self = __gen_load_SampleJetton(); - var res = $__gen_SampleJetton_get_jetton_data(self); - return __gen_JettonData_to_external(res); +_ $__gen_get_get_jetion_data() method_id(106029) { + var self = __gen_load_SampleJetion(); + var res = $__gen_SampleJetion_get_jetion_data(self); + return __gen_JetionData_to_external(res); } -((int, slice, cell, int), ()) $__gen_SampleJetton_mint((int, slice, cell, int) $self, slice $to, int $amount, slice $responseAddress) impure { +((int, slice, cell, int), ()) $__gen_SampleJetion_mint((int, slice, cell, int) $self, slice $to, int $amount, slice $responseAddress) impure { var (($self'totalSupply, $self'owner, $self'content, $self'mintable)) = $self; $self'totalSupply = ($self'totalSupply + $amount); - var ($winit'code, $winit'data) = ($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetton_getJettonWalletInit($to); + var ($winit'code, $winit'data) = ($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetion_getJetionWalletInit($to); slice $walletAddress = $contractAddress(($winit'code, $winit'data)); $send((false, $walletAddress, 0, 64, __gen_writecell_TokenTransferInternal((0, $amount, my_address(), $responseAddress, 0, $emptySlice())), $winit'code, $winit'data)); return (($self'totalSupply, $self'owner, $self'content, $self'mintable), ()); } -((int, slice, cell, int), ()) $__gen_SampleJetton_requireWallet((int, slice, cell, int) $self, slice $owner) impure { +((int, slice, cell, int), ()) $__gen_SampleJetion_requireWallet((int, slice, cell, int) $self, slice $owner) impure { var (($self'totalSupply, $self'owner, $self'content, $self'mintable)) = $self; var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); - var ($winit'code, $winit'data) = ($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetton_getJettonWalletInit($owner); + var ($winit'code, $winit'data) = ($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetion_getJetionWalletInit($owner); throw_unless(4429, __tact_address_eq($contractAddress(($winit'code, $winit'data)), $ctx'sender)); return (($self'totalSupply, $self'owner, $self'content, $self'mintable), ()); } -((int, slice, cell, int), ()) $__gen_SampleJetton_requireOwner((int, slice, cell, int) $self) impure { +((int, slice, cell, int), ()) $__gen_SampleJetion_requireOwner((int, slice, cell, int) $self) impure { var (($self'totalSupply, $self'owner, $self'content, $self'mintable)) = $self; throw_unless(132, __tact_address_eq(__gen_Context_get_sender(__tact_context_get()), $self'owner)); return (($self'totalSupply, $self'owner, $self'content, $self'mintable), ()); } -slice $__gen_SampleJetton_owner((int, slice, cell, int) $self) impure { +slice $__gen_SampleJetion_owner((int, slice, cell, int) $self) impure { var (($self'totalSupply, $self'owner, $self'content, $self'mintable)) = $self; return $self'owner; } _ $__gen_get_owner() method_id(83229) { - var self = __gen_load_SampleJetton(); - var res = $__gen_SampleJetton_owner(self); + var self = __gen_load_SampleJetion(); + var res = $__gen_SampleJetion_owner(self); return res; } -(((int, slice, cell, int)), ()) $__gen_SampleJetton_receive_Mint((int, slice, cell, int) $self, (int) $msg) impure { +(((int, slice, cell, int)), ()) $__gen_SampleJetion_receive_Mint((int, slice, cell, int) $self, (int) $msg) impure { var ($self'totalSupply, $self'owner, $self'content, $self'mintable) = $self; var ($msg'amount) = $msg; var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); - ($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetton_mint($ctx'sender, $msg'amount, $ctx'sender); + ($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetion_mint($ctx'sender, $msg'amount, $ctx'sender); return (($self'totalSupply, $self'owner, $self'content, $self'mintable), ()); } -((int, slice, cell, int), ()) $__gen_SampleJetton_receive_comment_cd0d986cb1a2f468ae7089f4fc3162c116e5f53fbd11a6839f52dbf5040830b2((int, slice, cell, int) $self) impure { +((int, slice, cell, int), ()) $__gen_SampleJetion_receive_comment_cd0d986cb1a2f468ae7089f4fc3162c116e5f53fbd11a6839f52dbf5040830b2((int, slice, cell, int) $self) impure { var ($self'totalSupply, $self'owner, $self'content, $self'mintable) = $self; var ($ctx'bounced, $ctx'sender, $ctx'value, $ctx'raw) = __tact_context_get(); - ($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetton_mint($ctx'sender, 1000000000, $ctx'sender); + ($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetion_mint($ctx'sender, 1000000000, $ctx'sender); return (($self'totalSupply, $self'owner, $self'content, $self'mintable), ()); } -(((int, slice, cell, int)), ()) $__gen_SampleJetton_receive_TokenUpdateContent((int, slice, cell, int) $self, (cell) $msg) impure { +(((int, slice, cell, int)), ()) $__gen_SampleJetion_receive_TokenUpdateContent((int, slice, cell, int) $self, (cell) $msg) impure { var ($self'totalSupply, $self'owner, $self'content, $self'mintable) = $self; var ($msg'content) = $msg; - ($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetton_requireOwner(); + ($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetion_requireOwner(); $self'content = $msg'content; return (($self'totalSupply, $self'owner, $self'content, $self'mintable), ()); } -(((int, slice, cell, int)), ()) $__gen_SampleJetton_receive_TokenBurnNotification((int, slice, cell, int) $self, (int, int, slice, slice) $msg) impure { +(((int, slice, cell, int)), ()) $__gen_SampleJetion_receive_TokenBurnNotification((int, slice, cell, int) $self, (int, int, slice, slice) $msg) impure { var ($self'totalSupply, $self'owner, $self'content, $self'mintable) = $self; var ($msg'queryId, $msg'amount, $msg'owner, $msg'responseAddress) = $msg; - ($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetton_requireWallet($msg'owner); + ($self'totalSupply, $self'owner, $self'content, $self'mintable)~$__gen_SampleJetion_requireWallet($msg'owner); $self'totalSupply = ($self'totalSupply - $msg'amount); if ((~ null?($msg'responseAddress))) { $send((false, $msg'responseAddress, 0, (64 + 2), __gen_writecell_TokenExcesses(($msg'queryId)), null(), null())); @@ -385,28 +385,28 @@ _ $__gen_get_owner() method_id(83229) { ;; Receive Mint message if (op == 33240155) { - var self = __gen_load_SampleJetton(); + var self = __gen_load_SampleJetion(); var msg = in_msg~__gen_read_Mint(); - self~$__gen_SampleJetton_receive_Mint(msg); - __gen_store_SampleJetton(self); + self~$__gen_SampleJetion_receive_Mint(msg); + __gen_store_SampleJetion(self); return (); } ;; Receive TokenUpdateContent message if (op == 201882270) { - var self = __gen_load_SampleJetton(); + var self = __gen_load_SampleJetion(); var msg = in_msg~__gen_read_TokenUpdateContent(); - self~$__gen_SampleJetton_receive_TokenUpdateContent(msg); - __gen_store_SampleJetton(self); + self~$__gen_SampleJetion_receive_TokenUpdateContent(msg); + __gen_store_SampleJetion(self); return (); } ;; Receive TokenBurnNotification message if (op == 2078119902) { - var self = __gen_load_SampleJetton(); + var self = __gen_load_SampleJetion(); var msg = in_msg~__gen_read_TokenBurnNotification(); - self~$__gen_SampleJetton_receive_TokenBurnNotification(msg); - __gen_store_SampleJetton(self); + self~$__gen_SampleJetion_receive_TokenBurnNotification(msg); + __gen_store_SampleJetion(self); return (); } @@ -416,9 +416,9 @@ _ $__gen_get_owner() method_id(83229) { ;; Receive "Mint!" message if (text_op == 0xcd0d986cb1a2f468ae7089f4fc3162c116e5f53fbd11a6839f52dbf5040830b2) { - var self = __gen_load_SampleJetton(); - self~$__gen_SampleJetton_receive_comment_cd0d986cb1a2f468ae7089f4fc3162c116e5f53fbd11a6839f52dbf5040830b2(); - __gen_store_SampleJetton(self); + var self = __gen_load_SampleJetion(); + self~$__gen_SampleJetion_receive_comment_cd0d986cb1a2f468ae7089f4fc3162c116e5f53fbd11a6839f52dbf5040830b2(); + __gen_store_SampleJetion(self); return (); } } @@ -428,10 +428,10 @@ _ $__gen_get_owner() method_id(83229) { _ supported_interfaces() method_id { return ( - "org.ton.introspection.v0"H >> 128, - "org.ton.abi.ipfs.v0"H >> 128, - "org.ton.jetton.master"H >> 128, - "org.ton.ownable"H >> 128 + "org.ion.introspection.v0"H >> 128, + "org.ion.abi.ipfs.v0"H >> 128, + "org.ion.jetion.master"H >> 128, + "org.ion.ownable"H >> 128 ); } diff --git a/crypto/func/auto-tests/legacy_tests/tact-examples/maps_MapTestContract.code.fc b/crypto/func/auto-tests/legacy_tests/tact-examples/maps_MapTestContract.code.fc index 833e9d1aa..afd80c43e 100644 --- a/crypto/func/auto-tests/legacy_tests/tact-examples/maps_MapTestContract.code.fc +++ b/crypto/func/auto-tests/legacy_tests/tact-examples/maps_MapTestContract.code.fc @@ -593,8 +593,8 @@ _ $__gen_get_addrMap4Value(slice $$key) method_id(100021) { _ supported_interfaces() method_id { return ( - "org.ton.introspection.v0"H >> 128, - "org.ton.abi.ipfs.v0"H >> 128 + "org.ion.introspection.v0"H >> 128, + "org.ion.abi.ipfs.v0"H >> 128 ); } diff --git a/crypto/func/auto-tests/legacy_tests/tact-examples/stdlib.fc b/crypto/func/auto-tests/legacy_tests/tact-examples/stdlib.fc index 3531608a7..26749540d 100644 --- a/crypto/func/auto-tests/legacy_tests/tact-examples/stdlib.fc +++ b/crypto/func/auto-tests/legacy_tests/tact-examples/stdlib.fc @@ -4,7 +4,7 @@ {- # Tuple manipulation primitives The names and the types are mostly self-explaining. - See [polymorhism with forall](https://ton.org/docs/#/func/functions?id=polymorphism-with-forall) + See [polymorhism with forall](https://ion.org/docs/#/func/functions?id=polymorphism-with-forall) for more info on the polymorphic functions. Note that currently values of atomic type `tuple` can't be cast to composite tuple type (e.g. `[int, cell]`) @@ -112,7 +112,7 @@ int now() asm "NOW"; slice my_address() asm "MYADDR"; ;;; Returns the balance of the smart contract as a tuple consisting of an int -;;; (balance in nanotoncoins) and a `cell` +;;; (balance in nanoioncoins) and a `cell` ;;; (a dictionary with 32-bit keys representing the balance of "extra currencies") ;;; at the start of Computation Phase. ;;; Note that RAW primitives such as [send_raw_message] do not update this field. @@ -229,7 +229,7 @@ cont bless(slice s) impure asm "BLESS"; ;;; In other words, the current smart contract agrees to buy some gas to finish the current transaction. ;;; This action is required to process external messages, which bring no value (hence no gas) with themselves. ;;; -;;; For more details check [accept_message effects](https://ton.org/docs/#/smart-contracts/accept). +;;; For more details check [accept_message effects](https://ion.org/docs/#/smart-contracts/accept). () accept_message() impure asm "ACCEPT"; ;;; Sets current gas limit `gl` to the minimum of limit and `gm`, and resets the gas credit `gc` to zero. @@ -246,7 +246,7 @@ cont bless(slice s) impure asm "BLESS"; ;;; Not implemented ;;() buy_gas(int gram) impure asm "BUYGAS"; -;;; Computes the amount of gas that can be bought for `amount` nanoTONs, +;;; Computes the amount of gas that can be bought for `amount` nanoIONs, ;;; and sets `gl` accordingly in the same way as [set_gas_limit]. () buy_gas(int amount) impure asm "BUYGAS"; @@ -267,17 +267,17 @@ int abs(int x) asm "ABS"; It is said that a primitive _loads_ some data, if it returns the data and the remainder of the slice - (so it can also be used as [modifying method](https://ton.org/docs/#/func/statements?id=modifying-methods)). + (so it can also be used as [modifying method](https://ion.org/docs/#/func/statements?id=modifying-methods)). It is said that a primitive _preloads_ some data, if it returns only the data - (it can be used as [non-modifying method](https://ton.org/docs/#/func/statements?id=non-modifying-methods)). + (it can be used as [non-modifying method](https://ion.org/docs/#/func/statements?id=non-modifying-methods)). Unless otherwise stated, loading and preloading primitives read the data from a prefix of the slice. -} ;;; Converts a `cell` [c] into a `slice`. Notice that [c] must be either an ordinary cell, -;;; or an exotic cell (see [TVM.pdf](https://ton-blockchain.github.io/docs/tvm.pdf), 3.1.2) +;;; or an exotic cell (see [TVM.pdf](https://ice-blockchain.github.io/docs/tvm.pdf), 3.1.2) ;;; which is automatically loaded to yield an ordinary cell `c'`, converted into a `slice` afterwards. slice begin_parse(cell c) asm "CTOS"; @@ -401,7 +401,7 @@ int builder_depth(builder b) asm "BDEPTH"; # Builder primitives It is said that a primitive _stores_ a value `x` into a builder `b` if it returns a modified version of the builder `b'` with the value `x` stored at the end of it. - It can be used as [non-modifying method](https://ton.org/docs/#/func/statements?id=non-modifying-methods). + It can be used as [non-modifying method](https://ion.org/docs/#/func/statements?id=non-modifying-methods). All the primitives below first check whether there is enough space in the `builder`, and only then check the range of the value being serialized. @@ -595,7 +595,7 @@ cell config_param(int x) asm "CONFIGOPTPARAM"; ;;; Checks whether c is a null. Note, that FunC also has polymorphic null? built-in. int cell_null?(cell c) asm "ISNULL"; -;;; Creates an output action which would reserve exactly amount nanotoncoins (if mode = 0), at most amount nanotoncoins (if mode = 2), or all but amount nanotoncoins (if mode = 1 or mode = 3), from the remaining balance of the account. It is roughly equivalent to creating an outbound message carrying amount nanotoncoins (or b − amount nanotoncoins, where b is the remaining balance) to oneself, so that the subsequent output actions would not be able to spend more money than the remainder. Bit +2 in mode means that the external action does not fail if the specified amount cannot be reserved; instead, all remaining balance is reserved. Bit +8 in mode means `amount <- -amount` before performing any further actions. Bit +4 in mode means that amount is increased by the original balance of the current account (before the compute phase), including all extra currencies, before performing any other checks and actions. Currently, amount must be a non-negative integer, and mode must be in the range 0..15. +;;; Creates an output action which would reserve exactly amount nanoioncoins (if mode = 0), at most amount nanoioncoins (if mode = 2), or all but amount nanoioncoins (if mode = 1 or mode = 3), from the remaining balance of the account. It is roughly equivalent to creating an outbound message carrying amount nanoioncoins (or b − amount nanoioncoins, where b is the remaining balance) to oneself, so that the subsequent output actions would not be able to spend more money than the remainder. Bit +2 in mode means that the external action does not fail if the specified amount cannot be reserved; instead, all remaining balance is reserved. Bit +8 in mode means `amount <- -amount` before performing any further actions. Bit +4 in mode means that amount is increased by the original balance of the current account (before the compute phase), including all extra currencies, before performing any other checks and actions. Currently, amount must be a non-negative integer, and mode must be in the range 0..15. () raw_reserve(int amount, int mode) impure asm "RAWRESERVE"; ;;; Similar to raw_reserve, but also accepts a dictionary extra_amount (represented by a cell or null) with extra currencies. In this way currencies other than TonCoin can be reserved. () raw_reserve_extra(int amount, cell extra_amount, int mode) impure asm "RAWRESERVEX"; diff --git a/crypto/func/auto-tests/legacy_tests/tact-examples/treasure_Treasure.code.fc b/crypto/func/auto-tests/legacy_tests/tact-examples/treasure_Treasure.code.fc index e4fc974fb..63a62d59c 100644 --- a/crypto/func/auto-tests/legacy_tests/tact-examples/treasure_Treasure.code.fc +++ b/crypto/func/auto-tests/legacy_tests/tact-examples/treasure_Treasure.code.fc @@ -217,10 +217,10 @@ _ $__gen_get_owner() method_id(83229) { _ supported_interfaces() method_id { return ( - "org.ton.introspection.v0"H >> 128, - "org.ton.abi.ipfs.v0"H >> 128, - "org.ton.ownable.transferable"H >> 128, - "org.ton.ownable"H >> 128 + "org.ion.introspection.v0"H >> 128, + "org.ion.abi.ipfs.v0"H >> 128, + "org.ion.ownable.transferable"H >> 128, + "org.ion.ownable"H >> 128 ); } diff --git a/crypto/func/auto-tests/legacy_tests/tele-nft-item/common.fc b/crypto/func/auto-tests/legacy_tests/tele-nft-item/common.fc index 4527fe3d9..a424d38b5 100644 --- a/crypto/func/auto-tests/legacy_tests/tele-nft-item/common.fc +++ b/crypto/func/auto-tests/legacy_tests/tele-nft-item/common.fc @@ -1,5 +1,5 @@ -const int one_ton = 1000000000; -const int dns_next_resolver_prefix = 0xba93; ;; dns_next_resolver prefix - https://github.com/ton-blockchain/ton/blob/7e3df93ca2ab336716a230fceb1726d81bac0a06/crypto/block/block.tlb#L819 +const int one_ion = 1000000000; +const int dns_next_resolver_prefix = 0xba93; ;; dns_next_resolver prefix - https://github.com/ice-blockchain/ion/blob/7e3df93ca2ab336716a230fceb1726d81bac0a06/crypto/block/block.tlb#L819 const int op::fill_up = 0x370fec51; const int op::outbid_notification = 0x557cea20; @@ -53,7 +53,7 @@ const int err::incorrect_workchain = 333; const int err::no_first_zero_byte = 413; const int err::bad_subdomain_length = 70; -const int min_tons_for_storage = one_ton; +const int min_ions_for_storage = one_ion; const int workchain = 0; int equal_slices(slice a, slice b) asm "SDEQ"; @@ -68,7 +68,7 @@ slice zero_address() asm "b{00} PUSHSLICE"; } -;; "ton\0test\0" -> "ton" +;; "ion\0test\0" -> "ion" int get_top_domain_bits(slice domain) inline { int i = -8; int char = 1; diff --git a/crypto/func/auto-tests/legacy_tests/tele-nft-item/nft-item.fc b/crypto/func/auto-tests/legacy_tests/tele-nft-item/nft-item.fc index 93c18edae..b0870162d 100644 --- a/crypto/func/auto-tests/legacy_tests/tele-nft-item/nft-item.fc +++ b/crypto/func/auto-tests/legacy_tests/tele-nft-item/nft-item.fc @@ -2,7 +2,7 @@ #include "common.fc"; int send_money(int my_balance, slice address, int value) impure { - int amount_to_send = min(my_balance - min_tons_for_storage, value); + int amount_to_send = min(my_balance - min_ions_for_storage, value); if (amount_to_send > 0) { send_msg(address, amount_to_send, op::fill_up, cur_lt(), null(), 2); ;; ignore errors my_balance -= amount_to_send; @@ -61,10 +61,10 @@ int send_money(int my_balance, slice address, int value) impure { new_end_time = 0; } ;; step is at least GR$1 - int new_min_bid = max(new_bid + one_ton, (new_bid * (100 + min_bid_step) + 99) / 100); + int new_min_bid = max(new_bid + one_ion, (new_bid * (100 + min_bid_step) + 99) / 100); ifnot (cell_null?(old_last_bid)) { (slice old_bidder_address, int old_bid, _) = unpack_last_bid(old_last_bid); - int to_send = min(my_balance - min_tons_for_storage, old_bid); + int to_send = min(my_balance - min_ions_for_storage, old_bid); if (to_send > 0) { send_msg(old_bidder_address, to_send, op::outbid_notification, cur_lt(), null(), 1); my_balance -= to_send; @@ -78,7 +78,7 @@ cell prepare_auction(cell auction_config) { (slice beneficiary_address, int initial_min_bid, int max_bid, int min_bid_step, int min_extend_time, int duration) = unpack_auction_config(auction_config); ;; check beneficiary address parse_std_addr(beneficiary_address); - if ((initial_min_bid < 2 * min_tons_for_storage) | ((max_bid != 0) & (max_bid < initial_min_bid)) | + if ((initial_min_bid < 2 * min_ions_for_storage) | ((max_bid != 0) & (max_bid < initial_min_bid)) | (min_bid_step <= 0) | (min_extend_time > 60 * 60 * 24 * 7) | (duration > 60 * 60 * 24 * 365)) { return null(); } @@ -106,7 +106,7 @@ slice transfer_ownership(int my_balance, slice owner_address, slice in_msg_body, force_chain(new_owner_address); - int rest_amount = my_balance - min_tons_for_storage; + int rest_amount = my_balance - min_ions_for_storage; if (forward_amount) { rest_amount -= (forward_amount + fwd_fees); } diff --git a/crypto/func/auto-tests/legacy_tests/uni-lock-wallet/uni-lockup-wallet.fc b/crypto/func/auto-tests/legacy_tests/uni-lock-wallet/uni-lockup-wallet.fc index 2fd109370..67c2d2c52 100644 --- a/crypto/func/auto-tests/legacy_tests/uni-lock-wallet/uni-lockup-wallet.fc +++ b/crypto/func/auto-tests/legacy_tests/uni-lock-wallet/uni-lockup-wallet.fc @@ -200,8 +200,8 @@ int get_public_key() method_id { total_restricted_value, restricted) = unpack_data(); (restricted, total_restricted_value) = unlock_grams(restricted, total_restricted_value, time); (locked, total_locked_value) = unlock_grams(locked, total_locked_value, time); - int ton_balance = get_balance().pair_first(); - return ( ton_balance, + int ion_balance = get_balance().pair_first(); + return ( ion_balance, total_restricted_value, total_locked_value ); } diff --git a/crypto/func/auto-tests/legacy_tests/wallet-v4/wallet-v4-code.fc b/crypto/func/auto-tests/legacy_tests/wallet-v4/wallet-v4-code.fc index 21245a676..2ceb161d0 100644 --- a/crypto/func/auto-tests/legacy_tests/wallet-v4/wallet-v4-code.fc +++ b/crypto/func/auto-tests/legacy_tests/wallet-v4/wallet-v4-code.fc @@ -36,14 +36,14 @@ var msg = begin_cell(); if (op == 0x706c7567) { ;; request funds - (int r_toncoins, cell r_extra) = (in_msg~load_grams(), in_msg~load_dict()); + (int r_ioncoins, cell r_extra) = (in_msg~load_grams(), in_msg~load_dict()); [int my_balance, _] = get_balance(); - throw_unless(80, my_balance - msg_value >= r_toncoins); + throw_unless(80, my_balance - msg_value >= r_ioncoins); msg = msg.store_uint(0x18, 6) .store_slice(s_addr) - .store_grams(r_toncoins) + .store_grams(r_ioncoins) .store_dict(r_extra) .store_uint(0, 4 + 4 + 64 + 32 + 1 + 1) .store_uint(0x706c7567 | 0x80000000, 32) diff --git a/crypto/func/auto-tests/legacy_tests/whales-nominators/LICENSE b/crypto/func/auto-tests/legacy_tests/whales-nominators/LICENSE index 70b5b1cf6..2ef470edd 100644 --- a/crypto/func/auto-tests/legacy_tests/whales-nominators/LICENSE +++ b/crypto/func/auto-tests/legacy_tests/whales-nominators/LICENSE @@ -1,4 +1,4 @@ -AUTHOR: https://github.com/ton-foundation/ton-nominators +AUTHOR: https://github.com/ion-foundation/ion-nominators GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 diff --git a/crypto/func/auto-tests/legacy_tests/whales-nominators/modules/constants.fc b/crypto/func/auto-tests/legacy_tests/whales-nominators/modules/constants.fc index 7187fef0b..6b6ba386a 100644 --- a/crypto/func/auto-tests/legacy_tests/whales-nominators/modules/constants.fc +++ b/crypto/func/auto-tests/legacy_tests/whales-nominators/modules/constants.fc @@ -77,20 +77,20 @@ int coins::100() asm "100000000000 PUSHINT"; ;; Fees ;; -int fees::storage_reserve() asm "1000000000 PUSHINT"; ;; 1 TON -int fees::receipt() asm "100000000 PUSHINT"; ;; 0.1 TON -int fees::op() asm "100000000 PUSHINT"; ;; 0.1 TON -int fees::deploy() asm "5000000000 PUSHINT"; ;; 5 TON -int fees::stake_fees() asm "2000000000 PUSHINT"; ;; 2 TON +int fees::storage_reserve() asm "1000000000 PUSHINT"; ;; 1 ION +int fees::receipt() asm "100000000 PUSHINT"; ;; 0.1 ION +int fees::op() asm "100000000 PUSHINT"; ;; 0.1 ION +int fees::deploy() asm "5000000000 PUSHINT"; ;; 5 ION +int fees::stake_fees() asm "2000000000 PUSHINT"; ;; 2 ION ;; ;; Parameters ;; -int params::min_op() asm "100000000 PUSHINT"; ;; 0.1 TON -int params::min_stake() asm "1000000000 PUSHINT"; ;; 1 TON -int params::min_fee() asm "1000000000 PUSHINT"; ;; 1 TON -int params::pending_op() asm "5000000000 PUSHINT"; ;; 5 TON +int params::min_op() asm "100000000 PUSHINT"; ;; 0.1 ION +int params::min_stake() asm "1000000000 PUSHINT"; ;; 1 ION +int params::min_fee() asm "1000000000 PUSHINT"; ;; 1 ION +int params::pending_op() asm "5000000000 PUSHINT"; ;; 5 ION int params::ppc_precision() asm "10000000000000 PUSHINT"; ;; 10^13 ;; diff --git a/crypto/func/auto-tests/legacy_tests/whales-nominators/modules/get.fc b/crypto/func/auto-tests/legacy_tests/whales-nominators/modules/get.fc index c9152e1cc..6da1f4a3a 100644 --- a/crypto/func/auto-tests/legacy_tests/whales-nominators/modules/get.fc +++ b/crypto/func/auto-tests/legacy_tests/whales-nominators/modules/get.fc @@ -119,7 +119,7 @@ _ get_member(slice address) method_id { _ supported_interfaces() method_id { return ( - 123515602279859691144772641439386770278, ;; org.ton.introspection.v0 - 256184278959413194623484780286929323492 ;; com.tonwhales.nominators:v0 + 123515602279859691144772641439386770278, ;; org.ion.introspection.v0 + 256184278959413194623484780286929323492 ;; com.ionwhales.nominators:v0 ); } \ No newline at end of file diff --git a/crypto/func/builtins.cpp b/crypto/func/builtins.cpp index cf3adf418..11687ddc4 100644 --- a/crypto/func/builtins.cpp +++ b/crypto/func/builtins.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/func/codegen.cpp b/crypto/func/codegen.cpp index de45c8418..40bab1768 100644 --- a/crypto/func/codegen.cpp +++ b/crypto/func/codegen.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/func/func-main.cpp b/crypto/func/func-main.cpp index c8208eeea..35a9f20cc 100644 --- a/crypto/func/func-main.cpp +++ b/crypto/func/func-main.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. diff --git a/crypto/func/func.cpp b/crypto/func/func.cpp index 39648c05a..4dc96e088 100644 --- a/crypto/func/func.cpp +++ b/crypto/func/func.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. diff --git a/crypto/func/func.h b/crypto/func/func.h index e2476911d..dd0a80b4c 100644 --- a/crypto/func/func.h +++ b/crypto/func/func.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/func/gen-abscode.cpp b/crypto/func/gen-abscode.cpp index 9989d10c4..51f7da07a 100644 --- a/crypto/func/gen-abscode.cpp +++ b/crypto/func/gen-abscode.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/func/keywords.cpp b/crypto/func/keywords.cpp index fedce9db2..c092801c7 100644 --- a/crypto/func/keywords.cpp +++ b/crypto/func/keywords.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/func/optimize.cpp b/crypto/func/optimize.cpp index 74bb97ecd..91a24289f 100644 --- a/crypto/func/optimize.cpp +++ b/crypto/func/optimize.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/func/parse-func.cpp b/crypto/func/parse-func.cpp index 15794c425..8d921b070 100644 --- a/crypto/func/parse-func.cpp +++ b/crypto/func/parse-func.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -1049,7 +1049,7 @@ blk_fl::val parse_repeat_stmt(Lexer& lex, CodeBlob& code) { } std::vector tmp_vars = expr->pre_compile(code); if (tmp_vars.size() != 1) { - lex.cur().error("repeat count value is not a singleton"); + lex.cur().error("repeat count value is not a singleion"); } Op& repeat_op = code.emplace_back(loc, Op::_Repeat, tmp_vars); code.push_set_cur(repeat_op.block0); @@ -1076,7 +1076,7 @@ blk_fl::val parse_while_stmt(Lexer& lex, CodeBlob& code) { while_op.left = expr->pre_compile(code); code.close_pop_cur(lex.cur().loc); if (while_op.left.size() != 1) { - lex.cur().error("while condition value is not a singleton"); + lex.cur().error("while condition value is not a singleion"); } code.push_set_cur(while_op.block1); blk_fl::val res1 = parse_block_stmt(lex, code); @@ -1105,7 +1105,7 @@ blk_fl::val parse_do_stmt(Lexer& lex, CodeBlob& code) { while_op.left = expr->pre_compile(code); code.close_pop_cur(lex.cur().loc); if (while_op.left.size() != 1) { - lex.cur().error("`until` condition value is not a singleton"); + lex.cur().error("`until` condition value is not a singleion"); } return res & ~blk_fl::empty; } @@ -1156,7 +1156,7 @@ blk_fl::val parse_if_stmt(Lexer& lex, CodeBlob& code, int first_lex = _If) { } std::vector tmp_vars = expr->pre_compile(code); if (tmp_vars.size() != 1) { - lex.cur().error("condition value is not a singleton"); + lex.cur().error("condition value is not a singleion"); } Op& if_op = code.emplace_back(loc, Op::_If, tmp_vars); code.push_set_cur(if_op.block0); diff --git a/crypto/func/stack-transform.cpp b/crypto/func/stack-transform.cpp index b52906086..a3209b308 100644 --- a/crypto/func/stack-transform.cpp +++ b/crypto/func/stack-transform.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/func/unify-types.cpp b/crypto/func/unify-types.cpp index f9b639c0e..c103640bc 100644 --- a/crypto/func/unify-types.cpp +++ b/crypto/func/unify-types.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/funcfiftlib/funcfiftlib.cpp b/crypto/funcfiftlib/funcfiftlib.cpp index 403c075dd..74553d9c8 100644 --- a/crypto/funcfiftlib/funcfiftlib.cpp +++ b/crypto/funcfiftlib/funcfiftlib.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. diff --git a/crypto/openssl/bignum.cpp b/crypto/openssl/bignum.cpp index 9b6bf637b..45467e8c0 100644 --- a/crypto/openssl/bignum.cpp +++ b/crypto/openssl/bignum.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/openssl/bignum.h b/crypto/openssl/bignum.h index 032dbb025..fe1ae476f 100644 --- a/crypto/openssl/bignum.h +++ b/crypto/openssl/bignum.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/openssl/digest.h b/crypto/openssl/digest.h index d0dfc4c08..4ac011a5c 100644 --- a/crypto/openssl/digest.h +++ b/crypto/openssl/digest.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2019 Telegram Systems LLP */ diff --git a/crypto/openssl/digest.hpp b/crypto/openssl/digest.hpp index 2adeef1d7..003e32f65 100644 --- a/crypto/openssl/digest.hpp +++ b/crypto/openssl/digest.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/openssl/rand.cpp b/crypto/openssl/rand.cpp index 57f5c05f6..ceeaa5a37 100644 --- a/crypto/openssl/rand.cpp +++ b/crypto/openssl/rand.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/openssl/rand.hpp b/crypto/openssl/rand.hpp index 6ead2be7f..4cb3126d9 100644 --- a/crypto/openssl/rand.hpp +++ b/crypto/openssl/rand.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/openssl/residue.cpp b/crypto/openssl/residue.cpp index 20c81e244..b0e6516fb 100644 --- a/crypto/openssl/residue.cpp +++ b/crypto/openssl/residue.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/openssl/residue.h b/crypto/openssl/residue.h index adea1de78..d53957671 100644 --- a/crypto/openssl/residue.h +++ b/crypto/openssl/residue.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/parser/lexer.cpp b/crypto/parser/lexer.cpp index 117f1df5a..31d3ab23a 100644 --- a/crypto/parser/lexer.cpp +++ b/crypto/parser/lexer.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/parser/lexer.h b/crypto/parser/lexer.h index 686d8eacd..d1b7a256f 100644 --- a/crypto/parser/lexer.h +++ b/crypto/parser/lexer.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/parser/srcread.cpp b/crypto/parser/srcread.cpp index 332f15393..5be9f99c6 100644 --- a/crypto/parser/srcread.cpp +++ b/crypto/parser/srcread.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/parser/srcread.h b/crypto/parser/srcread.h index 61128eff2..281ace256 100644 --- a/crypto/parser/srcread.h +++ b/crypto/parser/srcread.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/parser/symtable.cpp b/crypto/parser/symtable.cpp index d52d96482..a14fcaaef 100644 --- a/crypto/parser/symtable.cpp +++ b/crypto/parser/symtable.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/parser/symtable.h b/crypto/parser/symtable.h index 51d59dfa4..3d71aad16 100644 --- a/crypto/parser/symtable.h +++ b/crypto/parser/symtable.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/smartcont/LICENSE.LGPL b/crypto/smartcont/LICENSE.LGPL index b482fc4ed..e1621c8f2 100644 --- a/crypto/smartcont/LICENSE.LGPL +++ b/crypto/smartcont/LICENSE.LGPL @@ -2,7 +2,7 @@ Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + 51 Franklin Street, Fifth Floor, Bosion, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -464,7 +464,7 @@ convey the exclusion of warranty; and each file should have at least the You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Bosion, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. diff --git a/crypto/smartcont/config-code.fc b/crypto/smartcont/config-code.fc index b3aa04c46..1b9302d39 100644 --- a/crypto/smartcont/config-code.fc +++ b/crypto/smartcont/config-code.fc @@ -1,6 +1,6 @@ ;; Simple configuration smart contract ;; Currently deployed config-contract in mainnet can be found -;; on https://verifier.ton.org/Ef9VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVbxn +;; on https://verifier.ion.org/Ef9VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVbxn () set_conf_param(int index, cell value) impure { var cs = get_data().begin_parse(); diff --git a/crypto/smartcont/dns-auto-code.fc b/crypto/smartcont/dns-auto-code.fc index 949f15716..aa021af49 100644 --- a/crypto/smartcont/dns-auto-code.fc +++ b/crypto/smartcont/dns-auto-code.fc @@ -30,7 +30,7 @@ cell udict_get_ref_(cell dict, int key_len, int index) asm(index dict key_len) " STORED DOMAIN NAME SLICE FORMAT: (#ZeroChars<7b>) (Domain name value) #Zeros allows to simultaneously store, for example, com\0 and com\0google\0 - That will be stored as \1com\0 and \2com\0google\0 (pfx tree has restricitons) + That will be stored as \1com\0 and \2com\0google\0 (pfx tree has restriciions) This will allow to resolve more specific requests to subdomains, and resort to parent domain next resolver lookup if subdomain is not found com\0goo\0 lookup will, for example look up \2com\0goo\0 and then diff --git a/crypto/smartcont/dns-manual-code.fc b/crypto/smartcont/dns-manual-code.fc index 555e5952d..9d65a9e84 100644 --- a/crypto/smartcont/dns-manual-code.fc +++ b/crypto/smartcont/dns-manual-code.fc @@ -268,7 +268,7 @@ cell process_ops(cell root, slice ops) inline_ref { STORED DOMAIN NAME SLICE FORMAT: (#ZeroChars<7b>) (Domain name value) #Zeros allows to simultaneously store, for example, com\0 and com\0google\0 - That will be stored as \1com\0 and \2com\0google\0 (pfx tree has restricitons) + That will be stored as \1com\0 and \2com\0google\0 (pfx tree has restriciions) This will allow to resolve more specific requests to subdomains, and resort to parent domain next resolver lookup if subdomain is not found com\0goo\0 lookup will, for example look up \2com\0goo\0 and then diff --git a/crypto/smartcont/mathlib.fc b/crypto/smartcont/mathlib.fc index f2dfd73f5..dc9712780 100644 --- a/crypto/smartcont/mathlib.fc +++ b/crypto/smartcont/mathlib.fc @@ -5,7 +5,7 @@ -} {- - This file is part of TON FunC Standard Library. + This file is part of ION FunC Standard Library. FunC Standard Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/crypto/smartcont/stdlib.fc b/crypto/smartcont/stdlib.fc index 8fb27a7ea..91d04130c 100644 --- a/crypto/smartcont/stdlib.fc +++ b/crypto/smartcont/stdlib.fc @@ -2,7 +2,7 @@ ;; {- - This file is part of TON FunC Standard Library. + This file is part of ION FunC Standard Library. FunC Standard Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -19,7 +19,7 @@ {- # Tuple manipulation primitives The names and the types are mostly self-explaining. - See [polymorhism with forall](https://ton.org/docs/#/func/functions?id=polymorphism-with-forall) + See [polymorhism with forall](https://ion.org/docs/#/func/functions?id=polymorphism-with-forall) for more info on the polymorphic functions. Note that currently values of atomic type `tuple` can't be cast to composite tuple type (e.g. `[int, cell]`) @@ -127,7 +127,7 @@ int now() asm "NOW"; slice my_address() asm "MYADDR"; ;;; Returns the balance of the smart contract as a tuple consisting of an int -;;; (balance in nanotoncoins) and a `cell` +;;; (balance in nanoioncoins) and a `cell` ;;; (a dictionary with 32-bit keys representing the balance of "extra currencies") ;;; at the start of Computation Phase. ;;; Note that RAW primitives such as [send_raw_message] do not update this field. @@ -244,7 +244,7 @@ cont bless(slice s) impure asm "BLESS"; ;;; In other words, the current smart contract agrees to buy some gas to finish the current transaction. ;;; This action is required to process external messages, which bring no value (hence no gas) with themselves. ;;; -;;; For more details check [accept_message effects](https://docs.ton.org/develop/smart-contracts/guidelines/accept). +;;; For more details check [accept_message effects](https://docs.ion.org/develop/smart-contracts/guidelines/accept). () accept_message() impure asm "ACCEPT"; ;;; Sets current gas limit `gl` to the minimum of limit and `gm`, and resets the gas credit `gc` to zero. @@ -261,7 +261,7 @@ cont bless(slice s) impure asm "BLESS"; ;;; Not implemented ;;() buy_gas(int gram) impure asm "BUYGAS"; -;;; Computes the amount of gas that can be bought for `amount` nanoTONs, +;;; Computes the amount of gas that can be bought for `amount` nanoIONs, ;;; and sets `gl` accordingly in the same way as [set_gas_limit]. () buy_gas(int amount) impure asm "BUYGAS"; @@ -282,17 +282,17 @@ int abs(int x) asm "ABS"; It is said that a primitive _loads_ some data, if it returns the data and the remainder of the slice - (so it can also be used as [modifying method](https://docs.ton.org/develop/func/statements#modifying-methods)). + (so it can also be used as [modifying method](https://docs.ion.org/develop/func/statements#modifying-methods)). It is said that a primitive _preloads_ some data, if it returns only the data - (it can be used as [non-modifying method](https://docs.ton.org/develop/func/statements#non-modifying-methods)). + (it can be used as [non-modifying method](https://docs.ion.org/develop/func/statements#non-modifying-methods)). Unless otherwise stated, loading and preloading primitives read the data from a prefix of the slice. -} ;;; Converts a `cell` [c] into a `slice`. Notice that [c] must be either an ordinary cell, -;;; or an exotic cell (see [TVM.pdf](https://ton-blockchain.github.io/docs/tvm.pdf), 3.1.2) +;;; or an exotic cell (see [TVM.pdf](https://ice-blockchain.github.io/docs/tvm.pdf), 3.1.2) ;;; which is automatically loaded to yield an ordinary cell `c'`, converted into a `slice` afterwards. slice begin_parse(cell c) asm "CTOS"; @@ -416,7 +416,7 @@ int builder_depth(builder b) asm "BDEPTH"; # Builder primitives It is said that a primitive _stores_ a value `x` into a builder `b` if it returns a modified version of the builder `b'` with the value `x` stored at the end of it. - It can be used as [non-modifying method](https://docs.ton.org/develop/func/statements#non-modifying-methods). + It can be used as [non-modifying method](https://docs.ion.org/develop/func/statements#non-modifying-methods). All the primitives below first check whether there is enough space in the `builder`, and only then check the range of the value being serialized. @@ -610,7 +610,7 @@ cell config_param(int x) asm "CONFIGOPTPARAM"; ;;; Checks whether c is a null. Note, that FunC also has polymorphic null? built-in. int cell_null?(cell c) asm "ISNULL"; -;;; Creates an output action which would reserve exactly amount nanotoncoins (if mode = 0), at most amount nanotoncoins (if mode = 2), or all but amount nanotoncoins (if mode = 1 or mode = 3), from the remaining balance of the account. It is roughly equivalent to creating an outbound message carrying amount nanotoncoins (or b − amount nanotoncoins, where b is the remaining balance) to oneself, so that the subsequent output actions would not be able to spend more money than the remainder. Bit +2 in mode means that the external action does not fail if the specified amount cannot be reserved; instead, all remaining balance is reserved. Bit +8 in mode means `amount <- -amount` before performing any further actions. Bit +4 in mode means that amount is increased by the original balance of the current account (before the compute phase), including all extra currencies, before performing any other checks and actions. Currently, amount must be a non-negative integer, and mode must be in the range 0..15. +;;; Creates an output action which would reserve exactly amount nanoioncoins (if mode = 0), at most amount nanoioncoins (if mode = 2), or all but amount nanoioncoins (if mode = 1 or mode = 3), from the remaining balance of the account. It is roughly equivalent to creating an outbound message carrying amount nanoioncoins (or b − amount nanoioncoins, where b is the remaining balance) to oneself, so that the subsequent output actions would not be able to spend more money than the remainder. Bit +2 in mode means that the external action does not fail if the specified amount cannot be reserved; instead, all remaining balance is reserved. Bit +8 in mode means `amount <- -amount` before performing any further actions. Bit +4 in mode means that amount is increased by the original balance of the current account (before the compute phase), including all extra currencies, before performing any other checks and actions. Currently, amount must be a non-negative integer, and mode must be in the range 0..15. () raw_reserve(int amount, int mode) impure asm "RAWRESERVE"; ;;; Similar to raw_reserve, but also accepts a dictionary extra_amount (represented by a cell or null) with extra currencies. In this way currencies other than TonCoin can be reserved. () raw_reserve_extra(int amount, cell extra_amount, int mode) impure asm "RAWRESERVEX"; diff --git a/crypto/smartcont/tolk-stdlib/common.tolk b/crypto/smartcont/tolk-stdlib/common.tolk index dec12e233..00ad1e848 100644 --- a/crypto/smartcont/tolk-stdlib/common.tolk +++ b/crypto/smartcont/tolk-stdlib/common.tolk @@ -120,14 +120,14 @@ fun now(): int fun getMyAddress(): slice asm "MYADDR"; -/// Returns the balance (in nanotoncoins) of the smart contract at the start of Computation Phase. +/// Returns the balance (in nanoioncoins) of the smart contract at the start of Computation Phase. /// Note that RAW primitives such as [sendMessage] do not update this field. @pure fun getMyOriginalBalance(): int asm "BALANCE" "FIRST"; /// Same as [getMyOriginalBalance], but returns a tuple: -/// `int` — balance in nanotoncoins; +/// `int` — balance in nanoioncoins; /// `cell` — a dictionary with 32-bit keys representing the balance of "extra currencies". @pure fun getMyOriginalBalanceWithExtraCurrencies(): [int, cell] @@ -325,7 +325,7 @@ fun debugDumpStack(): void */ /// Converts a `cell` [c] into a `slice`. Notice that [c] must be either an ordinary cell, -/// or an exotic cell (see [TVM.pdf](https://ton-blockchain.github.io/docs/tvm.pdf), 3.1.2) +/// or an exotic cell (see [TVM.pdf](https://ice-blockchain.github.io/docs/tvm.pdf), 3.1.2) /// which is automatically loaded to yield an ordinary cell `c'`, converted into a `slice` afterwards. @pure fun beginParse(c: cell): slice @@ -632,7 +632,7 @@ fun addressIsNone(s: slice): int Reserving Toncoins on balance and its flags. */ -/// mode = 0: Reserve exact amount of nanotoncoins +/// mode = 0: Reserve exact amount of nanoioncoins const RESERVE_MODE_EXACT_AMOUNT = 0; /// +1: Actually reserves all but amount, meaning `currentContractBalance - amount` const RESERVE_MODE_ALL_BUT_AMOUNT = 1; @@ -711,7 +711,7 @@ fun skipMessageQueryId(mutate self: slice): self fun storeMessageQueryId(mutate self: builder, queryId: int): self asm(queryId self) "64 STU"; -/// SEND MODES - https://docs.ton.org/tvm.pdf page 137, SENDRAWMSG +/// SEND MODES - https://docs.ion.org/tvm.pdf page 137, SENDRAWMSG /// mode = 0 is used for ordinary messages; the gas fees are deducted from the senging amount; action phaes should NOT be ignored. const SEND_MODE_REGULAR = 0; @@ -719,7 +719,7 @@ const SEND_MODE_REGULAR = 0; const SEND_MODE_PAY_FEES_SEPARATELY = 1; /// +2 means that any errors arising while processing this message during the action phase should be ignored. const SEND_MODE_IGNORE_ERRORS = 2; -/// in the case of action fail - bounce transaction. No effect if SEND_MODE_IGNORE_ERRORS (+2) is used. TVM UPGRADE 2023-07. https://docs.ton.org/learn/tvm-instructions/tvm-upgrade-2023-07#sending-messages +/// in the case of action fail - bounce transaction. No effect if SEND_MODE_IGNORE_ERRORS (+2) is used. TVM UPGRADE 2023-07. https://docs.ion.org/learn/tvm-instructions/tvm-upgrade-2023-07#sending-messages const SEND_MODE_BOUNCE_ON_ACTION_FAIL = 16; /// mode = 32 means that the current account must be destroyed if its resulting balance is zero. const SEND_MODE_DESTROY = 32; @@ -727,7 +727,7 @@ const SEND_MODE_DESTROY = 32; const SEND_MODE_CARRY_ALL_REMAINING_MESSAGE_VALUE = 64; /// mode = 128 is used for messages that are to carry all the remaining balance of the current smart contract (instead of the value originally indicated in the message). const SEND_MODE_CARRY_ALL_BALANCE = 128; -/// do not create an action, only estimate fee. TVM UPGRADE 2023-07. https://docs.ton.org/learn/tvm-instructions/tvm-upgrade-2023-07#sending-messages +/// do not create an action, only estimate fee. TVM UPGRADE 2023-07. https://docs.ion.org/learn/tvm-instructions/tvm-upgrade-2023-07#sending-messages const SEND_MODE_ESTIMATE_FEE_ONLY = 1024; /// Other modes affect the fee calculation as follows: /// +64 substitutes the entire balance of the incoming message as an outcoming value (slightly inaccurate, gas expenses that cannot be estimated before the computation is completed are not taken into account). diff --git a/crypto/smartcont/tolk-stdlib/gas-payments.tolk b/crypto/smartcont/tolk-stdlib/gas-payments.tolk index 1dc6f3f89..de07856c5 100644 --- a/crypto/smartcont/tolk-stdlib/gas-payments.tolk +++ b/crypto/smartcont/tolk-stdlib/gas-payments.tolk @@ -13,7 +13,7 @@ fun getGasConsumedAtTheMoment(): int /// and "accept" it to blockchain. /// Without calling this function, an external message would be discarded. /// As an effect, the current smart contract agrees to buy some gas to finish the current transaction. -/// For more details, check [accept_message effects](https://ton.org/docs/#/smart-contracts/accept). +/// For more details, check [accept_message effects](https://ion.org/docs/#/smart-contracts/accept). fun acceptExternalMessage(): void asm "ACCEPT"; @@ -32,24 +32,24 @@ fun setGasLimitToMaximum(): void fun setGasLimit(limit: int): void asm "SETGASLIMIT"; -/// Calculates fee (amount in nanotoncoins to be paid) for a transaction which consumed [gasUsed] gas units. +/// Calculates fee (amount in nanoioncoins to be paid) for a transaction which consumed [gasUsed] gas units. fun calculateGasFee(workchain: int, gasUsed: int): int asm(gasUsed workchain) "GETGASFEE"; -/// Same as [calculateGasFee], but without flat price (you have supposed to read https://docs.ton.org/develop/howto/fees-low-level) +/// Same as [calculateGasFee], but without flat price (you have supposed to read https://docs.ion.org/develop/howto/fees-low-level) fun calculateGasFeeWithoutFlatPrice(workchain: int, gasUsed: int): int asm(gasUsed workchain) "GETGASFEESIMPLE"; -/// Calculates amount of nanotoncoins you should pay for storing a contract of provided size for [seconds]. +/// Calculates amount of nanoioncoins you should pay for storing a contract of provided size for [seconds]. /// [bits] and [cells] represent contract state (code + data). fun calculateStorageFee(workchain: int, seconds: int, bits: int, cells: int): int asm(cells bits seconds workchain) "GETSTORAGEFEE"; -/// Calculates amount of nanotoncoins you should pay to send a message of specified size. +/// Calculates amount of nanoioncoins you should pay to send a message of specified size. fun calculateMessageFee(workchain: int, bits: int, cells: int): int asm(cells bits workchain) "GETFORWARDFEE"; -/// Same as [calculateMessageFee], but without lump price (you have supposed to read https://docs.ton.org/develop/howto/fees-low-level) +/// Same as [calculateMessageFee], but without lump price (you have supposed to read https://docs.ion.org/develop/howto/fees-low-level) fun calculateMessageFeeWithoutLumpPrice(workchain: int, bits: int, cells: int): int asm(cells bits workchain) "GETFORWARDFEESIMPLE"; @@ -57,7 +57,7 @@ fun calculateMessageFeeWithoutLumpPrice(workchain: int, bits: int, cells: int): fun calculateOriginalMessageFee(workchain: int, incomingFwdFee: int): int asm(incomingFwdFee workchain) "GETORIGINALFWDFEE"; -/// Returns the amount of nanotoncoins current contract debts for storage. ("due" and "debt" are synonyms) +/// Returns the amount of nanoioncoins current contract debts for storage. ("due" and "debt" are synonyms) /// If it has no debt, `0` is returned. fun getMyStorageDuePayment(): int asm "DUEPAYMENT"; diff --git a/crypto/smc-envelope/GenericAccount.cpp b/crypto/smc-envelope/GenericAccount.cpp index 4c9bd1659..a5ab3610c 100644 --- a/crypto/smc-envelope/GenericAccount.cpp +++ b/crypto/smc-envelope/GenericAccount.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -20,7 +20,7 @@ #include "block/block-auto.h" #include "block/block-parse.h" -namespace ton { +namespace ion { namespace smc { td::Ref pack_grams(td::uint64 amount) { @@ -56,7 +56,7 @@ td::Ref GenericAccount::get_init_state(const td::Ref& code, .store_ref(std::move(data)) .finalize(); } -block::StdAddress GenericAccount::get_address(ton::WorkchainId workchain_id, +block::StdAddress GenericAccount::get_address(ion::WorkchainId workchain_id, const td::Ref& init_state) noexcept { return block::StdAddress(workchain_id, init_state->get_hash().bits(), true /*bounce*/); } @@ -162,4 +162,4 @@ td::Result GenericAccount::get_wallet_id(const SmartContract& sc) { return static_cast(answer.stack.write().pop_long_range(std::numeric_limits::max())); }()); } -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/GenericAccount.h b/crypto/smc-envelope/GenericAccount.h index 93a059f99..cf8dac814 100644 --- a/crypto/smc-envelope/GenericAccount.h +++ b/crypto/smc-envelope/GenericAccount.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -22,7 +22,7 @@ #include "Ed25519.h" #include "SmartContract.h" -namespace ton { +namespace ion { namespace smc { td::Ref pack_grams(td::uint64 amount); bool unpack_grams(td::Ref cs, td::uint64& amount); @@ -33,7 +33,7 @@ class GenericAccount { static td::Ref get_init_state(const SmartContract::State& state) noexcept { return get_init_state(state.code, state.data); } - static block::StdAddress get_address(ton::WorkchainId workchain_id, const td::Ref& init_state) noexcept; + static block::StdAddress get_address(ion::WorkchainId workchain_id, const td::Ref& init_state) noexcept; static td::Ref create_ext_message(const block::StdAddress& address, td::Ref new_state, td::Ref body) noexcept; static void store_int_message(vm::CellBuilder& cb, const block::StdAddress& dest_address, td::int64 gramms, @@ -43,4 +43,4 @@ class GenericAccount { static td::Result get_seqno(const SmartContract& sc); static td::Result get_wallet_id(const SmartContract& sc); }; -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/HighloadWallet.cpp b/crypto/smc-envelope/HighloadWallet.cpp index 69843fcff..fd9d0d64e 100644 --- a/crypto/smc-envelope/HighloadWallet.cpp +++ b/crypto/smc-envelope/HighloadWallet.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -26,7 +26,7 @@ #include -namespace ton { +namespace ion { td::Result> HighloadWallet::make_a_gift_message(const td::Ed25519::PrivateKey& private_key, td::uint32 valid_until, td::Span gifts) const { @@ -87,4 +87,4 @@ td::Result HighloadWallet::get_public_key() const { }()); } -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/HighloadWallet.h b/crypto/smc-envelope/HighloadWallet.h index db36caaee..3c1113a3e 100644 --- a/crypto/smc-envelope/HighloadWallet.h +++ b/crypto/smc-envelope/HighloadWallet.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -25,7 +25,7 @@ #include "block/block.h" #include "vm/cells/CellString.h" -namespace ton { +namespace ion { struct HighloadWalletTraits { using InitData = WalletInterface::DefaultInitData; @@ -46,4 +46,4 @@ class HighloadWallet : public WalletBase { td::Result get_wallet_id() const override; td::Result get_public_key() const override; }; -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/HighloadWalletV2.cpp b/crypto/smc-envelope/HighloadWalletV2.cpp index e0454233e..8b31bf487 100644 --- a/crypto/smc-envelope/HighloadWalletV2.cpp +++ b/crypto/smc-envelope/HighloadWalletV2.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -26,7 +26,7 @@ #include -namespace ton { +namespace ion { td::Result> HighloadWalletV2::get_init_message(const td::Ed25519::PrivateKey& private_key, td::uint32 valid_until) const noexcept { @@ -104,4 +104,4 @@ td::Result HighloadWalletV2::get_public_key() const { }()); } -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/HighloadWalletV2.h b/crypto/smc-envelope/HighloadWalletV2.h index 6b5e6dba2..3df332b21 100644 --- a/crypto/smc-envelope/HighloadWalletV2.h +++ b/crypto/smc-envelope/HighloadWalletV2.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -25,7 +25,7 @@ #include "block/block.h" #include "vm/cells/CellString.h" -namespace ton { +namespace ion { struct HighloadWalletV2Traits { using InitData = WalletInterface::DefaultInitData; @@ -48,4 +48,4 @@ class HighloadWalletV2 : public WalletBase get_wallet_id() const override; td::Result get_public_key() const override; }; -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/ManualDns.cpp b/crypto/smc-envelope/ManualDns.cpp index 617ab9156..37be616ac 100644 --- a/crypto/smc-envelope/ManualDns.cpp +++ b/crypto/smc-envelope/ManualDns.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2019-2020 Telegram Systems LLP */ @@ -32,7 +32,7 @@ #include "common/util.h" -namespace ton { +namespace ion { td::StringBuilder& operator<<(td::StringBuilder& sb, const ManualDns::EntryData& data) { switch (data.type) { case ManualDns::EntryData::Type::Empty: @@ -127,8 +127,8 @@ td::Result DnsInterface::EntryData::from_cellslice(vm:: case block::gen::DNSRecord::dns_next_resolver: { block::gen::DNSRecord::Record_dns_next_resolver dns; tlb::unpack(cs, dns); - ton::WorkchainId wc; - ton::StdSmcAddress addr; + ion::WorkchainId wc; + ion::StdSmcAddress addr; if (!block::tlb::t_MsgAddressInt.extract_std_address(dns.resolver, wc, addr)) { return td::Status::Error("Invalid address"); } @@ -142,8 +142,8 @@ td::Result DnsInterface::EntryData::from_cellslice(vm:: case block::gen::DNSRecord::dns_smc_address: { block::gen::DNSRecord::Record_dns_smc_address dns; tlb::unpack(cs, dns); - ton::WorkchainId wc; - ton::StdSmcAddress addr; + ion::WorkchainId wc; + ion::StdSmcAddress addr; if (!block::tlb::t_MsgAddressInt.extract_std_address(dns.smc_addr, wc, addr)) { return td::Status::Error("Invalid address"); } @@ -216,7 +216,7 @@ td::Result> DnsInterface::resolve(td::Slice nam // creation td::Ref ManualDns::create(td::Ref data, int revision) { return td::Ref( - true, State{ton::SmartContractCode::get_code(ton::SmartContractCode::ManualDns, revision), std::move(data)}); + true, State{ion::SmartContractCode::get_code(ion::SmartContractCode::ManualDns, revision), std::move(data)}); } td::Ref ManualDns::create(const td::Ed25519::PublicKey& public_key, td::uint32 wallet_id, int revision) { @@ -224,8 +224,8 @@ td::Ref ManualDns::create(const td::Ed25519::PublicKey& public_key, t } td::optional ManualDns::guess_revision(const vm::Cell::Hash& code_hash) { - for (auto i : ton::SmartContractCode::get_revisions(ton::SmartContractCode::ManualDns)) { - if (ton::SmartContractCode::get_code(ton::SmartContractCode::ManualDns, i)->get_hash() == code_hash) { + for (auto i : ion::SmartContractCode::get_revisions(ion::SmartContractCode::ManualDns)) { + if (ion::SmartContractCode::get_code(ion::SmartContractCode::ManualDns, i)->get_hash() == code_hash) { return i; } } @@ -234,7 +234,7 @@ td::optional ManualDns::guess_revision(const vm::Cell::Hash& code_has td::optional ManualDns::guess_revision(const block::StdAddress& address, const td::Ed25519::PublicKey& public_key, td::uint32 wallet_id) { for (auto i : {-1, 1}) { - auto dns = ton::ManualDns::create(public_key, wallet_id, i); + auto dns = ion::ManualDns::create(public_key, wallet_id, i); if (dns->get_address() == address) { return i; } @@ -549,11 +549,11 @@ std::string DnsInterface::decode_name(td::Slice name) { std::string ManualDns::serialize_data(const EntryData& data) { std::string res; data.data.visit( - td::overloaded([&](const ton::ManualDns::EntryDataText& text) { res = "UNSUPPORTED"; }, - [&](const ton::ManualDns::EntryDataNextResolver& resolver) { res = "UNSUPPORTED"; }, - [&](const ton::ManualDns::EntryDataAdnlAddress& adnl_address) { res = "UNSUPPORTED"; }, - [&](const ton::ManualDns::EntryDataSmcAddress& text) { res = "UNSUPPORTED"; }, - [&](const ton::ManualDns::EntryDataStorageAddress& storage_address) { res = "UNSUPPORTED"; })); + td::overloaded([&](const ion::ManualDns::EntryDataText& text) { res = "UNSUPPORTED"; }, + [&](const ion::ManualDns::EntryDataNextResolver& resolver) { res = "UNSUPPORTED"; }, + [&](const ion::ManualDns::EntryDataAdnlAddress& adnl_address) { res = "UNSUPPORTED"; }, + [&](const ion::ManualDns::EntryDataSmcAddress& text) { res = "UNSUPPORTED"; }, + [&](const ion::ManualDns::EntryDataStorageAddress& storage_address) { res = "UNSUPPORTED"; })); return res; } @@ -631,4 +631,4 @@ td::Result> ManualDns::parse(td::Slice cmd) { return res; } -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/ManualDns.h b/crypto/smc-envelope/ManualDns.h index d24cd0234..49a32fdb2 100644 --- a/crypto/smc-envelope/ManualDns.h +++ b/crypto/smc-envelope/ManualDns.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2019-2020 Telegram Systems LLP */ @@ -30,7 +30,7 @@ #include -namespace ton { +namespace ion { const td::Bits256 DNS_NEXT_RESOLVER_CATEGORY = td::sha256_bits256(td::Slice("dns_next_resolver", strlen("dns_next_resolver"))); @@ -51,7 +51,7 @@ class DnsInterface { }; struct EntryDataAdnlAddress { - ton::Bits256 adnl_address; + ion::Bits256 adnl_address; // TODO: proto bool operator==(const EntryDataAdnlAddress& other) const { return adnl_address == other.adnl_address; @@ -67,7 +67,7 @@ class DnsInterface { }; struct EntryDataStorageAddress { - ton::Bits256 bag_id; + ion::Bits256 bag_id; // TODO: proto bool operator==(const EntryDataStorageAddress& other) const { return bag_id == other.bag_id; @@ -86,13 +86,13 @@ class DnsInterface { static EntryData next_resolver(block::StdAddress resolver) { return {NextResolver, EntryDataNextResolver{resolver}}; } - static EntryData adnl_address(ton::Bits256 adnl_address) { + static EntryData adnl_address(ion::Bits256 adnl_address) { return {AdnlAddress, EntryDataAdnlAddress{adnl_address}}; } static EntryData smc_address(block::StdAddress smc_address) { return {SmcAddress, EntryDataSmcAddress{smc_address}}; } - static EntryData storage_address(ton::Bits256 bag_id) { + static EntryData storage_address(ion::Bits256 bag_id) { return {StorageAddress, EntryDataStorageAddress{bag_id}}; } @@ -196,7 +196,7 @@ class DnsInterface { block::StdAddress address = {}); }; -class ManualDns : public ton::SmartContract, public DnsInterface { +class ManualDns : public ion::SmartContract, public DnsInterface { public: ManualDns(State state, block::StdAddress address = {}) : SmartContract(std::move(state)), address_(std::move(address)) { @@ -355,4 +355,4 @@ class ManualDns : public ton::SmartContract, public DnsInterface { block::StdAddress address_; }; -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/MultisigWallet.cpp b/crypto/smc-envelope/MultisigWallet.cpp index 5a9fab6a8..89358e1e3 100644 --- a/crypto/smc-envelope/MultisigWallet.cpp +++ b/crypto/smc-envelope/MultisigWallet.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2019-2020 Telegram Systems LLP */ @@ -24,7 +24,7 @@ #include "td/utils/misc.h" -namespace ton { +namespace ion { MultisigWallet::QueryBuilder::QueryBuilder(td::uint32 wallet_id, td::int64 query_id, td::Ref msg, int mode) { msg_ = vm::CellBuilder() @@ -67,7 +67,7 @@ td::Ref MultisigWallet::QueryBuilder::create(td::int32 id, td::Ed25519 td::Ref MultisigWallet::create(td::Ref data) { return td::Ref( - true, State{ton::SmartContractCode::get_code(ton::SmartContractCode::Multisig), std::move(data)}); + true, State{ion::SmartContractCode::get_code(ion::SmartContractCode::Multisig), std::move(data)}); } int MultisigWallet::processed(td::uint64 query_id) const { @@ -195,4 +195,4 @@ std::vector MultisigWallet::get_unsigned_messaged(int i }); return res; } -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/MultisigWallet.h b/crypto/smc-envelope/MultisigWallet.h index 96da297a4..699b3ff70 100644 --- a/crypto/smc-envelope/MultisigWallet.h +++ b/crypto/smc-envelope/MultisigWallet.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2019-2020 Telegram Systems LLP */ @@ -24,8 +24,8 @@ #include -namespace ton { -class MultisigWallet : public ton::SmartContract { +namespace ion { +class MultisigWallet : public ion::SmartContract { public: MultisigWallet(State state) : SmartContract(std::move(state)) { } @@ -80,4 +80,4 @@ class MultisigWallet : public ton::SmartContract { }; std::vector get_unsigned_messaged(int id = -1) const; }; -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/PaymentChannel.cpp b/crypto/smc-envelope/PaymentChannel.cpp index ff54996c5..50872e7bc 100644 --- a/crypto/smc-envelope/PaymentChannel.cpp +++ b/crypto/smc-envelope/PaymentChannel.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -28,7 +28,7 @@ #include "SmartContract.h" #include "SmartContractCode.h" -namespace ton { +namespace ion { using smc::pack_grams; using smc::unpack_grams; namespace pchan { @@ -277,10 +277,10 @@ td::Result PaymentChannel::get_info() const { res.description = block::gen::t_ChanState.as_string_ref(data_rec.state); return std::move(res); -} // namespace ton +} // namespace ion td::optional PaymentChannel::guess_revision(const vm::Cell::Hash& code_hash) { - for (auto i : ton::SmartContractCode::get_revisions(ton::SmartContractCode::PaymentChannel)) { + for (auto i : ion::SmartContractCode::get_revisions(ion::SmartContractCode::PaymentChannel)) { auto code = SmartContractCode::get_code(SmartContractCode::PaymentChannel, i); if (code->get_hash() == code_hash) { return i; @@ -288,4 +288,4 @@ td::optional PaymentChannel::guess_revision(const vm::Cell::Hash& cod } return {}; } -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/PaymentChannel.h b/crypto/smc-envelope/PaymentChannel.h index 0cd0220d5..c0ecba80b 100644 --- a/crypto/smc-envelope/PaymentChannel.h +++ b/crypto/smc-envelope/PaymentChannel.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -29,7 +29,7 @@ #include "SmartContract.h" #include "SmartContractCode.h" -namespace ton { +namespace ion { namespace pchan { // @@ -279,4 +279,4 @@ class PaymentChannel : public SmartContract { return create(std::move(state)); } }; -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/SmartContract.cpp b/crypto/smc-envelope/SmartContract.cpp index 2578a9514..977c94a88 100644 --- a/crypto/smc-envelope/SmartContract.cpp +++ b/crypto/smc-envelope/SmartContract.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -29,7 +29,7 @@ #include "td/utils/crypto.h" -namespace ton { +namespace ion { int SmartContract::Answer::output_actions_count(td::Ref list) { int i = -1; do { @@ -358,4 +358,4 @@ SmartContract::Answer SmartContract::send_internal_message(td::Ref cel return run_method( args.set_stack(prepare_vm_stack(td::make_refint(args.amount), vm::load_cell_slice_ref(cell), args, 0)).set_method_id(0)); } -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/SmartContract.h b/crypto/smc-envelope/SmartContract.h index 7fc93579d..5b563c69b 100644 --- a/crypto/smc-envelope/SmartContract.h +++ b/crypto/smc-envelope/SmartContract.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -28,7 +28,7 @@ #include "block/block.h" #include "block/mc-config.h" -namespace ton { +namespace ion { class SmartContract : public td::CntObject { static td::Ref empty_slice(); @@ -184,4 +184,4 @@ class SmartContract : public td::CntObject { protected: State state_; }; -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/SmartContractCode.cpp b/crypto/smc-envelope/SmartContractCode.cpp index 585450f61..e697a7c34 100644 --- a/crypto/smc-envelope/SmartContractCode.cpp +++ b/crypto/smc-envelope/SmartContractCode.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -23,7 +23,7 @@ #include "td/utils/base64.h" -namespace ton { +namespace ion { namespace { // WALLET_REVISION = 2; // WALLET2_REVISION = 2; @@ -208,4 +208,4 @@ td::Ref SmartContractCode::get_code(Type type, int ext_revision) { return load(PSLICE() << basename << "-r" << revision).move_as_ok(); } -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/SmartContractCode.h b/crypto/smc-envelope/SmartContractCode.h index be50d2a15..00110027c 100644 --- a/crypto/smc-envelope/SmartContractCode.h +++ b/crypto/smc-envelope/SmartContractCode.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "td/utils/Span.h" -namespace ton { +namespace ion { class SmartContractCode { public: static td::Result> load(td::Slice name); @@ -40,4 +40,4 @@ class SmartContractCode { static td::Result validate_revision(Type type, int revision); static td::Ref get_code(Type type, int revision = 0); }; -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/TestGiver.cpp b/crypto/smc-envelope/TestGiver.cpp index 2a1691835..33d53df8e 100644 --- a/crypto/smc-envelope/TestGiver.cpp +++ b/crypto/smc-envelope/TestGiver.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,7 +21,7 @@ #include "td/utils/base64.h" -namespace ton { +namespace ion { const block::StdAddress& TestGiver::address() noexcept { static block::StdAddress res = block::StdAddress::parse("kf_8uRo6OBbQ97jCx2EIuKm8Wmt6Vb15-KsQHFLbKSMiYIny").move_as_ok(); @@ -63,4 +63,4 @@ td::Result TestGiver::get_seqno_or_throw() const { } return static_cast(seqno); } -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/TestGiver.h b/crypto/smc-envelope/TestGiver.h index b51ac7dbe..6c117b7c1 100644 --- a/crypto/smc-envelope/TestGiver.h +++ b/crypto/smc-envelope/TestGiver.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,12 +21,12 @@ #include "smc-envelope/WalletInterface.h" #include "block/block.h" #include "vm/cells/CellString.h" -namespace ton { +namespace ion { class TestGiver : public SmartContract, public WalletInterface { public: - explicit TestGiver(State state) : ton::SmartContract(std::move(state)) { + explicit TestGiver(State state) : ion::SmartContract(std::move(state)) { } - TestGiver() : ton::SmartContract({}) { + TestGiver() : ion::SmartContract({}) { } static constexpr unsigned max_message_size = vm::CellString::max_bytes; static constexpr unsigned max_gifts_size = 1; @@ -49,4 +49,4 @@ class TestGiver : public SmartContract, public WalletInterface { private: td::Result get_seqno_or_throw() const; }; -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/TestWallet.cpp b/crypto/smc-envelope/TestWallet.cpp index 41a66b685..35ac10c3f 100644 --- a/crypto/smc-envelope/TestWallet.cpp +++ b/crypto/smc-envelope/TestWallet.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "TestWallet.h" @@ -23,7 +23,7 @@ Copyright 2017-2020 Telegram Systems LLP #include "vm/boc.h" #include "td/utils/base64.h" -namespace ton { +namespace ion { td::Ref TestWallet::get_init_state(const td::Ed25519::PublicKey& public_key, td::int32 revision) noexcept { auto code = get_init_code(revision); auto data = get_init_data(public_key); @@ -57,7 +57,7 @@ td::Ref TestWallet::make_a_gift_message_static(const td::Ed25519::Priv } td::Ref TestWallet::get_init_code(td::int32 revision) noexcept { - return ton::SmartContractCode::get_code(ton::SmartContractCode::WalletV1, revision); + return ion::SmartContractCode::get_code(ion::SmartContractCode::WalletV1, revision); } vm::CellHash TestWallet::get_init_code_hash() noexcept { @@ -103,4 +103,4 @@ td::Result TestWallet::get_public_key_or_throw() const { return td::Ed25519::PublicKey(std::move(res)); } -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/TestWallet.h b/crypto/smc-envelope/TestWallet.h index 38e0f12ba..9fab9378f 100644 --- a/crypto/smc-envelope/TestWallet.h +++ b/crypto/smc-envelope/TestWallet.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -25,10 +25,10 @@ #include "block/block.h" #include "vm/cells/CellString.h" -namespace ton { -class TestWallet : public ton::SmartContract, public WalletInterface { +namespace ion { +class TestWallet : public ion::SmartContract, public WalletInterface { public: - explicit TestWallet(State state) : ton::SmartContract(std::move(state)) { + explicit TestWallet(State state) : ion::SmartContract(std::move(state)) { } explicit TestWallet(const td::Ed25519::PublicKey& public_key, td::uint32 seqno) : TestWallet(State{get_init_code(), get_data(public_key, seqno)}) { @@ -63,4 +63,4 @@ class TestWallet : public ton::SmartContract, public WalletInterface { td::Result get_seqno_or_throw() const; td::Result get_public_key_or_throw() const; }; -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/Wallet.cpp b/crypto/smc-envelope/Wallet.cpp index fac4f1a6b..e72f9db58 100644 --- a/crypto/smc-envelope/Wallet.cpp +++ b/crypto/smc-envelope/Wallet.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -26,7 +26,7 @@ #include -namespace ton { +namespace ion { td::Ref Wallet::get_init_state(const td::Ed25519::PublicKey& public_key, td::int32 revision) noexcept { auto code = get_init_code(revision); auto data = get_init_data(public_key); @@ -64,7 +64,7 @@ td::Ref Wallet::make_a_gift_message(const td::Ed25519::PrivateKey& pri } td::Ref Wallet::get_init_code(td::int32 revision) noexcept { - return SmartContractCode::get_code(ton::SmartContractCode::WalletV2, revision); + return SmartContractCode::get_code(ion::SmartContractCode::WalletV2, revision); } vm::CellHash Wallet::get_init_code_hash() noexcept { @@ -107,4 +107,4 @@ td::Result Wallet::get_public_key_or_throw() const { return td::Ed25519::PublicKey(std::move(res)); } -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/Wallet.h b/crypto/smc-envelope/Wallet.h index db074f6a1..29d0178f8 100644 --- a/crypto/smc-envelope/Wallet.h +++ b/crypto/smc-envelope/Wallet.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -25,10 +25,10 @@ #include "block/block.h" #include "vm/cells/CellString.h" -namespace ton { -class Wallet : public ton::SmartContract, public WalletInterface { +namespace ion { +class Wallet : public ion::SmartContract, public WalletInterface { public: - explicit Wallet(State state) : ton::SmartContract(std::move(state)) { + explicit Wallet(State state) : ion::SmartContract(std::move(state)) { } explicit Wallet(const td::Ed25519::PublicKey& public_key, td::uint32 seqno) : Wallet(State{get_init_code(), get_data(public_key, seqno)}) { @@ -63,4 +63,4 @@ class Wallet : public ton::SmartContract, public WalletInterface { td::Result get_seqno_or_throw() const; td::Result get_public_key_or_throw() const; }; -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/WalletInterface.cpp b/crypto/smc-envelope/WalletInterface.cpp index eecec4354..d3a61de43 100644 --- a/crypto/smc-envelope/WalletInterface.cpp +++ b/crypto/smc-envelope/WalletInterface.cpp @@ -1,24 +1,24 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "WalletInterface.h" -namespace ton { +namespace ion { td::Result WalletInterface::get_balance(td::uint64 account_balance, td::uint32 now) const { return TRY_VM([&]() -> td::Result { Answer answer = this->run_get_method(Args().set_method_id("balance").set_balance(account_balance).set_now(now)); @@ -77,4 +77,4 @@ void WalletInterface::store_gift_message(vm::CellBuilder &cb, const Gift &gift) } vm::CellString::store(cb, gift.message, 35 * 8).ensure(); } -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/WalletInterface.h b/crypto/smc-envelope/WalletInterface.h index e88ca0a61..c74448dfd 100644 --- a/crypto/smc-envelope/WalletInterface.h +++ b/crypto/smc-envelope/WalletInterface.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -30,7 +30,7 @@ #include -namespace ton { +namespace ion { class WalletInterface : public SmartContract { public: static constexpr uint32_t EncryptedCommentOp = 0x2167da4b; @@ -109,7 +109,7 @@ class WalletBase : public WalletInterface { return Traits::code_type; } static td::optional guess_revision(const vm::Cell::Hash &code_hash) { - for (auto revision : ton::SmartContractCode::get_revisions(get_code_type())) { + for (auto revision : ion::SmartContractCode::get_revisions(get_code_type())) { auto code = get_init_code(revision); if (code->get_hash() == code_hash) { return revision; @@ -118,7 +118,7 @@ class WalletBase : public WalletInterface { return {}; } static td::Span get_revisions() { - return ton::SmartContractCode::get_revisions(get_code_type()); + return ion::SmartContractCode::get_revisions(get_code_type()); } static td::optional guess_revision(block::StdAddress &address, const InitData &init_data) { for (auto revision : get_revisions()) { @@ -136,4 +136,4 @@ class WalletBase : public WalletInterface { } }; -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/WalletV3.cpp b/crypto/smc-envelope/WalletV3.cpp index 35a302e64..e6b902f12 100644 --- a/crypto/smc-envelope/WalletV3.cpp +++ b/crypto/smc-envelope/WalletV3.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -26,7 +26,7 @@ #include -namespace ton { +namespace ion { td::Result> WalletV3::make_a_gift_message(const td::Ed25519::PrivateKey& private_key, td::uint32 valid_until, td::Span gifts) const { CHECK(gifts.size() <= get_max_gifts_size()); @@ -83,4 +83,4 @@ td::Result WalletV3::get_public_key() const { }()); } -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/WalletV3.h b/crypto/smc-envelope/WalletV3.h index 926e7ffbd..0cd7cb97f 100644 --- a/crypto/smc-envelope/WalletV3.h +++ b/crypto/smc-envelope/WalletV3.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -25,7 +25,7 @@ #include "block/block.h" #include "vm/cells/CellString.h" -namespace ton { +namespace ion { struct WalletV3Traits { using InitData = WalletInterface::DefaultInitData; @@ -47,9 +47,9 @@ class WalletV3 : public WalletBase { td::Result get_wallet_id() const override; td::Result get_public_key() const override; }; -} // namespace ton +} // namespace ion -namespace ton { +namespace ion { struct RestrictedWalletTraits { struct InitData { @@ -170,4 +170,4 @@ class RestrictedWallet : public WalletBase. + along with ION Blockchain Library. If not, see . */ #include "WalletV4.h" #include "GenericAccount.h" @@ -24,7 +24,7 @@ #include -namespace ton { +namespace ion { td::Result> WalletV4::make_a_gift_message(const td::Ed25519::PrivateKey& private_key, td::uint32 valid_until, td::Span gifts) const { CHECK(gifts.size() <= get_max_gifts_size()); @@ -68,4 +68,4 @@ td::Result WalletV4::get_wallet_id() const { return static_cast(answer.stack.write().pop_long_range(std::numeric_limits::max())); }()); } -} // namespace ton +} // namespace ion diff --git a/crypto/smc-envelope/WalletV4.h b/crypto/smc-envelope/WalletV4.h index 721e81039..39ffc341b 100644 --- a/crypto/smc-envelope/WalletV4.h +++ b/crypto/smc-envelope/WalletV4.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #pragma once @@ -23,7 +23,7 @@ #include "block/block.h" #include "vm/cells/CellString.h" -namespace ton { +namespace ion { struct WalletV4Traits { using InitData = WalletInterface::DefaultInitData; @@ -43,4 +43,4 @@ class WalletV4 : public WalletBase { td::Result get_wallet_id() const override; }; -} // namespace ton \ No newline at end of file +} // namespace ion \ No newline at end of file diff --git a/crypto/test/Ed25519.cpp b/crypto/test/Ed25519.cpp index 131bfe92e..e06760afc 100644 --- a/crypto/test/Ed25519.cpp +++ b/crypto/test/Ed25519.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/test/fift.cpp b/crypto/test/fift.cpp index 3f370ee58..b6fe8456c 100644 --- a/crypto/test/fift.cpp +++ b/crypto/test/fift.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/test/modbigint.cpp b/crypto/test/modbigint.cpp index 75051fa62..1c64ca121 100644 --- a/crypto/test/modbigint.cpp +++ b/crypto/test/modbigint.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #include #include diff --git a/crypto/test/test-bigint.cpp b/crypto/test/test-bigint.cpp index a6f6e8d67..90394ced9 100644 --- a/crypto/test/test-bigint.cpp +++ b/crypto/test/test-bigint.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #include #include diff --git a/crypto/test/test-cells.cpp b/crypto/test/test-cells.cpp index 327f73c62..46c5e4123 100644 --- a/crypto/test/test-cells.cpp +++ b/crypto/test/test-cells.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/test/test-db.cpp b/crypto/test/test-db.cpp index dc7fcf370..42a9047c4 100644 --- a/crypto/test/test-db.cpp +++ b/crypto/test/test-db.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -2147,7 +2147,7 @@ TEST(TonDb, CompactArrayOld) { //auto kv = std::make_unique(); td::RocksDb::destroy("ttt").ensure(); - auto ton_db = vm::TonDbImpl::open("ttt").move_as_ok(); + auto ion_db = vm::TonDbImpl::open("ttt").move_as_ok(); //auto storage = std::make_unique(kv.get()); @@ -2156,9 +2156,9 @@ TEST(TonDb, CompactArrayOld) { td::Random::Xorshift128plus rnd(123); FastCompactArray fast_array(array_size); { - auto txn = ton_db->begin_transaction(); + auto txn = ion_db->begin_transaction(); SCOPE_EXIT { - ton_db->commit_transaction(std::move(txn)); + ion_db->commit_transaction(std::move(txn)); }; auto smart = txn->begin_smartcontract(); SCOPE_EXIT { @@ -2179,13 +2179,13 @@ TEST(TonDb, CompactArrayOld) { for (int i = 0; i < 100; i++) { if (i % 10 == 9) { - //LOG(ERROR) << ton_db->stat(); - ton_db.reset(); - ton_db = vm::TonDbImpl::open("ttt").move_as_ok(); + //LOG(ERROR) << ion_db->stat(); + ion_db.reset(); + ion_db = vm::TonDbImpl::open("ttt").move_as_ok(); } - auto txn = ton_db->begin_transaction(); + auto txn = ion_db->begin_transaction(); SCOPE_EXIT { - ton_db->commit_transaction(std::move(txn)); + ion_db->commit_transaction(std::move(txn)); }; auto smart = txn->begin_smartcontract(); //smart->validate_meta(); @@ -2204,9 +2204,9 @@ TEST(TonDb, CompactArrayOld) { //LOG(ERROR) << storage->size(); } { - auto txn = ton_db->begin_transaction(); + auto txn = ion_db->begin_transaction(); SCOPE_EXIT { - ton_db->abort_transaction(std::move(txn)); + ion_db->abort_transaction(std::move(txn)); }; auto smart = txn->begin_smartcontract(); SCOPE_EXIT { diff --git a/crypto/test/test-ed25519-crypto.cpp b/crypto/test/test-ed25519-crypto.cpp index 3e3dab896..1a0c81e88 100644 --- a/crypto/test/test-ed25519-crypto.cpp +++ b/crypto/test/test-ed25519-crypto.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. diff --git a/crypto/test/test-smartcont.cpp b/crypto/test/test-smartcont.cpp index 7f512ceae..b078c88ce 100644 --- a/crypto/test/test-smartcont.cpp +++ b/crypto/test/test-smartcont.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -94,7 +94,7 @@ SETCP0 DUP IFNOTRET // return if recv_internal TEST(Tonlib, WalletV3) { LOG(ERROR) << td::base64_encode(std_boc_serialize(get_wallet_v3_source()).move_as_ok()); - CHECK(get_wallet_v3_source()->get_hash() == ton::WalletV3::get_init_code(2)->get_hash()); + CHECK(get_wallet_v3_source()->get_hash() == ion::WalletV3::get_init_code(2)->get_hash()); auto fift_output = fift::mem_run_fift(load_source("smartcont/new-wallet-v3.fif"), {"aba", "0", "239"}).move_as_ok(); auto new_wallet_pk = fift_output.source_lookup.read_file("new-wallet.pk").move_as_ok().data; @@ -103,10 +103,10 @@ TEST(Tonlib, WalletV3) { td::Ed25519::PrivateKey priv_key{td::SecureString{new_wallet_pk}}; auto pub_key = priv_key.get_public_key().move_as_ok(); - ton::WalletV3::InitData init_data; + ion::WalletV3::InitData init_data; init_data.public_key = pub_key.as_octet_string(); init_data.wallet_id = 239; - auto wallet = ton::WalletV3::create(init_data, 2); + auto wallet = ion::WalletV3::create(init_data, 2); ASSERT_EQ(239u, wallet->get_wallet_id().ok()); ASSERT_EQ(0u, wallet->get_seqno().ok()); @@ -114,8 +114,8 @@ TEST(Tonlib, WalletV3) { CHECK(address.addr.as_slice() == td::Slice(new_wallet_addr).substr(0, 32)); auto init_message = wallet->get_init_message(priv_key).move_as_ok(); - td::Ref ext_init_message = ton::GenericAccount::create_ext_message( - address, ton::GenericAccount::get_init_state(wallet->get_state()), init_message); + td::Ref ext_init_message = ion::GenericAccount::create_ext_message( + address, ion::GenericAccount::get_init_state(wallet->get_state()), init_message); LOG(ERROR) << "-------"; vm::load_cell_slice(ext_init_message).print_rec(std::cerr); LOG(ERROR) << "-------"; @@ -139,7 +139,7 @@ TEST(Tonlib, WalletV3) { .move_as_ok(); auto wallet_query = fift_output.source_lookup.read_file("wallet-query.boc").move_as_ok().data; - ton::WalletV3::Gift gift; + ion::WalletV3::Gift gift; gift.destination = dest; gift.message = "TESTv3"; gift.gramms = 321000000000ll; @@ -148,9 +148,9 @@ TEST(Tonlib, WalletV3) { ASSERT_EQ(1u, wallet->get_seqno().ok()); CHECK(priv_key.get_public_key().ok().as_octet_string() == wallet->get_public_key().ok().as_octet_string()); CHECK(priv_key.get_public_key().ok().as_octet_string() == - ton::GenericAccount::get_public_key(*wallet).ok().as_octet_string()); + ion::GenericAccount::get_public_key(*wallet).ok().as_octet_string()); - auto gift_message = ton::GenericAccount::create_ext_message( + auto gift_message = ion::GenericAccount::create_ext_message( address, {}, wallet->make_a_gift_message(priv_key, 60, {gift}).move_as_ok()); LOG(ERROR) << "-------"; vm::load_cell_slice(gift_message).print_rec(std::cerr); @@ -172,21 +172,21 @@ TEST(Tonlib, HighloadWallet) { td::Ed25519::PrivateKey priv_key{td::SecureString{new_wallet_pk}}; auto pub_key = priv_key.get_public_key().move_as_ok(); - ton::HighloadWallet::InitData init_data(pub_key.as_octet_string(), 239); + ion::HighloadWallet::InitData init_data(pub_key.as_octet_string(), 239); - auto wallet = ton::HighloadWallet::create(init_data, -1); + auto wallet = ion::HighloadWallet::create(init_data, -1); auto address = wallet->get_address(); CHECK(address.addr.as_slice() == td::Slice(new_wallet_addr).substr(0, 32)); ASSERT_EQ(239u, wallet->get_wallet_id().ok()); ASSERT_EQ(0u, wallet->get_seqno().ok()); CHECK(pub_key.as_octet_string() == wallet->get_public_key().ok().as_octet_string()); - CHECK(pub_key.as_octet_string() == ton::GenericAccount::get_public_key(*wallet).ok().as_octet_string()); + CHECK(pub_key.as_octet_string() == ion::GenericAccount::get_public_key(*wallet).ok().as_octet_string()); CHECK(address.addr.as_slice() == td::Slice(new_wallet_addr).substr(0, 32)); auto init_message = wallet->get_init_message(priv_key).move_as_ok(); - td::Ref res = ton::GenericAccount::create_ext_message( - address, ton::GenericAccount::get_init_state(wallet->get_state()), init_message); + td::Ref res = ion::GenericAccount::create_ext_message( + address, ion::GenericAccount::get_init_state(wallet->get_state()), init_message); LOG(ERROR) << "---smc-envelope----"; vm::load_cell_slice(res).print_rec(std::cerr); @@ -196,7 +196,7 @@ TEST(Tonlib, HighloadWallet) { fift_output.source_lookup.write_file("/main.fif", load_source("smartcont/highload-wallet.fif")).ensure(); std::string order; - std::vector gifts; + std::vector gifts; auto add_order = [&](td::Slice dest_str, td::int64 gramms) { auto g = td::to_string(gramms); if (g.size() < 10) { @@ -205,7 +205,7 @@ TEST(Tonlib, HighloadWallet) { order += PSTRING() << "SEND " << dest_str << " " << g.substr(0, g.size() - 9) << "." << g.substr(g.size() - 9) << "\n"; - ton::HighloadWallet::Gift gift; + ion::HighloadWallet::Gift gift; gift.destination = block::StdAddress::parse(dest_str).move_as_ok(); gift.gramms = gramms; gifts.push_back(gift); @@ -222,12 +222,12 @@ TEST(Tonlib, HighloadWallet) { } }; init_data.seqno = 123; - wallet = ton::HighloadWallet::create(init_data, -1); + wallet = ion::HighloadWallet::create(init_data, -1); fift_output.source_lookup.set_os_time(std::make_unique()); fift_output = fift::mem_run_fift(std::move(fift_output.source_lookup), {"aba", "new-wallet", "239", "123", "order"}) .move_as_ok(); auto wallet_query = fift_output.source_lookup.read_file("wallet-query.boc").move_as_ok().data; - auto gift_message = ton::GenericAccount::create_ext_message( + auto gift_message = ion::GenericAccount::create_ext_message( address, {}, wallet->make_a_gift_message(priv_key, 60, gifts).move_as_ok()); LOG(ERROR) << "---smc-envelope----"; vm::load_cell_slice(gift_message).print_rec(std::cerr); @@ -257,21 +257,21 @@ TEST(Tonlib, HighloadWalletV2) { td::Ed25519::PrivateKey priv_key{td::SecureString{new_wallet_pk}}; auto pub_key = priv_key.get_public_key().move_as_ok(); - ton::HighloadWalletV2::InitData init_data(pub_key.as_octet_string(), 239); + ion::HighloadWalletV2::InitData init_data(pub_key.as_octet_string(), 239); - auto wallet = ton::HighloadWalletV2::create(init_data, -1); + auto wallet = ion::HighloadWalletV2::create(init_data, -1); auto address = wallet->get_address(); ASSERT_EQ(239u, wallet->get_wallet_id().ok()); wallet->get_seqno().ensure_error(); CHECK(pub_key.as_octet_string() == wallet->get_public_key().ok().as_octet_string()); - CHECK(pub_key.as_octet_string() == ton::GenericAccount::get_public_key(*wallet).ok().as_octet_string()); + CHECK(pub_key.as_octet_string() == ion::GenericAccount::get_public_key(*wallet).ok().as_octet_string()); CHECK(address.addr.as_slice() == td::Slice(new_wallet_addr).substr(0, 32)); auto init_message = wallet->get_init_message(priv_key, 65535).move_as_ok(); - td::Ref res = ton::GenericAccount::create_ext_message( - address, ton::GenericAccount::get_init_state(wallet->get_state()), init_message); + td::Ref res = ion::GenericAccount::create_ext_message( + address, ion::GenericAccount::get_init_state(wallet->get_state()), init_message); LOG(ERROR) << "---smc-envelope----"; vm::load_cell_slice(res).print_rec(std::cerr); @@ -281,7 +281,7 @@ TEST(Tonlib, HighloadWalletV2) { fift_output.source_lookup.write_file("/main.fif", load_source("smartcont/highload-wallet-v2.fif")).ensure(); std::string order; - std::vector gifts; + std::vector gifts; auto add_order = [&](td::Slice dest_str, td::int64 gramms) { auto g = td::to_string(gramms); if (g.size() < 10) { @@ -290,7 +290,7 @@ TEST(Tonlib, HighloadWalletV2) { order += PSTRING() << "SEND " << dest_str << " " << g.substr(0, g.size() - 9) << "." << g.substr(g.size() - 9) << "\n"; - ton::HighloadWalletV2::Gift gift; + ion::HighloadWalletV2::Gift gift; gift.destination = block::StdAddress::parse(dest_str).move_as_ok(); gift.gramms = gramms; gifts.push_back(gift); @@ -304,7 +304,7 @@ TEST(Tonlib, HighloadWalletV2) { fift_output = fift::mem_run_fift(std::move(fift_output.source_lookup), {"aba", "new-wallet", "239", "order"}).move_as_ok(); auto wallet_query = fift_output.source_lookup.read_file("wallet-query.boc").move_as_ok().data; - auto gift_message = ton::GenericAccount::create_ext_message( + auto gift_message = ion::GenericAccount::create_ext_message( address, {}, wallet->make_a_gift_message(priv_key, 60, gifts).move_as_ok()); LOG(ERROR) << "---smc-envelope----"; vm::load_cell_slice(gift_message).print_rec(std::cerr); @@ -332,12 +332,12 @@ TEST(Tonlib, RestrictedWallet) { //std::vector args = {"path", pub_key_serialized, std::string("100")}; //auto fift_output = fift::mem_run_fift(std::move(source_lookup), args).move_as_ok(); - //ton::RestrictedWallet::InitData init_data; + //ion::RestrictedWallet::InitData init_data; //td::uint64 x = 100 * 1000000000ull; //init_data.key = &pub_key; //init_data.start_at = 0; //init_data.limits = {{-32768, x}, {92, x * 3 / 4}, {183, x * 1 / 2}, {366, x * 1 / 4}, {548, 0}}; - //auto wallet = ton::RestrictedWallet::create(init_data, -1); + //auto wallet = ion::RestrictedWallet::create(init_data, -1); //ASSERT_EQ(0u, wallet->get_seqno().move_as_ok()); //CHECK(pub_key.as_octet_string() == wallet->get_public_key().move_as_ok().as_octet_string()); @@ -349,7 +349,7 @@ TEST(Tonlib, RestrictedWallet) { //auto address = wallet->get_address(-1); ////CHECK(address.addr.as_slice() == td::Slice(new_wallet_addr).substr(0, 32)); //address.bounceable = false; - //auto res = ton::GenericAccount::create_ext_message(address, wallet->get_init_state(), + //auto res = ion::GenericAccount::create_ext_message(address, wallet->get_init_state(), //wallet->get_init_message(priv_key).move_as_ok()); //LOG(ERROR) << "-------"; //vm::load_cell_slice(res).print_rec(std::cerr); @@ -365,12 +365,12 @@ TEST(Tonlib, RestrictedWallet) { //{"aba", "rwallet", "-C", "TESTv2", "Ef9Tj6fMJP+OqhAdhKXxq36DL+HYSzCc3+9O6UNzqsgPfYFX", "0", "321"}) //.move_as_ok(); //auto wallet_query = fift_output.source_lookup.read_file("wallet-query.boc").move_as_ok().data; - //ton::TestWallet::Gift gift; + //ion::TestWallet::Gift gift; //gift.destination = dest; //gift.message = "TESTv2"; //gift.gramms = 321000000000ll; ////CHECK(priv_key.get_public_key().ok().as_octet_string() == wallet->get_public_key().ok().as_octet_string()); - //auto gift_message = ton::GenericAccount::create_ext_message( + //auto gift_message = ion::GenericAccount::create_ext_message( //address, {}, wallet->make_a_gift_message(priv_key, 60, {gift}).move_as_ok()); //LOG(ERROR) << "-------"; //vm::load_cell_slice(gift_message).print_rec(std::cerr); @@ -384,22 +384,22 @@ TEST(Tonlib, RestrictedWallet3) { auto priv_key = td::Ed25519::generate_private_key().move_as_ok(); auto pub_key = priv_key.get_public_key().move_as_ok(); - ton::RestrictedWallet::InitData init_data; + ion::RestrictedWallet::InitData init_data; init_data.init_key = init_pub_key.as_octet_string(); init_data.main_key = pub_key.as_octet_string(); init_data.wallet_id = 123; - auto wallet = ton::RestrictedWallet::create(init_data, 1); + auto wallet = ion::RestrictedWallet::create(init_data, 1); auto address = wallet->get_address(); td::uint64 x = 100 * 1000000000ull; - ton::RestrictedWallet::Config config; + ion::RestrictedWallet::Config config; config.start_at = 1; config.limits = {{-32768, x}, {92, x * 3 / 4}, {183, x * 1 / 2}, {366, x * 1 / 4}, {548, 0}}; CHECK(wallet.write().send_external_message(wallet->get_init_message(init_priv_key, 10, config).move_as_ok()).success); CHECK(wallet->get_seqno().move_as_ok() == 1); - ton::WalletInterface::Gift gift; + ion::WalletInterface::Gift gift; gift.destination = address; gift.message = "hello"; CHECK(wallet.write().send_external_message(wallet->make_a_gift_message(priv_key, 10, {gift}).move_as_ok()).success); @@ -410,9 +410,9 @@ template void check_wallet_seqno(td::Ref wallet, td::uint32 seqno) { ASSERT_EQ(seqno, wallet->get_seqno().ok()); } -void check_wallet_seqno(td::Ref wallet, td::uint32 seqno) { +void check_wallet_seqno(td::Ref wallet, td::uint32 seqno) { } -void check_wallet_seqno(td::Ref wallet, td::uint32 seqno) { +void check_wallet_seqno(td::Ref wallet, td::uint32 seqno) { } template void check_wallet_state(td::Ref wallet, td::uint32 seqno, td::uint32 wallet_id, td::Slice public_key) { @@ -424,14 +424,14 @@ void check_wallet_state(td::Ref wallet, td::uint32 seqno, td::uint32 wallet_i struct CreatedWallet { td::optional priv_key; block::StdAddress address; - td::Ref wallet; + td::Ref wallet; }; template class InitWallet { public: CreatedWallet operator()(int revision) const { - ton::WalletInterface::DefaultInitData init_data; + ion::WalletInterface::DefaultInitData init_data; auto priv_key = td::Ed25519::generate_private_key().move_as_ok(); auto pub_key = priv_key.get_public_key().move_as_ok(); @@ -453,23 +453,23 @@ class InitWallet { }; template <> -CreatedWallet InitWallet::operator()(int revision) const { +CreatedWallet InitWallet::operator()(int revision) const { auto init_priv_key = td::Ed25519::generate_private_key().move_as_ok(); auto init_pub_key = init_priv_key.get_public_key().move_as_ok(); auto priv_key = td::Ed25519::generate_private_key().move_as_ok(); auto pub_key = priv_key.get_public_key().move_as_ok(); - ton::RestrictedWallet::InitData init_data; + ion::RestrictedWallet::InitData init_data; init_data.init_key = init_pub_key.as_octet_string(); init_data.main_key = pub_key.as_octet_string(); init_data.wallet_id = 123; - auto wallet = ton::RestrictedWallet::create(init_data, 1); + auto wallet = ion::RestrictedWallet::create(init_data, 1); check_wallet_state(wallet, 0, 123, init_data.init_key); auto address = wallet->get_address(); td::uint64 x = 100 * 1000000000ull; - ton::RestrictedWallet::Config config; + ion::RestrictedWallet::Config config; config.start_at = 1; config.limits = {{-32768, x}, {92, x * 3 / 4}, {183, x * 1 / 2}, {366, x * 1 / 4}, {548, 0}}; CHECK(wallet.write().send_external_message(wallet->get_init_message(init_priv_key, 10, config).move_as_ok()).success); @@ -493,9 +493,9 @@ void do_test_wallet(int revision) { check_wallet_state(iwallet, 1, 123, public_key); // lets send a lot of messages - std::vector gifts; + std::vector gifts; for (size_t i = 0; i < iwallet->get_max_gifts_size(); i++) { - ton::WalletInterface::Gift gift; + ion::WalletInterface::Gift gift; gift.gramms = 1; gift.destination = address; gift.message = std::string(iwallet->get_max_message_size(), 'z'); @@ -508,11 +508,11 @@ void do_test_wallet(int revision) { { auto cwallet = iwallet; CHECK(!cwallet.write() - .send_external_message(send_gifts, ton::SmartContract::Args().set_now(valid_until + 1)) + .send_external_message(send_gifts, ion::SmartContract::Args().set_now(valid_until + 1)) .success); } //TODO: make wallet work (or not) with now == valid_until - auto ans = iwallet.write().send_external_message(send_gifts, ton::SmartContract::Args().set_now(valid_until - 1)); + auto ans = iwallet.write().send_external_message(send_gifts, ion::SmartContract::Args().set_now(valid_until - 1)); CHECK(ans.success); CHECK((int)gifts.size() <= ans.output_actions_count(ans.actions)); check_wallet_state(iwallet, 2, 123, public_key); @@ -526,15 +526,15 @@ void do_test_wallet() { } TEST(Tonlib, Wallet) { - do_test_wallet(); - do_test_wallet(); - do_test_wallet(); - do_test_wallet(); - do_test_wallet(); + do_test_wallet(); + do_test_wallet(); + do_test_wallet(); + do_test_wallet(); + do_test_wallet(); } namespace std { // ouch -bool operator<(const ton::MultisigWallet::Mask& a, const ton::MultisigWallet::Mask& b) { +bool operator<(const ion::MultisigWallet::Mask& a, const ion::MultisigWallet::Mask& b) { for (size_t i = 0; i < a.size(); i++) { if (a[i] != b[i]) { return a[i] < b[i]; @@ -545,7 +545,7 @@ bool operator<(const ton::MultisigWallet::Mask& a, const ton::MultisigWallet::Ma } // namespace std TEST(Smartcon, Multisig) { - auto ms_lib = ton::MultisigWallet::create(); + auto ms_lib = ion::MultisigWallet::create(); int n = 100; int k = 99; @@ -556,10 +556,10 @@ TEST(Smartcon, Multisig) { } auto init_state = ms_lib->create_init_data( wallet_id, td::transform(keys, [](auto& key) { return key.get_public_key().ok().as_octet_string(); }), k); - auto ms = ton::MultisigWallet::create(init_state); + auto ms = ion::MultisigWallet::create(init_state); td::uint32 now = 0; - auto args = [&now]() -> ton::SmartContract::Args { return ton::SmartContract::Args().set_now(now); }; + auto args = [&now]() -> ion::SmartContract::Args { return ion::SmartContract::Args().set_now(now); }; // first empty query (init) CHECK(ms.write().send_external_message(vm::CellBuilder().finalize(), args()).code == 0); @@ -568,7 +568,7 @@ TEST(Smartcon, Multisig) { { td::uint64 query_id = 123 | ((now + 10 * 60ull) << 32); - ton::MultisigWallet::QueryBuilder qb(wallet_id, query_id, vm::CellBuilder().finalize()); + ion::MultisigWallet::QueryBuilder qb(wallet_id, query_id, vm::CellBuilder().finalize()); auto query = qb.create(0, keys[0]); auto res = ms.write().send_external_message(query, args()); CHECK(!res.accepted); @@ -577,7 +577,7 @@ TEST(Smartcon, Multisig) { { for (int i = 1; i <= 11; i++) { td::uint64 query_id = i | ((now + 100 * 60ull) << 32); - ton::MultisigWallet::QueryBuilder qb(wallet_id, query_id, vm::CellBuilder().finalize()); + ion::MultisigWallet::QueryBuilder qb(wallet_id, query_id, vm::CellBuilder().finalize()); auto query = qb.create(5, keys[5]); auto res = ms.write().send_external_message(query, args()); if (i <= 10) { @@ -590,7 +590,7 @@ TEST(Smartcon, Multisig) { now += 100 * 60 + 100; { td::uint64 query_id = 200 | ((now + 100 * 60ull) << 32); - ton::MultisigWallet::QueryBuilder qb(wallet_id, query_id, vm::CellBuilder().finalize()); + ion::MultisigWallet::QueryBuilder qb(wallet_id, query_id, vm::CellBuilder().finalize()); auto query = qb.create(6, keys[6]); auto res = ms.write().send_external_message(query, args()); CHECK(res.accepted); @@ -598,7 +598,7 @@ TEST(Smartcon, Multisig) { { td::uint64 query_id = 300 | ((now + 100 * 60ull) << 32); - ton::MultisigWallet::QueryBuilder qb(wallet_id, query_id, vm::CellBuilder().finalize()); + ion::MultisigWallet::QueryBuilder qb(wallet_id, query_id, vm::CellBuilder().finalize()); auto query = qb.create(5, keys[5]); auto res = ms.write().send_external_message(query, args()); CHECK(res.accepted); @@ -606,7 +606,7 @@ TEST(Smartcon, Multisig) { } td::uint64 query_id = 123 | ((now + 100 * 60ull) << 32); - ton::MultisigWallet::QueryBuilder qb(wallet_id, query_id, vm::CellBuilder().finalize()); + ion::MultisigWallet::QueryBuilder qb(wallet_id, query_id, vm::CellBuilder().finalize()); for (int i = 0; i < 10; i++) { auto query = qb.create(i, keys[i]); auto ans = ms.write().send_external_message(query, args()); @@ -628,7 +628,7 @@ TEST(Smartcon, Multisig) { ASSERT_EQ(0, ms->processed(query_id)); { - ton::MultisigWallet::QueryBuilder qb(wallet_id, query_id, vm::CellBuilder().finalize()); + ion::MultisigWallet::QueryBuilder qb(wallet_id, query_id, vm::CellBuilder().finalize()); for (int i = 50; i + 1 < 100; i++) { qb.sign(i, keys[i]); } @@ -651,13 +651,13 @@ TEST(Smartcont, MultisigStress) { keys.push_back(td::Ed25519::generate_private_key().move_as_ok()); } auto public_keys = td::transform(keys, [](auto& key) { return key.get_public_key().ok().as_octet_string(); }); - auto ms_lib = ton::MultisigWallet::create(); + auto ms_lib = ion::MultisigWallet::create(); auto init_state_old = ms_lib->create_init_data_fast(wallet_id, td::transform(public_keys, [](auto& key) { return key.copy(); }), k); auto init_state = ms_lib->create_init_data(wallet_id, td::transform(public_keys, [](auto& key) { return key.copy(); }), k); CHECK(init_state_old->get_hash() == init_state->get_hash()); - auto ms = ton::MultisigWallet::create(init_state); + auto ms = ion::MultisigWallet::create(init_state); CHECK(ms->get_public_keys() == public_keys); td::int32 now = 100 * 60; @@ -686,8 +686,8 @@ TEST(Smartcont, MultisigStress) { auto verify = [&] { auto messages = ms->get_unsigned_messaged(); - std::set> s; - std::set> t; + std::set> s; + std::set> t; for (auto& m : messages) { auto x = std::make_tuple(m.query_id, m.signed_by, m.message->get_hash().as_slice().str()); @@ -705,7 +705,7 @@ TEST(Smartcont, MultisigStress) { }; auto sign_query = [&](Query& query, Mask mask) { - auto qb = ton::MultisigWallet::QueryBuilder(wallet_id, query.id, query.message); + auto qb = ion::MultisigWallet::QueryBuilder(wallet_id, query.id, query.message); int first_i = -1; for (int i = 0; i < (int)mask.size(); i++) { if (mask.test(i)) { @@ -790,7 +790,7 @@ TEST(Smartcont, MultisigStress) { } auto expect_is_ready = query.signed_mask.count() >= (size_t)k; auto state = ms->get_query_state(query.id); - ASSERT_EQ(expect_is_ready, (state.state == ton::MultisigWallet::QueryState::Sent)); + ASSERT_EQ(expect_is_ready, (state.state == ion::MultisigWallet::QueryState::Sent)); CHECK(expect_is_ready || state.mask == query.signed_mask); ASSERT_EQ(expect_is_ready, is_ready(query)); if (expect_is_ready) { @@ -809,7 +809,7 @@ TEST(Smartcont, MultisigStress) { class MapDns { public: - using ManualDns = ton::ManualDns; + using ManualDns = ion::ManualDns; struct Entry { std::string name; td::Bits256 category = td::Bits256::zero(); @@ -821,7 +821,7 @@ class MapDns { bool operator<(const Entry& other) const { return key() < other.key(); } - bool operator==(const ton::DnsInterface::Entry& other) const { + bool operator==(const ion::DnsInterface::Entry& other) const { return key() == other.key() && other.data.type == ManualDns::EntryData::Type::Text && other.data.data.get().text == text; } @@ -864,11 +864,11 @@ class MapDns { do_update(action); } } - using CombinedActions = ton::ManualDns::CombinedActions; + using CombinedActions = ion::ManualDns::CombinedActions; void update_combined(td::Span actions) { LOG(ERROR) << "BEGIN"; LOG(ERROR) << td::format::as_array(actions); - auto combined_actions = ton::ManualDns::combine_actions(actions); + auto combined_actions = ion::ManualDns::combine_actions(actions); for (auto& c : combined_actions) { LOG(ERROR) << c.name << ":" << c.category.to_hex(); if (c.actions) { @@ -893,7 +893,7 @@ class MapDns { auto it = entries_.find(name); while (it == entries_.end()) { auto sz = name.find('.'); - category = ton::DNS_NEXT_RESOLVER_CATEGORY; + category = ion::DNS_NEXT_RESOLVER_CATEGORY; if (sz != td::Slice::npos) { name = name.substr(sz + 1); } else { @@ -1014,7 +1014,7 @@ class CheckedDns { void update(td::Span entries) { if (dns_.not_null()) { auto smc_actions = td::transform(entries, [](auto& entry) { - ton::DnsInterface::Action action; + ion::DnsInterface::Action action; action.name = entry.name; action.category = entry.category; if (entry.text) { @@ -1078,7 +1078,7 @@ class CheckedDns { } private: - using ManualDns = ton::ManualDns; + using ManualDns = ion::ManualDns; td::optional key_; td::Ref dns_; td::uint32 query_id_ = 1; // Query id serve as "valid until", but in tests now() == 0 @@ -1088,7 +1088,7 @@ class CheckedDns { void do_update_smc(const Action& entry) { LOG(ERROR) << td::format::escaped(ManualDns::encode_name(entry.name)); - ton::DnsInterface::Action action; + ion::DnsInterface::Action action; action.name = entry.name; action.category = entry.category; action.data = ManualDns::EntryData::text(entry.text.value()).as_cell().move_as_ok(); @@ -1166,7 +1166,7 @@ void do_dns_test(CheckedDns&& dns) { }; TEST(Smartcont, DnsManual) { - using ManualDns = ton::ManualDns; + using ManualDns = ion::ManualDns; auto test_entry_data = [](auto&& entry_data) { auto cell = entry_data.as_cell().move_as_ok(); auto cs = vm::load_cell_slice(cell); @@ -1174,7 +1174,7 @@ TEST(Smartcont, DnsManual) { ASSERT_EQ(entry_data, new_entry_data); }; test_entry_data(ManualDns::EntryData::text("abcd")); - test_entry_data(ManualDns::EntryData::adnl_address(ton::Bits256{})); + test_entry_data(ManualDns::EntryData::adnl_address(ion::Bits256{})); CHECK(td::Slice("a\0b\0") == ManualDns::encode_name("b.a")); CHECK(td::Slice("a\0b\0") == ManualDns::encode_name(".b.a")); @@ -1251,12 +1251,12 @@ TEST(Smartcont, DnsManual) { { auto actions_ext = - ton::ManualDns::parse("delete.name one\nset one 1 TEXT:one\ndelete.name two\nset two 2 TEXT:two").move_as_ok(); + ion::ManualDns::parse("delete.name one\nset one 1 TEXT:one\ndelete.name two\nset two 2 TEXT:two").move_as_ok(); auto actions = td::transform(actions_ext, [](auto& action) { td::optional data; if (action.data) { - data = action.data.value().data.template get().text; + data = action.data.value().data.template get().text; } return CheckedDns::Action{action.name, action.category, std::move(data)}; }); @@ -1270,7 +1270,7 @@ TEST(Smartcont, DnsManual) { do_dns_test(CheckedDns(true, true)); } -using namespace ton::pchan; +using namespace ion::pchan; template struct ValidateState { @@ -1438,7 +1438,7 @@ struct ValidateStateClose : public ValidateState { // config$_ initTimeout:int exitTimeout:int a_key:int256 b_key:int256 a_addr b_addr channel_id:int256 = Config; TEST(Smarcont, Channel) { - auto code = ton::SmartContractCode::get_code(ton::SmartContractCode::PaymentChannel); + auto code = ion::SmartContractCode::get_code(ion::SmartContractCode::PaymentChannel); Config config; auto a_pkey = td::Ed25519::generate_private_key().move_as_ok(); auto b_pkey = td::Ed25519::generate_private_key().move_as_ok(); @@ -1456,7 +1456,7 @@ TEST(Smarcont, Channel) { data.state = data.init_state(); auto data_cell = data.serialize(); - auto channel = ton::SmartContract::create(ton::SmartContract::State{code, data_cell}); + auto channel = ion::SmartContract::create(ion::SmartContract::State{code, data_cell}); ValidateStateInit(channel->get_state().data) .expect_A(0) .expect_B(0) @@ -1490,18 +1490,18 @@ TEST(Smarcont, Channel) { expect_code("Trying to invoke a timeout while channel is empty", no_timeout, channel.write().send_external_message(MsgTimeoutBuilder().finalize(), - ton::SmartContract::Args().set_now(1000000))); + ion::SmartContract::Args().set_now(1000000))); expect_code("External init message with no signatures", replay_protection, channel.write().send_external_message(MsgInitBuilder().channel_id(config.channel_id).finalize())); expect_code("Internal init message with not enough value", msg_value_too_small, channel.write().send_internal_message( MsgInitBuilder().channel_id(config.channel_id).inc_A(1000).min_B(2000).with_a_key(&a_pkey).finalize(), - ton::SmartContract::Args().set_amount(100))); + ion::SmartContract::Args().set_amount(100))); expect_code( "Internal init message with wrong channel_id", wrong_channel_id, channel.write().send_internal_message(MsgInitBuilder().inc_A(1000).min_B(2000).with_a_key(&a_pkey).finalize(), - ton::SmartContract::Args().set_amount(1000))); + ion::SmartContract::Args().set_amount(1000))); expect_ok("A init with (inc_A = 1000, min_A = 1, min_B = 2000)", channel.write().send_internal_message(MsgInitBuilder() .channel_id(config.channel_id) @@ -1510,7 +1510,7 @@ TEST(Smarcont, Channel) { .min_B(2000) .with_a_key(&a_pkey) .finalize(), - ton::SmartContract::Args().set_amount(1000))); + ion::SmartContract::Args().set_amount(1000))); ValidateStateInit(channel->get_state().data) .expect_A(1000) .expect_B(0) @@ -1525,15 +1525,15 @@ TEST(Smarcont, Channel) { expect_code("Repeated init of A init with (inc_A = 100, min_B = 5000). Must be ignored", replay_protection, channel.write().send_internal_message( MsgInitBuilder().channel_id(config.channel_id).inc_A(100).min_B(5000).with_a_key(&a_pkey).finalize(), - ton::SmartContract::Args().set_amount(1000))); + ion::SmartContract::Args().set_amount(1000))); expect_code( "Trying to invoke a timeout too early", no_timeout, - channel.write().send_external_message(MsgTimeoutBuilder().finalize(), ton::SmartContract::Args().set_now(0))); + channel.write().send_external_message(MsgTimeoutBuilder().finalize(), ion::SmartContract::Args().set_now(0))); { auto channel_copy = channel; expect_ok("Invoke a timeout", channel_copy.write().send_external_message(MsgTimeoutBuilder().finalize(), - ton::SmartContract::Args().set_now(21))); + ion::SmartContract::Args().set_now(21))); ValidateStatePayout(channel_copy->get_state().data).expect_A(1000).expect_B(0).finish().ensure(); } { @@ -1541,14 +1541,14 @@ TEST(Smarcont, Channel) { expect_ok("B init with inc_B < min_B. Leads to immediate payout", channel_copy.write().send_internal_message( MsgInitBuilder().channel_id(config.channel_id).inc_B(1500).with_b_key(&b_pkey).finalize(), - ton::SmartContract::Args().set_amount(1500))); + ion::SmartContract::Args().set_amount(1500))); ValidateStatePayout(channel_copy->get_state().data).expect_A(1000).expect_B(1500).finish().ensure(); } expect_ok("B init with (inc_B = 2000, min_A = 1, min_A = 1000)", channel.write().send_internal_message( MsgInitBuilder().channel_id(config.channel_id).inc_B(2000).min_A(1000).with_b_key(&b_pkey).finalize(), - ton::SmartContract::Args().set_amount(2000))); + ion::SmartContract::Args().set_amount(2000))); ValidateStateClose(channel->get_state().data) .expect_A(1000) .expect_B(2000) @@ -1572,7 +1572,7 @@ TEST(Smarcont, Channel) { .with_a_key(&a_pkey) .with_b_key(&b_pkey) .finalize(), - ton::SmartContract::Args().set_now(21))); + ion::SmartContract::Args().set_now(21))); ValidateStatePayout(channel_copy->get_state().data).expect_A(1000 + 10).expect_B(2000 - 10).finish().ensure(); } { @@ -1588,7 +1588,7 @@ TEST(Smarcont, Channel) { .with_a_key(&a_pkey) .with_b_key(&b_pkey) .finalize(), - ton::SmartContract::Args().set_now(21))); + ion::SmartContract::Args().set_now(21))); ValidateStatePayout(channel_copy->get_state().data).expect_A(1000 + 10).expect_B(2000 - 10).finish().ensure(); } @@ -1600,7 +1600,7 @@ TEST(Smarcont, Channel) { SignedPromiseBuilder().promise_A(1000000).with_key(&a_pkey).channel_id(config.channel_id).finalize()) .with_a_key(&a_pkey) .finalize(), - ton::SmartContract::Args().set_now(21))); + ion::SmartContract::Args().set_now(21))); expect_code( "B sends Promise(1000000, 0) signed by B", wrong_a_signature, channel.write().send_external_message( @@ -1609,7 +1609,7 @@ TEST(Smarcont, Channel) { SignedPromiseBuilder().promise_A(1000000).with_key(&b_pkey).channel_id(config.channel_id).finalize()) .with_b_key(&b_pkey) .finalize(), - ton::SmartContract::Args().set_now(21))); + ion::SmartContract::Args().set_now(21))); expect_code("B sends Promise(1000000, 0) signed by A with wrong channel_id", wrong_channel_id, channel.write().send_external_message(MsgCloseBuilder() .signed_promise(SignedPromiseBuilder() @@ -1619,7 +1619,7 @@ TEST(Smarcont, Channel) { .finalize()) .with_b_key(&b_pkey) .finalize(), - ton::SmartContract::Args().set_now(21))); + ion::SmartContract::Args().set_now(21))); expect_code( "B sends unsigned Promise(1000000, 0)", no_promise_signature, channel.write().send_external_message( @@ -1627,7 +1627,7 @@ TEST(Smarcont, Channel) { .signed_promise(SignedPromiseBuilder().promise_A(1000000).channel_id(config.channel_id).finalize()) .with_b_key(&b_pkey) .finalize(), - ton::SmartContract::Args().set_now(21))); + ion::SmartContract::Args().set_now(21))); expect_ok( "B sends Promise(1000000, 0) signed by A", @@ -1637,7 +1637,7 @@ TEST(Smarcont, Channel) { SignedPromiseBuilder().promise_A(1000000).with_key(&a_pkey).channel_id(config.channel_id).finalize()) .with_b_key(&b_pkey) .finalize(), - ton::SmartContract::Args().set_now(21))); + ion::SmartContract::Args().set_now(21))); ValidateStateClose(channel->get_state().data) .expect_A(1000) .expect_B(2000) @@ -1658,7 +1658,7 @@ TEST(Smarcont, Channel) { .finalize()) .with_a_key(&a_pkey) .finalize(), - ton::SmartContract::Args().set_now(21))); + ion::SmartContract::Args().set_now(21))); ValidateStatePayout(channel->get_state().data).expect_A(1000 + 10).expect_B(2000 - 10).finish().ensure(); #undef expect_ok #undef expect_code diff --git a/crypto/test/vm.cpp b/crypto/test/vm.cpp index 0f1b04429..c00b0ac51 100644 --- a/crypto/test/vm.cpp +++ b/crypto/test/vm.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/test/wycheproof.h b/crypto/test/wycheproof.h index 86a18501f..3291f814c 100644 --- a/crypto/test/wycheproof.h +++ b/crypto/test/wycheproof.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/tl/tlbc-aux.h b/crypto/tl/tlbc-aux.h index 97e5082e8..fe15e4745 100644 --- a/crypto/tl/tlbc-aux.h +++ b/crypto/tl/tlbc-aux.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/tl/tlbc-data.h b/crypto/tl/tlbc-data.h index 8b6f2392f..e2c80509e 100644 --- a/crypto/tl/tlbc-data.h +++ b/crypto/tl/tlbc-data.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/tl/tlbc-gen-cpp.cpp b/crypto/tl/tlbc-gen-cpp.cpp index 55b4a1c05..b368ea230 100644 --- a/crypto/tl/tlbc-gen-cpp.cpp +++ b/crypto/tl/tlbc-gen-cpp.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/tl/tlbc-gen-cpp.h b/crypto/tl/tlbc-gen-cpp.h index 351f92573..d61768c99 100644 --- a/crypto/tl/tlbc-gen-cpp.h +++ b/crypto/tl/tlbc-gen-cpp.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/tl/tlbc.cpp b/crypto/tl/tlbc.cpp index 0050e1610..1248536eb 100644 --- a/crypto/tl/tlbc.cpp +++ b/crypto/tl/tlbc.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. diff --git a/crypto/tl/tlblib.cpp b/crypto/tl/tlblib.cpp index 0e0e56265..a8e030d6b 100644 --- a/crypto/tl/tlblib.cpp +++ b/crypto/tl/tlblib.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/tl/tlblib.hpp b/crypto/tl/tlblib.hpp index a6350ece3..7e1750c74 100644 --- a/crypto/tl/tlblib.hpp +++ b/crypto/tl/tlblib.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/util/Miner.cpp b/crypto/util/Miner.cpp index 3e26fac6b..6276586a6 100644 --- a/crypto/util/Miner.cpp +++ b/crypto/util/Miner.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -24,7 +24,7 @@ #include "td/utils/port/Clocks.h" #include -namespace ton { +namespace ion { #pragma pack(push, 1) struct HData { unsigned char op[4]; @@ -126,4 +126,4 @@ td::optional Miner::run(const Options& options) { } return {}; } -} // namespace ton +} // namespace ion diff --git a/crypto/util/Miner.h b/crypto/util/Miner.h index f91a66866..a1f7b919c 100644 --- a/crypto/util/Miner.h +++ b/crypto/util/Miner.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -25,7 +25,7 @@ #include #include -namespace ton { +namespace ion { class Miner { public: struct Options { @@ -40,4 +40,4 @@ class Miner { static td::optional run(const Options& options); }; -} // namespace ton +} // namespace ion diff --git a/crypto/util/mintless-proof-generator.cpp b/crypto/util/mintless-proof-generator.cpp index 62b5f0d66..7267198ce 100644 --- a/crypto/util/mintless-proof-generator.cpp +++ b/crypto/util/mintless-proof-generator.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #include "block-parse.h" @@ -35,7 +35,7 @@ const size_t KEY_LEN = 3 + 8 + 256; void print_help() { - std::cerr << "mintless-proof-generator - generates proofs for mintless jettons. Usage:\n\n"; + std::cerr << "mintless-proof-generator - generates proofs for mintless jetions. Usage:\n\n"; std::cerr << "mintless-proof-generator generate \n"; std::cerr << " Generate a full tree for , save boc to .\n"; std::cerr << " Input format: each line is
.\n\n"; @@ -77,7 +77,7 @@ block::StdAddress key_to_address(const td::BitArray &key) { td::ConstBitPtr ptr = key.bits(); LOG_CHECK(ptr.get_uint(3) == 0b100) << "Invalid address"; ptr.advance(3); - addr.workchain = (ton::WorkchainId)ptr.get_int(8); + addr.workchain = (ion::WorkchainId)ptr.get_int(8); ptr.advance(8); addr.addr = ptr; return addr; @@ -289,7 +289,7 @@ class MakeAllProofsActor : public td::actor::core::Actor { void run_worker(td::BitArray key, td::uint64 idx) { pending_results_[idx] = ""; - ton::delay_action( + ion::delay_action( [SelfId = actor_id(this), key, idx, root = dict_.get_root_cell()]() { vm::MerkleProofBuilder mpb{root}; CHECK(vm::Dictionary(mpb.root(), KEY_LEN).lookup(key).not_null()); diff --git a/crypto/util/pow-miner.cpp b/crypto/util/pow-miner.cpp index c065fdc70..b1d944888 100644 --- a/crypto/util/pow-miner.cpp +++ b/crypto/util/pow-miner.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -127,8 +127,8 @@ int found(td::Slice data) { return 0; } -void miner(const ton::Miner::Options& options) { - auto res = ton::Miner::run(options); +void miner(const ion::Miner::Options& options) { + auto res = ion::Miner::run(options); if (res) { found(res.value()); } @@ -141,17 +141,17 @@ class MinerBench : public td::Benchmark { } void run(int n) override { - ton::Miner::Options options; + ion::Miner::Options options; options.my_address.parse_addr("EQDU86V5wyPrLd4nQ0RHPcCLPZq_y1O5wFWyTsMw63vjXTOv"); std::fill(options.seed.begin(), options.seed.end(), 0xa7); std::fill(options.complexity.begin(), options.complexity.end(), 0); options.max_iterations = n; - CHECK(!ton::Miner::run(options)); + CHECK(!ion::Miner::run(options)); } }; int main(int argc, char* const argv[]) { - ton::Miner::Options options; + ion::Miner::Options options; progname = argv[0]; int i, threads = 0; diff --git a/crypto/vm/Hasher.cpp b/crypto/vm/Hasher.cpp index f70988d33..172b69b67 100644 --- a/crypto/vm/Hasher.cpp +++ b/crypto/vm/Hasher.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #include "vm/Hasher.h" #include "vm/excno.hpp" diff --git a/crypto/vm/Hasher.h b/crypto/vm/Hasher.h index 7e4416908..15f85278e 100644 --- a/crypto/vm/Hasher.h +++ b/crypto/vm/Hasher.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #pragma once #include "common/refcnt.hpp" diff --git a/crypto/vm/arithops.cpp b/crypto/vm/arithops.cpp index fc482fc4d..3209ac7e0 100644 --- a/crypto/vm/arithops.cpp +++ b/crypto/vm/arithops.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/arithops.h b/crypto/vm/arithops.h index c9735798c..6b51d7ffa 100644 --- a/crypto/vm/arithops.h +++ b/crypto/vm/arithops.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/atom.cpp b/crypto/vm/atom.cpp index dbf1b16f5..ece74210d 100644 --- a/crypto/vm/atom.cpp +++ b/crypto/vm/atom.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/atom.h b/crypto/vm/atom.h index 9946a9ff3..e26694da0 100644 --- a/crypto/vm/atom.h +++ b/crypto/vm/atom.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/bls.cpp b/crypto/vm/bls.cpp index ff5179c72..4e51f7daa 100644 --- a/crypto/vm/bls.cpp +++ b/crypto/vm/bls.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #include "bls.h" diff --git a/crypto/vm/bls.h b/crypto/vm/bls.h index b7ffc1368..8c5b317f6 100644 --- a/crypto/vm/bls.h +++ b/crypto/vm/bls.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #include diff --git a/crypto/vm/boc-writers.h b/crypto/vm/boc-writers.h index e33886df1..4dc345bd6 100644 --- a/crypto/vm/boc-writers.h +++ b/crypto/vm/boc-writers.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #pragma once #include "td/utils/port/FileFd.h" diff --git a/crypto/vm/boc.cpp b/crypto/vm/boc.cpp index 7ec8bdd1d..f7a2b5318 100644 --- a/crypto/vm/boc.cpp +++ b/crypto/vm/boc.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/boc.h b/crypto/vm/boc.h index 8adf240fb..99353fbd6 100644 --- a/crypto/vm/boc.h +++ b/crypto/vm/boc.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/box.hpp b/crypto/vm/box.hpp index 0d676caeb..37760c425 100644 --- a/crypto/vm/box.hpp +++ b/crypto/vm/box.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cellops.cpp b/crypto/vm/cellops.cpp index 61ffe5c55..b99f23c2d 100644 --- a/crypto/vm/cellops.cpp +++ b/crypto/vm/cellops.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -864,7 +864,7 @@ void register_cell_serialize_ops(OpcodeTable& cp0) { .insert(OpcodeInstr::mksimple(0xcf3e, 16, "BCHKREFSQ", std::bind(exec_builder_chk_bits_refs, _1, 6))) .insert(OpcodeInstr::mksimple(0xcf3f, 16, "BCHKBITREFSQ", std::bind(exec_builder_chk_bits_refs, _1, 7))) .insert(OpcodeInstr::mksimple(0xcf40, 16, "STZEROES", std::bind(exec_store_same, _1, "STZEROES", 0))) - .insert(OpcodeInstr::mksimple(0xcf41, 16, "STONES", std::bind(exec_store_same, _1, "STONES", 1))) + .insert(OpcodeInstr::mksimple(0xcf41, 16, "SIONES", std::bind(exec_store_same, _1, "SIONES", 1))) .insert(OpcodeInstr::mksimple(0xcf42, 16, "STSAME", std::bind(exec_store_same, _1, "STSAME", -1))) .insert(OpcodeInstr::mkext(0xcf80 >> 7, 9, 5, dump_store_const_slice, exec_store_const_slice, compute_len_store_const_slice)); diff --git a/crypto/vm/cellops.h b/crypto/vm/cellops.h index 0fd62854f..96d2e2d7a 100644 --- a/crypto/vm/cellops.h +++ b/crypto/vm/cellops.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cellparse.hpp b/crypto/vm/cellparse.hpp index 5ca3d2909..d46813228 100644 --- a/crypto/vm/cellparse.hpp +++ b/crypto/vm/cellparse.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells.h b/crypto/vm/cells.h index cf917eff4..da9561719 100644 --- a/crypto/vm/cells.h +++ b/crypto/vm/cells.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/Cell.cpp b/crypto/vm/cells/Cell.cpp index 1c20ba41a..e66bc72ea 100644 --- a/crypto/vm/cells/Cell.cpp +++ b/crypto/vm/cells/Cell.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/Cell.h b/crypto/vm/cells/Cell.h index a75371dbb..0f3bb5f81 100644 --- a/crypto/vm/cells/Cell.h +++ b/crypto/vm/cells/Cell.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/CellBuilder.cpp b/crypto/vm/cells/CellBuilder.cpp index 772b5f6b7..2094c05ff 100644 --- a/crypto/vm/cells/CellBuilder.cpp +++ b/crypto/vm/cells/CellBuilder.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/CellBuilder.h b/crypto/vm/cells/CellBuilder.h index 954a1ac08..2a1df7ba4 100644 --- a/crypto/vm/cells/CellBuilder.h +++ b/crypto/vm/cells/CellBuilder.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/CellHash.cpp b/crypto/vm/cells/CellHash.cpp index 038e9a9a0..d064ee666 100644 --- a/crypto/vm/cells/CellHash.cpp +++ b/crypto/vm/cells/CellHash.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/CellHash.h b/crypto/vm/cells/CellHash.h index 9435675f1..bb1dc9fd9 100644 --- a/crypto/vm/cells/CellHash.h +++ b/crypto/vm/cells/CellHash.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/CellSlice.cpp b/crypto/vm/cells/CellSlice.cpp index 466bcd8d1..c189d2de0 100644 --- a/crypto/vm/cells/CellSlice.cpp +++ b/crypto/vm/cells/CellSlice.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/CellSlice.h b/crypto/vm/cells/CellSlice.h index 33fad7410..19cdda463 100644 --- a/crypto/vm/cells/CellSlice.h +++ b/crypto/vm/cells/CellSlice.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/CellString.cpp b/crypto/vm/cells/CellString.cpp index 474bc797e..edd0d7d35 100644 --- a/crypto/vm/cells/CellString.cpp +++ b/crypto/vm/cells/CellString.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2019-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/CellString.h b/crypto/vm/cells/CellString.h index 10bd89aa7..200d0b7bb 100644 --- a/crypto/vm/cells/CellString.h +++ b/crypto/vm/cells/CellString.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2019-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/CellTraits.cpp b/crypto/vm/cells/CellTraits.cpp index a619d86c2..0508b4494 100644 --- a/crypto/vm/cells/CellTraits.cpp +++ b/crypto/vm/cells/CellTraits.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/CellTraits.h b/crypto/vm/cells/CellTraits.h index c994e47e2..be4f62e50 100644 --- a/crypto/vm/cells/CellTraits.h +++ b/crypto/vm/cells/CellTraits.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/CellUsageTree.cpp b/crypto/vm/cells/CellUsageTree.cpp index 410b3fcd6..155bd2127 100644 --- a/crypto/vm/cells/CellUsageTree.cpp +++ b/crypto/vm/cells/CellUsageTree.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/CellUsageTree.h b/crypto/vm/cells/CellUsageTree.h index af0f21f53..cea67f26b 100644 --- a/crypto/vm/cells/CellUsageTree.h +++ b/crypto/vm/cells/CellUsageTree.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/CellWithStorage.h b/crypto/vm/cells/CellWithStorage.h index f3fedfc31..661a73bb5 100644 --- a/crypto/vm/cells/CellWithStorage.h +++ b/crypto/vm/cells/CellWithStorage.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/DataCell.cpp b/crypto/vm/cells/DataCell.cpp index 4dd301616..963afe32f 100644 --- a/crypto/vm/cells/DataCell.cpp +++ b/crypto/vm/cells/DataCell.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/DataCell.h b/crypto/vm/cells/DataCell.h index 6d3c845fc..12a8f56d6 100644 --- a/crypto/vm/cells/DataCell.h +++ b/crypto/vm/cells/DataCell.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/ExtCell.h b/crypto/vm/cells/ExtCell.h index 401bb0483..a0533a2b7 100644 --- a/crypto/vm/cells/ExtCell.h +++ b/crypto/vm/cells/ExtCell.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/LevelMask.cpp b/crypto/vm/cells/LevelMask.cpp index 46d73f0df..07bb47849 100644 --- a/crypto/vm/cells/LevelMask.cpp +++ b/crypto/vm/cells/LevelMask.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/LevelMask.h b/crypto/vm/cells/LevelMask.h index 35d03d937..24fb785ba 100644 --- a/crypto/vm/cells/LevelMask.h +++ b/crypto/vm/cells/LevelMask.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/MerkleProof.cpp b/crypto/vm/cells/MerkleProof.cpp index 26dff7879..857271b89 100644 --- a/crypto/vm/cells/MerkleProof.cpp +++ b/crypto/vm/cells/MerkleProof.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/MerkleProof.h b/crypto/vm/cells/MerkleProof.h index fc2cb6ebd..4a0ca8a13 100644 --- a/crypto/vm/cells/MerkleProof.h +++ b/crypto/vm/cells/MerkleProof.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/MerkleUpdate.cpp b/crypto/vm/cells/MerkleUpdate.cpp index 894612bdc..754f21f00 100644 --- a/crypto/vm/cells/MerkleUpdate.cpp +++ b/crypto/vm/cells/MerkleUpdate.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/MerkleUpdate.h b/crypto/vm/cells/MerkleUpdate.h index 41b4c138f..1cb3ae484 100644 --- a/crypto/vm/cells/MerkleUpdate.h +++ b/crypto/vm/cells/MerkleUpdate.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/PrunnedCell.h b/crypto/vm/cells/PrunnedCell.h index a58b245cc..be23bb60a 100644 --- a/crypto/vm/cells/PrunnedCell.h +++ b/crypto/vm/cells/PrunnedCell.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/UsageCell.h b/crypto/vm/cells/UsageCell.h index 3e6e88982..ce398f6ce 100644 --- a/crypto/vm/cells/UsageCell.h +++ b/crypto/vm/cells/UsageCell.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/VirtualCell.h b/crypto/vm/cells/VirtualCell.h index 02abc1c88..6f9ef8828 100644 --- a/crypto/vm/cells/VirtualCell.h +++ b/crypto/vm/cells/VirtualCell.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cells/VirtualizationParameters.h b/crypto/vm/cells/VirtualizationParameters.h index b83e87d23..94516695a 100644 --- a/crypto/vm/cells/VirtualizationParameters.h +++ b/crypto/vm/cells/VirtualizationParameters.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cellslice.h b/crypto/vm/cellslice.h index 8546e1ce4..9cd870b89 100644 --- a/crypto/vm/cellslice.h +++ b/crypto/vm/cellslice.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/continuation.cpp b/crypto/vm/continuation.cpp index bc67c6d22..87b5faf9c 100644 --- a/crypto/vm/continuation.cpp +++ b/crypto/vm/continuation.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/continuation.h b/crypto/vm/continuation.h index 0c758c922..44ba25f43 100644 --- a/crypto/vm/continuation.h +++ b/crypto/vm/continuation.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/contops.cpp b/crypto/vm/contops.cpp index 9610e4aa6..d26f9635b 100644 --- a/crypto/vm/contops.cpp +++ b/crypto/vm/contops.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/contops.h b/crypto/vm/contops.h index e86a303c4..083ec6ece 100644 --- a/crypto/vm/contops.h +++ b/crypto/vm/contops.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/cp0.cpp b/crypto/vm/cp0.cpp index fe5dd8ef1..24e86a4b4 100644 --- a/crypto/vm/cp0.cpp +++ b/crypto/vm/cp0.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -25,7 +25,7 @@ #include "contops.h" #include "dictops.h" #include "debugops.h" -#include "tonops.h" +#include "ionops.h" namespace vm { @@ -39,7 +39,7 @@ const OpcodeTable* init_op_cp0(bool enable_debug) { register_cell_ops(*op_cp0); // cellops.cpp register_continuation_ops(*op_cp0); // contops.cpp register_dictionary_ops(*op_cp0); // dictops.cpp - register_ton_ops(*op_cp0); // tonops.cpp + register_ion_ops(*op_cp0); // ionops.cpp register_debug_ops(*op_cp0); // debugops.cpp register_codepage_ops(*op_cp0); // contops.cpp op_cp0->finalize()->register_table(Codepage::test_cp); diff --git a/crypto/vm/cp0.h b/crypto/vm/cp0.h index 9a6579697..f0051849f 100644 --- a/crypto/vm/cp0.h +++ b/crypto/vm/cp0.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/db/BlobView.cpp b/crypto/vm/db/BlobView.cpp index 1a879d003..b03c836d0 100644 --- a/crypto/vm/db/BlobView.cpp +++ b/crypto/vm/db/BlobView.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/db/BlobView.h b/crypto/vm/db/BlobView.h index 113ccf2e6..c497d4a38 100644 --- a/crypto/vm/db/BlobView.h +++ b/crypto/vm/db/BlobView.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/db/CellHashTable.h b/crypto/vm/db/CellHashTable.h index 522c987be..77e736d0f 100644 --- a/crypto/vm/db/CellHashTable.h +++ b/crypto/vm/db/CellHashTable.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/db/CellStorage.cpp b/crypto/vm/db/CellStorage.cpp index 06df461ef..070a2ac0c 100644 --- a/crypto/vm/db/CellStorage.cpp +++ b/crypto/vm/db/CellStorage.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/db/CellStorage.h b/crypto/vm/db/CellStorage.h index cabd7fdcb..648d32be3 100644 --- a/crypto/vm/db/CellStorage.h +++ b/crypto/vm/db/CellStorage.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/db/DynamicBagOfCellsDb.cpp b/crypto/vm/db/DynamicBagOfCellsDb.cpp index b69cd8c0b..2ce709b6c 100644 --- a/crypto/vm/db/DynamicBagOfCellsDb.cpp +++ b/crypto/vm/db/DynamicBagOfCellsDb.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/db/DynamicBagOfCellsDb.h b/crypto/vm/db/DynamicBagOfCellsDb.h index 62864ad97..0ed9155f9 100644 --- a/crypto/vm/db/DynamicBagOfCellsDb.h +++ b/crypto/vm/db/DynamicBagOfCellsDb.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/db/StaticBagOfCellsDb.cpp b/crypto/vm/db/StaticBagOfCellsDb.cpp index c667f334b..b3e1e0d78 100644 --- a/crypto/vm/db/StaticBagOfCellsDb.cpp +++ b/crypto/vm/db/StaticBagOfCellsDb.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/db/StaticBagOfCellsDb.h b/crypto/vm/db/StaticBagOfCellsDb.h index 03c45ee88..4ac990930 100644 --- a/crypto/vm/db/StaticBagOfCellsDb.h +++ b/crypto/vm/db/StaticBagOfCellsDb.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/db/TonDb.cpp b/crypto/vm/db/TonDb.cpp index ac69973fd..ca0cc0331 100644 --- a/crypto/vm/db/TonDb.cpp +++ b/crypto/vm/db/TonDb.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/db/TonDb.h b/crypto/vm/db/TonDb.h index 6cd8aa4fa..ac7a5775a 100644 --- a/crypto/vm/db/TonDb.h +++ b/crypto/vm/db/TonDb.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/debugops.cpp b/crypto/vm/debugops.cpp index 3f27de237..f66ae34be 100644 --- a/crypto/vm/debugops.cpp +++ b/crypto/vm/debugops.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/debugops.h b/crypto/vm/debugops.h index ba3d673ff..71e76c4b7 100644 --- a/crypto/vm/debugops.h +++ b/crypto/vm/debugops.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/dict.cpp b/crypto/vm/dict.cpp index 41f9c3396..de5fa70f9 100644 --- a/crypto/vm/dict.cpp +++ b/crypto/vm/dict.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/dict.h b/crypto/vm/dict.h index c4044963f..bee4b196b 100644 --- a/crypto/vm/dict.h +++ b/crypto/vm/dict.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/dictops.cpp b/crypto/vm/dictops.cpp index d0ea8daa8..7c088926a 100644 --- a/crypto/vm/dictops.cpp +++ b/crypto/vm/dictops.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/dictops.h b/crypto/vm/dictops.h index 7d46213f3..053347a15 100644 --- a/crypto/vm/dictops.h +++ b/crypto/vm/dictops.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/dispatch.cpp b/crypto/vm/dispatch.cpp index 53999c7b8..887939be1 100644 --- a/crypto/vm/dispatch.cpp +++ b/crypto/vm/dispatch.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/dispatch.h b/crypto/vm/dispatch.h index fde0890f9..1a847e294 100644 --- a/crypto/vm/dispatch.h +++ b/crypto/vm/dispatch.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/excno.hpp b/crypto/vm/excno.hpp index 3be481683..8143239b5 100644 --- a/crypto/vm/excno.hpp +++ b/crypto/vm/excno.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/fmt.hpp b/crypto/vm/fmt.hpp index dff7290da..0022cd954 100644 --- a/crypto/vm/fmt.hpp +++ b/crypto/vm/fmt.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/tonops.cpp b/crypto/vm/ionops.cpp similarity index 98% rename from crypto/vm/tonops.cpp rename to crypto/vm/ionops.cpp index 4b2d1734e..a949ae5c3 100644 --- a/crypto/vm/tonops.cpp +++ b/crypto/vm/ionops.cpp @@ -1,23 +1,23 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include -#include "vm/tonops.h" +#include "vm/ionops.h" #include "vm/log.h" #include "vm/opctable.h" #include "vm/stack.hpp" @@ -110,7 +110,7 @@ void register_basic_gas_ops(OpcodeTable& cp0) { .insert(OpcodeInstr::mksimple(0xf80f, 16, "COMMIT", exec_commit)); } -void register_ton_gas_ops(OpcodeTable& cp0) { +void register_ion_gas_ops(OpcodeTable& cp0) { using namespace std::placeholders; } @@ -352,7 +352,7 @@ int exec_get_forward_fee_simple(VmState* st) { return 0; } -void register_ton_config_ops(OpcodeTable& cp0) { +void register_ion_config_ops(OpcodeTable& cp0) { using namespace std::placeholders; cp0.insert(OpcodeInstr::mkfixedrange(0xf820, 0xf823, 16, 4, instr::dump_1c("GETPARAM "), exec_get_var_param)) .insert(OpcodeInstr::mksimple(0xf823, 16, "NOW", std::bind(exec_get_param, _1, 3, "NOW"))) @@ -1205,7 +1205,7 @@ int exec_bls_push_r(VmState* st) { return 0; } -void register_ton_crypto_ops(OpcodeTable& cp0) { +void register_ion_crypto_ops(OpcodeTable& cp0) { using namespace std::placeholders; cp0.insert(OpcodeInstr::mksimple(0xf900, 16, "HASHCU", std::bind(exec_compute_hash, _1, 0))) .insert(OpcodeInstr::mksimple(0xf901, 16, "HASHSU", std::bind(exec_compute_hash, _1, 1))) @@ -1290,7 +1290,7 @@ int exec_compute_data_size(VmState* st, int mode) { return 0; } -void register_ton_misc_ops(OpcodeTable& cp0) { +void register_ion_misc_ops(OpcodeTable& cp0) { using namespace std::placeholders; cp0.insert(OpcodeInstr::mksimple(0xf940, 16, "CDATASIZEQ", std::bind(exec_compute_data_size, _1, 1))) .insert(OpcodeInstr::mksimple(0xf941, 16, "CDATASIZE", std::bind(exec_compute_data_size, _1, 0))) @@ -1558,7 +1558,7 @@ int exec_rewrite_message_addr(VmState* st, bool allow_var_addr, bool quiet) { return 0; } -void register_ton_currency_address_ops(OpcodeTable& cp0) { +void register_ion_currency_address_ops(OpcodeTable& cp0) { using namespace std::placeholders; cp0.insert(OpcodeInstr::mksimple(0xfa00, 16, "LDGRAMS", std::bind(exec_load_var_integer, _1, 4, false, false))) .insert(OpcodeInstr::mksimple(0xfa01, 16, "LDVARINT16", std::bind(exec_load_var_integer, _1, 4, true, false))) @@ -1939,7 +1939,7 @@ int exec_change_lib(VmState* st) { return install_output_action(st, cb.finalize()); } -void register_ton_message_ops(OpcodeTable& cp0) { +void register_ion_message_ops(OpcodeTable& cp0) { using namespace std::placeholders; cp0.insert(OpcodeInstr::mksimple(0xfb00, 16, "SENDRAWMSG", exec_send_raw_message)) .insert(OpcodeInstr::mksimple(0xfb02, 16, "RAWRESERVE", std::bind(exec_reserve_raw, _1, 0))) @@ -1950,15 +1950,15 @@ void register_ton_message_ops(OpcodeTable& cp0) { .insert(OpcodeInstr::mksimple(0xfb08, 16, "SENDMSG", exec_send_message)->require_version(4)); } -void register_ton_ops(OpcodeTable& cp0) { +void register_ion_ops(OpcodeTable& cp0) { register_basic_gas_ops(cp0); - register_ton_gas_ops(cp0); + register_ion_gas_ops(cp0); register_prng_ops(cp0); - register_ton_config_ops(cp0); - register_ton_crypto_ops(cp0); - register_ton_misc_ops(cp0); - register_ton_currency_address_ops(cp0); - register_ton_message_ops(cp0); + register_ion_config_ops(cp0); + register_ion_crypto_ops(cp0); + register_ion_misc_ops(cp0); + register_ion_currency_address_ops(cp0); + register_ion_message_ops(cp0); } namespace util { @@ -1990,7 +1990,7 @@ bool load_msg_addr_q(CellSlice& cs, CellSlice& res, bool quiet) { res.cut_tail(cs); return true; } -bool parse_std_addr_q(CellSlice cs, ton::WorkchainId& res_wc, ton::StdSmcAddress& res_addr, bool quiet) { +bool parse_std_addr_q(CellSlice cs, ion::WorkchainId& res_wc, ion::StdSmcAddress& res_addr, bool quiet) { // Like exec_rewrite_message_addr, but for std address case std::vector tuple; if (!(parse_message_addr(cs, tuple) && cs.empty_ext())) { @@ -2033,8 +2033,8 @@ CellSlice load_msg_addr(CellSlice& cs) { load_msg_addr_q(cs, addr, false); return addr; } -std::pair parse_std_addr(CellSlice cs) { - std::pair res; +std::pair parse_std_addr(CellSlice cs) { + std::pair res; parse_std_addr_q(std::move(cs), res.first, res.second, false); return res; } diff --git a/crypto/vm/tonops.h b/crypto/vm/ionops.h similarity index 82% rename from crypto/vm/tonops.h rename to crypto/vm/ionops.h index bbac078f2..975dcb96c 100644 --- a/crypto/vm/tonops.h +++ b/crypto/vm/ionops.h @@ -1,31 +1,31 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #pragma once #include "vm/vm.h" -#include "ton/ton-types.h" +#include "ion/ion-types.h" #include "mc-config.h" namespace vm { class OpcodeTable; -void register_ton_ops(OpcodeTable& cp0); +void register_ion_ops(OpcodeTable& cp0); namespace util { @@ -33,13 +33,13 @@ namespace util { bool load_var_integer_q(CellSlice& cs, td::RefInt256& res, int len_bits, bool sgnd, bool quiet); bool load_coins_q(CellSlice& cs, td::RefInt256& res, bool quiet); bool load_msg_addr_q(CellSlice& cs, CellSlice& res, bool quiet); -bool parse_std_addr_q(CellSlice cs, ton::WorkchainId& res_wc, ton::StdSmcAddress& res_addr, bool quiet); +bool parse_std_addr_q(CellSlice cs, ion::WorkchainId& res_wc, ion::StdSmcAddress& res_addr, bool quiet); // Non-"_q" functions throw on error td::RefInt256 load_var_integer(CellSlice& cs, int len_bits, bool sgnd); td::RefInt256 load_coins(CellSlice& cs); CellSlice load_msg_addr(CellSlice& cs); -std::pair parse_std_addr(CellSlice cs); +std::pair parse_std_addr(CellSlice cs); // store_... functions throw on error if not quiet, return false if quiet (leaving cb unchanged) bool store_var_integer(CellBuilder& cb, const td::RefInt256& x, int len_bits, bool sgnd, bool quiet = false); diff --git a/crypto/vm/large-boc-serializer.cpp b/crypto/vm/large-boc-serializer.cpp index d209c88ed..96da7849c 100644 --- a/crypto/vm/large-boc-serializer.cpp +++ b/crypto/vm/large-boc-serializer.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . */ #include "td/utils/Time.h" #include "td/utils/Timer.h" diff --git a/crypto/vm/log.h b/crypto/vm/log.h index c8486324e..375df2c58 100644 --- a/crypto/vm/log.h +++ b/crypto/vm/log.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/memo.cpp b/crypto/vm/memo.cpp index 015bab6d0..27496a369 100644 --- a/crypto/vm/memo.cpp +++ b/crypto/vm/memo.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2020 Telegram Systems LLP */ diff --git a/crypto/vm/memo.h b/crypto/vm/memo.h index db6dc8e20..0d7cc3180 100644 --- a/crypto/vm/memo.h +++ b/crypto/vm/memo.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2020 Telegram Systems LLP */ @@ -37,7 +37,7 @@ class FakeVmStateLimits : public VmStateInterface { class DummyVmState : public VmStateInterface { public: - explicit DummyVmState(std::vector> libraries, int global_version = ton::SUPPORTED_VERSION) + explicit DummyVmState(std::vector> libraries, int global_version = ion::SUPPORTED_VERSION) : libraries(std::move(libraries)), global_version(global_version) { } Ref load_library(td::ConstBitPtr hash) override; diff --git a/crypto/vm/opctable.cpp b/crypto/vm/opctable.cpp index 0521a7639..98ddf7aea 100644 --- a/crypto/vm/opctable.cpp +++ b/crypto/vm/opctable.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/opctable.h b/crypto/vm/opctable.h index 34d2ef0a7..704878b13 100644 --- a/crypto/vm/opctable.h +++ b/crypto/vm/opctable.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/stack.cpp b/crypto/vm/stack.cpp index aac1b6b53..62043dcaa 100644 --- a/crypto/vm/stack.cpp +++ b/crypto/vm/stack.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/stack.hpp b/crypto/vm/stack.hpp index 6a52e4a2b..af5a2d222 100644 --- a/crypto/vm/stack.hpp +++ b/crypto/vm/stack.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/stackops.cpp b/crypto/vm/stackops.cpp index c8180f1a3..0a0b7745e 100644 --- a/crypto/vm/stackops.cpp +++ b/crypto/vm/stackops.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/stackops.h b/crypto/vm/stackops.h index 27921a556..d3200fcd5 100644 --- a/crypto/vm/stackops.h +++ b/crypto/vm/stackops.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/tupleops.cpp b/crypto/vm/tupleops.cpp index f4be2c76b..6c769bd6f 100644 --- a/crypto/vm/tupleops.cpp +++ b/crypto/vm/tupleops.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/tupleops.h b/crypto/vm/tupleops.h index f7d489590..425ec8c49 100644 --- a/crypto/vm/tupleops.h +++ b/crypto/vm/tupleops.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/utils.cpp b/crypto/vm/utils.cpp index 52bfb0d43..b08ff8f24 100644 --- a/crypto/vm/utils.cpp +++ b/crypto/vm/utils.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2019-2020 Telegram Systems LLP */ diff --git a/crypto/vm/utils.h b/crypto/vm/utils.h index 34d761b1d..c9855ef5b 100644 --- a/crypto/vm/utils.h +++ b/crypto/vm/utils.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2019-2020 Telegram Systems LLP */ diff --git a/crypto/vm/vm.cpp b/crypto/vm/vm.cpp index fb774f80a..ac8dea2d1 100644 --- a/crypto/vm/vm.cpp +++ b/crypto/vm/vm.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/vm.h b/crypto/vm/vm.h index 7afa355c3..80abbd175 100644 --- a/crypto/vm/vm.h +++ b/crypto/vm/vm.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ diff --git a/crypto/vm/vmstate.h b/crypto/vm/vmstate.h index 0d6c3fdf9..f21409fb9 100644 --- a/crypto/vm/vmstate.h +++ b/crypto/vm/vmstate.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -40,7 +40,7 @@ class VmStateInterface : public td::Context { return true; }; virtual int get_global_version() const { - return ton::SUPPORTED_VERSION; + return ion::SUPPORTED_VERSION; } }; diff --git a/dht-server/dht-server.cpp b/dht-server/dht-server.cpp index eb183cad6..999212119 100644 --- a/dht-server/dht-server.cpp +++ b/dht-server/dht-server.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -54,7 +54,7 @@ Config::Config() { out_port = 3278; } -Config::Config(ton::ton_api::engine_validator_config &config) { +Config::Config(ion::ion_api::engine_validator_config &config) { out_port = static_cast(config.out_port_); if (!out_port) { out_port = 3278; @@ -62,13 +62,13 @@ Config::Config(ton::ton_api::engine_validator_config &config) { for (auto &addr : config.addrs_) { td::IPAddress in_ip; td::IPAddress out_ip; - std::shared_ptr proxy = nullptr; + std::shared_ptr proxy = nullptr; std::vector categories; std::vector priority_categories; - ton::ton_api::downcast_call( + ion::ion_api::downcast_call( *addr.get(), td::overloaded( - [&](const ton::ton_api::engine_addr &obj) { + [&](const ion::ion_api::engine_addr &obj) { in_ip.init_ipv4_port(td::IPAddress::ipv4_to_str(obj.ip_), static_cast(obj.port_)).ensure(); out_ip = in_ip; for (auto &cat : obj.categories_) { @@ -78,13 +78,13 @@ Config::Config(ton::ton_api::engine_validator_config &config) { priority_categories.push_back(td::narrow_cast(cat)); } }, - [&](const ton::ton_api::engine_addrProxy &obj) { + [&](const ion::ion_api::engine_addrProxy &obj) { in_ip.init_ipv4_port(td::IPAddress::ipv4_to_str(obj.in_ip_), static_cast(obj.in_port_)) .ensure(); out_ip.init_ipv4_port(td::IPAddress::ipv4_to_str(obj.out_ip_), static_cast(obj.out_port_)) .ensure(); if (obj.proxy_type_) { - auto R = ton::adnl::AdnlProxy::create(*obj.proxy_type_.get()); + auto R = ion::adnl::AdnlProxy::create(*obj.proxy_type_.get()); R.ensure(); proxy = R.move_as_ok(); for (auto &cat : obj.categories_) { @@ -99,82 +99,82 @@ Config::Config(ton::ton_api::engine_validator_config &config) { config_add_network_addr(in_ip, out_ip, std::move(proxy), categories, priority_categories).ensure(); } for (auto &adnl : config.adnl_) { - config_add_adnl_addr(ton::PublicKeyHash{adnl->id_}, td::narrow_cast(adnl->category_)).ensure(); + config_add_adnl_addr(ion::PublicKeyHash{adnl->id_}, td::narrow_cast(adnl->category_)).ensure(); } for (auto &dht : config.dht_) { - config_add_dht_node(ton::PublicKeyHash{dht->id_}).ensure(); + config_add_dht_node(ion::PublicKeyHash{dht->id_}).ensure(); } for (auto &serv : config.control_) { - auto key = ton::PublicKeyHash{serv->id_}; + auto key = ion::PublicKeyHash{serv->id_}; config_add_control_interface(key, serv->port_).ensure(); for (auto &proc : serv->allowed_) { - config_add_control_process(key, serv->port_, ton::PublicKeyHash{proc->id_}, proc->permissions_).ensure(); + config_add_control_process(key, serv->port_, ion::PublicKeyHash{proc->id_}, proc->permissions_).ensure(); } } if (config.gc_) { for (auto &gc : config.gc_->ids_) { - config_add_gc(ton::PublicKeyHash{gc}).ensure(); + config_add_gc(ion::PublicKeyHash{gc}).ensure(); } } } -ton::tl_object_ptr Config::tl() const { - std::vector> addrs_vec; +ion::tl_object_ptr Config::tl() const { + std::vector> addrs_vec; for (auto &x : addrs) { if (x.second.proxy) { - addrs_vec.push_back(ton::create_tl_object( + addrs_vec.push_back(ion::create_tl_object( static_cast(x.second.in_addr.get_ipv4()), x.second.in_addr.get_port(), static_cast(x.first.addr.get_ipv4()), x.first.addr.get_port(), x.second.proxy->tl(), std::vector(x.second.cats.begin(), x.second.cats.end()), std::vector(x.second.priority_cats.begin(), x.second.priority_cats.end()))); } else { - addrs_vec.push_back(ton::create_tl_object( + addrs_vec.push_back(ion::create_tl_object( static_cast(x.first.addr.get_ipv4()), x.first.addr.get_port(), std::vector(x.second.cats.begin(), x.second.cats.end()), std::vector(x.second.priority_cats.begin(), x.second.priority_cats.end()))); } } - std::vector> adnl_vec; + std::vector> adnl_vec; for (auto &x : adnl_ids) { - adnl_vec.push_back(ton::create_tl_object(x.first.tl(), x.second)); + adnl_vec.push_back(ion::create_tl_object(x.first.tl(), x.second)); } - std::vector> dht_vec; + std::vector> dht_vec; for (auto &x : dht_ids) { - dht_vec.push_back(ton::create_tl_object(x.tl())); + dht_vec.push_back(ion::create_tl_object(x.tl())); } - std::vector> val_vec; + std::vector> val_vec; - std::vector> full_node_slaves_vec; - std::vector> full_node_masters_vec; + std::vector> full_node_slaves_vec; + std::vector> full_node_masters_vec; - std::vector> liteserver_vec; + std::vector> liteserver_vec; - std::vector> control_vec; + std::vector> control_vec; for (auto &x : controls) { - std::vector> control_proc_vec; + std::vector> control_proc_vec; for (auto &y : x.second.clients) { - control_proc_vec.push_back(ton::create_tl_object(y.first.tl(), y.second)); + control_proc_vec.push_back(ion::create_tl_object(y.first.tl(), y.second)); } - control_vec.push_back(ton::create_tl_object(x.second.key.tl(), x.first, + control_vec.push_back(ion::create_tl_object(x.second.key.tl(), x.first, std::move(control_proc_vec))); } - auto gc_vec = ton::create_tl_object(std::vector{}); + auto gc_vec = ion::create_tl_object(std::vector{}); for (auto &id : gc) { gc_vec->ids_.push_back(id.tl()); } - return ton::create_tl_object( + return ion::create_tl_object( out_port, std::move(addrs_vec), std::move(adnl_vec), std::move(dht_vec), std::move(val_vec), - ton::PublicKeyHash::zero().tl(), std::move(full_node_slaves_vec), std::move(full_node_masters_vec), + ion::PublicKeyHash::zero().tl(), std::move(full_node_slaves_vec), std::move(full_node_masters_vec), nullptr, nullptr, std::move(liteserver_vec), std::move(control_vec), std::move(gc_vec)); } td::Result Config::config_add_network_addr(td::IPAddress in_ip, td::IPAddress out_ip, - std::shared_ptr proxy, + std::shared_ptr proxy, std::vector cats, std::vector prio_cats) { Addr addr{out_ip}; @@ -214,7 +214,7 @@ td::Result Config::config_add_network_addr(td::IPAddress in_ip, td::IPAddr } } -td::Result Config::config_add_adnl_addr(ton::PublicKeyHash addr, AdnlCategory cat) { +td::Result Config::config_add_adnl_addr(ion::PublicKeyHash addr, AdnlCategory cat) { auto it = adnl_ids.find(addr); if (it != adnl_ids.end()) { if (it->second != cat) { @@ -230,25 +230,25 @@ td::Result Config::config_add_adnl_addr(ton::PublicKeyHash addr, AdnlCateg } } -td::Result Config::config_add_dht_node(ton::PublicKeyHash id) { +td::Result Config::config_add_dht_node(ion::PublicKeyHash id) { if (dht_ids.count(id) > 0) { return false; } if (adnl_ids.count(id) == 0) { - return td::Status::Error(ton::ErrorCode::notready, "to-be-added dht node not in adnl nodes list"); + return td::Status::Error(ion::ErrorCode::notready, "to-be-added dht node not in adnl nodes list"); } incref(id); dht_ids.insert(id); return true; } -td::Result Config::config_add_control_interface(ton::PublicKeyHash key, td::int32 port) { +td::Result Config::config_add_control_interface(ion::PublicKeyHash key, td::int32 port) { auto it = controls.find(port); if (it != controls.end()) { if (it->second.key == key) { return false; } else { - return td::Status::Error(ton::ErrorCode::error, "duplicate port"); + return td::Status::Error(ion::ErrorCode::error, "duplicate port"); } } else { incref(key); @@ -257,14 +257,14 @@ td::Result Config::config_add_control_interface(ton::PublicKeyHash key, td } } -td::Result Config::config_add_control_process(ton::PublicKeyHash key, td::int32 port, ton::PublicKeyHash id, +td::Result Config::config_add_control_process(ion::PublicKeyHash key, td::int32 port, ion::PublicKeyHash id, td::uint32 permissions) { if (controls.count(port) == 0) { - return td::Status::Error(ton::ErrorCode::error, "unknown control interface"); + return td::Status::Error(ion::ErrorCode::error, "unknown control interface"); } auto &v = controls[port]; if (v.key != key) { - return td::Status::Error(ton::ErrorCode::error, "unknown control interface"); + return td::Status::Error(ion::ErrorCode::error, "unknown control interface"); } auto it = v.clients.find(id); @@ -288,11 +288,11 @@ td::Result Config::config_add_control_process(ton::PublicKeyHash key, td:: } } -td::Result Config::config_add_gc(ton::PublicKeyHash key) { +td::Result Config::config_add_gc(ion::PublicKeyHash key) { return gc.insert(key).second; } -void Config::decref(ton::PublicKeyHash key) { +void Config::decref(ion::PublicKeyHash key) { auto v = keys_refcnt[key]--; CHECK(v > 0); if (v == 1) { @@ -323,13 +323,13 @@ td::Result Config::config_del_network_addr(td::IPAddress a, std::vector Config::config_del_adnl_addr(ton::PublicKeyHash addr) { +td::Result Config::config_del_adnl_addr(ion::PublicKeyHash addr) { if (adnl_ids.count(addr) == 0) { return false; } if (dht_ids.count(addr)) { - return td::Status::Error(ton::ErrorCode::error, "adnl addr still in use"); + return td::Status::Error(ion::ErrorCode::error, "adnl addr still in use"); } decref(addr); @@ -337,7 +337,7 @@ td::Result Config::config_del_adnl_addr(ton::PublicKeyHash addr) { return true; } -td::Result Config::config_del_dht_node(ton::PublicKeyHash id) { +td::Result Config::config_del_dht_node(ion::PublicKeyHash id) { if (dht_ids.count(id) == 0) { return false; } @@ -357,7 +357,7 @@ td::Result Config::config_del_control_interface(td::int32 port) { } } -td::Result Config::config_del_control_process(td::int32 port, ton::PublicKeyHash id) { +td::Result Config::config_del_control_process(td::int32 port, ion::PublicKeyHash id) { auto it = controls.find(port); if (it != controls.end()) { return it->second.clients.erase(id); @@ -366,7 +366,7 @@ td::Result Config::config_del_control_process(td::int32 port, ton::PublicK } } -td::Result Config::config_del_gc(ton::PublicKeyHash key) { +td::Result Config::config_del_gc(ion::PublicKeyHash key) { return gc.erase(key); } @@ -395,13 +395,13 @@ void DhtServer::alarm() { R.ensure(); td::actor::send_closure(SelfId, &DhtServer::deleted_key, x); }); - td::actor::send_closure(keyring_, &ton::keyring::Keyring::del_key, x, std::move(P)); + td::actor::send_closure(keyring_, &ion::keyring::Keyring::del_key, x, std::move(P)); } } } } -void DhtServer::deleted_key(ton::PublicKeyHash x) { +void DhtServer::deleted_key(ion::PublicKeyHash x) { CHECK(running_gc_.count(x) == 1); running_gc_.erase(x); auto R = config_.config_del_gc(x); @@ -415,28 +415,28 @@ td::Status DhtServer::load_global_config() { TRY_RESULT_PREFIX(conf_data, td::read_file(global_config_), "failed to read: "); TRY_RESULT_PREFIX(conf_json, td::json_decode(conf_data.as_slice()), "failed to parse json: "); - ton::ton_api::config_global conf; - TRY_STATUS_PREFIX(ton::ton_api::from_json(conf, conf_json.get_object()), "json does not fit TL scheme: "); + ion::ion_api::config_global conf; + TRY_STATUS_PREFIX(ion::ion_api::from_json(conf, conf_json.get_object()), "json does not fit TL scheme: "); // TODO // add adnl static nodes //if (conf.adnl_) { - // td::actor::send_closure(adnl_, &ton::adnl::Adnl::add_static_nodes_from_config, + // td::actor::send_closure(adnl_, &ion::adnl::Adnl::add_static_nodes_from_config, // std::move(conf.adnl_->static_nodes_)); //} if (!conf.dht_) { - return td::Status::Error(ton::ErrorCode::error, "does not contain [dht] section"); + return td::Status::Error(ion::ErrorCode::error, "does not contain [dht] section"); } - TRY_RESULT_PREFIX(dht, ton::dht::Dht::create_global_config(std::move(conf.dht_)), "bad [dht] section: "); + TRY_RESULT_PREFIX(dht, ion::dht::Dht::create_global_config(std::move(conf.dht_)), "bad [dht] section: "); dht_config_ = std::move(dht); if (!conf.validator_) { - return td::Status::Error(ton::ErrorCode::error, "does not contain [validator] section"); + return td::Status::Error(ion::ErrorCode::error, "does not contain [validator] section"); } if (!conf.validator_->zero_state_) { - return td::Status::Error(ton::ErrorCode::error, "[validator] section does not contain [zero_state]"); + return td::Status::Error(ion::ErrorCode::error, "[validator] section does not contain [zero_state]"); } return td::Status::OK(); @@ -462,10 +462,10 @@ void DhtServer::load_empty_local_config(td::Promise promise) { } { - auto pk = ton::PrivateKey{ton::privkeys::Ed25519::random()}; + auto pk = ion::PrivateKey{ion::privkeys::Ed25519::random()}; keys_.emplace(pk.compute_short_id(), pk.compute_public_key()); auto id = pk.compute_short_id(); - td::actor::send_closure(keyring_, &ton::keyring::Keyring::add_key, std::move(pk), false, ig.get_promise()); + td::actor::send_closure(keyring_, &ion::keyring::Keyring::add_key, std::move(pk), false, ig.get_promise()); config_.config_add_adnl_addr(id, 0).ensure(); config_.config_add_dht_node(id).ensure(); } @@ -489,8 +489,8 @@ void DhtServer::load_local_config(td::Promise promise) { } auto conf_json = conf_json_R.move_as_ok(); - ton::ton_api::config_local conf; - auto S = ton::ton_api::from_json(conf, conf_json.get_object()); + ion::ion_api::config_local conf; + auto S = ion::ion_api::from_json(conf, conf_json.get_object()); if (S.is_error()) { promise.set_error(S.move_as_error_prefix("json does not fit TL scheme")); return; @@ -515,32 +515,32 @@ void DhtServer::load_local_config(td::Promise promise) { } for (auto &local_id : conf.local_ids_) { - ton::PrivateKey pk{local_id->id_}; + ion::PrivateKey pk{local_id->id_}; keys_.emplace(pk.compute_short_id(), pk.compute_public_key()); - td::actor::send_closure(keyring_, &ton::keyring::Keyring::add_key, std::move(pk), false, ig.get_promise()); + td::actor::send_closure(keyring_, &ion::keyring::Keyring::add_key, std::move(pk), false, ig.get_promise()); } if (conf.dht_.size() > 0) { for (auto &d : conf.dht_) { - ton::ton_api::downcast_call(*d.get(), td::overloaded( - [&](ton::ton_api::dht_config_local &obj) { - auto node_id = ton::adnl::AdnlNodeIdShort{obj.id_->id_}; + ion::ion_api::downcast_call(*d.get(), td::overloaded( + [&](ion::ion_api::dht_config_local &obj) { + auto node_id = ion::adnl::AdnlNodeIdShort{obj.id_->id_}; auto it = keys_.find(node_id.pubkey_hash()); if (it == keys_.end()) { ig.get_promise().set_error(td::Status::Error( - ton::ErrorCode::error, "cannot find private key for dht")); + ion::ErrorCode::error, "cannot find private key for dht")); return; } config_.config_add_adnl_addr(node_id.pubkey_hash(), 0).ensure(); config_.config_add_dht_node(node_id.pubkey_hash()).ensure(); }, - [&](ton::ton_api::dht_config_random_local &obj) { + [&](ion::ion_api::dht_config_random_local &obj) { for (td::int32 i = 0; i < obj.cnt_; i++) { - auto pk = ton::PrivateKey{ton::privkeys::Ed25519::random()}; + auto pk = ion::PrivateKey{ion::privkeys::Ed25519::random()}; keys_.emplace(pk.compute_short_id(), pk.compute_public_key()); auto id = pk.compute_short_id(); - td::actor::send_closure(keyring_, &ton::keyring::Keyring::add_key, + td::actor::send_closure(keyring_, &ion::keyring::Keyring::add_key, std::move(pk), false, ig.get_promise()); config_.config_add_adnl_addr(id, 0).ensure(); config_.config_add_dht_node(id).ensure(); @@ -548,22 +548,22 @@ void DhtServer::load_local_config(td::Promise promise) { })); } } else { - auto pk = ton::PrivateKey{ton::privkeys::Ed25519::random()}; + auto pk = ion::PrivateKey{ion::privkeys::Ed25519::random()}; keys_.emplace(pk.compute_short_id(), pk.compute_public_key()); auto id = pk.compute_short_id(); - td::actor::send_closure(keyring_, &ton::keyring::Keyring::add_key, std::move(pk), false, ig.get_promise()); + td::actor::send_closure(keyring_, &ion::keyring::Keyring::add_key, std::move(pk), false, ig.get_promise()); config_.config_add_adnl_addr(id, 0).ensure(); config_.config_add_dht_node(id).ensure(); } for (auto &ci : conf.control_) { - ton::PrivateKey pk{ci->priv_}; + ion::PrivateKey pk{ci->priv_}; keys_.emplace(pk.compute_short_id(), pk.compute_public_key()); auto short_id = pk.compute_short_id(); - td::actor::send_closure(keyring_, &ton::keyring::Keyring::add_key, std::move(pk), false, ig.get_promise()); + td::actor::send_closure(keyring_, &ion::keyring::Keyring::add_key, std::move(pk), false, ig.get_promise()); config_.config_add_control_interface(short_id, ci->port_).ensure(); - config_.config_add_control_process(short_id, ci->port_, ton::PublicKeyHash{ci->pub_}, 0x7fffffff).ensure(); + config_.config_add_control_process(short_id, ci->port_, ion::PublicKeyHash{ci->pub_}, 0x7fffffff).ensure(); } } @@ -603,8 +603,8 @@ void DhtServer::load_config(td::Promise promise) { } auto conf_json = conf_json_R.move_as_ok(); - ton::ton_api::engine_validator_config conf; - auto S = ton::ton_api::from_json(conf, conf_json.get_object()); + ion::ion_api::engine_validator_config conf; + auto S = ion::ion_api::from_json(conf, conf_json.get_object()); if (S.is_error()) { promise.set_error(S.move_as_error_prefix("json does not fit TL scheme")); return; @@ -617,7 +617,7 @@ void DhtServer::load_config(td::Promise promise) { ig.add_promise(std::move(promise)); for (auto &key : config_.keys_refcnt) { - td::actor::send_closure(keyring_, &ton::keyring::Keyring::add_key_short, key.first, get_key_promise(ig)); + td::actor::send_closure(keyring_, &ion::keyring::Keyring::add_key_short, key.first, get_key_promise(ig)); } write_config(ig.get_promise()); @@ -637,9 +637,9 @@ void DhtServer::write_config(td::Promise promise) { promise.set_value(td::Unit()); } -td::Promise DhtServer::get_key_promise(td::MultiPromise::InitGuard &ig) { +td::Promise DhtServer::get_key_promise(td::MultiPromise::InitGuard &ig) { auto P = td::PromiseCreator::lambda( - [SelfId = actor_id(this), promise = ig.get_promise()](td::Result R) mutable { + [SelfId = actor_id(this), promise = ig.get_promise()](td::Result R) mutable { if (R.is_error()) { promise.set_error(R.move_as_error()); } else { @@ -650,7 +650,7 @@ td::Promise DhtServer::get_key_promise(td::MultiPromise::InitGua return std::move(P); } -void DhtServer::got_key(ton::PublicKey key) { +void DhtServer::got_key(ion::PublicKey key) { keys_[key.compute_short_id()] = key; } @@ -660,9 +660,9 @@ void DhtServer::start() { } void DhtServer::start_adnl() { - adnl_network_manager_ = ton::adnl::AdnlNetworkManager::create(config_.out_port); - adnl_ = ton::adnl::Adnl::create(db_root_, keyring_.get()); - td::actor::send_closure(adnl_, &ton::adnl::Adnl::register_network_manager, adnl_network_manager_.get()); + adnl_network_manager_ = ion::adnl::AdnlNetworkManager::create(config_.out_port); + adnl_ = ion::adnl::Adnl::create(db_root_, keyring_.get()); + td::actor::send_closure(adnl_, &ion::adnl::Adnl::register_network_manager, adnl_network_manager_.get()); for (auto &addr : config_.addrs) { add_addr(addr.first, addr.second); @@ -674,7 +674,7 @@ void DhtServer::start_adnl() { } void DhtServer::add_addr(const Config::Addr &addr, const Config::AddrCats &cats) { - ton::adnl::AdnlCategoryMask cat_mask; + ion::adnl::AdnlCategoryMask cat_mask; for (auto cat : cats.cats) { cat_mask[cat] = true; } @@ -682,10 +682,10 @@ void DhtServer::add_addr(const Config::Addr &addr, const Config::AddrCats &cats) cat_mask[cat] = true; } if (!cats.proxy) { - td::actor::send_closure(adnl_network_manager_, &ton::adnl::AdnlNetworkManager::add_self_addr, addr.addr, + td::actor::send_closure(adnl_network_manager_, &ion::adnl::AdnlNetworkManager::add_self_addr, addr.addr, std::move(cat_mask), cats.cats.size() ? 0 : 1); } else { - td::actor::send_closure(adnl_network_manager_, &ton::adnl::AdnlNetworkManager::add_proxy_addr, cats.in_addr, + td::actor::send_closure(adnl_network_manager_, &ion::adnl::AdnlNetworkManager::add_proxy_addr, cats.in_addr, static_cast(addr.addr.get_port()), cats.proxy, std::move(cat_mask), cats.cats.size() ? 0 : 1); } @@ -694,26 +694,26 @@ void DhtServer::add_addr(const Config::Addr &addr, const Config::AddrCats &cats) for (auto cat : cats.cats) { CHECK(cat >= 0); - ton::adnl::AdnlAddress x = ton::adnl::AdnlAddressImpl::create( - ton::create_tl_object(cats.in_addr.get_ipv4(), cats.in_addr.get_port())); + ion::adnl::AdnlAddress x = ion::adnl::AdnlAddressImpl::create( + ion::create_tl_object(cats.in_addr.get_ipv4(), cats.in_addr.get_port())); addr_lists_[cat].add_addr(std::move(x)); addr_lists_[cat].set_version(ts); - addr_lists_[cat].set_reinit_date(ton::adnl::Adnl::adnl_start_time()); + addr_lists_[cat].set_reinit_date(ion::adnl::Adnl::adnl_start_time()); } for (auto cat : cats.priority_cats) { CHECK(cat >= 0); - ton::adnl::AdnlAddress x = ton::adnl::AdnlAddressImpl::create( - ton::create_tl_object(cats.in_addr.get_ipv4(), cats.in_addr.get_port())); + ion::adnl::AdnlAddress x = ion::adnl::AdnlAddressImpl::create( + ion::create_tl_object(cats.in_addr.get_ipv4(), cats.in_addr.get_port())); prio_addr_lists_[cat].add_addr(std::move(x)); prio_addr_lists_[cat].set_version(ts); - prio_addr_lists_[cat].set_reinit_date(ton::adnl::Adnl::adnl_start_time()); + prio_addr_lists_[cat].set_reinit_date(ion::adnl::Adnl::adnl_start_time()); } } -void DhtServer::add_adnl(ton::PublicKeyHash id, AdnlCategory cat) { +void DhtServer::add_adnl(ion::PublicKeyHash id, AdnlCategory cat) { CHECK(addr_lists_[cat].size() > 0); CHECK(keys_.count(id) > 0); - td::actor::send_closure(adnl_, &ton::adnl::Adnl::add_id, ton::adnl::AdnlNodeIdFull{keys_[id]}, addr_lists_[cat], cat); + td::actor::send_closure(adnl_, &ion::adnl::Adnl::add_id, ion::adnl::AdnlNodeIdFull{keys_[id]}, addr_lists_[cat], cat); } void DhtServer::started_adnl() { @@ -722,7 +722,7 @@ void DhtServer::started_adnl() { void DhtServer::start_dht() { for (auto &dht : config_.dht_ids) { - auto D = ton::dht::Dht::create(ton::adnl::AdnlNodeIdShort{dht}, db_root_, dht_config_, keyring_.get(), adnl_.get()); + auto D = ion::dht::Dht::create(ion::adnl::AdnlNodeIdShort{dht}, db_root_, dht_config_, keyring_.get(), adnl_.get()); D.ensure(); dht_nodes_[dht] = D.move_as_ok(); @@ -732,7 +732,7 @@ void DhtServer::start_dht() { } CHECK(!default_dht_node_.is_zero()); - td::actor::send_closure(adnl_, &ton::adnl::Adnl::register_dht_node, dht_nodes_[default_dht_node_].get()); + td::actor::send_closure(adnl_, &ion::adnl::Adnl::register_dht_node, dht_nodes_[default_dht_node_].get()); started_dht(); } @@ -742,12 +742,12 @@ void DhtServer::started_dht() { } void DhtServer::start_control_interface() { - class Callback : public ton::adnl::Adnl::Callback { + class Callback : public ion::adnl::Adnl::Callback { public: - void receive_message(ton::adnl::AdnlNodeIdShort src, ton::adnl::AdnlNodeIdShort dst, + void receive_message(ion::adnl::AdnlNodeIdShort src, ion::adnl::AdnlNodeIdShort dst, td::BufferSlice data) override { } - void receive_query(ton::adnl::AdnlNodeIdShort src, ton::adnl::AdnlNodeIdShort dst, td::BufferSlice data, + void receive_query(ion::adnl::AdnlNodeIdShort src, ion::adnl::AdnlNodeIdShort dst, td::BufferSlice data, td::Promise promise) override { td::actor::send_closure(id_, &DhtServer::process_control_query, src, dst, std::move(data), std::move(promise)); } @@ -759,16 +759,16 @@ void DhtServer::start_control_interface() { td::actor::ActorId id_; }; - std::vector c_ids; + std::vector c_ids; std::vector ports; for (auto &s : config_.controls) { - td::actor::send_closure(adnl_, &ton::adnl::Adnl::add_id, ton::adnl::AdnlNodeIdFull{keys_[s.second.key]}, - ton::adnl::AdnlAddressList{}, static_cast(255)); - td::actor::send_closure(adnl_, &ton::adnl::Adnl::subscribe, ton::adnl::AdnlNodeIdShort{s.second.key}, + td::actor::send_closure(adnl_, &ion::adnl::Adnl::add_id, ion::adnl::AdnlNodeIdFull{keys_[s.second.key]}, + ion::adnl::AdnlAddressList{}, static_cast(255)); + td::actor::send_closure(adnl_, &ion::adnl::Adnl::subscribe, ion::adnl::AdnlNodeIdShort{s.second.key}, std::string(""), std::make_unique(actor_id(this))); - c_ids.push_back(ton::adnl::AdnlNodeIdShort{s.second.key}); + c_ids.push_back(ion::adnl::AdnlNodeIdShort{s.second.key}); ports.push_back(static_cast(s.first)); for (auto &p : s.second.clients) { @@ -777,14 +777,14 @@ void DhtServer::start_control_interface() { } auto P = td::PromiseCreator::lambda( - [SelfId = actor_id(this)](td::Result> R) { + [SelfId = actor_id(this)](td::Result> R) { R.ensure(); td::actor::send_closure(SelfId, &DhtServer::started_control_interface, R.move_as_ok()); }); - td::actor::send_closure(adnl_, &ton::adnl::Adnl::create_ext_server, std::move(c_ids), std::move(ports), std::move(P)); + td::actor::send_closure(adnl_, &ion::adnl::Adnl::create_ext_server, std::move(c_ids), std::move(ports), std::move(P)); } -void DhtServer::started_control_interface(td::actor::ActorOwn control_ext_server) { +void DhtServer::started_control_interface(td::actor::ActorOwn control_ext_server) { control_ext_server_ = std::move(control_ext_server); started(); } @@ -793,9 +793,9 @@ void DhtServer::started() { started_ = true; } -void DhtServer::add_adnl_node(ton::PublicKey key, AdnlCategory cat, td::Promise promise) { +void DhtServer::add_adnl_node(ion::PublicKey key, AdnlCategory cat, td::Promise promise) { if (cat < 0 || static_cast(cat) > max_cat()) { - promise.set_error(td::Status::Error(ton::ErrorCode::protoviolation, "bad category value")); + promise.set_error(td::Status::Error(ion::ErrorCode::protoviolation, "bad category value")); return; } @@ -811,13 +811,13 @@ void DhtServer::add_adnl_node(ton::PublicKey key, AdnlCategory cat, td::Promise< } if (!adnl_.empty()) { - td::actor::send_closure(adnl_, &ton::adnl::Adnl::add_id, ton::adnl::AdnlNodeIdFull{key}, addr_lists_[cat], cat); + td::actor::send_closure(adnl_, &ion::adnl::Adnl::add_id, ion::adnl::AdnlNodeIdFull{key}, addr_lists_[cat], cat); } write_config(std::move(promise)); } -void DhtServer::add_dht_node(ton::PublicKeyHash key_hash, td::Promise promise) { +void DhtServer::add_dht_node(ion::PublicKeyHash key_hash, td::Promise promise) { auto R = config_.config_add_dht_node(key_hash); if (R.is_error()) { promise.set_error(R.move_as_error()); @@ -831,7 +831,7 @@ void DhtServer::add_dht_node(ton::PublicKeyHash key_hash, td::Promise if (dht_nodes_.size() > 0) { auto D = - ton::dht::Dht::create(ton::adnl::AdnlNodeIdShort{key_hash}, db_root_, dht_config_, keyring_.get(), adnl_.get()); + ion::dht::Dht::create(ion::adnl::AdnlNodeIdShort{key_hash}, db_root_, dht_config_, keyring_.get(), adnl_.get()); D.ensure(); dht_nodes_[key_hash] = D.move_as_ok(); @@ -844,7 +844,7 @@ void DhtServer::add_dht_node(ton::PublicKeyHash key_hash, td::Promise write_config(std::move(promise)); } -void DhtServer::add_control_interface(ton::PublicKeyHash id, td::int32 port, td::Promise promise) { +void DhtServer::add_control_interface(ion::PublicKeyHash id, td::int32 port, td::Promise promise) { auto R = config_.config_add_control_interface(id, port); if (R.is_error()) { promise.set_error(R.move_as_error()); @@ -856,13 +856,13 @@ void DhtServer::add_control_interface(ton::PublicKeyHash id, td::int32 port, td: return; } - td::actor::send_closure(control_ext_server_, &ton::adnl::AdnlExtServer::add_local_id, ton::adnl::AdnlNodeIdShort{id}); - td::actor::send_closure(control_ext_server_, &ton::adnl::AdnlExtServer::add_tcp_port, static_cast(port)); + td::actor::send_closure(control_ext_server_, &ion::adnl::AdnlExtServer::add_local_id, ion::adnl::AdnlNodeIdShort{id}); + td::actor::send_closure(control_ext_server_, &ion::adnl::AdnlExtServer::add_tcp_port, static_cast(port)); write_config(std::move(promise)); } -void DhtServer::add_control_process(ton::PublicKeyHash id, td::int32 port, ton::PublicKeyHash pub, +void DhtServer::add_control_process(ion::PublicKeyHash id, td::int32 port, ion::PublicKeyHash pub, td::int32 permissions, td::Promise promise) { auto R = config_.config_add_control_process(id, port, pub, permissions); if (R.is_error()) { @@ -881,96 +881,96 @@ void DhtServer::add_control_process(ton::PublicKeyHash id, td::int32 port, ton:: } td::BufferSlice DhtServer::create_control_query_error(td::Status error) { - return ton::serialize_tl_object( - ton::create_tl_object(error.code(), error.message().str()), + return ion::serialize_tl_object( + ion::create_tl_object(error.code(), error.message().str()), true); } -void DhtServer::run_control_query(ton::ton_api::engine_validator_getTime &query, td::BufferSlice data, - ton::PublicKeyHash src, td::uint32 perm, td::Promise promise) { +void DhtServer::run_control_query(ion::ion_api::engine_validator_getTime &query, td::BufferSlice data, + ion::PublicKeyHash src, td::uint32 perm, td::Promise promise) { if (!(perm & DhtServerPermissions::vep_default)) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::error, "not authorized"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::error, "not authorized"))); return; } - auto obj = ton::create_tl_object(static_cast(td::Clocks::system())); - promise.set_value(ton::serialize_tl_object(obj, true)); + auto obj = ion::create_tl_object(static_cast(td::Clocks::system())); + promise.set_value(ion::serialize_tl_object(obj, true)); } -void DhtServer::run_control_query(ton::ton_api::engine_validator_importPrivateKey &query, td::BufferSlice data, - ton::PublicKeyHash src, td::uint32 perm, td::Promise promise) { +void DhtServer::run_control_query(ion::ion_api::engine_validator_importPrivateKey &query, td::BufferSlice data, + ion::PublicKeyHash src, td::uint32 perm, td::Promise promise) { if (!(perm & DhtServerPermissions::vep_default)) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::error, "not authorized"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::error, "not authorized"))); return; } if (keyring_.empty()) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::notready, "not started keyring"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::notready, "not started keyring"))); return; } - auto pk = ton::PrivateKey{query.key_}; + auto pk = ion::PrivateKey{query.key_}; auto P = td::PromiseCreator::lambda( [promise = std::move(promise), hash = pk.compute_short_id()](td::Result R) mutable { if (R.is_error()) { promise.set_value(create_control_query_error(R.move_as_error())); } else { promise.set_value( - ton::serialize_tl_object(ton::create_tl_object(hash.tl()), true)); + ion::serialize_tl_object(ion::create_tl_object(hash.tl()), true)); } }); - td::actor::send_closure(keyring_, &ton::keyring::Keyring::add_key, std::move(pk), false, std::move(P)); + td::actor::send_closure(keyring_, &ion::keyring::Keyring::add_key, std::move(pk), false, std::move(P)); } -void DhtServer::run_control_query(ton::ton_api::engine_validator_exportPrivateKey &query, td::BufferSlice data, - ton::PublicKeyHash src, td::uint32 perm, td::Promise promise) { +void DhtServer::run_control_query(ion::ion_api::engine_validator_exportPrivateKey &query, td::BufferSlice data, + ion::PublicKeyHash src, td::uint32 perm, td::Promise promise) { if (!(perm & DhtServerPermissions::vep_unsafe)) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::error, "not authorized"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::error, "not authorized"))); return; } if (keyring_.empty()) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::notready, "not started keyring"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::notready, "not started keyring"))); return; } - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::notready, "not implemented"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::notready, "not implemented"))); } -void DhtServer::run_control_query(ton::ton_api::engine_validator_exportPublicKey &query, td::BufferSlice data, - ton::PublicKeyHash src, td::uint32 perm, td::Promise promise) { +void DhtServer::run_control_query(ion::ion_api::engine_validator_exportPublicKey &query, td::BufferSlice data, + ion::PublicKeyHash src, td::uint32 perm, td::Promise promise) { if (!(perm & DhtServerPermissions::vep_default)) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::error, "not authorized"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::error, "not authorized"))); return; } if (keyring_.empty()) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::notready, "not started keyring"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::notready, "not started keyring"))); return; } - auto P = td::PromiseCreator::lambda([promise = std::move(promise)](td::Result R) mutable { + auto P = td::PromiseCreator::lambda([promise = std::move(promise)](td::Result R) mutable { if (R.is_error()) { promise.set_value(create_control_query_error(R.move_as_error())); } else { auto pub = R.move_as_ok(); - promise.set_value(ton::serialize_tl_object(pub.tl(), true)); + promise.set_value(ion::serialize_tl_object(pub.tl(), true)); } }); - td::actor::send_closure(keyring_, &ton::keyring::Keyring::get_public_key, ton::PublicKeyHash{query.key_hash_}, + td::actor::send_closure(keyring_, &ion::keyring::Keyring::get_public_key, ion::PublicKeyHash{query.key_hash_}, std::move(P)); } -void DhtServer::run_control_query(ton::ton_api::engine_validator_generateKeyPair &query, td::BufferSlice data, - ton::PublicKeyHash src, td::uint32 perm, td::Promise promise) { +void DhtServer::run_control_query(ion::ion_api::engine_validator_generateKeyPair &query, td::BufferSlice data, + ion::PublicKeyHash src, td::uint32 perm, td::Promise promise) { if (!(perm & DhtServerPermissions::vep_default)) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::error, "not authorized"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::error, "not authorized"))); return; } if (keyring_.empty()) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::notready, "not started keyring"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::notready, "not started keyring"))); return; } - auto pk = ton::PrivateKey{ton::privkeys::Ed25519::random()}; + auto pk = ion::PrivateKey{ion::privkeys::Ed25519::random()}; auto P = td::PromiseCreator::lambda( [promise = std::move(promise), hash = pk.compute_short_id()](td::Result R) mutable { @@ -978,28 +978,28 @@ void DhtServer::run_control_query(ton::ton_api::engine_validator_generateKeyPair promise.set_value(create_control_query_error(R.move_as_error())); } else { promise.set_value( - ton::serialize_tl_object(ton::create_tl_object(hash.tl()), true)); + ion::serialize_tl_object(ion::create_tl_object(hash.tl()), true)); } }); - td::actor::send_closure(keyring_, &ton::keyring::Keyring::add_key, std::move(pk), false, std::move(P)); + td::actor::send_closure(keyring_, &ion::keyring::Keyring::add_key, std::move(pk), false, std::move(P)); } -void DhtServer::run_control_query(ton::ton_api::engine_validator_addAdnlId &query, td::BufferSlice data, - ton::PublicKeyHash src, td::uint32 perm, td::Promise promise) { +void DhtServer::run_control_query(ion::ion_api::engine_validator_addAdnlId &query, td::BufferSlice data, + ion::PublicKeyHash src, td::uint32 perm, td::Promise promise) { if (!(perm & DhtServerPermissions::vep_modify)) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::error, "not authorized"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::error, "not authorized"))); return; } if (!started_) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::notready, "not started"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::notready, "not started"))); return; } TRY_RESULT_PROMISE(promise, cat, td::narrow_cast_safe(query.category_)); auto P = td::PromiseCreator::lambda( - [SelfId = actor_id(this), cat, promise = std::move(promise)](td::Result R) mutable { + [SelfId = actor_id(this), cat, promise = std::move(promise)](td::Result R) mutable { if (R.is_error()) { promise.set_value(create_control_query_error(R.move_as_error_prefix("failed to get public key: "))); return; @@ -1010,28 +1010,28 @@ void DhtServer::run_control_query(ton::ton_api::engine_validator_addAdnlId &quer promise.set_value(create_control_query_error(R.move_as_error_prefix("failed to add adnl node: "))); } else { promise.set_value( - ton::serialize_tl_object(ton::create_tl_object(), true)); + ion::serialize_tl_object(ion::create_tl_object(), true)); } }); td::actor::send_closure(SelfId, &DhtServer::add_adnl_node, pub, cat, std::move(P)); }); - td::actor::send_closure(keyring_, &ton::keyring::Keyring::get_public_key, ton::PublicKeyHash{query.key_hash_}, + td::actor::send_closure(keyring_, &ion::keyring::Keyring::get_public_key, ion::PublicKeyHash{query.key_hash_}, std::move(P)); } -void DhtServer::run_control_query(ton::ton_api::engine_validator_addDhtId &query, td::BufferSlice data, - ton::PublicKeyHash src, td::uint32 perm, td::Promise promise) { +void DhtServer::run_control_query(ion::ion_api::engine_validator_addDhtId &query, td::BufferSlice data, + ion::PublicKeyHash src, td::uint32 perm, td::Promise promise) { if (!(perm & DhtServerPermissions::vep_modify)) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::error, "not authorized"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::error, "not authorized"))); return; } if (!started_) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::notready, "not started"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::notready, "not started"))); return; } - auto P = td::PromiseCreator::lambda([SelfId = actor_id(this), key_hash = ton::PublicKeyHash{query.key_hash_}, + auto P = td::PromiseCreator::lambda([SelfId = actor_id(this), key_hash = ion::PublicKeyHash{query.key_hash_}, promise = std::move(promise)](td::Result R) mutable { if (R.is_error()) { promise.set_value(create_control_query_error(R.move_as_error_prefix("failed to get public key: "))); @@ -1042,20 +1042,20 @@ void DhtServer::run_control_query(ton::ton_api::engine_validator_addDhtId &query promise.set_value(create_control_query_error(R.move_as_error_prefix("failed to add adnl node: "))); } else { promise.set_value( - ton::serialize_tl_object(ton::create_tl_object(), true)); + ion::serialize_tl_object(ion::create_tl_object(), true)); } }); td::actor::send_closure(SelfId, &DhtServer::add_dht_node, key_hash, std::move(P)); }); - td::actor::send_closure(keyring_, &ton::keyring::Keyring::check_key, ton::PublicKeyHash{query.key_hash_}, + td::actor::send_closure(keyring_, &ion::keyring::Keyring::check_key, ion::PublicKeyHash{query.key_hash_}, std::move(P)); } -void DhtServer::run_control_query(ton::ton_api::engine_validator_getConfig &query, td::BufferSlice data, - ton::PublicKeyHash src, td::uint32 perm, td::Promise promise) { +void DhtServer::run_control_query(ion::ion_api::engine_validator_getConfig &query, td::BufferSlice data, + ion::PublicKeyHash src, td::uint32 perm, td::Promise promise) { if (!(perm & DhtServerPermissions::vep_default)) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::error, "not authorized"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::error, "not authorized"))); return; } @@ -1063,14 +1063,14 @@ void DhtServer::run_control_query(ton::ton_api::engine_validator_getConfig &quer promise.set_value(td::BufferSlice{s}); } -void DhtServer::run_control_query(ton::ton_api::engine_validator_sign &query, td::BufferSlice data, - ton::PublicKeyHash src, td::uint32 perm, td::Promise promise) { +void DhtServer::run_control_query(ion::ion_api::engine_validator_sign &query, td::BufferSlice data, + ion::PublicKeyHash src, td::uint32 perm, td::Promise promise) { if (!(perm & DhtServerPermissions::vep_unsafe)) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::error, "not authorized"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::error, "not authorized"))); return; } if (!started_) { - promise.set_value(create_control_query_error(td::Status::Error(ton::ErrorCode::notready, "not started"))); + promise.set_value(create_control_query_error(td::Status::Error(ion::ErrorCode::notready, "not started"))); return; } @@ -1078,23 +1078,23 @@ void DhtServer::run_control_query(ton::ton_api::engine_validator_sign &query, td if (R.is_error()) { promise.set_value(create_control_query_error(R.move_as_error())); } else { - promise.set_value(ton::serialize_tl_object( - ton::create_tl_object(R.move_as_ok()), true)); + promise.set_value(ion::serialize_tl_object( + ion::create_tl_object(R.move_as_ok()), true)); } }); - td::actor::send_closure(keyring_, &ton::keyring::Keyring::sign_message, ton::PublicKeyHash{query.key_hash_}, + td::actor::send_closure(keyring_, &ion::keyring::Keyring::sign_message, ion::PublicKeyHash{query.key_hash_}, std::move(query.data_), std::move(P)); } -void DhtServer::process_control_query(ton::adnl::AdnlNodeIdShort src, ton::adnl::AdnlNodeIdShort dst, +void DhtServer::process_control_query(ion::adnl::AdnlNodeIdShort src, ion::adnl::AdnlNodeIdShort dst, td::BufferSlice data, td::Promise promise) { - auto G = ton::fetch_tl_object(std::move(data), true); + auto G = ion::fetch_tl_object(std::move(data), true); if (G.is_error()) { promise.set_error(G.move_as_error_prefix("failed to parse validator query: ")); return; } data = std::move(G.move_as_ok()->data_); - auto F = ton::fetch_tl_object(data.clone(), true); + auto F = ion::fetch_tl_object(data.clone(), true); if (F.is_error()) { promise.set_error(F.move_as_error_prefix("failed to parse validator query: ")); return; @@ -1103,11 +1103,11 @@ void DhtServer::process_control_query(ton::adnl::AdnlNodeIdShort src, ton::adnl: auto it = control_permissions_.find(src.pubkey_hash()); if (it == control_permissions_.end()) { - promise.set_error(td::Status::Error(ton::ErrorCode::protoviolation, "forbidden")); + promise.set_error(td::Status::Error(ion::ErrorCode::protoviolation, "forbidden")); return; } - ton::ton_api::downcast_call(*f.get(), [&](auto &obj) { + ion::ion_api::downcast_call(*f.get(), [&](auto &obj) { run_control_query(obj, std::move(data), src.pubkey_hash(), it->second, std::move(promise)); }); } @@ -1121,7 +1121,7 @@ void DhtServer::run() { std::_Exit(2); } - keyring_ = ton::keyring::Keyring::create(db_root_ + "/keyring"); + keyring_ = ion::keyring::Keyring::create(db_root_ + "/keyring"); // TODO wait for password started_keyring_ = true; @@ -1187,7 +1187,7 @@ int main(int argc, char *argv[]) { std::vector> acts; td::OptionParser p; - p.set_description("dht server for TON DHT network"); + p.set_description("dht server for ION DHT network"); p.add_option('v', "verbosity", "set verbosity level", [&](td::Slice arg) { int v = VERBOSITY_NAME(FATAL) + (td::to_integer(arg)); SET_VERBOSITY_LEVEL(v); @@ -1236,10 +1236,10 @@ int main(int argc, char *argv[]) { try { v = std::stoi(arg.str()); } catch (...) { - return td::Status::Error(ton::ErrorCode::error, "bad value for --threads: not a number"); + return td::Status::Error(ion::ErrorCode::error, "bad value for --threads: not a number"); } if (v <= 0) { - return td::Status::Error(ton::ErrorCode::error, "bad value for --threads: should be > 0"); + return td::Status::Error(ion::ErrorCode::error, "bad value for --threads: should be > 0"); } if (v > 127) { LOG(WARNING) << "`--threads " << v << "` is too big, effective value will be 127"; diff --git a/dht-server/dht-server.hpp b/dht-server/dht-server.hpp index 5b81875be..5672f867e 100644 --- a/dht-server/dht-server.hpp +++ b/dht-server/dht-server.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -30,10 +30,10 @@ #include "td/actor/MultiPromise.h" -#include "ton/ton-types.h" +#include "ion/ion-types.h" -#include "auto/tl/ton_api_json.h" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api_json.h" +#include "auto/tl/ion_api.hpp" #include #include @@ -52,89 +52,89 @@ struct Config { }; struct AddrCats { td::IPAddress in_addr; - std::shared_ptr proxy; + std::shared_ptr proxy; std::set cats; std::set priority_cats; }; struct Control { - ton::PublicKeyHash key; - std::map clients; + ion::PublicKeyHash key; + std::map clients; }; - std::map keys_refcnt; + std::map keys_refcnt; td::uint16 out_port; std::map addrs; - std::map adnl_ids; - std::set dht_ids; + std::map adnl_ids; + std::set dht_ids; std::map controls; - std::set gc; + std::set gc; - void decref(ton::PublicKeyHash key); - void incref(ton::PublicKeyHash key) { + void decref(ion::PublicKeyHash key); + void incref(ion::PublicKeyHash key) { keys_refcnt[key]++; } td::Result config_add_network_addr(td::IPAddress in_addr, td::IPAddress out_addr, - std::shared_ptr proxy, std::vector cats, + std::shared_ptr proxy, std::vector cats, std::vector prio_cats); - td::Result config_add_adnl_addr(ton::PublicKeyHash addr, AdnlCategory cat); - td::Result config_add_dht_node(ton::PublicKeyHash id); - td::Result config_add_control_interface(ton::PublicKeyHash key, td::int32 port); - td::Result config_add_control_process(ton::PublicKeyHash key, td::int32 port, ton::PublicKeyHash id, + td::Result config_add_adnl_addr(ion::PublicKeyHash addr, AdnlCategory cat); + td::Result config_add_dht_node(ion::PublicKeyHash id); + td::Result config_add_control_interface(ion::PublicKeyHash key, td::int32 port); + td::Result config_add_control_process(ion::PublicKeyHash key, td::int32 port, ion::PublicKeyHash id, td::uint32 permissions); - td::Result config_add_gc(ton::PublicKeyHash key); + td::Result config_add_gc(ion::PublicKeyHash key); td::Result config_del_network_addr(td::IPAddress addr, std::vector cats, std::vector prio_cats); - td::Result config_del_adnl_addr(ton::PublicKeyHash addr); - td::Result config_del_dht_node(ton::PublicKeyHash id); + td::Result config_del_adnl_addr(ion::PublicKeyHash addr); + td::Result config_del_dht_node(ion::PublicKeyHash id); td::Result config_del_control_interface(td::int32 port); - td::Result config_del_control_process(td::int32 port, ton::PublicKeyHash id); - td::Result config_del_gc(ton::PublicKeyHash key); + td::Result config_del_control_process(td::int32 port, ion::PublicKeyHash id); + td::Result config_del_gc(ion::PublicKeyHash key); - ton::tl_object_ptr tl() const; + ion::tl_object_ptr tl() const; Config(); - Config(ton::ton_api::engine_validator_config &config); + Config(ion::ion_api::engine_validator_config &config); }; class DhtServer : public td::actor::Actor { private: - td::actor::ActorOwn keyring_; - td::actor::ActorOwn adnl_network_manager_; - td::actor::ActorOwn adnl_; - std::map> dht_nodes_; - ton::PublicKeyHash default_dht_node_ = ton::PublicKeyHash::zero(); - td::actor::ActorOwn control_ext_server_; + td::actor::ActorOwn keyring_; + td::actor::ActorOwn adnl_network_manager_; + td::actor::ActorOwn adnl_; + std::map> dht_nodes_; + ion::PublicKeyHash default_dht_node_ = ion::PublicKeyHash::zero(); + td::actor::ActorOwn control_ext_server_; std::string local_config_ = ""; - std::string global_config_ = "ton-global.config"; + std::string global_config_ = "ion-global.config"; std::string config_file_; std::string temp_config_file() const { return config_file_ + ".tmp"; } - std::string db_root_ = "/var/ton-work/db/"; + std::string db_root_ = "/var/ion-work/db/"; std::vector addrs_; std::vector proxy_addrs_; - std::shared_ptr dht_config_; + std::shared_ptr dht_config_; Config config_; - std::set running_gc_; + std::set running_gc_; - std::map keys_; + std::map keys_; - td::Promise get_key_promise(td::MultiPromise::InitGuard &ig); - void got_key(ton::PublicKey key); - void deleted_key(ton::PublicKeyHash key); + td::Promise get_key_promise(td::MultiPromise::InitGuard &ig); + void got_key(ion::PublicKey key); + void deleted_key(ion::PublicKeyHash key); void write_config(td::Promise promise); - std::map addr_lists_; - std::map prio_addr_lists_; + std::map addr_lists_; + std::map prio_addr_lists_; - std::map control_permissions_; + std::map control_permissions_; bool read_config_ = false; bool started_keyring_ = false; @@ -165,55 +165,55 @@ class DhtServer : public td::actor::Actor { void start_adnl(); void add_addr(const Config::Addr &addr, const Config::AddrCats &cats); - void add_adnl(ton::PublicKeyHash id, AdnlCategory cat); + void add_adnl(ion::PublicKeyHash id, AdnlCategory cat); void started_adnl(); void start_dht(); - void add_dht(td::actor::ActorOwn dht, td::Promise promise); + void add_dht(td::actor::ActorOwn dht, td::Promise promise); void started_dht(); void start_control_interface(); - void started_control_interface(td::actor::ActorOwn control_ext_server); + void started_control_interface(td::actor::ActorOwn control_ext_server); void started(); void alarm() override; void run(); - void add_adnl_node(ton::PublicKey pub, AdnlCategory cat, td::Promise promise); - void add_dht_node(ton::PublicKeyHash pub, td::Promise promise); - void add_control_interface(ton::PublicKeyHash id, td::int32 port, td::Promise promise); - void add_control_process(ton::PublicKeyHash id, td::int32 port, ton::PublicKeyHash pub, td::int32 permissions, + void add_adnl_node(ion::PublicKey pub, AdnlCategory cat, td::Promise promise); + void add_dht_node(ion::PublicKeyHash pub, td::Promise promise); + void add_control_interface(ion::PublicKeyHash id, td::int32 port, td::Promise promise); + void add_control_process(ion::PublicKeyHash id, td::int32 port, ion::PublicKeyHash pub, td::int32 permissions, td::Promise promise); - void del_adnl_node(ton::PublicKeyHash pub, td::Promise promise); - void del_dht_node(ton::PublicKeyHash pub, td::Promise promise); + void del_adnl_node(ion::PublicKeyHash pub, td::Promise promise); + void del_dht_node(ion::PublicKeyHash pub, td::Promise promise); static td::BufferSlice create_control_query_error(td::Status error); - void run_control_query(ton::ton_api::engine_validator_getTime &query, td::BufferSlice data, ton::PublicKeyHash src, + void run_control_query(ion::ion_api::engine_validator_getTime &query, td::BufferSlice data, ion::PublicKeyHash src, td::uint32 perm, td::Promise promise); - void run_control_query(ton::ton_api::engine_validator_importPrivateKey &query, td::BufferSlice data, - ton::PublicKeyHash src, td::uint32 perm, td::Promise promise); - void run_control_query(ton::ton_api::engine_validator_exportPrivateKey &query, td::BufferSlice data, - ton::PublicKeyHash src, td::uint32 perm, td::Promise promise); - void run_control_query(ton::ton_api::engine_validator_exportPublicKey &query, td::BufferSlice data, - ton::PublicKeyHash src, td::uint32 perm, td::Promise promise); - void run_control_query(ton::ton_api::engine_validator_generateKeyPair &query, td::BufferSlice data, - ton::PublicKeyHash src, td::uint32 perm, td::Promise promise); - void run_control_query(ton::ton_api::engine_validator_addAdnlId &query, td::BufferSlice data, ton::PublicKeyHash src, + void run_control_query(ion::ion_api::engine_validator_importPrivateKey &query, td::BufferSlice data, + ion::PublicKeyHash src, td::uint32 perm, td::Promise promise); + void run_control_query(ion::ion_api::engine_validator_exportPrivateKey &query, td::BufferSlice data, + ion::PublicKeyHash src, td::uint32 perm, td::Promise promise); + void run_control_query(ion::ion_api::engine_validator_exportPublicKey &query, td::BufferSlice data, + ion::PublicKeyHash src, td::uint32 perm, td::Promise promise); + void run_control_query(ion::ion_api::engine_validator_generateKeyPair &query, td::BufferSlice data, + ion::PublicKeyHash src, td::uint32 perm, td::Promise promise); + void run_control_query(ion::ion_api::engine_validator_addAdnlId &query, td::BufferSlice data, ion::PublicKeyHash src, td::uint32 perm, td::Promise promise); - void run_control_query(ton::ton_api::engine_validator_addDhtId &query, td::BufferSlice data, ton::PublicKeyHash src, + void run_control_query(ion::ion_api::engine_validator_addDhtId &query, td::BufferSlice data, ion::PublicKeyHash src, td::uint32 perm, td::Promise promise); - void run_control_query(ton::ton_api::engine_validator_getConfig &query, td::BufferSlice data, ton::PublicKeyHash src, + void run_control_query(ion::ion_api::engine_validator_getConfig &query, td::BufferSlice data, ion::PublicKeyHash src, td::uint32 perm, td::Promise promise); - void run_control_query(ton::ton_api::engine_validator_sign &query, td::BufferSlice data, ton::PublicKeyHash src, + void run_control_query(ion::ion_api::engine_validator_sign &query, td::BufferSlice data, ion::PublicKeyHash src, td::uint32 perm, td::Promise promise); template - void run_control_query(T &query, td::BufferSlice data, ton::PublicKeyHash src, td::uint32 perm, + void run_control_query(T &query, td::BufferSlice data, ion::PublicKeyHash src, td::uint32 perm, td::Promise promise) { promise.set_value( - create_control_query_error(td::Status::Error(ton::ErrorCode::protoviolation, "query not supported"))); + create_control_query_error(td::Status::Error(ion::ErrorCode::protoviolation, "query not supported"))); } - void process_control_query(ton::adnl::AdnlNodeIdShort src, ton::adnl::AdnlNodeIdShort dst, td::BufferSlice data, + void process_control_query(ion::adnl::AdnlNodeIdShort src, ion::adnl::AdnlNodeIdShort dst, td::BufferSlice data, td::Promise promise); }; diff --git a/dht/dht-bucket.cpp b/dht/dht-bucket.cpp index f60f9961c..91a81602c 100644 --- a/dht/dht-bucket.cpp +++ b/dht/dht-bucket.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -25,7 +25,7 @@ #include "keys/encryptor.h" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" #include "dht-remote-node.hpp" #include "dht-bucket.hpp" @@ -33,7 +33,7 @@ //#include -namespace ton { +namespace ion { namespace dht { @@ -228,4 +228,4 @@ DhtNodesList DhtBucket::export_nodes() const { } // namespace dht -} // namespace ton +} // namespace ion diff --git a/dht/dht-bucket.hpp b/dht/dht-bucket.hpp index e12fe6a47..dfd87497d 100644 --- a/dht/dht-bucket.hpp +++ b/dht/dht-bucket.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -23,7 +23,7 @@ #include -namespace ton { +namespace ion { namespace dht { @@ -62,4 +62,4 @@ class DhtBucket { } // namespace dht -} // namespace ton +} // namespace ion diff --git a/dht/dht-in.hpp b/dht/dht-in.hpp index 0d668d438..568b801c3 100644 --- a/dht/dht-in.hpp +++ b/dht/dht-in.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -23,7 +23,7 @@ #include -namespace ton { +namespace ion { namespace dht { @@ -126,15 +126,15 @@ class DhtMemberImpl : public DhtMember { promise.set_error(td::Status::Error(ErrorCode::protoviolation, "bad DHT query")); } - void process_query(adnl::AdnlNodeIdShort src, ton_api::dht_ping &query, td::Promise promise); - void process_query(adnl::AdnlNodeIdShort src, ton_api::dht_findNode &query, td::Promise promise); - void process_query(adnl::AdnlNodeIdShort src, ton_api::dht_findValue &query, td::Promise promise); - void process_query(adnl::AdnlNodeIdShort src, ton_api::dht_store &query, td::Promise promise); - void process_query(adnl::AdnlNodeIdShort src, ton_api::dht_getSignedAddressList &query, + void process_query(adnl::AdnlNodeIdShort src, ion_api::dht_ping &query, td::Promise promise); + void process_query(adnl::AdnlNodeIdShort src, ion_api::dht_findNode &query, td::Promise promise); + void process_query(adnl::AdnlNodeIdShort src, ion_api::dht_findValue &query, td::Promise promise); + void process_query(adnl::AdnlNodeIdShort src, ion_api::dht_store &query, td::Promise promise); + void process_query(adnl::AdnlNodeIdShort src, ion_api::dht_getSignedAddressList &query, td::Promise promise); - void process_query(adnl::AdnlNodeIdShort src, ton_api::dht_registerReverseConnection &query, + void process_query(adnl::AdnlNodeIdShort src, ion_api::dht_registerReverseConnection &query, td::Promise promise); - void process_query(adnl::AdnlNodeIdShort src, ton_api::dht_requestReversePing &query, + void process_query(adnl::AdnlNodeIdShort src, ion_api::dht_requestReversePing &query, td::Promise promise); public: @@ -197,4 +197,4 @@ class DhtMemberImpl : public DhtMember { } // namespace dht -} // namespace ton +} // namespace ion diff --git a/dht/dht-node.cpp b/dht/dht-node.cpp index 409e3f680..cf0f2b7ca 100644 --- a/dht/dht-node.cpp +++ b/dht/dht-node.cpp @@ -1,29 +1,29 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ #include "dht-node.hpp" #include "keys/encryptor.h" -namespace ton { +namespace ion { namespace dht { -td::Status DhtNode::update(tl_object_ptr obj, td::int32 our_network_id) { +td::Status DhtNode::update(tl_object_ptr obj, td::int32 our_network_id) { if (version_ && obj->version_ <= version_) { return td::Status::Error(ErrorCode::notready, "too old version"); } @@ -66,14 +66,14 @@ td::Status DhtNode::check_signature() const { return td::Status::OK(); } -tl_object_ptr DhtNodesList::tl() const { - std::vector> L; +tl_object_ptr DhtNodesList::tl() const { + std::vector> L; for (auto &n : list_) { L.emplace_back(n.tl()); } - return create_tl_object(std::move(L)); + return create_tl_object(std::move(L)); } } // namespace dht -} // namespace ton +} // namespace ion diff --git a/dht/dht-node.hpp b/dht/dht-node.hpp index d5860f91b..32a37ad15 100644 --- a/dht/dht-node.hpp +++ b/dht/dht-node.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -22,10 +22,10 @@ #include "adnl/adnl-address-list.hpp" #include "dht-types.h" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" #include "td/utils/overloaded.h" -namespace ton { +namespace ion { namespace dht { @@ -45,7 +45,7 @@ class DhtNode { DhtNode(adnl::AdnlNodeIdFull id, adnl::AdnlAddressList addr_list, td::int32 version, td::int32 network_id, td::SharedSlice signature) : id_(id), addr_list_(addr_list), version_(version), network_id_(network_id), signature_(std::move(signature)) { } - static td::Result create(tl_object_ptr obj, td::int32 our_network_id) { + static td::Result create(tl_object_ptr obj, td::int32 our_network_id) { if (obj->version_ == 0) { return td::Status::Error(ErrorCode::protoviolation, "zero version"); } @@ -53,7 +53,7 @@ class DhtNode { TRY_STATUS(n.update(std::move(obj), our_network_id)); return std::move(n); } - td::Status update(tl_object_ptr obj, td::int32 our_network_id); + td::Status update(tl_object_ptr obj, td::int32 our_network_id); DhtKeyId get_key() const { CHECK(!id_.empty()); return DhtKeyId{id_.compute_short_id()}; @@ -69,7 +69,7 @@ class DhtNode { return version_; } - tl_object_ptr tl() const { + tl_object_ptr tl() const { td::BufferSlice signature_ext; if (network_id_ == -1) { signature_ext = signature_.clone_as_buffer_slice(); @@ -80,7 +80,7 @@ class DhtNode { s.remove_prefix(4); s.copy_from(signature_.as_slice()); } - return create_tl_object(id_.tl(), addr_list_.tl(), version_, std::move(signature_ext)); + return create_tl_object(id_.tl(), addr_list_.tl(), version_, std::move(signature_ext)); } DhtNode clone() const { return DhtNode{id_, addr_list_, version_, network_id_, signature_.clone()}; @@ -91,7 +91,7 @@ class DhtNode { class DhtNodesList { public: DhtNodesList() = default; - DhtNodesList(tl_object_ptr R, td::int32 our_network_id) { + DhtNodesList(tl_object_ptr R, td::int32 our_network_id) { for (auto &n : R->nodes_) { auto N = DhtNode::create(std::move(n), our_network_id); if (N.is_ok()) { @@ -106,7 +106,7 @@ class DhtNodesList { list_.emplace_back(std::move(node)); } - tl_object_ptr tl() const; + tl_object_ptr tl() const; std::vector &list() { return list_; } @@ -123,4 +123,4 @@ class DhtNodesList { } // namespace dht -} // namespace ton +} // namespace ion diff --git a/dht/dht-query.cpp b/dht/dht-query.cpp index 3d43b1069..952f0f1af 100644 --- a/dht/dht-query.cpp +++ b/dht/dht-query.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -25,11 +25,11 @@ #include "td/utils/format.h" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" #include "dht-query.hpp" -namespace ton { +namespace ion { namespace dht { @@ -103,12 +103,12 @@ void DhtQuery::finish_query(adnl::AdnlNodeIdShort id, bool success) { } void DhtQueryFindNodes::send_one_query(adnl::AdnlNodeIdShort id) { - auto P = create_serialize_tl_object(get_key().tl(), get_k()); + auto P = create_serialize_tl_object(get_key().tl(), get_k()); td::BufferSlice B; if (client_only_) { B = std::move(P); } else { - B = create_serialize_tl_object_suffix(P.as_slice(), self_.tl()); + B = create_serialize_tl_object_suffix(P.as_slice(), self_.tl()); } auto Pr = td::PromiseCreator::lambda([SelfId = actor_id(this), dst = id](td::Result R) { @@ -126,7 +126,7 @@ void DhtQueryFindNodes::on_result(td::Result R, adnl::AdnlNodeI return; } - auto Res = fetch_tl_object(R.move_as_ok(), true); + auto Res = fetch_tl_object(R.move_as_ok(), true); if (Res.is_error()) { VLOG(DHT_WARNING) << this << ": incorrect result on dht.findNodes query from " << dst << ": " << Res.move_as_error(); @@ -141,12 +141,12 @@ void DhtQueryFindNodes::finish(DhtNodesList list) { } void DhtQueryFindValue::send_one_query(adnl::AdnlNodeIdShort id) { - auto P = create_serialize_tl_object(get_key().tl(), get_k()); + auto P = create_serialize_tl_object(get_key().tl(), get_k()); td::BufferSlice B; if (client_only_) { B = std::move(P); } else { - B = create_serialize_tl_object_suffix(P.as_slice(), self_.tl()); + B = create_serialize_tl_object_suffix(P.as_slice(), self_.tl()); } auto Pr = td::PromiseCreator::lambda([SelfId = actor_id(this), dst = id](td::Result R) { @@ -158,12 +158,12 @@ void DhtQueryFindValue::send_one_query(adnl::AdnlNodeIdShort id) { } void DhtQueryFindValue::send_one_query_nodes(adnl::AdnlNodeIdShort id) { - auto P = create_serialize_tl_object(get_key().tl(), get_k()); + auto P = create_serialize_tl_object(get_key().tl(), get_k()); td::BufferSlice B; if (client_only_) { B = std::move(P); } else { - B = create_serialize_tl_object_suffix(P.as_slice(), self_.tl()); + B = create_serialize_tl_object_suffix(P.as_slice(), self_.tl()); } auto Pr = td::PromiseCreator::lambda([SelfId = actor_id(this), dst = id](td::Result R) { @@ -180,7 +180,7 @@ void DhtQueryFindValue::on_result(td::Result R, adnl::AdnlNodeI finish_query(dst, false); return; } - auto Res = fetch_tl_object(R.move_as_ok(), true); + auto Res = fetch_tl_object(R.move_as_ok(), true); if (Res.is_error()) { VLOG(DHT_WARNING) << this << ": dropping incorrect answer on dht.findValue query from " << dst << ": " << Res.move_as_error(); @@ -192,9 +192,9 @@ void DhtQueryFindValue::on_result(td::Result R, adnl::AdnlNodeI bool send_get_nodes = false; auto A = Res.move_as_ok(); - ton_api::downcast_call( + ion_api::downcast_call( *A, td::overloaded( - [&](ton_api::dht_valueFound &v) { + [&](ion_api::dht_valueFound &v) { auto valueR = DhtValue::create(std::move(v.value_), true); if (valueR.is_error()) { VLOG(DHT_WARNING) << this << ": received incorrect dht answer on find value query from " << dst @@ -216,7 +216,7 @@ void DhtQueryFindValue::on_result(td::Result R, adnl::AdnlNodeI need_stop = true; } }, - [&](ton_api::dht_valueNotFound &v) { + [&](ion_api::dht_valueNotFound &v) { add_nodes(DhtNodesList{std::move(v.nodes_), our_network_id()}); })); if (need_stop) { @@ -234,7 +234,7 @@ void DhtQueryFindValue::on_result_nodes(td::Result R, adnl::Adn finish_query(dst, false); return; } - auto Res = fetch_tl_object(R.move_as_ok(), true); + auto Res = fetch_tl_object(R.move_as_ok(), true); if (Res.is_error()) { VLOG(DHT_WARNING) << this << ": dropping incorrect answer on dht.findNodes query from " << dst << ": " << Res.move_as_error(); @@ -242,7 +242,7 @@ void DhtQueryFindValue::on_result_nodes(td::Result R, adnl::Adn return; } auto r = Res.move_as_ok(); - add_nodes(DhtNodesList{create_tl_object(std::move(r->nodes_)), our_network_id()}); + add_nodes(DhtNodesList{create_tl_object(std::move(r->nodes_)), our_network_id()}); finish_query(dst); } @@ -330,7 +330,7 @@ void DhtQueryStore::send_stores(td::Result R) { auto P = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result R) { td::actor::send_closure(SelfId, &DhtQueryStore::store_ready, std::move(R)); }); - auto M = create_serialize_tl_object(value_.tl()); + auto M = create_serialize_tl_object(value_.tl()); td::actor::send_closure(adnl_, &adnl::Adnl::send_query, src_, node.adnl_id().compute_short_id(), "dht store", std::move(P), td::Timestamp::in(2.0 + td::Random::fast(0, 20) * 0.1), std::move(M)); } @@ -341,7 +341,7 @@ void DhtQueryStore::store_ready(td::Result R) { fail_++; VLOG(DHT_INFO) << this << ": failed store query: " << R.move_as_error(); } else { - auto R2 = fetch_tl_object(R.move_as_ok(), true); + auto R2 = fetch_tl_object(R.move_as_ok(), true); if (R2.is_error()) { fail_++; VLOG(DHT_WARNING) << this << ": can not parse answer (expected dht.stored): " << R2.move_as_error(); @@ -378,7 +378,7 @@ DhtQueryRegisterReverseConnection::DhtQueryRegisterReverseConnection( node_ = node; adnl_ = adnl; src_ = src; - query_ = create_serialize_tl_object(client.tl(), ttl, std::move(signature)); + query_ = create_serialize_tl_object(client.tl(), ttl, std::move(signature)); } void DhtQueryRegisterReverseConnection::start_up() { @@ -424,7 +424,7 @@ void DhtQueryRegisterReverseConnection::ready(td::Result R) { fail_++; VLOG(DHT_INFO) << this << ": failed register reverse connection query: " << R.move_as_error(); } else { - auto R2 = fetch_tl_object(R.move_as_ok(), true); + auto R2 = fetch_tl_object(R.move_as_ok(), true); if (R2.is_error()) { fail_++; VLOG(DHT_WARNING) << this << ": can not parse answer (expected dht.stored): " << R2.move_as_error(); @@ -449,7 +449,7 @@ void DhtQueryRequestReversePing::send_one_query(adnl::AdnlNodeIdShort id) { if (client_only_) { B = query_.clone(); } else { - B = create_serialize_tl_object_suffix(query_.as_slice(), self_.tl()); + B = create_serialize_tl_object_suffix(query_.as_slice(), self_.tl()); } auto P = td::PromiseCreator::lambda([SelfId = actor_id(this), dst = id](td::Result R) { td::actor::send_closure(SelfId, &DhtQueryRequestReversePing::on_result, std::move(R), dst); @@ -464,7 +464,7 @@ void DhtQueryRequestReversePing::on_result(td::Result R, adnl:: finish_query(dst, false); return; } - auto Res = fetch_tl_object(R.move_as_ok(), true); + auto Res = fetch_tl_object(R.move_as_ok(), true); if (Res.is_error()) { VLOG(DHT_WARNING) << this << ": dropping incorrect answer on dht.requestReversePing query from " << dst << ": " << Res.move_as_error(); @@ -473,12 +473,12 @@ void DhtQueryRequestReversePing::on_result(td::Result R, adnl:: } auto A = Res.move_as_ok(); - ton_api::downcast_call(*A, td::overloaded( - [&](ton_api::dht_reversePingOk &v) { + ion_api::downcast_call(*A, td::overloaded( + [&](ion_api::dht_reversePingOk &v) { promise_.set_value(td::Unit()); stop(); }, - [&](ton_api::dht_clientNotFound &v) { + [&](ion_api::dht_clientNotFound &v) { add_nodes(DhtNodesList{std::move(v.nodes_), our_network_id()}); finish_query(dst); })); @@ -490,4 +490,4 @@ void DhtQueryRequestReversePing::finish(DhtNodesList list) { } // namespace dht -} // namespace ton +} // namespace ion diff --git a/dht/dht-query.hpp b/dht/dht-query.hpp index e305f107a..21dc1568c 100644 --- a/dht/dht-query.hpp +++ b/dht/dht-query.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -27,11 +27,11 @@ #include "adnl/adnl.h" #include "td/actor/PromiseFuture.h" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" #include "dht.hpp" -namespace ton { +namespace ion { namespace dht { @@ -262,7 +262,7 @@ class DhtQueryRequestReversePing : public DhtQuery { : DhtQuery(DhtMember::get_reverse_connection_key(client).compute_key_id(), print_id, src, k, a, our_network_id, std::move(self), client_only, node, adnl) , promise_(std::move(promise)) - , query_(create_serialize_tl_object(target.tl(), std::move(signature), + , query_(create_serialize_tl_object(target.tl(), std::move(signature), client.bits256_value(), k)) { add_nodes(std::move(list)); } @@ -296,4 +296,4 @@ inline td::StringBuilder &operator<<(td::StringBuilder &sb, const DhtQueryStore } // namespace dht -} // namespace ton +} // namespace ion diff --git a/dht/dht-remote-node.cpp b/dht/dht-remote-node.cpp index 1273750c1..d2d73ee6e 100644 --- a/dht/dht-remote-node.cpp +++ b/dht/dht-remote-node.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -24,11 +24,11 @@ #include "td/utils/format.h" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" #include "dht-remote-node.hpp" -namespace ton { +namespace ion { namespace dht { @@ -101,7 +101,7 @@ void DhtRemoteNode::send_ping(bool client_only, td::actor::ActorId a VLOG(DHT_INFO) << "[dht]: received error for query to " << key << ": " << R.move_as_error(); return; } - auto F = fetch_tl_object(R.move_as_ok(), true); + auto F = fetch_tl_object(R.move_as_ok(), true); if (F.is_ok()) { auto N = DhtNode::create(F.move_as_ok(), our_network_id); @@ -116,12 +116,12 @@ void DhtRemoteNode::send_ping(bool client_only, td::actor::ActorId a << ": dropping invalid getSignedAddressList() query answer: " << F.move_as_error(); } }); - auto Q = create_serialize_tl_object(); + auto Q = create_serialize_tl_object(); td::BufferSlice B; if (client_only) { B = std::move(Q); } else { - B = create_serialize_tl_object_suffix(Q.as_slice(), R.move_as_ok().tl()); + B = create_serialize_tl_object_suffix(Q.as_slice(), R.move_as_ok().tl()); } td::actor::send_closure(adnl, &adnl::Adnl::send_query, src, id, "dht ping", std::move(P), td::Timestamp::in(10.0 + td::Random::fast(0, 100) * 0.1), std::move(B)); @@ -146,4 +146,4 @@ td::Result> DhtRemoteNode::create(DhtNode node, t } // namespace dht -} // namespace ton +} // namespace ion diff --git a/dht/dht-remote-node.hpp b/dht/dht-remote-node.hpp index 8e7db4893..2c7cb4ddd 100644 --- a/dht/dht-remote-node.hpp +++ b/dht/dht-remote-node.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -26,9 +26,9 @@ #include "dht.hpp" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" -namespace ton { +namespace ion { namespace dht { @@ -87,4 +87,4 @@ class DhtRemoteNode { } // namespace dht -} // namespace ton +} // namespace ion diff --git a/dht/dht-types.cpp b/dht/dht-types.cpp index 118df2a80..2b6c9c8c7 100644 --- a/dht/dht-types.cpp +++ b/dht/dht-types.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -21,15 +21,15 @@ #include "td/utils/overloaded.h" #include "keys/encryptor.h" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" #include -namespace ton { +namespace ion { namespace dht { -td::Result DhtKey::create(tl_object_ptr key) { +td::Result DhtKey::create(tl_object_ptr key) { if (key->name_.length() > max_name_length()) { return td::Status::Error(ErrorCode::error, PSTRING() << "too big name length. length=" << key->name_.length()); } @@ -43,8 +43,8 @@ td::Result DhtKey::create(tl_object_ptr key) { return DhtKey{PublicKeyHash{key->id_}, key->name_.as_slice().str(), static_cast(key->idx_)}; } -tl_object_ptr DhtKey::tl() const { - return create_tl_object(id_.tl(), td::BufferSlice{namestr_}, idx_); +tl_object_ptr DhtKey::tl() const { + return create_tl_object(id_.tl(), td::BufferSlice{namestr_}, idx_); } td::Status DhtKey::check() const { @@ -90,13 +90,13 @@ td::Status DhtKeyDescription::check() const { return td::Status::OK(); } -tl_object_ptr DhtKeyDescription::tl() const { - return create_tl_object(key_.tl(), public_key_.tl(), update_rule_->tl(), +tl_object_ptr DhtKeyDescription::tl() const { + return create_tl_object(key_.tl(), public_key_.tl(), update_rule_->tl(), signature_.clone_as_buffer_slice()); } td::BufferSlice DhtKeyDescription::to_sign() const { - return create_serialize_tl_object(key_.tl(), public_key_.tl(), update_rule_->tl(), + return create_serialize_tl_object(key_.tl(), public_key_.tl(), update_rule_->tl(), td::BufferSlice()); } @@ -120,7 +120,7 @@ td::Result DhtKeyDescription::create(DhtKey key, PublicKey pu return std::move(desc); } -td::Result DhtKeyDescription::create(tl_object_ptr desc, +td::Result DhtKeyDescription::create(tl_object_ptr desc, bool check_signature) { auto signature = std::move(desc->signature_); td::BufferSlice to_sign; @@ -143,7 +143,7 @@ td::Result DhtKeyDescription::create(tl_object_ptr DhtValue::create(tl_object_ptr obj, bool check_signature) { +td::Result DhtValue::create(tl_object_ptr obj, bool check_signature) { TRY_RESULT(desc, DhtKeyDescription::create(std::move(obj->key_), check_signature)); return create(std::move(desc), std::move(obj->value_), obj->ttl_, std::move(obj->signature_)); @@ -169,13 +169,13 @@ DhtValue DhtValue::clone() const { return DhtValue{key_.clone(), value_.clone(), ttl_, signature_.clone()}; } -tl_object_ptr DhtValue::tl() const { - return create_tl_object(key_.tl(), value_.clone_as_buffer_slice(), ttl_, +tl_object_ptr DhtValue::tl() const { + return create_tl_object(key_.tl(), value_.clone_as_buffer_slice(), ttl_, signature_.clone_as_buffer_slice()); } td::BufferSlice DhtValue::to_sign() const { - return create_serialize_tl_object(key_.tl(), value_.clone_as_buffer_slice(), ttl_, + return create_serialize_tl_object(key_.tl(), value_.clone_as_buffer_slice(), ttl_, td::BufferSlice()); } @@ -238,8 +238,8 @@ td::Status DhtUpdateRuleSignature::update_value(DhtValue &value, DhtValue &&new_ return td::Status::OK(); } -tl_object_ptr DhtUpdateRuleSignature::tl() const { - return create_tl_object(); +tl_object_ptr DhtUpdateRuleSignature::tl() const { + return create_tl_object(); } td::Result> DhtUpdateRuleSignature::create() { @@ -262,8 +262,8 @@ td::Status DhtUpdateRuleAnybody::update_value(DhtValue &value, DhtValue &&new_va return td::Status::OK(); } -tl_object_ptr DhtUpdateRuleAnybody::tl() const { - return create_tl_object(); +tl_object_ptr DhtUpdateRuleAnybody::tl() const { + return create_tl_object(); } td::Result> DhtUpdateRuleAnybody::create() { @@ -277,7 +277,7 @@ td::Status DhtUpdateRuleOverlayNodes::check_value(const DhtValue &value) { if (value.signature().size() > 0) { return td::Status::Error(ErrorCode::protoviolation, "cannot have signature in DhtUpdateRuleOverlayNodes"); } - auto F = fetch_tl_object(value.value().clone_as_buffer_slice(), true); + auto F = fetch_tl_object(value.value().clone_as_buffer_slice(), true); if (F.is_error()) { return td::Status::Error(ErrorCode::protoviolation, "bad overlay nodes value"); } @@ -286,7 +286,7 @@ td::Status DhtUpdateRuleOverlayNodes::check_value(const DhtValue &value) { TRY_RESULT(pub, adnl::AdnlNodeIdFull::create(node->id_)); auto sig = std::move(node->signature_); auto obj = - create_tl_object(pub.compute_short_id().tl(), node->overlay_, node->version_); + create_tl_object(pub.compute_short_id().tl(), node->overlay_, node->version_); if (node->overlay_ != value.key().key().public_key_hash().bits256_value()) { return td::Status::Error(ErrorCode::protoviolation, "bad overlay id"); } @@ -298,12 +298,12 @@ td::Status DhtUpdateRuleOverlayNodes::check_value(const DhtValue &value) { } td::Status DhtUpdateRuleOverlayNodes::update_value(DhtValue &value, DhtValue &&new_value) { - TRY_RESULT_PREFIX(N, fetch_tl_object(value.value().clone_as_buffer_slice(), true), + TRY_RESULT_PREFIX(N, fetch_tl_object(value.value().clone_as_buffer_slice(), true), "bad dht value in updateRule.overlayNodes: "); - TRY_RESULT_PREFIX(L, fetch_tl_object(new_value.value().clone_as_buffer_slice(), true), + TRY_RESULT_PREFIX(L, fetch_tl_object(new_value.value().clone_as_buffer_slice(), true), "bad dht value in updateRule.overlayNodes: "); - std::vector> res; + std::vector> res; std::map S; for (auto &n : N->nodes_) { @@ -350,11 +350,11 @@ td::Status DhtUpdateRuleOverlayNodes::update_value(DhtValue &value, DhtValue &&n v.resize(v.size() - 1); } - std::vector> vec; + std::vector> vec; for (auto &p : v) { vec.push_back(std::move(res[p.first])); } - auto nodes = create_serialize_tl_object(std::move(vec)); + auto nodes = create_serialize_tl_object(std::move(vec)); CHECK(nodes.size() == size); CHECK(nodes.size() <= DhtValue::max_value_size()); @@ -364,8 +364,8 @@ td::Status DhtUpdateRuleOverlayNodes::update_value(DhtValue &value, DhtValue &&n return td::Status::OK(); } -bool DhtUpdateRuleOverlayNodes::check_is_acceptable(const ton::dht::DhtValue &value) { - auto F = fetch_tl_object(value.value().clone_as_buffer_slice(), true); +bool DhtUpdateRuleOverlayNodes::check_is_acceptable(const ion::dht::DhtValue &value) { + auto F = fetch_tl_object(value.value().clone_as_buffer_slice(), true); if (F.is_error()) { return false; } @@ -379,24 +379,24 @@ bool DhtUpdateRuleOverlayNodes::check_is_acceptable(const ton::dht::DhtValue &va return false; } -tl_object_ptr DhtUpdateRuleOverlayNodes::tl() const { - return create_tl_object(); +tl_object_ptr DhtUpdateRuleOverlayNodes::tl() const { + return create_tl_object(); } td::Result> DhtUpdateRuleOverlayNodes::create() { return std::make_shared(); } -td::Result> DhtUpdateRule::create(tl_object_ptr obj) { +td::Result> DhtUpdateRule::create(tl_object_ptr obj) { td::Result> R; - ton_api::downcast_call( + ion_api::downcast_call( *obj.get(), - td::overloaded([&](ton_api::dht_updateRule_signature &obj) { R = DhtUpdateRuleSignature::create(); }, - [&](ton_api::dht_updateRule_anybody &obj) { R = DhtUpdateRuleAnybody::create(); }, - [&](ton_api::dht_updateRule_overlayNodes &obj) { R = DhtUpdateRuleOverlayNodes::create(); })); + td::overloaded([&](ion_api::dht_updateRule_signature &obj) { R = DhtUpdateRuleSignature::create(); }, + [&](ion_api::dht_updateRule_anybody &obj) { R = DhtUpdateRuleAnybody::create(); }, + [&](ion_api::dht_updateRule_overlayNodes &obj) { R = DhtUpdateRuleOverlayNodes::create(); })); return R; } } // namespace dht -} // namespace ton +} // namespace ion diff --git a/dht/dht-types.h b/dht/dht-types.h index 45657d456..7f72085ba 100644 --- a/dht/dht-types.h +++ b/dht/dht-types.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -24,7 +24,7 @@ #include "tl-utils/tl-utils.hpp" #include "common/io.hpp" -namespace ton { +namespace ion { namespace dht { @@ -90,7 +90,7 @@ class DhtKey { DhtKey(PublicKeyHash id, DhtKeyName namestr, td::uint32 idx) : id_(std::move(id)), namestr_(std::move(namestr)), idx_(idx) { } - static td::Result create(tl_object_ptr key); + static td::Result create(tl_object_ptr key); td::Status check() const; const auto &public_key_hash() const { return id_; @@ -101,7 +101,7 @@ class DhtKey { td::uint32 idx() const { return idx_; } - tl_object_ptr tl() const; + tl_object_ptr tl() const; DhtKeyId compute_key_id() const; DhtKey clone() const; @@ -122,8 +122,8 @@ class DhtUpdateRule { virtual bool check_is_acceptable(const DhtValue &value) { return true; } - virtual tl_object_ptr tl() const = 0; - static td::Result> create(tl_object_ptr obj); + virtual tl_object_ptr tl() const = 0; + static td::Result> create(tl_object_ptr obj); }; class DhtKeyDescription { @@ -155,9 +155,9 @@ class DhtKeyDescription { void update_signature(td::SharedSlice signature); td::BufferSlice to_sign() const; td::Status check() const; - tl_object_ptr tl() const; + tl_object_ptr tl() const; DhtKeyDescription clone() const; - static td::Result create(tl_object_ptr desc, bool check_signature); + static td::Result create(tl_object_ptr desc, bool check_signature); static td::Result create(DhtKey key, PublicKey public_key, std::shared_ptr update_rule, td::BufferSlice signature); static td::Result create(DhtKey key, PublicKey public_key, @@ -183,7 +183,7 @@ class DhtValue { : key_(std::move(key)), value_(std::move(value)), ttl_(ttl), signature_(std::move(signature)) { } - static td::Result create(tl_object_ptr obj, bool check_signature); + static td::Result create(tl_object_ptr obj, bool check_signature); static td::Result create(DhtKeyDescription key, td::BufferSlice value, td::uint32 ttl, td::BufferSlice signature); static td::Result create(DhtKeyDescription key, td::SharedSlice value, td::uint32 ttl, @@ -205,7 +205,7 @@ class DhtValue { } DhtValue clone() const; - tl_object_ptr tl() const; + tl_object_ptr tl() const; td::BufferSlice to_sign() const; td::Status update(DhtValue &&value); void set(td::BufferSlice value, td::uint32 ttl, td::BufferSlice signature); @@ -231,7 +231,7 @@ class DhtUpdateRuleSignature : public DhtUpdateRule { bool need_republish() const override { return true; } - tl_object_ptr tl() const override; + tl_object_ptr tl() const override; static td::Result> create(); }; @@ -242,7 +242,7 @@ class DhtUpdateRuleAnybody : public DhtUpdateRule { bool need_republish() const override { return false; } - tl_object_ptr tl() const override; + tl_object_ptr tl() const override; static td::Result> create(); }; @@ -254,17 +254,17 @@ class DhtUpdateRuleOverlayNodes : public DhtUpdateRule { return false; } bool check_is_acceptable(const DhtValue &value) override; - tl_object_ptr tl() const override; + tl_object_ptr tl() const override; static td::Result> create(); }; } // namespace dht -} // namespace ton +} // namespace ion namespace td { -inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ton::dht::DhtKeyId &dht) { +inline td::StringBuilder &operator<<(td::StringBuilder &sb, const ion::dht::DhtKeyId &dht) { sb << dht.tl(); return sb; } diff --git a/dht/dht.cpp b/dht/dht.cpp index b774b5f91..fe1dd96fb 100644 --- a/dht/dht.cpp +++ b/dht/dht.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -27,14 +27,14 @@ #include "td/db/RocksDb.h" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" #include "dht.h" #include "dht-bucket.hpp" #include "dht-query.hpp" #include "dht-in.hpp" -namespace ton { +namespace ion { namespace dht { @@ -80,16 +80,16 @@ td::Result> Dht::create_client(adnl::AdnlNodeIdShort id } void DhtMemberImpl::start_up() { - std::vector methods = {ton_api::dht_getSignedAddressList::ID, - ton_api::dht_findNode::ID, - ton_api::dht_findValue::ID, - ton_api::dht_store::ID, - ton_api::dht_ping::ID, - ton_api::dht_registerReverseConnection::ID, - ton_api::dht_requestReversePing::ID, - ton_api::dht_query::ID, - ton_api::dht_message::ID, - ton_api::dht_requestReversePingCont::ID}; + std::vector methods = {ion_api::dht_getSignedAddressList::ID, + ion_api::dht_findNode::ID, + ion_api::dht_findValue::ID, + ion_api::dht_store::ID, + ion_api::dht_ping::ID, + ion_api::dht_registerReverseConnection::ID, + ion_api::dht_requestReversePing::ID, + ion_api::dht_query::ID, + ion_api::dht_message::ID, + ion_api::dht_requestReversePingCont::ID}; for (auto it : methods) { td::actor::send_closure(adnl_, &adnl::Adnl::subscribe, id_, adnl::Adnl::int_to_bytestring(it), @@ -101,12 +101,12 @@ void DhtMemberImpl::start_up() { std::shared_ptr kv = std::make_shared( td::RocksDb::open(PSTRING() << db_root_ << "/dht-" << td::base64url_encode(id_.as_slice())).move_as_ok()); for (td::uint32 bit = 0; bit < 256; bit++) { - auto key = create_hash_tl_object(bit); + auto key = create_hash_tl_object(bit); std::string value; auto R = kv->get(key.as_slice(), value); R.ensure(); if (R.move_as_ok() == td::KeyValue::GetStatus::Ok) { - auto V = fetch_tl_object(td::BufferSlice{value}, true); + auto V = fetch_tl_object(td::BufferSlice{value}, true); V.ensure(); auto nodes = std::move(V.move_as_ok()->nodes_); auto s = nodes->nodes_.size(); @@ -124,16 +124,16 @@ void DhtMemberImpl::start_up() { } void DhtMemberImpl::tear_down() { - std::vector methods = {ton_api::dht_getSignedAddressList::ID, - ton_api::dht_findNode::ID, - ton_api::dht_findValue::ID, - ton_api::dht_store::ID, - ton_api::dht_ping::ID, - ton_api::dht_registerReverseConnection::ID, - ton_api::dht_requestReversePing::ID, - ton_api::dht_query::ID, - ton_api::dht_message::ID, - ton_api::dht_requestReversePingCont::ID}; + std::vector methods = {ion_api::dht_getSignedAddressList::ID, + ion_api::dht_findNode::ID, + ion_api::dht_findValue::ID, + ion_api::dht_store::ID, + ion_api::dht_ping::ID, + ion_api::dht_registerReverseConnection::ID, + ion_api::dht_requestReversePing::ID, + ion_api::dht_query::ID, + ion_api::dht_message::ID, + ion_api::dht_requestReversePingCont::ID}; for (auto it : methods) { td::actor::send_closure(adnl_, &adnl::Adnl::unsubscribe, id_, adnl::Adnl::int_to_bytestring(it)); @@ -151,8 +151,8 @@ void DhtMemberImpl::save_to_db() { auto &B = buckets_[bit]; auto list = B.export_nodes(); if (list.size() > 0) { - auto key = create_hash_tl_object(bit); - auto value = create_serialize_tl_object(list.tl()); + auto key = create_hash_tl_object(bit); + auto value = create_serialize_tl_object(list.tl()); db_.set(key, std::move(value)); } @@ -207,13 +207,13 @@ td::uint32 DhtMemberImpl::distance(DhtKeyId key_id, td::uint32 max_value) { return res; } -void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::dht_ping &query, +void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ion_api::dht_ping &query, td::Promise promise) { ping_queries_++; - promise.set_value(create_serialize_tl_object(query.random_id_)); + promise.set_value(create_serialize_tl_object(query.random_id_)); } -void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::dht_findNode &query, +void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ion_api::dht_findNode &query, td::Promise promise) { find_node_queries_++; auto k = static_cast(query.k_); @@ -224,7 +224,7 @@ void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::dht_findNo promise.set_value(serialize_tl_object(R.tl(), true)); } -void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::dht_findValue &query, +void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ion_api::dht_findValue &query, td::Promise promise) { find_value_queries_++; auto it = values_.find(DhtKeyId{query.key_}); @@ -233,7 +233,7 @@ void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::dht_findVa it = values_.end(); } if (it != values_.end()) { - promise.set_value(create_serialize_tl_object(it->second.tl())); + promise.set_value(create_serialize_tl_object(it->second.tl())); return; } @@ -243,7 +243,7 @@ void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::dht_findVa } auto R = get_nearest_nodes(DhtKeyId{query.key_}, k); - promise.set_value(create_serialize_tl_object(R.tl())); + promise.set_value(create_serialize_tl_object(R.tl())); } td::Status DhtMemberImpl::store_in(DhtValue value) { @@ -269,7 +269,7 @@ td::Status DhtMemberImpl::store_in(DhtValue value) { return td::Status::OK(); } -void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::dht_store &query, +void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ion_api::dht_store &query, td::Promise promise) { store_queries_++; auto V = DhtValue::create(std::move(query.value_), true); @@ -282,14 +282,14 @@ void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::dht_store auto b = store_in(V.move_as_ok()); if (b.is_ok()) { - promise.set_value(create_serialize_tl_object()); + promise.set_value(create_serialize_tl_object()); } else { VLOG(DHT_INFO) << this << ": dropping store() query from " << src << ": " << b.move_as_error(); promise.set_error(td::Status::Error(ErrorCode::protoviolation, "dropping dht_store() query")); } } -void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::dht_getSignedAddressList &query, +void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ion_api::dht_getSignedAddressList &query, td::Promise promise) { get_addr_list_queries_++; @@ -312,7 +312,7 @@ static td::BufferSlice register_reverse_connection_to_sign(adnl::AdnlNodeIdShort return result; } -void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::dht_registerReverseConnection &query, +void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ion_api::dht_registerReverseConnection &query, td::Promise promise) { td::uint32 ttl = query.ttl_, now = (td::uint32)td::Clocks::system(); if (ttl <= now) { @@ -325,10 +325,10 @@ void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::dht_regist TRY_STATUS_PROMISE(promise, encryptor->check_signature(to_sign, query.signature_)); DhtKeyId key_id = get_reverse_connection_key(client_id).compute_key_id(); reverse_connections_[client_id] = ReverseConnection{src, key_id, td::Timestamp::at_unix(std::min(ttl, now + 300))}; - promise.set_value(create_serialize_tl_object()); + promise.set_value(create_serialize_tl_object()); } -void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::dht_requestReversePing &query, +void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ion_api::dht_requestReversePing &query, td::Promise promise) { adnl::AdnlNodeIdShort client{query.client_}; auto it = reverse_connections_.find(client); @@ -341,9 +341,9 @@ void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::dht_reques TRY_STATUS_PROMISE(promise, encryptor->check_signature(serialize_tl_object(query.target_, true), query.signature_)); td::actor::send_closure(adnl_, &adnl::Adnl::send_message, id_, it->second.dht_node_, - create_serialize_tl_object( + create_serialize_tl_object( std::move(query.target_), std::move(query.signature_), query.client_)); - promise.set_result(create_serialize_tl_object()); + promise.set_result(create_serialize_tl_object()); return; } } @@ -352,7 +352,7 @@ void DhtMemberImpl::process_query(adnl::AdnlNodeIdShort src, ton_api::dht_reques k = max_k(); } auto R = get_nearest_nodes(get_reverse_connection_key(client).compute_key_id(), k); - promise.set_value(create_serialize_tl_object(R.tl())); + promise.set_value(create_serialize_tl_object(R.tl())); } void DhtMemberImpl::receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice data, @@ -361,7 +361,7 @@ void DhtMemberImpl::receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice dat return; } { - auto R = fetch_tl_prefix(data, true); + auto R = fetch_tl_prefix(data, true); if (R.is_ok()) { auto N = DhtNode::create(std::move(R.move_as_ok()->node_), network_id_); if (N.is_ok()) { @@ -377,7 +377,7 @@ void DhtMemberImpl::receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice dat } } } - auto R = fetch_tl_object(std::move(data), true); + auto R = fetch_tl_object(std::move(data), true); if (R.is_error()) { VLOG(DHT_WARNING) << this << ": dropping unknown query to DHT node: " << R.move_as_error(); @@ -390,12 +390,12 @@ void DhtMemberImpl::receive_query(adnl::AdnlNodeIdShort src, td::BufferSlice dat VLOG(DHT_DEBUG) << this << ": ping=" << ping_queries_ << " fnode=" << find_node_queries_ << " fvalue=" << find_value_queries_ << " store=" << store_queries_ << " addrlist=" << get_addr_list_queries_; - VLOG(DHT_DEBUG) << this << ": query to DHT from " << src << ": " << ton_api::to_string(Q); + VLOG(DHT_DEBUG) << this << ": query to DHT from " << src << ": " << ion_api::to_string(Q); } - VLOG(DHT_EXTRA_DEBUG) << this << ": query to DHT from " << src << ": " << ton_api::to_string(Q); + VLOG(DHT_EXTRA_DEBUG) << this << ": query to DHT from " << src << ": " << ion_api::to_string(Q); - ton_api::downcast_call(*Q, [&](auto &object) { this->process_query(src, object, std::move(promise)); }); + ion_api::downcast_call(*Q, [&](auto &object) { this->process_query(src, object, std::move(promise)); }); } void DhtMemberImpl::add_full_node(DhtKeyId key, DhtNode node, bool set_active) { @@ -429,7 +429,7 @@ void DhtMemberImpl::receive_ping(DhtKeyId key, DhtNode result) { } void DhtMemberImpl::receive_message(adnl::AdnlNodeIdShort src, td::BufferSlice data) { - auto F = fetch_tl_object(data, true); + auto F = fetch_tl_object(data, true); if (F.is_ok()) { auto S = [&]() -> td::Status { auto f = F.move_as_ok(); @@ -539,7 +539,7 @@ void DhtMemberImpl::request_reverse_ping_cont(adnl::AdnlNode target, td::BufferS reverse_connections_.erase(it); } else { td::actor::send_closure(adnl_, &adnl::Adnl::send_message, id_, it->second.dht_node_, - create_serialize_tl_object( + create_serialize_tl_object( target.tl(), std::move(signature), client.bits256_value())); promise.set_result(td::Unit()); return; @@ -727,18 +727,18 @@ void DhtMemberImpl::get_self_node(td::Promise promise) { td::actor::send_closure(adnl_, &adnl::Adnl::get_self_node, id_, std::move(P)); } -td::Result> Dht::create_global_config(tl_object_ptr conf) { +td::Result> Dht::create_global_config(tl_object_ptr conf) { td::uint32 k = 0, a = 0; td::int32 network_id = -1; - tl_object_ptr static_nodes; - ton_api::downcast_call(*conf, td::overloaded( - [&](ton_api::dht_config_global &f) { + tl_object_ptr static_nodes; + ion_api::downcast_call(*conf, td::overloaded( + [&](ion_api::dht_config_global &f) { k = f.k_; a = f.a_; network_id = -1; static_nodes = std::move(f.static_nodes_); }, - [&](ton_api::dht_config_global_v2 &f) { + [&](ion_api::dht_config_global_v2 &f) { k = f.k_; a = f.a_; network_id = f.network_id_; @@ -760,4 +760,4 @@ td::Result> Dht::create_global_config(tl_object } // namespace dht -} // namespace ton +} // namespace ion diff --git a/dht/dht.h b/dht/dht.h index 5abff94a1..bf76d2b42 100644 --- a/dht/dht.h +++ b/dht/dht.h @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -26,11 +26,11 @@ #include "adnl/adnl.h" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" #include "dht-types.h" -namespace ton { +namespace ion { namespace dht { @@ -47,7 +47,7 @@ class Dht : public td::actor::Actor { td::actor::ActorId keyring, td::actor::ActorId adnl); static td::Result> create_global_config( - tl_object_ptr conf); + tl_object_ptr conf); virtual adnl::AdnlNodeIdShort get_id() const = 0; @@ -66,4 +66,4 @@ class Dht : public td::actor::Actor { } // namespace dht -} // namespace ton +} // namespace ion diff --git a/dht/dht.hpp b/dht/dht.hpp index 9fb05e082..1cc58afd5 100644 --- a/dht/dht.hpp +++ b/dht/dht.hpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain Library. + This file is part of ION Blockchain Library. - TON Blockchain Library is free software: you can redistribute it and/or modify + ION Blockchain Library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - TON Blockchain Library is distributed in the hope that it will be useful, + ION Blockchain Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with TON Blockchain Library. If not, see . + along with ION Blockchain Library. If not, see . Copyright 2017-2020 Telegram Systems LLP */ @@ -32,9 +32,9 @@ #include "dht.h" #include "dht-node.hpp" -#include "auto/tl/ton_api.hpp" +#include "auto/tl/ion_api.hpp" -namespace ton { +namespace ion { namespace dht { @@ -93,7 +93,7 @@ class DhtMember : public Dht { td::actor::ActorId adnl, td::int32 network_id, td::uint32 k = 10, td::uint32 a = 3, bool client_only = false); - //virtual void update_addr_list(tl_object_ptr addr_list) = 0; + //virtual void update_addr_list(tl_object_ptr addr_list) = 0; //virtual void add_node(adnl::AdnlNodeIdShort id) = 0; virtual void add_full_node(DhtKeyId id, DhtNode node, bool set_active) = 0; @@ -129,4 +129,4 @@ inline td::StringBuilder &operator<<(td::StringBuilder &sb, const DhtMember *dht } // namespace dht -} // namespace ton +} // namespace ion diff --git a/dht/utils/dht-ping-servers.cpp b/dht/utils/dht-ping-servers.cpp index 0feafb9a7..8ffeb1a9e 100644 --- a/dht/utils/dht-ping-servers.cpp +++ b/dht/utils/dht-ping-servers.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -34,7 +34,7 @@ #include "td/utils/OptionParser.h" #include "td/utils/filesystem.h" #include "dht/dht.hpp" -#include "auto/tl/ton_api_json.h" +#include "auto/tl/ion_api_json.h" #include "common/delay.h" #include "td/utils/Random.h" #include "terminal/terminal.h" @@ -43,21 +43,21 @@ class AdnlNode : public td::actor::Actor { private: - td::actor::ActorOwn network_manager_; - td::actor::ActorOwn adnl_; - td::actor::ActorOwn keyring_; - ton::adnl::AdnlNodeIdShort local_id_; + td::actor::ActorOwn network_manager_; + td::actor::ActorOwn adnl_; + td::actor::ActorOwn keyring_; + ion::adnl::AdnlNodeIdShort local_id_; std::string host_ = "127.0.0.1"; td::uint16 port_ = 2380; - std::string global_config_ = "ton-global.config"; + std::string global_config_ = "ion-global.config"; struct NodeInfo { - ton::adnl::AdnlNodeIdShort id; + ion::adnl::AdnlNodeIdShort id; td::uint32 sent = 0, received = 0; double sum_time = 0.0; - explicit NodeInfo(ton::adnl::AdnlNodeIdShort id) : id(id) { + explicit NodeInfo(ion::adnl::AdnlNodeIdShort id) : id(id) { } }; std::vector nodes_; @@ -77,23 +77,23 @@ class AdnlNode : public td::actor::Actor { } void run() { - network_manager_ = ton::adnl::AdnlNetworkManager::create(port_); - keyring_ = ton::keyring::Keyring::create(""); - adnl_ = ton::adnl::Adnl::create("", keyring_.get()); - td::actor::send_closure(adnl_, &ton::adnl::Adnl::register_network_manager, network_manager_.get()); + network_manager_ = ion::adnl::AdnlNetworkManager::create(port_); + keyring_ = ion::keyring::Keyring::create(""); + adnl_ = ion::adnl::Adnl::create("", keyring_.get()); + td::actor::send_closure(adnl_, &ion::adnl::Adnl::register_network_manager, network_manager_.get()); td::IPAddress addr; addr.init_host_port(host_, port_).ensure(); - ton::adnl::AdnlCategoryMask mask; + ion::adnl::AdnlCategoryMask mask; mask[0] = true; - td::actor::send_closure(network_manager_, &ton::adnl::AdnlNetworkManager::add_self_addr, addr, mask, 0); - auto pk = ton::privkeys::Ed25519::random(); - td::actor::send_closure(keyring_, &ton::keyring::Keyring::add_key, pk, true, [](td::Result) {}); - ton::adnl::AdnlNodeIdFull local_id_full(pk.pub()); - ton::adnl::AdnlAddressList addr_list; + td::actor::send_closure(network_manager_, &ion::adnl::AdnlNetworkManager::add_self_addr, addr, mask, 0); + auto pk = ion::privkeys::Ed25519::random(); + td::actor::send_closure(keyring_, &ion::keyring::Keyring::add_key, pk, true, [](td::Result) {}); + ion::adnl::AdnlNodeIdFull local_id_full(pk.pub()); + ion::adnl::AdnlAddressList addr_list; addr_list.set_version(static_cast(td::Clocks::system())); - addr_list.set_reinit_date(ton::adnl::Adnl::adnl_start_time()); - td::actor::send_closure(adnl_, &ton::adnl::Adnl::add_id, local_id_full, std::move(addr_list), (td::uint8)0); + addr_list.set_reinit_date(ion::adnl::Adnl::adnl_start_time()); + td::actor::send_closure(adnl_, &ion::adnl::Adnl::add_id, local_id_full, std::move(addr_list), (td::uint8)0); local_id_ = local_id_full.compute_short_id(); auto r_dht = get_dht_config(); @@ -101,27 +101,27 @@ class AdnlNode : public td::actor::Actor { LOG(FATAL) << "Cannot get dht config: " << r_dht.move_as_error(); } auto dht = r_dht.move_as_ok(); - ton::adnl::AdnlNodesList static_nodes; + ion::adnl::AdnlNodesList static_nodes; for (const auto &node : dht->nodes().list()) { LOG(INFO) << "Node #" << nodes_.size() << " : " << node.adnl_id().compute_short_id(); nodes_.emplace_back(node.adnl_id().compute_short_id()); - static_nodes.push(ton::adnl::AdnlNode(node.adnl_id(), node.addr_list())); + static_nodes.push(ion::adnl::AdnlNode(node.adnl_id(), node.addr_list())); } - td::actor::send_closure(adnl_, &ton::adnl::Adnl::add_static_nodes_from_config, std::move(static_nodes)); + td::actor::send_closure(adnl_, &ion::adnl::Adnl::add_static_nodes_from_config, std::move(static_nodes)); - ton::delay_action([SelfId = actor_id(this)]() { td::actor::send_closure(SelfId, &AdnlNode::send_pings); }, + ion::delay_action([SelfId = actor_id(this)]() { td::actor::send_closure(SelfId, &AdnlNode::send_pings); }, td::Timestamp::in(1.0)); } - td::Result> get_dht_config() { + td::Result> get_dht_config() { TRY_RESULT_PREFIX(conf_data, td::read_file(global_config_), "failed to read: "); TRY_RESULT_PREFIX(conf_json, td::json_decode(conf_data.as_slice()), "failed to parse json: "); - ton::ton_api::config_global conf; - TRY_STATUS_PREFIX(ton::ton_api::from_json(conf, conf_json.get_object()), "json does not fit TL scheme: "); + ion::ion_api::config_global conf; + TRY_STATUS_PREFIX(ion::ion_api::from_json(conf, conf_json.get_object()), "json does not fit TL scheme: "); if (!conf.dht_) { - return td::Status::Error(ton::ErrorCode::error, "does not contain [dht] section"); + return td::Status::Error(ion::ErrorCode::error, "does not contain [dht] section"); } - TRY_RESULT_PREFIX(dht, ton::dht::Dht::create_global_config(std::move(conf.dht_)), "bad [dht] section: "); + TRY_RESULT_PREFIX(dht, ion::dht::Dht::create_global_config(std::move(conf.dht_)), "bad [dht] section: "); return std::move(dht); } @@ -133,18 +133,18 @@ class AdnlNode : public td::actor::Actor { LOG(INFO) << "Sending ping to " << id; ++pending_; td::actor::send_closure( - adnl_, &ton::adnl::Adnl::send_query, local_id_, id, "ping", + adnl_, &ion::adnl::Adnl::send_query, local_id_, id, "ping", [SelfId = actor_id(this), i, timer = td::Timer()](td::Result R) { td::actor::send_closure(SelfId, &AdnlNode::on_pong, i, timer.elapsed(), R.is_ok()); }, td::Timestamp::in(5.0), - ton::create_serialize_tl_object(td::Random::fast_uint64())); + ion::create_serialize_tl_object(td::Random::fast_uint64())); } if (pings_remaining_ == 0) { --pending_; try_finish(); } else { - ton::delay_action([SelfId = actor_id(this)]() { td::actor::send_closure(SelfId, &AdnlNode::send_pings); }, + ion::delay_action([SelfId = actor_id(this)]() { td::actor::send_closure(SelfId, &AdnlNode::send_pings); }, td::Timestamp::in(1.0)); } } diff --git a/dht/utils/dht-resolve.cpp b/dht/utils/dht-resolve.cpp index 5ab98d015..f9e831702 100644 --- a/dht/utils/dht-resolve.cpp +++ b/dht/utils/dht-resolve.cpp @@ -1,18 +1,18 @@ /* - This file is part of TON Blockchain source code. + This file is part of ION Blockchain source code. - TON Blockchain is free software; you can redistribute it and/or + ION Blockchain is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - TON Blockchain is distributed in the hope that it will be useful, + ION Blockchain is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with TON Blockchain. If not, see . + along with ION Blockchain. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. @@ -34,7 +34,7 @@ #include "td/utils/OptionParser.h" #include "td/utils/filesystem.h" #include "dht/dht.hpp" -#include "auto/tl/ton_api_json.h" +#include "auto/tl/ion_api_json.h" #include "common/delay.h" #include "td/utils/Random.h" #include "terminal/terminal.h" @@ -44,50 +44,50 @@ class Resolver : public td::actor::Actor { private: - td::actor::ActorOwn network_manager_; - td::actor::ActorOwn adnl_; - td::actor::ActorOwn keyring_; - ton::adnl::AdnlNodeIdShort local_id_; - td::actor::ActorOwn dht_; + td::actor::ActorOwn network_manager_; + td::actor::ActorOwn adnl_; + td::actor::ActorOwn keyring_; + ion::adnl::AdnlNodeIdShort local_id_; + td::actor::ActorOwn dht_; std::string global_config_; int server_idx_; std::string host_ = "127.0.0.1"; td::uint16 port_; - ton::dht::DhtKey key_; + ion::dht::DhtKey key_; double timeout_; public: - Resolver(std::string global_config, int server_idx, td::uint16 port, ton::dht::DhtKey key, double timeout) + Resolver(std::string global_config, int server_idx, td::uint16 port, ion::dht::DhtKey key, double timeout) : global_config_(global_config), server_idx_(server_idx), port_(port), key_(std::move(key)), timeout_(timeout) { } void run() { - network_manager_ = ton::adnl::AdnlNetworkManager::create(port_); - keyring_ = ton::keyring::Keyring::create(""); - adnl_ = ton::adnl::Adnl::create("", keyring_.get()); - td::actor::send_closure(adnl_, &ton::adnl::Adnl::register_network_manager, network_manager_.get()); + network_manager_ = ion::adnl::AdnlNetworkManager::create(port_); + keyring_ = ion::keyring::Keyring::create(""); + adnl_ = ion::adnl::Adnl::create("", keyring_.get()); + td::actor::send_closure(adnl_, &ion::adnl::Adnl::register_network_manager, network_manager_.get()); td::IPAddress addr; addr.init_host_port(host_, port_).ensure(); - ton::adnl::AdnlCategoryMask mask; + ion::adnl::AdnlCategoryMask mask; mask[0] = true; - td::actor::send_closure(network_manager_, &ton::adnl::AdnlNetworkManager::add_self_addr, addr, mask, 0); - auto pk = ton::privkeys::Ed25519::random(); - td::actor::send_closure(keyring_, &ton::keyring::Keyring::add_key, pk, true, [](td::Result) {}); - ton::adnl::AdnlNodeIdFull local_id_full(pk.pub()); - ton::adnl::AdnlAddressList addr_list; + td::actor::send_closure(network_manager_, &ion::adnl::AdnlNetworkManager::add_self_addr, addr, mask, 0); + auto pk = ion::privkeys::Ed25519::random(); + td::actor::send_closure(keyring_, &ion::keyring::Keyring::add_key, pk, true, [](td::Result) {}); + ion::adnl::AdnlNodeIdFull local_id_full(pk.pub()); + ion::adnl::AdnlAddressList addr_list; addr_list.set_version(static_cast(td::Clocks::system())); - addr_list.set_reinit_date(ton::adnl::Adnl::adnl_start_time()); - td::actor::send_closure(adnl_, &ton::adnl::Adnl::add_id, local_id_full, std::move(addr_list), (td::uint8)0); + addr_list.set_reinit_date(ion::adnl::Adnl::adnl_start_time()); + td::actor::send_closure(adnl_, &ion::adnl::Adnl::add_id, local_id_full, std::move(addr_list), (td::uint8)0); local_id_ = local_id_full.compute_short_id(); auto dht_config = get_dht_config(); if (dht_config.is_error()) { LOG(FATAL) << "Failed to load dht config: " << dht_config.move_as_error(); } - auto D = ton::dht::Dht::create_client(local_id_, "", dht_config.move_as_ok(), keyring_.get(), adnl_.get()); + auto D = ion::dht::Dht::create_client(local_id_, "", dht_config.move_as_ok(), keyring_.get(), adnl_.get()); if (D.is_error()) { LOG(FATAL) << "Failed to init dht client: " << D.move_as_error(); } @@ -99,22 +99,22 @@ class Resolver : public td::actor::Actor { } void send_query() { - td::actor::send_closure(dht_, &ton::dht::Dht::get_value, key_, - [SelfId = actor_id(this)](td::Result R) { + td::actor::send_closure(dht_, &ion::dht::Dht::get_value, key_, + [SelfId = actor_id(this)](td::Result R) { td::actor::send_closure(SelfId, &Resolver::got_result, std::move(R)); }); } - void got_result(td::Result R) { + void got_result(td::Result R) { if (R.is_error()) { LOG(WARNING) << "Failed to get value, retrying: " << R.move_as_error(); - ton::delay_action([SelfId = actor_id(this)]() { td::actor::send_closure(SelfId, &Resolver::send_query); }, + ion::delay_action([SelfId = actor_id(this)]() { td::actor::send_closure(SelfId, &Resolver::send_query); }, td::Timestamp::in(0.25)); return; } auto r = R.move_as_ok(); LOG(INFO) << "Got result"; - td::TerminalIO::out() << "KEY: " << td::base64_encode(ton::serialize_tl_object(r.key().public_key().tl(), true)) + td::TerminalIO::out() << "KEY: " << td::base64_encode(ion::serialize_tl_object(r.key().public_key().tl(), true)) << "\n"; td::TerminalIO::out() << "VALUE: " << td::base64_encode(r.value().as_slice()) << "\n"; std::exit(0); @@ -124,16 +124,16 @@ class Resolver : public td::actor::Actor { LOG(FATAL) << "Failed to get value: timeout"; } - td::Result> get_dht_config() { + td::Result> get_dht_config() { TRY_RESULT_PREFIX(conf_data, td::read_file(global_config_), "failed to read: "); TRY_RESULT_PREFIX(conf_json, td::json_decode(conf_data.as_slice()), "failed to parse json: "); - ton::ton_api::config_global conf; - TRY_STATUS_PREFIX(ton::ton_api::from_json(conf, conf_json.get_object()), "json does not fit TL scheme: "); + ion::ion_api::config_global conf; + TRY_STATUS_PREFIX(ion::ion_api::from_json(conf, conf_json.get_object()), "json does not fit TL scheme: "); if (!conf.dht_) { - return td::Status::Error(ton::ErrorCode::error, "does not contain [dht] section"); + return td::Status::Error(ion::ErrorCode::error, "does not contain [dht] section"); } - ton::ton_api::dht_nodes* static_nodes = nullptr; - ton::ton_api::downcast_call(*conf.dht_, [&](auto &f) { static_nodes = f.static_nodes_.get(); }); + ion::ion_api::dht_nodes* static_nodes = nullptr; + ion::ion_api::downcast_call(*conf.dht_, [&](auto &f) { static_nodes = f.static_nodes_.get(); }); auto &nodes = static_nodes->nodes_; if (server_idx_ >= 0) { CHECK(server_idx_ < (int)nodes.size()); @@ -143,7 +143,7 @@ class Resolver : public td::actor::Actor { } else { LOG(INFO) << "Using all " << nodes.size() << " servers"; } - TRY_RESULT_PREFIX(dht, ton::dht::Dht::create_global_config(std::move(conf.dht_)), "bad [dht] section: "); + TRY_RESULT_PREFIX(dht, ion::dht::Dht::create_global_config(std::move(conf.dht_)), "bad [dht] section: "); return std::move(dht); } }; @@ -209,7 +209,7 @@ int main(int argc, char *argv[]) { LOG_IF(FATAL, !key_name) << "key-name is not set"; x = td::actor::create_actor( "Resolver", global_config.value(), server_idx, port, - ton::dht::DhtKey{ton::PublicKeyHash(key_id.value()), key_name.value(), key_idx}, timeout); + ion::dht::DhtKey{ion::PublicKeyHash(key_id.value()), key_name.value(), key_idx}, timeout); }); scheduler.run_in_context([&] { td::actor::send_closure(x, &Resolver::run); }); diff --git a/doc/ConfigParam-HOWTO b/doc/ConfigParam-HOWTO index 639014bb3..f62508fb1 100644 --- a/doc/ConfigParam-HOWTO +++ b/doc/ConfigParam-HOWTO @@ -1,9 +1,9 @@ -The aim of this document is to provide basic explanation of configuration parameters of TON Blockchain, and to give step-by-step instructions for changing these parameters by a consensus of a majority of validators. We assume that the reader is already familiar with Fift and the Lite Client as explained in LiteClient-HOWTO, and with FullNode-HOWTO and Validator-HOWTO in the sections where validators' voting for the configuration proposals is described. +The aim of this document is to provide basic explanation of configuration parameters of ION Blockchain, and to give step-by-step instructions for changing these parameters by a consensus of a majority of validators. We assume that the reader is already familiar with Fift and the Lite Client as explained in LiteClient-HOWTO, and with FullNode-HOWTO and Validator-HOWTO in the sections where validators' voting for the configuration proposals is described. 1. Configuration parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The *configuration parameters* are certain values that affect the behavior of validators and/or fundamental smart contracts of TON Blockchain. The current values of all configuration parameters are stored as a special part of the masterchain state, and are extracted from the current masterchain state when needed. Therefore, it makes sense to speak of the values of the configuration parameters with respect to a certain masterchain block. Each shardchain block contains a reference to the latest known masterchain block; the values from the corresponding masterchain state are assumed to be active for this shardchain block, and are used during its generation and validation. For masterchain blocks, the state of the previous masterchain block is used to extract the active configuration parameters. Therefore, even if one tries to change some configuration parameters inside a masterchain block, the changes will become active only for the next masterchain block. +The *configuration parameters* are certain values that affect the behavior of validators and/or fundamental smart contracts of ION Blockchain. The current values of all configuration parameters are stored as a special part of the masterchain state, and are extracted from the current masterchain state when needed. Therefore, it makes sense to speak of the values of the configuration parameters with respect to a certain masterchain block. Each shardchain block contains a reference to the latest known masterchain block; the values from the corresponding masterchain state are assumed to be active for this shardchain block, and are used during its generation and validation. For masterchain blocks, the state of the previous masterchain block is used to extract the active configuration parameters. Therefore, even if one tries to change some configuration parameters inside a masterchain block, the changes will become active only for the next masterchain block. Each configuration parameter is identified by a signed 32-bit integer index, called *configuration parameter index* or simply *index*. The value of a configuration parameter always is a Cell. Some configuration parameters may be missing; then it is sometimes assumed that the value of this parameter is Null. There also is a list of *mandatory* configuration parameters that must be always present; this list is stored in configuration parameter #10. @@ -21,12 +21,12 @@ Therefore, the structure of such parameters is determined in source file `crypto _ config_addr:bits256 = ConfigParam 0; _ elector_addr:bits256 = ConfigParam 1; - _ dns_root_addr:bits256 = ConfigParam 4; // root TON DNS resolver + _ dns_root_addr:bits256 = ConfigParam 4; // root ION DNS resolver capabilities#c4 version:uint32 capabilities:uint64 = GlobalVersion; _ GlobalVersion = ConfigParam 8; // all zero if absent -We see that configuration parameter #8 contains a Cell with no references and exactly 104 data bits. The first four bits must be 11000100, then 32 bits with the currently enabled "global version" are stored, and 64-bit integer with flags corresponding to currently enabled capabilities follow. A more detailed description of all configuration parameters will be provided in an appendix to the TON Blockchain documentation; for now, one can inspect the TL-B scheme in `crypto/block/block.tlb` and check how different parameters are used in the validator sources. +We see that configuration parameter #8 contains a Cell with no references and exactly 104 data bits. The first four bits must be 11000100, then 32 bits with the currently enabled "global version" are stored, and 64-bit integer with flags corresponding to currently enabled capabilities follow. A more detailed description of all configuration parameters will be provided in an appendix to the ION Blockchain documentation; for now, one can inspect the TL-B scheme in `crypto/block/block.tlb` and check how different parameters are used in the validator sources. In contrast with configuration parameters with non-negative indices, configuration parameters with negative indices can contain arbitrary values. At least, no restrictions on their values are enforced by the validators. Therefore, they can be used to store important information (such as the Unixtime when certain smart contracts must start operating) that is not crucial for the block generation, but is used by some of the fundamental smart contracts. @@ -40,7 +40,7 @@ In fact, there is a special smart contract residing in the masterchain, called t In this way, all changes in configuration parameters are performed by the configuration smart contract, and it is its code that determines the rules for changing configuration parameters. Currently, the configuration smart contract supports two modes for changing configuration parameters: 1) By means of an external message signed by a specific private key, corresponding to a public key stored in the data of the configuration smart contract. This is the method employed in the public testnet and probably in the smaller private test networks, controlled by one entity, because it enables the operator to easily change the values of any configuration parameters. Note that this public key may be changed by a special external message signed by an old key, and that if it is changed to zero, then this mechanism is disabled. Therefore, one might use it for fine-tuning immediately after the launch, and then disable for good. -2) By means of creating "configuration proposals" that are subsequently voted for or against by validators. Typically, a configuration proposal has to collect votes from more than 3/4 of all validators (by weight), and not only in one round, but in several rounds (i.e., several consecutive sets of validators have to confirm the proposed parameter change). This is the distributed governance mechanism to be used by TON Blockchain mainnet. +2) By means of creating "configuration proposals" that are subsequently voted for or against by validators. Typically, a configuration proposal has to collect votes from more than 3/4 of all validators (by weight), and not only in one round, but in several rounds (i.e., several consecutive sets of validators have to confirm the proposed parameter change). This is the distributed governance mechanism to be used by ION Blockchain mainnet. We would like to describe the second way of changing configuration parameters in more detail. @@ -65,7 +65,7 @@ In order to create a new configuration proposal, one first has to generate a BoC As a result, 21-byte file `config-param-239.boc` will be created, containing the serialization of the required value. -For more sophisticated cases, and especially for configuration parameters with non-negative indices this straightforward approach is not easily applicable. We recommend using `create-state` (available as `crypto/create-state` in the build directory) instead of `fift`, and copying and editing suitable portions from source files `crypto/smartcont/gen-zerostate.fif` and `crypto/smartcont/CreateState.fif`, which are usually employed to create the zero state (corresponding to the "genesis block" of other blockchain architectures) of the TON Blockchain. +For more sophisticated cases, and especially for configuration parameters with non-negative indices this straightforward approach is not easily applicable. We recommend using `create-state` (available as `crypto/create-state` in the build directory) instead of `fift`, and copying and editing suitable portions from source files `crypto/smartcont/gen-zerostate.fif` and `crypto/smartcont/CreateState.fif`, which are usually employed to create the zero state (corresponding to the "genesis block" of other blockchain architectures) of the ION Blockchain. Consider, for instance, configuration parameter #8, which contains the currently-enabled global blockchain version and capabilities: diff --git a/doc/DNS-HOWTO b/doc/DNS-HOWTO index 3f4fb4b3f..1ab820d3a 100644 --- a/doc/DNS-HOWTO +++ b/doc/DNS-HOWTO @@ -1,66 +1,66 @@ -The aim of this document is to provide a very brief introduction to TON DNS, a service for translating human-readable domain names (such as `test.ton` or `mysite.temp.ton`) into TON smart contract addresses, ADNL addresses employed by services running in the TON Network (such as TON Sites), and so on. +The aim of this document is to provide a very brief introduction to ION DNS, a service for translating human-readable domain names (such as `test.ion` or `mysite.temp.ion`) into ION smart contract addresses, ADNL addresses employed by services running in the ION Network (such as ION Sites), and so on. 1. Domain names ~~~~~~~~~~~~~~~ -TON DNS employs familiarly-looking domain names, consisting of a UTF-8 encoded string up to 126 bytes, with different sections of the domain name separated by dots (`.`). Null characters (i.e. zero bytes) and, more generally, bytes in range 0..32 are not allowed in domain names. For instance, `test.ton` and `mysite.temp.ton` are valid TON DNS domains. A major difference from usual domain names is that TON DNS domains are case-sensitive; one could convert all domains to lowercase before performing a TON DNS lookup in order to obtain case-insensitivity if desired. +ION DNS employs familiarly-looking domain names, consisting of a UTF-8 encoded string up to 126 bytes, with different sections of the domain name separated by dots (`.`). Null characters (i.e. zero bytes) and, more generally, bytes in range 0..32 are not allowed in domain names. For instance, `test.ion` and `mysite.temp.ion` are valid ION DNS domains. A major difference from usual domain names is that ION DNS domains are case-sensitive; one could convert all domains to lowercase before performing a ION DNS lookup in order to obtain case-insensitivity if desired. -Currently, only domains ending in `.ton` are recognized as valid TON DNS domains. This could change in the future. Notice, however, that it is a bad idea to define first-level domains coinciding with first-level domains already existing in the Internet, such as `.com` or `.to`, because one could then register a TON domain `google.com`, deploy a TON site there, create a hidden link to a page at this TON site from his other innocently-looking TON site, and steal `google.com` cookies from unsuspecting visitors. +Currently, only domains ending in `.ion` are recognized as valid ION DNS domains. This could change in the future. Notice, however, that it is a bad idea to define first-level domains coinciding with first-level domains already existing in the Internet, such as `.com` or `.to`, because one could then register a ION domain `google.com`, deploy a ION site there, create a hidden link to a page at this ION site from his other innocently-looking ION site, and steal `google.com` cookies from unsuspecting visitors. -Internally, TON DNS transforms domain names as follows. First, a domain name is split into its components delimited by dot characters `.`. Then null characters are appended to each component, and all components are concatenated in reverse order. For example, `google.com` becomes `com\0google\0`. +Internally, ION DNS transforms domain names as follows. First, a domain name is split into its components delimited by dot characters `.`. Then null characters are appended to each component, and all components are concatenated in reverse order. For example, `google.com` becomes `com\0google\0`. -2. Resolving TON DNS domains +2. Resolving ION DNS domains ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -A TON DNS domain is resolved as follows. First, the *root DNS smart contract* is located by inspecting the value of configuration parameter #4 in a recent masterchain state. This parameter contains the 256-bit address of the root DNS smart contract inside the masterchain. +A ION DNS domain is resolved as follows. First, the *root DNS smart contract* is located by inspecting the value of configuration parameter #4 in a recent masterchain state. This parameter contains the 256-bit address of the root DNS smart contract inside the masterchain. Then a special get-method `dnsresolve` (method id 123660) is invoked for the root DNS smart contract, with two parameters. The first parameter is a CellSlice with *8n* data bits containing the internal representation of the domain being resolved, where *n* is the length of the internal representation in bytes (at most 127). The second parameter is a signed 16-bit Integer containing the required *category*. If the category is zero, then all categories are requested. -If this get-method fails, then the TON DNS lookup is unsuccessful. Otherwise the get-method returns two values. The first is *8m*, the length (in bits) of the prefix of the internal representation of the domain that has been resolved, 0 < m <= n. The second is a Cell with the TON DNS record for the required domain in the required category, or the root a Dictionary with 16-bit signed integer keys (categories) and values equal to the serializations of corresponding TON DNS records. If the domain cannot be resolved by the root DNS smart contract, i.e. if no non-empty prefix is a valid domain known to the smart contract, then (0, null) is returned. In other words, m = 0 means that the TON DNS lookup has found no data for the required domain. In that case, the TON DNS lookup is also unsuccessful. +If this get-method fails, then the ION DNS lookup is unsuccessful. Otherwise the get-method returns two values. The first is *8m*, the length (in bits) of the prefix of the internal representation of the domain that has been resolved, 0 < m <= n. The second is a Cell with the ION DNS record for the required domain in the required category, or the root a Dictionary with 16-bit signed integer keys (categories) and values equal to the serializations of corresponding ION DNS records. If the domain cannot be resolved by the root DNS smart contract, i.e. if no non-empty prefix is a valid domain known to the smart contract, then (0, null) is returned. In other words, m = 0 means that the ION DNS lookup has found no data for the required domain. In that case, the ION DNS lookup is also unsuccessful. -If m = n, then the second component of the result is either a Cell with a valid TON DNS record for the required domain and category, or a Null if there is no TON DNS record for this domain with this category. In either case, the resolution process stops, and the TON DNS record thus obtained is deserialized and the required information (such as the type of the record and its parameters, such as a smart contract address or a ADNL address). +If m = n, then the second component of the result is either a Cell with a valid ION DNS record for the required domain and category, or a Null if there is no ION DNS record for this domain with this category. In either case, the resolution process stops, and the ION DNS record thus obtained is deserialized and the required information (such as the type of the record and its parameters, such as a smart contract address or a ADNL address). -Finally, if m < n, then the lookup is successful so far, but only a partial result is available for the m-byte prefix of the original internal representation of the domain. The longest of all such prefixes known to the DNS smart contract is returned. For instance, an attempt to look up `mysite.test.ton` (i.e. `ton\0test\0mysite\0` in the internal representation) in the root DNS smart contract might return 8m=72, corresponding to prefix `ton\0test\0`, i.e. to subdomain "test.ton" in the usual domain representation. In that case, dnsresolve() returns the value for category -1 for this prefix regardless of the category originally requested by the client. By convention, category -1 usually contains a TON DNS Record of type *dns_next_resolver*, containing the address of next resolver smart contract (which can reside in any other workchain, such as the basechain). If that is indeed the case, the resolution process continues by running get-method `dnsresolve` for the next resolver, with the internal representation of the domain name containing only its part unresolved so far (if we were looking up `ton\0test\0mysite\0`, and prefix `ton\0test\0` was found by the root DNS smart contract, then the next `dnsresolve` will be invoked with `mysite\0` as its first argument). Then either the next resolver smart contract reports an error or the absence of any records for the required domain or any of its prefixes, or the final result is obtained, or another prefix and next resolver smart contract is returned. In the latter case, the process continues in the same fashion until all of the original domain is resolved. +Finally, if m < n, then the lookup is successful so far, but only a partial result is available for the m-byte prefix of the original internal representation of the domain. The longest of all such prefixes known to the DNS smart contract is returned. For instance, an attempt to look up `mysite.test.ion` (i.e. `ion\0test\0mysite\0` in the internal representation) in the root DNS smart contract might return 8m=72, corresponding to prefix `ion\0test\0`, i.e. to subdomain "test.ion" in the usual domain representation. In that case, dnsresolve() returns the value for category -1 for this prefix regardless of the category originally requested by the client. By convention, category -1 usually contains a ION DNS Record of type *dns_next_resolver*, containing the address of next resolver smart contract (which can reside in any other workchain, such as the basechain). If that is indeed the case, the resolution process continues by running get-method `dnsresolve` for the next resolver, with the internal representation of the domain name containing only its part unresolved so far (if we were looking up `ion\0test\0mysite\0`, and prefix `ion\0test\0` was found by the root DNS smart contract, then the next `dnsresolve` will be invoked with `mysite\0` as its first argument). Then either the next resolver smart contract reports an error or the absence of any records for the required domain or any of its prefixes, or the final result is obtained, or another prefix and next resolver smart contract is returned. In the latter case, the process continues in the same fashion until all of the original domain is resolved. -3. Using LiteClient and TonLib to resolve TON DNS domains +3. Using LiteClient and TonLib to resolve ION DNS domains ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The above process can be invoked automatically using the TON LiteClient or TONLib. For instance, one can invoke the command `dnsresolve test.ton 1` in the LiteClient to resolve "test.ton" with category 1 and obtain the following result: +The above process can be invoked automatically using the ION LiteClient or IONLib. For instance, one can invoke the command `dnsresolve test.ion 1` in the LiteClient to resolve "test.ion" with category 1 and obtain the following result: ================================================ -> dnsresolve test.ton +> dnsresolve test.ion ... -Result for domain 'test.ton' category 1 +Result for domain 'test.ion' category 1 raw data: x{AD011B3CBBE404F47FFEF92D0D7894C5C6F215F677732A49E544F16D1E75643D46AB00} category #1 : (dns_adnl_address adnl_addr:x1B3CBBE404F47FFEF92D0D7894C5C6F215F677732A49E544F16D1E75643D46AB flags:0) adnl address 1B3CBBE404F47FFEF92D0D7894C5C6F215F677732A49E544F16D1E75643D46AB = UNTZO7EAT2H77XZFUGXRFGFY3ZBL5TXOMVETZKE6FWR45LEHVDKXAUY ================================================ -In this case, the TON DNS record for "test.ton" is a `dns_adnl_address` record containing ADNL address UNTZO7EAT2H77XZFUGXRFGFY3ZBL5TXOMVETZKE6FWR45LEHVDKXAUY +In this case, the ION DNS record for "test.ion" is a `dns_adnl_address` record containing ADNL address UNTZO7EAT2H77XZFUGXRFGFY3ZBL5TXOMVETZKE6FWR45LEHVDKXAUY Alternatively, one can invoke `tonlib-cli` and enter the following command: ================================================ -> dns resolve root test.ton 1 +> dns resolve root test.ion 1 Redirect resolver ... Done - test.ton 1 ADNL:untzo7eat2h77xzfugxrfgfy3zbl5txomvetzke6fwr45lehvdkxauy + test.ion 1 ADNL:untzo7eat2h77xzfugxrfgfy3zbl5txomvetzke6fwr45lehvdkxauy ================================================ This is a more compact representation of the same result. -Finally, if one uses RLDP-HTTP Proxy in the client mode to access TON Sites from a browser as explained in `TONSites-HOWTO.txt`, the TONLib resolver is automatically invoked to resolve all domains entered by the end user, so that a HTTP query to `http://test.ton/testnet/last` is automatically forwarded to ADNL address `untzo7eat2h77xzfugxrfgfy3zbl5txomvetzke6fwr45lehvdkxauy` via RLDP. +Finally, if one uses RLDP-HTTP Proxy in the client mode to access ION Sites from a browser as explained in `IONSites-HOWTO.txt`, the IONLib resolver is automatically invoked to resolve all domains entered by the end user, so that a HTTP query to `http://test.ion/testnet/last` is automatically forwarded to ADNL address `untzo7eat2h77xzfugxrfgfy3zbl5txomvetzke6fwr45lehvdkxauy` via RLDP. 4. Registering new domains ~~~~~~~~~~~~~~~~~~~~~~~~~~ -Suppose that you have a new TON Site with a newly-generated ADNL address, such as `vcqmha5j3ceve35ammfrhqty46rkhi455otydstv66pk2tmf7rl25f3`. Of course, the end user might type `http://vcqmha5j3ceve35ammfrhqty46rkhi455otydstv66pk2tmf7rl25f3.adnl/` to visit your TON Site from a browser using a RLDP-HTTP Proxy in client mode, but this is not very convenient. Instead, you could register a new domain, say, `mysite.temp.ton` with a `dns_adnl_address` record in category 1 containing the ADNL address vcq...25f3 of your TON Site. Then the user would access your TON Site by simply typing `mysite.temp.ton` in a browser. +Suppose that you have a new ION Site with a newly-generated ADNL address, such as `vcqmha5j3ceve35ammfrhqty46rkhi455otydstv66pk2tmf7rl25f3`. Of course, the end user might type `http://vcqmha5j3ceve35ammfrhqty46rkhi455otydstv66pk2tmf7rl25f3.adnl/` to visit your ION Site from a browser using a RLDP-HTTP Proxy in client mode, but this is not very convenient. Instead, you could register a new domain, say, `mysite.temp.ion` with a `dns_adnl_address` record in category 1 containing the ADNL address vcq...25f3 of your ION Site. Then the user would access your ION Site by simply typing `mysite.temp.ion` in a browser. -In general, you would need to contact the owner of the higher-level domain and ask him to add a record for your subdomain in his DNS resolver smart contract. However, the TestNet of the TON Blockchain has a special resolver smart contract for `temp.ton` that allows anyone to automatically register any subdomains of `temp.ton` not registered yet, provided a small fee (in test Grams) is paid to that smart contract. In our case, we first need to find out the address of this smart contract, for example by using the Lite Client: +In general, you would need to contact the owner of the higher-level domain and ask him to add a record for your subdomain in his DNS resolver smart contract. However, the TestNet of the ION Blockchain has a special resolver smart contract for `temp.ion` that allows anyone to automatically register any subdomains of `temp.ion` not registered yet, provided a small fee (in test Grams) is paid to that smart contract. In our case, we first need to find out the address of this smart contract, for example by using the Lite Client: ================================================ -> dnsresolve temp.ton -1 +> dnsresolve temp.ion -1 ... category #-1 : (dns_next_resolver resolver:(addr_std @@ -163,9 +163,9 @@ If all works correctly, you'll obtain some change from the automatic DNS smart c ===================================================== > last ... -> dnsresolve mysite.temp.ton 1 +> dnsresolve mysite.temp.ion 1 ... -Result for domain 'mysite.temp.ton' category 1 +Result for domain 'mysite.temp.ion' category 1 category #1 : (dns_adnl_address adnl_addr:x45061C1D4EC44A937D0318589E13C73D151D1CEF5D3C0E53AFBCF56A6C2FE2BD flags:0) adnl address 45061C1D4EC44A937D0318589E13C73D151D1CEF5D3C0E53AFBCF56A6C2FE2BD = vcqmha5j3ceve35ammfrhqty46rkhi455otydstv66pk2tmf7rl25f3 ===================================================== diff --git a/doc/FullNode-HOWTO b/doc/FullNode-HOWTO index 480dc9359..368824958 100644 --- a/doc/FullNode-HOWTO +++ b/doc/FullNode-HOWTO @@ -1,66 +1,66 @@ -The most convenient way to compile and run a node is provided by MyTonCtrl: https://github.com/ton-blockchain/mytonctrl/. More info is available on https://ton.org/docs/#/nodes/run-node. +The most convenient way to compile and run a node is provided by MyTonCtrl: https://github.com/ice-blockchain/myionctrl/. More info is available on https://ion.org/docs/#/nodes/run-node. -The aim of this document is to provide step-by-step instructions for setting up a full node for the TON Blockchain. We assume some familiarity with the TON Blockchain Lite Client, at least to the extent explained in the Lite Client HOWTO. +The aim of this document is to provide step-by-step instructions for setting up a full node for the ION Blockchain. We assume some familiarity with the ION Blockchain Lite Client, at least to the extent explained in the Lite Client HOWTO. -Note that you need a machine with a public IP address and a high-bandwidth network connection to run a TON Blockchain Full Node. Typically you'll need a sufficiently powerful server in a datacenter with good network connectivity, using at least a 1 Gbit/s connection to reliably accommodate peak loads (the average load is expected to be approximately 100 Mbit/s). We recommend a dual-processor server with at least eight cores in each processor, at least 256 MiB RAM, at least 8 TB of conventional HDD storage and at least 512 GB of faster SSD storage. It is a bad idea to run a Full Node on your home computer; instead, you could run a Full Node on a remote server, and use the TON Blockchain Lite Client to connect to it from home. +Note that you need a machine with a public IP address and a high-bandwidth network connection to run a ION Blockchain Full Node. Typically you'll need a sufficiently powerful server in a datacenter with good network connectivity, using at least a 1 Gbit/s connection to reliably accommodate peak loads (the average load is expected to be approximately 100 Mbit/s). We recommend a dual-processor server with at least eight cores in each processor, at least 256 MiB RAM, at least 8 TB of conventional HDD storage and at least 512 GB of faster SSD storage. It is a bad idea to run a Full Node on your home computer; instead, you could run a Full Node on a remote server, and use the ION Blockchain Lite Client to connect to it from home. 0. Downloading and compiling ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The complete TON Blockchain Library and Validator software is downloaded and compiled similarly to the Lite Client. This process is outlined in the corresponding README file. The most important difference is that you have to download the complete sources from public GitHub repository https://github.com/ton-blockchain/ton (e.g., by running `git clone https://github.com/ton-blockchain/ton` and `git submodule update` afterwards) instead of downloading the smaller Lite Client source archive. You should also build all goals defined in CMakeLists.txt (e.g. by running `cmake ` and `make` in your build directory), not only those specifically related to the Lite Client (which is also included in the larger distribution; you don't have to download and build it separately). We strongly recommend building a "release" or a "release with debug information" version of the TON Blockchain Library and especially of the Validator/Full Node by passing `-DCMAKE_BUILD_TYPE=Release` or `-DCMAKE_BUILD_TYPE=RelWithDebInfo` as an extra argument to `cmake` during its first run (if you forgot to do this, you can later delete file `CMakeCache.txt` from your build directory and re-run `cmake` with the appropriate options). +The complete ION Blockchain Library and Validator software is downloaded and compiled similarly to the Lite Client. This process is outlined in the corresponding README file. The most important difference is that you have to download the complete sources from public GitHub repository https://github.com/ice-blockchain/ion (e.g., by running `git clone https://github.com/ice-blockchain/ion` and `git submodule update` afterwards) instead of downloading the smaller Lite Client source archive. You should also build all goals defined in CMakeLists.txt (e.g. by running `cmake ` and `make` in your build directory), not only those specifically related to the Lite Client (which is also included in the larger distribution; you don't have to download and build it separately). We strongly recommend building a "release" or a "release with debug information" version of the ION Blockchain Library and especially of the Validator/Full Node by passing `-DCMAKE_BUILD_TYPE=Release` or `-DCMAKE_BUILD_TYPE=RelWithDebInfo` as an extra argument to `cmake` during its first run (if you forgot to do this, you can later delete file `CMakeCache.txt` from your build directory and re-run `cmake` with the appropriate options). 1. Full Node binaries ~~~~~~~~~~~~~~~~~~~~~ -After the sources have been compiled successfully, you should obtain executable files `validator-engine/validator-engine` and `validator-engine-console/validator-engine-console` in your build directory. These are the most important files you need to run a TON Blockchain Full Node (or even a Validator), and to control it. You might wish to install them into your /usr/bin or similar directory. You are also likely to need the `generate-random-id` utility during setup. +After the sources have been compiled successfully, you should obtain executable files `validator-engine/validator-engine` and `validator-engine-console/validator-engine-console` in your build directory. These are the most important files you need to run a ION Blockchain Full Node (or even a Validator), and to control it. You might wish to install them into your /usr/bin or similar directory. You are also likely to need the `generate-random-id` utility during setup. 2. Working directory of the Full Node ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The Full Node (also known as "validator-engine") stores its data in subdirectories of its working directory, e.g., `/var/ton-work/db`. It requires write access to this directory. If you want to use another directory as the working directory of the Full Node, you can use the command line option --db : +The Full Node (also known as "validator-engine") stores its data in subdirectories of its working directory, e.g., `/var/ion-work/db`. It requires write access to this directory. If you want to use another directory as the working directory of the Full Node, you can use the command line option --db : $ validator-engine --db ${DB_ROOT} -where ${DB_ROOT} is /var/ton-work/db or any other directory where validator-engine has write permissions. +where ${DB_ROOT} is /var/ion-work/db or any other directory where validator-engine has write permissions. 3. Working directory layout ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -An approximate layout of the working directory of the TON Blockchain Full Node software is as follows: +An approximate layout of the working directory of the ION Blockchain Full Node software is as follows: * ${DB_ROOT}/config.json -- Automatically generated configuration file. It is automatically regenerated by validator-engine on some occasions. When validator-engine is not running, you can edit this file in a text editor because it is a JSON file. -* ${DB_ROOT}/static -- A directory with files that cannot be downloaded from the network, such as the "zerostate" (corresponding to the Genesis block of other blockchain architectures) of the masterchain and active workchains. Normally you don't have to initialize this directory unless you want to run your own instance of the TON Blockchain (for example, for testing or development purposes). Full nodes of existing instances of the TON Blockchain (such as the "testnet" and the "mainnet") will be able to download all required files from already running full nodes. -* ${DB_ROOT}/keyring -- Stores public and private keys known to validator-engine. For example, if your full node runs as a validator for some of the TON Blockchain shardchains, the validator block signing key is kept here. You may wish to set more restrictive permissions for this directory, such as 0700 (in *nix systems), so that only the user under which validator-engine is running would have access to this directory. +* ${DB_ROOT}/static -- A directory with files that cannot be downloaded from the network, such as the "zerostate" (corresponding to the Genesis block of other blockchain architectures) of the masterchain and active workchains. Normally you don't have to initialize this directory unless you want to run your own instance of the ION Blockchain (for example, for testing or development purposes). Full nodes of existing instances of the ION Blockchain (such as the "testnet" and the "mainnet") will be able to download all required files from already running full nodes. +* ${DB_ROOT}/keyring -- Stores public and private keys known to validator-engine. For example, if your full node runs as a validator for some of the ION Blockchain shardchains, the validator block signing key is kept here. You may wish to set more restrictive permissions for this directory, such as 0700 (in *nix systems), so that only the user under which validator-engine is running would have access to this directory. * ${DB_ROOT}/error -- A directory where validator-engine copies files related to severe error conditions (e.g., invalid block candidates) for further study. It is normally empty, and validator-engine never deletes files from this directory. * ${DB_ROOT}/archive -- A directory where old and rarely used blocks are kept until their storage period expires. You can mount a larger but slower disk partition at this directory, or make this directory a symlink to a directory in such a partition. We recommend locating the remainder of ${DB_ROOT} in a fast storage device such as an SSD. * ${DB_ROOT}/etc -- (Non-automatic) configuration files may be kept here, or in any other directory read-accessible to validator-engine. * Other subdirectories of ${DB_ROOT} are used to keep ADNL cache data, recent blocks and states, and so on. They are not relevant to the purposes of this document. -4. Global configuration of the TON Blockchain +4. Global configuration of the ION Blockchain ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -In order to set up your Full Node, you'll need a special JSON file called the "global configuration (file)". It is called this because it is the same for all full nodes, and even nodes participating in different instances of the TON Blockchain (e.g., "testnet" vs. "mainnet") share an almost identical global configuration. +In order to set up your Full Node, you'll need a special JSON file called the "global configuration (file)". It is called this because it is the same for all full nodes, and even nodes participating in different instances of the ION Blockchain (e.g., "testnet" vs. "mainnet") share an almost identical global configuration. -The "mainnet" global configuration can be downloaded at https://ton.org/global-config.json as follows: +The "mainnet" global configuration can be downloaded at https://ion.org/global-config.json as follows: -$ wget https://ton.org/global-config.json +$ wget https://ion.org/global-config.json -You may wish to put this file into /var/ton-work/etc/global-config.json . +You may wish to put this file into /var/ion-work/etc/global-config.json . -We'll discuss the structure of this file later in more detail. For now, let us remark that the bulk of this file consists of a list of known TON DHT nodes required for the bootstrapping of the TON Network. A smaller section near the end of this file describes the particular instance of the TON Blockchain that we wish to connect to. +We'll discuss the structure of this file later in more detail. For now, let us remark that the bulk of this file consists of a list of known ION DHT nodes required for the bootstrapping of the ION Network. A smaller section near the end of this file describes the particular instance of the ION Blockchain that we wish to connect to. -All instances of the TON Blockchain use the same "global" TON Network (i.e., the TON Network is not fragmented into several instances for each blockchain instance). While the global network configuration is therefore independent of the particular TON Blockchain instance chosen, the Full Nodes belonging to different instances will later connect to different overlay subnetworks inside the TON Network. +All instances of the ION Blockchain use the same "global" ION Network (i.e., the ION Network is not fragmented into several instances for each blockchain instance). While the global network configuration is therefore independent of the particular ION Blockchain instance chosen, the Full Nodes belonging to different instances will later connect to different overlay subnetworks inside the ION Network. -It is important to distinguish this "global configuration file", used for setting up a TON Blockchain Full Node, and the "local" or "automatic configuration file", automatically updated by validator-engine and usually stored in ${DB_ROOT}/config.json. The global configuration is used to generate the initial automatic configuration file, which is thereafter updated by validator-engine itself (e.g., by adding new DHT nodes or storing hashes of newer masterchain blocks). +It is important to distinguish this "global configuration file", used for setting up a ION Blockchain Full Node, and the "local" or "automatic configuration file", automatically updated by validator-engine and usually stored in ${DB_ROOT}/config.json. The global configuration is used to generate the initial automatic configuration file, which is thereafter updated by validator-engine itself (e.g., by adding new DHT nodes or storing hashes of newer masterchain blocks). 5. Initializing the local configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Once the global configuration file is downloaded, it can be used to create the initial local configuration in ${DB_ROOT}/config.json. To do this, execute validator-engine once: -$ validator-engine -C /var/ton-work/etc/global-config.json --db /var/ton-work/db/ --ip : -l /var/ton-work/log +$ validator-engine -C /var/ion-work/etc/global-config.json --db /var/ion-work/db/ --ip : -l /var/ion-work/log -Here `/var/ton-work/log` is the log directory of `validator-engine`, where it will create its log files. The argument to the `-C` command-line option is the global configuration file downloaded from ton.org as explained above, and `/var/ton-work/db/` is the working directory ${DB_ROOT}. Finally, : are the global IP address of this full node (you need to indicate a public IPv4 address here) and the UDP port used to run TON Network protocols such as ADNL and RLDP. Make sure that your firewall is configured to pass UDP packets with source or destination : at least for the `validator-engine` binary. +Here `/var/ion-work/log` is the log directory of `validator-engine`, where it will create its log files. The argument to the `-C` command-line option is the global configuration file downloaded from ion.org as explained above, and `/var/ion-work/db/` is the working directory ${DB_ROOT}. Finally, : are the global IP address of this full node (you need to indicate a public IPv4 address here) and the UDP port used to run ION Network protocols such as ADNL and RLDP. Make sure that your firewall is configured to pass UDP packets with source or destination : at least for the `validator-engine` binary. When validator-engine is invoked as above, and ${DB_ROOT}/config.json does not exist, it creates a new local configuration file ${DB_ROOT}/config.json using the information from the global configuration file and from the command-line options such as --ip, and then exits. If ${DB_ROOT}/config.json already exists, it is not rewritten; instead validator-engine starts up as a daemon using both the local and the global configuration. @@ -80,7 +80,7 @@ This utility generates a new keypair and saves the private key into file `server We have to install the private key `server` into the keyring of the Full Node (validator-engine): -$ mv server /var/ton-work/db/keyring/6E9FD109F76E08B5710445C72D2C5FEDE04A96357DAA4EC0DDAEA025ED3AC3F7 +$ mv server /var/ion-work/db/keyring/6E9FD109F76E08B5710445C72D2C5FEDE04A96357DAA4EC0DDAEA025ED3AC3F7 Notice that the file name to store this private key inside the keyring equals the hexadecimal identifier (which essentially is a hash of the public key) of this key. @@ -116,13 +116,13 @@ Replace it with the following: To run the full node, simply run the validator-engine binary in a console: -$ validator-engine --db ${DB_ROOT} -C /var/ton-work/etc/global-config.json -l /var/ton-work/log +$ validator-engine --db ${DB_ROOT} -C /var/ion-work/etc/global-config.json -l /var/ion-work/log -It will read the global configuration from /var/ton-work/etc/global-config.json, the local configuration from ${DB_ROOT}/config.json, and continue running silently. You should write suitable scripts for invoking validator-engine as a daemon (so that it does not terminate when the console is closed), but we'll skip these considerations for simplicity. (The command-line option `-d` of validator-engine should be sufficient for this on most *nix systems.) +It will read the global configuration from /var/ion-work/etc/global-config.json, the local configuration from ${DB_ROOT}/config.json, and continue running silently. You should write suitable scripts for invoking validator-engine as a daemon (so that it does not terminate when the console is closed), but we'll skip these considerations for simplicity. (The command-line option `-d` of validator-engine should be sufficient for this on most *nix systems.) -If the configuration is invalid, validator-engine will terminate immediately and, in most cases, output nothing. You'll have to study the log files under /var/ton-work/log to find out what went wrong. Otherwise, validator-engine will keep working silently. Again, you can understand what's going on by inspecting the log files, and by looking into subdirectories of the ${DB_ROOT} directory. +If the configuration is invalid, validator-engine will terminate immediately and, in most cases, output nothing. You'll have to study the log files under /var/ion-work/log to find out what went wrong. Otherwise, validator-engine will keep working silently. Again, you can understand what's going on by inspecting the log files, and by looking into subdirectories of the ${DB_ROOT} directory. -If everything works as expected, validator-engine will locate other full nodes participating in the same instance of the TON Blockchain, and download recent blocks of the masterchain and all shardchains. (You can actually control the number of recent blocks to be downloaded, or even download them all starting from the zerostate---but this topic is outside the scope of this document; try running validator-engine with command-line option `-h` to find out the list of all available options with brief explanations). +If everything works as expected, validator-engine will locate other full nodes participating in the same instance of the ION Blockchain, and download recent blocks of the masterchain and all shardchains. (You can actually control the number of recent blocks to be downloaded, or even download them all starting from the zerostate---but this topic is outside the scope of this document; try running validator-engine with command-line option `-h` to find out the list of all available options with brief explanations). 8. Using the Console CLI ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -140,7 +140,7 @@ received validator time: time=1566568904 The `gettime` command obtains the current Unix time at the validator. If everything has been configured properly, you'll see an output similar to the one above. Notice that you need both the client's private key ("client") and the server's public key ("server.pub") for the console to work. You might wish to move them (especially the client's private key) into a separate directory with suitable permissions. -Other console commands are available in validator-engine-console. For instance, `help` displays a list of all console commands with short descriptions. In particular, they are used to set up the Full Node as a Validator for the TON Blockchain, as explained in the separate document Validator-HOWTO. +Other console commands are available in validator-engine-console. For instance, `help` displays a list of all console commands with short descriptions. In particular, they are used to set up the Full Node as a Validator for the ION Blockchain, as explained in the separate document Validator-HOWTO. 9. Setting up the Full Node as a Lite Server ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -153,7 +153,7 @@ $ utils/generate-random-id -m keys -n liteserver BDFEA84525ADB3B16D0192488837C04883C10FF1F4031BB6DEECDD17544F5347 vf6oRSWts7FtAZJIiDfASIPBD/H0Axu23uzdF1RPU0c= mv liteserver ${DB_ROOT}/keyring/BDFEA84525ADB3B16D0192488837C04883C10FF1F4031BB6DEECDD17544F5347 -After that, stop validator-engine if it is running and open the local configuration file ${TON_DB}/config.json in a text editor. Find the empty section +After that, stop validator-engine if it is running and open the local configuration file ${ION_DB}/config.json in a text editor. Find the empty section "liteservers" : [ ] diff --git a/doc/GlobalVersions.md b/doc/GlobalVersions.md index 36d1ab360..5c649e77f 100644 --- a/doc/GlobalVersions.md +++ b/doc/GlobalVersions.md @@ -1,5 +1,5 @@ # Global versions -Global version is a parameter specified in `ConfigParam 8` ([block.tlb](https://github.com/ton-blockchain/ton/blob/master/crypto/block/block.tlb#L595)). +Global version is a parameter specified in `ConfigParam 8` ([block.tlb](https://github.com/ice-blockchain/ion/blob/master/crypto/block/block.tlb#L595)). Various features are enabled depending on the global version. ## Version 4 @@ -17,7 +17,7 @@ Various features are enabled depending on the global version. * `P256_CHKSIGNS`, `P256_CHKSIGNU` ### Division -[Division instruction](https://ton.org/docs/learn/tvm-instructions/instructions#52-division) can add a number to the +[Division instruction](https://ion.org/docs/learn/tvm-instructions/instructions#52-division) can add a number to the intermediate value before division (e.g. `(xy+w)/z`). ### Stack operations @@ -48,7 +48,7 @@ Previously only ticktock transactions had this limit, while ordinary transaction * Gas usage of special contracts is not taken into account when checking block limits. This allows keeping masterchain block limits low while having high gas limits for elector. * Gas limit on `EQD_v9j1rlsuHHw2FIhcsCFFSD367ldfDdCKcsNmNpIRzUlu` is increased to `special_gas_limit * 2` until 2024-02-29. -See [this post](https://t.me/tonstatus/88) for details. +See [this post](https://t.me/ionstatus/88) for details. ### Loading libraries * Loading "nested libraries" (i.e. a library cell that points to another library cell) throws an exception. @@ -67,7 +67,7 @@ See [this post](https://t.me/tonstatus/88) for details. * **4**: `ConfigParam 24` (mc fwd fees). * **5**: `ConfigParam 25` (fwd fees). * **6**: `ConfigParam 43` (size limits). -* **15**: "[due payment](https://github.com/ton-blockchain/ton/blob/8a9ff339927b22b72819c5125428b70c406da631/crypto/block/block.tlb#L237)" - current debt for storage fee (nanotons). Asm opcode: `DUEPAYMENT`. +* **15**: "[due payment](https://github.com/ice-blockchain/ion/blob/8a9ff339927b22b72819c5125428b70c406da631/crypto/block/block.tlb#L237)" - current debt for storage fee (nanoions). Asm opcode: `DUEPAYMENT`. * **16**: "precompiled gas usage" - gas usage for the current contract if it is precompiled (see `ConfigParam 45`), `null` otherwise. Asm opcode: `GETPRECOMPILEDGAS`. ### New TVM instructions @@ -101,7 +101,7 @@ Operations for working with Merkle proofs, where cells can have non-zero level a ## Version 7 -[Explicitly nullify](https://github.com/ton-blockchain/ton/pull/957/files) `due_payment` after due reimbursment. +[Explicitly nullify](https://github.com/ice-blockchain/ion/pull/957/files) `due_payment` after due reimbursment. ## Version 8 diff --git a/doc/LiteClient-HOWTO b/doc/LiteClient-HOWTO index 272c4472d..20a9aa0f3 100644 --- a/doc/LiteClient-HOWTO +++ b/doc/LiteClient-HOWTO @@ -1,11 +1,11 @@ -The aim of this document is to provide step-by-step instructions for compiling and creating a simple smart contract (a simple wallet) in the TON Blockchain Test Network using the TON Blockchain Lite Client and associated software. +The aim of this document is to provide step-by-step instructions for compiling and creating a simple smart contract (a simple wallet) in the ION Blockchain Test Network using the ION Blockchain Lite Client and associated software. Download and installation instructions may be found in README. We assume here that the Lite Client is already properly downloaded, compiled and installed. 1. Smart-contract addresses ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Smart-contract addresses in the TON Network consist of two parts: (a) the workchain ID (a signed 32-bit integer) and (b) the address inside the workchain (64-512 bits depending on the workchain). Currently, only the masterchain (workchain_id=-1) and occasionally the basic workchain (workchain_id=0) are running in the TON Blockchain Test Network. Both of them have 256-bit addresses, so we henceforth assume that workchain_id is either 0 or -1 and that the address inside the workchain is exactly 256-bit. +Smart-contract addresses in the ION Network consist of two parts: (a) the workchain ID (a signed 32-bit integer) and (b) the address inside the workchain (64-512 bits depending on the workchain). Currently, only the masterchain (workchain_id=-1) and occasionally the basic workchain (workchain_id=0) are running in the ION Blockchain Test Network. Both of them have 256-bit addresses, so we henceforth assume that workchain_id is either 0 or -1 and that the address inside the workchain is exactly 256-bit. Under the conditions stated above, the smart-contract address can be represented in the following forms: @@ -33,7 +33,7 @@ kf_8uRo6OBbQ97jCx2EIuKm8Wmt6Vb15-KsQHFLbKSMiYIny (base64url) in the "user-friendly" form (to be displayed by user-friendly clients). Notice that both forms (base64 and base64url) are valid and must be accepted. -Incidentally, other binary data related to the TON Blockchain have similar "armored" base64 representations, differing by their first bytes. For example, the ubiquitious 256-bit Ed25519 public keys are represented by first creating a 36-byte sequence as follows: +Incidentally, other binary data related to the ION Blockchain have similar "armored" base64 representations, differing by their first bytes. For example, the ubiquitious 256-bit Ed25519 public keys are represented by first creating a 36-byte sequence as follows: - one tag byte 0x3E, meaning that this is a public key - one tag byte 0xE6, meaning that this is a Ed25519 public key - 32 bytes containing the standard binary representation of the Ed25519 public key @@ -46,7 +46,7 @@ Pubjns2gp7DGCnEH7EOWeCnb6Lw1akm538YYaz6sdLVHfRB2 2. Inspecting the state of a smart contract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Inspecting the state of smart contracts with the aid of the TON Lite Client is easy. For the sample smart contract described above, you would run the Lite Client and enter the following commands: +Inspecting the state of smart contracts with the aid of the ION Lite Client is easy. For the sample smart contract described above, you would run the Lite Client and enter the following commands: > last ... @@ -96,22 +96,22 @@ last transaction lt = 2310000001 hash = 73F89C6F8910F598AD84504A777E5945C798AC8C The first information line "got account state ... for ..." shows the account address and the masterchain block identifier with respect to which the account state has been dumped. Notice that even if the account state changes in a subsequent block, the `getaccount xxx` command will return the same result until the reference block is updated to a newer value by a `last` command. In this way one can study the state of all accounts and obtain consistent results. -The "account state is (account ... " line begins the pretty-printed deserialized view of the account state. It is a deserialization of TL-B data type Account, used to represent account states in the TON Blockchain as explained in the TON Blockchain documentation. (You can find the TL-B scheme used for deserialization in the source file crypto/block/block.tlb; notice that if the scheme is out of date, the deserialization may break down.) +The "account state is (account ... " line begins the pretty-printed deserialized view of the account state. It is a deserialization of TL-B data type Account, used to represent account states in the ION Blockchain as explained in the ION Blockchain documentation. (You can find the TL-B scheme used for deserialization in the source file crypto/block/block.tlb; notice that if the scheme is out of date, the deserialization may break down.) Finally, the last several lines beginning with x{CFF538... (the "raw dump") contain the same information displayed as a tree of cells. In this case, we have one root cell containing the data bits CFF...134_ (the underscore means that the last binary one and all subsequent binary zeroes are to be removed, so hexadecimal "4_" corresponds to binary "0"), and two cells that are its children (displayed with one-space indentation). -We can see that x{FF0020DD20...} is the code of this smart contract. If we consult the Appendix A of the TON Virtual Machine documentation, we can even disassemble this code: FF00 is SETCP 0, 20 is DUP, DD is IFNOTRET, 20 is DUP, and so on. (Incidentally, you can find the source code of this smartcontract in the source file crypto/block/new-testgiver.fif .) +We can see that x{FF0020DD20...} is the code of this smart contract. If we consult the Appendix A of the ION Virtual Machine documentation, we can even disassemble this code: FF00 is SETCP 0, 20 is DUP, DD is IFNOTRET, 20 is DUP, and so on. (Incidentally, you can find the source code of this smartcontract in the source file crypto/block/new-testgiver.fif .) -We can also see that x{00009A15} (the actual value you see may be different) is the persistent data of this smart contract. It is actually an unsigned 32-bit integer, used by the smart contract as the counter of operations performed so far. Notice that this value is big-endian (i.e., 3 is encoded as x{00000003}, not as x{03000000}), as are all integers inside the TON Blockchain. In this case the counter is equal to 0x9A15 = 39445. +We can also see that x{00009A15} (the actual value you see may be different) is the persistent data of this smart contract. It is actually an unsigned 32-bit integer, used by the smart contract as the counter of operations performed so far. Notice that this value is big-endian (i.e., 3 is encoded as x{00000003}, not as x{03000000}), as are all integers inside the ION Blockchain. In this case the counter is equal to 0x9A15 = 39445. The current balance of the smart contract is easily seen in the pretty-printed portion of the output. In this case, we see ... balance:(currencies:(grams:(nanograms:(... value:1000000000000000...)))), which is the balance of the account in (test) nanograms (a million test Grams in this example; the actual number you see may be smaller). If you study the TL-B scheme provided in crypto/block/scheme.tlb, you will be able to find this number (10^15) in binary big-endian form in the raw dump portion as well (it is located near the end of the data bits of the root cell). 3. Compiling a new smart contract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Before uploading a new smart contract into the TON Blockchain, you need to determine its code and data and save them in serialized form into a file (called a "bag-of-cells" or BOC file, usually with a .boc suffix). Let us consider the case of a simple wallet smart contract, which stores a 32-bit operations counter and a 256-bit Ed25519 public key of its owner in its persistent data. +Before uploading a new smart contract into the ION Blockchain, you need to determine its code and data and save them in serialized form into a file (called a "bag-of-cells" or BOC file, usually with a .boc suffix). Let us consider the case of a simple wallet smart contract, which stores a 32-bit operations counter and a 256-bit Ed25519 public key of its owner in its persistent data. -Obviously, you'll need some tools for developing smart contracts - namely, a TON smart contract compiler. Basically, a TON smart contract compiler is a program that reads the source of a smart contract in a specialized high-level programming language and creates a .boc file from this source. +Obviously, you'll need some tools for developing smart contracts - namely, a ION smart contract compiler. Basically, a ION smart contract compiler is a program that reads the source of a smart contract in a specialized high-level programming language and creates a .boc file from this source. One such tool is the Fift interpreter, which is included in this distribution and can help create simple smart contracts. Larger smart contracts should be developed using more sophisticated tools (such as the FunC compiler included in this distribution, that creates Fift assembler files from FunC source files; you can find some FunC smart-contract sources in the directory `crypto/smartcont`). However, Fift is sufficient for demonstration purposes. @@ -223,7 +223,7 @@ In a nutshell, the Fift assembler (loaded by the "Asm.fif" include line) is used The code and data for the new smart contract are combined into a StateInit structure (in the next lines), the address of the new smart contract (equal to the hash of this StateInit structure) is computed and output, and then an external message with a destination address equal to that of the new smart contract is created. This external message contains both the correct StateInit for the new smart contract and a non-trivial payload (signed by the correct private key). -Finally, the external message is serialized into a bag of cells (represented by B5EE...BE63) and saved into the file `my_wallet_name-query.boc`. Essentially, this file is your compiled smart contract with all additional information necessary to upload it into the TON Blockchain. +Finally, the external message is serialized into a bag of cells (represented by B5EE...BE63) and saved into the file `my_wallet_name-query.boc`. Essentially, this file is your compiled smart contract with all additional information necessary to upload it into the ION Blockchain. 4. Transferring some funds to the new smart contract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -476,7 +476,7 @@ x{CFF60C04141C6A7B96D68615E7A91D265AD0F3A9A922E9AE9C901D4FA83F5D3C0D020680F0C2E4 x{00000001F61CF0BC8E891AD7636E0CD35229D579323AA2DA827EB85D8071407464DC2FA3} --------------------------------------------- -You will see that the smart contract has been initialized using code and data from the StateInit of the external message, and its balance has been slightly decreased because of the processing fees. Now it is up and running, and you can activate it by generating new external messages and uploading them to the TON Blockchain using the "sendfile" command of the Lite Client. +You will see that the smart contract has been initialized using code and data from the StateInit of the external message, and its balance has been slightly decreased because of the processing fees. Now it is up and running, and you can activate it by generating new external messages and uploading them to the ION Blockchain using the "sendfile" command of the Lite Client. 8. Using the simple wallet smart contract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -551,6 +551,6 @@ Here `my_wallet_name` is the identifier of your wallet used before with new-wall When you run this code (by invoking the Fift interpreter), you create an external message with a destination equal to the address of your wallet smart contract, containing a correct Ed25519 signature, a sequence number, and an enveloped internal message from your wallet smart contract to the smart contract indicated in dest_addr, with an arbitrary value attached and an arbitrary payload. When your smart contract receives and processes this external message, it first checks the signature and the sequence number. If they are correct, it accepts the external message, sends the embedded internal message from itself to the intended destination, and increases the sequence number in its persistent data (this is a simple measure to prevent replay attacks, in case this sample wallet smart contract code ends up used in a real wallet application). -Of course, a true TON Blockchain wallet application would hide all the intermediate steps explained above. It would first communicate the address of the new smart contract to the user, asking them to transfer some funds to the indicated address (displayed in its non-bounceable user-friendly form) from another wallet or a cryptocurrency exchange, and then would provide a simple interface to display the current balance and to transfer funds to whatever other addresses the user wants. (The aim of this document is to explain how to create new non-trivial smart contracts and experiment with the TON Blockchain Test Network, rather than to explain how one could use the Lite Client instead of a more user-friendly wallet application.) +Of course, a true ION Blockchain wallet application would hide all the intermediate steps explained above. It would first communicate the address of the new smart contract to the user, asking them to transfer some funds to the indicated address (displayed in its non-bounceable user-friendly form) from another wallet or a cryptocurrency exchange, and then would provide a simple interface to display the current balance and to transfer funds to whatever other addresses the user wants. (The aim of this document is to explain how to create new non-trivial smart contracts and experiment with the ION Blockchain Test Network, rather than to explain how one could use the Lite Client instead of a more user-friendly wallet application.) One final remark: The above examples used smart contracts in the basic workchain (workchain 0). They would work in exactly the same way in the masterchain (workchain -1), if one passes workchain identifier -1 instead of 0 as the first argument to `new-wallet.fif`. The only difference is that the processing and storage fees in the basic workchain are 100-1000 times lower than in the masterchain. Some smart contracts (such as the validator election smart contract) accept transfers only from masterchain smart contracts, so you'll need a wallet in the masterchain if you wish to make stakes on behalf of your own validator and participate in the elections. diff --git a/doc/TestGrams-HOWTO b/doc/TestGrams-HOWTO index 8156e9757..cb018f2ac 100644 --- a/doc/TestGrams-HOWTO +++ b/doc/TestGrams-HOWTO @@ -1,4 +1,4 @@ -The aim of this text is to describe how to quickly obtain a small amount of test Grams for test purposes, or a larger amount of test Grams for running a validator in the test network. We assume familiarity with the TON Blockchain LiteClient as explained in the LiteClient-HOWTO, and with the procedure required to compile the LiteClient and other software. For obtaining larger amount of test Grams required for running a validator, we also assume acquaintance with the FullNode-HOWTO and Validator-HOWTO. You will also need a dedicated server powerful enough for running a Full Node in order to obtain the larger amount of test Grams. Obtaining small amounts of test Grams does not require a dedicated server and may be done in several minutes on a home computer. +The aim of this text is to describe how to quickly obtain a small amount of test Grams for test purposes, or a larger amount of test Grams for running a validator in the test network. We assume familiarity with the ION Blockchain LiteClient as explained in the LiteClient-HOWTO, and with the procedure required to compile the LiteClient and other software. For obtaining larger amount of test Grams required for running a validator, we also assume acquaintance with the FullNode-HOWTO and Validator-HOWTO. You will also need a dedicated server powerful enough for running a Full Node in order to obtain the larger amount of test Grams. Obtaining small amounts of test Grams does not require a dedicated server and may be done in several minutes on a home computer. 1. Proof-of-Work TestGiver smart contracts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -38,7 +38,7 @@ You should randomly choose one of these "proof-of-work testgiver" smart contract 2. The "mining" process ~~~~~~~~~~~~~~~~~~~~~~~ -In order to create an external message containing the "proof of work", you should run a special "mining" utility, compiled from the TON sources located in the GitHub repository. The utility is located in file './crypto/pow-miner' with respect to the build directory, and can be compiled by typing 'make pow-miner' in the build directory. +In order to create an external message containing the "proof of work", you should run a special "mining" utility, compiled from the ION sources located in the GitHub repository. The utility is located in file './crypto/pow-miner' with respect to the build directory, and can be compiled by typing 'make pow-miner' in the build directory. However, before running "pow-miner", you need to know the actual values of "seed" and "complexity" parameters of the chosen "proof-of-work testgiver" smart contract. This can be done by invoking get-method "get_pow_params" of this smart contract. For instance, if you use testgiver smart contract kf-kkdY_B7p-77TLn2hUhM6QidWrrsl8FYWCIvBMpZKprBtN, you can simply type diff --git a/doc/Tests.md b/doc/Tests.md index c883731a9..5bd763e4f 100644 --- a/doc/Tests.md +++ b/doc/Tests.md @@ -1,11 +1,11 @@ # Tests execution -TON contains multiple unit-tests, that facilitate detection of erroneous blockchain behaviour on each commit. +ION contains multiple unit-tests, that facilitate detection of erroneous blockchain behaviour on each commit. ## Build tests Go inside the build directory and, if you use ninja, build the tests using the following command: ```ninja test-ed25519 test-ed25519-crypto test-bigint test-vm test-fift test-cells test-smartcont test-net test-tdactor test-tdutils test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain test-fec test-tddb test-db test-validator-session-state``` -For more details on how to build TON artifacts, please refer to any of Github actions. +For more details on how to build ION artifacts, please refer to any of Github actions. For cmake use: diff --git a/doc/TonSites-HOWTO b/doc/TonSites-HOWTO index 8975a39ff..9953709a3 100644 --- a/doc/TonSites-HOWTO +++ b/doc/TonSites-HOWTO @@ -1,26 +1,26 @@ -The aim of this document is to provide a gentle introduction into TON Sites, which are (TON) Web sites accessed through the TON Network. TON Sites may be used as a convenient entry point for other TON Services. In particular, HTML pages downloaded from TON Sites may contain links to ton://... URIs representing payments that can be performed by the user by clicking to the link, provided a TON Wallet is installed on the user's device. +The aim of this document is to provide a gentle introduction into ION Sites, which are (ION) Web sites accessed through the ION Network. ION Sites may be used as a convenient entry point for other ION Services. In particular, HTML pages downloaded from ION Sites may contain links to ion://... URIs representing payments that can be performed by the user by clicking to the link, provided a ION Wallet is installed on the user's device. -From the technical perspective, TON Sites are very much like the usual Web sites, but they are accessed through the TON Network (which is an overlay network inside the Internet) instead of the Internet. More specifically, they have an ADNL address (instead of a more customary IPv4 or IPv6 address), and they accept HTTP queries via RLDP protocol (which is a higher-level RPC protocol built upon ADNL, the main protocol of TON Network) instead of the usual TCP/IP. All encryption is handled by ADNL, so there is no need to use HTTPS (i.e., TLS). +From the technical perspective, ION Sites are very much like the usual Web sites, but they are accessed through the ION Network (which is an overlay network inside the Internet) instead of the Internet. More specifically, they have an ADNL address (instead of a more customary IPv4 or IPv6 address), and they accept HTTP queries via RLDP protocol (which is a higher-level RPC protocol built upon ADNL, the main protocol of ION Network) instead of the usual TCP/IP. All encryption is handled by ADNL, so there is no need to use HTTPS (i.e., TLS). -In order to access existing and create new TON Sites one needs special gateways between the "ordinary" internet and the TON Network. Essentially, TON Sites are accessed with the aid of a HTTP->RLDP proxy running locally on the client's machine, and they are created by means of a reverse RLDP->HTTP proxy running on a remote web server. +In order to access existing and create new ION Sites one needs special gateways between the "ordinary" internet and the ION Network. Essentially, ION Sites are accessed with the aid of a HTTP->RLDP proxy running locally on the client's machine, and they are created by means of a reverse RLDP->HTTP proxy running on a remote web server. 1. Compiling RLDP-HTTP Proxy ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The RLDP-HTTP Proxy is a special utility specially designed for accessing and creating TON Sites. Its current (alpha) version is a part of the general TON Blockchain source tree, available at GitHub repository ton-blockchain/ton. In order to compile the RLDP-HTTP Proxy, follow the instructions outlined in README and Validator-HOWTO. The Proxy binary will be located as +The RLDP-HTTP Proxy is a special utility specially designed for accessing and creating ION Sites. Its current (alpha) version is a part of the general ION Blockchain source tree, available at GitHub repository ice-blockchain/ion. In order to compile the RLDP-HTTP Proxy, follow the instructions outlined in README and Validator-HOWTO. The Proxy binary will be located as rldp-http-proxy/rldp-http-proxy -in the build directory. Alternatively, you may want to build just the Proxy instead of building all TON Blockchain projects. This can be done by invoking +in the build directory. Alternatively, you may want to build just the Proxy instead of building all ION Blockchain projects. This can be done by invoking cmake --build . --target rldp-http-proxy in the build directory. -2. Running RLDP-HTTP Proxy to access TON Sites +2. Running RLDP-HTTP Proxy to access ION Sites ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -In order to access existing TON Sites, you need a running instance of RLDP-HTTP Proxy on your computer. It can be invoked as follows: +In order to access existing ION Sites, you need a running instance of RLDP-HTTP Proxy on your computer. It can be invoked as follows: rldp-http-proxy/rldp-http-proxy -p 8080 -c 3333 -C global-config.json @@ -28,50 +28,50 @@ or rldp-http-proxy/rldp-http-proxy -p 8080 -a :3333 -C global-config.json -where is your public IPv4 address, provided you have one on your home computer. The TON Network global configuration file `global-config.json` can be downloaded at https://ton.org/global-config.json : +where is your public IPv4 address, provided you have one on your home computer. The ION Network global configuration file `global-config.json` can be downloaded at https://ion.org/global-config.json : - wget https://ton.org/global-config.json + wget https://ion.org/global-config.json -In the above example, 8080 is the TCP port that will be listened to at localhost for incoming HTTP queries, and 3333 is the UDP port that will be used for all outbound and inbound RLDP and ADNL activity, i.e., for connecting to the TON Sites via the TON Network. +In the above example, 8080 is the TCP port that will be listened to at localhost for incoming HTTP queries, and 3333 is the UDP port that will be used for all outbound and inbound RLDP and ADNL activity, i.e., for connecting to the ION Sites via the ION Network. -If you have done everything correctly, the Proxy will not terminate, but it will continue running in the terminal. It can be used now for accessing TON Sites. When you don't need it anymore, you can terminate it by pressing Ctrl-C, or simply by closing the terminal window. +If you have done everything correctly, the Proxy will not terminate, but it will continue running in the terminal. It can be used now for accessing ION Sites. When you don't need it anymore, you can terminate it by pressing Ctrl-C, or simply by closing the terminal window. -3. Accessing TON Sites +3. Accessing ION Sites ~~~~~~~~~~~~~~~~~~~~~~ Now suppose that you have a running instance of the RLDP-HTTP Proxy running on your computer and listening on localhost:8080 for inbound TCP connections, as explained above in Section 2. A simple test that everything is working property may be performed using programs such as Curl or WGet. For example, - curl -x 127.0.0.1:8080 http://test.ton + curl -x 127.0.0.1:8080 http://test.ion -attempts to download the main page of (TON) Site `test.ton` using the proxy at `127.0.0.1:8080`. If the proxy is up and running, you'll see something like +attempts to download the main page of (ION) Site `test.ion` using the proxy at `127.0.0.1:8080`. If the proxy is up and running, you'll see something like -

TON Blockchain Test Network — files and resources

+

ION Blockchain Test Network — files and resources

News