TestSuite4 is a framework designed to simplify development and testing of TON Contracts. It includes light-weight emulator of blockchain making it easy to develop contracts.

Related tags

Emulators TestSuite4
Overview

TestSuite4 0.1.2

TestSuite4 is a framework designed to simplify development and testing of TON Contracts. It contains lightweight blockchain emulator making it easy to develop contracts in a TDD-friendly style.

Features:

  • Speed - perform dozens of tests in just seconds.
  • Complex test scenarios - using Python as a scripting language allows you to create testing scenarios of varying complexity.
  • Deep Integration - access all internal messages, measure gas and control time.
  • Easy installation - use pip install tonos-ts4 to install TestSuite4 on your local Windows, Linux or macOS. You can also easily compile it from source if needed.

See tutorials for self-documented examples of framework usage.

List of tutorials

Quick Start

⚠️ You might need to replace python and pip with python3 and pip3 if you are running Linux or macOS.

If you have Python 3.6-3.9, pip and git installed on your system, you can proceed with the following steps.

  1. Install tonos-ts4 package:
pip install tonos-ts4
  1. Download tutorials from GitHub:
git clone [email protected]:tonlabs/TestSuite4.git
  1. ... and run the tutorials:
cd TestSuite4/tutorials
python tutorial01_getters.py

Building TestSuite4 from source

Prerequesites

  • Python 3.6-3.9
  • Latest version of Rust
  • Cargo tool

Build for Linux and macOS

cd linker_lib && cargo update && ./build_release.sh && cd -

Build for Windows

cd linker_lib && cargo update && build_release.sh && cd -

Install package in developer mode

python setup.py develop

Disable developer mode

python3 setup.py develop --uninstall

Run tutorials

cd tutorials
python tutorial01_getters.py
You might also like...
Emulator and debugger for LPRS1 ISA & CPU

About LPRSemu is a simple emulator and debugger for LPRS1 ISA & CPU. It supports loading programs from assembly text files, binary string representati

A hardware-accelerated GPU terminal emulator powered by WebGPU, focusing to run in desktops, browsers, tvs and everywhere.
A hardware-accelerated GPU terminal emulator powered by WebGPU, focusing to run in desktops, browsers, tvs and everywhere.

Rio term tl;dr: Rio is a terminal built to run everywhere, as a native desktop applications by Rust/WebGPU or even in the browser powered by WebAssemb

The Resurgence VM, a register virtual machine designed for simplicity and ease of use, based on the old Rendor VM
The Resurgence VM, a register virtual machine designed for simplicity and ease of use, based on the old Rendor VM

Resurgence Join the Discord server! Resurgence aims to be an embeddable virtual machine with an easy-to-use API for projects like: Game engines Langua

Commodore 64 emulator written in Rust
Commodore 64 emulator written in Rust

Rust64 - a C64 emulator written in Rust This is my attempt to study the Rust programming language and have fun at the same time. The goal is to presen

A Flash Player emulator written in Rust
A Flash Player emulator written in Rust

website | demo | nightly builds | wiki Ruffle Ruffle is an Adobe Flash Player emulator written in the Rust programming language. Ruffle targets both t

A Gameboy Emulator in Rust

RBoy A Gameboy Color Emulator written in Rust Implemented CPU All instructions correct All timings correct Double speed mode GPU Normal mode Color mod

RGB (Rust Game Boy) is a simple emulator for the original game boy
RGB (Rust Game Boy) is a simple emulator for the original game boy

RGB RGB (Rust Game Boy) is a simple emulator for the original game boy and the color game boy. Warning: This no longer compiles in the latest versions

Full featured Cross-platform GameBoy emulator by Rust. Forever boys!.
Full featured Cross-platform GameBoy emulator by Rust. Forever boys!.

Gameboy Full featured Cross-platform GameBoy emulator. Forever boys!. You can start a game with the following command, here with a built-in game "Boxe

NES emulator written in Rust to learn Rust

OxideNES A NES emulator in Rust. CPU should be accurate, PPU is mostly accurate, timing between the 2 is off for some corner cases and hardware qui

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

    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?

    opened by senitskiy 4
  • Cant compil

    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?
    
    
    opened by user090909 0
  • Contract methods in tests do not work the same way as in blockchain

    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)
    
    opened by nikitaghost 0
Owner
TON Labs
TON Labs is focused on developing the core infrastructure and an Open Source ecosystem for the Free TON
TON Labs
Emulator for the agon light 8-bit computer

agon-light-emulator This will be an emulator for the agon light (https://www.thebyteattic.com/p/agon.html) by Bernardo Kastrup. The ez80 emulation is

null 10 May 28, 2023
Nes-emulator - A NES emulator made to learn the Rust programming language

nes-emulator Building $ rustc --version rustc 1.32.0 (9fda7c223 2019-01-16) $ cargo --version cargo 1.32.0 (8610973aa 2019-01-02) $ cargo build --rel

Michael Burge 225 Dec 23, 2022
A Game Boy research project and emulator written in Rust

Mooneye GB Mooneye GB is a Game Boy research project and emulator written in Rust. The main goals of this project are accuracy and documentation. Some

Joonas Javanainen 802 Dec 28, 2022
RustBoyAdvance-NG is a Nintendo™ Game Boy Advance emulator and debugger, written in the rust programming language.

RustBoyAdvance-NG Nintendo GameBoy Advance ™ emulator and debugger, written in rust. WebAssembly Demo: https://michelhe.github.io/rustboyadvance-ng/ P

MishMish 510 Dec 30, 2022
Learn emulator and programming languages, target chip8, nes, gbc, gba ...

[WIP]learn emulator go-chip8 go run main.go source https://en.wikipedia.org/wiki/CHIP-8 http://devernay.free.fr/hacks/chip8/C8TECH10.HTM https://githu

早晨海风 4 Apr 30, 2021
A NES emulator written in Rust, with a focus on expandability and accuracy

A NES emulator written in Rust, with a focus on expandability and accuracy

Benjamin Mordaunt 4 Sep 19, 2022
Unicorn Emulator Debug Server - Written in Rust, with bindings of C, Go, Java and Python

udbserver - Unicorn Emulator Debug Server When you do emulation with Unicorn Engine, do you want to inspect the inner state during every step? udbserv

Bet4 246 Dec 27, 2022
Learning Rust and ECS by implementing an emulator for Silkroad Online.

Skrillax Learning Rust and ECS by implementing an emulator for an MMORPG. Skrillax is my learning project for playing around with Rust, learning about

Tim Hagemann 10 Dec 22, 2022
SCEMU The crates.io lib, x86 cpu and systems emulator focused mainly for anti-malware

SCEMU Usage Download the maps32.zip or maps64.zip from: https://github.com/sha0coder/scemu/releases/download/maps/maps32.zip https://github.com/sha0co

sha0coder 11 Dec 25, 2022
🥔 MOS-6502 and NES emulator in Rust (SDL/WebAssembly)

?? Potatis /mos6502 - Generic CPU emulator. Passes all tests, including illegal ops. (No BCD mode). /nes - A very incomplete NES emulator. /nes-sdl -

Henrik Persson 28 Jan 9, 2023