Giter VIP home page Giter VIP logo

testsuite4's People

Contributors

buktop24 avatar sauin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

testsuite4's Issues

Contract methods in tests do not work the same way as in blockchain

Test contract:

pragma ton-solidity ^0.58.1;
pragma AbiHeader expire;
pragma AbiHeader pubkey;

contract Test {

    constructor() public {
        tvm.accept();
    }

    function foo() public view {
        require(msg.value > 1 ever);
        tvm.rawReserve(0, 4);

        msg.sender.transfer({value: 0, flag: 128});

        msg.sender.transfer({value: 0.3 ever, flag: 0});
        msg.sender.transfer({value: 0.3 ever, flag: 0});
    }    

}

In the blockchain, its foo method will be executed without errors:
image

As we see the contract balance after the deposit = 0.3 ever. Following from this, we can say that, theoretically, the transfer of 2 transactions after the payment of the change is impossible because the amount of transactions is greater than the reserved balance of the contract.

But in tests, the call to the foo method does not pass and falls into an error:
image

test.py:

from tonos_ts4 import ts4

eq = ts4.eq

ts4.init('../build', verbose = True)

def deploy_setcodemultisig():
    keypair = ts4.make_keypair()
    setcode = ts4.BaseContract('SetcodeMultisigWallet', ctor_params={'owners': [keypair[1]], 'reqConfirms': 1}, keypair=keypair)
    return setcode

def deploy_test():
    test = ts4.BaseContract('Test', ctor_params = {}, balance=300000000)
    return test

def test_contract(setcode, test):
    payload = ts4.encode_message_body('Test', 'foo', params={})
    setcode.call_method_signed('sendTransaction', {'dest': test.address, 'value': 1100000000, 'bounce': False, 'flags': 0, 'payload': payload}, expect_ec = 0)
    ts4.dispatch_messages()

setcode = deploy_setcodemultisig()
test = deploy_test()
test_contract(setcode, test)

Cant compil

Command:
bash build.sh

  --> src/printer.rs:19:35
   |
19 |         tree_of_cells_into_base64(state.data.as_ref()),
   |                                   ^^^^^^^^^^^^^^^^^^^ expected struct `ton_types::Cell`, found struct `ton_types::cell::Cell`
   |
   = note: expected enum `std::option::Option<&ton_types::Cell>`
              found enum `std::option::Option<&ton_types::cell::Cell>`
   = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
  --> src/printer.rs:20:35
   |
20 |         tree_of_cells_into_base64(state.code.as_ref()),
   |                                   ^^^^^^^^^^^^^^^^^^^ expected struct `ton_types::Cell`, found struct `ton_types::cell::Cell`
   |
   = note: expected enum `std::option::Option<&ton_types::Cell>`
              found enum `std::option::Option<&ton_types::cell::Cell>`
   = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
  --> src/printer.rs:21:35
   |
21 |         tree_of_cells_into_base64(state.library.root()),
   |                                   ^^^^^^^^^^^^^^^^^^^^ expected struct `ton_types::Cell`, found struct `ton_types::cell::Cell`
   |
   = note: expected enum `std::option::Option<&ton_types::Cell>`
              found enum `std::option::Option<&ton_types::cell::Cell>`
   = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
  --> src/printer.rs:52:13
   |
52 | /             msg.body()
53 | |                 .map(|slice| slice.into_cell())
54 | |                 .as_ref(),
   | |_________________________^ expected struct `ton_types::Cell`, found struct `ton_types::cell::Cell`
   |
   = note: expected enum `std::option::Option<&ton_types::Cell>`
              found enum `std::option::Option<&ton_types::cell::Cell>`
   = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
  --> src/util.rs:56:44
   |
56 |     MsgAddressInt::with_standart(None, wc, AccountId::from(address)).unwrap()
   |                                            ^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `ton_types::cell::slice::SliceData`, found struct `SliceData`
   |
   = note: perhaps two different versions of crate `ton_types` are being used?

error[E0277]: the trait bound `ton_types::cell::slice::SliceData: From<ton_types::Cell>` is not satisfied
  --> src/util.rs:65:31
   |
65 |     StateInit::construct_from(&mut cell.into()).unwrap()
   |                               ^^^^^^^^^^^^^^^^ the trait `From<ton_types::Cell>` is not implemented for `ton_types::cell::slice::SliceData`
   |
   = help: the following implementations were found:
             <ton_types::cell::slice::SliceData as From<&[u8]>>
             <ton_types::cell::slice::SliceData as From<&mut ton_types::cell::builder::BuilderData>>
             <ton_types::cell::slice::SliceData as From<&ton_types::cell::Cell>>
             <ton_types::cell::slice::SliceData as From<&ton_types::cell::builder::BuilderData>>
           and 6 others
   = note: required because of the requirements on the impl of `Into<ton_types::cell::slice::SliceData>` for `ton_types::Cell`

error[E0308]: mismatched types
  --> src/util.rs:74:23
   |
74 |     *msg.body_mut() = body;
   |                       ^^^^ expected struct `ton_types::cell::slice::SliceData`, found struct `SliceData`
   |
   = note: expected enum `std::option::Option<ton_types::cell::slice::SliceData>`
              found enum `std::option::Option<SliceData>`
   = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
  --> src/util.rs:99:23
   |
99 |     *msg.body_mut() = body;
   |                       ^^^^ expected struct `ton_types::cell::slice::SliceData`, found struct `SliceData`
   |
   = note: expected enum `std::option::Option<ton_types::cell::slice::SliceData>`
              found enum `std::option::Option<SliceData>`
   = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
  --> src/abi.rs:57:61
   |
57 |             let res = decode_unknown_function_call(abi_str, body.clone(), internal);
   |                                                             ^^^^^^^^^^^^ expected struct `ton_types::cell::slice::SliceData`, found struct `SliceData`
   |
   = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
   --> src/abi.rs:132:57
    |
132 |     if let Some(res) = gs.all_abis.decode_function_call(&body, internal) {
    |                                                         ^^^^^ expected struct `SliceData`, found struct `ton_types::cell::slice::SliceData`
    |
    = note: expected reference `&SliceData`
               found reference `&ton_types::cell::slice::SliceData`
    = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
   --> src/abi.rs:154:5
    |
153 |   ) -> Result<BuilderData, String> {
    |        --------------------------- expected `Result<BuilderData, std::string::String>` because of return type
154 | /     encode_function_call(
155 | |         abi_info.text().clone(),
156 | |         method.to_owned(),
157 | |         header,
...   |
160 | |         pair,
161 | |     ).map_err(|e| format!("cannot encode abi body: {:?}", e))
    | |_____________________________________________________________^ expected struct `BuilderData`, found struct `ton_types::cell::builder::BuilderData`
    |
    = note: expected enum `Result<BuilderData, _>`
               found enum `Result<ton_types::cell::builder::BuilderData, _>`
    = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
  --> src/actions.rs:94:33
   |
94 |             state_init.set_code(c);
   |                                 ^ expected struct `ton_types::cell::Cell`, found struct `ton_types::Cell`
   |
   = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
   --> src/actions.rs:179:31
    |
179 |             state.code = Some(new_code);
    |                               ^^^^^^^^ expected struct `ton_types::Cell`, found struct `ton_types::cell::Cell`
    |
    = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
   --> src/debug_info.rs:109:49
    |
109 |     let dict1 = HashmapE::with_hashmap(32, Some(root_cell.reference(0).unwrap()));
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `ton_types::Cell`, found struct `ton_types::cell::Cell`
    |
    = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
   --> src/debug_info.rs:110:49
    |
110 |     let dict2 = HashmapE::with_hashmap(32, Some(root_cell.reference(1).unwrap().reference(0).unwrap()));
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `ton_types::Cell`, found struct `ton_types::cell::Cell`
    |
    = note: perhaps two different versions of crate `ton_types` are being used?

error[E0277]: the trait bound `SliceData: From<ton_types::cell::Cell>` is not satisfied
   --> src/debug_info.rs:114:72
    |
114 |         let key = id.write_to_new_cell().unwrap().into_cell().unwrap().into();
    |                                                                        ^^^^ the trait `From<ton_types::cell::Cell>` is not implemented for `SliceData`
    |
    = help: the following implementations were found:
              <SliceData as From<&BuilderData>>
              <SliceData as From<&UInt256>>
              <SliceData as From<&[u8]>>
              <SliceData as From<&mut BuilderData>>
            and 6 others
    = note: required because of the requirements on the impl of `Into<SliceData>` for `ton_types::cell::Cell`

error[E0277]: the trait bound `SliceData: From<ton_types::cell::Cell>` is not satisfied
   --> src/debug_info.rs:134:72
    |
134 |         let key = id.write_to_new_cell().unwrap().into_cell().unwrap().into();
    |                                                                        ^^^^ the trait `From<ton_types::cell::Cell>` is not implemented for `SliceData`
    |
    = help: the following implementations were found:
              <SliceData as From<&BuilderData>>
              <SliceData as From<&UInt256>>
              <SliceData as From<&[u8]>>
              <SliceData as From<&mut BuilderData>>
            and 6 others
    = note: required because of the requirements on the impl of `Into<SliceData>` for `ton_types::cell::Cell`

error[E0277]: the trait bound `SliceData: From<ton_types::cell::Cell>` is not satisfied
   --> src/debug_info.rs:154:72
    |
154 |         let key = id.write_to_new_cell().unwrap().into_cell().unwrap().into();
    |                                                                        ^^^^ the trait `From<ton_types::cell::Cell>` is not implemented for `SliceData`
    |
    = help: the following implementations were found:
              <SliceData as From<&BuilderData>>
              <SliceData as From<&UInt256>>
              <SliceData as From<&[u8]>>
              <SliceData as From<&mut BuilderData>>
            and 6 others
    = note: required because of the requirements on the impl of `Into<SliceData>` for `ton_types::cell::Cell`

error[E0308]: mismatched types
   --> src/debug_info.rs:160:26
    |
160 |     hash2function.insert(root_cell.repr_hash(), "selector".to_owned());
    |                          ^^^^^^^^^^^^^^^^^^^^^ expected struct `UInt256`, found struct `ton_types::types::UInt256`
    |
    = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
   --> src/debug_info.rs:162:30
    |
162 |         hash2function.insert(selector2.repr_hash(), "selector2".to_owned());
    |                              ^^^^^^^^^^^^^^^^^^^^^ expected struct `UInt256`, found struct `ton_types::types::UInt256`
    |
    = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
   --> src/exec.rs:102:36
    |
102 |     let address0 = convert_address(state_init.hash().unwrap(), wc);
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `UInt256`, found struct `ton_types::types::UInt256`
    |
    = note: perhaps two different versions of crate `ton_types` are being used?

error[E0277]: the trait bound `ton_types::Cell: From<ton_types::cell::Cell>` is not satisfied
   --> src/call_contract.rs:131:40
    |
131 |         let msg_cell = StackItem::Cell(msg.serialize().unwrap().into());
    |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<ton_types::cell::Cell>` is not implemented for `ton_types::Cell`
    |
    = help: the following implementations were found:
              <ton_types::Cell as From<&BuilderData>>
              <ton_types::Cell as From<&mut BuilderData>>
              <ton_types::Cell as From<BuilderData>>
    = note: required because of the requirements on the impl of `Into<ton_types::Cell>` for `ton_types::cell::Cell`

error[E0277]: the trait bound `SliceData: From<ton_types::cell::slice::SliceData>` is not satisfied
   --> src/call_contract.rs:134:26
    |
134 |             Some(b) => b.into(),
    |                          ^^^^ the trait `From<ton_types::cell::slice::SliceData>` is not implemented for `SliceData`
    |
    = help: the following implementations were found:
              <SliceData as From<&BuilderData>>
              <SliceData as From<&UInt256>>
              <SliceData as From<&[u8]>>
              <SliceData as From<&mut BuilderData>>
            and 6 others
    = note: required because of the requirements on the impl of `Into<SliceData>` for `ton_types::cell::slice::SliceData`

error[E0308]: mismatched types
   --> src/call_contract.rs:212:40
    |
212 |                 state_init.data = Some(root_cell);
    |                                        ^^^^^^^^^ expected struct `ton_types::cell::Cell`, found struct `ton_types::Cell`
    |
    = note: perhaps two different versions of crate `ton_types` are being used?

error[E0277]: the trait bound `ton_types::cell::slice::SliceData: From<ton_types::Cell>` is not satisfied
   --> src/call_contract.rs:229:40
    |
229 |             OutActions::construct_from(&mut cell.into()).unwrap(),
    |                                        ^^^^^^^^^^^^^^^^ the trait `From<ton_types::Cell>` is not implemented for `ton_types::cell::slice::SliceData`
    |
    = help: the following implementations were found:
              <ton_types::cell::slice::SliceData as From<&[u8]>>
              <ton_types::cell::slice::SliceData as From<&mut ton_types::cell::builder::BuilderData>>
              <ton_types::cell::slice::SliceData as From<&ton_types::cell::Cell>>
              <ton_types::cell::slice::SliceData as From<&ton_types::cell::builder::BuilderData>>
            and 6 others
    = note: required because of the requirements on the impl of `Into<ton_types::cell::slice::SliceData>` for `ton_types::Cell`

error[E0277]: the trait bound `ton_types::cell::Cell: From<BuilderData>` is not satisfied
   --> src/call_contract.rs:259:43
    |
259 |             .unwrap_or(BuilderData::new().into())
    |                                           ^^^^ the trait `From<BuilderData>` is not implemented for `ton_types::cell::Cell`
    |
    = help: the following implementations were found:
              <ton_types::cell::Cell as From<&mut ton_types::cell::builder::BuilderData>>
              <ton_types::cell::Cell as From<&ton_types::cell::builder::BuilderData>>
              <ton_types::cell::Cell as From<ton_types::cell::builder::BuilderData>>
    = note: required because of the requirements on the impl of `Into<ton_types::cell::Cell>` for `BuilderData`

error[E0277]: the trait bound `SliceData: From<ton_types::cell::Cell>` is not satisfied
   --> src/call_contract.rs:260:14
    |
260 |             .into();
    |              ^^^^ the trait `From<ton_types::cell::Cell>` is not implemented for `SliceData`
    |
    = help: the following implementations were found:
              <SliceData as From<&BuilderData>>
              <SliceData as From<&UInt256>>
              <SliceData as From<&[u8]>>
              <SliceData as From<&mut BuilderData>>
            and 6 others
    = note: required because of the requirements on the impl of `Into<SliceData>` for `ton_types::cell::Cell`

error[E0277]: the trait bound `ton_types::cell::Cell: From<BuilderData>` is not satisfied
   --> src/call_contract.rs:263:43
    |
263 |             .unwrap_or(BuilderData::new().into())
    |                                           ^^^^ the trait `From<BuilderData>` is not implemented for `ton_types::cell::Cell`
    |
    = help: the following implementations were found:
              <ton_types::cell::Cell as From<&mut ton_types::cell::builder::BuilderData>>
              <ton_types::cell::Cell as From<&ton_types::cell::builder::BuilderData>>
              <ton_types::cell::Cell as From<ton_types::cell::builder::BuilderData>>
    = note: required because of the requirements on the impl of `Into<ton_types::cell::Cell>` for `BuilderData`

error[E0277]: the trait bound `SliceData: From<ton_types::cell::Cell>` is not satisfied
   --> src/call_contract.rs:264:14
    |
264 |             .into();
    |              ^^^^ the trait `From<ton_types::cell::Cell>` is not implemented for `SliceData`
    |
    = help: the following implementations were found:
              <SliceData as From<&BuilderData>>
              <SliceData as From<&UInt256>>
              <SliceData as From<&[u8]>>
              <SliceData as From<&mut BuilderData>>
            and 6 others
    = note: required because of the requirements on the impl of `Into<SliceData>` for `ton_types::cell::Cell`

error[E0277]: the trait bound `SliceData: From<ton_types::cell::Cell>` is not satisfied
   --> src/call_contract.rs:277:51
    |
277 |     let mut info = SmartContractInfo::with_myself(myself.serialize().unwrap().into());
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<ton_types::cell::Cell>` is not implemented for `SliceData`
    |
    = help: the following implementations were found:
              <SliceData as From<&BuilderData>>
              <SliceData as From<&UInt256>>
              <SliceData as From<&[u8]>>
              <SliceData as From<&mut BuilderData>>
            and 6 others
    = note: required because of the requirements on the impl of `Into<SliceData>` for `ton_types::cell::Cell`

error[E0308]: mismatched types
   --> src/call_contract.rs:279:43
    |
279 |     *info.balance_remaining_other_mut() = balance.1.other_as_hashmap().clone();
    |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `HashmapE`, found struct `ton_types::dictionary::hashmap::HashmapE`
    |
    = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
   --> src/messages.rs:475:29
    |
475 |         b.append_bytestring(&body).unwrap();
    |                             ^^^^^ expected struct `SliceData`, found struct `ton_types::cell::slice::SliceData`
    |
    = note: expected reference `&SliceData`
               found reference `&ton_types::cell::slice::SliceData`
    = note: perhaps two different versions of crate `ton_types` are being used?

error[E0277]: the trait bound `ton_types::cell::slice::SliceData: From<BuilderData>` is not satisfied
   --> src/messages.rs:531:25
    |
531 |                         BuilderData::with_raw(vec![0x55; 8], 64).unwrap().into()
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<BuilderData>` is not implemented for `ton_types::cell::slice::SliceData`
    |
    = help: the following implementations were found:
              <ton_types::cell::slice::SliceData as From<&[u8]>>
              <ton_types::cell::slice::SliceData as From<&mut ton_types::cell::builder::BuilderData>>
              <ton_types::cell::slice::SliceData as From<&ton_types::cell::Cell>>
              <ton_types::cell::slice::SliceData as From<&ton_types::cell::builder::BuilderData>>
            and 6 others
    = note: required because of the requirements on the impl of `Into<ton_types::cell::slice::SliceData>` for `BuilderData`

error[E0308]: mismatched types
   --> src/lib.rs:156:30
    |
156 |     let code = serialize_toc(&code).unwrap();
    |                              ^^^^^ expected struct `ton_types::Cell`, found `&ton_types::cell::Cell`
    |
    = note: expected reference `&ton_types::Cell`
               found reference `&&ton_types::cell::Cell`

error[E0308]: mismatched types
   --> src/lib.rs:159:30
    |
159 |     let data = serialize_toc(&data).unwrap();
    |                              ^^^^^ expected struct `ton_types::Cell`, found `&ton_types::cell::Cell`
    |
    = note: expected reference `&ton_types::Cell`
               found reference `&&ton_types::cell::Cell`

error[E0277]: the trait bound `ton_types::Cell: From<ton_types::cell::builder::BuilderData>` is not satisfied
   --> src/lib.rs:173:10
    |
173 |         .into();
    |          ^^^^ the trait `From<ton_types::cell::builder::BuilderData>` is not implemented for `ton_types::Cell`
    |
    = help: the following implementations were found:
              <ton_types::Cell as From<&BuilderData>>
              <ton_types::Cell as From<&mut BuilderData>>
              <ton_types::Cell as From<BuilderData>>
    = note: required because of the requirements on the impl of `Into<ton_types::Cell>` for `ton_types::cell::builder::BuilderData`

error[E0308]: mismatched types
   --> src/lib.rs:393:31
    |
393 |     let bytes = serialize_toc(&code).unwrap();
    |                               ^^^^^ expected struct `ton_types::Cell`, found struct `ton_types::cell::Cell`
    |
    = note: expected reference `&ton_types::Cell`
               found reference `&ton_types::cell::Cell`
    = note: perhaps two different versions of crate `ton_types` are being used?

error[E0308]: mismatched types
   --> src/lib.rs:402:31
    |
402 |     let bytes = serialize_toc(&data).unwrap();
    |                               ^^^^^ expected struct `ton_types::Cell`, found struct `ton_types::cell::Cell`
    |
    = note: expected reference `&ton_types::Cell`
               found reference `&ton_types::cell::Cell`
    = note: perhaps two different versions of crate `ton_types` are being used?

Oшибка при запуске: python3 setup.py develop

Traceback (most recent call last):
File "setup.py", line 10, in
with open(os.path.join(HERE, 'README_PYPI.md')) as fh:
FileNotFoundError: [Errno 2] No such file or directory: '/home/dima/TestSuite4-1/README_PYPI.md'

Может должно быть просто README.md или есть дополнительный файлик README_PYPI.md?

continue development in a new location

https://github.com/tonlabs/TestSuite4 will not be developed further; there is also the project https://github.com/disintar/toncli, which will also cease development.

There is an idea to merge the concepts of these two projects and continue development in a new location: https://github.com/ever-guild/TestSuite.

The goal is to provide a tool for testing contracts written for the TON virtual machine as well as for Everscale. Both technologies use the same TVM base, but there are some differences.

This tool will allow contracts for both networks to be tested in a unified style.

Testing contracts is an important task, but there are few good tools available for it, especially for complex contract systems.

🙋Please describe your expectations for this tool, as well as what you currently use for contract testing and what you find lacking in comment or https://t.me/ton_ts4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.