GithubHelp home page GithubHelp logo

isabella232 / iele-semantics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from runtimeverification/iele-semantics

0.0 0.0 0.0 6.36 MB

Semantics of Virtual Machine for IELE prototype blockchain

License: Other

Shell 0.77% OCaml 5.21% Makefile 1.35% Python 3.07% Haskell 4.45% Dockerfile 0.28% C++ 1.26% C 0.05% JavaScript 0.06% HTML 82.16% Nix 0.88% Solidity 0.44%

iele-semantics's Introduction

IELE: Semantics of New Blockchain VM in K

In this repository we provide a model of IELE in K.

Structure

  • The file iele-syntax.md contains the syntax definition of IELE, along with comments that guide the reader through the structure of the language and links to more detailed descriptions of various features. This file is a good starting point for getting familiar with the language.
  • The file data.md explains the basic data of IELE (including words and some datastructures over them). This data is defined functionally.
  • iele.md is the file containing the semantics of IELE. This file contains the configuration (a map of the state), and a simple imperative execution machine which IELE lives on top of. It deals with the semantics of opcodes and parsing/unparsing/assembling/disassembling.
  • iele-gas.md describes gas price computations. iele-gas-summary.md summarizes them in a format readable by those who don't know K.
  • iele-binary.md defines the mnemonic for each opcode, and the disassembler.
  • iele-node.md defines the protobuf communication protocol used to plug the IELE VM into anonther client to make a full node.
  • iele-testing.md loads test-files from the Ethereum Test Set and executes them, checking that the output is correct. If the output is correct, the entire configuration is cleared. If any check fails, the configuration retains the failed check at the top of the <k> cell. iele-testing.md is also capable of executing tests of arbitrary IELE transactions (subject to the fact that this first release of IELE is still built on top of an ethereum-like network layer). The test format is based off of, but slightly different from, the ethereum BlockchainTest json test format.

Using the Definition

Installing/Building

See INSTALL.md.

Help/Version

Calling kiele help and kiele version will output the user guide and the KIELE version, respectively.

Assembler

The assembler takes textual IELE and produces IELE bytecode. For example, on the following file iele-examples/factorial.iele:

contract Factorial {

  define public @factorial(%n) {
    %lt = cmp lt %n, 0
    br %lt, throw

    %result = 1

  condition:
    %cond = cmp le %n, 0
    br %cond, after_loop

  loop_body:
    %result = mul %result, %n
    %n      = sub %n, 1
    br condition

  after_loop:
    ret %result

  throw:
    call @iele.invalid()
  }

  define @init() {}
}

You can run:

kiele assemble iele-examples/factorial.iele

To produce output:

0000004C6303690009666163746F7269616C6800010001618001100042650003026101036600006180011200446500020466000102001B610101030040640000660002F6000103660003FE6700000000

NOTE: Right now, if you use the NixOS package, you must call iele-assemble instead of kiele assemble.

KIELE Node

You can run a KIELE node, specifying the port to run on and use the KIELE test harness to run some transactions through it. To start the KIELE node, call (in one terminal):

kiele vm --port 9001

Then in a separate terminal, send a transaction through:

iele-test-vm tests/iele/danse/factorial/factorial_positive.iele.json 9001

You'll see the launched node record to the terminal a list of messages it sends and receives.

NOTE: The iele-test-vm executable is only available in a from-source build of KIELE. You can still launch and use the KIELE VM node without this executable.

Interpreter

Tests in the Ethereum Test Suite format can be run directly by the IELE interpreter.

For example, from this repository, you can run:

make assemble-iele-test -j4

To prepare the Ethereum test-suite. Then you can run an individual test, and see the post-state with:

kiele interpret tests/iele/danse/factorial/factorial_positive.iele.json.test-assembled

You may also run the interpreter with the Haskell backend instead (though it is significantly slower):

kiele interpret --backend haskell tests/iele/danse/factorial/factorial_positive.iele.json.test-assembled

NOTE: Printing the post-state will not work unless you are using a from-source build of KIELE. Instead, you should inspect the exit code of kiele interpret to see if the test passed or failed, by adding option --no-unparse to skip printing the post-state.

Well-Formedness Checker

The KIELE well-formedness checker will do some type-checking on the input IELE program, using exit code to indicate success/failure. For example, we can type-check the ERC20 contract example iele-examples/erc20.iele:

kiele check --schedule DANSE iele-examples/erc20.iele

NOTE: The KIELE well-formedness checker requires that (i) you are using a local build of KIELE, and (ii) you have installed K as well.

Contacting Us

To reach us, you can either use our chat, or open issues against this repository:

iele-semantics's People

Contributors

andreistefanescu avatar anvacaru avatar baltoli avatar bmmoore avatar brrmorre avatar dfilaretti avatar dwightguth avatar ehildenb avatar gazhayes avatar grosu avatar gtrepta avatar lucaspena avatar marick avatar msaxena2 avatar nishantjr avatar pmackay1982 avatar rv-jenkins avatar shd101wyy avatar theo25 avatar traiansf avatar ttuegel avatar virgil-serbanuta avatar vsubhuman avatar yzhang90 avatar zhuxiaoran07 avatar zzma avatar

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.