disintar / toncli

TON Command Line Interface - easy smart contract manipulation
https://disintar.io/
Apache License 2.0
158 stars 35 forks source link

Tests are falling, probably due to the lack of a file stdlib.fc #115

Open ilyar opened 11 months ago

ilyar commented 11 months ago

Bug Type

Functional

Reproduction steps

The launch is made in a ready-made environment with installed utilities, but probably the path for the file stdlib.fc is not specified and it is not obvious how to specify it, or it may be necessary to mark it in a specific place

docker run -it ghcr.io/ever-guild/tvm-action:1.2.0-rc.1
toncli start  nft_collection
cd  nft_collection
toncli run_tests

Actual result

I got error:

toncli run_tests
INFO: 🌈 Start tests
/src/local/nft_collection/func/utils/params.func:4:17: error: undefined function `parse_std_addr`, defining a global function of unknown type
    (int wc, _) = parse_std_addr(addr);
                  ^
/src/local/nft_collection/func/nft-collection.func:17:12: error: undefined function `get_data`, defining a global function of unknown type
    var ds = get_data().begin_parse();
             ^
/src/local/nft_collection/func/nft-collection.func:17:22: error: undefined function `.begin_parse`, defining a global function of unknown type
    var ds = get_data().begin_parse();
                       ^
/src/local/nft_collection/func/nft-collection.func:19:8: error: undefined function `~load_msg_addr`, defining a global function of unknown type
      (ds~load_msg_addr(), ;; owner_address
         ^
/src/local/nft_collection/func/nft-collection.func:21:8: error: undefined function `~load_ref`, defining a global function of unknown type
       ds~load_ref(), ;; content
         ^
/src/local/nft_collection/func/nft-collection.func:28:3: error: undefined function `set_data`, defining a global function of unknown type
    set_data(begin_cell()
    ^
/src/local/nft_collection/func/nft-collection.func:28:12: error: undefined function `begin_cell`, defining a global function of unknown type
    set_data(begin_cell()
             ^
/src/local/nft_collection/func/nft-collection.func:29:5: error: undefined function `.store_slice`, defining a global function of unknown type
      .store_slice(owner_address)
      ^
/src/local/nft_collection/func/nft-collection.func:31:5: error: undefined function `.store_ref`, defining a global function of unknown type
      .store_ref(content)
      ^
/src/local/nft_collection/func/nft-collection.func:34:5: error: undefined function `.end_cell`, defining a global function of unknown type
      .end_cell());
      ^
/src/local/nft_collection/func/nft-collection.func:38:67: error: undefined function `my_address`, defining a global function of unknown type
    cell data = begin_cell().store_uint(item_index, 64).store_slice(my_address()).end_cell();
                                                                    ^
/src/local/nft_collection/func/nft-collection.func:39:39: error: undefined function `.store_dict`, defining a global function of unknown type
    return begin_cell().store_uint(0, 2).store_dict(nft_item_code).store_dict(data).store_uint(0, 1).end_cell();
                                        ^
/src/local/nft_collection/func/nft-collection.func:45:34: error: undefined function `cell_hash`, defining a global function of unknown type
                       .store_uint(cell_hash(state_init), 256)
                                   ^
/src/local/nft_collection/func/nft-collection.func:56:13: error: undefined function `.store_coins`, defining a global function of unknown type
              .store_coins(amount)
              ^
/src/local/nft_collection/func/nft-collection.func:60:3: error: undefined function `send_raw_message`, defining a global function of unknown type
    send_raw_message(msg.end_cell(), 1); ;; pay transfer fees separately, revert on errors
    ^
/src/local/nft_collection/func/nft-collection.func:76:20: error: undefined function `.slice_empty?`, defining a global function of unknown type
      if (in_msg_body.slice_empty?()) { ;; ignore empty messages
                     ^
/src/local/nft_collection/func/nft-collection.func:104:61: error: undefined function `~load_coins`, defining a global function of unknown type
        deploy_nft_item(item_index, nft_item_code, in_msg_body~load_coins(), in_msg_body~load_ref());
                                                              ^
/src/local/nft_collection/func/nft-collection.func:115:49: error: undefined function `~udict::delete_get_min`, defining a global function of unknown type
          var (item_index, item, f?) = deploy_list~udict::delete_get_min(64);
                                                  ^
/src/local/nft_collection/tests/utils/collection-data.func:35:23: error: undefined function `invoke_method`, defining a global function of unknown type
        ( _, tuple stack ) = invoke_method( royalty_params, [] );
                             ^
/src/local/nft_collection/tests/utils/collection-data.func:37:16: error: undefined function `.first`, defining a global function of unknown type
        return ( stack.first(), stack.second(), stack.third() );
                      ^
/src/local/nft_collection/tests/utils/collection-data.func:37:31: error: undefined function `.second`, defining a global function of unknown type
        return ( stack.first(), stack.second(), stack.third() );
                                     ^
/src/local/nft_collection/tests/utils/collection-data.func:37:47: error: undefined function `.third`, defining a global function of unknown type
        return ( stack.first(), stack.second(), stack.third() );
                                                     ^
/src/local/nft_collection/tests/collection-tests.func:11:16: error: undefined function `null`, defining a global function of unknown type
      cell res = null();
                 ^
/src/local/nft_collection/tests/collection-tests.func:40:27: error: undefined function `token_snake_len`, defining a global function of unknown type
          throw_unless(306, token_snake_len(content_data) > 8);
                            ^
/src/local/nft_collection/tests/collection-tests.func:44:39: error: undefined function `.preload_dict`, defining a global function of unknown type
          throw_unless(306, content_data.preload_dict().dict_empty?());
                                        ^
/src/local/nft_collection/tests/collection-tests.func:44:54: error: undefined function `.dict_empty?`, defining a global function of unknown type
          throw_unless(306, content_data.preload_dict().dict_empty?());
                                                       ^
/src/local/nft_collection/tests/collection-tests.func:63:21: error: undefined function `rand`, defining a global function of unknown type
        int query_id     = rand(1337) + 1;
                           ^
/src/local/nft_collection/tests/collection-tests.func:64:21: error: undefined function `generate_internal_address_with_custom_data`, defining a global function of unknown type
        slice rand_addr  = generate_internal_address_with_custom_data(0, 0, random());
                           ^
/src/local/nft_collection/tests/collection-tests.func:64:70: error: undefined function `random`, defining a global function of unknown type
        slice rand_addr  = generate_internal_address_with_custom_data(0, 0, random());
                                                                            ^
/src/local/nft_collection/tests/collection-tests.func:66:21: error: undefined function `generate_internal_message_body`, defining a global function of unknown type
        builder msg_body = generate_internal_message_body( change_owner, query_id ).store_slice( rand_addr );
                           ^
/src/local/nft_collection/tests/collection-tests.func:67:21: error: undefined function `generate_internal_message_custom`, defining a global function of unknown type
        cell  msg        = generate_internal_message_custom( 0, 0, 0, msg_body, rand_addr, null(), 0 );
                           ^
/src/local/nft_collection/tests/collection-tests.func:70:21: error: undefined function `invoke_method_expect_fail`, defining a global function of unknown type
        int gas_failed   = invoke_method_expect_fail( recv_internal, [one_ton, one_ton, msg, msg_body.end_cell().begin_parse()] );
                           ^
/src/local/nft_collection/tests/collection-tests.func:74:111: error: cannot apply function invoke_method : (() -> (int, int, slice), []) -> (??303, tuple) to arguments of type ((cell, slice) -> (), [int, int, cell, slice]): cannot unify type (cell, slice) with ()
        var ( gas_success, _ ) = invoke_method( recv_internal, [one_ton, 0, msg, msg_body.end_cell().begin_parse()] );
                                                                                                                     ^

Traceback (most recent call last):
  File "/usr/local/bin/toncli", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/toncli/main.py", line 65, in main
    CommandsExecuter(command, string_kwargs, parser)
  File "/usr/local/lib/python3.10/site-packages/toncli/modules/utils/commands/commands_executer.py", line 39, in __init__
    self.command_mapper[command](self)
  File "/usr/local/lib/python3.10/site-packages/toncli/modules/utils/commands/commands_executer.py", line 49, in run_tests_command
    return RunTestsCommand(self.string_kwargs, self.parser)
  File "/usr/local/lib/python3.10/site-packages/toncli/modules/utils/commands/command_classes/run_tests_command.py", line 12, in __init__
    test_runner.run(args.contracts.split() if args.contracts else None,
  File "/usr/local/lib/python3.10/site-packages/toncli/modules/utils/test/tests.py", line 44, in run
    build_test(getcwd(), contracts=real_contracts, cwd=getcwd(), compile_tests_with_contract=not run_tests_old_way)
  File "/usr/local/lib/python3.10/site-packages/toncli/modules/utils/test/commands.py", line 56, in build_test
    build_test_files([*func_and_test_files, *contract.func_files_locations, *contract.func_tests_files_locations],
  File "/usr/local/lib/python3.10/site-packages/toncli/modules/utils/test/commands.py", line 87, in build_test_files
    get_output = check_output(build_command,
  File "/usr/local/lib/python3.10/subprocess.py", line 421, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/local/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/local/bin/func', '-o', '/src/local/nft_collection/build/nft_collection_tests.fif', '-SPA', '/src/local/nft_collection/func/utils/helpers.func', '/src/local/nft_collection/func/utils/params.func', '/src/local/nft_collection/func/utils/op-codes.func', '/src/local/nft_collection/func/nft-collection.func', '/src/local/nft_collection/tests/collection-tests.func', '/src/local/nft_collection/tests/collection-tests-int.func']' returned non-zero exit status 2.

Expected result

Tests run without system errors

Suggested Severity

Medium

Device

docker run -it ghcr.io/ever-guild/tvm-action:1.2.0-rc.1
cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
fift -V
Fift build information: [ Commit: cc0eb453cb3bf69f92693160103d33112856c056, Date: 2023-06-05 14:27:53]
echo $FIFTPATH
/usr/local/lib/fift
func -V
FunC semantic version: v0.4.4
Build information: [ Commit: cc0eb453cb3bf69f92693160103d33112856c056, Date: 2023-06-05 14:27:53]
toncli -v
INFO: v0.0.43

Additional Context

No response