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

Document Tact language limitations due to blockchain/TVM/validator limitations #1097

Open
anton-trunov opened this issue Mar 13, 2024 · 1 comment
Assignees
Labels
kind: docs Documentation for docs.tact-lang.org kept in docs folder
Milestone

Comments

@anton-trunov
Copy link
Member

anton-trunov commented Mar 13, 2024

For instance, how large maps can be, etc.

@0kenx
Copy link
Contributor

0kenx commented Apr 11, 2024

This limit is contradictory to our tests. We deployed a contract on testnet and added 66k entries to a map.

https://testnet.tonviewer.com/kQDrXvmitxbGvjpXwRtc5NMuN_4tDkJ83f3myVK04VrviF2v

import "@stdlib/deploy";
import "@stdlib/ownable";
import "./utils/transfer_helpers";

message Increment {
    count: Int;
}

contract MapOnlineTest with Deployable, OwnableTransferable {
    const STORAGE_GAS_RESERVE: Int = ton("0.2");

    owner: Address;
    logo: Int;
    total_map: map<Int, Int>;
    total: Int = 0;

    init(owner: Address, logo: Int) {
        self.owner = owner;
        self.logo = logo;
    }

    receive("fund gas") {}

    receive(msg: Increment) {
        self.requireOwner();
        repeat (msg.count) {
            self.total_map.set(self.total, 1);
            self.total = self.total + 1;
        }
        
    }

    receive("withdraw dust") {
        self.requireOwner();
        send_ton(
            self.owner,
            myBalance() - self.STORAGE_GAS_RESERVE, 
            false,
            "Dust withdrawn".asComment()
        );
    }

    get fun balance(): Int {
        return myBalance();
    }

    get fun total(): Int {
        return self.total;
    }

    get fun total_map(index: Int): Int? {
        return self.total_map.get(index);
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: docs Documentation for docs.tact-lang.org kept in docs folder
Projects
None yet
Development

No branches or pull requests

3 participants