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

Compiling error: Function '__tact_dict_get_int_int' does not exist in imported FunC sources #722

Closed
imartemy1524 opened this issue Aug 23, 2024 · 1 comment · Fixed by #725
Assignees
Labels
feature: maps The map datatype and operations on it kind: bug Something isn't working or isn't right scope: codegen Code generation, a.k.a. compiler backend (src/generator)
Milestone

Comments

@imartemy1524
Copy link

Problem

Trying to compile big project with many contracts dependencies, and getting next error:
Function '__tact_dict_get_int_int' does not exist in imported FunC sources
Trait, where error is being thrown:

trait LockableAction{

    lockableAction: map<Int as uint64, Bool>;


    inline fun lock(userId: Int){
        self.lockableAction.set(userId, true);
    }
    inline fun unlock(userId: Int){
        self.lockableAction.del(userId);
    }

    inline fun requireNotLocked(userId: Int){
        require(self.lockableAction.get(userId) == null, "Please wait untill previous transaction finish!");
    }
}

Generated func code:

((int, slice, int, slice, cell, int, int), ()) $UserPost$_fun_requireNotLocked((int, slice, int, slice, cell, int, int) $self, int $userId) impure inline {
    var (($self'postId, $self'text, $self'ownerUserId, $self'master, $self'lockableAction, $self'likesCount, $self'dislikesCount)) = $self;
    ////////////////////////////////          |> error here 
    throw_unless(1151, null?(__tact_dict_get_int_int($self'lockableAction, 64, $userId, 1)));
    return (($self'postId, $self'text, $self'ownerUserId, $self'master, $self'lockableAction, $self'likesCount, $self'dislikesCount), ());
}

Steps to reproduce

git clone https://github.com/imartemy1524/ton-social -b tact-error
cd ton-social 
npm i
npx blueprint build # error here

Other comments

It seems, that this is the problem with Bool value type in map, because when one replaces map<Int as uint64, Bool> with map<Int as uint64, Int as uint8>, the problem fixes.

My temporary solution:

trait LockableAction{

    lockableAction: map<Int as uint64, Int as uint8>;


    inline fun lock(userId: Int){
        self.lockableAction.set(userId, 0);
    }
    inline fun unlock(userId: Int){
        self.lockableAction.del(userId);
    }

    inline fun requireNotLocked(userId: Int){
        require(self.lockableAction.get(userId) == null, "Please wait untill previous transaction finish!");
    }
}
@anton-trunov
Copy link
Member

@imartemy1524 Let me thank you for such a well-written report! We will look into this asap. Incidentally, blueprint build should report a failure but it does not, I filed an issue here: ton-org/blueprint#144

@anton-trunov anton-trunov changed the title [Blueprint] Compiling error: Function '__tact_dict_get_int_int' does not exist in imported FunC sources Compiling error: Function '__tact_dict_get_int_int' does not exist in imported FunC sources Aug 24, 2024
@anton-trunov anton-trunov added kind: bug Something isn't working or isn't right scope: codegen Code generation, a.k.a. compiler backend (src/generator) feature: maps The map datatype and operations on it labels Aug 24, 2024
@anton-trunov anton-trunov self-assigned this Aug 24, 2024
@anton-trunov anton-trunov added this to the v1.5.0 milestone Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: maps The map datatype and operations on it kind: bug Something isn't working or isn't right scope: codegen Code generation, a.k.a. compiler backend (src/generator)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants