Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Tolk update to testnet #1500

Merged
merged 7 commits into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ jobs:
workflow: ton-x86-64-linux.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: true

- name: Download and unzip Linux x86-64 artifacts
@@ -25,6 +26,7 @@ jobs:
workflow: ton-x86-64-linux.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: false

- name: Download Mac x86-64 artifacts
@@ -33,6 +35,7 @@ jobs:
workflow: ton-x86-64-macos.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: true

- name: Download Mac arm64 artifacts
@@ -41,6 +44,7 @@ jobs:
workflow: ton-arm64-macos.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: true

- name: Download and unzip Mac x86-64 artifacts
@@ -49,6 +53,7 @@ jobs:
workflow: ton-x86-64-macos.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: false

- name: Download and unzip arm64 artifacts
@@ -57,6 +62,7 @@ jobs:
workflow: ton-arm64-macos.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: false

- name: Download Windows artifacts
@@ -65,6 +71,7 @@ jobs:
workflow: ton-x86-64-windows.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: true

- name: Download and unzip Windows artifacts
@@ -73,6 +80,7 @@ jobs:
workflow: ton-x86-64-windows.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: false

- name: Download WASM artifacts
@@ -81,6 +89,7 @@ jobs:
workflow: build-ton-wasm-emscripten.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: true

- name: Download Android Tonlib artifacts
@@ -89,6 +98,7 @@ jobs:
workflow: build-ton-linux-android-tonlib.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: true

- name: Show all artifacts
134 changes: 134 additions & 0 deletions .github/workflows/create-tolk-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Create tolk release

on:
workflow_dispatch:
inputs:
tag:
description: 'tolk release and tag name'
required: true

permissions: write-all

jobs:
create-release:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Download and unzip Linux x86-64 artifacts
uses: dawidd6/action-download-artifact@v6
with:
workflow: ton-x86-64-linux.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: false

- name: Download and unzip Mac x86-64 artifacts
uses: dawidd6/action-download-artifact@v6
with:
workflow: ton-x86-64-macos.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: false

- name: Download and unzip arm64 artifacts
uses: dawidd6/action-download-artifact@v6
with:
workflow: ton-arm64-macos.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: false

- name: Download and unzip Windows artifacts
uses: dawidd6/action-download-artifact@v6
with:
workflow: ton-x86-64-windows.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: false

- name: Download WASM artifacts
uses: dawidd6/action-download-artifact@v6
with:
workflow: build-ton-wasm-emscripten.yml
path: artifacts
workflow_conclusion: success
branch: master
skip_unpack: true

- name: Show all artifacts
run: |
tree artifacts


# create release
- 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

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ inputs.tag }}
release_name: ${{ inputs.tag }}
draft: false
prerelease: false

# upload

# win

- name: Upload Windows 2019 single artifact - tolk
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/ton-win-binaries/tolk.exe
asset_name: tolk.exe
tag: ${{ inputs.tag }}

# mac x86-64

- name: Upload Mac x86-64 single artifact - tolk
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/ton-x86_64-macos-binaries/tolk
asset_name: tolk-mac-x86-64
tag: ${{ inputs.tag }}

# mac arm64

- name: Upload Mac arm64 single artifact - tolk
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/ton-arm64-macos-binaries/tolk
asset_name: tolk-mac-arm64
tag: ${{ inputs.tag }}

# linux x86-64

- name: Upload Linux x86-64 single artifact - tolk
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/ton-x86_64-linux-binaries/tolk
asset_name: tolk-linux-x86_64
tag: ${{ inputs.tag }}

- name: Upload WASM artifacts
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/ton-wasm-binaries.zip
asset_name: ton-wasm.zip
tag: ${{ inputs.tag }}
42 changes: 21 additions & 21 deletions crypto/smartcont/tolk-stdlib/common.tolk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Standard library for Tolk (LGPL licence).
// It contains common functions that are available out of the box, the user doesn't have to import anything.
// More specific functions are required to be imported explicitly, like "@stdlib/tvm-dicts".
tolk 0.6
tolk 0.7

/**
Tuple manipulation primitives.
@@ -17,17 +17,17 @@ fun createEmptyTuple(): tuple
/// Appends a value to tuple, resulting in `Tuple t' = (x1, ..., xn, value)`.
/// If its size exceeds 255, throws a type check exception.
@pure
fun tuplePush<X>(mutate self: tuple, value: X): void
fun tuplePush<T>(mutate self: tuple, value: T): void
asm "TPUSH";

/// Returns the first element of a non-empty tuple.
@pure
fun tupleFirst<X>(t: tuple): X
fun tupleFirst<T>(t: tuple): T
asm "FIRST";

/// Returns the [`index`]-th element of a tuple.
@pure
fun tupleAt<X>(t: tuple, index: int): X
fun tupleAt<T>(t: tuple, index: int): T
builtin;

/// Returns the size of a tuple (elements count in it).
@@ -37,7 +37,7 @@ fun tupleSize(t: tuple): int

/// Returns the last element of a non-empty tuple.
@pure
fun tupleLast(t: tuple): int
fun tupleLast<T>(t: tuple): T
asm "LAST";


@@ -205,7 +205,7 @@ fun stringHash(s: slice): int
/// That is, if [hash] is computed as the hash of some data, these data are hashed twice,
/// the second hashing occurring inside `CHKSIGNS`.
@pure
fun isSignatureValid(hash: int, signature: slice, publicKey: int): int
fun isSignatureValid(hash: int, signature: slice, publicKey: int): bool
asm "CHKSIGNU";

/// Checks whether [signature] is a valid Ed25519-signature of the data portion of `slice data` using `publicKey`,
@@ -214,7 +214,7 @@ fun isSignatureValid(hash: int, signature: slice, publicKey: int): int
/// The verification of Ed25519 signatures is the standard one,
/// with sha256 used to reduce [data] to the 256-bit number that is actually signed.
@pure
fun isSliceSignatureValid(data: slice, signature: slice, publicKey: int): int
fun isSliceSignatureValid(data: slice, signature: slice, publicKey: int): bool
asm "CHKSIGNS";

/// Generates a new pseudo-random unsigned 256-bit integer x.
@@ -259,14 +259,14 @@ fun randomizeByLogicalTime(): void
/// otherwise the computation is aborted before visiting the `(maxCells + 1)`-st cell and
/// a zero flag is returned to indicate failure. If [c] is `null`, returns `x = y = z = 0`.
@pure
fun calculateCellSize(c: cell, maxCells: int): (int, int, int, int)
fun calculateCellSize(c: cell, maxCells: int): (int, int, int, bool)
asm "CDATASIZEQ NULLSWAPIFNOT2 NULLSWAPIFNOT";

/// Similar to [calculateCellSize], but accepting a `slice` [s] instead of a `cell`.
/// The returned value of `x` does not take into account the cell that contains the `slice` [s] itself;
/// however, the data bits and the cell references of [s] are accounted for in `y` and `z`.
@pure
fun calculateSliceSize(s: slice, maxCells: int): (int, int, int, int)
fun calculateSliceSize(s: slice, maxCells: int): (int, int, int, bool)
asm "SDATASIZEQ NULLSWAPIFNOT2 NULLSWAPIFNOT";

/// A non-quiet version of [calculateCellSize] that throws a cell overflow exception (`8`) on failure.
@@ -306,11 +306,11 @@ fun getBuilderDepth(b: builder): int
*/

/// Dump a variable [x] to the debug log.
fun debugPrint<X>(x: X): void
fun debugPrint<T>(x: T): void
builtin;

/// Dump a string [x] to the debug log.
fun debugPrintString<X>(x: X): void
fun debugPrintString<T>(x: T): void
builtin;

/// Dumps the stack (at most the top 255 values) and shows the total stack depth.
@@ -382,7 +382,7 @@ fun loadCoins(mutate self: slice): int

/// Loads bool (-1 or 0) from a slice
@pure
fun loadBool(mutate self: slice): int
fun loadBool(mutate self: slice): bool
asm( -> 1 0) "1 LDI";

/// Shifts a slice pointer to [len] bits forward, mutating the slice.
@@ -482,7 +482,7 @@ fun storeCoins(mutate self: builder, x: int): self
/// Stores bool (-1 or 0) into a builder.
/// Attention: true value is `-1`, not 1! If you pass `1` here, TVM will throw an exception.
@pure
fun storeBool(mutate self: builder, x: int): self
fun storeBool(mutate self: builder, x: bool): self
asm(x self) "1 STI";

/// Stores dictionary (represented by TVM `cell` or `null`) into a builder.
@@ -529,22 +529,22 @@ fun getRemainingBitsAndRefsCount(self: slice): (int, int)

/// Checks whether a slice is empty (i.e., contains no bits of data and no cell references).
@pure
fun isEndOfSlice(self: slice): int
fun isEndOfSlice(self: slice): bool
asm "SEMPTY";

/// Checks whether a slice has no bits of data.
@pure
fun isEndOfSliceBits(self: slice): int
fun isEndOfSliceBits(self: slice): bool
asm "SDEMPTY";

/// Checks whether a slice has no references.
@pure
fun isEndOfSliceRefs(self: slice): int
fun isEndOfSliceRefs(self: slice): bool
asm "SREMPTY";

/// Checks whether data parts of two slices coinside.
@pure
fun isSliceBitsEqual(self: slice, b: slice): int
fun isSliceBitsEqual(self: slice, b: slice): bool
asm "SDEQ";

/// Returns the number of cell references already stored in a builder.
@@ -621,10 +621,10 @@ fun parseStandardAddress(s: slice): (int, int)
fun createAddressNone(): slice
asm "b{00} PUSHSLICE";

/// Returns if a slice pointer contains an empty address (`-1` for true, `0` for false, as always).
/// Returns if a slice pointer contains an empty address.
/// In other words, a slice starts with two `0` bits (TL addr_none$00).
@pure
fun addressIsNone(s: slice): int
fun addressIsNone(s: slice): bool
asm "2 PLDU" "0 EQINT";


@@ -677,8 +677,8 @@ fun loadMessageFlags(mutate self: slice): int
/// Having msgFlags (4 bits), check that a message is bounced.
/// Effectively, it's `msgFlags & 1` (the lowest bit present).
@pure
fun isMessageBounced(msgFlags: int): int
asm "1 PUSHINT" "AND";
fun isMessageBounced(msgFlags: int): bool
asm "2 PUSHINT" "MODR";

/// Skip 0xFFFFFFFF prefix (when a message is bounced).
@pure
8 changes: 7 additions & 1 deletion crypto/smartcont/tolk-stdlib/gas-payments.tolk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// A part of standard library for Tolk
tolk 0.6
tolk 0.7

/**
Gas and payment related primitives.
@@ -61,3 +61,9 @@ fun calculateOriginalMessageFee(workchain: int, incomingFwdFee: int): int
/// If it has no debt, `0` is returned.
fun getMyStorageDuePayment(): int
asm "DUEPAYMENT";

/// Returns the amount of nanotoncoins charged for storage.
/// (during storage phase preceeding to current computation phase)
@pure
fun getMyStoragePaidPayment(): int
asm "STORAGEFEES";
2 changes: 1 addition & 1 deletion crypto/smartcont/tolk-stdlib/lisp-lists.tolk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// A part of standard library for Tolk
tolk 0.6
tolk 0.7

/**
Lisp-style lists are nested 2-elements tuples: `(1, (2, (3, null)))` represents list `[1, 2, 3]`.
Loading