disintar / toncli

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

When running tests with recent ton tools and tonclin of branch main: `contract_tests.fif ... PROC:<{:procedure already defined` #76

Closed vtamara closed 2 years ago

vtamara commented 2 years ago

With previous versions of ton and toncli 0.0.38 I could run without issue tests like:

https://gitlab.com/pasosdeJesus/pruebas_mdc_func

With the current version of ton and toncli from branch main of repository, running that test produces:

toncli run_tests                                                                                                                                         [2/253]
INFO: 🌈 Start tests                                                                                                                                            
INFO: πŸ₯Œ Build successfully, check out ./build
[ 1][t 0][2022-09-09 19:51:58.855893][Fift.cpp:67]      top: abort
level 1: swap { <continuation 0x43a3ebce500> } if **HERE** drop 
level 2: [in @PROC:<{:] over @fail-ifdef **HERE** 2 { <continuation 0x43a540e4b00> } does null swap @doafter<{ 0 32 u, 
level 3: <text interpreter continuation> 
level 4: <continuation 0x43a540b32c0>
level 5: <text interpreter continuation> 
[ 1][t 0][2022-09-09 19:51:58.855985][fift-main.cpp:204]        Error interpreting file `/tmp/tmpezl103ve.fif`: contract_tests.fif:1508:        PROC:<{:procedur
e already defined                       
tvorogme commented 2 years ago

Hi! This is because you try to use old version of tests. Documentation on new tests could be found here: https://github.com/disintar/toncli/blob/master/docs/advanced/func_tests_new.md

If you prefer to use old tests - you need to use --old flag, but it's not recommended.

vtamara commented 2 years ago

It doesn't work. When I run toncli run_tests --old it produces:

INFO: 🌈 Start tests
INFO: πŸ₯Œ Build successfully, check out ./build
[ 1][t 0][2022-09-10 14:12:46.953886][Fift.cpp:67]      top: abort
level 1: swap { <continuation 0xe80d1026b40> } if **HERE** drop 
level 2: [in @PROC:<{:] over @fail-ifdef **HERE** 2 { <continuation 0xe804ac8a980> } does null swap @doafter<{ 0 32 u, 
level 3: <text interpreter continuation>
level 4: <continuation 0xe804ac98700>
level 5: <text interpreter continuation>
[ 1][t 0][2022-09-10 14:12:46.953983][fift-main.cpp:204]        Error interpreting file `/tmp/tmpuqaemtr_.fif`: contract_tests.fif:1502:        PROC:<{:procedure already defined
tvorogme commented 2 years ago

@vtamara this error means that some proc IDs in your test are the same. Guess something wrong in new tests-libs helpers. We really don't want to support old tests anymore, so why they are deprecated. I suggest to use new tests system, it's much better.

  DECLPROC power
  DECLPROC sqrt
  DECLPROC avg
  DECLPROC exp
  DECLPROC log2
  114362 DECLMETHOD generate_empty_address
  103563 DECLMETHOD generate_internal_address
  71142 DECLMETHOD generate_internal_address_with_custom_data
  105789 DECLMETHOD generate_external_address
  77760 DECLMETHOD generate_external_address_with_custom_data
  119020 DECLMETHOD generate_var_address
  101577 DECLMETHOD generate_var_address_with_custom_data
  DECLPROC generate_any_address
  69682 DECLMETHOD init_environment
  104832 DECLMETHOD storage_key
  68533 DECLMETHOD load_storage_with_tag
  113134 DECLMETHOD save_storage_with_tag
  85860 DECLMETHOD get_c7
  78457 DECLMETHOD invoke_method
  93676 DECLMETHOD invoke_method_expect_fail
  127733 DECLMETHOD assert_no_actions
  DECLPROC parse_send_raw_message
  DECLPROC parse_lib_code
  DECLPROC parse_raw_reserve
  DECLPROC parse_set_code
  DECLPROC parse_c5
  66092 DECLMETHOD generate_init_state
  86734 DECLMETHOD generate_init_state_with_data
  70014 DECLMETHOD parse_init_state
  71497 DECLMETHOD random_query_id
  128031 DECLMETHOD generate_internal_message_body
  103755 DECLMETHOD generate_internal_message_custom
  125184 DECLMETHOD generate_nft_transfer_request
  93113 DECLMETHOD generate_nft_get_static_data_request
  80940 DECLMETHOD generate_nft_deploy_request
  72255 DECLMETHOD generate_jetton_burn_request
  DECLPROC generate_jetton_burn_notification
  100003 DECLMETHOD generate_jetton_transfer_request
  129018 DECLMETHOD generate_internal_message
  108731 DECLMETHOD generate_internal_message_relaxed
  115574 DECLMETHOD generate_external_in_message
  78122 DECLMETHOD generate_external_in_message_with_empty_source_address
  94514 DECLMETHOD generate_external_out_message
  75192 DECLMETHOD generate_external_out_message_with_empty_destination_address
  77897 DECLMETHOD generate_external_out_message_relaxed
  94767 DECLMETHOD parse_internal_message
  97177 DECLMETHOD parse_external_message
  76887 DECLMETHOD generate_external_out_message_with_bad_source_address
  113901 DECLMETHOD generate_external_out_message_with_bad_destination_address
  124331 DECLMETHOD generate_external_in_message_with_bad_source_address
  128854 DECLMETHOD generate_external_in_message_with_bad_destination_address
  122899 DECLMETHOD generate_internal_message_with_bad_grams_data
  105345 DECLMETHOD generate_internal_message_with_bad_init_state_data
  DECLPROC token_snake_len
  DECLPROC get_snake_tail
  103208 DECLMETHOD snake_concat
  DECLPROC snake_concat_tagged
  DECLPROC snake_equal?
  0 DECLMETHOD test_30_12_data
  1 DECLMETHOD test_30_12
vtamara commented 1 year ago

In my humble opinion toncli should be able to run in two modes without issue:

  1. To run with the debugging ton that has available more debuggin primitives.
  2. With the --old flag it should be able to run in the standard ton that is where the real smart contract will run.