Giter Site home page Giter Site logo

ocamlpro / techelson Goto Github PK

View Code? Open in Web Editor NEW
18.0 7.0 5.0 1.33 MB

A test execution engine for Michelson smart contracts.

Home Page: https://ocamlpro.github.io/techelson

Shell 1.84% Makefile 0.08% OCaml 98.08%
tezos michelson liquidity testing

techelson's Introduction

Techelson Build Status

TEst miCHELSON: techelson.

A test execution engine for Michelson smart contracts.

Documentation

The user documentation is hosted here the main repository's github pages. Finally, there is a blog post by Techelson's main developer on how to use Techelson with Liquidity: adrienchampion.github.io/blog.

Features

Techelson is currently in beta. The rough list of (planned) features is

  • operation must-fail: specifies that a (chain of) operation(s) should fail
  • inspection instruction: break points and stack inspection
  • support for all data types (potentially with some liberty taken compared to tezos)
    • everything but signature
    • signature
  • semantics as close to the tezos protocol as possible
    • for non-crypto, non-packing-related operations (int, nat, map, etc.)
    • for crypto operations
    • internal packing and unpacking (packed and unpacked by Techelson)
    • arbitrary byte unpacking
  • support import of local michelson contracts
  • support retrieving the storage and code of contracts directly from the tezos blockchain

Build

We recommend to use the latest version of the OCaml compiler. Make sure you have opam installed, and run

> opam switch create techelson 4.07.1

Techelson relies on the dune build system and a few other libraries:

> opam install dune menhir zarith ptime stdint

(This list of dependencies might be out-of-date. Check .travis.sh for the latest version.) Finally, build Techelson with make. The binary will be ./bin/techelson.

You can also run make test to make sure there is no problem with the Techelson binary. The user documentation's root is docs/user_doc/index.html. You can regenerate it with make user-doc, as long as you have mdbook installed.

Usage

Assuming the binary Techelson is in you path, you can run it with

> techelson [ --contract <contract_file> ]* -- [ <testcase> ]*

Argument <contract_file> is a michelson contract (storage, parameter and code fields). <optional_init_file> is an optional initializer for the contract. It should contain two fields : parameter and code. The former is the type of data the initializer takes as input, and the latter is a (sequence of) michelson instruction(s) which, from a stack with a value of type parameter, produces a stack with a value of the storage type appearing in the <contract_file> associated with the initializer.

A <testcase> is a (sequence of) michelson instruction(s) which produce(s) a list of operations from an empty stack. Techelson runs all testcases sequentially and reports the errors it runs into.

For example

> techelson --contract rsc/tests/test0/contracts/test0.liq.tz -- rsc/tests/test0/okay/Test0Test1.techel

techelson's People

Contributors

adrienchampion avatar

Stargazers

 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

techelson's Issues

Getting error on Test16

When I run test16 I get:

$ make test
running tests for "rsc/tests/test16"
okay/Test16Test2.techel ...error /(T_T)
exit code: 127 (expected 0)
command: "./bin/techelson --contract rsc/tests/test16/contracts/test16.liq.tz -- rsc/tests/test16/okay/Test16Test2.techel"
make: *** [bin-test] Error 2

liquidity requires 4.06.1 and techelson requires 4.07.1

So another small error, I keep having to add

opam switch liquidity;

and

opam switch techelson;

to my test scripts since they require different environments according to the documentation. Is the documentation out of date for liquidity or is this expected behavior?

Techel.apply_operations how to catch a failure

Hi!

I would like to verify that a particular contract call fails. Is there a way to "catch" the failure of Techel.apply_operations - and verify the failure message?

Thanks ๐Ÿ˜„

Nested types cause "Unknown module or contract"

Hi there!

I'm setting out to build a tezos smart contract backed app. I'm using liquidity and techelson via my own testrunner sliq (just a cli passing contracts and tests to a docker image for exec).

I have an issues where when I try to use nested types I get <unspecified>: Error: Unknown module or contract Appstore from liquidity ๐Ÿค”

Here is my Appstore.reliq:

type app = {
  name: string,
  owner: address,
};

type storage =  map(string, app);

let%entry main = (name: string, store) => {
  let amount = Current.amount();

  if (amount < 5.00tz) {
    Current.failwith("Not enough money, at least 5tz to vote");
  };

  ([], store);
};

If I modify type storage = map(string, app); with type storage = map(string, string); it works as expected and tests are run.

Any help would be greatly appreciated ๐Ÿ˜„๐Ÿ‘

Let me know if this is a more approproate issue on the liquidity repo.

Thanks!

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.